text
stringlengths 2
100k
| meta
dict |
---|---|
// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers. See the top-level LICENSE file for dates and other
// details. No copyright assignment is required to contribute to VisIt.
#include <QvisAppearanceWindow.h>
#include <QApplication>
#include <QCheckBox>
#include <QComboBox>
#include <QLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QStyleFactory>
#include <QvisColorButton.h>
#include <QvisDialogLineEdit.h>
#include <AppearanceAttributes.h>
#include <ViewerProxy.h>
// ****************************************************************************
// Method: QvisAppearanceWindow::QvisAppearanceWindow
//
// Purpose:
// This is the constructor for the QvisAppearanceWindow class.
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 6 12:27:16 PDT 2001
//
// Modifications:
// Brad Whitlock, Wed Apr 9 11:10:51 PDT 2008
// QString for caption, shortName.
//
// Kathleen Biagas, Fri Jan 22 14:12:09 PST 2016
// Retrieve style names from QStyleFactory.
//
// ****************************************************************************
QvisAppearanceWindow::QvisAppearanceWindow(AppearanceAttributes *subj,
const QString &caption, const QString &shortName, QvisNotepadArea *notepad) :
QvisPostableWindowObserver(subj, caption, shortName, notepad,
QvisPostableWindowObserver::ApplyButton)
{
styleNames = QStyleFactory::keys();
}
// ****************************************************************************
// Method: QvisAppearanceWindow::~QvisAppearanceWindow
//
// Purpose:
// This is the destructor for the QvisAppearanceWindow class.
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 6 12:28:27 PDT 2001
//
// Modifications:
//
// ****************************************************************************
QvisAppearanceWindow::~QvisAppearanceWindow()
{
// Nothing here
}
// ****************************************************************************
// Method: QvisAppearanceWindow::CreateWindowContents
//
// Purpose:
// This method creates the widgets for the window.
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 6 12:31:03 PDT 2001
//
// Modifications:
// Brad Whitlock, Tue Jan 29 13:16:20 PST 2002
// Added orientation combo box.
//
// Brad Whitlock, Fri Aug 15 13:08:37 PST 2003
// I changed how the style menu is populated.
//
// Brad Whitlock, Thu Mar 15 15:25:51 PST 2007
// Added font support.
//
// Brad Whitlock, Tue Apr 8 09:27:26 PDT 2008
// Support for internationalization.
//
// Brad Whitlock, Thu Jun 19 11:11:54 PDT 2008
// Qt 4.
//
// Cyrus Harrison, Mon Nov 24 11:57:42 PST 2008
// Support for default system appearance.
//
// Kathleen Biagas, Fri Jan 22 14:12:31 PST 2016
// styleNames now stored as a QStringList.
//
// ****************************************************************************
void
QvisAppearanceWindow::CreateWindowContents()
{
QGridLayout *mainLayout = new QGridLayout(0);
mainLayout->setSpacing(10);
topLayout->addLayout(mainLayout);
int row = 0;
useSysDefaultCheckBox = new QCheckBox(central);
connect(useSysDefaultCheckBox , SIGNAL(toggled(bool)),
this, SLOT(useSysDefaultChanged(bool)));
useSysDefaultCheckBox->setText(
tr("Use default system appearance"));
mainLayout->addWidget(useSysDefaultCheckBox,row,0,1,3);
row++;
// Create the background color button.
backgroundColorButton = new QvisColorButton(central);
connect(backgroundColorButton, SIGNAL(selectedColor(const QColor &)),
this, SLOT(backgroundChanged(const QColor &)));
mainLayout->addWidget(backgroundColorButton, row, 1);
backgroundColorLabel = new QLabel(tr("GUI background"), central);
backgroundColorLabel->setBuddy(backgroundColorButton);
mainLayout->addWidget(backgroundColorLabel, row, 0);
row++;
// Create the background color button.
foregroundColorButton = new QvisColorButton(central);
connect(foregroundColorButton, SIGNAL(selectedColor(const QColor &)),
this, SLOT(foregroundChanged(const QColor &)));
mainLayout->addWidget(foregroundColorButton, row, 1);
foregroundColorLabel = new QLabel(tr("GUI foreground"), central);
foregroundColorLabel->setBuddy(foregroundColorButton);
mainLayout->addWidget(foregroundColorLabel, row, 0);
row++;
// Create the style combo box.
styleComboBox = new QComboBox(central);
for(int i = 0; i < styleNames.size(); ++i)
styleComboBox->addItem(styleNames.at(i));
connect(styleComboBox, SIGNAL(activated(int)),
this, SLOT(styleChanged(int)));
mainLayout->addWidget(styleComboBox, row, 1);
styleLabel = new QLabel(tr("GUI style"), central);
styleLabel->setBuddy(styleComboBox);
mainLayout->addWidget(styleLabel, row, 0);
row++;
// Create the orientation combo box.
orientationComboBox = new QComboBox(central);
orientationComboBox->addItem(tr("Vertical"));
orientationComboBox->addItem(tr("Horizontal"));
connect(orientationComboBox, SIGNAL(activated(int)),
this, SLOT(orientationChanged(int)));
mainLayout->addWidget(orientationComboBox, row, 1);
orientationLabel = new QLabel(tr("GUI orientation"), central);
orientationLabel->setBuddy(orientationComboBox);
mainLayout->addWidget(orientationLabel, row, 0);
row++;
// Create the font edit.
fontName = new QvisDialogLineEdit(central);
fontName->setDialogMode(QvisDialogLineEdit::ChooseFont);
connect(fontName, SIGNAL(textChanged(const QString &)),
this, SLOT(fontNameChanged(const QString &)));
mainLayout->addWidget(fontName, row, 1, 1, 2);
fontLabel = new QLabel(tr("GUI font"), central);
fontLabel->setBuddy(fontName);
mainLayout->addWidget(fontLabel, row, 0);
row++;
}
// ****************************************************************************
// Method: QvisAppearanceWindow::UpdateWindow
//
// Purpose:
// This method is called when the appearance attributes are updated.
//
// Arguments:
// doAll : Whether or not to update all widgets.
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 6 12:57:29 PDT 2001
//
// Modifications:
// Brad Whitlock, Tue Jan 29 13:14:42 PST 2002
// Added orientation combo box.
//
// Brad Whitlock, Tue Apr 1 09:15:14 PDT 2003
// I made it use QColor's parsing instead of sscanf.
//
// Brad Whitlock, Fri Aug 15 13:10:28 PST 2003
// I changed how the styles are set.
//
// Brad Whitlock, Thu Mar 15 15:26:07 PST 2007
// Added font support.
//
// Brad Whitlock, Fri Dec 14 16:57:53 PST 2007
// Made it use ids.
//
// Brad Whitlock, Thu Jun 19 11:20:42 PDT 2008
// Qt 4.
//
// Cyrus Harrison, Mon Nov 24 11:57:42 PST 2008
// Support for default system appearance.
//
// Brad Whitlock, Tue Nov 25 15:52:04 PST 2008
// Make the window reflect the state object when we're using the
// system defaults.
//
// Kathleen Biagas, Fri Jan 22 14:12:31 PST 2016
// styleNames now stored as a QStringList.
//
// ****************************************************************************
void
QvisAppearanceWindow::UpdateWindow(bool doAll)
{
AppearanceAttributes *atts = (AppearanceAttributes *)subject;
int j;
for(int i = 0; i < atts->NumAttributes(); ++i)
{
if(!doAll)
{
if(!atts->IsSelected(i))
continue;
}
switch(i)
{
case AppearanceAttributes::ID_useSystemDefault:
{ // new scope
bool val = atts->GetUseSystemDefault();
useSysDefaultCheckBox->blockSignals(true);
if(val)
useSysDefaultCheckBox->setCheckState(Qt::Checked);
else
useSysDefaultCheckBox->setCheckState(Qt::Unchecked);
useSysDefaultCheckBox->blockSignals(false);
}
break;
case AppearanceAttributes::ID_background:
{ // new scope
QColor bg;
if(atts->GetUseSystemDefault())
bg = QColor(atts->GetDefaultBackground().c_str());
else
bg = QColor(atts->GetBackground().c_str());
backgroundColorButton->blockSignals(true);
backgroundColorButton->setButtonColor(bg);
backgroundColorButton->blockSignals(false);
}
break;
case AppearanceAttributes::ID_foreground:
{ // new scope
QColor fg;
if(atts->GetUseSystemDefault())
fg = QColor(atts->GetDefaultForeground().c_str());
else
fg = QColor(atts->GetForeground().c_str());
foregroundColorButton->blockSignals(true);
foregroundColorButton->setButtonColor(fg);
foregroundColorButton->blockSignals(false);
}
break;
case AppearanceAttributes::ID_fontName:
fontName->blockSignals(true);
if(atts->GetUseSystemDefault())
fontName->setText(atts->GetDefaultFontName().c_str());
else
fontName->setText(atts->GetFontName().c_str());
fontName->blockSignals(false);
break;
case AppearanceAttributes::ID_style:
{ // new scope
std::string styleName;
if(atts->GetUseSystemDefault())
styleName = atts->GetDefaultStyle();
else
styleName = atts->GetStyle();
for(j = 0; j < styleNames.size(); ++j)
{
if(styleName == styleNames.at(j).toStdString())
{
styleComboBox->blockSignals(true);
styleComboBox->setCurrentIndex(j);
styleComboBox->blockSignals(false);
break;
}
}
}
break;
case AppearanceAttributes::ID_orientation:
orientationComboBox->blockSignals(true);
if(atts->GetOrientation() == 0)
orientationComboBox->setCurrentIndex(0);
else
orientationComboBox->setCurrentIndex(1);
orientationComboBox->blockSignals(false);
break;
}
}
UpdateWindowSensitivity();
}
// ****************************************************************************
// Method: QvisAppearanceWindow::UpdateWindowSensitivity
//
// Purpose:
// This method is called to update window sensitivity
//
//
// Programmer: Cyrus Harrison
// Creation: Mon Nov 24 10:28:26 PST 2008
//
// Modifications:
//
// ****************************************************************************
void
QvisAppearanceWindow::UpdateWindowSensitivity()
{
AppearanceAttributes *atts = (AppearanceAttributes *)subject;
bool val = !atts->GetUseSystemDefault();
backgroundColorButton->setEnabled(val);
backgroundColorLabel->setEnabled(val);
foregroundColorButton->setEnabled(val);
foregroundColorLabel->setEnabled(val);
fontName->setEnabled(val);
fontLabel->setEnabled(val);
styleComboBox->setEnabled(val);
styleLabel->setEnabled(val);
orientationComboBox->setEnabled(val);
orientationLabel->setEnabled(val);
}
// ****************************************************************************
// Method: QvisAppearanceWindow::GetCurrentValues
//
// Purpose:
// This method gets the current values from line edits.
//
// Arguments:
// which : The index of the widget that we want to get.
//
// Programmer: Brad Whitlock
// Creation: Thu Mar 15 15:45:17 PST 2007
//
// Modifications:
// Brad Whitlock, Wed Nov 26 11:29:38 PDT 2008
// I removed code that no longer seemed needed.
//
// ****************************************************************************
void
QvisAppearanceWindow::GetCurrentValues(int which)
{
}
// ****************************************************************************
// Method: QvisAppearanceWindow::Apply
//
// Purpose:
// This method applies the changes to the appearance.
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 6 13:15:11 PST 2001
//
// Modifications:
// Brad Whitlock, Tue Sep 18 13:58:39 PST 2001
// Removed an unused variable.
//
// Brad Whitlock, Thu Mar 15 15:51:22 PST 2007
// Call GetCurrentValues.
//
// ****************************************************************************
void
QvisAppearanceWindow::Apply(bool ignore)
{
if(AutoUpdate() || ignore)
{
GetCurrentValues(-1);
emit changeAppearance(true);
}
}
// ****************************************************************************
// Method: QvisAppearanceWindow::apply
//
// Purpose:
// This is a Qt slot function that is called when the apply button is clicked.
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 6 13:16:09 PST 2001
//
// Modifications:
//
// ****************************************************************************
void
QvisAppearanceWindow::apply()
{
Apply(true);
}
// ****************************************************************************
// Method: QvisAppearanceWindow::ColorsNotTooClose
//
// Purpose:
// Prevents bad colors from being used together.
//
// Arguments:
// c0 : The first color to check.
// c1str : The string representation of the second color to check.
//
// Returns: True if the colors can be used together; false otherwise.
//
// Programmer: Brad Whitlock
// Creation: Fri Oct 3 10:02:10 PDT 2003
//
// Modifications:
// Brad Whitlock, Tue Apr 8 09:27:26 PDT 2008
// Support for internationalization.
//
// ****************************************************************************
bool
QvisAppearanceWindow::ColorsNotTooClose(const QColor &c0, const char *c1str)
{
QColor c1(c1str);
int dR = int(c0.red()) - int(c1.red());
int dG = int(c0.green()) - int(c1.green());
int dB = int(c0.blue()) - int(c1.blue());
const int threshold = 10;
bool rClose = dR > -threshold && dR < threshold;
bool gClose = dG > -threshold && dG < threshold;
bool bClose = dB > -threshold && dB < threshold;
bool retval = true;
if(rClose && gClose && bClose)
{
// Update the window so the color buttons get set back properly.
UpdateWindow(true);
// Tell the user that it was a bad idea.
Warning(tr("The background color and foreground color will not be "
"changed because the selected colors are too similar and "
"using them would make it too difficult to use VisIt."));
retval = false;
}
return retval;
}
// ****************************************************************************
// Method: QvisAppearanceWindow::useSysDefaultChanged
//
// Purpose:
// This is a Qt slot function that is called when the user changes the
// the "Use System Default Appearance" Check Box.
//
// Arguments:
// state : The check state.
//
// Programmer: Cyrus Harrison
// Creation: Mon Nov 24 10:20:10 PST 2008
//
// Modifications:
//
// ****************************************************************************
void
QvisAppearanceWindow::useSysDefaultChanged(bool val)
{
AppearanceAttributes *atts = (AppearanceAttributes *)subject;
atts->SetUseSystemDefault(val);
atts->SelectAll();
atts->Notify();
}
// ****************************************************************************
// Method: QvisAppearanceWindow::backgroundChanged
//
// Purpose:
// This is a Qt slot function that is called when the user changes the GUI
// background color via the color button.
//
// Arguments:
// bg : The new background color.
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 6 13:16:36 PST 2001
//
// Modifications:
// Brad Whitlock, Fri Oct 3 10:03:19 PDT 2003
// Prevented bad colors from being used together.
//
// ****************************************************************************
void
QvisAppearanceWindow::backgroundChanged(const QColor &bg)
{
AppearanceAttributes *atts = (AppearanceAttributes *)subject;
if(ColorsNotTooClose(bg, atts->GetForeground().c_str()))
{
QString tmp;
tmp.sprintf("#%02x%02x%02x", bg.red(), bg.green(), bg.blue());
atts->SetBackground(tmp.toStdString());
SetUpdate(false);
Apply();
}
}
// ****************************************************************************
// Method: QvisAppearanceWindow::foregroundChanged
//
// Purpose:
// This is a Qt slot function that is called when the user changes the GUI
// foreground color via the color button.
//
// Arguments:
// fg : The new foreground color.
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 6 13:16:36 PST 2001
//
// Modifications:
// Brad Whitlock, Fri Oct 3 10:03:19 PDT 2003
// Prevented bad colors from being used together.
//
// ****************************************************************************
void
QvisAppearanceWindow::foregroundChanged(const QColor &fg)
{
AppearanceAttributes *atts = (AppearanceAttributes *)subject;
if(ColorsNotTooClose(fg, atts->GetBackground().c_str()))
{
QString tmp;
tmp.sprintf("#%02x%02x%02x", fg.red(), fg.green(), fg.blue());
atts->SetForeground(tmp.toStdString());
SetUpdate(false);
Apply();
}
}
// ****************************************************************************
// Method: QvisAppearanceWindow::styleChanged
//
// Purpose:
// This is a Qt slot function that is called when the user changes the style.
//
// Arguments:
// index : The index of the new style.
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 6 13:17:42 PST 2001
//
// Modifications:
// Brad Whitlock, Fri Aug 15 13:11:13 PST 2003
// I made it use a table lookup.
//
// Kathleen Biagas, Fri Jan 22 14:12:31 PST 2016
// styleNames now stored as a QStringList.
//
// ****************************************************************************
void
QvisAppearanceWindow::styleChanged(int index)
{
AppearanceAttributes *atts = (AppearanceAttributes *)subject;
atts->SetStyle(styleNames.at(index).toStdString());
SetUpdate(false);
Apply();
}
// ****************************************************************************
// Method: QvisAppearanceWindow::fontNameChanged
//
// Purpose:
// This is a Qt slot function that is called when the Font... button is
// clicked.
//
// Programmer: Brad Whitlock
// Creation: Thu Sep 6 19:38:04 PST 2001
//
// Modifications:
// Brad Whitlock, Thu Mar 15 15:31:57 PST 2007
// Rewrote.
//
// ****************************************************************************
void
QvisAppearanceWindow::fontNameChanged(const QString &newFont)
{
AppearanceAttributes *atts = (AppearanceAttributes *)subject;
atts->SetFontName(newFont.toStdString());
SetUpdate(false);
Apply();
}
// ****************************************************************************
// Method: QvisAppearanceWindow::orientationChanged
//
// Purpose:
// This is a Qt slot function that is called when the orientation is changed.
//
// Arguments:
// index : The new orientation.
//
// Programmer: Brad Whitlock
// Creation: Tue Jan 29 13:21:26 PST 2002
//
// Modifications:
//
// ****************************************************************************
void
QvisAppearanceWindow::orientationChanged(int index)
{
AppearanceAttributes *atts = (AppearanceAttributes *)subject;
atts->SetOrientation((index == 0) ? 0 : 2);
SetUpdate(false);
Apply();
}
| {
"pile_set_name": "Github"
} |
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package rafthttp
import (
"encoding/binary"
"errors"
"io"
"github.com/coreos/etcd/pkg/pbutil"
"github.com/coreos/etcd/raft/raftpb"
)
// messageEncoder is a encoder that can encode all kinds of messages.
// It MUST be used with a paired messageDecoder.
type messageEncoder struct {
w io.Writer
}
func (enc *messageEncoder) encode(m *raftpb.Message) error {
if err := binary.Write(enc.w, binary.BigEndian, uint64(m.Size())); err != nil {
return err
}
_, err := enc.w.Write(pbutil.MustMarshal(m))
return err
}
// messageDecoder is a decoder that can decode all kinds of messages.
type messageDecoder struct {
r io.Reader
}
var (
readBytesLimit uint64 = 512 * 1024 * 1024 // 512 MB
ErrExceedSizeLimit = errors.New("rafthttp: error limit exceeded")
)
func (dec *messageDecoder) decode() (raftpb.Message, error) {
return dec.decodeLimit(readBytesLimit)
}
func (dec *messageDecoder) decodeLimit(numBytes uint64) (raftpb.Message, error) {
var m raftpb.Message
var l uint64
if err := binary.Read(dec.r, binary.BigEndian, &l); err != nil {
return m, err
}
if l > numBytes {
return m, ErrExceedSizeLimit
}
buf := make([]byte, int(l))
if _, err := io.ReadFull(dec.r, buf); err != nil {
return m, err
}
return m, m.Unmarshal(buf)
}
| {
"pile_set_name": "Github"
} |
@page "/sliders"
<h3>Slider 滑块</h3>
<h4>通过拖动滑块在一个固定区间内进行选择</h4>
<Block Title="基础用法" Introduction="在拖动滑块时,改变当前值" CodeFile="slider.1.html">
<Slider></Slider>
<Slider Value="50" Label="自定义初始值"></Slider>
<Slider Value="42" IsDisabled="true" Label="禁用"></Slider>
</Block>
<Block Title="Slider 双向绑定" Introduction="通过拖动滑块在一个固定区间内进行选择" CodeFile="slider.2.html">
<div class="form-inline">
<div class="row">
<div class="form-group col-12 col-sm-8">
<Slider @bind-Value="@BindValue" Label="自定义初始值"></Slider>
</div>
<div class="form-group col-12 col-sm-4">
<BootstrapInput @bind-Value="@BindValue" readonly></BootstrapInput>
</div>
</div>
</div>
</Block>
<AttributeTable Items="@GetAttributes()" />
<EventTable Items="@GetEvents()" />
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="/benchmark/js/jquery.min.js"></script>
<script type="text/javascript" src="/benchmark/js/js.cookie.js"></script>
<title>BenchmarkTest01358</title>
</head>
<body>
<form action="/benchmark/weakrand-03/BenchmarkTest01358" method="GET" id="FormBenchmarkTest01358">
<div><label>Please enter your details:</label></div>
<br/>
<div><label>Username:</label></div>
<div><input type="text" id="username" name="username"></input></div>
<div><label>Password:</label></div>
<div><input type="text" id="password" name="password" value=""></input></div>
<div> </div>
<div><label>Parameter: BenchmarkTest01358 <BR> Value:</label>
<input type="text" id="BenchmarkTest01358" name="BenchmarkTest01358" value="whatever"></input></div>
<br/>
<div><input type="submit" value="Login" /></div>
</form>
</body>
</html>
| {
"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 groovy.lang;
import org.codehaus.groovy.transform.GroovyASTTransformationClass;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation that supports writing constructor call expressions without the 'new'
* keyword. Instead they can be written "Ruby-style" as a method call to a 'new'
* method or "Python-style" by just omitting the keyword missing.
* <p>
* It allows you to write code snippets like this ("Python-style"):
* <pre>
* {@code @Newify([Tree,Leaf])} class MyTreeProcessor {
* def myTree = Tree(Tree(Leaf("A"), Leaf("B")), Leaf("C"))
* def process() { ... }
* }
* </pre>
* or this ("Ruby-style"):
* <pre>
* {@code @Newify} class MyTreeProcessor {
* def myTree = Tree.new(Tree.new(Leaf.new("A"), Leaf.new("B")), Leaf.new("C"))
* def process() { ... }
* }
* </pre>
*
* After the AST transformation, the following code is passed on for further compilation:
* <pre>
* class MyTreeProcessor {
* def myTree = new Tree(new Tree(new Leaf("A"), new Leaf("B")), new Leaf("C"))
* def process() { ... }
* }
* </pre>
* The annotation can be used on a whole class as shown above or selectively on a particular
* method, constructor or field.
* <p>
* The "Ruby-style" new conversions occur automatically unless the 'auto=false'
* flag is given when using the annotation. You might do this if you create a new method
* using meta programming.
* <p>
* The "Python-style" conversions require you to specify each class on which you want them
* to apply. The transformation then works by matching the basename of the provided classes to any
* similarly named instance method calls not specifically bound to an object, i.e. associated
* with the 'this' object. In other words <code>Leaf("A")</code> would be transformed to
* <code>new Leaf("A")</code> but <code>x.Leaf("A")</code> would not be touched.
* <p>
* An example showing how to use the annotation at different levels:
* <pre>
* {@code @Newify(auto=false, value=Foo)}
* class Main {
* {@code @Newify} // turn auto on for field
* def field1 = java.math.BigInteger.new(42)
* def field2, field3, field4
*
* {@code @Newify(Bar)}
* def process() {
* field2 = Bar("my bar")
* }
*
* {@code @Newify(Baz)}
* Main() {
* field3 = Foo("my foo")
* field4 = Baz("my baz")
* }
* }
* </pre>
*
* The annotation is intended to be used sparingly; perhaps in DSL scenarios or when
* using deeply nested structural types. In particular, there is no support for using
* the facility with two similarly named classes from different packages at the same time.
* Though it is OK to have different packages in different contexts. Also, there is
* no support for turning "Ruby-style" conversions off at the method, constructor or
* field level if already turned on at the class level.
*
* @author Paul King
*/
@java.lang.annotation.Documented
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.TYPE, ElementType.FIELD, ElementType.LOCAL_VARIABLE})
@GroovyASTTransformationClass("org.codehaus.groovy.transform.NewifyASTTransformation")
public @interface Newify {
Class[] value();
/**
* @return if automatic conversion of "Ruby-style" new method calls should occur
*/
boolean auto() default true;
}
| {
"pile_set_name": "Github"
} |
/* SPDX-License-Identifier: GPL-2.0 */
#define memset MEMSET /* don't hide glibc's memset() */
#define altinstr_replacement text
#define globl p2align 4; .globl
#include "../../arch/x86/lib/memset_64.S"
/*
* We need to provide note.GNU-stack section, saying that we want
* NOT executable stack. Otherwise the final linking will assume that
* the ELF stack should not be restricted at all and set it RWX.
*/
.section .note.GNU-stack,"",@progbits
| {
"pile_set_name": "Github"
} |
#ifndef _PENNER_CUBIC
#define _PENNER_CUBIC
class Cubic {
public:
static float easeIn(float t,float b , float c, float d);
static float easeOut(float t,float b , float c, float d);
static float easeInOut(float t,float b , float c, float d);
};
#endif | {
"pile_set_name": "Github"
} |
v3
4
230346 230350 part-r-00000 0
231370 231374 part-r-00001 1
232394 232398 part-r-00002 2
233418 233422 part-r-00003 3
| {
"pile_set_name": "Github"
} |
---
layout: base
title: 'Statistics of Degree in UD_Dutch'
udver: '2'
---
## Treebank Statistics: UD_Dutch: Features: `Degree`
This feature is universal.
It occurs with 3 different values: `Cmp`, `Pos`, `Sup`.
13682 tokens (7%) have a non-empty value of `Degree`.
3646 types (13%) occur at least once with a non-empty value of `Degree`.
2561 lemmas (11%) occur at least once with a non-empty value of `Degree`.
The feature is used with 1 part-of-speech tags: <tt><a href="nl-pos-ADJ.html">ADJ</a></tt> (13682; 7% instances).
### `ADJ`
13682 <tt><a href="nl-pos-ADJ.html">ADJ</a></tt> tokens (96% of all `ADJ` tokens) have a non-empty value of `Degree`.
`ADJ` tokens may have the following values of `Degree`:
* `Cmp` (707; 5% of non-empty `Degree`): <em>verder, beter, later, jongeren, langer, groter, grotere, hoger, vroeger, vroegere</em>
* `Pos` (12497; 91% of non-empty `Degree`): <em>nieuwe, grote, andere, Nederlandse, goed, heel, groot, goede, Amerikaanse, eigen</em>
* `Sup` (478; 3% of non-empty `Degree`): <em>laatste, grootste, beste, belangrijkste, hoogste, best, hoogst, jongste, voornaamste, oudste</em>
* `EMPTY` (580): <em>eerste, tweede, derde, eerst, vierde, vijfde, zevende, 19e, dertiende, negende</em>
<table>
<tr><th>Paradigm <i>groot</i></th><th><tt>Pos</tt></th><th><tt>Cmp</tt></th><th><tt>Sup</tt></th></tr>
<tr><td><tt></tt></td><td><em>grote, groot, groten</em></td><td><em>grotere, groter</em></td><td><em>grootste, grootst</em></td></tr>
</table>
`Degree` seems to be **lexical feature** of `ADJ`. 94% lemmas (2416) occur only with one value of `Degree`.
## Relations with Agreement in `Degree`
The 10 most frequent relations where parent and child node agree in `Degree`:
<tt>ADJ --[<tt><a href="nl-dep-advmod.html">advmod</a></tt>]--> ADJ</tt> (418; 89%),
<tt>ADJ --[<tt><a href="nl-dep-conj.html">conj</a></tt>]--> ADJ</tt> (235; 93%),
<tt>ADJ --[<tt><a href="nl-dep-amod.html">amod</a></tt>]--> ADJ</tt> (48; 76%),
<tt>ADJ --[<tt><a href="nl-dep-fixed.html">fixed</a></tt>]--> ADJ</tt> (33; 92%),
<tt>ADJ --[<tt><a href="nl-dep-parataxis.html">parataxis</a></tt>]--> ADJ</tt> (19; 79%),
<tt>ADJ --[<tt><a href="nl-dep-advcl.html">advcl</a></tt>]--> ADJ</tt> (16; 52%),
<tt>ADJ --[<tt><a href="nl-dep-obl.html">obl</a></tt>]--> ADJ</tt> (9; 100%),
<tt>ADJ --[<tt><a href="nl-dep-nsubj.html">nsubj</a></tt>]--> ADJ</tt> (7; 78%),
<tt>ADJ --[<tt><a href="nl-dep-csubj.html">csubj</a></tt>]--> ADJ</tt> (5; 83%),
<tt>ADJ --[<tt><a href="nl-dep-ccomp.html">ccomp</a></tt>]--> ADJ</tt> (3; 100%).
| {
"pile_set_name": "Github"
} |
require('../modules/es6.reflect.apply');
require('../modules/es6.reflect.construct');
require('../modules/es6.reflect.define-property');
require('../modules/es6.reflect.delete-property');
require('../modules/es6.reflect.enumerate');
require('../modules/es6.reflect.get');
require('../modules/es6.reflect.get-own-property-descriptor');
require('../modules/es6.reflect.get-prototype-of');
require('../modules/es6.reflect.has');
require('../modules/es6.reflect.is-extensible');
require('../modules/es6.reflect.own-keys');
require('../modules/es6.reflect.prevent-extensions');
require('../modules/es6.reflect.set');
require('../modules/es6.reflect.set-prototype-of');
module.exports = require('../modules/$.core').Reflect; | {
"pile_set_name": "Github"
} |
describe("j$.pp (HTML Dependent)", function () {
it("should stringify HTML nodes properly", function() {
var sampleNode = document.createElement('div');
sampleNode.innerHTML = 'foo<b>bar</b>';
expect(j$.pp(sampleNode)).toEqual("HTMLNode");
expect(j$.pp({foo: sampleNode})).toEqual("{ foo: HTMLNode }");
});
it("should print Firefox's wrapped native objects correctly", function() {
if(jasmine.getEnv().firefoxVersion) {
try { new CustomEvent(); } catch(e) { var err = e; };
expect(j$.pp(err)).toMatch(/Not enough arguments/);
}
});
});
| {
"pile_set_name": "Github"
} |
// go run mksyscall.go -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build linux,arm
package unix
import (
"syscall"
"unsafe"
)
var _ syscall.Errno
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) {
r0, _, e1 := Syscall(SYS_FANOTIFY_INIT, uintptr(flags), uintptr(event_f_flags), 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 fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) {
_, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(mask>>32), uintptr(dirFd), uintptr(unsafe.Pointer(pathname)))
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) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_FCHMODAT, 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 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 Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (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 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), 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 openat(dirfd int, path string, flags int, mode 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(flags), uintptr(mode), 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 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 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 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 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 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
}
// 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 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 KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(arg2)
if err != nil {
return
}
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(arg3)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(arg4)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
var _p0 unsafe.Pointer
if len(payload) > 0 {
_p0 = unsafe.Pointer(&payload[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(keyType)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(restriction)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), 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 keyctlRestrictKeyring(cmd int, arg2 int) (err error) {
_, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(arg)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), 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 mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(source)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(target)
if err != nil {
return
}
var _p2 *byte
_p2, err = BytePtrFromString(fstype)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Acct(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_ACCT, 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 AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(keyType)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(description)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(payload) > 0 {
_p2 = unsafe.Pointer(&payload[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
id = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Adjtimex(buf *Timex) (state int, err error) {
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
state = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Capget(hdr *CapUserHeader, data *CapUserData) (err error) {
_, _, e1 := Syscall(SYS_CAPGET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Capset(hdr *CapUserHeader, data *CapUserData) (err error) {
_, _, e1 := Syscall(SYS_CAPSET, uintptr(unsafe.Pointer(hdr)), uintptr(unsafe.Pointer(data)), 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 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 ClockGetres(clockid int32, res *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETRES, uintptr(clockid), uintptr(unsafe.Pointer(res)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) {
_, _, e1 := Syscall6(SYS_CLOCK_NANOSLEEP, uintptr(clockid), uintptr(flags), uintptr(unsafe.Pointer(request)), uintptr(unsafe.Pointer(remain)), 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 CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), 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 DeleteModule(name string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(name)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_DELETE_MODULE, 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 Dup(oldfd int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 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 Dup3(oldfd int, newfd int, flags int) (err error) {
_, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollCreate1(flag int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 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 EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) {
_, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Eventfd(initval uint, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_EVENTFD2, uintptr(initval), uintptr(flags), 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 Exit(code int) {
SyscallNoError(SYS_EXIT_GROUP, uintptr(code), 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fallocate(fd int, mode uint32, off int64, len int64) (err error) {
_, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(off>>32), uintptr(len), uintptr(len>>32))
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 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 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 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 Fdatasync(fd int) (err error) {
_, _, e1 := Syscall(SYS_FDATASYNC, 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 Fgetxattr(fd int, attr string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(dest) > 0 {
_p1 = unsafe.Pointer(&dest[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)), 0, 0)
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func FinitModule(fd int, params string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(params)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_FINIT_MODULE, uintptr(fd), 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 Flistxattr(fd int, dest []byte) (sz int, err error) {
var _p0 unsafe.Pointer
if len(dest) > 0 {
_p0 = unsafe.Pointer(&dest[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_FLISTXATTR, uintptr(fd), uintptr(_p0), uintptr(len(dest)))
sz = int(r0)
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 Fremovexattr(fd int, attr string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(attr)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fsetxattr(fd int, attr string, dest []byte, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(dest) > 0 {
_p1 = unsafe.Pointer(&dest[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)), uintptr(flags), 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 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_GETDENTS64, 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 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 Getpid() (pid int) {
r0, _ := RawSyscallNoError(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, _ := RawSyscallNoError(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 Getrandom(buf []byte, flags int) (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_GETRANDOM, uintptr(_p0), uintptr(len(buf)), 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 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 Gettid() (tid int) {
r0, _ := RawSyscallNoError(SYS_GETTID, 0, 0, 0)
tid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(dest) > 0 {
_p2 = unsafe.Pointer(&dest[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func InitModule(moduleImage []byte, params string) (err error) {
var _p0 unsafe.Pointer
if len(moduleImage) > 0 {
_p0 = unsafe.Pointer(&moduleImage[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
var _p1 *byte
_p1, err = BytePtrFromString(params)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_INIT_MODULE, uintptr(_p0), uintptr(len(moduleImage)), 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 InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func InotifyInit1(flags int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 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 InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) {
r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0)
success = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Kill(pid int, sig syscall.Signal) (err error) {
_, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Klogctl(typ 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_SYSLOG, uintptr(typ), 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 Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(dest) > 0 {
_p2 = unsafe.Pointer(&dest[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Listxattr(path string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(dest) > 0 {
_p1 = unsafe.Pointer(&dest[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Llistxattr(path string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(dest) > 0 {
_p1 = unsafe.Pointer(&dest[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lremovexattr(path string, attr string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LREMOVEXATTR, 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 Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(data) > 0 {
_p2 = unsafe.Pointer(&data[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func MemfdCreate(name string, flags int) (fd int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(name)
if err != nil {
return
}
r0, _, e1 := Syscall(SYS_MEMFD_CREATE, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 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 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 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 PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) {
r0, _, e1 := Syscall6(SYS_PERF_EVENT_OPEN, uintptr(unsafe.Pointer(attr)), uintptr(pid), uintptr(cpu), uintptr(groupFd), uintptr(flags), 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 PivotRoot(newroot string, putold string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(newroot)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(putold)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, 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 prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) {
_, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)))
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 Removexattr(path string, attr string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, 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 Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (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 := Syscall6(SYS_RENAMEAT2, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), 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 RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(keyType)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(description)
if err != nil {
return
}
var _p2 *byte
_p2, err = BytePtrFromString(callback)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
id = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setdomainname(p []byte) (err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Sethostname(p []byte) (err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 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 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(tv *Timeval) (err error) {
_, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, 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 Setns(fd int, nstype int) (err error) {
_, _, e1 := Syscall(SYS_SETNS, uintptr(fd), uintptr(nstype), 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 Setxattr(path string, attr string, data []byte, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(data) > 0 {
_p2 = unsafe.Pointer(&data[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) {
r0, _, e1 := Syscall6(SYS_SIGNALFD4, uintptr(fd), uintptr(unsafe.Pointer(sigmask)), uintptr(maskSize), uintptr(flags), 0, 0)
newfd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), 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 Sync() {
SyscallNoError(SYS_SYNC, 0, 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Syncfs(fd int) (err error) {
_, _, e1 := Syscall(SYS_SYNCFS, 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 Sysinfo(info *Sysinfo_t) (err error) {
_, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
r0, r1, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0)
n = int64(int64(r1)<<32 | int64(r0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) {
_, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Times(tms *Tms) (ticks uintptr, err error) {
r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0)
ticks = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Umask(mask int) (oldmask int) {
r0, _ := RawSyscallNoError(SYS_UMASK, uintptr(mask), 0, 0)
oldmask = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Uname(buf *Utsname) (err error) {
_, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unmount(target string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(target)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, 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 Unshare(flags int) (err error) {
_, _, e1 := Syscall(SYS_UNSHARE, 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 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 exitThread(code int) (err error) {
_, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 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, p *byte, np int) (n int, err error) {
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np))
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, p *byte, np int) (n int, err error) {
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np))
n = int(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 Madvise(b []byte, advice 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(advice))
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 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 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 faccessat(dirfd int, path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_FACCESSAT, 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 nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NAME_TO_HANDLE_AT, uintptr(dirFD), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(fh)), uintptr(unsafe.Pointer(mountID)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN_BY_HANDLE_AT, uintptr(mountFD), uintptr(unsafe.Pointer(fh)), uintptr(flags))
fd = int(r0)
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 pipe2(p *[2]_C_int, flags int) (err error) {
_, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
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 accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 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 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 getgroups(n int, list *_Gid_t) (nn int, err error) {
r0, _, e1 := RawSyscall(SYS_GETGROUPS32, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
nn = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setgroups(n int, list *_Gid_t) (err error) {
_, _, e1 := RawSyscall(SYS_SETGROUPS32, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
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 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 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 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 socketpair(domain int, typ int, flags int, fd *[2]int32) (err error) {
_, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(flags), 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 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 Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollCreate(size int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 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 EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 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 Fchown(fd int, uid int, gid int) (err error) {
_, _, e1 := Syscall(SYS_FCHOWN32, 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 Fstat(fd int, stat *Stat_t) (err error) {
_, _, e1 := Syscall(SYS_FSTAT64, 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(dirfd int, path string, stat *Stat_t, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(dirfd), 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 Getegid() (egid int) {
r0, _ := RawSyscallNoError(SYS_GETEGID32, 0, 0, 0)
egid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Geteuid() (euid int) {
r0, _ := RawSyscallNoError(SYS_GETEUID32, 0, 0, 0)
euid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getgid() (gid int) {
r0, _ := RawSyscallNoError(SYS_GETGID32, 0, 0, 0)
gid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getuid() (uid int) {
r0, _ := RawSyscallNoError(SYS_GETUID32, 0, 0, 0)
uid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func InotifyInit() (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 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_LCHOWN32, 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 Listen(s int, n int) (err error) {
_, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 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_LSTAT64, 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 Pause() (err error) {
_, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Renameat(olddirfd int, 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 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), 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 sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0)
written = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 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 Setfsgid(gid int) (err error) {
_, _, e1 := Syscall(SYS_SETFSGID32, 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 Setfsuid(uid int) (err error) {
_, _, e1 := Syscall(SYS_SETFSUID32, 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 Setregid(rgid int, egid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREGID32, 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 Setresgid(rgid int, egid int, sgid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESGID32, 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_SETRESUID32, 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 Setreuid(ruid int, euid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREUID32, 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 Shutdown(fd int, how int) (err error) {
_, _, e1 := Syscall(SYS_SHUTDOWN, 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 Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), 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 Stat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STAT64, 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 Ustat(dev int, ubuf *Ustat_t) (err error) {
_, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func futimesat(dirfd int, path string, times *[2]Timeval) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)))
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 utimes(path string, times *[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(times)), 0)
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_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32))
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_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), uintptr(offset>>32))
n = int(r0)
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 := Syscall6(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length), uintptr(length>>32), 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 := Syscall6(SYS_FTRUNCATE64, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) {
r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset))
xaddr = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getrlimit(resource int, rlim *rlimit32) (err error) {
_, _, e1 := RawSyscall(SYS_UGETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setrlimit(resource int, rlim *rlimit32) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
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 armSyncFileRange(fd int, flags int, off int64, n int64) (err error) {
_, _, e1 := Syscall6(SYS_ARM_SYNC_FILE_RANGE, uintptr(fd), uintptr(flags), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(cmdline)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
| {
"pile_set_name": "Github"
} |
#!/bin/sh
current_path=$(readlink -f $0)
export bindir=$(dirname $current_path)
export PATH=$bindir/bin:$PATH
export SKIP_KNOWN_BUGS=1
cd testsuite || exit 1
LANG=C.UTF-8 ./runtest -v | sed -r 's/^(SKIPPED|UNTESTED):/SKIP:/'
| {
"pile_set_name": "Github"
} |
import "dart:typed_data";
import "dart:convert";
import "actor_component.dart";
import "actor_event.dart";
import "actor_node.dart";
import "actor_node_solo.dart";
import "actor_bone.dart";
import "actor_root_bone.dart";
import "actor_jelly_bone.dart";
import "jelly_component.dart";
import "actor_ik_constraint.dart";
import "actor_rotation_constraint.dart";
import "actor_translation_constraint.dart";
import "actor_distance_constraint.dart";
import "actor_transform_constraint.dart";
import "actor_scale_constraint.dart";
import "dependency_sorter.dart";
import "actor_image.dart";
import "animation/actor_animation.dart";
import "readers/stream_reader.dart";
const Map<String, int> BlockTypesMap = {
"unknown": BlockTypes.Unknown,
"nodes": BlockTypes.Components,
"node": BlockTypes.ActorNode,
"bone": BlockTypes.ActorBone,
"rootBone": BlockTypes.ActorRootBone,
"image": BlockTypes.ActorImage,
"view": BlockTypes.View,
"animation": BlockTypes.Animation,
"animations": BlockTypes.Animations,
"atlases": BlockTypes.Atlases,
"atlas": BlockTypes.Atlas,
"event": BlockTypes.ActorEvent,
"customInt": BlockTypes.CustomIntProperty,
"customFloat": BlockTypes.CustomFloatProperty,
"customString": BlockTypes.CustomStringProperty,
"customBoolean": BlockTypes.CustomBooleanProperty,
"rectangleCollider": BlockTypes.ActorColliderRectangle,
"triangleCollider": BlockTypes.ActorColliderTriangle,
"circleCollider": BlockTypes.ActorColliderCircle,
"polygonCollider": BlockTypes.ActorColliderPolygon,
"lineCollider": BlockTypes.ActorColliderLine,
"imageSequence": BlockTypes.ActorImageSequence,
"solo": BlockTypes.ActorNodeSolo,
"jelly": BlockTypes.JellyComponent,
"jellyBone": BlockTypes.ActorJellyBone,
"ikConstraint": BlockTypes.ActorIKConstraint,
"distanceConstraint": BlockTypes.ActorDistanceConstraint,
"translationConstraint": BlockTypes.ActorTranslationConstraint,
"rotationConstraint": BlockTypes.ActorRotationConstraint,
"scaleConstraint": BlockTypes.ActorScaleConstraint,
"transformConstraint": BlockTypes.ActorTransformConstraint
};
class BlockTypes {
static const int Unknown = 0;
static const int Components = 1;
static const int ActorNode = 2;
static const int ActorBone = 3;
static const int ActorRootBone = 4;
static const int ActorImage = 5;
static const int View = 6;
static const int Animation = 7;
static const int Animations = 8;
static const int Atlases = 9;
static const int Atlas = 10;
static const int ActorIKTarget = 11;
static const int ActorEvent = 12;
static const int CustomIntProperty = 13;
static const int CustomFloatProperty = 14;
static const int CustomStringProperty = 15;
static const int CustomBooleanProperty = 16;
static const int ActorColliderRectangle = 17;
static const int ActorColliderTriangle = 18;
static const int ActorColliderCircle = 19;
static const int ActorColliderPolygon = 20;
static const int ActorColliderLine = 21;
static const int ActorImageSequence = 22;
static const int ActorNodeSolo = 23;
static const int JellyComponent = 28;
static const int ActorJellyBone = 29;
static const int ActorIKConstraint = 30;
static const int ActorDistanceConstraint = 31;
static const int ActorTranslationConstraint = 32;
static const int ActorRotationConstraint = 33;
static const int ActorScaleConstraint = 34;
static const int ActorTransformConstraint = 35;
}
class ActorFlags {
static const int IsImageDrawOrderDirty = 1 << 0;
static const int IsVertexDeformDirty = 1 << 1;
static const int IsDirty = 1 << 2;
}
class Actor {
int _flags =
ActorFlags.IsImageDrawOrderDirty | ActorFlags.IsVertexDeformDirty;
int _maxTextureIndex = 0;
int _imageNodeCount = 0;
int _nodeCount = 0;
int _version = 0;
int _dirtDepth = 0;
ActorNode _root;
List<ActorComponent> _components;
List<ActorNode> _nodes;
List<ActorImage> _imageNodes;
List<ActorAnimation> _animations;
List<ActorComponent> _dependencyOrder;
List _atlases;
Actor();
bool addDependency(ActorComponent a, ActorComponent b) {
List<ActorComponent> dependents = b.dependents;
if (dependents == null) {
b.dependents = dependents = <ActorComponent>[];
}
if (dependents.contains(a)) {
return false;
}
dependents.add(a);
return true;
}
void sortDependencies() {
DependencySorter sorter = DependencySorter();
_dependencyOrder = sorter.sort(_root);
int graphOrder = 0;
for (final ActorComponent component in _dependencyOrder) {
component.graphOrder = graphOrder++;
component.dirtMask = 255;
}
_flags |= ActorFlags.IsDirty;
}
bool addDirt(ActorComponent component, int value, bool recurse) {
if ((component.dirtMask & value) == value) {
// Already marked.
return false;
}
// Make sure dirt is set before calling anything that can set more dirt.
int dirt = component.dirtMask | value;
component.dirtMask = dirt;
_flags |= ActorFlags.IsDirty;
component.onDirty(dirt);
// If the order of this component is less than the current dirt depth,
// update the dirt depth so that the update loop can break out early
// and re-run (something up the tree is dirty).
if (component.graphOrder < _dirtDepth) {
_dirtDepth = component.graphOrder;
}
if (!recurse) {
return true;
}
List<ActorComponent> dependents = component.dependents;
if (dependents != null) {
for (ActorComponent d in dependents) {
addDirt(d, value, recurse);
}
}
return true;
}
int get version {
return _version;
}
List<ActorComponent> get components {
return _components;
}
List<ActorNode> get nodes {
return _nodes;
}
List<ActorAnimation> get animations {
return _animations;
}
List<ActorImage> get imageNodes {
return _imageNodes;
}
ActorComponent operator [](int index) {
return _components[index];
}
int get componentCount {
return _components.length;
}
int get nodeCount {
return _nodeCount;
}
int get imageNodeCount {
return _imageNodeCount;
}
int get texturesUsed {
return _maxTextureIndex + 1;
}
ActorNode get root {
return _root;
}
ActorAnimation getAnimation(String name) {
for (ActorAnimation a in _animations) {
if (a.name == name) {
return a;
}
}
return null;
}
ActorAnimationInstance getAnimationInstance(String name) {
ActorAnimation animation = getAnimation(name);
if (animation == null) {
return null;
}
return ActorAnimationInstance(this, animation);
}
ActorNode getNode(String name) {
for (ActorNode node in _nodes) {
if (node != null && node.name == name) {
return node;
}
}
return null;
}
void markImageDrawOrderDirty() {
_flags |= ActorFlags.IsImageDrawOrderDirty;
}
bool get isVertexDeformDirty {
return (_flags & ActorFlags.IsVertexDeformDirty) != 0x00;
}
void copyActor(Actor actor) {
_animations = actor._animations;
//_flags = actor._flags;
_maxTextureIndex = actor._maxTextureIndex;
_imageNodeCount = actor._imageNodeCount;
_nodeCount = actor._nodeCount;
if (actor.componentCount != 0) {
_components = List<ActorComponent>(actor.componentCount);
}
if (_nodeCount != 0) // This will always be at least 1.
{
_nodes = List<ActorNode>(_nodeCount);
}
if (_imageNodeCount != 0) {
_imageNodes = List<ActorImage>(_imageNodeCount);
}
if (actor.componentCount != 0) {
int idx = 0;
int imgIdx = 0;
int ndIdx = 0;
for (ActorComponent component in actor.components) {
if (component == null) {
_components[idx++] = null;
continue;
}
ActorComponent instanceComponent = component.makeInstance(this);
_components[idx++] = instanceComponent;
// ActorNode nodeInstance = instanceComponent as ActorNode;
// if(nodeInstance != null)
if (instanceComponent is ActorNode) {
_nodes[ndIdx++] = instanceComponent;
}
// ActorImage imageInstance = instanceComponent as ActorImage;
if (instanceComponent is ActorImage) {
_imageNodes[imgIdx++] = instanceComponent;
}
}
}
_root = _components[0] as ActorNode;
for (ActorComponent component in _components) {
if (_root == component || component == null) {
continue;
}
component.resolveComponentIndices(_components);
}
for (ActorComponent component in _components) {
if (_root == component || component == null) {
continue;
}
component.completeResolve();
}
sortDependencies();
if (_imageNodes != null) {
_imageNodes.sort((a, b) => a.drawOrder.compareTo(b.drawOrder));
for (int i = 0; i < _imageNodes.length; i++) {
_imageNodes[i].drawIndex = i;
}
}
}
void updateVertexDeform(ActorImage image) {}
ActorImage makeImageNode() {
return ActorImage();
}
void advance(double seconds) {
if ((_flags & ActorFlags.IsDirty) != 0) {
const int MaxSteps = 100;
int step = 0;
int count = _dependencyOrder.length;
while ((_flags & ActorFlags.IsDirty) != 0 && step < MaxSteps) {
_flags &= ~ActorFlags.IsDirty;
// Track dirt depth here so that if something else marks dirty, we restart.
for (int i = 0; i < count; i++) {
ActorComponent component = _dependencyOrder[i];
_dirtDepth = i;
int d = component.dirtMask;
if (d == 0) {
continue;
}
component.dirtMask = 0;
component.update(d);
if (_dirtDepth < i) {
break;
}
}
step++;
}
}
if ((_flags & ActorFlags.IsImageDrawOrderDirty) != 0) {
_flags &= ~ActorFlags.IsImageDrawOrderDirty;
if (_imageNodes != null) {
_imageNodes.sort((a, b) => a.drawOrder.compareTo(b.drawOrder));
for (int i = 0; i < _imageNodes.length; i++) {
_imageNodes[i].drawIndex = i;
}
}
}
if ((_flags & ActorFlags.IsVertexDeformDirty) != 0) {
_flags &= ~ActorFlags.IsVertexDeformDirty;
for (int i = 0; i < _imageNodeCount; i++) {
ActorImage imageNode = _imageNodes[i];
if (imageNode != null && imageNode.isVertexDeformDirty) {
imageNode.isVertexDeformDirty = false;
updateVertexDeform(imageNode);
}
}
}
}
void load(ByteData data) {
int N = data.getUint8(0);
int I = data.getUint8(1);
int M = data.getUint8(2);
int A = data.getUint8(3);
dynamic inputData = data;
if (N != 78 || I != 73 || M != 77 || A != 65) {
Uint8List byteList = data.buffer.asUint8List();
String stringData = String.fromCharCodes(byteList);
dynamic jsonActor = jsonDecode(stringData);
Map jsonObject = <dynamic, dynamic>{};
jsonObject["container"] = jsonActor;
inputData = jsonObject; // Override.
}
StreamReader reader = StreamReader(inputData);
_version = reader.readVersion();
if (_version < 12) {
throw UnsupportedError("Nima file is too old.");
}
_root = ActorNode.withActor(this);
StreamReader block;
while ((block = reader.readNextBlock(BlockTypesMap)) != null) {
switch (block.blockType) {
case BlockTypes.Components:
readComponentsBlock(block);
break;
case BlockTypes.Animations:
readAnimationsBlock(block);
break;
case BlockTypes.Atlases:
readAtlasesBlock(block, this);
break;
}
}
}
void readComponentsBlock(StreamReader block) {
int componentCount = block.readUint16Length();
_components = List<ActorComponent>(componentCount + 1);
_components[0] = _root;
// Guaranteed from the exporter to be in index order.
_nodeCount = 1;
for (int componentIndex = 1, end = componentCount + 1;
componentIndex < end;
componentIndex++) {
StreamReader nodeBlock = block.readNextBlock(BlockTypesMap);
if (nodeBlock == null) {
break;
}
ActorComponent component;
switch (nodeBlock.blockType) {
case BlockTypes.ActorNode:
component = ActorNode.read(this, nodeBlock, null);
break;
case BlockTypes.ActorBone:
component = ActorBone.read(this, nodeBlock, null);
break;
case BlockTypes.ActorRootBone:
component = ActorRootBone.read(this, nodeBlock, null);
break;
case BlockTypes.ActorImageSequence:
_imageNodeCount++;
component = ActorImage.readSequence(this, nodeBlock, makeImageNode());
ActorImage ai = component as ActorImage;
_maxTextureIndex = ai
.sequenceFrames.last.atlasIndex; // Last atlasIndex is the biggest
break;
case BlockTypes.ActorImage:
_imageNodeCount++;
component = ActorImage.read(this, nodeBlock, makeImageNode());
if ((component as ActorImage).textureIndex > _maxTextureIndex) {
_maxTextureIndex = (component as ActorImage).textureIndex;
}
break;
case BlockTypes.ActorIKTarget:
//component = ActorIKTarget.Read(this, nodeBlock);
break;
case BlockTypes.ActorEvent:
component = ActorEvent.read(this, nodeBlock, null);
break;
case BlockTypes.CustomIntProperty:
//component = CustomIntProperty.Read(this, nodeBlock);
break;
case BlockTypes.CustomFloatProperty:
//component = CustomFloatProperty.Read(this, nodeBlock);
break;
case BlockTypes.CustomStringProperty:
//component = CustomStringProperty.Read(this, nodeBlock);
break;
case BlockTypes.CustomBooleanProperty:
//component = CustomBooleanProperty.Read(this, nodeBlock);
break;
case BlockTypes.ActorColliderRectangle:
//component = ActorColliderRectangle.Read(this, nodeBlock);
break;
case BlockTypes.ActorColliderTriangle:
//component = ActorColliderTriangle.Read(this, nodeBlock);
break;
case BlockTypes.ActorColliderCircle:
//component = ActorColliderCircle.Read(this, nodeBlock);
break;
case BlockTypes.ActorColliderPolygon:
//component = ActorColliderPolygon.Read(this, nodeBlock);
break;
case BlockTypes.ActorColliderLine:
//component = ActorColliderLine.Read(this, nodeBlock);
break;
case BlockTypes.ActorNodeSolo:
component = ActorNodeSolo.read(this, nodeBlock, null);
break;
case BlockTypes.ActorJellyBone:
component = ActorJellyBone.read(this, nodeBlock, null);
break;
case BlockTypes.JellyComponent:
component = JellyComponent.read(this, nodeBlock, null);
break;
case BlockTypes.ActorIKConstraint:
component = ActorIKConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.ActorDistanceConstraint:
component = ActorDistanceConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.ActorTranslationConstraint:
component = ActorTranslationConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.ActorScaleConstraint:
component = ActorScaleConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.ActorRotationConstraint:
component = ActorRotationConstraint.read(this, nodeBlock, null);
break;
case BlockTypes.ActorTransformConstraint:
component = ActorTransformConstraint.read(this, nodeBlock, null);
break;
}
if (component is ActorNode) {
_nodeCount++;
}
_components[componentIndex] = component;
if (component != null) {
component.idx = componentIndex;
}
}
_imageNodes = List<ActorImage>(_imageNodeCount);
_nodes = List<ActorNode>(_nodeCount);
_nodes[0] = _root;
// Resolve nodes.
int imgIdx = 0;
int anIdx = 0;
for (int i = 1; i <= componentCount; i++) {
ActorComponent c = _components[i];
// Nodes can be null if we read from a file version that contained nodes that we don't interpret in this runtime.
if (c != null) {
c.resolveComponentIndices(_components);
}
if (c is ActorImage) {
ActorImage ain = c;
if (ain != null) {
_imageNodes[imgIdx++] = ain;
}
}
if (c is ActorNode) {
ActorNode an = c;
if (an != null) {
_nodes[anIdx++] = an;
}
}
}
for (int i = 1; i <= componentCount; i++) {
ActorComponent c = components[i];
if (c != null) {
c.completeResolve();
}
}
sortDependencies();
}
void readAnimationsBlock(StreamReader block) {
// Read animations.
int animationCount = block.readUint16Length();
_animations = List<ActorAnimation>(animationCount);
StreamReader animationBlock;
int animationIndex = 0;
while ((animationBlock = block.readNextBlock(BlockTypesMap)) != null) {
switch (animationBlock.blockType) {
case BlockTypes.Animation:
ActorAnimation anim =
ActorAnimation.read(animationBlock, _components);
_animations[animationIndex++] = anim;
break;
}
}
}
void readAtlasesBlock(StreamReader block, Actor actor) {
bool isOOB = block.readBool("isOOB");
block.openArray("data");
int numAtlases = block.readUint16Length();
String readerType = block.containerType;
if (isOOB) {
_atlases = List<String>(numAtlases);
for (int i = 0; i < numAtlases; i++) {
String filename = block.readString("data");
actor._atlases[i] = filename;
}
} else {
_atlases = List<Uint8List>(numAtlases);
switch (readerType) {
case "json":
for (int i = 0; i < numAtlases; i++) {
String imageString = block
.readString("data"); // Label wouldn't be neede here either.
Uint8List bytes = Base64Decoder().convert(imageString, 22);
actor._atlases[i] = bytes;
}
break;
case "bin":
for (int i = 0; i < numAtlases; i++) {
int size = block.readUint32("");
Uint8List bytes = Uint8List(size);
block.readUint8Array(bytes, size, 0, "");
actor._atlases[i] = bytes;
}
break;
default:
print("Unknown reader type!");
break;
}
}
block.closeArray();
}
List get atlases => _atlases;
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGUID>{E2432E1E-235C-4E6F-A79F-D95B0AE26A9A}</ProjectGUID>
<RootNamespace>facedetect</RootNamespace>
<ProjectName>interaction-area</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros">
<NuGetPackageImportStamp>ff985d44</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)build\dist\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)build\dist\$(Platform)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)build\obj\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)precompiled-libs\x64\opencv\include\;$(SolutionDir)..\</AdditionalIncludeDirectories>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)precompiled-libs\x64\opencv\lib</AdditionalLibraryDirectories>
<AdditionalDependencies>%(AdditionalDependencies);opencv_world310d.lib</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>XCOPY "$(SolutionDir)"\precompiled-libs\x64\opencv\bin\*.DLL "$(TargetDir)" /D /K /Y
XCOPY "$(SolutionDir)"\data\*.* "$(TargetDir)" /D /K /Y</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy DLLs and data files to target directory</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir)precompiled-libs\x64\opencv\include\;$(SolutionDir)..\</AdditionalIncludeDirectories>
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>%(AdditionalDependencies);opencv_world310.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)precompiled-libs\x64\opencv\lib</AdditionalLibraryDirectories>
</Link>
<PostBuildEvent>
<Command>XCOPY "$(SolutionDir)"\precompiled-libs\x64\opencv\bin\*.DLL "$(TargetDir)" /D /K /Y
XCOPY "$(SolutionDir)"\data\*.* "$(TargetDir)" /D /K /Y</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copy DLLs and data files to target directory</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project> | {
"pile_set_name": "Github"
} |
// Boost.Bimap
//
// Copyright (c) 2006-2007 Matias Capeletto
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
/// \file views/set_view.hpp
/// \brief View of a bimap that is signature compatible with std::set.
#ifndef BOOST_BIMAP_VIEWS_SET_VIEW_HPP
#define BOOST_BIMAP_VIEWS_SET_VIEW_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/config.hpp>
#include <boost/bimap/container_adaptor/set_adaptor.hpp>
#include <boost/bimap/detail/set_view_base.hpp>
namespace boost {
namespace bimaps {
namespace views {
/// \brief View of a bimap that is signature compatible with std::set.
/**
This class uses container_adaptor and iterator_adaptor to wrapped a index of the
multi_index bimap core so it can be used as a std::set.
See also const_set_view.
**/
template< class CoreIndex >
class set_view
:
public BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
set_adaptor,
CoreIndex,
reverse_iterator, const_reverse_iterator
),
public ::boost::bimaps::detail::
set_view_base< set_view< CoreIndex >, CoreIndex >
{
typedef BOOST_BIMAP_SET_VIEW_CONTAINER_ADAPTOR(
set_adaptor,
CoreIndex,
reverse_iterator, const_reverse_iterator
) base_;
BOOST_BIMAP_SET_VIEW_BASE_FRIEND(set_view,CoreIndex)
public:
set_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) : base_(c) {}
/*
template< class LowerBounder, class UpperBounder >
std::pair<BOOST_DEDUCED_TYPENAME base_::const_iterator,
BOOST_DEDUCED_TYPENAME base_::const_iterator>
range(LowerBounder lower,UpperBounder upper) const
{
return this->base().range(
::boost::bimaps::container_adaptor::detail::unary_check_adaptor
<
LowerBounder,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>( lower, this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>() ),
::boost::bimaps::container_adaptor::detail::unary_check_adaptor
<
UpperBounder,
BOOST_DEDUCED_TYPENAME base_::base_type::value_type,
BOOST_DEDUCED_TYPENAME base_::value_from_base
>( upper, this->template functor<
BOOST_DEDUCED_TYPENAME base_::value_from_base>() )
);
}
*/
set_view & operator=(const set_view & v)
{
this->base() = v.base();
return *this;
}
};
} // namespace views
} // namespace bimaps
} // namespace boost
#endif // BOOST_BIMAP_VIEWS_SET_VIEW_HPP
| {
"pile_set_name": "Github"
} |
#ifndef UD_DECODE_H
#define UD_DECODE_H
#define MAX_INSN_LENGTH 15
/* register classes */
#define T_NONE 0
#define T_GPR 1
#define T_MMX 2
#define T_CRG 3
#define T_DBG 4
#define T_SEG 5
#define T_XMM 6
/* itab prefix bits */
#define P_none ( 0 )
#define P_c1 ( 1 << 0 )
#define P_C1(n) ( ( n >> 0 ) & 1 )
#define P_rexb ( 1 << 1 )
#define P_REXB(n) ( ( n >> 1 ) & 1 )
#define P_depM ( 1 << 2 )
#define P_DEPM(n) ( ( n >> 2 ) & 1 )
#define P_c3 ( 1 << 3 )
#define P_C3(n) ( ( n >> 3 ) & 1 )
#define P_inv64 ( 1 << 4 )
#define P_INV64(n) ( ( n >> 4 ) & 1 )
#define P_rexw ( 1 << 5 )
#define P_REXW(n) ( ( n >> 5 ) & 1 )
#define P_c2 ( 1 << 6 )
#define P_C2(n) ( ( n >> 6 ) & 1 )
#define P_def64 ( 1 << 7 )
#define P_DEF64(n) ( ( n >> 7 ) & 1 )
#define P_rexr ( 1 << 8 )
#define P_REXR(n) ( ( n >> 8 ) & 1 )
#define P_oso ( 1 << 9 )
#define P_OSO(n) ( ( n >> 9 ) & 1 )
#define P_aso ( 1 << 10 )
#define P_ASO(n) ( ( n >> 10 ) & 1 )
#define P_rexx ( 1 << 11 )
#define P_REXX(n) ( ( n >> 11 ) & 1 )
#define P_ImpAddr ( 1 << 12 )
#define P_IMPADDR(n) ( ( n >> 12 ) & 1 )
/* rex prefix bits */
#define REX_W(r) ( ( 0xF & ( r ) ) >> 3 )
#define REX_R(r) ( ( 0x7 & ( r ) ) >> 2 )
#define REX_X(r) ( ( 0x3 & ( r ) ) >> 1 )
#define REX_B(r) ( ( 0x1 & ( r ) ) >> 0 )
#define REX_PFX_MASK(n) ( ( P_REXW(n) << 3 ) | \
( P_REXR(n) << 2 ) | \
( P_REXX(n) << 1 ) | \
( P_REXB(n) << 0 ) )
/* scable-index-base bits */
#define SIB_S(b) ( ( b ) >> 6 )
#define SIB_I(b) ( ( ( b ) >> 3 ) & 7 )
#define SIB_B(b) ( ( b ) & 7 )
/* modrm bits */
#define MODRM_REG(b) ( ( ( b ) >> 3 ) & 7 )
#define MODRM_NNN(b) ( ( ( b ) >> 3 ) & 7 )
#define MODRM_MOD(b) ( ( ( b ) >> 6 ) & 3 )
#define MODRM_RM(b) ( ( b ) & 7 )
/* operand type constants -- order is important! */
enum ud_operand_code {
OP_NONE,
OP_A, OP_E, OP_M, OP_G,
OP_I,
OP_AL, OP_CL, OP_DL, OP_BL,
OP_AH, OP_CH, OP_DH, OP_BH,
OP_ALr8b, OP_CLr9b, OP_DLr10b, OP_BLr11b,
OP_AHr12b, OP_CHr13b, OP_DHr14b, OP_BHr15b,
OP_AX, OP_CX, OP_DX, OP_BX,
OP_SI, OP_DI, OP_SP, OP_BP,
OP_rAX, OP_rCX, OP_rDX, OP_rBX,
OP_rSP, OP_rBP, OP_rSI, OP_rDI,
OP_rAXr8, OP_rCXr9, OP_rDXr10, OP_rBXr11,
OP_rSPr12, OP_rBPr13, OP_rSIr14, OP_rDIr15,
OP_eAX, OP_eCX, OP_eDX, OP_eBX,
OP_eSP, OP_eBP, OP_eSI, OP_eDI,
OP_ES, OP_CS, OP_SS, OP_DS,
OP_FS, OP_GS,
OP_ST0, OP_ST1, OP_ST2, OP_ST3,
OP_ST4, OP_ST5, OP_ST6, OP_ST7,
OP_J, OP_S, OP_O,
OP_I1, OP_I3,
OP_V, OP_W, OP_Q, OP_P,
OP_R, OP_C, OP_D, OP_VR, OP_PR
};
/* operand size constants */
enum ud_operand_size {
SZ_NA = 0,
SZ_Z = 1,
SZ_V = 2,
SZ_P = 3,
SZ_WP = 4,
SZ_DP = 5,
SZ_MDQ = 6,
SZ_RDQ = 7,
/* the following values are used as is,
* and thus hard-coded. changing them
* will break internals
*/
SZ_B = 8,
SZ_W = 16,
SZ_D = 32,
SZ_Q = 64,
SZ_T = 80,
};
/* itab entry operand definitions */
#define O_rSPr12 { OP_rSPr12, SZ_NA }
#define O_BL { OP_BL, SZ_NA }
#define O_BH { OP_BH, SZ_NA }
#define O_BP { OP_BP, SZ_NA }
#define O_AHr12b { OP_AHr12b, SZ_NA }
#define O_BX { OP_BX, SZ_NA }
#define O_Jz { OP_J, SZ_Z }
#define O_Jv { OP_J, SZ_V }
#define O_Jb { OP_J, SZ_B }
#define O_rSIr14 { OP_rSIr14, SZ_NA }
#define O_GS { OP_GS, SZ_NA }
#define O_D { OP_D, SZ_NA }
#define O_rBPr13 { OP_rBPr13, SZ_NA }
#define O_Ob { OP_O, SZ_B }
#define O_P { OP_P, SZ_NA }
#define O_Ow { OP_O, SZ_W }
#define O_Ov { OP_O, SZ_V }
#define O_Gw { OP_G, SZ_W }
#define O_Gv { OP_G, SZ_V }
#define O_rDX { OP_rDX, SZ_NA }
#define O_Gx { OP_G, SZ_MDQ }
#define O_Gd { OP_G, SZ_D }
#define O_Gb { OP_G, SZ_B }
#define O_rBXr11 { OP_rBXr11, SZ_NA }
#define O_rDI { OP_rDI, SZ_NA }
#define O_rSI { OP_rSI, SZ_NA }
#define O_ALr8b { OP_ALr8b, SZ_NA }
#define O_eDI { OP_eDI, SZ_NA }
#define O_Gz { OP_G, SZ_Z }
#define O_eDX { OP_eDX, SZ_NA }
#define O_DHr14b { OP_DHr14b, SZ_NA }
#define O_rSP { OP_rSP, SZ_NA }
#define O_PR { OP_PR, SZ_NA }
#define O_NONE { OP_NONE, SZ_NA }
#define O_rCX { OP_rCX, SZ_NA }
#define O_jWP { OP_J, SZ_WP }
#define O_rDXr10 { OP_rDXr10, SZ_NA }
#define O_Md { OP_M, SZ_D }
#define O_C { OP_C, SZ_NA }
#define O_G { OP_G, SZ_NA }
#define O_Mb { OP_M, SZ_B }
#define O_Mt { OP_M, SZ_T }
#define O_S { OP_S, SZ_NA }
#define O_Mq { OP_M, SZ_Q }
#define O_W { OP_W, SZ_NA }
#define O_ES { OP_ES, SZ_NA }
#define O_rBX { OP_rBX, SZ_NA }
#define O_Ed { OP_E, SZ_D }
#define O_DLr10b { OP_DLr10b, SZ_NA }
#define O_Mw { OP_M, SZ_W }
#define O_Eb { OP_E, SZ_B }
#define O_Ex { OP_E, SZ_MDQ }
#define O_Ez { OP_E, SZ_Z }
#define O_Ew { OP_E, SZ_W }
#define O_Ev { OP_E, SZ_V }
#define O_Ep { OP_E, SZ_P }
#define O_FS { OP_FS, SZ_NA }
#define O_Ms { OP_M, SZ_W }
#define O_rAXr8 { OP_rAXr8, SZ_NA }
#define O_eBP { OP_eBP, SZ_NA }
#define O_Isb { OP_I, SZ_SB }
#define O_eBX { OP_eBX, SZ_NA }
#define O_rCXr9 { OP_rCXr9, SZ_NA }
#define O_jDP { OP_J, SZ_DP }
#define O_CH { OP_CH, SZ_NA }
#define O_CL { OP_CL, SZ_NA }
#define O_R { OP_R, SZ_RDQ }
#define O_V { OP_V, SZ_NA }
#define O_CS { OP_CS, SZ_NA }
#define O_CHr13b { OP_CHr13b, SZ_NA }
#define O_eCX { OP_eCX, SZ_NA }
#define O_eSP { OP_eSP, SZ_NA }
#define O_SS { OP_SS, SZ_NA }
#define O_SP { OP_SP, SZ_NA }
#define O_BLr11b { OP_BLr11b, SZ_NA }
#define O_SI { OP_SI, SZ_NA }
#define O_eSI { OP_eSI, SZ_NA }
#define O_DL { OP_DL, SZ_NA }
#define O_DH { OP_DH, SZ_NA }
#define O_DI { OP_DI, SZ_NA }
#define O_DX { OP_DX, SZ_NA }
#define O_rBP { OP_rBP, SZ_NA }
#define O_Gvw { OP_G, SZ_MDQ }
#define O_I1 { OP_I1, SZ_NA }
#define O_I3 { OP_I3, SZ_NA }
#define O_DS { OP_DS, SZ_NA }
#define O_ST4 { OP_ST4, SZ_NA }
#define O_ST5 { OP_ST5, SZ_NA }
#define O_ST6 { OP_ST6, SZ_NA }
#define O_ST7 { OP_ST7, SZ_NA }
#define O_ST0 { OP_ST0, SZ_NA }
#define O_ST1 { OP_ST1, SZ_NA }
#define O_ST2 { OP_ST2, SZ_NA }
#define O_ST3 { OP_ST3, SZ_NA }
#define O_E { OP_E, SZ_NA }
#define O_AH { OP_AH, SZ_NA }
#define O_M { OP_M, SZ_NA }
#define O_AL { OP_AL, SZ_NA }
#define O_CLr9b { OP_CLr9b, SZ_NA }
#define O_Q { OP_Q, SZ_NA }
#define O_eAX { OP_eAX, SZ_NA }
#define O_VR { OP_VR, SZ_NA }
#define O_AX { OP_AX, SZ_NA }
#define O_rAX { OP_rAX, SZ_NA }
#define O_Iz { OP_I, SZ_Z }
#define O_rDIr15 { OP_rDIr15, SZ_NA }
#define O_Iw { OP_I, SZ_W }
#define O_Iv { OP_I, SZ_V }
#define O_Ap { OP_A, SZ_P }
#define O_CX { OP_CX, SZ_NA }
#define O_Ib { OP_I, SZ_B }
#define O_BHr15b { OP_BHr15b, SZ_NA }
/* A single operand of an entry in the instruction table.
* (internal use only)
*/
struct ud_itab_entry_operand
{
enum ud_operand_code type;
enum ud_operand_size size;
};
/* A single entry in an instruction table.
*(internal use only)
*/
struct ud_itab_entry
{
enum ud_mnemonic_code mnemonic;
struct ud_itab_entry_operand operand1;
struct ud_itab_entry_operand operand2;
struct ud_itab_entry_operand operand3;
uint32_t prefix;
};
extern const char * ud_lookup_mnemonic( enum ud_mnemonic_code c );
#endif /* UD_DECODE_H */
/* vim:cindent
* vim:expandtab
* vim:ts=4
* vim:sw=4
*/
| {
"pile_set_name": "Github"
} |
diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
index 0320b96..a56b9e7 100644
--- a/drivers/hid/hid-lenovo.c
+++ b/drivers/hid/hid-lenovo.c
@@ -1,5 +1,6 @@
/*
- * HID driver for Lenovo ThinkPad USB Keyboard with TrackPoint
+ * HID driver for Lenovo:
+ * - ThinkPad USB Keyboard with TrackPoint (tpkbd)
*
* Copyright (c) 2012 Bernhard Seibold
*/
@@ -39,7 +40,7 @@ static int lenovo_input_mapping_tpkbd(struct hid_device *hdev,
struct hid_usage *usage, unsigned long **bit, int *max)
{
if (usage->hid == (HID_UP_BUTTON | 0x0010)) {
- /* mark the device as pointer */
+ /* This sub-device contains trackpoint, mark it */
hid_set_drvdata(hdev, (void *)1);
map_key_clear(KEY_MICMUTE);
return 1;
@@ -47,6 +48,19 @@ static int lenovo_input_mapping_tpkbd(struct hid_device *hdev,
return 0;
}
+static int lenovo_input_mapping(struct hid_device *hdev,
+ struct hid_input *hi, struct hid_field *field,
+ struct hid_usage *usage, unsigned long **bit, int *max)
+{
+ switch (hdev->product) {
+ case USB_DEVICE_ID_LENOVO_TPKBD:
+ return lenovo_input_mapping_tpkbd(hdev, hi, field,
+ usage, bit, max);
+ default:
+ return 0;
+ }
+}
+
#undef map_key_clear
static int lenovo_features_set_tpkbd(struct hid_device *hdev)
@@ -337,6 +351,15 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev)
char *name_mute, *name_micmute;
int i;
+ /*
+ * Only register extra settings against subdevice where input_mapping
+ * set drvdata to 1, i.e. the trackpoint.
+ */
+ if (!hid_get_drvdata(hdev))
+ return 0;
+
+ hid_set_drvdata(hdev, NULL);
+
/* Validate required reports. */
for (i = 0; i < 4; i++) {
if (!hid_validate_values(hdev, HID_FEATURE_REPORT, 4, i, 1))
@@ -409,12 +432,16 @@ static int lenovo_probe(struct hid_device *hdev,
goto err;
}
- if (hid_get_drvdata(hdev)) {
- hid_set_drvdata(hdev, NULL);
+ switch (hdev->product) {
+ case USB_DEVICE_ID_LENOVO_TPKBD:
ret = lenovo_probe_tpkbd(hdev);
- if (ret)
- goto err_hid;
+ break;
+ default:
+ ret = 0;
+ break;
}
+ if (ret)
+ goto err_hid;
return 0;
err_hid:
@@ -427,6 +454,13 @@ static void lenovo_remove_tpkbd(struct hid_device *hdev)
{
struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev);
+ /*
+ * Only the trackpoint half of the keyboard has drvdata and stuff that
+ * needs unregistering.
+ */
+ if (data_pointer == NULL)
+ return;
+
sysfs_remove_group(&hdev->dev.kobj,
&lenovo_attr_group_tpkbd);
@@ -438,8 +472,11 @@ static void lenovo_remove_tpkbd(struct hid_device *hdev)
static void lenovo_remove(struct hid_device *hdev)
{
- if (hid_get_drvdata(hdev))
+ switch (hdev->product) {
+ case USB_DEVICE_ID_LENOVO_TPKBD:
lenovo_remove_tpkbd(hdev);
+ break;
+ }
hid_hw_stop(hdev);
}
@@ -454,7 +491,7 @@ MODULE_DEVICE_TABLE(hid, lenovo_devices);
static struct hid_driver lenovo_driver = {
.name = "lenovo",
.id_table = lenovo_devices,
- .input_mapping = lenovo_input_mapping_tpkbd,
+ .input_mapping = lenovo_input_mapping,
.probe = lenovo_probe,
.remove = lenovo_remove,
};
| {
"pile_set_name": "Github"
} |
require_rv64;
WRITE_RD(sext32(int32_t(RS1) >> (RS2 & 0x1F)));
| {
"pile_set_name": "Github"
} |
#!/bin/bash
cd docker
# load local environment variables
if [ ! -e ".env" ]; then
echo "The .env (environment variables) file is missing"
exit 1
fi
. ./.env
docker-compose -f ../docker-compose.yml build
/bin/bash ./init-selfcert.sh
| {
"pile_set_name": "Github"
} |
/******************************************************************************
*
* Author: Xilinx, 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 of the License, or (at your
* option) any later version.
*
*
* XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A
* COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
* ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD,
* XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE
* FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING
* ANY THIRD PARTY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.
* XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO
* THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY
* WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM
* CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE.
*
*
* Xilinx hardware products are not intended for use in life support
* appliances, devices, or systems. Use in such applications is
* expressly prohibited.
*
*
* (c) Copyright 2002-2004 Xilinx Inc.
* All rights reserved.
*
*
* 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.
*
******************************************************************************/
/*****************************************************************************/
/**
*
* @file xbasic_types.h
*
* This file contains basic types for Xilinx software IP. These types do not
* follow the standard naming convention with respect to using the component
* name in front of each name because they are considered to be primitives.
*
* @note
*
* This file contains items which are architecture dependent.
*
* <pre>
* MODIFICATION HISTORY:
*
* Ver Who Date Changes
* ----- ---- -------- -------------------------------------------------------
* 1.00a rmm 12/14/01 First release
* rmm 05/09/03 Added "xassert always" macros to rid ourselves of diab
* compiler warnings
* 1.00a rpm 11/07/03 Added XNullHandler function as a stub interrupt handler
* </pre>
*
******************************************************************************/
#ifndef XBASIC_TYPES_H /* prevent circular inclusions */
#define XBASIC_TYPES_H /* by using protection macros */
/***************************** Include Files *********************************/
/************************** Constant Definitions *****************************/
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef NULL
#define NULL 0
#endif
/** Null */
#define XCOMPONENT_IS_READY 0x11111111 /* component has been initialized */
#define XCOMPONENT_IS_STARTED 0x22222222 /* component has been started */
/* the following constants and declarations are for unit test purposes and are
* designed to be used in test applications.
*/
#define XTEST_PASSED 0
#define XTEST_FAILED 1
#define XASSERT_NONE 0
#define XASSERT_OCCURRED 1
extern unsigned int XAssertStatus;
extern void XAssert(char *, int);
/**************************** Type Definitions *******************************/
/** @name Primitive types
* These primitive types are created for transportability.
* They are dependent upon the target architecture.
* @{
*/
#include <linux/types.h>
typedef struct {
u32 Upper;
u32 Lower;
} Xuint64;
/*@}*/
/**
* This data type defines an interrupt handler for a device.
* The argument points to the instance of the component
*/
typedef void (*XInterruptHandler) (void *InstancePtr);
/**
* This data type defines a callback to be invoked when an
* assert occurs. The callback is invoked only when asserts are enabled
*/
typedef void (*XAssertCallback) (char *FilenamePtr, int LineNumber);
/***************** Macros (Inline Functions) Definitions *********************/
/*****************************************************************************/
/**
* Return the most significant half of the 64 bit data type.
*
* @param x is the 64 bit word.
*
* @return
*
* The upper 32 bits of the 64 bit word.
*
* @note
*
* None.
*
******************************************************************************/
#define XUINT64_MSW(x) ((x).Upper)
/*****************************************************************************/
/**
* Return the least significant half of the 64 bit data type.
*
* @param x is the 64 bit word.
*
* @return
*
* The lower 32 bits of the 64 bit word.
*
* @note
*
* None.
*
******************************************************************************/
#define XUINT64_LSW(x) ((x).Lower)
#ifndef NDEBUG
/*****************************************************************************/
/**
* This assert macro is to be used for functions that do not return anything
* (void). This in conjunction with the XWaitInAssert boolean can be used to
* accomodate tests so that asserts which fail allow execution to continue.
*
* @param expression is the expression to evaluate. If it evaluates to false,
* the assert occurs.
*
* @return
*
* Returns void unless the XWaitInAssert variable is true, in which case
* no return is made and an infinite loop is entered.
*
* @note
*
* None.
*
******************************************************************************/
#define XASSERT_VOID(expression) \
{ \
if (expression) { \
XAssertStatus = XASSERT_NONE; \
} else { \
XAssert(__FILE__, __LINE__); \
XAssertStatus = XASSERT_OCCURRED; \
return; \
} \
}
/*****************************************************************************/
/**
* This assert macro is to be used for functions that do return a value. This in
* conjunction with the XWaitInAssert boolean can be used to accomodate tests so
* that asserts which fail allow execution to continue.
*
* @param expression is the expression to evaluate. If it evaluates to false,
* the assert occurs.
*
* @return
*
* Returns 0 unless the XWaitInAssert variable is true, in which case
* no return is made and an infinite loop is entered.
*
* @note
*
* None.
*
******************************************************************************/
#define XASSERT_NONVOID(expression) \
{ \
if (expression) { \
XAssertStatus = XASSERT_NONE; \
} else { \
XAssert(__FILE__, __LINE__); \
XAssertStatus = XASSERT_OCCURRED; \
return 0; \
} \
}
/*****************************************************************************/
/**
* Always assert. This assert macro is to be used for functions that do not
* return anything (void). Use for instances where an assert should always
* occur.
*
* @return
*
* Returns void unless the XWaitInAssert variable is true, in which case
* no return is made and an infinite loop is entered.
*
* @note
*
* None.
*
******************************************************************************/
#define XASSERT_VOID_ALWAYS() \
{ \
XAssert(__FILE__, __LINE__); \
XAssertStatus = XASSERT_OCCURRED; \
return; \
}
/*****************************************************************************/
/**
* Always assert. This assert macro is to be used for functions that do return
* a value. Use for instances where an assert should always occur.
*
* @return
*
* Returns void unless the XWaitInAssert variable is true, in which case
* no return is made and an infinite loop is entered.
*
* @note
*
* None.
*
******************************************************************************/
#define XASSERT_NONVOID_ALWAYS() \
{ \
XAssert(__FILE__, __LINE__); \
XAssertStatus = XASSERT_OCCURRED; \
return 0; \
}
#else
#define XASSERT_VOID(expression)
#define XASSERT_VOID_ALWAYS()
#define XASSERT_NONVOID(expression)
#define XASSERT_NONVOID_ALWAYS()
#endif
/************************** Function Prototypes ******************************/
void XAssertSetCallback(XAssertCallback Routine);
void XNullHandler(void *NullParameter);
#endif /* end of protection macro */
| {
"pile_set_name": "Github"
} |
/* steamShovel:ignore */
/*global __instrumentor_map__:true, window:true, global:true */
module.exports = function instrumentor_record(filetag, id, expression) {
var scope = global || window;
scope.st_timeCommenced = scope.st_timeCommenced || Date.now();
scope.st_iterator = (scope.st_iterator || 0);
var depth =
(new Error()).stack.split("\n")
.slice(1)
.length;
if (!scope.mem)
scope.mem = (
typeof process !== "undefined" ? process.memoryUsage : function(){}
);
if (scope.__steamshovel_test_depth) {
depth -= scope.__steamshovel_test_depth;
}
__instrumentor_map__[filetag].instruments[id].results.push({
"depth": depth,
"time": Date.now(),
"timeOffset": Date.now() - scope.st_timeCommenced,
"memoryUsage": scope.mem(),
"invocation": scope.st_iterator,
"milestone": scope.__steamshovel_milestone,
"value": scope.__steamshovel_record_expression ? expression : null
});
scope.st_iterator ++;
// Make sure we return the original expresison result
return expression;
}; | {
"pile_set_name": "Github"
} |
set noparent
[email protected]
[email protected]
# COMPONENT: Blink>JavaScript>Runtime
| {
"pile_set_name": "Github"
} |
const flattenDeep = require('lodash/flattenDeep')
const memoize = require('lodash/memoize')
const range = require('lodash/range')
const chunk = require('lodash/chunk')
const Web3 = require('web3')
const Bottleneck = require('bottleneck')
const { get, post } = require('@origin/ipfs')
const { debug, validateParams } = require('./utils')
const { InMemoryBackend, IndexedDBBackend } = require('./backends/browser')
let PostgreSQLBackend
if (!process.env.WEBPACK_BUILD) {
PostgreSQLBackend = require('./backends/PostgreSQLBackend').PostgreSQLBackend
}
// Note: do not increase over 2,000 which is Alchemy's limit
const DEFAULT_BATCH_SIZE = 2000
// Note: Increasing this limit causes more cpu units usage on Alchemy
// and may cause rate limiting.
const MAX_CONCURRENT_REQUESTS = 25
const limiter = new Bottleneck({ maxConcurrent: MAX_CONCURRENT_REQUESTS })
limiter.on('error', err => {
debug('Error occurred within rate limiter', err)
})
limiter.on('failed', async (err, jobInfo) => {
debug(`Job ${jobInfo.options.id} failed`, err)
// Retry 3 times
if (jobInfo.retryCount < 4) {
// 1sec wait for retry
debug('Retrying job...')
return 1000
}
})
const getPastEvents = memoize(
async function(instance, fromBlock, toBlock, batchSize = DEFAULT_BATCH_SIZE) {
if (
instance.ipfsEventCache && // IPFS cache configured.
!instance.loadedCache && // IPFS cache hasn't been loaded yet.
(!instance.latestIndexedBlock || // Back-end does not support persistent storage. Always load cache at startup.
instance.latestIndexedBlock < instance.cacheMaxBlock) // Data indexed in back-end is not as fresh as cache.
) {
try {
debug('Loading event cache from IPFS', instance.ipfsEventCache)
const cachedEvents = flattenDeep(
await Promise.all(
instance.ipfsEventCache.map(hash => get(instance.ipfsServer, hash))
)
)
const lastCached = cachedEvents[cachedEvents.length - 1].blockNumber
debug(`Loaded ${cachedEvents.length} events from IPFS cache`)
debug(`Last cached blockNumber: ${lastCached}`)
debug(`Latest indexed block: ${instance.latestIndexedBlock}`)
if (
!instance.latestIndexedBlock ||
lastCached > instance.latestIndexedBlock
) {
debug(`Adding IPFS events to backend`)
await instance.backend.addEvents(cachedEvents)
fromBlock = lastCached + 1
}
} catch (e) {
debug(`Error loading IPFS events`, e)
}
instance.loadedCache = true
} else {
debug('Skipped loading event from IPFS cache.')
}
// Paranoia check.
if (!instance.contract || !instance.contract.options.address) {
throw new Error(
`EventCache.getPastEvents failure. Contract ${instance.prefix} missing address!`
)
}
const requests = range(fromBlock, toBlock + 1, batchSize).map(start =>
limiter.schedule(
args => instance.contract.getPastEvents('allEvents', args),
{ fromBlock: start, toBlock: Math.min(start + batchSize - 1, toBlock) }
)
)
const numBlocks = toBlock - fromBlock + 1
debug(`Get ${numBlocks} blocks in ${requests.length} requests`)
if (!numBlocks) return
const newEvents = flattenDeep(await Promise.all(requests))
debug(`Got ${newEvents.length} new events`)
if (newEvents.length > 0) {
try {
await instance.backend.addEvents(newEvents)
debug(`Added all new events to backend`)
} catch (e) {
debug('Error adding new events to backend', e)
}
}
instance.lastQueriedBlock = toBlock
},
(...args) => `${args[0].contract._address}-${args[1]}-${args[2]}`
)
/**
* @class
* @classdesc EventCache to define the interface for EventCache backends
*
* Example configuration object(all optional):
* {
* backend: new InMemoryBackend(),
* platform: 'browser', // or 'nodejs', and eventually 'mobile'
* ipfsServer: 'http://localhost:5002',
* ipfsEventCache: 'QmBase64HashThisisTHISis...'
* }
*/
class EventCache {
/**
* constructor
*
* @param contract {web3.eth.Contract} The contract to patch
* @param fromBlock {number} The block number to start the event search at. If
* null, or not given it will start at the latest known to the cache
* backend
* @param config {object} A configuration JS object (See EventCache)
*/
constructor(contract, originBlock = 0, config) {
this._processConfig(config)
if (
!(contract._address || (contract.options && contract.options.address))
) {
throw new Error(
`Contract ${this.prefix} missing address! Can not initialize EventCache`
)
}
this.contract = contract
this.originBlock = Number(originBlock)
this.web3 = new Web3(contract.currentProvider)
this.lastQueriedBlock = 0
this.latestIndexedBlock = 0
const addr = (this.contract._address || 'no-contract').substr(0, 10)
debug(`EventCache using backend ${this.backend.type}`)
debug(`Initialized ${addr} with originBlock ${this.originBlock}`)
}
/**
* Detect and return a platform string
*
* @returns {string} - The platform string
*/
_detectPlatform() {
if (typeof window !== 'undefined') {
return 'browser'
}
return 'nodejs'
}
/**
* _getBackend initializes a storage backend
*
* @returns {object} An initialized storage backend
*/
_getBackend(platform) {
if (!platform) platform = this._detectPlatform()
switch (platform) {
case 'nodejs':
case 'postgresql':
return new PostgreSQLBackend({ prefix: this.prefix })
case 'browser':
return new IndexedDBBackend({ prefix: this.prefix })
case 'mobile':
case 'memory':
default:
return new InMemoryBackend()
}
}
/**
* _processConfig processes the provided configuration object
*/
_processConfig(conf) {
this.prefix = conf.prefix || ''
if (typeof conf.backend !== 'undefined') {
this.backend = conf.backend
} else {
this.backend = this._getBackend(conf.platform)
}
this.ipfsServer =
conf.ipfsGateway || conf.ipfsServer || 'https://ipfs.originprotocol.com'
if (conf.batchSize) {
this.batchSize = Math.min(conf.batchSize, DEFAULT_BATCH_SIZE)
} else {
this.batchSize = DEFAULT_BATCH_SIZE
}
debug(`Setting batch size to ${this.batchSize}`)
// If config specifies a cache, it should also have cacheMaxBlock.
if (
conf.ipfsEventCache &&
conf.ipfsEventCache.length &&
!conf.cacheMaxBlock
) {
throw new Error('cacheMaxBlock missing from config.')
}
this.ipfsEventCache =
conf.ipfsEventCache && conf.ipfsEventCache.length
? conf.ipfsEventCache
: null
this.cacheMaxBlock = conf.cacheMaxBlock
/**
* Only reason to set this false is if something external will manage the
* latest block with setLatestBlock()
*/
this.useLatestFromChain =
typeof conf.useLatestFromChain !== 'undefined'
? conf.useLatestFromChain
: true
}
/**
* _fetchEvents makes the necessary calls to fetch the event logs from the JSON-RPC provider
*
* @param fromBlock {number} The block to start the search at
* @param toBlock {T} The number to search to (or 'latest')
* @returns {Array} An array of event objects
*/
async _fetchEvents() {
// Do not fetch events if this isn't a writer
if (typeof process.env.EVENTCACHE_SLAVE !== 'undefined') {
debug('_fetchEvents disabled. slave instance')
return
}
let toBlock = this.latestBlock
if (this.useLatestFromChain || !toBlock) {
toBlock = this.latestBlock = await this.web3.eth.getBlockNumber()
}
if (this.latestBlock && this.lastQueriedBlock === this.latestBlock) {
debug('noop, current')
return
}
// Set if missing
if (this.latestIndexedBlock === 0) {
this.latestIndexedBlock = await this.backend.getLatestBlock()
}
/**
* Base fromBlock on the latest block number that had an event and was added
* to the backend. This is defensive against accidental "future" requests on
* nodes that may be out of sync
*/
const fromBlock = this.latestIndexedBlock
? this.latestIndexedBlock + 1
: this.originBlock
if (fromBlock > toBlock) {
debug(`fromBlock > toBlock (${fromBlock} > ${toBlock})`)
return
}
await getPastEvents(this, fromBlock, toBlock, this.batchSize)
// Update latestIndexedBlock
this.latestIndexedBlock = await this.backend.getLatestBlock()
}
/**
* getPastEvents retrieves all events
*
* @param eventName {string} The name of the event
* @param options {object} An Object as defined by web3.js' getPastEvents
* @returns {Array} An array of event objects
*/
async getPastEvents(eventName, options) {
let args = {}
if (options && options.filter) {
args = {
event: eventName,
...options.filter
}
} else {
args = {
event: eventName
}
}
return await this.getEvents(args)
}
/**
* getEvents retrieves all events fitting the filter
* @param params {object} - An object with params to match events against
* @returns {Array} - An array of event objects
*/
async getEvents(params) {
if (params && !validateParams(this.contract, params)) {
debug(params)
throw new TypeError('Invalid event parameters')
}
await this._fetchEvents()
return await this.backend.get(params)
}
/**
* allEvents retrieves all events wihtout filter
* @returns {Array} - An array of event objects
*/
async allEvents() {
await this._fetchEvents()
return await this.backend.all()
}
/**
* Returns the latest block number known by the backend
* @returns {number} The latest known block number
*/
async getBlockNumber() {
return await this.backend.getLatestBlock()
}
/**
* Set the latest known block number, if managing this externally
* @param {number} The latest known block number
*/
setLatestBlock(num) {
debug(`setLatestBlock to ${num}`)
this.latestBlock = num
}
/**
* saveCheckpoint saves a checkpoint to IPFS for later reload
*
* @returns {string} - The IPFS hash of the checkpoint
*/
async saveCheckpoint() {
const serialized = await this.allEvents()
return await Promise.all(
chunk(serialized, 1500).map(events => post(this.ipfsServer, events, true))
)
}
/**
* loadCheckpoint loads events from an IPFS hash
*/
async loadCheckpoint(ipfsHashes) {
const events = await Promise.all(
ipfsHashes.map(hash => get(this.ipfsServer, hash))
)
return flattenDeep(events)
}
}
module.exports = {
EventCache
}
| {
"pile_set_name": "Github"
} |
package Module::Build::PPMMaker;
use strict;
use warnings;
use Config;
our $VERSION = '0.4214';
$VERSION = eval $VERSION;
# This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a
# few tweaks based on the PPD spec at
# http://www.xav.com/perl/site/lib/XML/PPD.html
# The PPD spec is based on <http://www.w3.org/TR/NOTE-OSD>
sub new {
my $package = shift;
return bless {@_}, $package;
}
sub make_ppd {
my ($self, %args) = @_;
my $build = delete $args{build};
my @codebase;
if (exists $args{codebase}) {
@codebase = ref $args{codebase} ? @{$args{codebase}} : ($args{codebase});
} else {
my $distfile = $build->ppm_name . '.tar.gz';
print "Using default codebase '$distfile'\n";
@codebase = ($distfile);
}
my %dist;
foreach my $info (qw(name author abstract version)) {
my $method = "dist_$info";
$dist{$info} = $build->$method() or die "Can't determine distribution's $info\n";
}
$self->_simple_xml_escape($_) foreach $dist{abstract}, @{$dist{author}};
# TODO: could add <LICENSE HREF=...> tag if we knew what the URLs were for
# various licenses
my $ppd = <<"PPD";
<SOFTPKG NAME=\"$dist{name}\" VERSION=\"$dist{version}\">
<ABSTRACT>$dist{abstract}</ABSTRACT>
@{[ join "\n", map " <AUTHOR>$_</AUTHOR>", @{$dist{author}} ]}
<IMPLEMENTATION>
PPD
# We don't include recommended dependencies because PPD has no way
# to distinguish them from normal dependencies. We don't include
# build_requires dependencies because the PPM installer doesn't
# build or test before installing. And obviously we don't include
# conflicts either.
foreach my $type (qw(requires)) {
my $prereq = $build->$type();
while (my ($modname, $spec) = each %$prereq) {
next if $modname eq 'perl';
my $min_version = '0.0';
foreach my $c ($build->_parse_conditions($spec)) {
my ($op, $version) = $c =~ /^\s* (<=?|>=?|==|!=) \s* ([\w.]+) \s*$/x;
# This is a nasty hack because it fails if there is no >= op
if ($op eq '>=') {
$min_version = $version;
last;
}
}
# PPM4 spec requires a '::' for top level modules
$modname .= '::' unless $modname =~ /::/;
$ppd .= qq! <REQUIRE NAME="$modname" VERSION="$min_version" />\n!;
}
}
# We only include these tags if this module involves XS, on the
# assumption that pure Perl modules will work on any OS.
if (keys %{$build->find_xs_files}) {
my $perl_version = $self->_ppd_version($build->perl_version);
$ppd .= sprintf(<<'EOF', $self->_varchname($build->config) );
<ARCHITECTURE NAME="%s" />
EOF
}
foreach my $codebase (@codebase) {
$self->_simple_xml_escape($codebase);
$ppd .= sprintf(<<'EOF', $codebase);
<CODEBASE HREF="%s" />
EOF
}
$ppd .= <<'EOF';
</IMPLEMENTATION>
</SOFTPKG>
EOF
my $ppd_file = "$dist{name}.ppd";
open(my $fh, '>', $ppd_file)
or die "Cannot write to $ppd_file: $!";
binmode($fh, ":utf8")
if $] >= 5.008 && $Config{useperlio};
print $fh $ppd;
close $fh;
return $ppd_file;
}
sub _ppd_version {
my ($self, $version) = @_;
# generates something like "0,18,0,0"
return join ',', (split(/\./, $version), (0)x4)[0..3];
}
sub _varchname { # Copied from PPM.pm
my ($self, $config) = @_;
my $varchname = $config->{archname};
# Append "-5.8" to architecture name for Perl 5.8 and later
if ($] >= 5.008) {
my $vstring = sprintf "%vd", $^V;
$vstring =~ s/\.\d+$//;
$varchname .= "-$vstring";
}
return $varchname;
}
{
my %escapes = (
"\n" => "\\n",
'"' => '"',
'&' => '&',
'>' => '>',
'<' => '<',
);
my $rx = join '|', keys %escapes;
sub _simple_xml_escape {
$_[1] =~ s/($rx)/$escapes{$1}/go;
}
}
1;
__END__
=head1 NAME
Module::Build::PPMMaker - Perl Package Manager file creation
=head1 SYNOPSIS
On the command line, builds a .ppd file:
./Build ppd
=head1 DESCRIPTION
This package contains the code that builds F<.ppd> "Perl Package
Description" files, in support of ActiveState's "Perl Package
Manager". Details are here:
L<http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/>
=head1 AUTHOR
Dave Rolsky <[email protected]>, Ken Williams <[email protected]>
=head1 COPYRIGHT
Copyright (c) 2001-2006 Ken Williams. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 SEE ALSO
perl(1), Module::Build(3)
=cut
| {
"pile_set_name": "Github"
} |
#define PART_1
#ifdef PART_1
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
using namespace tensorflow;
REGISTER_OP("ZeroOut")
.Input("to_zero: int32")
.Output("zeroed: int32")
.SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) {
c->set_output(0, c->input(0));
return Status::OK();
});
using namespace tensorflow;
class ZeroOutOp : public OpKernel {
public:
explicit ZeroOutOp(OpKernelConstruction* context) : OpKernel(context) {}
void Compute(OpKernelContext* context) override {
// Grab the input tensor
const Tensor& input_tensor = context->input(0);
/* test whether a Status object returned from some function is an error, and if so return it */
OP_REQUIRES(context, TensorShapeUtils::IsVector(input_tensor.shape()),
errors::InvalidArgument("ZeroOut expects a 1-D vector."));
auto input = input_tensor.flat<int32>();
// Create an output tensor
Tensor* output_tensor = NULL;
OP_REQUIRES_OK(context, context->allocate_output(0, input_tensor.shape(),
&output_tensor));
auto output_flat = output_tensor->flat<int32>();
// Set all but the first element of the output tensor to 0.
const int N = input.size();
for (int i = 1; i < N; i++) {
output_flat(i) = 0;
}
// Preserve the first input value if possible.
if (N > 0) output_flat(0) = input(0);
}
};
REGISTER_KERNEL_BUILDER(Name("ZeroOut").Device(DEVICE_CPU), ZeroOutOp)
#endif // PART_1
#ifdef PART_2
/*
Register the new op in a C++ file. Op registration defines an
interface (specification) for the op's functionality, which is
independent of the op's implementation. For example, op
registration defines the op's name and the op's inputs and
outputs. It also defines the shape function that is used
for tensor shape inference.
*/
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/shape_inference.h"
using namespace tensorflow;
class ZeroOutInt32Op : public OpKernel {
public:
explicit ZeroOutOp(OpKernelConstruction* context) : OpKernel(context) {
// Get the index of the value to preserve
OP_REQUIRES_OK(context,
context->GetAttr("preserve_index", &preserve_index));
// Check that preserve_index is positive
OP_REQUIRES(context, preserve_index >= 0,
errors::InvalidArgument("Need preserve_index >= 0, got ",
preserve_index));
}
void Compute(OpKernelContext* context) override {
// Grab the input tensor
const Tensor& input_tensor = context->input(0);
auto input = input_tensor.flat<int32>();
// Create an output tensor
Tensor* output_tensor = NULL;
OP_REQUIRES(context, TensorShapeUtils::IsVector(input_tensor.shape()),
errors::InvalidArgument("ZeroOut expects a 1-D vector."));
OP_REQUIRES_OK(context, context->allocate_output(0, input_tensor.shape(),
&output_tensor));
// We're using saved attr to validate potentially dynamic input
// So we check that preserve_index is in range
OP_REQUIRES(context, preserve_index < input.dimension(0),
errors::InvalidArgument("preserve_index out of range"));
auto output_flat = output_tensor->flat<int32>();
// Set all but the first element of the output tensor to 0.
const int N = input.size();
for (int i = 0; i < N; i++) {
output_flat(i) = 0;
}
// Preserve the requested input value
output_flat(preserve_index) = input(preserve_index);
// Preserve the first input value if possible.
if (N > 0) output_flat(0) = input(0);
}
};
class ZeroOutFloatOp : public OpKernel {
public:
explicit ZeroOutFloatOp(OpKernelConstruction* context) : OpKernel(context) {
// Get the index of the value to preserve
OP_REQUIRES_OK(context,
context->GetAttr("preserve_index", &preserve_index));
// Check that preserve_index is positive
OP_REQUIRES(context, preserve_index >= 0,
errors::InvalidArgument("Need preserve_index >= 0, got ",
preserve_index));
}
void Compute(OpKernelContext* context) override {
// Grab the input tensor
const Tensor& input_tensor = context->input(0);
auto input = input_tensor.flat<float>();
// Create an output tensor
Tensor* output_tensor = NULL;
OP_REQUIRES(context, TensorShapeUtils::IsVector(input_tensor.shape()),
errors::InvalidArgument("ZeroOut expects a 1-D vector."));
OP_REQUIRES_OK(context, context->allocate_output(0, input_tensor.shape(),
&output_tensor));
// We're using saved attr to validate potentially dynamic input
// So we check that preserve_index is in range
OP_REQUIRES(context, preserve_index < input.dimension(0),
errors::InvalidArgument("preserve_index out of range"));
auto output_flat = output_tensor->flat<float>();
// Set all but the first element of the output tensor to 0.
const int N = input.size();
for (int i = 0; i < N; i++) {
output_flat(i) = 0;
}
// Preserve the requested input value
output_flat(preserve_index) = input(preserve_index);
// Preserve the first input value if possible.
if (N > 0) output_flat(0) = input(0);
}
};
REGISTER_OP("ZeroOut")
.Attr("preserve_index: int")
.Attr("T: {float, int32} = DT_INT32")
.Input("to_zero: T")
.Output("zeroed: T")
.SetShapeFn([](::tensorflow::shape_inference::InferenceContext* c) {
c->set_output(0, c->input(0));
return Status::OK();
});
REGISTER_KERNEL_BUILDER(
Name("ZeroOut")
.Device(DEVICE_CPU)
.TypeConstraint<int32>("T"),
ZeroOutInt32Op);
REGISTER_KERNEL_BUILDER(
Name("ZeroOut")
.Device(DEVICE_CPU)
.TypeConstraint<int32>("T"),
ZeroOutFloatOp);
#endif // PART_2 | {
"pile_set_name": "Github"
} |
require_relative '../../spec_helper'
describe "Signal.list" do
RUBY_SIGNALS = %w{
EXIT
HUP
INT
QUIT
ILL
TRAP
IOT
ABRT
EMT
FPE
KILL
BUS
SEGV
SYS
PIPE
ALRM
TERM
URG
STOP
TSTP
CONT
CHLD
CLD
TTIN
TTOU
IO
XCPU
XFSZ
VTALRM
PROF
WINCH
USR1
USR2
LOST
MSG
PWR
POLL
DANGER
MIGRATE
PRE
GRANT
RETRACT
SOUND
INFO
}
it "doesn't contain other signals than the known list" do
(Signal.list.keys - RUBY_SIGNALS).should == []
end
if Signal.list["CHLD"]
it "redefines CLD with CHLD if defined" do
Signal.list["CLD"].should == Signal.list["CHLD"]
end
end
it "includes the EXIT key with a value of zero" do
Signal.list["EXIT"].should == 0
end
it "includes the KILL key with a value of nine" do
Signal.list["KILL"].should == 9
end
end
| {
"pile_set_name": "Github"
} |
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"
FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
echo Found %WRAPPER_JAR%
) else (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
echo Finished downloading %WRAPPER_JAR%
)
@REM End of extension
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%
| {
"pile_set_name": "Github"
} |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.
defmodule GoogleApi.AndroidEnterprise.V1.Model.GroupLicensesListResponse do
@moduledoc """
## Attributes
* `groupLicense` (*type:* `list(GoogleApi.AndroidEnterprise.V1.Model.GroupLicense.t)`, *default:* `nil`) - A group license for a product approved for use in the enterprise.
"""
use GoogleApi.Gax.ModelBase
@type t :: %__MODULE__{
:groupLicense => list(GoogleApi.AndroidEnterprise.V1.Model.GroupLicense.t())
}
field(:groupLicense, as: GoogleApi.AndroidEnterprise.V1.Model.GroupLicense, type: :list)
end
defimpl Poison.Decoder, for: GoogleApi.AndroidEnterprise.V1.Model.GroupLicensesListResponse do
def decode(value, options) do
GoogleApi.AndroidEnterprise.V1.Model.GroupLicensesListResponse.decode(value, options)
end
end
defimpl Poison.Encoder, for: GoogleApi.AndroidEnterprise.V1.Model.GroupLicensesListResponse do
def encode(value, options) do
GoogleApi.Gax.ModelBase.encode(value, options)
end
end
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0
/*
* Implementation of the hash table type.
*
* Author : Stephen Smalley, <[email protected]>
*/
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include "hashtab.h"
struct hashtab *hashtab_create(u32 (*hash_value)(struct hashtab *h, const void *key),
int (*keycmp)(struct hashtab *h, const void *key1, const void *key2),
u32 size)
{
struct hashtab *p;
u32 i;
p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
return p;
p->size = size;
p->nel = 0;
p->hash_value = hash_value;
p->keycmp = keycmp;
p->htable = kmalloc_array(size, sizeof(*p->htable), GFP_KERNEL);
if (!p->htable) {
kfree(p);
return NULL;
}
for (i = 0; i < size; i++)
p->htable[i] = NULL;
return p;
}
int hashtab_insert(struct hashtab *h, void *key, void *datum)
{
u32 hvalue;
struct hashtab_node *prev, *cur, *newnode;
cond_resched();
if (!h || h->nel == HASHTAB_MAX_NODES)
return -EINVAL;
hvalue = h->hash_value(h, key);
prev = NULL;
cur = h->htable[hvalue];
while (cur && h->keycmp(h, key, cur->key) > 0) {
prev = cur;
cur = cur->next;
}
if (cur && (h->keycmp(h, key, cur->key) == 0))
return -EEXIST;
newnode = kzalloc(sizeof(*newnode), GFP_KERNEL);
if (!newnode)
return -ENOMEM;
newnode->key = key;
newnode->datum = datum;
if (prev) {
newnode->next = prev->next;
prev->next = newnode;
} else {
newnode->next = h->htable[hvalue];
h->htable[hvalue] = newnode;
}
h->nel++;
return 0;
}
void *hashtab_search(struct hashtab *h, const void *key)
{
u32 hvalue;
struct hashtab_node *cur;
if (!h)
return NULL;
hvalue = h->hash_value(h, key);
cur = h->htable[hvalue];
while (cur && h->keycmp(h, key, cur->key) > 0)
cur = cur->next;
if (!cur || (h->keycmp(h, key, cur->key) != 0))
return NULL;
return cur->datum;
}
void hashtab_destroy(struct hashtab *h)
{
u32 i;
struct hashtab_node *cur, *temp;
if (!h)
return;
for (i = 0; i < h->size; i++) {
cur = h->htable[i];
while (cur) {
temp = cur;
cur = cur->next;
kfree(temp);
}
h->htable[i] = NULL;
}
kfree(h->htable);
h->htable = NULL;
kfree(h);
}
int hashtab_map(struct hashtab *h,
int (*apply)(void *k, void *d, void *args),
void *args)
{
u32 i;
int ret;
struct hashtab_node *cur;
if (!h)
return 0;
for (i = 0; i < h->size; i++) {
cur = h->htable[i];
while (cur) {
ret = apply(cur->key, cur->datum, args);
if (ret)
return ret;
cur = cur->next;
}
}
return 0;
}
void hashtab_stat(struct hashtab *h, struct hashtab_info *info)
{
u32 i, chain_len, slots_used, max_chain_len;
struct hashtab_node *cur;
slots_used = 0;
max_chain_len = 0;
for (slots_used = max_chain_len = i = 0; i < h->size; i++) {
cur = h->htable[i];
if (cur) {
slots_used++;
chain_len = 0;
while (cur) {
chain_len++;
cur = cur->next;
}
if (chain_len > max_chain_len)
max_chain_len = chain_len;
}
}
info->slots_used = slots_used;
info->max_chain_len = max_chain_len;
}
| {
"pile_set_name": "Github"
} |
{
"ver": "1.0.5",
"uuid": "91e3eca9-e807-4f49-a689-7a5e0ee67684",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
} | {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* ALSA sequencer Memory Manager
* Copyright (c) 1998 by Frank van de Pol <[email protected]>
* Jaroslav Kysela <[email protected]>
* 2000 by Takashi Iwai <[email protected]>
*/
#include <linux/init.h>
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/sched/signal.h>
#include <linux/mm.h>
#include <sound/core.h>
#include <sound/seq_kernel.h>
#include "seq_memory.h"
#include "seq_queue.h"
#include "seq_info.h"
#include "seq_lock.h"
static inline int snd_seq_pool_available(struct snd_seq_pool *pool)
{
return pool->total_elements - atomic_read(&pool->counter);
}
static inline int snd_seq_output_ok(struct snd_seq_pool *pool)
{
return snd_seq_pool_available(pool) >= pool->room;
}
/*
* Variable length event:
* The event like sysex uses variable length type.
* The external data may be stored in three different formats.
* 1) kernel space
* This is the normal case.
* ext.data.len = length
* ext.data.ptr = buffer pointer
* 2) user space
* When an event is generated via read(), the external data is
* kept in user space until expanded.
* ext.data.len = length | SNDRV_SEQ_EXT_USRPTR
* ext.data.ptr = userspace pointer
* 3) chained cells
* When the variable length event is enqueued (in prioq or fifo),
* the external data is decomposed to several cells.
* ext.data.len = length | SNDRV_SEQ_EXT_CHAINED
* ext.data.ptr = the additiona cell head
* -> cell.next -> cell.next -> ..
*/
/*
* exported:
* call dump function to expand external data.
*/
static int get_var_len(const struct snd_seq_event *event)
{
if ((event->flags & SNDRV_SEQ_EVENT_LENGTH_MASK) != SNDRV_SEQ_EVENT_LENGTH_VARIABLE)
return -EINVAL;
return event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
}
int snd_seq_dump_var_event(const struct snd_seq_event *event,
snd_seq_dump_func_t func, void *private_data)
{
int len, err;
struct snd_seq_event_cell *cell;
if ((len = get_var_len(event)) <= 0)
return len;
if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
char buf[32];
char __user *curptr = (char __force __user *)event->data.ext.ptr;
while (len > 0) {
int size = sizeof(buf);
if (len < size)
size = len;
if (copy_from_user(buf, curptr, size))
return -EFAULT;
err = func(private_data, buf, size);
if (err < 0)
return err;
curptr += size;
len -= size;
}
return 0;
}
if (!(event->data.ext.len & SNDRV_SEQ_EXT_CHAINED))
return func(private_data, event->data.ext.ptr, len);
cell = (struct snd_seq_event_cell *)event->data.ext.ptr;
for (; len > 0 && cell; cell = cell->next) {
int size = sizeof(struct snd_seq_event);
if (len < size)
size = len;
err = func(private_data, &cell->event, size);
if (err < 0)
return err;
len -= size;
}
return 0;
}
EXPORT_SYMBOL(snd_seq_dump_var_event);
/*
* exported:
* expand the variable length event to linear buffer space.
*/
static int seq_copy_in_kernel(char **bufptr, const void *src, int size)
{
memcpy(*bufptr, src, size);
*bufptr += size;
return 0;
}
static int seq_copy_in_user(char __user **bufptr, const void *src, int size)
{
if (copy_to_user(*bufptr, src, size))
return -EFAULT;
*bufptr += size;
return 0;
}
int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char *buf,
int in_kernel, int size_aligned)
{
int len, newlen;
int err;
if ((len = get_var_len(event)) < 0)
return len;
newlen = len;
if (size_aligned > 0)
newlen = roundup(len, size_aligned);
if (count < newlen)
return -EAGAIN;
if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
if (! in_kernel)
return -EINVAL;
if (copy_from_user(buf, (void __force __user *)event->data.ext.ptr, len))
return -EFAULT;
return newlen;
}
err = snd_seq_dump_var_event(event,
in_kernel ? (snd_seq_dump_func_t)seq_copy_in_kernel :
(snd_seq_dump_func_t)seq_copy_in_user,
&buf);
return err < 0 ? err : newlen;
}
EXPORT_SYMBOL(snd_seq_expand_var_event);
/*
* release this cell, free extended data if available
*/
static inline void free_cell(struct snd_seq_pool *pool,
struct snd_seq_event_cell *cell)
{
cell->next = pool->free;
pool->free = cell;
atomic_dec(&pool->counter);
}
void snd_seq_cell_free(struct snd_seq_event_cell * cell)
{
unsigned long flags;
struct snd_seq_pool *pool;
if (snd_BUG_ON(!cell))
return;
pool = cell->pool;
if (snd_BUG_ON(!pool))
return;
spin_lock_irqsave(&pool->lock, flags);
free_cell(pool, cell);
if (snd_seq_ev_is_variable(&cell->event)) {
if (cell->event.data.ext.len & SNDRV_SEQ_EXT_CHAINED) {
struct snd_seq_event_cell *curp, *nextptr;
curp = cell->event.data.ext.ptr;
for (; curp; curp = nextptr) {
nextptr = curp->next;
curp->next = pool->free;
free_cell(pool, curp);
}
}
}
if (waitqueue_active(&pool->output_sleep)) {
/* has enough space now? */
if (snd_seq_output_ok(pool))
wake_up(&pool->output_sleep);
}
spin_unlock_irqrestore(&pool->lock, flags);
}
/*
* allocate an event cell.
*/
static int snd_seq_cell_alloc(struct snd_seq_pool *pool,
struct snd_seq_event_cell **cellp,
int nonblock, struct file *file,
struct mutex *mutexp)
{
struct snd_seq_event_cell *cell;
unsigned long flags;
int err = -EAGAIN;
wait_queue_entry_t wait;
if (pool == NULL)
return -EINVAL;
*cellp = NULL;
init_waitqueue_entry(&wait, current);
spin_lock_irqsave(&pool->lock, flags);
if (pool->ptr == NULL) { /* not initialized */
pr_debug("ALSA: seq: pool is not initialized\n");
err = -EINVAL;
goto __error;
}
while (pool->free == NULL && ! nonblock && ! pool->closing) {
set_current_state(TASK_INTERRUPTIBLE);
add_wait_queue(&pool->output_sleep, &wait);
spin_unlock_irqrestore(&pool->lock, flags);
if (mutexp)
mutex_unlock(mutexp);
schedule();
if (mutexp)
mutex_lock(mutexp);
spin_lock_irqsave(&pool->lock, flags);
remove_wait_queue(&pool->output_sleep, &wait);
/* interrupted? */
if (signal_pending(current)) {
err = -ERESTARTSYS;
goto __error;
}
}
if (pool->closing) { /* closing.. */
err = -ENOMEM;
goto __error;
}
cell = pool->free;
if (cell) {
int used;
pool->free = cell->next;
atomic_inc(&pool->counter);
used = atomic_read(&pool->counter);
if (pool->max_used < used)
pool->max_used = used;
pool->event_alloc_success++;
/* clear cell pointers */
cell->next = NULL;
err = 0;
} else
pool->event_alloc_failures++;
*cellp = cell;
__error:
spin_unlock_irqrestore(&pool->lock, flags);
return err;
}
/*
* duplicate the event to a cell.
* if the event has external data, the data is decomposed to additional
* cells.
*/
int snd_seq_event_dup(struct snd_seq_pool *pool, struct snd_seq_event *event,
struct snd_seq_event_cell **cellp, int nonblock,
struct file *file, struct mutex *mutexp)
{
int ncells, err;
unsigned int extlen;
struct snd_seq_event_cell *cell;
*cellp = NULL;
ncells = 0;
extlen = 0;
if (snd_seq_ev_is_variable(event)) {
extlen = event->data.ext.len & ~SNDRV_SEQ_EXT_MASK;
ncells = (extlen + sizeof(struct snd_seq_event) - 1) / sizeof(struct snd_seq_event);
}
if (ncells >= pool->total_elements)
return -ENOMEM;
err = snd_seq_cell_alloc(pool, &cell, nonblock, file, mutexp);
if (err < 0)
return err;
/* copy the event */
cell->event = *event;
/* decompose */
if (snd_seq_ev_is_variable(event)) {
int len = extlen;
int is_chained = event->data.ext.len & SNDRV_SEQ_EXT_CHAINED;
int is_usrptr = event->data.ext.len & SNDRV_SEQ_EXT_USRPTR;
struct snd_seq_event_cell *src, *tmp, *tail;
char *buf;
cell->event.data.ext.len = extlen | SNDRV_SEQ_EXT_CHAINED;
cell->event.data.ext.ptr = NULL;
src = (struct snd_seq_event_cell *)event->data.ext.ptr;
buf = (char *)event->data.ext.ptr;
tail = NULL;
while (ncells-- > 0) {
int size = sizeof(struct snd_seq_event);
if (len < size)
size = len;
err = snd_seq_cell_alloc(pool, &tmp, nonblock, file,
mutexp);
if (err < 0)
goto __error;
if (cell->event.data.ext.ptr == NULL)
cell->event.data.ext.ptr = tmp;
if (tail)
tail->next = tmp;
tail = tmp;
/* copy chunk */
if (is_chained && src) {
tmp->event = src->event;
src = src->next;
} else if (is_usrptr) {
if (copy_from_user(&tmp->event, (char __force __user *)buf, size)) {
err = -EFAULT;
goto __error;
}
} else {
memcpy(&tmp->event, buf, size);
}
buf += size;
len -= size;
}
}
*cellp = cell;
return 0;
__error:
snd_seq_cell_free(cell);
return err;
}
/* poll wait */
int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file,
poll_table *wait)
{
poll_wait(file, &pool->output_sleep, wait);
return snd_seq_output_ok(pool);
}
/* allocate room specified number of events */
int snd_seq_pool_init(struct snd_seq_pool *pool)
{
int cell;
struct snd_seq_event_cell *cellptr;
if (snd_BUG_ON(!pool))
return -EINVAL;
cellptr = kvmalloc_array(sizeof(struct snd_seq_event_cell), pool->size,
GFP_KERNEL);
if (!cellptr)
return -ENOMEM;
/* add new cells to the free cell list */
spin_lock_irq(&pool->lock);
if (pool->ptr) {
spin_unlock_irq(&pool->lock);
kvfree(cellptr);
return 0;
}
pool->ptr = cellptr;
pool->free = NULL;
for (cell = 0; cell < pool->size; cell++) {
cellptr = pool->ptr + cell;
cellptr->pool = pool;
cellptr->next = pool->free;
pool->free = cellptr;
}
pool->room = (pool->size + 1) / 2;
/* init statistics */
pool->max_used = 0;
pool->total_elements = pool->size;
spin_unlock_irq(&pool->lock);
return 0;
}
/* refuse the further insertion to the pool */
void snd_seq_pool_mark_closing(struct snd_seq_pool *pool)
{
unsigned long flags;
if (snd_BUG_ON(!pool))
return;
spin_lock_irqsave(&pool->lock, flags);
pool->closing = 1;
spin_unlock_irqrestore(&pool->lock, flags);
}
/* remove events */
int snd_seq_pool_done(struct snd_seq_pool *pool)
{
struct snd_seq_event_cell *ptr;
if (snd_BUG_ON(!pool))
return -EINVAL;
/* wait for closing all threads */
if (waitqueue_active(&pool->output_sleep))
wake_up(&pool->output_sleep);
while (atomic_read(&pool->counter) > 0)
schedule_timeout_uninterruptible(1);
/* release all resources */
spin_lock_irq(&pool->lock);
ptr = pool->ptr;
pool->ptr = NULL;
pool->free = NULL;
pool->total_elements = 0;
spin_unlock_irq(&pool->lock);
kvfree(ptr);
spin_lock_irq(&pool->lock);
pool->closing = 0;
spin_unlock_irq(&pool->lock);
return 0;
}
/* init new memory pool */
struct snd_seq_pool *snd_seq_pool_new(int poolsize)
{
struct snd_seq_pool *pool;
/* create pool block */
pool = kzalloc(sizeof(*pool), GFP_KERNEL);
if (!pool)
return NULL;
spin_lock_init(&pool->lock);
pool->ptr = NULL;
pool->free = NULL;
pool->total_elements = 0;
atomic_set(&pool->counter, 0);
pool->closing = 0;
init_waitqueue_head(&pool->output_sleep);
pool->size = poolsize;
/* init statistics */
pool->max_used = 0;
return pool;
}
/* remove memory pool */
int snd_seq_pool_delete(struct snd_seq_pool **ppool)
{
struct snd_seq_pool *pool = *ppool;
*ppool = NULL;
if (pool == NULL)
return 0;
snd_seq_pool_mark_closing(pool);
snd_seq_pool_done(pool);
kfree(pool);
return 0;
}
/* exported to seq_clientmgr.c */
void snd_seq_info_pool(struct snd_info_buffer *buffer,
struct snd_seq_pool *pool, char *space)
{
if (pool == NULL)
return;
snd_iprintf(buffer, "%sPool size : %d\n", space, pool->total_elements);
snd_iprintf(buffer, "%sCells in use : %d\n", space, atomic_read(&pool->counter));
snd_iprintf(buffer, "%sPeak cells in use : %d\n", space, pool->max_used);
snd_iprintf(buffer, "%sAlloc success : %d\n", space, pool->event_alloc_success);
snd_iprintf(buffer, "%sAlloc failures : %d\n", space, pool->event_alloc_failures);
}
| {
"pile_set_name": "Github"
} |
Devise.setup do |config|
require "devise/orm/active_record"
config.timeout_in = 7200
end | {
"pile_set_name": "Github"
} |
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_
#define COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_
#include <stdint.h>
#include <memory>
#include "base/memory/ref_counted_memory.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/image/image.h"
#include "url/gurl.h"
namespace favicon_base {
struct FallbackIconStyle;
typedef int64_t FaviconID;
// Defines the icon types. They are also stored in icon_type field of favicons
// table.
// The values of the IconTypes are used to select the priority in which favicon
// data is returned in HistoryBackend and ThumbnailDatabase. Data for the
// largest IconType takes priority if data for multiple IconTypes is available.
enum IconType {
INVALID_ICON = 0x0,
FAVICON = 1 << 0,
TOUCH_ICON = 1 << 1,
TOUCH_PRECOMPOSED_ICON = 1 << 2
};
// Defines a gfx::Image of size desired_size_in_dip composed of image
// representations for each of the desired scale factors.
struct FaviconImageResult {
FaviconImageResult();
~FaviconImageResult();
// The resulting image.
gfx::Image image;
// The URL of the favicon which contains all of the image representations of
// |image|.
// TODO(pkotwicz): Return multiple |icon_urls| to allow |image| to have
// representations from several favicons once content::FaviconStatus supports
// multiple URLs.
GURL icon_url;
};
// Defines a favicon bitmap which best matches the desired DIP size and one of
// the desired scale factors.
struct FaviconRawBitmapResult {
FaviconRawBitmapResult();
FaviconRawBitmapResult(const FaviconRawBitmapResult& other);
~FaviconRawBitmapResult();
// Returns true if |bitmap_data| contains a valid bitmap.
bool is_valid() const { return bitmap_data.get() && bitmap_data->size(); }
// Indicates whether |bitmap_data| is expired.
bool expired;
// The bits of the bitmap.
scoped_refptr<base::RefCountedMemory> bitmap_data;
// The pixel dimensions of |bitmap_data|.
gfx::Size pixel_size;
// The URL of the containing favicon.
GURL icon_url;
// The icon type of the containing favicon.
IconType icon_type;
};
// Define type with same structure as FaviconRawBitmapResult for passing data to
// HistoryBackend::SetFavicons().
typedef FaviconRawBitmapResult FaviconRawBitmapData;
// Result returned by LargeIconService::GetLargeIconOrFallbackStyle(). Contains
// either the bitmap data if the favicon database has a sufficiently large
// favicon bitmap and the style of the fallback icon otherwise.
struct LargeIconResult {
explicit LargeIconResult(const FaviconRawBitmapResult& bitmap_in);
// Takes ownership of |fallback_icon_style_in|.
explicit LargeIconResult(FallbackIconStyle* fallback_icon_style_in);
~LargeIconResult();
// The bitmap from the favicon database if the database has a sufficiently
// large one.
FaviconRawBitmapResult bitmap;
// The fallback icon style if a sufficiently large icon isn't available. This
// uses the dominant color of a smaller icon as the background if available.
std::unique_ptr<FallbackIconStyle> fallback_icon_style;
};
} // namespace favicon_base
#endif // COMPONENTS_FAVICON_BASE_FAVICON_TYPES_H_
| {
"pile_set_name": "Github"
} |
//: Playground - noun: a place where people can play
import UIKit
//variable
var str = "Hello, playground"
var myVariable = 123
let myConstantVariable = 123
myVariable += 5
var aNonOptionalInteger = 42
if aNonOptionalInteger == 42 {
println("has a value")
} else {
println("no value")
}
//array
let aTuple = (1,"Yes")
let theNumber = aTuple.0
let theString = aTuple.1
let anotherTuple = (aNumber:1,aString:"Yes")
let tNumber = anotherTuple.aNumber
let tString = anotherTuple.aString
var arrayOfInt = [1,2,3]
arrayOfInt.append(4)
arrayOfInt.insert(0, atIndex: 0)
arrayOfInt.removeAtIndex(4)
arrayOfInt.reverse()
//dictionary
var Martin = [
"name":"Martin.Tsiu",
"Age":"23",
"Job":"Designer"
];
Martin["name"]
//for in
let loopingArray = [1,2,3,4,5]
var loopSum = 0
for number in loopingArray{
loopSum += number
}
loopSum
var countDown = 5
while countDown > 0 {
countDown--
println(countDown)
}
let intswitch = 3
switch intswitch {
case 0:
println("It's 0")
case 1:
println("It's 1")
case 2:
println("It's 2")
default:
println("something else")
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<booksignings xmlns="http://camelcookbook.org/schema/booksignings">
<store>
<address>
<street>123 Main St</street>
<city>Boston</city>
</address>
<authors>
<author>Scott Cranton</author>
</authors>
</store>
<store>
<address>
<street>321 Main St</street>
<city>London</city>
</address>
<authors>
<author>Jakub Korab</author>
</authors>
</store>
</booksignings> | {
"pile_set_name": "Github"
} |
{
sstore(0, 1)
}
| {
"pile_set_name": "Github"
} |
package events
import scala.concurrent.{Await, Future, Promise}
import scala.util.{Failure, Success, Try}
import scala.util.control.NonFatal
import org.apache.kafka.clients.CommonClientConfigs
import org.apache.kafka.clients.producer._
import org.apache.kafka.common.serialization.{ByteArraySerializer, StringSerializer}
import akka.Done
import akka.actor.{Actor, ActorSystem, Props}
import akka.http.scaladsl.util.FastFuture._
import akka.http.scaladsl.util.FastFuture
import akka.kafka.ProducerSettings
import akka.stream.scaladsl.{Sink, Source}
import org.apache.kafka.common.config.SslConfigs
import play.api.libs.json._
import env.Env
import org.apache.kafka.common.config.internals.BrokerSecurityConfigs
import ssl.DynamicSSLEngineProvider
import utils.http.MtlsConfig
case class KafkaConfig(servers: Seq[String],
keyPass: Option[String] = None,
keystore: Option[String] = None,
truststore: Option[String] = None,
sendEvents: Boolean = false,
alertsTopic: String = "otoroshi-alerts",
analyticsTopic: String = "otoroshi-analytics",
auditTopic: String = "otoroshi-audits",
mtlsConfig: MtlsConfig = MtlsConfig()) {
def json: JsValue = KafkaConfig.format.writes(this)
}
object KafkaConfig {
implicit val format = new Format[KafkaConfig] { // Json.format[KafkaConfig]
override def writes(o: KafkaConfig): JsValue = Json.obj(
"servers" -> JsArray(o.servers.map(JsString.apply)),
"keyPass" -> o.keyPass.map(JsString.apply).getOrElse(JsNull).as[JsValue],
"keystore" -> o.keystore.map(JsString.apply).getOrElse(JsNull).as[JsValue],
"truststore" -> o.truststore.map(JsString.apply).getOrElse(JsNull).as[JsValue],
"sendEvents" -> o.sendEvents,
"alertsTopic" -> o.alertsTopic,
"analyticsTopic" -> o.analyticsTopic,
"auditTopic" -> o.auditTopic,
"mtlsConfig" -> o.mtlsConfig.json,
)
override def reads(json: JsValue): JsResult[KafkaConfig] =
Try {
KafkaConfig(
servers = (json \ "servers").asOpt[Seq[String]].getOrElse(Seq.empty),
keyPass = (json \ "keyPass").asOpt[String],
keystore = (json \ "keystore").asOpt[String],
truststore = (json \ "truststore").asOpt[String],
sendEvents = (json \ "sendEvents").asOpt[Boolean].getOrElse(false),
alertsTopic = (json \ "alertsTopic").asOpt[String].getOrElse("otoroshi-alerts"),
analyticsTopic = (json \ "analyticsTopic").asOpt[String].getOrElse("otoroshi-analytics"),
auditTopic = (json \ "auditTopic").asOpt[String].getOrElse("otoroshi-audits"),
mtlsConfig = MtlsConfig.read((json \ "mtlsConfig").asOpt[JsValue])
)
} match {
case Failure(e) => JsError(e.getMessage)
case Success(kc) => JsSuccess(kc)
}
}
}
object KafkaSettings {
import scala.concurrent.duration._
def waitForFirstSetup(env: Env): Future[Unit] = {
Source
.tick(0.second, 1.second, ())
.filter(_ => DynamicSSLEngineProvider.isFirstSetupDone)
.take(1)
.runWith(Sink.head)(env.otoroshiMaterializer)
}
def producerSettings(_env: env.Env, config: KafkaConfig): ProducerSettings[Array[Byte], String] = {
val settings = ProducerSettings
.create(_env.analyticsActorSystem, new ByteArraySerializer(), new StringSerializer())
.withBootstrapServers(config.servers.mkString(","))
if (config.mtlsConfig.mtls) {
Await.result(waitForFirstSetup(_env), 5.seconds) // wait until certs fully populated at least once
val (jks1, jks2, password) = config.mtlsConfig.toJKS(_env)
settings
.withProperty(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SSL")
.withProperty(BrokerSecurityConfigs.SSL_CLIENT_AUTH_CONFIG, "required")
.withProperty(SslConfigs.SSL_KEY_PASSWORD_CONFIG, "")
.withProperty(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, jks1.getAbsolutePath)
.withProperty(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, password)
.withProperty(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, jks2.getAbsolutePath)
.withProperty(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, password)
} else {
val s = for {
ks <- config.keystore
ts <- config.truststore
kp <- config.keyPass
} yield {
settings
.withProperty(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SSL")
.withProperty(BrokerSecurityConfigs.SSL_CLIENT_AUTH_CONFIG, "required")
.withProperty(SslConfigs.SSL_KEY_PASSWORD_CONFIG, kp)
.withProperty(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, ks)
.withProperty(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, kp)
.withProperty(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, ts)
.withProperty(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, kp)
}
s.getOrElse(settings)
}
}
}
case class KafkaWrapperEvent(event: JsValue, env: Env, config: KafkaConfig)
case class KafkaWrapperEventClose()
class KafkaWrapper(actorSystem: ActorSystem, env: Env, topicFunction: KafkaConfig => String) {
val kafkaWrapperActor = actorSystem.actorOf(KafkaWrapperActor.props(env, topicFunction))
def publish(event: JsValue, forcePush: Boolean = false)(env: Env, config: KafkaConfig): Future[Done] = {
kafkaWrapperActor ! KafkaWrapperEvent(event, env, if (forcePush) config.copy(sendEvents = true) else config)
FastFuture.successful(Done)
}
def close(): Unit = {
kafkaWrapperActor ! KafkaWrapperEventClose()
}
}
class KafkaWrapperActor(env: Env, topicFunction: KafkaConfig => String) extends Actor {
implicit val ec = env.analyticsExecutionContext
var config: Option[KafkaConfig] = None
var eventProducer: Option[KafkaEventProducer] = None
lazy val logger = play.api.Logger("otoroshi-kafka-wrapper")
override def receive: Receive = {
case event: KafkaWrapperEvent if config.isEmpty && eventProducer.isEmpty => {
config = Some(event.config)
eventProducer.foreach(_.close())
eventProducer = Some(new KafkaEventProducer(event.env, event.config, topicFunction))
if (event.config.sendEvents) {
eventProducer.get.publish(event.event).andThen {
case Failure(e) => logger.error("Error while pushing event to kafka", e)
}
}
}
case event: KafkaWrapperEvent if config.isDefined && config.get != event.config && event.config.sendEvents => {
config = Some(event.config)
eventProducer.foreach(_.close())
eventProducer = Some(new KafkaEventProducer(event.env, event.config, topicFunction))
if (event.config.sendEvents) {
eventProducer.get.publish(event.event).andThen {
case Failure(e) => logger.error("Error while pushing event to kafka", e)
}
}
}
case event: KafkaWrapperEvent =>
if (event.config.sendEvents) {
eventProducer.get.publish(event.event).andThen {
case Failure(e) => logger.error("Error while pushing event to kafka", e)
}
}
case KafkaWrapperEventClose() =>
eventProducer.foreach(_.close())
config = None
eventProducer = None
case _ =>
}
}
object KafkaWrapperActor {
def props(env: Env, topicFunction: KafkaConfig => String) = Props(new KafkaWrapperActor(env, topicFunction))
}
class KafkaEventProducer(_env: env.Env, config: KafkaConfig, topicFunction: KafkaConfig => String) {
implicit val ec = _env.analyticsExecutionContext
lazy val logger = play.api.Logger("otoroshi-kafka-connector")
lazy val topic = topicFunction(config)
logger.debug(s"Initializing kafka event store on topic ${topic}")
private lazy val producerSettings = KafkaSettings.producerSettings(_env, config)
private lazy val producer: Producer[Array[Byte], String] = producerSettings.createKafkaProducer
def publish(event: JsValue): Future[Done] = {
val promise = Promise[RecordMetadata]
try {
val message = Json.stringify(event)
producer.send(new ProducerRecord[Array[Byte], String](topic, message), callback(promise))
} catch {
case NonFatal(e) =>
promise.failure(e)
}
promise.future.fast.map { _ =>
Done
}
}
def close() =
producer.close()
private def callback(promise: Promise[RecordMetadata]) = new Callback {
override def onCompletion(metadata: RecordMetadata, exception: Exception) =
if (exception != null) {
promise.failure(exception)
} else {
promise.success(metadata)
}
}
}
| {
"pile_set_name": "Github"
} |
#!/bin/sh
echo "const char *$2 ="
cat $1|sed 's/\\/\\\\/g'|sed 's/"/\\"/g'|sed 's/^/\"/'|sed 's/$/\\n\"/'
echo ";"
| {
"pile_set_name": "Github"
} |
#pragma once
// MESSAGE LED_CONTROL PACKING
#define MAVLINK_MSG_ID_LED_CONTROL 186
MAVPACKED(
typedef struct __mavlink_led_control_t {
uint8_t target_system; /*< System ID*/
uint8_t target_component; /*< Component ID*/
uint8_t instance; /*< Instance (LED instance to control or 255 for all LEDs)*/
uint8_t pattern; /*< Pattern (see LED_PATTERN_ENUM)*/
uint8_t custom_len; /*< Custom Byte Length*/
uint8_t custom_bytes[24]; /*< Custom Bytes*/
}) mavlink_led_control_t;
#define MAVLINK_MSG_ID_LED_CONTROL_LEN 29
#define MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN 29
#define MAVLINK_MSG_ID_186_LEN 29
#define MAVLINK_MSG_ID_186_MIN_LEN 29
#define MAVLINK_MSG_ID_LED_CONTROL_CRC 72
#define MAVLINK_MSG_ID_186_CRC 72
#define MAVLINK_MSG_LED_CONTROL_FIELD_CUSTOM_BYTES_LEN 24
#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_LED_CONTROL { \
186, \
"LED_CONTROL", \
6, \
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_led_control_t, target_system) }, \
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_led_control_t, target_component) }, \
{ "instance", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_led_control_t, instance) }, \
{ "pattern", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_led_control_t, pattern) }, \
{ "custom_len", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_led_control_t, custom_len) }, \
{ "custom_bytes", NULL, MAVLINK_TYPE_UINT8_T, 24, 5, offsetof(mavlink_led_control_t, custom_bytes) }, \
} \
}
#else
#define MAVLINK_MESSAGE_INFO_LED_CONTROL { \
"LED_CONTROL", \
6, \
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_led_control_t, target_system) }, \
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_led_control_t, target_component) }, \
{ "instance", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_led_control_t, instance) }, \
{ "pattern", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_led_control_t, pattern) }, \
{ "custom_len", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_led_control_t, custom_len) }, \
{ "custom_bytes", NULL, MAVLINK_TYPE_UINT8_T, 24, 5, offsetof(mavlink_led_control_t, custom_bytes) }, \
} \
}
#endif
/**
* @brief Pack a led_control message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param target_system System ID
* @param target_component Component ID
* @param instance Instance (LED instance to control or 255 for all LEDs)
* @param pattern Pattern (see LED_PATTERN_ENUM)
* @param custom_len Custom Byte Length
* @param custom_bytes Custom Bytes
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_led_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_LED_CONTROL_LEN];
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, target_component);
_mav_put_uint8_t(buf, 2, instance);
_mav_put_uint8_t(buf, 3, pattern);
_mav_put_uint8_t(buf, 4, custom_len);
_mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LED_CONTROL_LEN);
#else
mavlink_led_control_t packet;
packet.target_system = target_system;
packet.target_component = target_component;
packet.instance = instance;
packet.pattern = pattern;
packet.custom_len = custom_len;
mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LED_CONTROL_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_LED_CONTROL;
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
}
/**
* @brief Pack a led_control message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param target_system System ID
* @param target_component Component ID
* @param instance Instance (LED instance to control or 255 for all LEDs)
* @param pattern Pattern (see LED_PATTERN_ENUM)
* @param custom_len Custom Byte Length
* @param custom_bytes Custom Bytes
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_led_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint8_t target_system,uint8_t target_component,uint8_t instance,uint8_t pattern,uint8_t custom_len,const uint8_t *custom_bytes)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_LED_CONTROL_LEN];
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, target_component);
_mav_put_uint8_t(buf, 2, instance);
_mav_put_uint8_t(buf, 3, pattern);
_mav_put_uint8_t(buf, 4, custom_len);
_mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LED_CONTROL_LEN);
#else
mavlink_led_control_t packet;
packet.target_system = target_system;
packet.target_component = target_component;
packet.instance = instance;
packet.pattern = pattern;
packet.custom_len = custom_len;
mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LED_CONTROL_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_LED_CONTROL;
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
}
/**
* @brief Encode a led_control struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param led_control C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_led_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_led_control_t* led_control)
{
return mavlink_msg_led_control_pack(system_id, component_id, msg, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes);
}
/**
* @brief Encode a led_control struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param led_control C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_led_control_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_led_control_t* led_control)
{
return mavlink_msg_led_control_pack_chan(system_id, component_id, chan, msg, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes);
}
/**
* @brief Send a led_control message
* @param chan MAVLink channel to send the message
*
* @param target_system System ID
* @param target_component Component ID
* @param instance Instance (LED instance to control or 255 for all LEDs)
* @param pattern Pattern (see LED_PATTERN_ENUM)
* @param custom_len Custom Byte Length
* @param custom_bytes Custom Bytes
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_led_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_LED_CONTROL_LEN];
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, target_component);
_mav_put_uint8_t(buf, 2, instance);
_mav_put_uint8_t(buf, 3, pattern);
_mav_put_uint8_t(buf, 4, custom_len);
_mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, buf, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
#else
mavlink_led_control_t packet;
packet.target_system = target_system;
packet.target_component = target_component;
packet.instance = instance;
packet.pattern = pattern;
packet.custom_len = custom_len;
mav_array_memcpy(packet.custom_bytes, custom_bytes, sizeof(uint8_t)*24);
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)&packet, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
#endif
}
/**
* @brief Send a led_control message
* @param chan MAVLink channel to send the message
* @param struct The MAVLink struct to serialize
*/
static inline void mavlink_msg_led_control_send_struct(mavlink_channel_t chan, const mavlink_led_control_t* led_control)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
mavlink_msg_led_control_send(chan, led_control->target_system, led_control->target_component, led_control->instance, led_control->pattern, led_control->custom_len, led_control->custom_bytes);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)led_control, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
#endif
}
#if MAVLINK_MSG_ID_LED_CONTROL_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_led_control_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t instance, uint8_t pattern, uint8_t custom_len, const uint8_t *custom_bytes)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char *buf = (char *)msgbuf;
_mav_put_uint8_t(buf, 0, target_system);
_mav_put_uint8_t(buf, 1, target_component);
_mav_put_uint8_t(buf, 2, instance);
_mav_put_uint8_t(buf, 3, pattern);
_mav_put_uint8_t(buf, 4, custom_len);
_mav_put_uint8_t_array(buf, 5, custom_bytes, 24);
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, buf, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
#else
mavlink_led_control_t *packet = (mavlink_led_control_t *)msgbuf;
packet->target_system = target_system;
packet->target_component = target_component;
packet->instance = instance;
packet->pattern = pattern;
packet->custom_len = custom_len;
mav_array_memcpy(packet->custom_bytes, custom_bytes, sizeof(uint8_t)*24);
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LED_CONTROL, (const char *)packet, MAVLINK_MSG_ID_LED_CONTROL_MIN_LEN, MAVLINK_MSG_ID_LED_CONTROL_LEN, MAVLINK_MSG_ID_LED_CONTROL_CRC);
#endif
}
#endif
#endif
// MESSAGE LED_CONTROL UNPACKING
/**
* @brief Get field target_system from led_control message
*
* @return System ID
*/
static inline uint8_t mavlink_msg_led_control_get_target_system(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 0);
}
/**
* @brief Get field target_component from led_control message
*
* @return Component ID
*/
static inline uint8_t mavlink_msg_led_control_get_target_component(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 1);
}
/**
* @brief Get field instance from led_control message
*
* @return Instance (LED instance to control or 255 for all LEDs)
*/
static inline uint8_t mavlink_msg_led_control_get_instance(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 2);
}
/**
* @brief Get field pattern from led_control message
*
* @return Pattern (see LED_PATTERN_ENUM)
*/
static inline uint8_t mavlink_msg_led_control_get_pattern(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 3);
}
/**
* @brief Get field custom_len from led_control message
*
* @return Custom Byte Length
*/
static inline uint8_t mavlink_msg_led_control_get_custom_len(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 4);
}
/**
* @brief Get field custom_bytes from led_control message
*
* @return Custom Bytes
*/
static inline uint16_t mavlink_msg_led_control_get_custom_bytes(const mavlink_message_t* msg, uint8_t *custom_bytes)
{
return _MAV_RETURN_uint8_t_array(msg, custom_bytes, 24, 5);
}
/**
* @brief Decode a led_control message into a struct
*
* @param msg The message to decode
* @param led_control C-struct to decode the message contents into
*/
static inline void mavlink_msg_led_control_decode(const mavlink_message_t* msg, mavlink_led_control_t* led_control)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
led_control->target_system = mavlink_msg_led_control_get_target_system(msg);
led_control->target_component = mavlink_msg_led_control_get_target_component(msg);
led_control->instance = mavlink_msg_led_control_get_instance(msg);
led_control->pattern = mavlink_msg_led_control_get_pattern(msg);
led_control->custom_len = mavlink_msg_led_control_get_custom_len(msg);
mavlink_msg_led_control_get_custom_bytes(msg, led_control->custom_bytes);
#else
uint8_t len = msg->len < MAVLINK_MSG_ID_LED_CONTROL_LEN? msg->len : MAVLINK_MSG_ID_LED_CONTROL_LEN;
memset(led_control, 0, MAVLINK_MSG_ID_LED_CONTROL_LEN);
memcpy(led_control, _MAV_PAYLOAD(msg), len);
#endif
}
| {
"pile_set_name": "Github"
} |
// Copyright 2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.android.stardroid.control;
import com.google.android.stardroid.control.AstronomerModel.Pointing;
import com.google.android.stardroid.units.GeocentricCoordinates;
import com.google.android.stardroid.units.Matrix33;
import com.google.android.stardroid.units.Vector3;
import com.google.android.stardroid.util.Geometry;
import com.google.android.stardroid.util.MiscUtil;
import android.util.Log;
/**
* Allows user-input elements such as touch screens and trackballs to move the
* map.
*
* @author John Taylor
*/
public class ManualOrientationController extends AbstractController {
private static final String TAG = MiscUtil.getTag(ManualOrientationController.class);
@Override
public void start() {
// Nothing to do
}
@Override
public void stop() {
// Nothing to do
}
/**
* Moves the astronomer's pointing right or left.
*
* @param radians the angular change in the pointing in radians (only
* accurate in the limit as radians tends to 0.)
*/
public void changeRightLeft(float radians) {
// TODO(johntaylor): Some of the Math in here perhaps belongs in
// AstronomerModel.
if (!enabled) {
return;
}
Pointing pointing = model.getPointing();
GeocentricCoordinates pointingXyz = pointing.getLineOfSight();
GeocentricCoordinates topXyz = pointing.getPerpendicular();
Vector3 horizontalXyz = Geometry.vectorProduct(pointingXyz, topXyz);
Vector3 deltaXyz = Geometry.scaleVector(horizontalXyz, radians);
Vector3 newPointingXyz = Geometry.addVectors(pointingXyz, deltaXyz);
newPointingXyz.normalize();
model.setPointing(newPointingXyz, topXyz);
}
/**
* Moves the astronomer's pointing up or down.
*
* @param radians the angular change in the pointing in radians (only
* accurate in the limit as radians tends to 0.)
*/
public void changeUpDown(float radians) {
if (!enabled) {
return;
}
// Log.d(TAG, "Scrolling up down");
Pointing pointing = model.getPointing();
GeocentricCoordinates pointingXyz = pointing.getLineOfSight();
// Log.d(TAG, "Current view direction " + viewDir);
GeocentricCoordinates topXyz = pointing.getPerpendicular();
Vector3 deltaXyz = Geometry.scaleVector(topXyz, -radians);
Vector3 newPointingXyz = Geometry.addVectors(pointingXyz, deltaXyz);
newPointingXyz.normalize();
Vector3 deltaUpXyz = Geometry.scaleVector(pointingXyz, radians);
Vector3 newUpXyz = Geometry.addVectors(topXyz, deltaUpXyz);
newUpXyz.normalize();
model.setPointing(newPointingXyz, newUpXyz);
}
/**
* Rotates the astronomer's view.
*/
public void rotate(float degrees) {
if (!enabled) {
return;
}
Log.d(TAG, "Rotating by " + degrees);
Pointing pointing = model.getPointing();
GeocentricCoordinates pointingXyz = pointing.getLineOfSight();
Matrix33 rotation = Geometry.calculateRotationMatrix(degrees, pointingXyz);
GeocentricCoordinates topXyz = pointing.getPerpendicular();
Vector3 newUpXyz = Geometry.matrixVectorMultiply(rotation, topXyz);
newUpXyz.normalize();
model.setPointing(pointingXyz, newUpXyz);
}
}
| {
"pile_set_name": "Github"
} |
# ===================================================================
#
# Copyright (c) 2015, Legrandin <[email protected]>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# THIS SOFTWARE IS PROVIDED BY 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 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
# ===================================================================
from Crypto.Util.py3compat import bord
from Crypto.Util._raw_api import (load_pycryptodome_raw_lib,
VoidPointer, SmartPointer,
create_string_buffer,
get_raw_buffer, c_size_t,
c_uint8_ptr)
from Crypto.Hash.keccak import _raw_keccak_lib
class SHAKE256_XOF(object):
"""A SHAKE256 hash object.
Do not instantiate directly.
Use the :func:`new` function.
:ivar oid: ASN.1 Object ID
:vartype oid: string
"""
# ASN.1 Object ID
oid = "2.16.840.1.101.3.4.2.12"
def __init__(self, data=None):
state = VoidPointer()
result = _raw_keccak_lib.keccak_init(state.address_of(),
c_size_t(64),
0x1F)
if result:
raise ValueError("Error %d while instantiating SHAKE256"
% result)
self._state = SmartPointer(state.get(),
_raw_keccak_lib.keccak_destroy)
self._is_squeezing = False
if data:
self.update(data)
def update(self, data):
"""Continue hashing of a message by consuming the next chunk of data.
Args:
data (byte string/byte array/memoryview): The next chunk of the message being hashed.
"""
if self._is_squeezing:
raise TypeError("You cannot call 'update' after the first 'read'")
result = _raw_keccak_lib.keccak_absorb(self._state.get(),
c_uint8_ptr(data),
c_size_t(len(data)))
if result:
raise ValueError("Error %d while updating SHAKE256 state"
% result)
return self
def read(self, length):
"""
Compute the next piece of XOF output.
.. note::
You cannot use :meth:`update` anymore after the first call to
:meth:`read`.
Args:
length (integer): the amount of bytes this method must return
:return: the next piece of XOF output (of the given length)
:rtype: byte string
"""
self._is_squeezing = True
bfr = create_string_buffer(length)
result = _raw_keccak_lib.keccak_squeeze(self._state.get(),
bfr,
c_size_t(length))
if result:
raise ValueError("Error %d while extracting from SHAKE256"
% result)
return get_raw_buffer(bfr)
def new(self, data=None):
return type(self)(data=data)
def new(data=None):
"""Return a fresh instance of a SHAKE256 object.
Args:
data (byte string/byte array/memoryview):
The very first chunk of the message to hash.
It is equivalent to an early call to :meth:`update`.
Optional.
:Return: A :class:`SHAKE256_XOF` object
"""
return SHAKE256_XOF(data=data)
| {
"pile_set_name": "Github"
} |
package com.eden.orchid.wiki.utils
import com.caseyjbrooks.clog.Clog
import com.eden.common.util.EdenUtils
import com.eden.orchid.api.OrchidContext
import com.eden.orchid.api.resources.resource.OrchidResource
import com.eden.orchid.api.resources.resource.StringResource
import com.eden.orchid.api.theme.assets.AssetPage
import com.eden.orchid.api.theme.pages.OrchidReference
import com.eden.orchid.utilities.OrchidUtils
import com.eden.orchid.utilities.camelCase
import com.eden.orchid.utilities.from
import com.eden.orchid.utilities.titleCase
import com.eden.orchid.utilities.to
import com.eden.orchid.wiki.model.WikiSection
import com.eden.orchid.wiki.pages.WikiBookPage
import com.eden.orchid.wiki.pages.WikiPage
import com.eden.orchid.wiki.pages.WikiSummaryPage
import org.jsoup.Jsoup
object WikiUtils {
// Wiki Creation Helpers
//----------------------------------------------------------------------------------------------------------------------
/**
* Compile a summary file and traverse it to convert its links to wiki pages. For each link found, let a consumer
* locate the appropriate OrchidResource for that link.
*/
fun createWikiFromSummaryFile(
context: OrchidContext,
section: WikiSection,
summary: OrchidResource,
onLinkDetected: (linkName: String, linkTarget: String, order: Int) -> OrchidResource
): Pair<WikiSummaryPage, List<WikiPage>> {
val wiki = mutableListOf<WikiPage>()
val content = summary.compileContent(context, null)
val doc = Jsoup.parse(content)
var previous: WikiPage? = null
var i = 1
for (a in doc.select("a[href]")) {
val linkTarget = a.attr("href")
if (OrchidUtils.isExternal(linkTarget) || OrchidUtils.isAnchorReference(linkTarget)) continue
val linkName = a.text()
val resource = onLinkDetected(linkName, linkTarget, i)
if (resource.reference.originalFileName.equals("index", ignoreCase = true)) {
resource.reference.setAsDirectoryIndex()
}
val pageTitle = if (section.includeIndexInPageTitle) "${i + 1}. " + a.text() else a.text()
val page = WikiPage(resource, pageTitle, section.key, i + 1)
if (section.key.isBlank()) {
page.reference.stripFromPath("wiki")
page.reference.path = "wiki/${page.reference.originalPath}"
} else {
page.reference.stripFromPath("wiki/${section.key}")
page.reference.path = "wiki/${section.key}/${page.reference.originalPath}"
}
i++
wiki.add(page)
if (previous != null) {
previous.next = page
page.previous = previous
previous = page
} else {
previous = page
}
a.attr("href", page.reference.toString(context))
}
val newSummary = StringResource(summary.reference, doc.toString(), summary.embeddedData)
val definedSectionTitle = section.title
val sectionTitle =
if (!EdenUtils.isEmpty(definedSectionTitle)) definedSectionTitle
else if (!EdenUtils.isEmpty(section.key)) section.key
else "Wiki"
val summaryPage = WikiSummaryPage(
section.key,
newSummary,
sectionTitle from String::camelCase to Array<String>::titleCase
)
if (section.key.isBlank()) {
summaryPage.reference.path = ""
summaryPage.reference.fileName = "wiki"
summaryPage.reference.isUsePrettyUrl = true
} else {
summaryPage.reference.path = "wiki"
summaryPage.reference.fileName = section.key
summaryPage.reference.isUsePrettyUrl = true
}
return summaryPage to wiki
}
fun createWikiFromResources(
context: OrchidContext,
section: WikiSection,
resources: List<OrchidResource>
): Pair<WikiSummaryPage, List<WikiPage>> {
val wikiPages = resources
.sortedBy { it.reference.originalFullFileName }
.mapIndexed { index, resource ->
WikiPage(resource, "", section.key, index).also {
it.reference.path = "wiki/${section.key}"
}
}
var summaryPageContent = "<ul>"
for (page in wikiPages) {
summaryPageContent += """<li><a href="${page.link}">${page.title}</a></li>"""
}
summaryPageContent += "</ul>"
val definedSectionTitle = section.title
val sectionTitle =
if (!EdenUtils.isEmpty(definedSectionTitle)) definedSectionTitle
else if (!EdenUtils.isEmpty(section.key)) section.key
else "Wiki"
val summaryPage = WikiSummaryPage(
section.key,
StringResource(
OrchidReference(context, "wiki/${section.key}.html"),
summaryPageContent
),
sectionTitle from String::camelCase to Array<String>::titleCase
)
return summaryPage to wikiPages
}
// Generator Helpers
//----------------------------------------------------------------------------------------------------------------------
fun linkWikiPages(summaryPage: WikiSummaryPage, wiki: List<WikiPage>) {
// set up inter-page references properly
for (wikiPage in wiki) {
wikiPage.sectionSummary = summaryPage
wikiPage.parent = summaryPage
}
}
fun createWikiPdf(section: WikiSection): WikiBookPage? {
// create PDF from this section
return if (section.createPdf) {
val bookReference = OrchidReference(section.summaryPage.reference)
if (section.key.isBlank()) {
bookReference.path = "wiki"
bookReference.fileName = "book"
bookReference.extension = "pdf"
bookReference.isUsePrettyUrl = false
} else {
bookReference.path = "wiki/${section.key}"
bookReference.fileName = "book"
bookReference.extension = "pdf"
bookReference.isUsePrettyUrl = false
}
WikiBookPage(bookReference, section)
} else {
null
}
}
fun handleImages(onImageDetected: (String, Int) -> AssetPage?): (String) -> String = { input ->
val doc = Jsoup.parse(input)
var i = 1
for (img in doc.select("img")) {
val imageTarget = img.attr("src")
if (OrchidUtils.isExternal(imageTarget)) continue
val imageAsset = onImageDetected(imageTarget, i)
i++
if(imageAsset != null) {
img.attr("src", imageAsset.link)
}
else {
Clog.w("image asset referenced in wiki not found: {}", imageTarget)
}
}
doc.toString()
}
}
| {
"pile_set_name": "Github"
} |
#ifndef _IPXE_RETRY_H
#define _IPXE_RETRY_H
/** @file
*
* Retry timers
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/list.h>
/** Default timeout value */
#define DEFAULT_MIN_TIMEOUT ( TICKS_PER_SEC / 4 )
/** Limit after which the timeout will be deemed permanent */
#define DEFAULT_MAX_TIMEOUT ( 10 * TICKS_PER_SEC )
/** A retry timer */
struct retry_timer {
/** List of active timers */
struct list_head list;
/** Timer is currently running */
unsigned int running;
/** Timeout value (in ticks) */
unsigned long timeout;
/** Minimum timeout value (in ticks)
*
* A value of zero means "use default timeout."
*/
unsigned long min_timeout;
/** Maximum timeout value before failure (in ticks)
*
* A value of zero means "use default timeout."
*/
unsigned long max_timeout;
/** Start time (in ticks) */
unsigned long start;
/** Retry count */
unsigned int count;
/** Timer expired callback
*
* @v timer Retry timer
* @v fail Failure indicator
*
* The timer will already be stopped when this method is
* called. The failure indicator will be True if the retry
* timeout has already exceeded @c MAX_TIMEOUT.
*/
void ( * expired ) ( struct retry_timer *timer, int over );
/** Reference counter
*
* If this interface is not part of a reference-counted
* object, this field may be NULL.
*/
struct refcnt *refcnt;
};
/**
* Initialise a timer
*
* @v timer Retry timer
* @v expired Timer expired callback
* @v refcnt Reference counter, or NULL
*/
static inline __attribute__ (( always_inline )) void
timer_init ( struct retry_timer *timer,
void ( * expired ) ( struct retry_timer *timer, int over ),
struct refcnt *refcnt ) {
timer->expired = expired;
timer->refcnt = refcnt;
}
/**
* Initialise a static timer
*
* @v expired_fn Timer expired callback
*/
#define TIMER_INIT( expired_fn ) { \
.expired = (expired_fn), \
}
extern void start_timer ( struct retry_timer *timer );
extern void start_timer_fixed ( struct retry_timer *timer,
unsigned long timeout );
extern void stop_timer ( struct retry_timer *timer );
/**
* Start timer with no delay
*
* @v timer Retry timer
*
* This starts the timer running with a zero timeout value.
*/
static inline void start_timer_nodelay ( struct retry_timer *timer ) {
start_timer_fixed ( timer, 0 );
}
/**
* Test to see if timer is currently running
*
* @v timer Retry timer
* @ret running Non-zero if timer is running
*/
static inline __attribute__ (( always_inline )) unsigned long
timer_running ( struct retry_timer *timer ) {
return ( timer->running );
}
#endif /* _IPXE_RETRY_H */
| {
"pile_set_name": "Github"
} |
package types
import (
"testing"
"gotest.tools/assert"
is "gotest.tools/assert/cmp"
)
func TestNewInitialComposeFile(t *testing.T) {
f := NewInitialComposeFile()
assert.Check(t, is.Equal(f.Version, defaultComposefileVersion))
}
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0
#include "evlist.h"
#include "evsel.h"
#include "thread_map.h"
#include "cpumap.h"
#include "tests.h"
#include <errno.h>
#include <signal.h>
static int exited;
static int nr_exit;
static void sig_handler(int sig __maybe_unused)
{
exited = 1;
}
/*
* perf_evlist__prepare_workload will send a SIGUSR1 if the fork fails, since
* we asked by setting its exec_error to this handler.
*/
static void workload_exec_failed_signal(int signo __maybe_unused,
siginfo_t *info __maybe_unused,
void *ucontext __maybe_unused)
{
exited = 1;
nr_exit = -1;
}
/*
* This test will start a workload that does nothing then it checks
* if the number of exit event reported by the kernel is 1 or not
* in order to check the kernel returns correct number of event.
*/
int test__task_exit(struct test *test __maybe_unused, int subtest __maybe_unused)
{
int err = -1;
union perf_event *event;
struct perf_evsel *evsel;
struct perf_evlist *evlist;
struct target target = {
.uid = UINT_MAX,
.uses_mmap = true,
};
const char *argv[] = { "true", NULL };
char sbuf[STRERR_BUFSIZE];
struct cpu_map *cpus;
struct thread_map *threads;
struct perf_mmap *md;
signal(SIGCHLD, sig_handler);
evlist = perf_evlist__new_default();
if (evlist == NULL) {
pr_debug("perf_evlist__new_default\n");
return -1;
}
/*
* Create maps of threads and cpus to monitor. In this case
* we start with all threads and cpus (-1, -1) but then in
* perf_evlist__prepare_workload we'll fill in the only thread
* we're monitoring, the one forked there.
*/
cpus = cpu_map__dummy_new();
threads = thread_map__new_by_tid(-1);
if (!cpus || !threads) {
err = -ENOMEM;
pr_debug("Not enough memory to create thread/cpu maps\n");
goto out_free_maps;
}
perf_evlist__set_maps(evlist, cpus, threads);
cpus = NULL;
threads = NULL;
err = perf_evlist__prepare_workload(evlist, &target, argv, false,
workload_exec_failed_signal);
if (err < 0) {
pr_debug("Couldn't run the workload!\n");
goto out_delete_evlist;
}
evsel = perf_evlist__first(evlist);
evsel->attr.task = 1;
#ifdef __s390x__
evsel->attr.sample_freq = 1000000;
#else
evsel->attr.sample_freq = 1;
#endif
evsel->attr.inherit = 0;
evsel->attr.watermark = 0;
evsel->attr.wakeup_events = 1;
evsel->attr.exclude_kernel = 1;
err = perf_evlist__open(evlist);
if (err < 0) {
pr_debug("Couldn't open the evlist: %s\n",
str_error_r(-err, sbuf, sizeof(sbuf)));
goto out_delete_evlist;
}
if (perf_evlist__mmap(evlist, 128) < 0) {
pr_debug("failed to mmap events: %d (%s)\n", errno,
str_error_r(errno, sbuf, sizeof(sbuf)));
goto out_delete_evlist;
}
perf_evlist__start_workload(evlist);
retry:
md = &evlist->mmap[0];
if (perf_mmap__read_init(md) < 0)
goto out_init;
while ((event = perf_mmap__read_event(md)) != NULL) {
if (event->header.type == PERF_RECORD_EXIT)
nr_exit++;
perf_mmap__consume(md);
}
perf_mmap__read_done(md);
out_init:
if (!exited || !nr_exit) {
perf_evlist__poll(evlist, -1);
goto retry;
}
if (nr_exit != 1) {
pr_debug("received %d EXIT records\n", nr_exit);
err = -1;
}
out_free_maps:
cpu_map__put(cpus);
thread_map__put(threads);
out_delete_evlist:
perf_evlist__delete(evlist);
return err;
}
| {
"pile_set_name": "Github"
} |
FROM php:7-apache
RUN apt-get update && \
apt-get install -y libicu-dev --no-install-recommends && \
docker-php-ext-install intl && \
a2enmod remoteip rewrite headers && \
rm -rf /var/lib/apt/lists/* && \
apt-get purge -y --auto-remove libicu-dev
COPY config/apache/apache2.conf /etc/apache2/apache2.conf
COPY src/ /var/www/html/
| {
"pile_set_name": "Github"
} |
#include "carControl.h"
void leftwheel(uint8_t val) {
Wire.beginTransmission(0x38);
Wire.write(0x00);
Wire.write(val);
Wire.endTransmission();
}
void rightwheel(uint8_t val) {
Wire.beginTransmission(0x38);
Wire.write(0x01);
Wire.write(val);
Wire.endTransmission();
}
void led(uint8_t num, uint32_t val) {
Wire.beginTransmission(0x38);
Wire.write(0x02);
Wire.write(num);
Wire.write(uint8_t(val >> 16));
Wire.write(uint8_t(val >> 8));
Wire.write(uint8_t(val & 0x0f));
Wire.endTransmission();
}
| {
"pile_set_name": "Github"
} |
/* BasicTextAreaUI.java --
Copyright (C) 2004, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath 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.
GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package javax.swing.plaf.basic;
import java.beans.PropertyChangeEvent;
import javax.swing.JComponent;
import javax.swing.JTextArea;
import javax.swing.UIDefaults;
import javax.swing.plaf.ComponentUI;
import javax.swing.text.Element;
import javax.swing.text.PlainView;
import javax.swing.text.View;
import javax.swing.text.WrappedPlainView;
public class BasicTextAreaUI extends BasicTextUI
{
public static ComponentUI createUI(JComponent comp)
{
return new BasicTextAreaUI();
}
public BasicTextAreaUI()
{
// Nothing to do here.
}
/**
* Create the view. Returns a WrappedPlainView if the text area
* has lineWrap set to true, otherwise returns a PlainView. If
* lineWrap is true has to check whether the wrap style is word
* or character and return an appropriate WrappedPlainView.
*
* @param elem the element to create a View for
* @return an appropriate View for the element
*/
public View create(Element elem)
{
JTextArea comp = (JTextArea) getComponent();
if (comp.getLineWrap())
{
if (comp.getWrapStyleWord())
return new WrappedPlainView(elem, true);
else
return new WrappedPlainView(elem, false);
}
else
return new PlainView(elem);
}
/**
* Returns the prefix for entries in the {@link UIDefaults} table.
*
* @return "TextArea"
*/
protected String getPropertyPrefix()
{
return "TextArea";
}
/**
* Receives notification whenever one of the text component's bound
* properties changes. This changes the view to WrappedPlainView
* if setLineWrap(true) is called, and back to PlainView if
* setLineWrap(false) is called.
*
* @param ev the property change event
*/
protected void propertyChange(PropertyChangeEvent ev)
{
JTextArea comp = (JTextArea) getComponent();
if (ev.getPropertyName() == "lineWrap"
|| ev.getPropertyName() == "wrapStyleWord")
{
// Changes the View (without modifying the document or it's listeners).
setView(create(textComponent.getDocument().getDefaultRootElement()));
}
}
}
| {
"pile_set_name": "Github"
} |
/*
Copyright (c) 2008, Luke Benstead.
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.
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.
*/
#include <assert.h>
#include <stdlib.h>
#include "kazmath/vec3.h"
#include "kazmath/vec4.h"
#include "kazmath/plane.h"
const kmScalar kmPlaneDot(const kmPlane* pP, const kmVec4* pV)
{
//a*x + b*y + c*z + d*w
return (pP->a * pV->x +
pP->b * pV->y +
pP->c * pV->z +
pP->d * pV->w);
}
const kmScalar kmPlaneDotCoord(const kmPlane* pP, const kmVec3* pV)
{
return (pP->a * pV->x +
pP->b * pV->y +
pP->c * pV->z + pP->d);
}
const kmScalar kmPlaneDotNormal(const kmPlane* pP, const kmVec3* pV)
{
return (pP->a * pV->x +
pP->b * pV->y +
pP->c * pV->z);
}
kmPlane* const kmPlaneFromPointNormal(kmPlane* pOut, const kmVec3* pPoint, const kmVec3* pNormal)
{
/*
Planea = Nx
Planeb = Ny
Planec = Nz
Planed = −N⋅P
*/
pOut->a = pNormal->x;
pOut->b = pNormal->y;
pOut->c = pNormal->z;
pOut->d = -kmVec3Dot(pNormal, pPoint);
return pOut;
}
/**
* Creates a plane from 3 points. The result is stored in pOut.
* pOut is returned.
*/
kmPlane* const kmPlaneFromPoints(kmPlane* pOut, const kmVec3* p1, const kmVec3* p2, const kmVec3* p3)
{
/*
v = (B − A) × (C − A)
n = 1⁄|v| v
Outa = nx
Outb = ny
Outc = nz
Outd = −n⋅A
*/
kmVec3 n, v1, v2;
kmVec3Subtract(&v1, p2, p1); //Create the vectors for the 2 sides of the triangle
kmVec3Subtract(&v2, p3, p1);
kmVec3Cross(&n, &v1, &v2); //Use the cross product to get the normal
kmVec3Normalize(&n, &n); //Normalize it and assign to pOut->m_N
pOut->a = n.x;
pOut->b = n.y;
pOut->c = n.z;
pOut->d = kmVec3Dot(kmVec3Scale(&n, &n, -1.0), p1);
return pOut;
}
kmVec3* const kmPlaneIntersectLine(kmVec3* pOut, const kmPlane* pP, const kmVec3* pV1, const kmVec3* pV2)
{
/*
n = (Planea, Planeb, Planec)
d = V − U
Out = U − d⋅(Pd + n⋅U)⁄(d⋅n) [iff d⋅n ≠ 0]
*/
kmVec3 d;
assert(0 && "Not implemented");
kmVec3Subtract(&d, pV2, pV1); //Get the direction vector
//TODO: Continue here!
/*if (fabs(kmVec3Dot(&pP->m_N, &d)) > kmEpsilon)
{
//If we get here then the plane and line are parallel (i.e. no intersection)
pOut = nullptr; //Set to nullptr
return pOut;
} */
return NULL;
}
kmPlane* const kmPlaneNormalize(kmPlane* pOut, const kmPlane* pP)
{
kmVec3 n;
kmScalar l = 0;
n.x = pP->a;
n.y = pP->b;
n.z = pP->c;
l = 1.0f / kmVec3Length(&n); //Get 1/length
kmVec3Normalize(&n, &n); //Normalize the vector and assign to pOut
pOut->a = n.x;
pOut->b = n.y;
pOut->c = n.z;
pOut->d = pP->d * l; //Scale the D value and assign to pOut
return pOut;
}
kmPlane* const kmPlaneScale(kmPlane* pOut, const kmPlane* pP, kmScalar s)
{
assert(0 && "Not implemented");
return NULL;
}
/**
* Returns POINT_INFRONT_OF_PLANE if pP is infront of pIn. Returns
* POINT_BEHIND_PLANE if it is behind. Returns POINT_ON_PLANE otherwise
*/
const POINT_CLASSIFICATION kmPlaneClassifyPoint(const kmPlane* pIn, const kmVec3* pP)
{
// This function will determine if a point is on, in front of, or behind
// the plane. First we store the dot product of the plane and the point.
float distance = pIn->a * pP->x + pIn->b * pP->y + pIn->c * pP->z + pIn->d;
// Simply put if the dot product is greater than 0 then it is infront of it.
// If it is less than 0 then it is behind it. And if it is 0 then it is on it.
if(distance > 0.001) return POINT_INFRONT_OF_PLANE;
if(distance < -0.001) return POINT_BEHIND_PLANE;
return POINT_ON_PLANE;
}
| {
"pile_set_name": "Github"
} |
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSView.h"
@interface NSView (IBTransitionsEffectsInspectorAdditions)
+ (id)keyPathsForValuesAffectingIbInspectedDesignableSubviewsTransitionName;
+ (id)keyPathsForValuesAffectingIbShadowedDesignableSubviewsTransition;
- (void)setIbInspectedDesignableSubviewsTransitionName:(id)arg1;
- (id)ibInspectedDesignableSubviewsTransitionName;
- (id)ibShadowedDesignableSubviewsTransition;
@end
| {
"pile_set_name": "Github"
} |
alter table gha_skip_commits add dt timestamp without time zone;
update gha_skip_commits set dt = now();
alter table gha_skip_commits alter column dt set not null;
| {
"pile_set_name": "Github"
} |
using Microsoft.Extensions.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Recipes.ServiceStack.Entities;
using ServiceStack.Data;
using ServiceStack.OrmLite;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using ServiceStack.OrmLite.SqlServer.Converters;
namespace Recipes.ServiceStack
{
[TestClass]
public class Setup
{
private static Lazy<IDbConnectionFactory> DbConnectionFactoryFactory = new Lazy<IDbConnectionFactory>(() =>
{
// About SQL Server TIME Converter
// See: https://github.com/ServiceStack/ServiceStack.OrmLite/wiki/OrmLite-Type-Converters#sql-server-time-converter
SqlServerDialect.Provider.RegisterConverter<TimeSpan>(
new SqlServerTimeConverter
{
Precision = 7
});
var configuration = new ConfigurationBuilder().SetBasePath(AppContext.BaseDirectory).AddJsonFile("appsettings.json").Build();
var sqlServerConnectionString = configuration.GetSection("ConnectionStrings")["SqlServerTestDatabase"];
return new OrmLiteConnectionFactory(sqlServerConnectionString, SqlServerDialect.Provider);
});
internal static IDbConnectionFactory DbConnectionFactory => DbConnectionFactoryFactory.Value;
[AssemblyCleanup]
public static void AssemblyCleanup()
{
}
[AssemblyInitialize]
[SuppressMessage("Usage", "CA1801")]
public static void AssemblyInit(TestContext context)
{
try
{
new Setup().Warmup();
}
catch
{
}
}
[TestMethod]
public void CheckIncludes()
{
var e = new Employee
{
EmployeeClassificationId = 2,
FirstName = "test",
LastName = "test"
};
using (var db = DbConnectionFactory.OpenDbConnection())
{
using (var tx = db.OpenTransaction())
{
db.Save(e);
Assert.AreNotEqual(0, e.Id);
tx.Rollback();
}
}
}
[TestMethod]
public void TestFlags()
{
var a = new EmployeeClassification() { EmployeeClassificationName = "A T T " + DateTime.Now.Ticks, IsExempt = true, IsEmployee = true };
var b = new EmployeeClassification() { EmployeeClassificationName = "A F T " + DateTime.Now.Ticks, IsExempt = false, IsEmployee = true };
var c = new EmployeeClassification() { EmployeeClassificationName = "A T F " + DateTime.Now.Ticks, IsExempt = true, IsEmployee = false };
var d = new EmployeeClassification() { EmployeeClassificationName = "A F F " + DateTime.Now.Ticks, IsExempt = false, IsEmployee = false };
using (var db = DbConnectionFactory.OpenDbConnection())
{
db.Save(a);
db.Save(b);
db.Save(c);
db.Save(d);
}
}
[TestMethod]
public void Warmup()
{
long i = 0;
//Touch all of the models to validate entity mappings
using (var db = DbConnectionFactory.OpenDbConnection())
{
i = db.Count<Department>();
i += db.Count<Division>();
i += db.Count<Employee>();
i += db.Count<EmployeeClassification>();
}
Assert.AreNotEqual(0, i);
}
}
}
| {
"pile_set_name": "Github"
} |
/*
* CardOS specific operation for PKCS15 initialization
*
* Copyright (C) 2005 Nils Larsch <[email protected]>
* Copyright (C) 2002 Olaf Kirch <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdarg.h>
#include "libopensc/opensc.h"
#include "libopensc/cardctl.h"
#include "libopensc/log.h"
#include "libopensc/cards.h"
#include "libopensc/asn1.h"
#include "pkcs15-init.h"
#include "profile.h"
#ifndef MIN
# define MIN(a, b) (((a) < (b))? (a) : (b))
#endif
struct tlv {
unsigned char * base;
unsigned char * end;
unsigned char * current;
unsigned char * next;
};
/*
* Local functions
*/
static int cardos_store_pin(sc_profile_t *profile, sc_card_t *card,
sc_pkcs15_auth_info_t *auth_info, int puk_id,
const u8 *pin, size_t pin_len);
static int cardos_create_sec_env(sc_profile_t *, sc_card_t *,
unsigned int, unsigned int);
static int cardos_put_key(struct sc_profile *, sc_pkcs15_card_t *,
int, sc_pkcs15_prkey_info_t *,
struct sc_pkcs15_prkey_rsa *);
static int cardos_key_algorithm(unsigned int, size_t, int *);
static int cardos_extract_pubkey(sc_card_t *, sc_pkcs15_pubkey_t *,
sc_file_t *, int);
static int do_cardos_extract_pubkey(sc_card_t *card, int nr, u8 tag,
sc_pkcs15_bignum_t *bn);
static int cardos_have_verifyrc_package(sc_card_t *card);
/* Object IDs for PIN objects.
* SO PIN = 0x01, SO PUK = 0x02
* each user pin is 2*N+1, each corresponding PUK is 2*N+2
*/
#define CARDOS_PIN_ID_MIN 1
#define CARDOS_PIN_ID_MAX 15
#define CARDOS_KEY_ID_MIN 16
#define CARDOS_KEY_ID_MAX 31
#define CARDOS_AC_NEVER 0xFF
#define CARDOS_ALGO_RSA 0x08
#define CARDOS_ALGO_RSA_PURE 0x0C
#define CARDOS_ALGO_RSA_SIG 0x88
#define CARDOS_ALGO_RSA_PURE_SIG 0x8C
#define CARDOS_ALGO_RSA_SIG_SHA1 0xC8
#define CARDOS_ALGO_RSA_PURE_SIG_SHA1 0xCC
#define CARDOS_ALGO_EXT_RSA_PURE 0x0a
#define CARDOS_ALGO_EXT_RSA_SIG_PURE 0x8a
#define CARDOS_ALGO_PIN 0x87
static void tlv_init(struct tlv *tlv, u8 *base, size_t size)
{
tlv->base = base;
tlv->end = base + size;
tlv->current = tlv->next = base;
}
static void tlv_next(struct tlv *tlv, u8 tag)
{
assert(tlv->next + 2 < tlv->end);
tlv->current = tlv->next;
*(tlv->next++) = tag;
*(tlv->next++) = 0;
}
static void tlv_add(struct tlv *tlv, u8 val)
{
assert(tlv->next + 1 < tlv->end);
*(tlv->next++) = val;
tlv->current[1]++;
}
static size_t
tlv_len(struct tlv *tlv)
{
return tlv->next - tlv->base;
}
/*
* Try to delete pkcs15 structure
* This is not quite the same as erasing the whole token, but
* it's close enough to be useful.
*/
static int
cardos_erase(struct sc_profile *profile, sc_pkcs15_card_t *p15card)
{
return sc_pkcs15init_erase_card_recursively(p15card, profile);
}
/*
* Create the Application DF
*/
static int
cardos_create_dir(sc_profile_t *profile, sc_pkcs15_card_t *p15card, sc_file_t *df)
{
int r;
/* Create the application DF */
if ((r = sc_pkcs15init_create_file(profile, p15card, df)) < 0)
return r;
if ((r = sc_select_file(p15card->card, &df->path, NULL)) < 0)
return r;
/* Create a default security environment for this DF.
* This SE automatically becomes the current SE when the
* DF is selected. */
if ((r = cardos_create_sec_env(profile, p15card->card, 0x01, 0x00)) < 0)
return r;
return 0;
}
/*
* Caller passes in a suggested PIN reference.
* See if it's good, and if it isn't, propose something better
*/
static int
cardos_select_pin_reference(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
sc_pkcs15_auth_info_t *auth_info)
{
int preferred, current;
if (auth_info->auth_type != SC_PKCS15_PIN_AUTH_TYPE_PIN)
return SC_ERROR_OBJECT_NOT_VALID;
if ((current = auth_info->attrs.pin.reference) < 0)
current = CARDOS_PIN_ID_MIN;
if (auth_info->attrs.pin.flags & SC_PKCS15_PIN_FLAG_SO_PIN) {
preferred = 1;
if (current > preferred)
return SC_ERROR_TOO_MANY_OBJECTS;
} else {
preferred = current;
/* PINs are even numbered, PUKs are odd */
if (!(preferred & 1))
preferred++;
}
if (preferred > CARDOS_PIN_ID_MAX)
return SC_ERROR_TOO_MANY_OBJECTS;
auth_info->attrs.pin.reference = preferred;
return SC_SUCCESS;
}
/*
* Store a PIN
*/
static int
cardos_create_pin(sc_profile_t *profile, sc_pkcs15_card_t *p15card, sc_file_t *df,
sc_pkcs15_object_t *pin_obj,
const u8 *pin, size_t pin_len,
const u8 *puk, size_t puk_len)
{
sc_pkcs15_auth_info_t *auth_info = (sc_pkcs15_auth_info_t *) pin_obj->data;
struct sc_card *card = p15card->card;
unsigned int puk_id = CARDOS_AC_NEVER;
int r;
if (!pin || !pin_len)
return SC_ERROR_INVALID_ARGUMENTS;
if (auth_info->auth_type != SC_PKCS15_PIN_AUTH_TYPE_PIN)
return SC_ERROR_OBJECT_NOT_VALID;
r = sc_select_file(card, auth_info->attrs.pin.reference & 0x80 ? &df->path : sc_get_mf_path(), NULL);
if (r < 0)
return r;
if (puk && puk_len) {
struct sc_pkcs15_auth_info puk_ainfo;
sc_profile_get_pin_info(profile,
SC_PKCS15INIT_USER_PUK, &puk_ainfo);
puk_ainfo.attrs.pin.reference = puk_id = auth_info->attrs.pin.reference + 1;
r = cardos_store_pin(profile, card,
&puk_ainfo, CARDOS_AC_NEVER,
puk, puk_len);
}
if (r >= 0) {
r = cardos_store_pin(profile, card,
auth_info, puk_id, pin, pin_len);
}
return r;
}
/*
* Select a key reference
*/
static int
cardos_select_key_reference(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
sc_pkcs15_prkey_info_t *key_info)
{
if (key_info->key_reference < CARDOS_KEY_ID_MIN)
key_info->key_reference = CARDOS_KEY_ID_MIN;
if (key_info->key_reference > CARDOS_KEY_ID_MAX)
return SC_ERROR_TOO_MANY_OBJECTS;
return 0;
}
/*
* Create a private key object.
* This is a no-op.
*/
static int
cardos_create_key(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
sc_pkcs15_object_t *obj)
{
return 0;
}
/*
* Store a private key object.
*/
static int
cardos_store_key(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
sc_pkcs15_object_t *obj,
sc_pkcs15_prkey_t *key)
{
struct sc_context *ctx = p15card->card->ctx;
sc_pkcs15_prkey_info_t *key_info = (sc_pkcs15_prkey_info_t *) obj->data;
struct sc_file *file = NULL;
int algorithm = 0, r;
if (obj->type != SC_PKCS15_TYPE_PRKEY_RSA) {
sc_log(ctx, "CardOS supports RSA keys only.");
return SC_ERROR_NOT_SUPPORTED;
}
if (cardos_key_algorithm(key_info->usage, key_info->modulus_length, &algorithm) < 0) {
sc_log(ctx, "CardOS does not support keys "
"that can both sign _and_ decrypt.");
return SC_ERROR_NOT_SUPPORTED;
}
r = sc_select_file(p15card->card, &key_info->path, &file);
if (r) {
sc_log(ctx, "Failed to store key: cannot select parent DF");
return r;
}
r = sc_pkcs15init_authenticate(profile, p15card, file, SC_AC_OP_UPDATE);
sc_file_free(file);
if (r) {
sc_log(ctx, "Failed to store key: 'UPDATE' authentication failed");
return r;
}
r = cardos_put_key(profile, p15card, algorithm, key_info, &key->u.rsa);
return r;
}
static void init_key_object(struct sc_pkcs15_prkey_rsa *key,
u8 *data, size_t len)
{
/* Create a key object, initializing components to 0xff */
memset(key, 0x00, sizeof(*key));
memset(data, 0xff, len);
key->modulus.data = data;
key->modulus.len = len;
key->d.data = data;
key->d.len = len;
key->p.len = len >> 1;
key->p.data = data;
key->q.len = len >> 1;
key->q.data = data;
key->iqmp.len = len >> 1;
key->iqmp.data = data;
key->dmp1.len = len >> 1;
key->dmp1.data = data;
key->dmq1.len = len >> 1;
key->dmq1.data = data;
}
/*
* Key generation
*/
static int
cardos_generate_key(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
sc_pkcs15_object_t *obj,
sc_pkcs15_pubkey_t *pubkey)
{
struct sc_context *ctx = p15card->card->ctx;
struct sc_pkcs15_prkey_info *key_info = (sc_pkcs15_prkey_info_t *) obj->data;
struct sc_pkcs15_prkey_rsa key_obj;
struct sc_cardctl_cardos_genkey_info args;
struct sc_file *temp;
u8 abignum[256];
int algorithm = 0, r, delete_it = 0, use_ext_rsa = 0;
size_t keybits, rsa_max_size;
int pin_id = -1;
if (obj->type != SC_PKCS15_TYPE_PRKEY_RSA)
return SC_ERROR_NOT_SUPPORTED;
rsa_max_size = (sc_card_find_rsa_alg(p15card->card, 2048) != NULL) ? 2048 : 1024;
keybits = key_info->modulus_length & ~7UL;
if (keybits > rsa_max_size) {
sc_log(ctx, "Unable to generate key, max size is %lu",
(unsigned long) rsa_max_size);
return SC_ERROR_INVALID_ARGUMENTS;
}
if (keybits > 1024)
use_ext_rsa = 1;
if (cardos_key_algorithm(key_info->usage, keybits, &algorithm) < 0) {
sc_log(ctx, "CardOS does not support keys "
"that can both sign _and_ decrypt.");
return SC_ERROR_NOT_SUPPORTED;
}
if (sc_profile_get_file(profile, "tempfile", &temp) < 0) {
sc_log(ctx, "Profile doesn't define temporary file "
"for key generation.");
return SC_ERROR_NOT_SUPPORTED;
}
pin_id = sc_pkcs15init_get_pin_reference(p15card, profile,
SC_AC_SYMBOLIC, SC_PKCS15INIT_USER_PIN);
if (pin_id >= 0) {
r = sc_pkcs15init_verify_secret(profile, p15card, NULL, SC_AC_CHV, pin_id);
if (r < 0)
return r;
}
if (use_ext_rsa == 0)
temp->ef_structure = SC_FILE_EF_LINEAR_VARIABLE_TLV;
else
temp->ef_structure = SC_FILE_EF_TRANSPARENT;
if ((r = sc_pkcs15init_create_file(profile, p15card, temp)) < 0)
goto out;
delete_it = 1;
init_key_object(&key_obj, abignum, keybits >> 3);
r = cardos_put_key(profile, p15card, algorithm, key_info, &key_obj);
if (r < 0)
goto out;
memset(&args, 0, sizeof(args));
args.key_id = key_info->key_reference;
args.key_bits = keybits;
args.fid = temp->id;
r = sc_card_ctl(p15card->card, SC_CARDCTL_CARDOS_GENERATE_KEY, &args);
if (r < 0)
goto out;
r = cardos_extract_pubkey(p15card->card, pubkey, temp, use_ext_rsa);
out:
if (delete_it != 0)
sc_pkcs15init_rmdir(p15card, profile, temp);
sc_file_free(temp);
if (r < 0) {
if (pubkey->u.rsa.modulus.data)
free (pubkey->u.rsa.modulus.data);
if (pubkey->u.rsa.exponent.data)
free (pubkey->u.rsa.exponent.data);
}
return r;
}
/*
* Object deletion.
*/
static int
cardos_delete_object(sc_profile_t *profile, struct sc_pkcs15_card *p15card,
struct sc_pkcs15_object *obj, const struct sc_path *path)
{
int r = SC_SUCCESS, stored_in_ef = 0, algorithm = 0;
size_t keybits;
sc_file_t *file = NULL;
struct sc_pkcs15_prkey_info *key_info;
struct sc_pkcs15_prkey_rsa key_obj;
struct sc_context *ctx = p15card->card->ctx;
uint8_t abignum[256];
LOG_FUNC_CALLED(ctx);
/*
* If we are deleting a private key, overwrite it so it can't be used.
*/
if ((obj->type & SC_PKCS15_TYPE_CLASS_MASK) == SC_PKCS15_TYPE_PRKEY) {
key_info = obj->data;
keybits = key_info->modulus_length & ~7UL;
init_key_object(&key_obj, abignum, keybits >> 3);
r = cardos_key_algorithm(key_info->usage, keybits, &algorithm);
LOG_TEST_RET(ctx, r, "cardos_key_algorithm failed");
r = sc_select_file(p15card->card, &key_info->path, &file);
LOG_TEST_RET(ctx, r, "Failed to store key: cannot select parent DF");
r = sc_pkcs15init_authenticate(profile, p15card, file, SC_AC_OP_UPDATE);
sc_file_free(file);
LOG_TEST_RET(ctx, r, "Failed to store key: UPDATE authentication failed");
r = cardos_put_key(profile, p15card, algorithm, key_info, &key_obj);
LOG_TEST_RET(ctx, r, "cardos_put_key failed");
}
/* Delete object from the PKCS15 file system. */
if (path->len || path->aid.len) {
r = sc_select_file(p15card->card, path, &file);
if (r != SC_ERROR_FILE_NOT_FOUND)
LOG_TEST_RET(ctx, r, "select object path failed");
stored_in_ef = (file->type != SC_FILE_TYPE_DF);
sc_file_free(file);
}
/* If the object is stored in a normal EF, try to delete the EF. */
if (r == SC_SUCCESS && stored_in_ef) {
r = sc_pkcs15init_delete_by_path(profile, p15card, path);
LOG_TEST_RET(ctx, r, "Failed to delete object by path");
}
LOG_FUNC_RETURN(ctx, SC_SUCCESS);
}
/*
* Store a PIN or PUK
*/
static int
cardos_store_pin(sc_profile_t *profile, sc_card_t *card,
sc_pkcs15_auth_info_t *auth_info, int puk_id,
const u8 *pin, size_t pin_len)
{
struct sc_cardctl_cardos_obj_info args;
unsigned char buffer[256];
unsigned char pinpadded[256];
struct tlv tlv;
unsigned int attempts, minlen, maxlen;
int r, hasverifyrc;
if (auth_info->auth_type != SC_PKCS15_PIN_AUTH_TYPE_PIN)
return SC_ERROR_OBJECT_NOT_VALID;
/* We need to do padding because pkcs15-lib.c does it.
* Would be nice to have a flag in the profile that says
* "no padding required". */
maxlen = MIN(profile->pin_maxlen, sizeof(pinpadded));
if (pin_len > maxlen) {
sc_log(card->ctx,
"invalid pin length: %"SC_FORMAT_LEN_SIZE_T"u (max %u)\n",
pin_len, maxlen);
return SC_ERROR_INVALID_ARGUMENTS;
}
memcpy(pinpadded, pin, pin_len);
while (pin_len < maxlen)
pinpadded[pin_len++] = profile->pin_pad_char;
pin = pinpadded;
attempts = auth_info->tries_left;
minlen = auth_info->attrs.pin.min_length;
tlv_init(&tlv, buffer, sizeof(buffer));
/* object address: class, id */
tlv_next(&tlv, 0x83);
tlv_add(&tlv, 0x00); /* class byte: usage TEST, k=0 */
tlv_add(&tlv, auth_info->attrs.pin.reference & 0x7f);
/* parameters */
tlv_next(&tlv, 0x85);
tlv_add(&tlv, 0x02); /* options byte */
hasverifyrc = cardos_have_verifyrc_package(card);
if (hasverifyrc == 1)
/* Use 9 byte OCI parameters to be able to set VerifyRC bit */
tlv_add(&tlv, 0x04); /* options_2 byte with bit 2 set to return CurrentErrorCounter */
tlv_add(&tlv, attempts & 0xf); /* flags byte */
tlv_add(&tlv, CARDOS_ALGO_PIN); /* algorithm = pin-test */
tlv_add(&tlv, attempts & 0xf); /* errcount = attempts */
/* usecount: not documented, but seems to work like this:
* - value of 0xff means pin can be presented any number
* of times
* - anything less: max # of times before BS object is blocked.
*/
tlv_add(&tlv, 0xff);
/* DEK: not documented, no idea what it means */
tlv_add(&tlv, 0xff);
/* ARA counter: number of times the test object can be used before
* another verification is required (~ user consent)
* (0x00 unlimited usage)
*/
tlv_add(&tlv, 0x00);
tlv_add(&tlv, minlen); /* minlen */
/* AC conditions */
tlv_next(&tlv, 0x86);
tlv_add(&tlv, 0x00); /* use: always */
tlv_add(&tlv, auth_info->attrs.pin.reference); /* change: PIN */
tlv_add(&tlv, puk_id); /* unblock: PUK */
/* data: PIN */
tlv_next(&tlv, 0x8f);
while (pin_len--)
tlv_add(&tlv, *pin++);
args.data = buffer;
args.len = tlv_len(&tlv);
/* ensure we are in the correct lifecycle */
r = sc_pkcs15init_set_lifecycle(card, SC_CARDCTRL_LIFECYCLE_ADMIN);
if (r < 0 && r != SC_ERROR_NOT_SUPPORTED)
return r;
return sc_card_ctl(card, SC_CARDCTL_CARDOS_PUT_DATA_OCI, &args);
}
/*
* Create an empty security environment
*/
static int
cardos_create_sec_env(struct sc_profile *profile, sc_card_t *card,
unsigned int se_id, unsigned int key_id)
{
struct sc_cardctl_cardos_obj_info args;
struct tlv tlv;
unsigned char buffer[64];
int r;
tlv_init(&tlv, buffer, sizeof(buffer));
tlv_next(&tlv, 0x83);
tlv_add(&tlv, se_id);
tlv_next(&tlv, 0x86);
tlv_add(&tlv, 0);
tlv_add(&tlv, 0);
tlv_next(&tlv, 0x8f);
tlv_add(&tlv, key_id);
tlv_add(&tlv, key_id);
tlv_add(&tlv, key_id);
tlv_add(&tlv, key_id);
tlv_add(&tlv, key_id);
tlv_add(&tlv, key_id);
args.data = buffer;
args.len = tlv_len(&tlv);
/* ensure we are in the correct lifecycle */
r = sc_pkcs15init_set_lifecycle(card, SC_CARDCTRL_LIFECYCLE_ADMIN);
if (r < 0 && r != SC_ERROR_NOT_SUPPORTED)
return r;
return sc_card_ctl(card, SC_CARDCTL_CARDOS_PUT_DATA_SECI, &args);
}
/*
* Determine the key algorithm based on the intended usage
* Note that CardOS/M4 does not support keys that can be used
* for signing _and_ decipherment
*/
#define USAGE_ANY_SIGN (SC_PKCS15_PRKEY_USAGE_SIGN|\
SC_PKCS15_PRKEY_USAGE_NONREPUDIATION)
#define USAGE_ANY_DECIPHER (SC_PKCS15_PRKEY_USAGE_DECRYPT|\
SC_PKCS15_PRKEY_USAGE_UNWRAP)
static int cardos_key_algorithm(unsigned int usage, size_t keylen, int *algop)
{
/* if it is sign and decipher, we use decipher and emulate sign */
if (usage & USAGE_ANY_DECIPHER) {
if (keylen <= 1024)
*algop = CARDOS_ALGO_RSA_PURE;
else
*algop = CARDOS_ALGO_EXT_RSA_PURE;
return 0;
}
if (usage & USAGE_ANY_SIGN) {
if (keylen <= 1024)
*algop = CARDOS_ALGO_RSA_PURE_SIG;
else
*algop = CARDOS_ALGO_EXT_RSA_SIG_PURE;
return 0;
}
return -1;
}
/*
* Create a private key object
*/
#define CARDOS_KEY_OPTIONS 0x02
#define CARDOS_KEY_FLAGS 0x00
static int
cardos_store_key_component(sc_card_t *card,
int algorithm,
unsigned int key_id, unsigned int pin_id,
unsigned int num,
const u8 *data, size_t len,
int last, int use_prefix)
{
struct sc_cardctl_cardos_obj_info args;
struct tlv tlv;
unsigned char buffer[256];
#ifdef SET_SM_BYTES
unsigned int n;
#endif
int r;
/* Initialize the TLV encoder */
tlv_init(&tlv, buffer, sizeof(buffer));
/* Object address */
tlv_next(&tlv, 0x83);
tlv_add(&tlv, 0x20|num); /* PSO, n-th component */
tlv_add(&tlv, key_id);
/* Object parameters */
tlv_next(&tlv, 0x85);
tlv_add(&tlv, CARDOS_KEY_OPTIONS|(last? 0x00 : 0x20));
tlv_add(&tlv, CARDOS_KEY_FLAGS);
tlv_add(&tlv, algorithm);
tlv_add(&tlv, 0x00);
tlv_add(&tlv, 0xFF); /* use count */
tlv_add(&tlv, 0xFF); /* DEK (whatever this is) */
tlv_add(&tlv, 0x00);
tlv_add(&tlv, 0x00);
/* AC bytes */
tlv_next(&tlv, 0x86);
tlv_add(&tlv, pin_id); /* AC USE */
tlv_add(&tlv, pin_id); /* AC CHANGE */
tlv_add(&tlv, pin_id); /* UNKNOWN */
tlv_add(&tlv, 0); /* rfu */
tlv_add(&tlv, 0); /* rfu */
tlv_add(&tlv, 0); /* rfu */
tlv_add(&tlv, 0);
#ifdef SET_SM_BYTES
/* it shouldn't be necessary to set the default value */
/* SM bytes */
tlv_next(&tlv, 0x8B);
for (n = 0; n < 16; n++)
tlv_add(&tlv, 0xFF);
#endif
/* key component */
tlv_next(&tlv, 0x8f);
if (use_prefix != 0) {
tlv_add(&tlv, len+1);
tlv_add(&tlv, 0);
}
while (len--)
tlv_add(&tlv, *data++);
args.data = buffer;
args.len = tlv_len(&tlv);
/* ensure we are in the correct lifecycle */
r = sc_pkcs15init_set_lifecycle(card, SC_CARDCTRL_LIFECYCLE_ADMIN);
if (r < 0 && r != SC_ERROR_NOT_SUPPORTED)
return r;
return sc_card_ctl(card, SC_CARDCTL_CARDOS_PUT_DATA_OCI, &args);
}
static int
cardos_put_key(sc_profile_t *profile, struct sc_pkcs15_card *p15card,
int algorithm, sc_pkcs15_prkey_info_t *key_info,
struct sc_pkcs15_prkey_rsa *key)
{
struct sc_card *card = p15card->card;
int r, key_id, pin_id;
pin_id = sc_pkcs15init_get_pin_reference(p15card, profile, SC_AC_SYMBOLIC,
SC_PKCS15INIT_USER_PIN);
if (pin_id < 0)
pin_id = 0;
key_id = key_info->key_reference;
if (key_info->modulus_length > 1024 && (card->type == SC_CARD_TYPE_CARDOS_M4_2 ||
card->type == SC_CARD_TYPE_CARDOS_M4_3 ||card->type == SC_CARD_TYPE_CARDOS_M4_2B ||
card->type == SC_CARD_TYPE_CARDOS_M4_2C ||card->type == SC_CARD_TYPE_CARDOS_M4_4)) {
r = cardos_store_key_component(card, algorithm, key_id, pin_id, 0,
key->p.data, key->p.len, 0, 0);
if (r != SC_SUCCESS)
return r;
r = cardos_store_key_component(card, algorithm, key_id, pin_id, 1,
key->q.data, key->q.len, 0, 0);
if (r != SC_SUCCESS)
return r;
r = cardos_store_key_component(card, algorithm, key_id, pin_id, 2,
key->dmp1.data, key->dmp1.len, 0, 0);
if (r != SC_SUCCESS)
return r;
r = cardos_store_key_component(card, algorithm, key_id, pin_id, 3,
key->dmq1.data, key->dmq1.len, 0, 0);
if (r != SC_SUCCESS)
return r;
r = cardos_store_key_component(card, algorithm, key_id, pin_id, 4,
key->iqmp.data, key->iqmp.len, 1, 0);
} else {
r = cardos_store_key_component(card, algorithm, key_id, pin_id, 0,
key->modulus.data, key->modulus.len, 0, 1);
if (r != SC_SUCCESS)
return r;
r = cardos_store_key_component(card, algorithm, key_id, pin_id, 1,
key->d.data, key->d.len, 1, 1);
}
return r;
}
/*
* Extract a key component from the public key file populated by
* GENERATE KEY PAIR
*/
static int parse_ext_pubkey_file(sc_card_t *card, const u8 *data, size_t len,
sc_pkcs15_pubkey_t *pubkey)
{
const u8 *p;
size_t ilen = 0, tlen = 0;
if (data == NULL || len < 32)
return SC_ERROR_INVALID_ARGUMENTS;
data = sc_asn1_find_tag(card->ctx, data, len, 0x7f49, &ilen);
if (data == NULL) {
sc_log(card->ctx, "invalid public key data: missing tag");
return SC_ERROR_INTERNAL;
}
p = sc_asn1_find_tag(card->ctx, data, ilen, 0x81, &tlen);
if (p == NULL) {
sc_log(card->ctx, "invalid public key data: missing modulus");
return SC_ERROR_INTERNAL;
}
pubkey->u.rsa.modulus.len = tlen;
pubkey->u.rsa.modulus.data = malloc(tlen);
if (pubkey->u.rsa.modulus.data == NULL)
return SC_ERROR_OUT_OF_MEMORY;
memcpy(pubkey->u.rsa.modulus.data, p, tlen);
p = sc_asn1_find_tag(card->ctx, data, ilen, 0x82, &tlen);
if (p == NULL) {
sc_log(card->ctx, "invalid public key data: missing exponent");
return SC_ERROR_INTERNAL;
}
pubkey->u.rsa.exponent.len = tlen;
pubkey->u.rsa.exponent.data = malloc(tlen);
if (pubkey->u.rsa.exponent.data == NULL)
return SC_ERROR_OUT_OF_MEMORY;
memcpy(pubkey->u.rsa.exponent.data, p, tlen);
return SC_SUCCESS;
}
static int
do_cardos_extract_pubkey(sc_card_t *card, int nr, u8 tag,
sc_pkcs15_bignum_t *bn)
{
u8 buf[256];
int r, count;
r = sc_read_record(card, nr, buf, sizeof(buf), SC_RECORD_BY_REC_NR);
if (r < 0)
return r;
count = r - 4;
if (count <= 0 || buf[0] != tag || buf[1] != count + 2
|| buf[2] != count + 1 || buf[3] != 0)
return SC_ERROR_INTERNAL;
bn->len = count;
bn->data = malloc(count);
if (bn->data == NULL)
return SC_ERROR_OUT_OF_MEMORY;
memcpy(bn->data, buf + 4, count);
return SC_SUCCESS;
}
static int cardos_extract_pubkey(sc_card_t *card, sc_pkcs15_pubkey_t *pubkey,
sc_file_t *tfile, int use_ext_rsa)
{
int r;
memset(pubkey, 0, sizeof(*pubkey));
r = sc_select_file(card, &tfile->path, NULL);
if (r != SC_SUCCESS)
return r;
if (use_ext_rsa == 0) {
r = do_cardos_extract_pubkey(card, 1, 0x10, &pubkey->u.rsa.modulus);
if (r != SC_SUCCESS)
return r;
r = do_cardos_extract_pubkey(card, 2, 0x11, &pubkey->u.rsa.exponent);
} else {
u8 *buf;
buf = malloc(tfile->size);
if (buf == NULL)
return SC_ERROR_OUT_OF_MEMORY;
r = sc_read_binary(card, 0, buf, tfile->size, 0);
if (r > 0)
r = parse_ext_pubkey_file(card, buf, (size_t)r, pubkey);
free(buf);
}
pubkey->algorithm = SC_ALGORITHM_RSA;
return r;
}
static int cardos_have_verifyrc_package(sc_card_t *card)
{
sc_apdu_t apdu;
u8 rbuf[SC_MAX_APDU_BUFFER_SIZE];
int r;
const u8 *p = rbuf, *q;
size_t len, tlen = 0, ilen = 0;
sc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xca, 0x01, 0x88);
apdu.resp = rbuf;
apdu.resplen = sizeof(rbuf);
apdu.lc = 0;
apdu.le = 256;
r = sc_transmit_apdu(card, &apdu);
LOG_TEST_RET(card->ctx, r, "APDU transmit failed");
if ((len = apdu.resplen) == 0)
/* looks like no package has been installed */
return 0;
while (len != 0) {
p = sc_asn1_find_tag(card->ctx, p, len, 0xe1, &tlen);
if (p == NULL)
return 0;
if (card->type == SC_CARD_TYPE_CARDOS_M4_3) {
/* the verifyRC package on CardOS 4.3B use Manufacturer ID 0x01 */
/* and Package Number 0x07 */
q = sc_asn1_find_tag(card->ctx, p, tlen, 0x01, &ilen);
if (q == NULL || ilen != 4)
return 0;
if (q[0] == 0x07)
return 1;
} else if (card->type == SC_CARD_TYPE_CARDOS_M4_4) {
/* the verifyRC package on CardOS 4.4 use Manufacturer ID 0x03 */
/* and Package Number 0x02 */
q = sc_asn1_find_tag(card->ctx, p, tlen, 0x03, &ilen);
if (q == NULL || ilen != 4)
return 0;
if (q[0] == 0x02)
return 1;
} else {
return 0;
}
p += tlen;
len -= tlen + 2;
}
return 0;
}
static struct sc_pkcs15init_operations sc_pkcs15init_cardos_operations = {
cardos_erase,
NULL, /* init_card */
cardos_create_dir,
NULL, /* create_domain */
cardos_select_pin_reference,
cardos_create_pin,
cardos_select_key_reference,
cardos_create_key,
cardos_store_key,
cardos_generate_key,
NULL, NULL, /* encode private/public key */
NULL, /* finalize_card */
cardos_delete_object,
NULL, NULL, NULL, NULL, NULL, /* pkcs15init emulation */
NULL /* sanity_check */
};
struct sc_pkcs15init_operations *
sc_pkcs15init_get_cardos_ops(void)
{
return &sc_pkcs15init_cardos_operations;
}
| {
"pile_set_name": "Github"
} |
package rule
import (
"go/ast"
"github.com/mgechev/revive/lint"
)
// UnreachableCodeRule lints unreachable code.
type UnreachableCodeRule struct{}
// Apply applies the rule to given file.
func (r *UnreachableCodeRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure {
var failures []lint.Failure
onFailure := func(failure lint.Failure) {
failures = append(failures, failure)
}
var branchingFunctions = map[string]map[string]bool{
"os": map[string]bool{"Exit": true},
"log": map[string]bool{
"Fatal": true,
"Fatalf": true,
"Fatalln": true,
"Panic": true,
"Panicf": true,
"Panicln": true,
},
}
w := lintUnreachableCode{onFailure, branchingFunctions}
ast.Walk(w, file.AST)
return failures
}
// Name returns the rule name.
func (r *UnreachableCodeRule) Name() string {
return "unreachable-code"
}
type lintUnreachableCode struct {
onFailure func(lint.Failure)
branchingFunctions map[string]map[string]bool
}
func (w lintUnreachableCode) Visit(node ast.Node) ast.Visitor {
blk, ok := node.(*ast.BlockStmt)
if !ok {
return w
}
if len(blk.List) < 2 {
return w
}
loop:
for i, stmt := range blk.List[:len(blk.List)-1] {
// println("iterating ", len(blk.List))
next := blk.List[i+1]
if _, ok := next.(*ast.LabeledStmt); ok {
continue // skip if next statement is labeled
}
switch s := stmt.(type) {
case *ast.ReturnStmt:
w.onFailure(newUnreachableCodeFailure(s))
break loop
case *ast.BranchStmt:
token := s.Tok.String()
if token != "fallthrough" {
w.onFailure(newUnreachableCodeFailure(s))
break loop
}
case *ast.ExprStmt:
ce, ok := s.X.(*ast.CallExpr)
if !ok {
continue
}
// it's a function call
fc, ok := ce.Fun.(*ast.SelectorExpr)
if !ok {
continue
}
id, ok := fc.X.(*ast.Ident)
if !ok {
continue
}
fn := fc.Sel.Name
pkg := id.Name
if !w.branchingFunctions[pkg][fn] { // it isn't a call to a branching function
continue
}
if _, ok := next.(*ast.ReturnStmt); ok { // return statement needed to satisfy function signature
continue
}
w.onFailure(newUnreachableCodeFailure(s))
break loop
}
}
return w
}
func newUnreachableCodeFailure(node ast.Node) lint.Failure {
return lint.Failure{
Confidence: 1,
Node: node,
Category: "logic",
Failure: "unreachable code after this statement",
}
}
| {
"pile_set_name": "Github"
} |
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import React from 'react';
import { withTheme } from '../../../cn';
import Icon from '../..';
import { IconProps } from '../../icon';
class IconCardVisa extends React.PureComponent<IconProps> {
render() {
return (
<Icon
{ ...this.props }
name="card-visa"
/>
);
}
}
export default withTheme<IconProps, IconCardVisa>(IconCardVisa);
| {
"pile_set_name": "Github"
} |
'use strict'
process.env.BABEL_ENV = 'web'
const path = require('path')
const webpack = require('webpack')
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
// TODO update
let webConfig = {
devtool: '#cheap-module-eval-source-map',
entry: {
web: path.join(__dirname, '../src/renderer/index.tsx')
},
module: {
rules: [
{
test: /\.scss$/,
use: [
{
loader: MiniCssExtractPlugin.loader
},
'css-loader',
'sass-loader'
]
},
{
test: /\.sass$/,
use: [
{
loader: MiniCssExtractPlugin.loader
},
'css-loader',
'sass-loader?indentedSyntax'
]
},
{
test: /\.less$/,
use: [
{
loader: MiniCssExtractPlugin.loader
},
'css-loader',
'less-loader'
]
},
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader
},
'css-loader'
]
},
{
test: /\.(js|jsx|ts|tsx)$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
experimentalWatchApi: true
},
exclude: /node_modules/
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: {
loader: 'url-loader',
query: {
limit: 10000,
name: 'imgs/[name].[ext]'
}
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
use: {
loader: 'url-loader',
query: {
limit: 10000,
name: 'fonts/[name].[ext]'
}
}
}
]
},
plugins: [
new MiniCssExtractPlugin({ filename: 'styles.css' }),
new ForkTsCheckerWebpackPlugin(),
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.resolve(__dirname, '../src/index.ejs'),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true
},
nodeModules: false
}),
new webpack.DefinePlugin({
'process.env.IS_WEB': 'true'
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
],
output: {
filename: '[name].js',
path: path.join(__dirname, '../dist/web')
},
resolve: {
alias: {
'@': path.join(__dirname, '../src/renderer')
},
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.css']
},
target: 'web'
}
/**
* Adjust webConfig for production settings
*/
if (process.env.NODE_ENV === 'production') {
webConfig.devtool = ''
webConfig.optimization = {
minimize: true,
minimizer: [new TerserPlugin({ extractComments: false })]
}
webConfig.plugins.push(
new CopyWebpackPlugin([
{
from: path.join(__dirname, '../static'),
to: path.join(__dirname, '../dist/web/static'),
ignore: ['.*']
}
]),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
)
}
module.exports = webConfig
| {
"pile_set_name": "Github"
} |
heat_template_version: 2013-05-23
description: 'Template for test _generate_hot_from_tosca().'
parameters:
nfv:
type: json
resources:
VDU1:
type: OS::Nova::Server
properties:
flavor:
get_resource: VDU1_flavor
name: VDU1
image: { get_param: [ nfv, VDU, VDU1, image ] }
networks:
- port:
get_resource: CP1
CP1:
type: OS::Neutron::Port
properties:
network: { get_param: [ nfv, CP, CP1, network ] }
VDU1_flavor:
type: OS::Nova::Flavor
properties:
ram: { get_param: [ nfv, VDU, VDU1, flavor, ram ] }
vcpus: { get_param: [ nfv, VDU, VDU1, flavor, vcpus ] }
disk: { get_param: [ nfv, VDU, VDU1, flavor, disk ] }
outputs: {}
| {
"pile_set_name": "Github"
} |
package ram
//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 Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses"
)
// ListUsers invokes the ram.ListUsers API synchronously
// api document: https://help.aliyun.com/api/ram/listusers.html
func (client *Client) ListUsers(request *ListUsersRequest) (response *ListUsersResponse, err error) {
response = CreateListUsersResponse()
err = client.DoAction(request, response)
return
}
// ListUsersWithChan invokes the ram.ListUsers API asynchronously
// api document: https://help.aliyun.com/api/ram/listusers.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) ListUsersWithChan(request *ListUsersRequest) (<-chan *ListUsersResponse, <-chan error) {
responseChan := make(chan *ListUsersResponse, 1)
errChan := make(chan error, 1)
err := client.AddAsyncTask(func() {
defer close(responseChan)
defer close(errChan)
response, err := client.ListUsers(request)
if err != nil {
errChan <- err
} else {
responseChan <- response
}
})
if err != nil {
errChan <- err
close(responseChan)
close(errChan)
}
return responseChan, errChan
}
// ListUsersWithCallback invokes the ram.ListUsers API asynchronously
// api document: https://help.aliyun.com/api/ram/listusers.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) ListUsersWithCallback(request *ListUsersRequest, callback func(response *ListUsersResponse, err error)) <-chan int {
result := make(chan int, 1)
err := client.AddAsyncTask(func() {
var response *ListUsersResponse
var err error
defer close(result)
response, err = client.ListUsers(request)
callback(response, err)
result <- 1
})
if err != nil {
defer close(result)
callback(nil, err)
result <- 0
}
return result
}
// ListUsersRequest is the request struct for api ListUsers
type ListUsersRequest struct {
*requests.RpcRequest
Marker string `position:"Query" name:"Marker"`
MaxItems requests.Integer `position:"Query" name:"MaxItems"`
}
// ListUsersResponse is the response struct for api ListUsers
type ListUsersResponse struct {
*responses.BaseResponse
RequestId string `json:"RequestId" xml:"RequestId"`
IsTruncated bool `json:"IsTruncated" xml:"IsTruncated"`
Marker string `json:"Marker" xml:"Marker"`
Users UsersInListUsers `json:"Users" xml:"Users"`
}
// CreateListUsersRequest creates a request to invoke ListUsers API
func CreateListUsersRequest() (request *ListUsersRequest) {
request = &ListUsersRequest{
RpcRequest: &requests.RpcRequest{},
}
request.InitWithApiInfo("Ram", "2015-05-01", "ListUsers", "ram", "openAPI")
return
}
// CreateListUsersResponse creates a response to parse from ListUsers response
func CreateListUsersResponse() (response *ListUsersResponse) {
response = &ListUsersResponse{
BaseResponse: &responses.BaseResponse{},
}
return
}
| {
"pile_set_name": "Github"
} |
{
"images": [
{
"idiom": "universal"
},
{
"filename": "scoops06.png",
"scale": "1x",
"idiom": "universal"
},
{
"filename": "[email protected]",
"scale": "2x",
"idiom": "universal"
},
{
"filename": "[email protected]",
"scale": "3x",
"idiom": "universal"
},
{
"idiom": "iphone"
},
{
"scale": "1x",
"idiom": "iphone"
},
{
"scale": "2x",
"idiom": "iphone"
},
{
"subtype": "retina4",
"scale": "2x",
"idiom": "iphone"
},
{
"scale": "3x",
"idiom": "iphone"
},
{
"idiom": "ipad"
},
{
"scale": "1x",
"idiom": "ipad"
},
{
"scale": "2x",
"idiom": "ipad"
},
{
"idiom": "watch"
},
{
"scale": "2x",
"idiom": "watch"
},
{
"screenWidth": "{130,145}",
"scale": "2x",
"idiom": "watch"
},
{
"screenWidth": "{146,165}",
"scale": "2x",
"idiom": "watch"
},
{
"idiom": "mac"
},
{
"scale": "1x",
"idiom": "mac"
},
{
"scale": "2x",
"idiom": "mac"
}
],
"info": {
"version": 1,
"author": "xcode"
}
} | {
"pile_set_name": "Github"
} |
export { appError, clearAppErrorModal } from './app-error';
export { emitBuildLog, emitBuildResults, emitBuildStatus, onBuildLog, onBuildResults, onBuildStatus } from './events';
export { initBuildProgress } from './progress';
export { initBuildStatus } from './status';
export { logBuild, logDiagnostic, logDisabled, logReload, logWarn } from './logger';
export { hmrWindow } from './hmr-window';
| {
"pile_set_name": "Github"
} |
/***********************************************************************
*
* Copyright (c) 2012-2020 Barbara Geller
* Copyright (c) 2012-2020 Ansel Sermersheim
*
* Copyright (c) 2015 The Qt Company Ltd.
* Copyright (c) 2012-2016 Digia Plc and/or its subsidiary(-ies).
* Copyright (c) 2008-2012 Nokia Corporation and/or its subsidiary(-ies).
*
* This file is part of CopperSpice.
*
* CopperSpice is free software. You can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* CopperSpice 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.
*
* https://www.gnu.org/licenses/
*
***********************************************************************/
#ifndef QSCRIPTDEBUGGEREVENT_P_H
#define QSCRIPTDEBUGGEREVENT_P_H
#include <QtCore/qobjectdefs.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qhash.h>
#include <QtCore/qvariant.h>
#include <QtCore/qscopedpointer.h>
QT_BEGIN_NAMESPACE
class QDataStream;
class QScriptDebuggerValue;
class QScriptDebuggerEventPrivate;
class QScriptDebuggerEvent
{
public:
friend QDataStream &operator<<(QDataStream &, const QScriptDebuggerEvent &);
friend QDataStream &operator>>(QDataStream &, QScriptDebuggerEvent &);
enum Type {
None,
Interrupted,
SteppingFinished,
LocationReached,
Breakpoint,
Exception,
Trace,
InlineEvalFinished,
DebuggerInvocationRequest,
ForcedReturn,
UserEvent = 1000,
MaxUserEvent = 32767
};
enum Attribute {
ScriptID,
FileName,
BreakpointID,
LineNumber,
ColumnNumber,
Value,
Message,
IsNestedEvaluate,
HasExceptionHandler,
UserAttribute = 1000,
MaxUserAttribute = 32767
};
QScriptDebuggerEvent();
QScriptDebuggerEvent(Type type);
QScriptDebuggerEvent(Type type, qint64 scriptId, int lineNumber, int columnNumber);
QScriptDebuggerEvent(const QScriptDebuggerEvent &other);
~QScriptDebuggerEvent();
Type type() const;
QVariant attribute(Attribute attribute,
const QVariant &defaultValue = QVariant()) const;
void setAttribute(Attribute attribute, const QVariant &value);
QHash<Attribute, QVariant> attributes() const;
qint64 scriptId() const;
void setScriptId(qint64 id);
QString fileName() const;
void setFileName(const QString &fileName);
int lineNumber() const;
void setLineNumber(int lineNumber);
int columnNumber() const;
void setColumnNumber(int columnNumber);
int breakpointId() const;
void setBreakpointId(int id);
QString message() const;
void setMessage(const QString &message);
QScriptDebuggerValue scriptValue() const;
void setScriptValue(const QScriptDebuggerValue &value);
void setNestedEvaluate(bool nested);
bool isNestedEvaluate() const;
void setHasExceptionHandler(bool hasHandler);
bool hasExceptionHandler() const;
QScriptDebuggerEvent &operator=(const QScriptDebuggerEvent &other);
bool operator==(const QScriptDebuggerEvent &other) const;
bool operator!=(const QScriptDebuggerEvent &other) const;
private:
QScopedPointer<QScriptDebuggerEventPrivate> d_ptr;
Q_DECLARE_PRIVATE(QScriptDebuggerEvent)
};
QDataStream &operator<<(QDataStream &, const QScriptDebuggerEvent &);
QDataStream &operator>>(QDataStream &, QScriptDebuggerEvent &);
// helper class that's used to transport a debugger event through the Qt event loop
class QScriptDebuggerEventEvent : public QEvent
{
public:
QScriptDebuggerEventEvent(const QScriptDebuggerEvent &event)
: QEvent(QEvent::Type(QEvent::User + 1)), m_event(event) {}
~QScriptDebuggerEventEvent() {}
const QScriptDebuggerEvent &event() const {
return m_event;
}
private:
QScriptDebuggerEvent m_event;
};
QT_END_NAMESPACE
#endif
| {
"pile_set_name": "Github"
} |
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
namespace StyleCop.Analyzers.Test.MaintainabilityRules
{
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Testing;
using TestHelper;
using Xunit;
public class SA1402ForDelegateUnitTests : SA1402ForNonBlockDeclarationUnitTestsBase
{
public override string Keyword => "delegate";
[Fact]
public async Task TestOneElementAsync()
{
var testCode = @"public delegate void Foo();";
await VerifyCSharpDiagnosticAsync(testCode, this.GetSettings(), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
[Fact]
public async Task TestTwoElementsAsync()
{
var testCode = @"public delegate void Foo();
public delegate void Bar();
";
var fixedCode = new[]
{
("/0/Test0.cs", @"public delegate void Foo();
"),
("Bar.cs", @"public delegate void Bar();
"),
};
DiagnosticResult expected = Diagnostic().WithLocation(2, 22);
await VerifyCSharpFixAsync(testCode, this.GetSettings(), expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
}
[Fact]
public async Task TestTwoGenericElementsAsync()
{
var testCode = @"public delegate void Foo();
public delegate void Bar<T1, T2, T3>(T1 x, T2 y, T3 z);
";
var fixedCode = new[]
{
("/0/Test0.cs", @"public delegate void Foo();
"),
("Bar.cs", @"public delegate void Bar<T1, T2, T3>(T1 x, T2 y, T3 z);
"),
};
DiagnosticResult expected = Diagnostic().WithLocation(2, 22);
await VerifyCSharpFixAsync(testCode, this.GetSettings(), expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
}
[Fact]
public async Task TestTwoElementsWithRuleDisabledAsync()
{
this.SettingsConfiguration = SA1402SettingsConfiguration.ConfigureAsNonTopLevelType;
var testCode = @"public delegate void Foo();
public delegate void Bar();
";
await VerifyCSharpDiagnosticAsync(testCode, this.GetSettings(), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
[Fact]
public async Task TestTwoElementsWithDefaultRuleConfigurationAsync()
{
this.SettingsConfiguration = SA1402SettingsConfiguration.KeepDefaultConfiguration;
var testCode = @"public delegate void Foo();
public delegate void Bar();
";
await VerifyCSharpDiagnosticAsync(testCode, this.GetSettings(), DiagnosticResult.EmptyDiagnosticResults, CancellationToken.None).ConfigureAwait(false);
}
[Fact]
public async Task TestThreeElementsAsync()
{
var testCode = @"public delegate void Foo();
public delegate void Bar();
public delegate void FooBar();
";
var fixedCode = new[]
{
("/0/Test0.cs", @"public delegate void Foo();
"),
("Bar.cs", @"public delegate void Bar();
"),
("FooBar.cs", @"public delegate void FooBar();
"),
};
DiagnosticResult[] expected =
{
Diagnostic().WithLocation(2, 22),
Diagnostic().WithLocation(3, 22),
};
await VerifyCSharpFixAsync(testCode, this.GetSettings(), expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
}
[Fact]
public async Task TestPreferFilenameTypeAsync()
{
var testCode = @"public delegate void Foo();
public delegate void Test0();
";
var fixedCode = new[]
{
("/0/Test0.cs", $@"public delegate void Test0();
"),
("Foo.cs", $@"public delegate void Foo();
"),
};
DiagnosticResult expected = Diagnostic().WithLocation(1, 22);
await VerifyCSharpFixAsync(testCode, this.GetSettings(), expected, fixedCode, CancellationToken.None).ConfigureAwait(false);
}
}
}
| {
"pile_set_name": "Github"
} |
package onecache
import (
"reflect"
"testing"
)
type mockRing struct {
addImpl func(node string)
removeImpl func(node string)
replicaPeersImpl func(string) []string
successorImpl func(string) string
getOwnedKeysImpl func([]string) []string
ownedKeysByNodeImpl func([]string, string) []string
}
func (m *mockRing) replicaPeers(node string) []string {
return m.replicaPeersImpl(node)
}
func (m *mockRing) successor(node string) string {
return m.successorImpl(node)
}
func (m *mockRing) getOwnedKeys(keys []string) []string {
return m.getOwnedKeysImpl(keys)
}
func (m *mockRing) ownedKeysByNode(keys []string, node string) []string {
return m.ownedKeysByNodeImpl(keys, node)
}
func (m *mockRing) add(node string) { m.addImpl(node) }
func (m *mockRing) remove(node string) { m.removeImpl(node) }
func (m *mockRing) ringCopy() ring {
c := *m
return &c
}
func TestSuccessorSingle(t *testing.T) {
n, err := defaultTestNode()
if err != nil {
t.Fatalf("defaultTestNode() failed: %v", err)
}
// Get the successor and assert it is itself.
s := n.ring.successor(n.name)
if s != n.name {
t.Errorf("successor() returned %v; want %v", s, n.name)
}
}
func TestSuccessorValid(t *testing.T) {
nodes, err := connectedTestNodes(2, 1)
defer tearDownNodes(nodes)
if err != nil {
t.Fatalf("connectedTestNodes(2, 1) failed: %v", err)
}
// Get the successor and assert there is an error.
n := nodes[0]
s := n.ring.successor(n.name)
expected := nodes[1].name
if s != expected {
t.Errorf("successor() returned %v; want %v", s, expected)
}
}
func TestReplicaPeersKeySingleNode(t *testing.T) {
node, err := defaultTestNode()
defer node.Exit()
if err != nil {
t.Fatalf("connectedTestNodes(1, 0) failed: %v", err)
}
key := "foo"
peers := node.ring.replicaPeers(key)
if len(peers) != 1 {
t.Errorf("replicaPeers(%v) should have one element: %v", key, peers)
t.FailNow()
}
expected := node.name
actual := peers[0]
if expected != actual {
t.Errorf("replicaPeers returned [%v]; expected [%v]", expected, actual)
}
}
func TestReplicaPeersKeyMultiple(t *testing.T) {
nodes, err := connectedTestNodes(2, 2)
defer tearDownNodes(nodes)
if err != nil {
t.Fatalf("connectedTestNodes(2, 2) failed: %v", err)
}
n1 := nodes[0]
key := "foo"
peers := n1.ring.replicaPeers(key)
if len(peers) != 2 {
t.Errorf("replicaPeers(%v) should have two elements: %v", key, peers)
t.FailNow()
}
}
func TestReplicaPeersSelfSingle(t *testing.T) {
nodes, err := connectedTestNodes(2, 2)
defer tearDownNodes(nodes)
if err != nil {
t.Fatalf("connectedTestNodes(2, 2) failed: %v", err)
}
n1 := nodes[0]
peers := n1.ring.replicaPeers(n1.name)
if len(peers) != 1 {
t.Errorf("replicaPeers(%v) should have one element: %v", n1.name, peers)
t.FailNow()
}
expected := nodes[1].name
actual := peers[0]
if expected != actual {
t.Errorf("replicaPeers returned [%v]; expected [%v]", expected, actual)
}
}
func TestReplicaSelfPeers(t *testing.T) {
nodes, err := connectedTestNodes(3, 2)
defer tearDownNodes(nodes)
if err != nil {
t.Fatalf("conenctedTestNodes(3, 2) failed: %v", err)
}
n1 := nodes[0]
peers := n1.ring.replicaPeers(n1.name)
if len(peers) != 2 {
t.Errorf("replicaPeers(%v) should have two elements: %v", n1.name, peers)
}
expected := []string{nodes[1].name, nodes[2].name}
for _, e := range expected {
match := false
for _, a := range peers {
if a == e {
match = true
}
}
if !match {
t.Errorf("replicaPeers(%v) didn't include expected peer %v", n1.name, e)
}
}
// Get successors a second time and ensure ordering is the same
peers2 := n1.ring.replicaPeers(n1.name)
if !reflect.DeepEqual(peers, peers2) {
t.Errorf("ordering of replicaPeers(%v) should be the same over calls: %v != %v", n1.name, peers, peers2)
}
}
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using Microsoft.Msagl.Core.Geometry;
using Microsoft.Msagl.Core.Layout;
namespace Microsoft.Msagl.Layout.Incremental {
/// <summary>
/// A stick constraint requires a fixed separation between two nodes
/// </summary>
public class StickConstraint : IConstraint {
/// <summary>
///
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
protected Node u;
/// <summary>
///
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
protected Node v;
/// <summary>
///
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
protected double separation;
/// <summary>
///
/// </summary>
/// <param name="u"></param>
/// <param name="v"></param>
/// <param name="separation"></param>
public StickConstraint(Node u, Node v, double separation) {
this.u = u;
this.v = v;
this.separation = separation;
}
/// <summary>
///
/// </summary>
public virtual double Project() {
Point uv = v.Center - u.Center;
double d = separation - uv.Length,
wu = ((FiNode)u.AlgorithmData).stayWeight,
wv = ((FiNode)v.AlgorithmData).stayWeight;
Point f = d * uv.Normalize() / (wu + wv);
u.Center -= wv * f;
v.Center += wu * f;
return Math.Abs(d);
}
/// <summary>
/// StickConstraints are usually structural and therefore default to level 0
/// </summary>
/// <returns>0</returns>
public int Level { get { return 0; } }
/// <summary>
/// Get the list of nodes involved in the constraint
/// </summary>
public IEnumerable<Node> Nodes { get { return new Node[]{ u, v }; } }
}
} | {
"pile_set_name": "Github"
} |
# PossiblyInvalidCast
Emitted when attempting to cast a value that may not be castable
```php
<?php
class A {}
class B {
public function __toString() {
return 'hello';
}
}
$c = (string) (rand(0, 1) ? new A() : new B());
```
| {
"pile_set_name": "Github"
} |
423.14
422
0
0
1599533069
Infinity
| {
"pile_set_name": "Github"
} |
cmake_minimum_required(VERSION 2.8)
project(ROUTER_LAB LANGUAGES C CXX)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
set(BACKEND Linux CACHE STRING "Router platform")
set(BACKEND_VALUES "Linux" "Xilinx" "macOS" "stdio" "emcc")
set_property(CACHE BACKEND PROPERTY STRINGS ${BACKEND_VALUES})
list(FIND BACKEND_VALUES ${BACKEND} BACKEND_INDEX)
if(${BACKEND_INDEX} EQUAL -1)
message(WARNING "Backend ${BACKEND} not supported, valid items are: ${BACKEND_VALUES}")
set(BACKEND "Linux")
else()
message("Using backend ${BACKEND}")
endif()
string(TOUPPER "${BACKEND}" BACKEND)
add_definitions("-DROUTER_BACKEND_${BACKEND}")
add_subdirectory(HAL)
add_subdirectory(Example)
| {
"pile_set_name": "Github"
} |
/* s_logbl.c -- long double version of s_logb.c.
* Conversion to IEEE quad long double by Jakub Jelinek, [email protected].
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#if defined(LIBM_SCCS) && !defined(lint)
static char rcsid[] = "$NetBSD: $";
#endif
/*
* long double logbl(x)
* IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
* Use ilogb instead.
*/
#include <math.h>
#include <math_private.h>
#include <libm-alias-ldouble.h>
_Float128
__logbl (_Float128 x)
{
int64_t lx, hx, ex;
GET_LDOUBLE_WORDS64 (hx, lx, x);
hx &= 0x7fffffffffffffffLL; /* high |x| */
if ((hx | lx) == 0)
return -1.0 / fabsl (x);
if (hx >= 0x7fff000000000000LL)
return x * x;
if ((ex = hx >> 48) == 0) /* IEEE 754 logb */
{
/* POSIX specifies that denormal number is treated as
though it were normalized. */
int ma;
if (hx == 0)
ma = __builtin_clzll (lx) + 64;
else
ma = __builtin_clzll (hx);
ex -= ma - 16;
}
return (_Float128) (ex - 16383);
}
libm_alias_ldouble (__logb, logb)
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _ANDROID_VIEW_SURFACE_H
#define _ANDROID_VIEW_SURFACE_H
#include <android/native_window.h>
#include "jni.h"
namespace android {
class Surface;
extern sp<ANativeWindow> android_Surface_getNativeWindow(
JNIEnv* env, jobject clazz);
extern bool android_Surface_isInstanceOf(JNIEnv* env, jobject obj);
/* Gets the underlying Surface from a Surface Java object. */
extern sp<Surface> Surface_getSurface(JNIEnv* env, jobject thiz);
} // namespace android
#endif // _ANDROID_VIEW_SURFACE_H
| {
"pile_set_name": "Github"
} |
/* MN10300 I/O port emulation and memory-mapped I/O
*
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
* Written by David Howells ([email protected])
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public Licence
* as published by the Free Software Foundation; either version
* 2 of the Licence, or (at your option) any later version.
*/
#ifndef _ASM_IO_H
#define _ASM_IO_H
#include <asm/page.h> /* I/O is all done through memory accesses */
#include <asm/cpu-regs.h>
#include <asm/cacheflush.h>
#define mmiowb() do {} while (0)
/*****************************************************************************/
/*
* readX/writeX() are used to access memory mapped devices. On some
* architectures the memory mapped IO stuff needs to be accessed
* differently. On the x86 architecture, we just read/write the
* memory location directly.
*/
static inline u8 readb(const volatile void __iomem *addr)
{
return *(const volatile u8 *) addr;
}
static inline u16 readw(const volatile void __iomem *addr)
{
return *(const volatile u16 *) addr;
}
static inline u32 readl(const volatile void __iomem *addr)
{
return *(const volatile u32 *) addr;
}
#define __raw_readb readb
#define __raw_readw readw
#define __raw_readl readl
#define readb_relaxed readb
#define readw_relaxed readw
#define readl_relaxed readl
static inline void writeb(u8 b, volatile void __iomem *addr)
{
*(volatile u8 *) addr = b;
}
static inline void writew(u16 b, volatile void __iomem *addr)
{
*(volatile u16 *) addr = b;
}
static inline void writel(u32 b, volatile void __iomem *addr)
{
*(volatile u32 *) addr = b;
}
#define __raw_writeb writeb
#define __raw_writew writew
#define __raw_writel writel
/*****************************************************************************/
/*
* traditional input/output functions
*/
static inline u8 inb_local(unsigned long addr)
{
return readb((volatile void __iomem *) addr);
}
static inline void outb_local(u8 b, unsigned long addr)
{
return writeb(b, (volatile void __iomem *) addr);
}
static inline u8 inb(unsigned long addr)
{
return readb((volatile void __iomem *) addr);
}
static inline u16 inw(unsigned long addr)
{
return readw((volatile void __iomem *) addr);
}
static inline u32 inl(unsigned long addr)
{
return readl((volatile void __iomem *) addr);
}
static inline void outb(u8 b, unsigned long addr)
{
return writeb(b, (volatile void __iomem *) addr);
}
static inline void outw(u16 b, unsigned long addr)
{
return writew(b, (volatile void __iomem *) addr);
}
static inline void outl(u32 b, unsigned long addr)
{
return writel(b, (volatile void __iomem *) addr);
}
#define inb_p(addr) inb(addr)
#define inw_p(addr) inw(addr)
#define inl_p(addr) inl(addr)
#define outb_p(x, addr) outb((x), (addr))
#define outw_p(x, addr) outw((x), (addr))
#define outl_p(x, addr) outl((x), (addr))
static inline void insb(unsigned long addr, void *buffer, int count)
{
if (count) {
u8 *buf = buffer;
do {
u8 x = inb(addr);
*buf++ = x;
} while (--count);
}
}
static inline void insw(unsigned long addr, void *buffer, int count)
{
if (count) {
u16 *buf = buffer;
do {
u16 x = inw(addr);
*buf++ = x;
} while (--count);
}
}
static inline void insl(unsigned long addr, void *buffer, int count)
{
if (count) {
u32 *buf = buffer;
do {
u32 x = inl(addr);
*buf++ = x;
} while (--count);
}
}
static inline void outsb(unsigned long addr, const void *buffer, int count)
{
if (count) {
const u8 *buf = buffer;
do {
outb(*buf++, addr);
} while (--count);
}
}
static inline void outsw(unsigned long addr, const void *buffer, int count)
{
if (count) {
const u16 *buf = buffer;
do {
outw(*buf++, addr);
} while (--count);
}
}
extern void __outsl(unsigned long addr, const void *buffer, int count);
static inline void outsl(unsigned long addr, const void *buffer, int count)
{
if ((unsigned long) buffer & 0x3)
return __outsl(addr, buffer, count);
if (count) {
const u32 *buf = buffer;
do {
outl(*buf++, addr);
} while (--count);
}
}
#define ioread8(addr) readb(addr)
#define ioread16(addr) readw(addr)
#define ioread32(addr) readl(addr)
#define iowrite8(v, addr) writeb((v), (addr))
#define iowrite16(v, addr) writew((v), (addr))
#define iowrite32(v, addr) writel((v), (addr))
#define ioread8_rep(p, dst, count) \
insb((unsigned long) (p), (dst), (count))
#define ioread16_rep(p, dst, count) \
insw((unsigned long) (p), (dst), (count))
#define ioread32_rep(p, dst, count) \
insl((unsigned long) (p), (dst), (count))
#define iowrite8_rep(p, src, count) \
outsb((unsigned long) (p), (src), (count))
#define iowrite16_rep(p, src, count) \
outsw((unsigned long) (p), (src), (count))
#define iowrite32_rep(p, src, count) \
outsl((unsigned long) (p), (src), (count))
#define readsb(p, dst, count) \
insb((unsigned long) (p), (dst), (count))
#define readsw(p, dst, count) \
insw((unsigned long) (p), (dst), (count))
#define readsl(p, dst, count) \
insl((unsigned long) (p), (dst), (count))
#define writesb(p, src, count) \
outsb((unsigned long) (p), (src), (count))
#define writesw(p, src, count) \
outsw((unsigned long) (p), (src), (count))
#define writesl(p, src, count) \
outsl((unsigned long) (p), (src), (count))
#define IO_SPACE_LIMIT 0xffffffff
#ifdef __KERNEL__
#include <linux/vmalloc.h>
#define __io_virt(x) ((void *) (x))
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
struct pci_dev;
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
{
}
/*
* Change virtual addresses to physical addresses and vv.
* These are pretty trivial
*/
static inline unsigned long virt_to_phys(volatile void *address)
{
return __pa(address);
}
static inline void *phys_to_virt(unsigned long address)
{
return __va(address);
}
/*
* Change "struct page" to physical address.
*/
static inline void __iomem *__ioremap(unsigned long offset, unsigned long size,
unsigned long flags)
{
return (void __iomem *) offset;
}
static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
{
return (void __iomem *) offset;
}
/*
* This one maps high address device memory and turns off caching for that
* area. it's useful if some control registers are in such an area and write
* combining or read caching is not desirable:
*/
static inline void __iomem *ioremap_nocache(unsigned long offset, unsigned long size)
{
return (void __iomem *) (offset | 0x20000000);
}
#define ioremap_wc ioremap_nocache
static inline void iounmap(void __iomem *addr)
{
}
static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
{
return (void __iomem *) port;
}
static inline void ioport_unmap(void __iomem *p)
{
}
#define xlate_dev_kmem_ptr(p) ((void *) (p))
#define xlate_dev_mem_ptr(p) ((void *) (p))
/*
* PCI bus iomem addresses must be in the region 0x80000000-0x9fffffff
*/
static inline unsigned long virt_to_bus(volatile void *address)
{
return ((unsigned long) address) & ~0x20000000;
}
static inline void *bus_to_virt(unsigned long address)
{
return (void *) address;
}
#define page_to_bus page_to_phys
#define memset_io(a, b, c) memset(__io_virt(a), (b), (c))
#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c))
#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c))
#endif /* __KERNEL__ */
#endif /* _ASM_IO_H */
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>后台管理系统</title>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
| {
"pile_set_name": "Github"
} |
package com.henninghall.date_picker;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* Created by heng on 16/9/5.
*/
public class DatePickerPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Arrays.<ViewManager> asList(
new DatePickerManager()
);
}
} | {
"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.
-->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="lib/esl.js"></script>
<script src="lib/config.js"></script>
<script src="lib/jquery.min.js"></script>
<script src="lib/facePrint.js"></script>
</head>
<body>
<style>
html, body, #main {
width: 100%;
height: 100%;
margin: 0;
}
</style>
<div id="main"></div>
<script>
var lngRange = [79.781327, 131.48];
var lngExtent = lngRange[1] - lngRange[0];
var latRange = [18.252847, 52.33];
var latExtent = latRange[1] - latRange[0];
var chunkMax = 100;
var chunkCount = 0;
function genData(count) {
var data = [];
for (var i = 0; i < count; i++) {
data.push([
Math.random() * lngExtent + lngRange[0],
Math.random() * latExtent + latRange[0],
Math.random() * 1000
]);
}
return data;
}
var initData = genData(2001);
require([
'echarts'
// 'echarts/chart/map',
// 'echarts/chart/scatter',
// 'echarts/component/title',
// 'echarts/component/legend',
// 'echarts/component/geo',
// 'echarts/component/visualMap',
// 'echarts/component/markPoint',
// 'echarts/component/tooltip'
], function (echarts) {
require(['map/js/china'], function () {
var chart = echarts.init(document.getElementById('main'));
chart.setOption({
tooltip: {},
legend: {
orient: 'vertical',
left: 'left',
data:['categoryA','categoryB','categoryC']
},
// ???
// visualMap: {
// min: 0,
// max: 1500,
// left: 'left',
// top: 'bottom',
// text: ['High','Low'],
// seriesIndex: [1, 2, 3],
// inRange: {
// color: ['#006edd', '#e0ffff']
// },
// calculable : true
// },
geo: {
map: 'china',
roam: true,
label: {
normal: {
show: true,
textStyle: {
color: 'rgba(0,0,0,0.4)'
}
}
},
itemStyle: {
normal:{
borderColor: 'rgba(0, 0, 0, 0.2)'
},
emphasis:{
color: null,
areaColor: null,
shadowOffsetX: 0,
shadowOffsetY: 0,
shadowBlur: 20,
borderWidth: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
},
series : [{
name: 'pm2.5',
type: 'scatter',
stream: true,
coordinateSystem: 'geo',
data: initData,
symbolSize: 4,
// symbol: 'rect',
itemStyle: {
normal: {
// color: '#ddb926'
color: '#dda'
}
},
progressive: 100
}]
});
chart.on('click', function (param) {
alert('asdf');
});
next();
function next() {
if (chunkCount++ < chunkMax) {
var newData = genData(1000);
chart.appendData({seriesIndex: 0, data: newData});
setTimeout(next, 1000);
}
}
});
});
</script>
</body>
</html> | {
"pile_set_name": "Github"
} |
/*
* (C) Copyright 2008 Dmitry Rakhchev, EmCraft Systems, [email protected]
*
* Developed for DENX Software Engineering GmbH
*
* See file CREDITS for list of people who contributed to this
* project.
*
* 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., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
/* This test verifies if the reason of last reset was an abnormal voltage
* condition, than it performs watchdog test, measuing time required to
* trigger watchdog reset.
*/
#include <post.h>
#if CONFIG_POST & CONFIG_SYS_POST_WATCHDOG
#include <watchdog.h>
#include <asm/gpio.h>
#include <asm/io.h>
static uint watchdog_magic_read(void)
{
return in_be32((void *)CONFIG_SYS_WATCHDOG_FLAGS_ADDR) &
CONFIG_SYS_WATCHDOG_MAGIC_MASK;
}
static void watchdog_magic_write(uint value)
{
out_be32((void *)CONFIG_SYS_WATCHDOG_FLAGS_ADDR, value |
(in_be32((void *)CONFIG_SYS_WATCHDOG_FLAGS_ADDR) &
~CONFIG_SYS_WATCHDOG_MAGIC_MASK));
}
int sysmon1_post_test(int flags)
{
if (gpio_read_in_bit(CONFIG_SYS_GPIO_SYSMON_STATUS) == 0) {
/*
* 3.1. GPIO62 is low
* Assuming system voltage failure.
*/
post_log("Abnormal voltage detected (GPIO62)\n");
return 1;
}
return 0;
}
int lwmon5_watchdog_post_test(int flags)
{
/* On each reset scratch register 1 should be tested,
* but first test GPIO62:
*/
if (!(flags & POST_MANUAL) && sysmon1_post_test(flags)) {
/* 3.1. GPIO62 is low
* Assuming system voltage failure.
*/
/* 3.1.1. Set scratch register 1 to 0x0000xxxx */
watchdog_magic_write(0);
/* 3.1.2. Mark test as failed due to voltage?! */
return 1;
}
if (watchdog_magic_read() != CONFIG_SYS_WATCHDOG_MAGIC) {
/* 3.2. Scratch register 1 differs from magic value 0x1248xxxx
* Assuming PowerOn
*/
int ints;
ulong base;
ulong time;
/* 3.2.1. Set magic value to scratch register */
watchdog_magic_write(CONFIG_SYS_WATCHDOG_MAGIC);
ints = disable_interrupts ();
/* 3.2.2. strobe watchdog once */
WATCHDOG_RESET();
out_be32((void *)CONFIG_SYS_WATCHDOG_TIME_ADDR, 0);
/* 3.2.3. save time of strobe in scratch register 2 */
base = post_time_ms (0);
/* 3.2.4. Wait for 150 ms (enough for reset to happen) */
while ((time = post_time_ms (base)) < 150)
out_be32((void *)CONFIG_SYS_WATCHDOG_TIME_ADDR, time);
if (ints)
enable_interrupts ();
/* 3.2.5. Reset didn't happen. - Set 0x0000xxxx
* into scratch register 1
*/
watchdog_magic_write(0);
/* 3.2.6. Mark test as failed. */
post_log("hw watchdog time : %u ms, failed ", time);
return 2;
} else {
/* 3.3. Scratch register matches magic value 0x1248xxxx
* Assume this is watchdog-initiated reset
*/
ulong time;
/* 3.3.1. So, the test succeed, save measured time to syslog. */
time = in_be32((void *)CONFIG_SYS_WATCHDOG_TIME_ADDR);
post_log("hw watchdog time : %u ms, passed ", time);
/* 3.3.2. Set scratch register 1 to 0x0000xxxx */
watchdog_magic_write(0);
return 0;
}
return -1;
}
#endif /* CONFIG_POST & CONFIG_SYS_POST_WATCHDOG */
| {
"pile_set_name": "Github"
} |
/*
* xtensa/config/core-matmap.h -- Memory access and translation mapping
* parameters (CHAL) of the Xtensa processor core configuration.
*
* If you are using Xtensa Tools, see <xtensa/config/core.h> (which includes
* this file) for more details.
*
* In the Xtensa processor products released to date, all parameters
* defined in this file are derivable (at least in theory) from
* information contained in the core-isa.h header file.
* In particular, the following core configuration parameters are relevant:
* XCHAL_HAVE_CACHEATTR
* XCHAL_HAVE_MIMIC_CACHEATTR
* XCHAL_HAVE_XLT_CACHEATTR
* XCHAL_HAVE_PTP_MMU
* XCHAL_ITLB_ARF_ENTRIES_LOG2
* XCHAL_DTLB_ARF_ENTRIES_LOG2
* XCHAL_DCACHE_IS_WRITEBACK
* XCHAL_ICACHE_SIZE (presence of I-cache)
* XCHAL_DCACHE_SIZE (presence of D-cache)
* XCHAL_HW_VERSION_MAJOR
* XCHAL_HW_VERSION_MINOR
*/
/* Customer ID=4313; Build=0x5483b; Copyright (c) 1999-2015 Tensilica Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS 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. */
#ifndef XTENSA_CONFIG_CORE_MATMAP_H
#define XTENSA_CONFIG_CORE_MATMAP_H
/*----------------------------------------------------------------------
CACHE (MEMORY ACCESS) ATTRIBUTES
----------------------------------------------------------------------*/
/* Cache Attribute encodings -- lists of access modes for each cache attribute: */
#define XCHAL_FCA_LIST XTHAL_FAM_EXCEPTION XCHAL_SEP \
XTHAL_FAM_CACHED XCHAL_SEP \
XTHAL_FAM_BYPASS XCHAL_SEP \
XTHAL_FAM_CACHED XCHAL_SEP \
XTHAL_FAM_CACHED XCHAL_SEP \
XTHAL_FAM_CACHED XCHAL_SEP \
XTHAL_FAM_BYPASS XCHAL_SEP \
XTHAL_FAM_EXCEPTION XCHAL_SEP \
XTHAL_FAM_EXCEPTION XCHAL_SEP \
XTHAL_FAM_EXCEPTION XCHAL_SEP \
XTHAL_FAM_EXCEPTION XCHAL_SEP \
XTHAL_FAM_EXCEPTION XCHAL_SEP \
XTHAL_FAM_EXCEPTION XCHAL_SEP \
XTHAL_FAM_EXCEPTION XCHAL_SEP \
XTHAL_FAM_EXCEPTION XCHAL_SEP \
XTHAL_FAM_EXCEPTION
#define XCHAL_LCA_LIST XTHAL_LAM_CACHED_NOALLOC XCHAL_SEP \
XTHAL_LAM_CACHED XCHAL_SEP \
XTHAL_LAM_BYPASSG XCHAL_SEP \
XTHAL_LAM_EXCEPTION XCHAL_SEP \
XTHAL_LAM_CACHED XCHAL_SEP \
XTHAL_LAM_CACHED XCHAL_SEP \
XTHAL_LAM_BYPASSG XCHAL_SEP \
XTHAL_LAM_EXCEPTION XCHAL_SEP \
XTHAL_LAM_EXCEPTION XCHAL_SEP \
XTHAL_LAM_EXCEPTION XCHAL_SEP \
XTHAL_LAM_EXCEPTION XCHAL_SEP \
XTHAL_LAM_EXCEPTION XCHAL_SEP \
XTHAL_LAM_EXCEPTION XCHAL_SEP \
XTHAL_LAM_EXCEPTION XCHAL_SEP \
XTHAL_LAM_ISOLATE XCHAL_SEP \
XTHAL_LAM_EXCEPTION
#define XCHAL_SCA_LIST XTHAL_SAM_WRITETHRU XCHAL_SEP \
XTHAL_SAM_WRITETHRU XCHAL_SEP \
XTHAL_SAM_BYPASS XCHAL_SEP \
XTHAL_SAM_EXCEPTION XCHAL_SEP \
XTHAL_SAM_WRITEBACK XCHAL_SEP \
XTHAL_SAM_WRITEBACK_NOALLOC XCHAL_SEP \
XTHAL_SAM_BYPASS XCHAL_SEP \
XTHAL_SAM_EXCEPTION XCHAL_SEP \
XTHAL_SAM_EXCEPTION XCHAL_SEP \
XTHAL_SAM_EXCEPTION XCHAL_SEP \
XTHAL_SAM_EXCEPTION XCHAL_SEP \
XTHAL_SAM_EXCEPTION XCHAL_SEP \
XTHAL_SAM_EXCEPTION XCHAL_SEP \
XTHAL_SAM_EXCEPTION XCHAL_SEP \
XTHAL_SAM_ISOLATE XCHAL_SEP \
XTHAL_SAM_EXCEPTION
/*
* Specific encoded cache attribute values of general interest.
* If a specific cache mode is not available, the closest available
* one is returned instead (eg. writethru instead of writeback,
* bypass instead of writethru).
*/
#define XCHAL_CA_BYPASS 2 /* cache disabled (bypassed) mode */
#define XCHAL_CA_BYPASSBUF 6 /* cache disabled (bypassed) bufferable mode */
#define XCHAL_CA_WRITETHRU 1 /* cache enabled (write-through) mode */
#define XCHAL_CA_WRITEBACK 4 /* cache enabled (write-back) mode */
#define XCHAL_HAVE_CA_WRITEBACK_NOALLOC 1 /* write-back no-allocate availability */
#define XCHAL_CA_WRITEBACK_NOALLOC 5 /* cache enabled (write-back no-allocate) mode */
#define XCHAL_CA_ILLEGAL 15 /* no access allowed (all cause exceptions) mode */
#define XCHAL_CA_ISOLATE 14 /* cache isolate (accesses go to cache not memory) mode */
/*----------------------------------------------------------------------
MMU
----------------------------------------------------------------------*/
/*
* General notes on MMU parameters.
*
* Terminology:
* ASID = address-space ID (acts as an "extension" of virtual addresses)
* VPN = virtual page number
* PPN = physical page number
* CA = encoded cache attribute (access modes)
* TLB = translation look-aside buffer (term is stretched somewhat here)
* I = instruction (fetch accesses)
* D = data (load and store accesses)
* way = each TLB (ITLB and DTLB) consists of a number of "ways"
* that simultaneously match the virtual address of an access;
* a TLB successfully translates a virtual address if exactly
* one way matches the vaddr; if none match, it is a miss;
* if multiple match, one gets a "multihit" exception;
* each way can be independently configured in terms of number of
* entries, page sizes, which fields are writable or constant, etc.
* set = group of contiguous ways with exactly identical parameters
* ARF = auto-refill; hardware services a 1st-level miss by loading a PTE
* from the page table and storing it in one of the auto-refill ways;
* if this PTE load also misses, a miss exception is posted for s/w.
* min-wired = a "min-wired" way can be used to map a single (minimum-sized)
* page arbitrarily under program control; it has a single entry,
* is non-auto-refill (some other way(s) must be auto-refill),
* all its fields (VPN, PPN, ASID, CA) are all writable, and it
* supports the XCHAL_MMU_MIN_PTE_PAGE_SIZE page size (a current
* restriction is that this be the only page size it supports).
*
* TLB way entries are virtually indexed.
* TLB ways that support multiple page sizes:
* - must have all writable VPN and PPN fields;
* - can only use one page size at any given time (eg. setup at startup),
* selected by the respective ITLBCFG or DTLBCFG special register,
* whose bits n*4+3 .. n*4 index the list of page sizes for way n
* (XCHAL_xTLB_SETm_PAGESZ_LOG2_LIST for set m corresponding to way n);
* this list may be sparse for auto-refill ways because auto-refill
* ways have independent lists of supported page sizes sharing a
* common encoding with PTE entries; the encoding is the index into
* this list; unsupported sizes for a given way are zero in the list;
* selecting unsupported sizes results in undefined hardware behaviour;
* - is only possible for ways 0 thru 7 (due to ITLBCFG/DTLBCFG definition).
*/
#define XCHAL_MMU_ASID_INVALID 0 /* ASID value indicating invalid address space */
#define XCHAL_MMU_ASID_KERNEL 0 /* ASID value indicating kernel (ring 0) address space */
#define XCHAL_MMU_SR_BITS 0 /* number of size-restriction bits supported */
#define XCHAL_MMU_CA_BITS 4 /* number of bits needed to hold cache attribute encoding */
#define XCHAL_MMU_MAX_PTE_PAGE_SIZE 29 /* max page size in a PTE structure (log2) */
#define XCHAL_MMU_MIN_PTE_PAGE_SIZE 29 /* min page size in a PTE structure (log2) */
/*** Instruction TLB: ***/
#define XCHAL_ITLB_WAY_BITS 0 /* number of bits holding the ways */
#define XCHAL_ITLB_WAYS 1 /* number of ways (n-way set-associative TLB) */
#define XCHAL_ITLB_ARF_WAYS 0 /* number of auto-refill ways */
#define XCHAL_ITLB_SETS 1 /* number of sets (groups of ways with identical settings) */
/* Way set to which each way belongs: */
#define XCHAL_ITLB_WAY0_SET 0
/* Ways sets that are used by hardware auto-refill (ARF): */
#define XCHAL_ITLB_ARF_SETS 0 /* number of auto-refill sets */
/* Way sets that are "min-wired" (see terminology comment above): */
#define XCHAL_ITLB_MINWIRED_SETS 0 /* number of "min-wired" sets */
/* ITLB way set 0 (group of ways 0 thru 0): */
#define XCHAL_ITLB_SET0_WAY 0 /* index of first way in this way set */
#define XCHAL_ITLB_SET0_WAYS 1 /* number of (contiguous) ways in this way set */
#define XCHAL_ITLB_SET0_ENTRIES_LOG2 3 /* log2(number of entries in this way) */
#define XCHAL_ITLB_SET0_ENTRIES 8 /* number of entries in this way (always a power of 2) */
#define XCHAL_ITLB_SET0_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
#define XCHAL_ITLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */
#define XCHAL_ITLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */
#define XCHAL_ITLB_SET0_PAGESZ_LOG2_MIN 29 /* log2(minimum supported page size) */
#define XCHAL_ITLB_SET0_PAGESZ_LOG2_MAX 29 /* log2(maximum supported page size) */
#define XCHAL_ITLB_SET0_PAGESZ_LOG2_LIST 29 /* list of log2(page size)s, separated by XCHAL_SEP;
2^PAGESZ_BITS entries in list, unsupported entries are zero */
#define XCHAL_ITLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */
#define XCHAL_ITLB_SET0_VPN_CONSTMASK 0x00000000 /* constant VPN bits, not including entry index bits; 0 if all writable */
#define XCHAL_ITLB_SET0_PPN_CONSTMASK 0xE0000000 /* constant PPN bits, including entry index bits; 0 if all writable */
#define XCHAL_ITLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */
#define XCHAL_ITLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
#define XCHAL_ITLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
#define XCHAL_ITLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
#define XCHAL_ITLB_SET0_CA_RESET 1 /* 1 if CA reset values defined (and all writable); 0 otherwise */
/* Constant VPN values for each entry of ITLB way set 0 (because VPN_CONSTMASK is non-zero): */
#define XCHAL_ITLB_SET0_E0_VPN_CONST 0x00000000
#define XCHAL_ITLB_SET0_E1_VPN_CONST 0x20000000
#define XCHAL_ITLB_SET0_E2_VPN_CONST 0x40000000
#define XCHAL_ITLB_SET0_E3_VPN_CONST 0x60000000
#define XCHAL_ITLB_SET0_E4_VPN_CONST 0x80000000
#define XCHAL_ITLB_SET0_E5_VPN_CONST 0xA0000000
#define XCHAL_ITLB_SET0_E6_VPN_CONST 0xC0000000
#define XCHAL_ITLB_SET0_E7_VPN_CONST 0xE0000000
/* Constant PPN values for each entry of ITLB way set 0 (because PPN_CONSTMASK is non-zero): */
#define XCHAL_ITLB_SET0_E0_PPN_CONST 0x00000000
#define XCHAL_ITLB_SET0_E1_PPN_CONST 0x20000000
#define XCHAL_ITLB_SET0_E2_PPN_CONST 0x40000000
#define XCHAL_ITLB_SET0_E3_PPN_CONST 0x60000000
#define XCHAL_ITLB_SET0_E4_PPN_CONST 0x80000000
#define XCHAL_ITLB_SET0_E5_PPN_CONST 0xA0000000
#define XCHAL_ITLB_SET0_E6_PPN_CONST 0xC0000000
#define XCHAL_ITLB_SET0_E7_PPN_CONST 0xE0000000
/* Reset CA values for each entry of ITLB way set 0 (because SET0_CA_RESET is non-zero): */
#define XCHAL_ITLB_SET0_E0_CA_RESET 0x02
#define XCHAL_ITLB_SET0_E1_CA_RESET 0x02
#define XCHAL_ITLB_SET0_E2_CA_RESET 0x02
#define XCHAL_ITLB_SET0_E3_CA_RESET 0x02
#define XCHAL_ITLB_SET0_E4_CA_RESET 0x02
#define XCHAL_ITLB_SET0_E5_CA_RESET 0x02
#define XCHAL_ITLB_SET0_E6_CA_RESET 0x02
#define XCHAL_ITLB_SET0_E7_CA_RESET 0x02
/*** Data TLB: ***/
#define XCHAL_DTLB_WAY_BITS 0 /* number of bits holding the ways */
#define XCHAL_DTLB_WAYS 1 /* number of ways (n-way set-associative TLB) */
#define XCHAL_DTLB_ARF_WAYS 0 /* number of auto-refill ways */
#define XCHAL_DTLB_SETS 1 /* number of sets (groups of ways with identical settings) */
/* Way set to which each way belongs: */
#define XCHAL_DTLB_WAY0_SET 0
/* Ways sets that are used by hardware auto-refill (ARF): */
#define XCHAL_DTLB_ARF_SETS 0 /* number of auto-refill sets */
/* Way sets that are "min-wired" (see terminology comment above): */
#define XCHAL_DTLB_MINWIRED_SETS 0 /* number of "min-wired" sets */
/* DTLB way set 0 (group of ways 0 thru 0): */
#define XCHAL_DTLB_SET0_WAY 0 /* index of first way in this way set */
#define XCHAL_DTLB_SET0_WAYS 1 /* number of (contiguous) ways in this way set */
#define XCHAL_DTLB_SET0_ENTRIES_LOG2 3 /* log2(number of entries in this way) */
#define XCHAL_DTLB_SET0_ENTRIES 8 /* number of entries in this way (always a power of 2) */
#define XCHAL_DTLB_SET0_ARF 0 /* 1=autorefill by h/w, 0=non-autorefill (wired/constant/static) */
#define XCHAL_DTLB_SET0_PAGESIZES 1 /* number of supported page sizes in this way */
#define XCHAL_DTLB_SET0_PAGESZ_BITS 0 /* number of bits to encode the page size */
#define XCHAL_DTLB_SET0_PAGESZ_LOG2_MIN 29 /* log2(minimum supported page size) */
#define XCHAL_DTLB_SET0_PAGESZ_LOG2_MAX 29 /* log2(maximum supported page size) */
#define XCHAL_DTLB_SET0_PAGESZ_LOG2_LIST 29 /* list of log2(page size)s, separated by XCHAL_SEP;
2^PAGESZ_BITS entries in list, unsupported entries are zero */
#define XCHAL_DTLB_SET0_ASID_CONSTMASK 0 /* constant ASID bits; 0 if all writable */
#define XCHAL_DTLB_SET0_VPN_CONSTMASK 0x00000000 /* constant VPN bits, not including entry index bits; 0 if all writable */
#define XCHAL_DTLB_SET0_PPN_CONSTMASK 0xE0000000 /* constant PPN bits, including entry index bits; 0 if all writable */
#define XCHAL_DTLB_SET0_CA_CONSTMASK 0 /* constant CA bits; 0 if all writable */
#define XCHAL_DTLB_SET0_ASID_RESET 0 /* 1 if ASID reset values defined (and all writable); 0 otherwise */
#define XCHAL_DTLB_SET0_VPN_RESET 0 /* 1 if VPN reset values defined (and all writable); 0 otherwise */
#define XCHAL_DTLB_SET0_PPN_RESET 0 /* 1 if PPN reset values defined (and all writable); 0 otherwise */
#define XCHAL_DTLB_SET0_CA_RESET 1 /* 1 if CA reset values defined (and all writable); 0 otherwise */
/* Constant VPN values for each entry of DTLB way set 0 (because VPN_CONSTMASK is non-zero): */
#define XCHAL_DTLB_SET0_E0_VPN_CONST 0x00000000
#define XCHAL_DTLB_SET0_E1_VPN_CONST 0x20000000
#define XCHAL_DTLB_SET0_E2_VPN_CONST 0x40000000
#define XCHAL_DTLB_SET0_E3_VPN_CONST 0x60000000
#define XCHAL_DTLB_SET0_E4_VPN_CONST 0x80000000
#define XCHAL_DTLB_SET0_E5_VPN_CONST 0xA0000000
#define XCHAL_DTLB_SET0_E6_VPN_CONST 0xC0000000
#define XCHAL_DTLB_SET0_E7_VPN_CONST 0xE0000000
/* Constant PPN values for each entry of DTLB way set 0 (because PPN_CONSTMASK is non-zero): */
#define XCHAL_DTLB_SET0_E0_PPN_CONST 0x00000000
#define XCHAL_DTLB_SET0_E1_PPN_CONST 0x20000000
#define XCHAL_DTLB_SET0_E2_PPN_CONST 0x40000000
#define XCHAL_DTLB_SET0_E3_PPN_CONST 0x60000000
#define XCHAL_DTLB_SET0_E4_PPN_CONST 0x80000000
#define XCHAL_DTLB_SET0_E5_PPN_CONST 0xA0000000
#define XCHAL_DTLB_SET0_E6_PPN_CONST 0xC0000000
#define XCHAL_DTLB_SET0_E7_PPN_CONST 0xE0000000
/* Reset CA values for each entry of DTLB way set 0 (because SET0_CA_RESET is non-zero): */
#define XCHAL_DTLB_SET0_E0_CA_RESET 0x02
#define XCHAL_DTLB_SET0_E1_CA_RESET 0x02
#define XCHAL_DTLB_SET0_E2_CA_RESET 0x02
#define XCHAL_DTLB_SET0_E3_CA_RESET 0x02
#define XCHAL_DTLB_SET0_E4_CA_RESET 0x02
#define XCHAL_DTLB_SET0_E5_CA_RESET 0x02
#define XCHAL_DTLB_SET0_E6_CA_RESET 0x02
#define XCHAL_DTLB_SET0_E7_CA_RESET 0x02
#endif /*XTENSA_CONFIG_CORE_MATMAP_H*/
| {
"pile_set_name": "Github"
} |
Required software:
- autoconf
- make
- xsltproc
- xmllint
On Windows, you should use Cygwin software or another port of GNU
development tools.
How to build the DocBook documentation:
- run "autoconf" in this dir
- run "./configure" in this dir
- run "make"
The HTML files are rendered in the "html" dir.
When developing content, you can verify your changes by running:
"make check"
This verifies the XML for the whole manual is valid.
You can verify your changes in a single file by running:
"make XMLFILE=filename.xml check1"
The filename.xml is relative to the "module_specs" directory.
DocBook resources:
http://www.ibiblio.org/godoy/sgml/docbook/howto/index.html
http://opensource.bureau-cornavin.com/crash-course/index.html
http://ds9a.nl/docbook/
http://www.sagehill.net/docbookxsl/index.html
http://docbook.org/tdg/en/html/part2.html DocBook tag reference
Also a CHM project file is prepared to create CHM help files on the fly.
You need to install the MsHtmlHelpWorkshop.
To build the CHM file from within the commandshell go to the directory
where your html files are build by using make as described before.
Then call:
"C:/path/to/workshop/hhc htmlhelp.hhp"
where "C:/path/to/workshop/" is the path to you installation of MsHtmlHelpWorkshop
This will build a "Zend_Framework_LANGUAGE.chm" file.
Within the file you will find a index and in future also a table of content. | {
"pile_set_name": "Github"
} |
canon15
OpenBabel04151001012D
8 8 0 0 0 0 0 0 0 0999 V2000
-6.4250 0.3250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-5.4250 0.3258 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-5.4242 -0.6742 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-6.4242 -0.6750 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-7.1307 -1.3827 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-4.7165 -1.3807 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-7.1327 1.0315 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-4.7185 1.0335 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0
1 7 1 1 0 0 0
2 3 1 0 0 0 0
2 8 1 1 0 0 0
3 4 1 0 0 0 0
3 6 1 1 0 0 0
4 1 1 0 0 0 0
4 5 1 1 0 0 0
M END
| {
"pile_set_name": "Github"
} |
#source: pr17154-x86.s
#as: --64
#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
#objdump: -dw
#target: x86_64-*-*
#...
0+240 <.*>:
+[a-f0-9]+: ff 35 5a 01 20 00 push 0x20015a\(%rip\) # 2003a0 <_GLOBAL_OFFSET_TABLE_\+0x8>
+[a-f0-9]+: ff 25 5c 01 20 00 jmp \*0x20015c\(%rip\) # 2003a8 <_GLOBAL_OFFSET_TABLE_\+0x10>
+[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
0+250 <\*ABS\*\+0x29a@plt>:
+[a-f0-9]+: ff 25 5a 01 20 00 jmp \*0x20015a\(%rip\) # 2003b0 <_GLOBAL_OFFSET_TABLE_\+0x18>
+[a-f0-9]+: 68 03 00 00 00 push \$0x3
+[a-f0-9]+: e9 e0 ff ff ff jmp 240 <.plt>
0+260 <func1@plt>:
+[a-f0-9]+: ff 25 52 01 20 00 jmp \*0x200152\(%rip\) # 2003b8 <func1>
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
+[a-f0-9]+: e9 d0 ff ff ff jmp 240 <.plt>
0+270 <func2@plt>:
+[a-f0-9]+: ff 25 4a 01 20 00 jmp \*0x20014a\(%rip\) # 2003c0 <func2>
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
+[a-f0-9]+: e9 c0 ff ff ff jmp 240 <.plt>
0+280 <\*ABS\*\+0x290@plt>:
+[a-f0-9]+: ff 25 42 01 20 00 jmp \*0x200142\(%rip\) # 2003c8 <_GLOBAL_OFFSET_TABLE_\+0x30>
+[a-f0-9]+: 68 02 00 00 00 push \$0x2
+[a-f0-9]+: e9 b0 ff ff ff jmp 240 <.plt>
Disassembly of section .text:
0+290 <resolve1>:
+[a-f0-9]+: e8 cb ff ff ff call 260 <func1@plt>
0+295 <g1>:
+[a-f0-9]+: e9 e6 ff ff ff jmp 280 <\*ABS\*\+0x290@plt>
0+29a <resolve2>:
+[a-f0-9]+: e8 d1 ff ff ff call 270 <func2@plt>
0+29f <g2>:
+[a-f0-9]+: e9 ac ff ff ff jmp 250 <\*ABS\*\+0x29a@plt>
#pass
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<model ref="r:63a6a44c-f24e-44b6-83ad-9204b2e588eb(jetbrains.mps.samples.generator_demo.test_models.test2)">
<persistence version="9" />
<languages>
<use id="772f6dcd-8c0d-48f7-869c-908e036f7c8e" name="jetbrains.mps.sampleXML" version="0" />
<engage id="ef47f5be-76c4-4166-8925-2b415ec6b840" name="jetbrains.mps.samples.generator_demo.demoLang2" />
</languages>
<imports />
<registry>
<language id="ceab5195-25ea-4f22-9b92-103b95ca8c0c" name="jetbrains.mps.lang.core">
<concept id="1169194658468" name="jetbrains.mps.lang.core.structure.INamedConcept" flags="ng" index="TrEIO">
<property id="1169194664001" name="name" index="TrG5h" />
</concept>
</language>
<language id="772f6dcd-8c0d-48f7-869c-908e036f7c8e" name="jetbrains.mps.sampleXML">
<concept id="1225239603385" name="jetbrains.mps.sampleXML.structure.Element" flags="ng" index="15YaA$" />
<concept id="1225239603382" name="jetbrains.mps.sampleXML.structure.Document" flags="ng" index="15YaAF">
<child id="1225239603384" name="rootElement" index="15YaA_" />
</concept>
</language>
</registry>
<node concept="15YaAF" id="hS9pnUO">
<property role="TrG5h" value="Button" />
<node concept="15YaA$" id="hS9pnUP" role="15YaA_">
<property role="TrG5h" value="button" />
</node>
</node>
<node concept="15YaAF" id="hS9pnUQ">
<property role="TrG5h" value="Label" />
<node concept="15YaA$" id="hS9pnUR" role="15YaA_">
<property role="TrG5h" value="label" />
</node>
</node>
</model>
| {
"pile_set_name": "Github"
} |
/*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#include <stdio.h>
#include "internal/cryptlib.h"
#ifndef OPENSSL_NO_RMD160
# include <openssl/ripemd.h>
# include <openssl/evp.h>
# include <openssl/objects.h>
# include <openssl/x509.h>
# include <openssl/rsa.h>
# include "internal/evp_int.h"
static int init(EVP_MD_CTX *ctx)
{
return RIPEMD160_Init(EVP_MD_CTX_md_data(ctx));
}
static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
{
return RIPEMD160_Update(EVP_MD_CTX_md_data(ctx), data, count);
}
static int final(EVP_MD_CTX *ctx, unsigned char *md)
{
return RIPEMD160_Final(md, EVP_MD_CTX_md_data(ctx));
}
static const EVP_MD ripemd160_md = {
NID_ripemd160,
NID_ripemd160WithRSA,
RIPEMD160_DIGEST_LENGTH,
0,
init,
update,
final,
NULL,
NULL,
RIPEMD160_CBLOCK,
sizeof(EVP_MD *) + sizeof(RIPEMD160_CTX),
};
const EVP_MD *EVP_ripemd160(void)
{
return &ripemd160_md;
}
#endif
| {
"pile_set_name": "Github"
} |
using System;
using System.Windows;
using System.Windows.Media;
namespace FFXIV.Framework.WPF
{
public static class DependencyObjectExtension
{
/// <summary>
/// WalkInChildrenメソッドの本体
/// </summary>
/// <param name="obj">DependencyObject</param>
/// <param name="action">Action</param>
private static void WalkCore(DependencyObject obj, Action<DependencyObject> action)
{
var count = VisualTreeHelper.GetChildrenCount(obj);
for (int i = 0; i < count; i++)
{
var child = VisualTreeHelper.GetChild(obj, i);
if (child is DependencyObject)
{
action(child as DependencyObject);
WalkCore(child as DependencyObject, action);
}
}
}
/// <summary>
/// 子オブジェクトに対してデリゲートを実行する
/// </summary>
/// <param name="obj">this : DependencyObject</param>
/// <param name="action">デリゲート : Action</param>
public static void Walk(this DependencyObject obj, Action<DependencyObject> action)
{
if (action == null)
{
throw new ArgumentNullException();
}
WalkCore(obj, action);
}
}
}
| {
"pile_set_name": "Github"
} |
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
//
// ThreadProxyFactoryManager.cpp
//
// Manager for thread proxy factories. The RM relies on a factory manager to pool thread proxies of different types.
//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#include "concrtinternal.h"
namespace Concurrency
{
namespace details
{
/// <summary>
/// Creates a thread proxy factory manager.
/// </summary>
ThreadProxyFactoryManager::ThreadProxyFactoryManager() :
m_pFreeThreadProxyFactory(NULL),
m_pUMSFreeThreadProxyFactory(NULL)
{
// Allocate a TLS slot to track execution resources in the RM.
m_dwExecutionResourceTlsIndex = platform::__TlsAlloc();
}
/// <summary>
/// Destroys a thread proxy factory manager.
/// </summary>
ThreadProxyFactoryManager::~ThreadProxyFactoryManager()
{
if (m_pFreeThreadProxyFactory != NULL)
{
m_pFreeThreadProxyFactory->ShutdownFactory();
}
#ifndef _UMS_DISABLED
if (m_pUMSFreeThreadProxyFactory != NULL)
{
m_pUMSFreeThreadProxyFactory->ShutdownFactory();
}
#endif
platform::__TlsFree(m_dwExecutionResourceTlsIndex);
}
/// <summary>
/// Returns a Win32 thread proxy factory.
/// </summary>
FreeThreadProxyFactory * ThreadProxyFactoryManager::GetFreeThreadProxyFactory()
{
if (m_pFreeThreadProxyFactory == NULL)
{
_NonReentrantBlockingLock::_Scoped_lock lock(m_proxyFactoryCreationLock);
if (m_pFreeThreadProxyFactory == NULL)
{
m_pFreeThreadProxyFactory = FreeThreadProxyFactory::CreateFactory(this);
}
}
return m_pFreeThreadProxyFactory;
}
#ifndef _UMS_DISABLED
/// <summary>
/// Returns a UMS thread proxy factory.
/// </summary>
UMSFreeThreadProxyFactory * ThreadProxyFactoryManager::GetUMSFreeThreadProxyFactory()
{
if (m_pUMSFreeThreadProxyFactory == NULL)
{
_NonReentrantBlockingLock::_Scoped_lock lock(m_proxyFactoryCreationLock);
if (m_pUMSFreeThreadProxyFactory == NULL)
{
m_pUMSFreeThreadProxyFactory = UMSFreeThreadProxyFactory::CreateFactory(this);
}
}
return m_pUMSFreeThreadProxyFactory;
}
#endif
} // namespace details
} // namespace Concurrency
| {
"pile_set_name": "Github"
} |
op {
graph_op_name: "TensorArrayReadV2"
visibility: HIDDEN
}
| {
"pile_set_name": "Github"
} |
api_url: https://example.com:8000/
username: user
password:
eauth: pam
verify_ssl: true
| {
"pile_set_name": "Github"
} |
# FreeType 2 src/otvalid Jamfile
#
# Copyright 2004-2018 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) otvalid ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = otvbase
otvcommn
otvgdef
otvgpos
otvgsub
otvjstf
otvmath
otvmod
;
}
else
{
_sources = otvalid ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/otvalid Jamfile
| {
"pile_set_name": "Github"
} |
/* crypto/bio/bio.h */
/* Copyright (C) 1995-1998 Eric Young ([email protected])
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young ([email protected]).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson ([email protected]).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young ([email protected])"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson ([email protected])"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifndef HEADER_BIO_H
#define HEADER_BIO_H
#ifndef OPENSSL_NO_FP_API
# include <stdio.h>
#endif
#include <stdarg.h>
#include <openssl/crypto.h>
#include <openssl/e_os2.h>
#ifdef __cplusplus
extern "C" {
#endif
/* These are the 'types' of BIOs */
#define BIO_TYPE_NONE 0
#define BIO_TYPE_MEM (1|0x0400)
#define BIO_TYPE_FILE (2|0x0400)
#define BIO_TYPE_FD (4|0x0400|0x0100)
#define BIO_TYPE_SOCKET (5|0x0400|0x0100)
#define BIO_TYPE_NULL (6|0x0400)
#define BIO_TYPE_SSL (7|0x0200)
#define BIO_TYPE_MD (8|0x0200) /* passive filter */
#define BIO_TYPE_BUFFER (9|0x0200) /* filter */
#define BIO_TYPE_CIPHER (10|0x0200) /* filter */
#define BIO_TYPE_BASE64 (11|0x0200) /* filter */
#define BIO_TYPE_CONNECT (12|0x0400|0x0100) /* socket - connect */
#define BIO_TYPE_ACCEPT (13|0x0400|0x0100) /* socket for accept */
#define BIO_TYPE_PROXY_CLIENT (14|0x0200) /* client proxy BIO */
#define BIO_TYPE_PROXY_SERVER (15|0x0200) /* server proxy BIO */
#define BIO_TYPE_NBIO_TEST (16|0x0200) /* server proxy BIO */
#define BIO_TYPE_NULL_FILTER (17|0x0200)
#define BIO_TYPE_BER (18|0x0200) /* BER -> bin filter */
#define BIO_TYPE_BIO (19|0x0400) /* (half a) BIO pair */
#define BIO_TYPE_LINEBUFFER (20|0x0200) /* filter */
#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */
#define BIO_TYPE_FILTER 0x0200
#define BIO_TYPE_SOURCE_SINK 0x0400
/* BIO_FILENAME_READ|BIO_CLOSE to open or close on free.
* BIO_set_fp(in,stdin,BIO_NOCLOSE); */
#define BIO_NOCLOSE 0x00
#define BIO_CLOSE 0x01
/* These are used in the following macros and are passed to
* BIO_ctrl() */
#define BIO_CTRL_RESET 1 /* opt - rewind/zero etc */
#define BIO_CTRL_EOF 2 /* opt - are we at the eof */
#define BIO_CTRL_INFO 3 /* opt - extra tit-bits */
#define BIO_CTRL_SET 4 /* man - set the 'IO' type */
#define BIO_CTRL_GET 5 /* man - get the 'IO' type */
#define BIO_CTRL_PUSH 6 /* opt - internal, used to signify change */
#define BIO_CTRL_POP 7 /* opt - internal, used to signify change */
#define BIO_CTRL_GET_CLOSE 8 /* man - set the 'close' on free */
#define BIO_CTRL_SET_CLOSE 9 /* man - set the 'close' on free */
#define BIO_CTRL_PENDING 10 /* opt - is their more data buffered */
#define BIO_CTRL_FLUSH 11 /* opt - 'flush' buffered output */
#define BIO_CTRL_DUP 12 /* man - extra stuff for 'duped' BIO */
#define BIO_CTRL_WPENDING 13 /* opt - number of bytes still to write */
/* callback is int cb(BIO *bio,state,ret); */
#define BIO_CTRL_SET_CALLBACK 14 /* opt - set callback function */
#define BIO_CTRL_GET_CALLBACK 15 /* opt - set callback function */
#define BIO_CTRL_SET_FILENAME 30 /* BIO_s_file special */
/* modifiers */
#define BIO_FP_READ 0x02
#define BIO_FP_WRITE 0x04
#define BIO_FP_APPEND 0x08
#define BIO_FP_TEXT 0x10
#define BIO_FLAGS_READ 0x01
#define BIO_FLAGS_WRITE 0x02
#define BIO_FLAGS_IO_SPECIAL 0x04
#define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)
#define BIO_FLAGS_SHOULD_RETRY 0x08
/* Used in BIO_gethostbyname() */
#define BIO_GHBN_CTRL_HITS 1
#define BIO_GHBN_CTRL_MISSES 2
#define BIO_GHBN_CTRL_CACHE_SIZE 3
#define BIO_GHBN_CTRL_GET_ENTRY 4
#define BIO_GHBN_CTRL_FLUSH 5
/* Mostly used in the SSL BIO */
/* Not used anymore
* #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10
* #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20
* #define BIO_FLAGS_PROTOCOL_STARTUP 0x40
*/
#define BIO_FLAGS_BASE64_NO_NL 0x100
/* This is used with memory BIOs: it means we shouldn't free up or change the
* data in any way.
*/
#define BIO_FLAGS_MEM_RDONLY 0x200
#define BIO_set_flags(b,f) ((b)->flags|=(f))
#define BIO_get_flags(b) ((b)->flags)
#define BIO_set_retry_special(b) \
((b)->flags|=(BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))
#define BIO_set_retry_read(b) \
((b)->flags|=(BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))
#define BIO_set_retry_write(b) \
((b)->flags|=(BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))
/* These are normally used internally in BIOs */
#define BIO_clear_flags(b,f) ((b)->flags&= ~(f))
#define BIO_clear_retry_flags(b) \
((b)->flags&= ~(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
#define BIO_get_retry_flags(b) \
((b)->flags&(BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))
/* These should be used by the application to tell why we should retry */
#define BIO_should_read(a) ((a)->flags & BIO_FLAGS_READ)
#define BIO_should_write(a) ((a)->flags & BIO_FLAGS_WRITE)
#define BIO_should_io_special(a) ((a)->flags & BIO_FLAGS_IO_SPECIAL)
#define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS)
#define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY)
/* The next three are used in conjunction with the
* BIO_should_io_special() condition. After this returns true,
* BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO
* stack and return the 'reason' for the special and the offending BIO.
* Given a BIO, BIO_get_retry_reason(bio) will return the code. */
/* Returned from the SSL bio when the certificate retrieval code had an error */
#define BIO_RR_SSL_X509_LOOKUP 0x01
/* Returned from the connect BIO when a connect would have blocked */
#define BIO_RR_CONNECT 0x02
/* Returned from the accept BIO when an accept would have blocked */
#define BIO_RR_ACCEPT 0x03
/* These are passed by the BIO callback */
#define BIO_CB_FREE 0x01
#define BIO_CB_READ 0x02
#define BIO_CB_WRITE 0x03
#define BIO_CB_PUTS 0x04
#define BIO_CB_GETS 0x05
#define BIO_CB_CTRL 0x06
/* The callback is called before and after the underling operation,
* The BIO_CB_RETURN flag indicates if it is after the call */
#define BIO_CB_RETURN 0x80
#define BIO_CB_return(a) ((a)|BIO_CB_RETURN))
#define BIO_cb_pre(a) (!((a)&BIO_CB_RETURN))
#define BIO_cb_post(a) ((a)&BIO_CB_RETURN)
#define BIO_set_callback(b,cb) ((b)->callback=(cb))
#define BIO_set_callback_arg(b,arg) ((b)->cb_arg=(char *)(arg))
#define BIO_get_callback_arg(b) ((b)->cb_arg)
#define BIO_get_callback(b) ((b)->callback)
#define BIO_method_name(b) ((b)->method->name)
#define BIO_method_type(b) ((b)->method->type)
typedef struct bio_st BIO;
typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);
#ifndef OPENSSL_SYS_WIN16
typedef struct bio_method_st
{
int type;
const char *name;
int (*bwrite)(BIO *, const char *, int);
int (*bread)(BIO *, char *, int);
int (*bputs)(BIO *, const char *);
int (*bgets)(BIO *, char *, int);
long (*ctrl)(BIO *, int, long, void *);
int (*create)(BIO *);
int (*destroy)(BIO *);
long (*callback_ctrl)(BIO *, int, bio_info_cb *);
} BIO_METHOD;
#else
typedef struct bio_method_st
{
int type;
const char *name;
int (_far *bwrite)();
int (_far *bread)();
int (_far *bputs)();
int (_far *bgets)();
long (_far *ctrl)();
int (_far *create)();
int (_far *destroy)();
long (_far *callback_ctrl)();
} BIO_METHOD;
#endif
struct bio_st
{
BIO_METHOD *method;
/* bio, mode, argp, argi, argl, ret */
long (*callback)(struct bio_st *,int,const char *,int, long,long);
char *cb_arg; /* first argument for the callback */
int init;
int shutdown;
int flags; /* extra storage */
int retry_reason;
int num;
void *ptr;
struct bio_st *next_bio; /* used by filter BIOs */
struct bio_st *prev_bio; /* used by filter BIOs */
int references;
unsigned long num_read;
unsigned long num_write;
CRYPTO_EX_DATA ex_data;
};
DECLARE_STACK_OF(BIO)
typedef struct bio_f_buffer_ctx_struct
{
/* BIO *bio; */ /* this is now in the BIO struct */
int ibuf_size; /* how big is the input buffer */
int obuf_size; /* how big is the output buffer */
char *ibuf; /* the char array */
int ibuf_len; /* how many bytes are in it */
int ibuf_off; /* write/read offset */
char *obuf; /* the char array */
int obuf_len; /* how many bytes are in it */
int obuf_off; /* write/read offset */
} BIO_F_BUFFER_CTX;
/* connect BIO stuff */
#define BIO_CONN_S_BEFORE 1
#define BIO_CONN_S_GET_IP 2
#define BIO_CONN_S_GET_PORT 3
#define BIO_CONN_S_CREATE_SOCKET 4
#define BIO_CONN_S_CONNECT 5
#define BIO_CONN_S_OK 6
#define BIO_CONN_S_BLOCKED_CONNECT 7
#define BIO_CONN_S_NBIO 8
/*#define BIO_CONN_get_param_hostname BIO_ctrl */
#define BIO_C_SET_CONNECT 100
#define BIO_C_DO_STATE_MACHINE 101
#define BIO_C_SET_NBIO 102
#define BIO_C_SET_PROXY_PARAM 103
#define BIO_C_SET_FD 104
#define BIO_C_GET_FD 105
#define BIO_C_SET_FILE_PTR 106
#define BIO_C_GET_FILE_PTR 107
#define BIO_C_SET_FILENAME 108
#define BIO_C_SET_SSL 109
#define BIO_C_GET_SSL 110
#define BIO_C_SET_MD 111
#define BIO_C_GET_MD 112
#define BIO_C_GET_CIPHER_STATUS 113
#define BIO_C_SET_BUF_MEM 114
#define BIO_C_GET_BUF_MEM_PTR 115
#define BIO_C_GET_BUFF_NUM_LINES 116
#define BIO_C_SET_BUFF_SIZE 117
#define BIO_C_SET_ACCEPT 118
#define BIO_C_SSL_MODE 119
#define BIO_C_GET_MD_CTX 120
#define BIO_C_GET_PROXY_PARAM 121
#define BIO_C_SET_BUFF_READ_DATA 122 /* data to read first */
#define BIO_C_GET_CONNECT 123
#define BIO_C_GET_ACCEPT 124
#define BIO_C_SET_SSL_RENEGOTIATE_BYTES 125
#define BIO_C_GET_SSL_NUM_RENEGOTIATES 126
#define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT 127
#define BIO_C_FILE_SEEK 128
#define BIO_C_GET_CIPHER_CTX 129
#define BIO_C_SET_BUF_MEM_EOF_RETURN 130/*return end of input value*/
#define BIO_C_SET_BIND_MODE 131
#define BIO_C_GET_BIND_MODE 132
#define BIO_C_FILE_TELL 133
#define BIO_C_GET_SOCKS 134
#define BIO_C_SET_SOCKS 135
#define BIO_C_SET_WRITE_BUF_SIZE 136/* for BIO_s_bio */
#define BIO_C_GET_WRITE_BUF_SIZE 137
#define BIO_C_MAKE_BIO_PAIR 138
#define BIO_C_DESTROY_BIO_PAIR 139
#define BIO_C_GET_WRITE_GUARANTEE 140
#define BIO_C_GET_READ_REQUEST 141
#define BIO_C_SHUTDOWN_WR 142
#define BIO_C_NREAD0 143
#define BIO_C_NREAD 144
#define BIO_C_NWRITE0 145
#define BIO_C_NWRITE 146
#define BIO_C_RESET_READ_REQUEST 147
#define BIO_set_app_data(s,arg) BIO_set_ex_data(s,0,arg)
#define BIO_get_app_data(s) BIO_get_ex_data(s,0)
/* BIO_s_connect() and BIO_s_socks4a_connect() */
#define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name)
#define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port)
#define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip)
#define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port)
#define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)
#define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)
#define BIO_get_conn_ip(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)
#define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3)
#define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)
/* BIO_s_accept_socket() */
#define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)
#define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)
/* #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */
#define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL)
#define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio)
#define BIO_BIND_NORMAL 0
#define BIO_BIND_REUSEADDR_IF_UNUSED 1
#define BIO_BIND_REUSEADDR 2
#define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)
#define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)
#define BIO_do_connect(b) BIO_do_handshake(b)
#define BIO_do_accept(b) BIO_do_handshake(b)
#define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)
/* BIO_s_proxy_client() */
#define BIO_set_url(b,url) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url))
#define BIO_set_proxies(b,p) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p))
/* BIO_set_nbio(b,n) */
#define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s))
/* BIO *BIO_get_filter_bio(BIO *bio); */
#define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)()))
#define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk)
#define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool)
#define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp)
#define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p))
#define BIO_get_url(b,url) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))
#define BIO_get_no_connect_return(b) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)
#define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd)
#define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)
#define BIO_set_fp(b,fp,c) BIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)
#define BIO_get_fp(b,fpp) BIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)
#define BIO_seek(b,ofs) (int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)
#define BIO_tell(b) (int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)
/* name is cast to lose const, but might be better to route through a function
so we can do it safely */
#ifdef CONST_STRICT
/* If you are wondering why this isn't defined, its because CONST_STRICT is
* purely a compile-time kludge to allow const to be checked.
*/
int BIO_read_filename(BIO *b,const char *name);
#else
#define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
BIO_CLOSE|BIO_FP_READ,(char *)name)
#endif
#define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
BIO_CLOSE|BIO_FP_WRITE,name)
#define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
BIO_CLOSE|BIO_FP_APPEND,name)
#define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \
BIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name)
/* WARNING WARNING, this ups the reference count on the read bio of the
* SSL structure. This is because the ssl read BIO is now pointed to by
* the next_bio field in the bio. So when you free the BIO, make sure
* you are doing a BIO_free_all() to catch the underlying BIO. */
#define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl)
#define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp)
#define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)
#define BIO_set_ssl_renegotiate_bytes(b,num) \
BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL);
#define BIO_get_num_renegotiates(b) \
BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL);
#define BIO_set_ssl_renegotiate_timeout(b,seconds) \
BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL);
/* defined in evp.h */
/* #define BIO_set_md(b,md) BIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */
#define BIO_get_mem_data(b,pp) BIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)
#define BIO_set_mem_buf(b,bm,c) BIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm)
#define BIO_get_mem_ptr(b,pp) BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp)
#define BIO_set_mem_eof_return(b,v) \
BIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL)
/* For the BIO_f_buffer() type */
#define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)
#define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)
#define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)
#define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)
#define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)
/* Don't use the next one unless you know what you are doing :-) */
#define BIO_dup_state(b,ret) BIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret))
#define BIO_reset(b) (int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)
#define BIO_eof(b) (int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)
#define BIO_set_close(b,c) (int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)
#define BIO_get_close(b) (int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL)
#define BIO_pending(b) (int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)
#define BIO_wpending(b) (int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)
/* ...pending macros have inappropriate return type */
size_t BIO_ctrl_pending(BIO *b);
size_t BIO_ctrl_wpending(BIO *b);
#define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
#define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \
cbp)
#define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb)
/* For the BIO_f_buffer() type */
#define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)
/* For BIO_s_bio() */
#define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL)
#define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL)
#define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2)
#define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL)
#define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL)
/* macros with inappropriate type -- but ...pending macros use int too: */
#define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL)
#define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL)
size_t BIO_ctrl_get_write_guarantee(BIO *b);
size_t BIO_ctrl_get_read_request(BIO *b);
int BIO_ctrl_reset_read_request(BIO *b);
/* These two aren't currently implemented */
/* int BIO_get_ex_num(BIO *bio); */
/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */
int BIO_set_ex_data(BIO *bio,int idx,void *data);
void *BIO_get_ex_data(BIO *bio,int idx);
int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
unsigned long BIO_number_read(BIO *bio);
unsigned long BIO_number_written(BIO *bio);
# ifndef OPENSSL_NO_FP_API
# if defined(OPENSSL_SYS_WIN16) && defined(_WINDLL)
BIO_METHOD *BIO_s_file_internal(void);
BIO *BIO_new_file_internal(char *filename, char *mode);
BIO *BIO_new_fp_internal(FILE *stream, int close_flag);
# define BIO_s_file BIO_s_file_internal
# define BIO_new_file BIO_new_file_internal
# define BIO_new_fp BIO_new_fp_internal
# else /* FP_API */
BIO_METHOD *BIO_s_file(void );
BIO *BIO_new_file(const char *filename, const char *mode);
BIO *BIO_new_fp(FILE *stream, int close_flag);
# define BIO_s_file_internal BIO_s_file
# define BIO_new_file_internal BIO_new_file
# define BIO_new_fp_internal BIO_s_file
# endif /* FP_API */
# endif
BIO * BIO_new(BIO_METHOD *type);
int BIO_set(BIO *a,BIO_METHOD *type);
int BIO_free(BIO *a);
void BIO_vfree(BIO *a);
int BIO_read(BIO *b, void *data, int len);
int BIO_gets(BIO *bp,char *buf, int size);
int BIO_write(BIO *b, const void *data, int len);
int BIO_puts(BIO *bp,const char *buf);
int BIO_indent(BIO *b,int indent,int max);
long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long));
char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg);
long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg);
BIO * BIO_push(BIO *b,BIO *append);
BIO * BIO_pop(BIO *b);
void BIO_free_all(BIO *a);
BIO * BIO_find_type(BIO *b,int bio_type);
BIO * BIO_next(BIO *b);
BIO * BIO_get_retry_BIO(BIO *bio, int *reason);
int BIO_get_retry_reason(BIO *bio);
BIO * BIO_dup_chain(BIO *in);
int BIO_nread0(BIO *bio, char **buf);
int BIO_nread(BIO *bio, char **buf, int num);
int BIO_nwrite0(BIO *bio, char **buf);
int BIO_nwrite(BIO *bio, char **buf, int num);
#ifndef OPENSSL_SYS_WIN16
long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
long argl,long ret);
#else
long _far _loadds BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
long argl,long ret);
#endif
BIO_METHOD *BIO_s_mem(void);
BIO *BIO_new_mem_buf(void *buf, int len);
BIO_METHOD *BIO_s_socket(void);
BIO_METHOD *BIO_s_connect(void);
BIO_METHOD *BIO_s_accept(void);
BIO_METHOD *BIO_s_fd(void);
#ifndef OPENSSL_SYS_OS2
BIO_METHOD *BIO_s_log(void);
#endif
BIO_METHOD *BIO_s_bio(void);
BIO_METHOD *BIO_s_null(void);
BIO_METHOD *BIO_f_null(void);
BIO_METHOD *BIO_f_buffer(void);
#ifdef OPENSSL_SYS_VMS
BIO_METHOD *BIO_f_linebuffer(void);
#endif
BIO_METHOD *BIO_f_nbio_test(void);
/* BIO_METHOD *BIO_f_ber(void); */
int BIO_sock_should_retry(int i);
int BIO_sock_non_fatal_error(int error);
int BIO_fd_should_retry(int i);
int BIO_fd_non_fatal_error(int error);
int BIO_dump(BIO *b,const char *bytes,int len);
int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent);
struct hostent *BIO_gethostbyname(const char *name);
/* We might want a thread-safe interface too:
* struct hostent *BIO_gethostbyname_r(const char *name,
* struct hostent *result, void *buffer, size_t buflen);
* or something similar (caller allocates a struct hostent,
* pointed to by "result", and additional buffer space for the various
* substructures; if the buffer does not suffice, NULL is returned
* and an appropriate error code is set).
*/
int BIO_sock_error(int sock);
int BIO_socket_ioctl(int fd, long type, void *arg);
int BIO_socket_nbio(int fd,int mode);
int BIO_get_port(const char *str, unsigned short *port_ptr);
int BIO_get_host_ip(const char *str, unsigned char *ip);
int BIO_get_accept_socket(char *host_port,int mode);
int BIO_accept(int sock,char **ip_port);
int BIO_sock_init(void );
void BIO_sock_cleanup(void);
int BIO_set_tcp_ndelay(int sock,int turn_on);
BIO *BIO_new_socket(int sock, int close_flag);
BIO *BIO_new_fd(int fd, int close_flag);
BIO *BIO_new_connect(char *host_port);
BIO *BIO_new_accept(char *host_port);
int BIO_new_bio_pair(BIO **bio1, size_t writebuf1,
BIO **bio2, size_t writebuf2);
/* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints.
* Otherwise returns 0 and sets *bio1 and *bio2 to NULL.
* Size 0 uses default value.
*/
void BIO_copy_next_retry(BIO *b);
/*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/
int BIO_printf(BIO *bio, const char *format, ...);
int BIO_vprintf(BIO *bio, const char *format, va_list args);
int BIO_snprintf(char *buf, size_t n, const char *format, ...);
int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
void ERR_load_BIO_strings(void);
/* Error codes for the BIO functions. */
/* Function codes. */
#define BIO_F_ACPT_STATE 100
#define BIO_F_BIO_ACCEPT 101
#define BIO_F_BIO_BER_GET_HEADER 102
#define BIO_F_BIO_CTRL 103
#define BIO_F_BIO_GETHOSTBYNAME 120
#define BIO_F_BIO_GETS 104
#define BIO_F_BIO_GET_ACCEPT_SOCKET 105
#define BIO_F_BIO_GET_HOST_IP 106
#define BIO_F_BIO_GET_PORT 107
#define BIO_F_BIO_MAKE_PAIR 121
#define BIO_F_BIO_NEW 108
#define BIO_F_BIO_NEW_FILE 109
#define BIO_F_BIO_NEW_MEM_BUF 126
#define BIO_F_BIO_NREAD 123
#define BIO_F_BIO_NREAD0 124
#define BIO_F_BIO_NWRITE 125
#define BIO_F_BIO_NWRITE0 122
#define BIO_F_BIO_PUTS 110
#define BIO_F_BIO_READ 111
#define BIO_F_BIO_SOCK_INIT 112
#define BIO_F_BIO_WRITE 113
#define BIO_F_BUFFER_CTRL 114
#define BIO_F_CONN_CTRL 127
#define BIO_F_CONN_STATE 115
#define BIO_F_FILE_CTRL 116
#define BIO_F_FILE_READ 130
#define BIO_F_LINEBUFFER_CTRL 129
#define BIO_F_MEM_READ 128
#define BIO_F_MEM_WRITE 117
#define BIO_F_SSL_NEW 118
#define BIO_F_WSASTARTUP 119
/* Reason codes. */
#define BIO_R_ACCEPT_ERROR 100
#define BIO_R_BAD_FOPEN_MODE 101
#define BIO_R_BAD_HOSTNAME_LOOKUP 102
#define BIO_R_BROKEN_PIPE 124
#define BIO_R_CONNECT_ERROR 103
#define BIO_R_EOF_ON_MEMORY_BIO 127
#define BIO_R_ERROR_SETTING_NBIO 104
#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET 105
#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET 106
#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET 107
#define BIO_R_INVALID_ARGUMENT 125
#define BIO_R_INVALID_IP_ADDRESS 108
#define BIO_R_IN_USE 123
#define BIO_R_KEEPALIVE 109
#define BIO_R_NBIO_CONNECT_ERROR 110
#define BIO_R_NO_ACCEPT_PORT_SPECIFIED 111
#define BIO_R_NO_HOSTNAME_SPECIFIED 112
#define BIO_R_NO_PORT_DEFINED 113
#define BIO_R_NO_PORT_SPECIFIED 114
#define BIO_R_NO_SUCH_FILE 128
#define BIO_R_NULL_PARAMETER 115
#define BIO_R_TAG_MISMATCH 116
#define BIO_R_UNABLE_TO_BIND_SOCKET 117
#define BIO_R_UNABLE_TO_CREATE_SOCKET 118
#define BIO_R_UNABLE_TO_LISTEN_SOCKET 119
#define BIO_R_UNINITIALIZED 120
#define BIO_R_UNSUPPORTED_METHOD 121
#define BIO_R_WRITE_TO_READ_ONLY_BIO 126
#define BIO_R_WSASTARTUP 122
#ifdef __cplusplus
}
#endif
#endif
| {
"pile_set_name": "Github"
} |
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/rds/model/EventCategoriesMap.h>
#include <aws/core/utils/xml/XmlSerializer.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>
#include <utility>
using namespace Aws::Utils::Xml;
using namespace Aws::Utils;
namespace Aws
{
namespace RDS
{
namespace Model
{
EventCategoriesMap::EventCategoriesMap() :
m_sourceTypeHasBeenSet(false),
m_eventCategoriesHasBeenSet(false)
{
}
EventCategoriesMap::EventCategoriesMap(const XmlNode& xmlNode) :
m_sourceTypeHasBeenSet(false),
m_eventCategoriesHasBeenSet(false)
{
*this = xmlNode;
}
EventCategoriesMap& EventCategoriesMap::operator =(const XmlNode& xmlNode)
{
XmlNode resultNode = xmlNode;
if(!resultNode.IsNull())
{
XmlNode sourceTypeNode = resultNode.FirstChild("SourceType");
if(!sourceTypeNode.IsNull())
{
m_sourceType = Aws::Utils::Xml::DecodeEscapedXmlText(sourceTypeNode.GetText());
m_sourceTypeHasBeenSet = true;
}
XmlNode eventCategoriesNode = resultNode.FirstChild("EventCategories");
if(!eventCategoriesNode.IsNull())
{
XmlNode eventCategoriesMember = eventCategoriesNode.FirstChild("EventCategory");
while(!eventCategoriesMember.IsNull())
{
m_eventCategories.push_back(eventCategoriesMember.GetText());
eventCategoriesMember = eventCategoriesMember.NextNode("EventCategory");
}
m_eventCategoriesHasBeenSet = true;
}
}
return *this;
}
void EventCategoriesMap::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
{
if(m_sourceTypeHasBeenSet)
{
oStream << location << index << locationValue << ".SourceType=" << StringUtils::URLEncode(m_sourceType.c_str()) << "&";
}
if(m_eventCategoriesHasBeenSet)
{
unsigned eventCategoriesIdx = 1;
for(auto& item : m_eventCategories)
{
oStream << location << index << locationValue << ".EventCategory." << eventCategoriesIdx++ << "=" << StringUtils::URLEncode(item.c_str()) << "&";
}
}
}
void EventCategoriesMap::OutputToStream(Aws::OStream& oStream, const char* location) const
{
if(m_sourceTypeHasBeenSet)
{
oStream << location << ".SourceType=" << StringUtils::URLEncode(m_sourceType.c_str()) << "&";
}
if(m_eventCategoriesHasBeenSet)
{
unsigned eventCategoriesIdx = 1;
for(auto& item : m_eventCategories)
{
oStream << location << ".EventCategory." << eventCategoriesIdx++ << "=" << StringUtils::URLEncode(item.c_str()) << "&";
}
}
}
} // namespace Model
} // namespace RDS
} // namespace Aws
| {
"pile_set_name": "Github"
} |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* @name: S11.13.2_A4.2_T2.8;
* @section: 11.13.2, 11.5.2;
* @assertion: The production x /= y is the same as x = x / y;
* @description: Type(x) is different from Type(y) and both types vary between Boolean (primitive or object) and Undefined;
*/
//CHECK#1
x = true;
x /= undefined;
if (isNaN(x) !== true) {
$ERROR('#1: x = true; x /= undefined; x === Not-a-Number. Actual: ' + (x));
}
//CHECK#2
x = undefined;
x /= true;
if (isNaN(x) !== true) {
$ERROR('#2: x = undefined; x /= true; x === Not-a-Number. Actual: ' + (x));
}
//CHECK#3
x = new Boolean(true);
x /= undefined;
if (isNaN(x) !== true) {
$ERROR('#3: x = new Boolean(true); x /= undefined; x === Not-a-Number. Actual: ' + (x));
}
//CHECK#4
x = undefined;
x /= new Boolean(true);
if (isNaN(x) !== true) {
$ERROR('#4: x = undefined; x /= new Boolean(true); x === Not-a-Number. Actual: ' + (x));
}
| {
"pile_set_name": "Github"
} |
# 安装CDN
```shell
# rpm -qa | grep bind
# rpm -e --nodeps bind-9.8.2-0.47.rc1.el6_8.3.x86_64 删除包
```
## 安装bind
```shell
#yum install bind-chroot bind -y
```
## 拷贝文件
```shell
#cp -R /usr/share/doc/bind-*/sample/var/named/* /var/named/chroot/var/named/
```
## bind 创建相关文件
```shell
touch /var/named/chroot/var/named/data/cache_dump.db
touch /var/named/chroot/var/named/data/named_stats.txt
touch /var/named/chroot/var/named/data/named_mem_stats.txt
touch /var/named/chroot/var/named/data/named.run
mkdir /var/named/chroot/var/named/dynamic
touch /var/named/chroot/var/named/dynamic/managed-keys.bind
```
## 设置可写
```shell
chmod -R 777 /var/named/chroot/var/named/data
chmod -R 777 /var/named/chroot/var/named/dynamic
```
## 拷贝 /etc/named.conf
```shell
cp -p /etc/named.conf /var/named/chroot/etc/named.conf
```
| {
"pile_set_name": "Github"
} |
config BR2_PACKAGE_ODROID_MALI
bool "odroid-mali"
depends on BR2_TOOLCHAIN_USES_GLIBC
depends on BR2_aarch64 || BR2_ARM_EABIHF
select BR2_PACKAGE_HAS_LIBEGL
select BR2_PACKAGE_HAS_LIBGLES
select BR2_PACKAGE_ODROID_SCRIPTS # runtime
help
Install the ARM Mali drivers for odroidc2 based systems.
https://github.com/mdrjr/c2_mali
if BR2_PACKAGE_ODROID_MALI
config BR2_PACKAGE_PROVIDES_LIBEGL
default "odroid-mali"
config BR2_PACKAGE_PROVIDES_LIBGLES
default "odroid-mali"
endif
config BR2_PACKAGE_ODROID_MALI_X11
bool
depends on BR2_aarch64 # No 32 bit version available
select BR2_PACKAGE_LIBDRM
select BR2_PACKAGE_XLIB_LIBX11
select BR2_PACKAGE_XLIB_LIBXDAMAGE
select BR2_PACKAGE_XLIB_LIBXEXT
select BR2_PACKAGE_XLIB_LIBXFIXES
comment "odroid-mali needs a glibc toolchain"
depends on BR2_aarch64 || BR2_ARM_EABIHF
depends on !BR2_TOOLCHAIN_USES_GLIBC
| {
"pile_set_name": "Github"
} |
package org.example.utils.vaadinbridge.internal;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import org.example.utils.vaadinbridge.ApplicationFactory;
import com.vaadin.Application;
import com.vaadin.Application.SystemMessages;
import com.vaadin.terminal.gwt.server.AbstractApplicationServlet;
class ApplicationFactoryServlet extends AbstractApplicationServlet {
private static final long serialVersionUID = 1L;
private final ApplicationFactory factory;
ApplicationFactoryServlet(ApplicationFactory factory) {
this.factory = factory;
}
@Override
protected Application getNewApplication(HttpServletRequest request) throws ServletException {
return factory.newInstance();
}
@Override
protected Class<? extends Application> getApplicationClass() {
return null;
}
@Override
protected String getApplicationCSSClassName() {
return factory.getApplicationCSSClassName();
}
@Override
protected SystemMessages getSystemMessages() {
SystemMessages messages = factory.getSystemMessages();
return messages != null ? messages : Application.getSystemMessages();
}
} | {
"pile_set_name": "Github"
} |
cd c:\scripts\wail2ban\
start powershell .\wail2ban.ps1
| {
"pile_set_name": "Github"
} |
// cgo -godefs types_darwin.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build 386,darwin
package unix
const (
sizeofPtr = 0x4
sizeofShort = 0x2
sizeofInt = 0x4
sizeofLong = 0x4
sizeofLongLong = 0x8
)
type (
_C_short int16
_C_int int32
_C_long int32
_C_long_long int64
)
type Timespec struct {
Sec int32
Nsec int32
}
type Timeval struct {
Sec int32
Usec int32
}
type Timeval32 struct{}
type Rusage struct {
Utime Timeval
Stime Timeval
Maxrss int32
Ixrss int32
Idrss int32
Isrss int32
Minflt int32
Majflt int32
Nswap int32
Inblock int32
Oublock int32
Msgsnd int32
Msgrcv int32
Nsignals int32
Nvcsw int32
Nivcsw int32
}
type Rlimit struct {
Cur uint64
Max uint64
}
type _Gid_t uint32
type Stat_t struct {
Dev int32
Mode uint16
Nlink uint16
Ino uint64
Uid uint32
Gid uint32
Rdev int32
Atimespec Timespec
Mtimespec Timespec
Ctimespec Timespec
Birthtimespec Timespec
Size int64
Blocks int64
Blksize int32
Flags uint32
Gen uint32
Lspare int32
Qspare [2]int64
}
type Statfs_t struct {
Bsize uint32
Iosize int32
Blocks uint64
Bfree uint64
Bavail uint64
Files uint64
Ffree uint64
Fsid Fsid
Owner uint32
Type uint32
Flags uint32
Fssubtype uint32
Fstypename [16]int8
Mntonname [1024]int8
Mntfromname [1024]int8
Reserved [8]uint32
}
type Flock_t struct {
Start int64
Len int64
Pid int32
Type int16
Whence int16
}
type Fstore_t struct {
Flags uint32
Posmode int32
Offset int64
Length int64
Bytesalloc int64
}
type Radvisory_t struct {
Offset int64
Count int32
}
type Fbootstraptransfer_t struct {
Offset int64
Length uint32
Buffer *byte
}
type Log2phys_t struct {
Flags uint32
Contigbytes int64
Devoffset int64
}
type Fsid struct {
Val [2]int32
}
type Dirent struct {
Ino uint64
Seekoff uint64
Reclen uint16
Namlen uint16
Type uint8
Name [1024]int8
Pad_cgo_0 [3]byte
}
type RawSockaddrInet4 struct {
Len uint8
Family uint8
Port uint16
Addr [4]byte /* in_addr */
Zero [8]int8
}
type RawSockaddrInet6 struct {
Len uint8
Family uint8
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
type RawSockaddrUnix struct {
Len uint8
Family uint8
Path [104]int8
}
type RawSockaddrDatalink struct {
Len uint8
Family uint8
Index uint16
Type uint8
Nlen uint8
Alen uint8
Slen uint8
Data [12]int8
}
type RawSockaddr struct {
Len uint8
Family uint8
Data [14]int8
}
type RawSockaddrAny struct {
Addr RawSockaddr
Pad [92]int8
}
type _Socklen uint32
type Linger struct {
Onoff int32
Linger int32
}
type Iovec struct {
Base *byte
Len uint32
}
type IPMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type IPv6Mreq struct {
Multiaddr [16]byte /* in6_addr */
Interface uint32
}
type Msghdr struct {
Name *byte
Namelen uint32
Iov *Iovec
Iovlen int32
Control *byte
Controllen uint32
Flags int32
}
type Cmsghdr struct {
Len uint32
Level int32
Type int32
}
type Inet4Pktinfo struct {
Ifindex uint32
Spec_dst [4]byte /* in_addr */
Addr [4]byte /* in_addr */
}
type Inet6Pktinfo struct {
Addr [16]byte /* in6_addr */
Ifindex uint32
}
type IPv6MTUInfo struct {
Addr RawSockaddrInet6
Mtu uint32
}
type ICMPv6Filter struct {
Filt [8]uint32
}
const (
SizeofSockaddrInet4 = 0x10
SizeofSockaddrInet6 = 0x1c
SizeofSockaddrAny = 0x6c
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x14
SizeofLinger = 0x8
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x1c
SizeofCmsghdr = 0xc
SizeofInet4Pktinfo = 0xc
SizeofInet6Pktinfo = 0x14
SizeofIPv6MTUInfo = 0x20
SizeofICMPv6Filter = 0x20
)
const (
PTRACE_TRACEME = 0x0
PTRACE_CONT = 0x7
PTRACE_KILL = 0x8
)
type Kevent_t struct {
Ident uint32
Filter int16
Flags uint16
Fflags uint32
Data int32
Udata *byte
}
type FdSet struct {
Bits [32]int32
}
const (
SizeofIfMsghdr = 0x70
SizeofIfData = 0x60
SizeofIfaMsghdr = 0x14
SizeofIfmaMsghdr = 0x10
SizeofIfmaMsghdr2 = 0x14
SizeofRtMsghdr = 0x5c
SizeofRtMetrics = 0x38
)
type IfMsghdr struct {
Msglen uint16
Version uint8
Type uint8
Addrs int32
Flags int32
Index uint16
Pad_cgo_0 [2]byte
Data IfData
}
type IfData struct {
Type uint8
Typelen uint8
Physical uint8
Addrlen uint8
Hdrlen uint8
Recvquota uint8
Xmitquota uint8
Unused1 uint8
Mtu uint32
Metric uint32
Baudrate uint32
Ipackets uint32
Ierrors uint32
Opackets uint32
Oerrors uint32
Collisions uint32
Ibytes uint32
Obytes uint32
Imcasts uint32
Omcasts uint32
Iqdrops uint32
Noproto uint32
Recvtiming uint32
Xmittiming uint32
Lastchange Timeval
Unused2 uint32
Hwassist uint32
Reserved1 uint32
Reserved2 uint32
}
type IfaMsghdr struct {
Msglen uint16
Version uint8
Type uint8
Addrs int32
Flags int32
Index uint16
Pad_cgo_0 [2]byte
Metric int32
}
type IfmaMsghdr struct {
Msglen uint16
Version uint8
Type uint8
Addrs int32
Flags int32
Index uint16
Pad_cgo_0 [2]byte
}
type IfmaMsghdr2 struct {
Msglen uint16
Version uint8
Type uint8
Addrs int32
Flags int32
Index uint16
Pad_cgo_0 [2]byte
Refcount int32
}
type RtMsghdr struct {
Msglen uint16
Version uint8
Type uint8
Index uint16
Pad_cgo_0 [2]byte
Flags int32
Addrs int32
Pid int32
Seq int32
Errno int32
Use int32
Inits uint32
Rmx RtMetrics
}
type RtMetrics struct {
Locks uint32
Mtu uint32
Hopcount uint32
Expire int32
Recvpipe uint32
Sendpipe uint32
Ssthresh uint32
Rtt uint32
Rttvar uint32
Pksent uint32
Filler [4]uint32
}
const (
SizeofBpfVersion = 0x4
SizeofBpfStat = 0x8
SizeofBpfProgram = 0x8
SizeofBpfInsn = 0x8
SizeofBpfHdr = 0x14
)
type BpfVersion struct {
Major uint16
Minor uint16
}
type BpfStat struct {
Recv uint32
Drop uint32
}
type BpfProgram struct {
Len uint32
Insns *BpfInsn
}
type BpfInsn struct {
Code uint16
Jt uint8
Jf uint8
K uint32
}
type BpfHdr struct {
Tstamp Timeval
Caplen uint32
Datalen uint32
Hdrlen uint16
Pad_cgo_0 [2]byte
}
type Termios struct {
Iflag uint32
Oflag uint32
Cflag uint32
Lflag uint32
Cc [20]uint8
Ispeed uint32
Ospeed uint32
}
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
const (
AT_FDCWD = -0x2
AT_REMOVEDIR = 0x80
AT_SYMLINK_FOLLOW = 0x40
AT_SYMLINK_NOFOLLOW = 0x20
)
| {
"pile_set_name": "Github"
} |
/* crypto/bf/bf_ecb.c */
/* Copyright (C) 1995-1998 Eric Young ([email protected])
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young ([email protected]).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson ([email protected]).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young ([email protected])"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson ([email protected])"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``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 AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#include <openssl/blowfish.h>
#include "bf_locl.h"
#include <openssl/opensslv.h>
/*
* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' (From
* LECTURE NOTES IN COMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, CAMBRIDGE
* SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993)
*/
const char BF_version[] = "Blowfish" OPENSSL_VERSION_PTEXT;
const char *BF_options(void)
{
#ifdef BF_PTR
return ("blowfish(ptr)");
#elif defined(BF_PTR2)
return ("blowfish(ptr2)");
#else
return ("blowfish(idx)");
#endif
}
void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
const BF_KEY *key, int encrypt)
{
BF_LONG l, d[2];
n2l(in, l);
d[0] = l;
n2l(in, l);
d[1] = l;
if (encrypt)
BF_encrypt(d, key);
else
BF_decrypt(d, key);
l = d[0];
l2n(l, out);
l = d[1];
l2n(l, out);
l = d[0] = d[1] = 0;
}
| {
"pile_set_name": "Github"
} |
# synthwave-everything
[colors]
foreground = "#f0eff1"
background = "#2a2139"
cursor_bg = "#72f1b8"
cursor_fg = "#1a1a1a"
selection_bg = "#181521"
selection_fg = "#f0eff1"
ansi = ["#fefefe","#f97e72","#72f1b8","#fede5d","#6d77b3","#c792ea","#f772e0","#fefefe"]
brights = ["#fefefe","#f88414","#72f1b8","#fff951","#36f9f6","#e1acff","#f92aad","#fefefe"]
| {
"pile_set_name": "Github"
} |
//==============================================================================
// This file is part of Master Password.
// Copyright (c) 2011-2017, Maarten Billemont.
//
// Master Password is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Master Password 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 can find a copy of the GNU General Public License in the
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
//==============================================================================
package com.lyndir.masterpassword.gui.model;
import static com.lyndir.lhunath.opal.system.util.ObjectUtils.*;
import com.lyndir.masterpassword.MPResultType;
import com.lyndir.masterpassword.model.impl.MPBasicQuestion;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* @author lhunath, 2018-05-16
*/
public class MPIncognitoQuestion extends MPBasicQuestion {
private final MPIncognitoSite site;
public MPIncognitoQuestion(final MPIncognitoSite site, final String keyword, @Nullable final MPResultType type) {
super( keyword, ifNotNullElse( type, site.getAlgorithm().mpw_default_answer_type() ) );
this.site = site;
}
@Nonnull
@Override
public MPIncognitoSite getSite() {
return site;
}
}
| {
"pile_set_name": "Github"
} |
owner = SWE
controller = SWE
add_core = SWE
terrain = woods
infra = 2
| {
"pile_set_name": "Github"
} |
!!!COM: Palestrina, Giovanni Perluigi da
!!!OPR: Missa Tu es Petrus (1887)
!!!OTL: Gloria
**kern **kern **kern **kern **kern **kern
*Ibass *Ibarit *Itenor *Icalto *Icant *Icant
!Bassus !Baritone !Tenor !Altus !Cantus 2 !Cantus 1
*clefF4 *clefF4 *clefGv2 *clefG2 *clefG2 *clefG2
*k[] *k[] *k[] *k[] *k[] *k[]
*G:mix *G:mix *G:mix *G:mix *G:mix *G:mix
*M4/2 *M4/2 *M4/2 *M4/2 *M4/2 *M4/2
=1 =1 =1 =1 =1 =1
0r 0r 0r 1.g 1.b 0dd
. . . 4f# 4a .
. . . 4e 4g .
=2 =2 =2 =2 =2 =2
0r 0r 1r 2f# 2a 1dd
. . . 2g 2b .
. . 2r 1c 2.cc 1ee
. . [2g . . .
. . . . 4b .
=3 =3 =3 =3 =3 =3
0r 0r 2g] 1.d 1a 2.dd
. . 4f# . . .
. . 4e . . 8cc
. . . . . 8b
. . 2f# . 1dd 2a
. . 2g 2G . 2b
=4 =4 =4 =4 =4 =4
0r 0r 2c 2r 1ee 1cc
. . 2c 2.g . .
. . 2d . 1dd 1a
. . . 4f# . .
. . 2d 2f# . .
=5 =5 =5 =5 =5 =5
0r 0r 2G 2g 2dd 2b
. . 2g 2e 2ee 2cc
. . 1a 4d 1ff 1dd
. . . 4e . .
. . . 4f . .
. . . 4g . .
=6 =6 =6 =6 =6 =6
0r 0r 1.A 2a 1.ee 2cc
. . . 1cc . 2a
. . . . . 2cc
. . 2B 2b 2dd 2dd
=7 =7 =7 =7 =7 =7
0r 0r 2c 2a 2.cc 1ee
. . 2c 1g . .
. . . . 4b .
. . 1d . 1a 1dd
. . . 2f# . .
=8 =8 =8 =8 =8 =8
1G 1B 2G 2g 1b 0dd
. . 2d 1g . .
2G 2B 1d . 1r .
4F# 4A . [2a . .
4E 4G . . . .
=9 =9 =9 =9 =9 =9
2F# 2A 1d 2a] 1r 0r
2G 2B . 2g . .
4C 2c 2e 1g 2r .
4D . . . . .
4E [2c [2g . [2ee .
4F . . . . .
=10 =10 =10 =10 =10 =10
1G 2c] 2g] 2r 2ee] 0r
. 4B 2g 1d 4dd .
. 4A . . 4cc .
1r 2B 2.g . 2dd .
. 2c . 2c 2ee .
. . 4g . . .
=11 =11 =11 =11 =11 =11
1r 2F 1a 2cc 2ff 1r
. 2F . 2cc 2ff .
2r 2c 1g 1cc 1ee 2r
[2c 4C . . . [2ee
. 4D . . . .
=12 =12 =12 =12 =12 =12
2c] 4E 2r 1g 0gg 2ee]
. 4F . . . .
4B 1G 1g . . 4dd
4A . . . . 4cc
2B . . 2r . 2dd
2c 2C 2g [2cc . 2ee
=13 =13 =13 =13 =13 =13
2F 1r 2a 2cc] 1r 2ff
2F . 2a 2cc . 2ff
1c 2r 4g 2cc 2r 2.ee
. . 4f . . .
. 2c 4e 2cc 2ee .
. . 4d . . 4ff
=14 =14 =14 =14 =14 =14
2r 2c 2c 1g 2ee 1gg
2G 4B 2d . 4dd .
. 4A . . 4cc .
2G 2B 2d 2r 2dd 2g
2C 2c 2c 2g 2ee 4g
. . . . . 4a
=15 =15 =15 =15 =15 =15
0G 4G 1d 2g 1dd 4b
. 4A . . . 4cc
. 4B . 4G . 1dd
. 4c . 4A . .
. 1d 2G 4B 2.b .
. . . 4c . .
. . [2d 4d . 2b
. . . 4e 4cc .
=16 =16 =16 =16 =16 =16
0D 0d 4d] 2f# 0dd 2a
. . 4c . . .
. . 2B 1g . 2g
. . 1A . . 1a
. . . 2f# . .
=17 =17 =17 =17 =17 =17
1G 1B 1G 1g 1dd 1b
1r 1r 1r 1r 1r 1r
=18 =18 =18 =18 =18 =18
0r 1.A 0r 1.a 1.cc# 1.ee
. 2A . 2a 2cc# 2ee
=19 =19 =19 =19 =19 =19
1r 1A 2r 1a 1cc# 1ee
. . 1A . . .
1D [1d . [1f# [1dd [1a
. . 2A . . .
=20 =20 =20 =20 =20 =20
2D 1d] 2A 1f#] 1dd] 1a]
2D . 1d . . .
2G 1B . 1g 1dd 1b
2G . 2G . . .
=21 =21 =21 =21 =21 =21
1C 1c 2G 1g 2.cc 1ee
. . 2.c . . .
. . . . 4dd .
2.c 1A . 2r 2ee [1cc
. . 4d . . .
. . 4e [2cc [2a .
4B . 8d . . .
. . 8e . . .
=22 =22 =22 =22 =22 =22
4A 2.F 1f 4cc] 4a] 0cc]
4G . . 4b 4b .
4F . . 4a 2cc .
4E 4G . 4g . .
1F 2.A 1c 4f 4a .
. . . 4g 4b .
. . . 2a 4cc .
. 4B . . 4dd .
=23 =23 =23 =23 =23 =23
1C 0c 2r 1g 1ee 1cc
. . 1g . . .
2r . . 2r [1cc [1ee
[2c . 2c [2g . .
=24 =24 =24 =24 =24 =24
2c] 0r 2g 2g] 2cc] 2ee]
2F . 2f 2a 2cc 2ff
2c . 1e 2g 2.cc 2gg
2A . . 2a . 2cc
. . . . 8b .
. . . . 8a .
=25 =25 =25 =25 =25 =25
1G 0r 1g 2d 1b 2dd
. . . 2g . 2ee
1F . 4a 4cc 1a 4ff
. . 4g 4b . 4ee
. . 4f 2a . 4dd
. . 4e . . 4cc
=26 =26 =26 =26 =26 =26
2G 0r 2d 2g 0r 2b
2A . 2c 2f . 1cc
1G . 1d 2.g . .
. . . . . 2b
. . . 4f . .
=27 =27 =27 =27 =27 =27
1C 2r 2c 1e 2r 2cc
. 2.c 2.g . 2.ee 2.cc
1r . . 1r . .
. 4c 4g . 4ee 4cc
. 2B 2g . 2dd 2dd
=28 =28 =28 =28 =28 =28
0r 1c 1g 0r 1cc 1ee
. 2G 1g . 2b 2dd
. [2c . . [2cc [2ee
=29 =29 =29 =29 =29 =29
1r 2c] 2g 0r 2cc] 2ee]
. 2B 2g . 2dd 2dd
2r 1A 2c . 2ee 2cc
[2c . 2c . 2ff# 2cc
=30 =30 =30 =30 =30 =30
2c] 1G 0r 2r 1gg 2ee
2B . . 1g . 2dd
1c 2r . . 2r 1ee
. [2c . 2g [2ee .
=31 =31 =31 =31 =31 =31
1G 2c] 2r 2.g 2ee] 0gg
. 2B 1g . 2dd .
. . . 4f . .
2r 1c . 4e 1ee .
. . . 4d . .
2c . 2g 2c . .
=32 =32 =32 =32 =32 =32
2c 2G 1g 2.d 1dd 0r
2B 2G . . . .
. . . 4e . .
2.A 2.F 1c 4f 2r .
. . . 4g . .
. . . [2a 4a .
4G 4G . . 4b .
=33 =33 =33 =33 =33 =33
2F 4A 1c 2a] 4cc 0r
. 4B . . 4dd .
2E 1c . 2g 2ee .
1D . 2d 2f 2ff .
. 2B 2d 2f 2dd .
=34 =34 =34 =34 =34 =34
1C 2c 2G 2e 1ee 2r
. 1c 1g 1e . 1cc
1r . . . 1r .
. 2c 2e 2g . 2cc
=35 =35 =35 =35 =35 =35
0r 1F 1f 1a 0r 1cc
. 2G 2d 1g . 2b
. 2G 2e . . 2b
=36 =36 =36 =36 =36 =36
0r 4F 1f 1c 1.cc 4a
. 4G . . . 4b
. 4A . . . 4cc
. 4B . . . 4dd
. 2c 1e 1r . 2ee
. 2e . . 2cc 2gg
=37 =37 =37 =37 =37 =37
0r 2d 2a 1r 2.dd 2gg
. 2d 2a . . 2ff#
. . . . 4dd .
. 1G 1g 2r 1dd [1gg
. . . [2g . .
=38 =38 =38 =38 =38 =38
0C 0c 2.e 2g] 2r 1gg]
. . . 4c 1ee .
. . 4f 4d . .
. . 1g 4e . 1ee
. . . 4f . .
. . . 4g [2cc .
. . . 4e . .
=39 =39 =39 =39 =39 =39
0F 0A 0a 4f 4cc] 2.cc
. . . 4g 4b .
. . . 4a 4a .
. . . 4b 4g 4b
. . . 1cc 2f 4a
. . . . . 4g
. . . . [2ff 2f
=40 =40 =40 =40 =40 =40
0D 1d 2.a 2.f 4ff] 2.ff
. . . . 4ee .
. . . . 4dd .
. . 4g 4g 4cc 4ee
. 1d 4f 1a 4dd 4dd
. . 4e . 4ee 4cc
. . 2d . 2ff 2dd
=41 =41 =41 =41 =41 =41
1A 2r 0e 2a 2ee 2cc#
. 2.A . 2.a 2.cc# 2.ee
1r . . . . .
. 4A . 4a 4cc# 4ee
. 2A . 2a 2cc# 2ee
=42 =42 =42 =42 =42 =42
0r 1d 0r 1f# 1dd 1a
. 2G . 1g 2dd 2b
. [2c . . [2ee [2cc
=43 =43 =43 =43 =43 =43
0r 2c] 0r 1g 2ee] 2cc]
. 2B . . 2dd 2dd
. 1c . 2e 2.cc 1ee
. . . [2g . .
. . . . 4b .
=44 =44 =44 =44 =44 =44
2r 0d 2r 2g] 0a 1dd
2.D . 2.A 4f# . .
. . . 4e . .
. . . 1f# . 2r
4D . 4A . . .
2D . 2A . . [2dd
=45 =45 =45 =45 =45 =45
1G 2r 1B 1g 1g 4dd]
. . . . . 4dd
. 2.G . . . 2dd
1C . 2.c [1e 2r 1ee
. 4G . . . .
. 2G . . [2g .
. . 4d . . .
=46 =46 =46 =46 =46 =46
2r 2.c 0e 2e] 4g] 1ee
. . . . 4g .
2.C . . 2c 2g .
. 4B . . . .
. 2A . 1c 2.cc 2r
4C . . . . .
2C 2G . . . [2cc
. . . . 4b .
=47 =47 =47 =47 =47 =47
2.F 0A 2r 1c [0a 4cc]
. . . . . 4cc
. . 2c . . 2cc
4E . . . . .
2D . 2d 2r . 2ff
2C# . 2e [2A . [2ee
=48 =48 =48 =48 =48 =48
1D 2.F 1f 2A] 0a] 4ee]
. . . . . 4dd
. . . 2.a . 1dd
. 4G . . . .
1AA 1A 1e . . .
. . . 4g . .
. . . 2e . 2cc#
=49 =49 =49 =49 =49 =49
0D 0A 0d 0f# 0a 0dd
=50 =50 =50 =50 =50 =50
0G 1r 0d 0g 0b 0dd
. [1G . . . .
=51 =51 =51 =51 =51 =51
0C 1G] 0c 0g 1.cc 0ee
. 1c . . . .
. . . . 4g .
. . . . 4a .
=52 =52 =52 =52 =52 =52
1.G 2.B 1d 1g 4b 1dd
. . . . 4a .
. . . . 4b .
. 4A . . 4cc .
. 4G 1g 1b 2dd 2r
. 4A . . . .
2G 4B . . 2dd 2dd
. 4c . . . .
=53 =53 =53 =53 =53 =53
2D 2d 2f 2a 2ff 2dd
2D 2d 2f 2a 2ff 2dd
1F 2A 2f 1a 1ff 1cc
. 2A 4c . . .
. . 4d . . .
=54 =54 =54 =54 =54 =54
1C 1c 4e 2g 2ee 1cc
. . 4d . . .
. . 4e 1cc 1ee .
. . 4f . . .
1r 1G 1g . . 2r
. . . 2b 2dd [2gg
=55 =55 =55 =55 =55 =55
0r 0r 0r 1.a 1.cc 2gg]
. . . . . 2ff
. . . . . 2.ee
. . . 4g 2b .
. . . 4f . 4dd
=56 =56 =56 =56 =56 =56
0r 0r 0r 2e 2cc 2ee
. . . 2d 2.dd 2ff
. . . 1a . 2ee
. . . . 4cc .
. . . . [2cc 4dd
. . . . . 4cc
=57 =57 =57 =57 =57 =57
0G 1r 0d 1g 2cc] 1dd
. . . . 4b .
. . . . 4a .
. [1G . 2r 2b 2dd
. . . 2g 2dd 2b
=58 =58 =58 =58 =58 =58
0C 1G] 0c 0g 0ee 1.cc
. 1c . . . .
. . . . . 4g
. . . . . 4a
=59 =59 =59 =59 =59 =59
1.G 2.B 1d 1g 1dd 4b
. . . . . 4a
. . . . . 4b
. 4A . . . 4cc
. 4G 1g 1b 2r 2dd
. 4A . . . .
2G 4B . . 2dd 2dd
. 4c . . . .
=60 =60 =60 =60 =60 =60
2D 2d 1.f 2a 2dd 1ff
2D 2d . 2a 2dd .
1F 2A . 1a [1cc 1ff
. 2A 2c . . .
=61 =61 =61 =61 =61 =61
1C 1c 1e 1g 1cc] 1ee
2r 1G 1g 2r 2b 2dd
[2G . . [2g [2dd [2b
=62 =62 =62 =62 =62 =62
2G] 2r 2r 2g] 2dd] 2b]
2G 1G 1d 2g 2dd 2b
1G . . [1g 1dd 1b
. 2G 2d . . .
=63 =63 =63 =63 =63 =63
0r 0G 2d 1g] 2r 2r
. . 1g . 1dd 1b
. . . 2r . .
. . 2g [2g 2dd 2b
=64 =64 =64 =64 =64 =64
0r 0r 2c 2g] 2ee 2cc
. . 2c 2g 2ee 2cc
. . 4G 2g 2.dd 2b
. . 4A . . .
. . 4B 2g . 2b
. . 4c . 4ee .
=65 =65 =65 =65 =65 =65
0r 0r 2d 4f 2ff 4a
. . . 4g . 4b
. . 4c 4a 2.ee 4cc
. . 4B 4b . 4dd
. . 2A 2cc . 4ee
. . . . 8dd 4ff
. . . . 8cc .
. . 2e 2g 2b [2gg
=66 =66 =66 =66 =66 =66
1r 1r 1d 1a 1dd 2gg]
. . . . . 2ff#
1G 1B 2G 2b 2dd 1gg
. . 2d 2g 2dd .
=67 =67 =67 =67 =67 =67
1C 1c 1e 1g 1cc 2r
. . . . . 2g
[1G [1B [1d 1g 1dd 1b
=68 =68 =68 =68 =68 =68
1G] 1B] 1d] 2r 2r 2dd
. . . 1g 1b 2dd
1r 1r 1r . . 2.ee
. . . [2a [2cc .
. . . . . 4cc
=69 =69 =69 =69 =69 =69
1r 1r 2r 4a] 4cc] 2cc
. . . 4f# 4a .
. . 1d 2f# 2a 1dd
1G 2r . 2.g 1b .
. 2B [2e . . 2g
. . . 4f . .
=70 =70 =70 =70 =70 =70
2.A 2.c 4e] 2e 1a 0r
. . 4c . . .
. . 2c 2A . .
4F# 4A . . . .
2F# 2A 1d 1r 1r .
[2G [2B . . . .
=71 =71 =71 =71 =71 =71
2G] 2B] 2B 0r 0r 0r
2E 2G 2c . . .
2F 2A 2d . . .
2G 2B 2e . . .
=72 =72 =72 =72 =72 =72
2A 2c 2f 2r 0r 1r
2B 1d 2.g 2d . .
1c . . 2e . 2r
. . 4f . . .
. 2c 2e 2g . 2cc
=73 =73 =73 =73 =73 =73
1G 2c 1d 1g 2r 1dd
. 2B . . 2g .
1C 2.c 1c 2.e 2g [1ee
. . . . [2cc .
. 8B . 4f . .
. 8A . . . .
=74 =74 =74 =74 =74 =74
0r 1G 0r 1g 2cc] 2ee]
. . . . 2b 2dd
. 1r . 4c 1ee 1cc
. . . 4d . .
. . . 4e . .
. . . 4f . .
=75 =75 =75 =75 =75 =75
2r 1r 2r 2g 1dd 2b
1G . 1B 1g . 1b
. [1d . . 2r .
2G . 2B 2g [2dd 2b
=76 =76 =76 =76 =76 =76
2.G 2d] 1B 1g 2dd] 2.b
. 2d . . 2dd .
8F . . . . 8a
8E . . . . 8g
1D 2.d 2r 2.f 2dd 1a
. . 2d . [2dd .
. 8c . 4g . .
. 8B . . . .
=77 =77 =77 =77 =77 =77
0r 2A 2e 1a 4dd] 2r
. . . . 4dd .
. 2A 2f . 2cc 2a
. 2G 2g 1r 2b 2b
. 2F 2a . [2a 2cc
=78 =78 =78 =78 =78 =78
1r 1B- 1d 2r 2a] 1dd
. . . 2d 2g .
2r 1A 1r 2e 2a 1cc
2A . . 2f 2a .
=79 =79 =79 =79 =79 =79
2G 0r 1r 2g 2b 0r
2F . . 1a 2cc .
2B- . 2r . 2dd .
2B- . 2d 2g 2dd .
=80 =80 =80 =80 =80 =80
1A 1r 2e 1a 2.cc 2r
. . 2f . . 2a
. . . . 4dd .
1r 2r 1g 1e 1ee 2b
. 2e . . . 2cc
=81 =81 =81 =81 =81 =81
0r 2d 1.a 2f 2r 2dd
. 2c . 2e 2ee 1ee
. 1f . 2r 2cc .
. . 2d 2a 2dd [2dd
=82 =82 =82 =82 =82 =82
0r 2e 1g 2b 2ee 2dd]
. 2e . 2g 1gg 2cc#
. [1d 1r [1a . [1dd
. . . . 4ff# .
. . . . 4ee .
=83 =83 =83 =83 =83 =83
1r 1d] 1r 1a] 2ff# 1dd]
. . . . 2ff# .
[1C [1c [1e [1cc 1gg [1ee
=84 =84 =84 =84 =84 =84
2C] 2c] 2e] 1cc] 1.g 0ee]
2D 4B 2f . . .
. 4A . . . .
2E [1G [1g [1b . .
2F . . . 2a .
=85 =85 =85 =85 =85 =85
1.G 2G] 1g] 0b] 2b 1dd
. 2A . . 2cc .
. 1B 1G . 2dd 1gg
2G . . . 2dd .
=86 =86 =86 =86 =86 =86
0F 1c 2.A 0a 0ff 0cc
. . 4B . . .
. 1A 2c . . .
. . 2d . . .
=87 =87 =87 =87 =87 =87
0C 1c 0e 1g 1ee 1cc
. 2r . 2r 1ee 2r
. 2c . 2g . 2cc
=88 =88 =88 =88 =88 =88
0r 2B 0r 2g 2dd 2dd
. 2c . 2g 2cc 2ee
. 2.F . 2a 2.cc 2ff
. . . 2a . 2ff
. 4F . . 4cc .
=89 =89 =89 =89 =89 =89
2r 1G 2r 2g 2b 0dd
2G . 2d 2b 2g .
2F# 1r 2d 2a 2a .
2G . 2d 2g 2b .
=90 =90 =90 =90 =90 =90
2.C 1r 2.e 2.g 2.cc 1r
4C . 4e 4g 4cc .
1G 2r 2d 1g 2b 2r
. 2G 2g . 2dd 2b
=91 =91 =91 =91 =91 =91
0r 2.G 2.g 0r 2.dd 2.b
. 4G 4g . 4dd 4b
. 1c 1g . 1ee 1cc
=92 =92 =92 =92 =92 =92
0r 2G 2g 0r 2dd 2b
. 2G 2d . 2b 2g
. 4F 1f . [1cc 4a
. 4G . . . 4b
. 4A . . . 4cc
. 4B . . . 4dd
=93 =93 =93 =93 =93 =93
1r 4c 1e 1r 1cc] 4ee
. 4d . . . 4ff
. 2e . . . 1gg
2r [1d 1r 1a 1dd .
2D . . . . 4ff#
. . . . . 4ee
=94 =94 =94 =94 =94 =94
2.D 1d] 2r 2.a 2r 1ff#
. . 2d . 2dd .
4D . . 4a . .
1G 1r 2.d 1b 2.dd 1gg
. . 4d . 4dd .
=95 =95 =95 =95 =95 =95
2E 0r 1e 2b 1gg 0r
2C . . 2cc . .
4D . 2d [1a 2ff .
4E . . . . .
4F . 2d . 2ff .
4G . . . . .
=96 =96 =96 =96 =96 =96
4A 1r 1c 2a] 1ee 1r
4B . . . . .
1c . . 4g . .
. . . 4f . .
. 1G [1d [1g 1dd 2r
4B . . . . 2dd
4A . . . . .
=97 =97 =97 =97 =97 =97
1B 2.G 1d] 1g] 2r 2dd
. . . . 2g 2dd
. 4G . . . .
2c [1c 2r 1e 2.g [1ee
2C . 2g . . .
. . . . 4g .
=98 =98 =98 =98 =98 =98
2.C 1c] 2.e 2r 1cc 1ee]
. . . 2g . .
4C . 4e . . .
1G 2d 1g 2g 2b 2dd
. 2d . 2d 2g 2b
=99 =99 =99 =99 =99 =99
1F 1A 1.c 1f 4a 1.cc
. . . . 4b .
. . . . 4cc .
. . . . 4dd .
1C 1G . 2e 4ee .
. . . . 4ff .
. . 2B 2e [2gg 2g
=100 =100 =100 =100 =100 =100
0D 1r 0A 0d 2gg] 1dd
. . . . 4ff# .
. . . . 4ee .
. 1d . . 1ff# 2dd
. . . . . [2dd
=101 =101 =101 =101 =101 =101
1G 1B 2G 1d 0gg 2dd]
. . 1d . . 1b
1G 2d . [1g . .
. 2d 2B . . [2dd
=102 =102 =102 =102 =102 =102
1E 0G 1e 2g] 2r 4dd]
. . . . . 4cc
. . . 2g 2.gg 1cc
2G . 1d 2g . .
. . . . 8ff .
. . . . 8ee .
2G . . 2g 2dd 2b
=103 =103 =103 =103 =103 =103
0C 1.G 0c 0g 2.ee 2.cc
. . . . 4dd 4dd
. . . . 1cc 1ee
. 2A . . . .
=104 =104 =104 =104 =104 =104
0G 0B 0d 0g 0b 0dd
== == == == == ==
*- *- *- *- *- *-
!!!CDT: 1525/^1526/-1594/2/2
!!!OCY: Italia
!!!AGN: Mass (Parody)
!!!AST: renaissance, vocal
!!!ASW: Motet 1572 (Palestrina)
!!!PWK: Masses, Book 11
!!!RNB: Cadence finals: C,D
!!!YOR: Le Opere Complete, v. 28, p. 268
!!!YOO: Rome, Italy: Fratelli Scalera
!!!END: 1992//
!!!EED: John Miller
!!!YEC: Copyright 2000, John Miller
!!!YEN: United States of America
!!!YEM: Rights to all derivative electronic formats reserved.
!!!YEM: Refer to licensing agreement for further details.
!!!YEM: This file must be accompanied by the licensing agreement.
!!!YEM: A copy of the licensing agreement may be found at http://www.music-cog.ohio-state.edu/HumdrumDatabases/Palestrina/license.txt
!!!EMD: converted to Humdrum by Bret Aarden
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2020, NVIDIA CORPORATION. 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.
*/
#include "videoSource.h"
#include "imageLoader.h"
#include "gstCamera.h"
#include "gstDecoder.h"
#include "logging.h"
// constructor
videoSource::videoSource( const videoOptions& options ) : mOptions(options)
{
mStreaming = false;
}
// destructor
videoSource::~videoSource()
{
}
// Create
videoSource* videoSource::Create( const videoOptions& options )
{
videoSource* src = NULL;
const URI& uri = options.resource;
if( uri.protocol == "file" )
{
if( gstDecoder::IsSupportedExtension(uri.extension.c_str()) )
src = gstDecoder::Create(options);
else
src = imageLoader::Create(options);
}
else if( uri.protocol == "rtp" || uri.protocol == "rtsp" )
{
src = gstDecoder::Create(options);
}
else if( uri.protocol == "csi" || uri.protocol == "v4l2" )
{
src = gstCamera::Create(options);
}
else
{
LogError(LOG_VIDEO "videoSource -- unsupported protocol (%s)\n", uri.protocol.size() > 0 ? uri.protocol.c_str() : "null");
}
if( !src )
return NULL;
LogSuccess(LOG_VIDEO "created %s from %s\n", src->TypeToStr(), src->GetResource().string.c_str());
src->GetOptions().Print(src->TypeToStr());
return src;
}
// Create
videoSource* videoSource::Create( const char* resource, const videoOptions& options )
{
videoOptions opt = options;
opt.resource = resource;
return Create(opt);
}
// Create
videoSource* videoSource::Create( const char* resource, const int argc, char** argv )
{
commandLine cmdLine(argc, argv);
return Create(resource, cmdLine);
}
// Create
videoSource* videoSource::Create( const char* resource, const commandLine& cmdLine )
{
videoOptions opt;
if( !opt.Parse(resource, cmdLine, videoOptions::INPUT) )
{
LogError(LOG_VIDEO "videoSource -- failed to parse command line options\n");
return NULL;
}
return Create(opt);
}
// Create
videoSource* videoSource::Create( const int argc, char** argv, int positionArg )
{
/*if( argc < 0 || !argv )
return NULL;*/
commandLine cmdLine(argc, argv);
return Create(cmdLine, positionArg);
}
// Create
videoSource* videoSource::Create( const commandLine& cmdLine, int positionArg )
{
videoOptions opt;
if( !opt.Parse(cmdLine, videoOptions::INPUT, positionArg) )
{
LogError(LOG_VIDEO "videoSource -- failed to parse command line options\n");
return NULL;
}
return Create(opt);
}
// Open
bool videoSource::Open()
{
mStreaming = true;
return true;
}
// Close
void videoSource::Close()
{
mStreaming = false;
}
// TypeToStr
const char* videoSource::TypeToStr( uint32_t type )
{
if( type == gstCamera::Type )
return "gstCamera";
else if( type == gstDecoder::Type )
return "gstDecoder";
else if( type == imageLoader::Type )
return "imageLoader";
return "(unknown)";
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.