text
stringlengths 2
99.9k
| meta
dict |
|---|---|
; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
declare void @a(i64* byval inalloca %p)
; CHECK: Attributes {{.*}} are incompatible
declare void @b(i64* inreg inalloca %p)
; CHECK: Attributes {{.*}} are incompatible
declare void @c(i64* sret inalloca %p)
; CHECK: Attributes {{.*}} are incompatible
declare void @d(i64* nest inalloca %p)
; CHECK: Attributes {{.*}} are incompatible
declare void @e(i64* readonly inalloca %p)
; CHECK: Attributes {{.*}} are incompatible
declare void @f(void ()* inalloca %p)
; CHECK: do not support unsized types
declare void @g(i32* inalloca %p, i32 %p2)
; CHECK: inalloca isn't on the last parameter!
|
{
"pile_set_name": "Github"
}
|
title: Traffic Analysis of Network Interfaces Using RMON
agents: snmp
catalog: hw/network/generic
license: GPL
distribution: check_mk
description:
This check extracts data from the RMON statistics group of RMON enabled network
interfaces. The data are described in the Remote MONitoring MIB. Several devices
of various vendors are capable of supplying RMON data via SNMP, among them
are some CISCO devices. It may be necessary to enable RMON for every single network
interface you want to gather information for.
The check always returns the state {OK}. The main purpose of the check is to gather
network traffic statistics as performance data.
item:
The ID of the network interface within RMON (etherStatsIndex)
inventory:
The discovery of services has to be specifically activated for this check (ruleset
"Monitor RMON statistics"). By default, no services are discovered. If activated,
one service is created for each network port for which RMON is activated.
|
{
"pile_set_name": "Github"
}
|
ReplaceString = """
This message contained an attachment that was stripped out.
The original type was: %(content_type)s
The filename was: %(filename)s,
(and it had additional parameters of:
%(params)s)
"""
import re
BAD_CONTENT_RE = re.compile('application/(msword|msexcel)', re.I)
BAD_FILEEXT_RE = re.compile(r'(\.exe|\.zip|\.pif|\.scr|\.ps)$')
def sanitise(msg):
# Strip out all payloads of a particular type
ct = msg.get_content_type()
# We also want to check for bad filename extensions
fn = msg.get_filename()
# get_filename() returns None if there's no filename
if BAD_CONTENT_RE.search(ct) or (fn and BAD_FILEEXT_RE.search(fn)):
# Ok. This part of the message is bad, and we're going to stomp
# on it. First, though, we pull out the information we're about to
# destroy so we can tell the user about it.
# This returns the parameters to the content-type. The first entry
# is the content-type itself, which we already have.
params = msg.get_params()[1:]
# The parameters are a list of (key, value) pairs - join the
# key-value with '=', and the parameter list with ', '
params = ', '.join([ '='.join(p) for p in params ])
# Format up the replacement text, telling the user we ate their
# email attachment.
replace = ReplaceString % dict(content_type=ct,
filename=fn,
params=params)
# Install the text body as the new payload.
msg.set_payload(replace)
# Now we manually strip away any paramaters to the content-type
# header. Again, we skip the first parameter, as it's the
# content-type itself, and we'll stomp that next.
for k, v in msg.get_params()[1:]:
msg.del_param(k)
# And set the content-type appropriately.
msg.set_type('text/plain')
# Since we've just stomped the content-type, we also kill these
# headers - they make no sense otherwise.
del msg['Content-Transfer-Encoding']
del msg['Content-Disposition']
else:
# Now we check for any sub-parts to the message
if msg.is_multipart():
# Call the sanitise routine on any subparts
payload = [ sanitise(x) for x in msg.get_payload() ]
# We replace the payload with our list of sanitised parts
msg.set_payload(payload)
# Return the sanitised message
return msg
# And a simple driver to show how to use this
import email, sys
m = email.message_from_file(open(sys.argv[1]))
print sanitise(m)
|
{
"pile_set_name": "Github"
}
|
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_PLATFORM_DEFAULT_LOGGING_H_
#define TENSORFLOW_PLATFORM_DEFAULT_LOGGING_H_
// IWYU pragma: private, include "third_party/tensorflow/core/platform/logging.h"
// IWYU pragma: friend third_party/tensorflow/core/platform/logging.h
#include <sstream>
#include <limits>
#include "tensorflow/core/platform/macros.h"
#include "tensorflow/core/platform/types.h"
// TODO(mrry): Prevent this Windows.h #define from leaking out of our headers.
#undef ERROR
namespace tensorflow {
const int INFO = 0; // base_logging::INFO;
const int WARNING = 1; // base_logging::WARNING;
const int ERROR = 2; // base_logging::ERROR;
const int FATAL = 3; // base_logging::FATAL;
const int NUM_SEVERITIES = 4; // base_logging::NUM_SEVERITIES;
namespace internal {
class LogMessage : public std::basic_ostringstream<char> {
public:
LogMessage(const char* fname, int line, int severity);
~LogMessage();
// Returns the minimum log level for VLOG statements.
// E.g., if MinVLogLevel() is 2, then VLOG(2) statements will produce output,
// but VLOG(3) will not. Defaults to 0.
static int64 MinVLogLevel();
protected:
void GenerateLogMessage();
private:
const char* fname_;
int line_;
int severity_;
};
// LogMessageFatal ensures the process will exit in failure after
// logging this message.
class LogMessageFatal : public LogMessage {
public:
LogMessageFatal(const char* file, int line) TF_ATTRIBUTE_COLD;
TF_ATTRIBUTE_NORETURN ~LogMessageFatal();
};
#define _TF_LOG_INFO \
::tensorflow::internal::LogMessage(__FILE__, __LINE__, tensorflow::INFO)
#define _TF_LOG_WARNING \
::tensorflow::internal::LogMessage(__FILE__, __LINE__, tensorflow::WARNING)
#define _TF_LOG_ERROR \
::tensorflow::internal::LogMessage(__FILE__, __LINE__, tensorflow::ERROR)
#define _TF_LOG_FATAL \
::tensorflow::internal::LogMessageFatal(__FILE__, __LINE__)
#define _TF_LOG_QFATAL _TF_LOG_FATAL
#define LOG(severity) _TF_LOG_##severity
#ifdef IS_MOBILE_PLATFORM
// Turn VLOG off when under mobile devices for considerations of binary size.
#define VLOG_IS_ON(lvl) ((lvl) <= 0)
#else
// Otherwise, Set TF_CPP_MIN_VLOG_LEVEL environment to update minimum log level
// of VLOG
#define VLOG_IS_ON(lvl) \
((lvl) <= ::tensorflow::internal::LogMessage::MinVLogLevel())
#endif
#define VLOG(lvl) \
if (TF_PREDICT_FALSE(VLOG_IS_ON(lvl))) \
::tensorflow::internal::LogMessage(__FILE__, __LINE__, tensorflow::INFO)
// CHECK dies with a fatal error if condition is not true. It is *not*
// controlled by NDEBUG, so the check will be executed regardless of
// compilation mode. Therefore, it is safe to do things like:
// CHECK(fp->Write(x) == 4)
#define CHECK(condition) \
if (TF_PREDICT_FALSE(!(condition))) \
LOG(FATAL) << "Check failed: " #condition " "
// Function is overloaded for integral types to allow static const
// integrals declared in classes and not defined to be used as arguments to
// CHECK* macros. It's not encouraged though.
template <typename T>
inline const T& GetReferenceableValue(const T& t) {
return t;
}
inline char GetReferenceableValue(char t) { return t; }
inline unsigned char GetReferenceableValue(unsigned char t) { return t; }
inline signed char GetReferenceableValue(signed char t) { return t; }
inline short GetReferenceableValue(short t) { return t; }
inline unsigned short GetReferenceableValue(unsigned short t) { return t; }
inline int GetReferenceableValue(int t) { return t; }
inline unsigned int GetReferenceableValue(unsigned int t) { return t; }
inline long GetReferenceableValue(long t) { return t; }
inline unsigned long GetReferenceableValue(unsigned long t) { return t; }
inline long long GetReferenceableValue(long long t) { return t; }
inline unsigned long long GetReferenceableValue(unsigned long long t) {
return t;
}
// This formats a value for a failing CHECK_XX statement. Ordinarily,
// it uses the definition for operator<<, with a few special cases below.
template <typename T>
inline void MakeCheckOpValueString(std::ostream* os, const T& v) {
(*os) << v;
}
// Overrides for char types provide readable values for unprintable
// characters.
template <>
void MakeCheckOpValueString(std::ostream* os, const char& v);
template <>
void MakeCheckOpValueString(std::ostream* os, const signed char& v);
template <>
void MakeCheckOpValueString(std::ostream* os, const unsigned char& v);
#if LANG_CXX11
// We need an explicit specialization for std::nullptr_t.
template <>
void MakeCheckOpValueString(std::ostream* os, const std::nullptr_t& p);
#endif
// A container for a string pointer which can be evaluated to a bool -
// true iff the pointer is non-NULL.
struct CheckOpString {
CheckOpString(string* str) : str_(str) {}
// No destructor: if str_ is non-NULL, we're about to LOG(FATAL),
// so there's no point in cleaning up str_.
operator bool() const { return TF_PREDICT_FALSE(str_ != NULL); }
string* str_;
};
// Build the error message string. Specify no inlining for code size.
template <typename T1, typename T2>
string* MakeCheckOpString(const T1& v1, const T2& v2,
const char* exprtext) TF_ATTRIBUTE_NOINLINE;
// A helper class for formatting "expr (V1 vs. V2)" in a CHECK_XX
// statement. See MakeCheckOpString for sample usage. Other
// approaches were considered: use of a template method (e.g.,
// base::BuildCheckOpString(exprtext, base::Print<T1>, &v1,
// base::Print<T2>, &v2), however this approach has complications
// related to volatile arguments and function-pointer arguments).
class CheckOpMessageBuilder {
public:
// Inserts "exprtext" and " (" to the stream.
explicit CheckOpMessageBuilder(const char* exprtext);
// Deletes "stream_".
~CheckOpMessageBuilder();
// For inserting the first variable.
std::ostream* ForVar1() { return stream_; }
// For inserting the second variable (adds an intermediate " vs. ").
std::ostream* ForVar2();
// Get the result (inserts the closing ")").
string* NewString();
private:
std::ostringstream* stream_;
};
template <typename T1, typename T2>
string* MakeCheckOpString(const T1& v1, const T2& v2, const char* exprtext) {
CheckOpMessageBuilder comb(exprtext);
MakeCheckOpValueString(comb.ForVar1(), v1);
MakeCheckOpValueString(comb.ForVar2(), v2);
return comb.NewString();
}
// Helper functions for CHECK_OP macro.
// The (int, int) specialization works around the issue that the compiler
// will not instantiate the template version of the function on values of
// unnamed enum type - see comment below.
// The (size_t, int) and (int, size_t) specialization are to handle unsigned
// comparison errors while still being thorough with the comparison.
#define TF_DEFINE_CHECK_OP_IMPL(name, op) \
template <typename T1, typename T2> \
inline string* name##Impl(const T1& v1, const T2& v2, \
const char* exprtext) { \
if (TF_PREDICT_TRUE(v1 op v2)) \
return NULL; \
else \
return ::tensorflow::internal::MakeCheckOpString(v1, v2, exprtext); \
} \
inline string* name##Impl(int v1, int v2, const char* exprtext) { \
return name##Impl<int, int>(v1, v2, exprtext); \
} \
inline string* name##Impl(const size_t v1, const int v2, const char* exprtext) { \
if (TF_PREDICT_FALSE(v2 < 0)) { \
return ::tensorflow::internal::MakeCheckOpString(v1, v2, exprtext);\
} \
const size_t uval = (size_t)((unsigned)v1); \
return name##Impl<size_t, size_t>(uval, v2, exprtext); \
} \
inline string* name##Impl(const int v1, const size_t v2, const char* exprtext) { \
if (TF_PREDICT_FALSE(v2 >= std::numeric_limits<int>::max())) { \
return ::tensorflow::internal::MakeCheckOpString(v1, v2, exprtext);\
} \
const size_t uval = (size_t)((unsigned)v2); \
return name##Impl<size_t, size_t>(v1, uval, exprtext); \
}
// We use the full name Check_EQ, Check_NE, etc. in case the file including
// base/logging.h provides its own #defines for the simpler names EQ, NE, etc.
// This happens if, for example, those are used as token names in a
// yacc grammar.
TF_DEFINE_CHECK_OP_IMPL(Check_EQ,
== ) // Compilation error with CHECK_EQ(NULL, x)?
TF_DEFINE_CHECK_OP_IMPL(Check_NE, != ) // Use CHECK(x == NULL) instead.
TF_DEFINE_CHECK_OP_IMPL(Check_LE, <= )
TF_DEFINE_CHECK_OP_IMPL(Check_LT, < )
TF_DEFINE_CHECK_OP_IMPL(Check_GE, >= )
TF_DEFINE_CHECK_OP_IMPL(Check_GT, > )
#undef TF_DEFINE_CHECK_OP_IMPL
// In optimized mode, use CheckOpString to hint to compiler that
// the while condition is unlikely.
#define CHECK_OP_LOG(name, op, val1, val2) \
while (::tensorflow::internal::CheckOpString _result = \
::tensorflow::internal::name##Impl( \
::tensorflow::internal::GetReferenceableValue(val1), \
::tensorflow::internal::GetReferenceableValue(val2), \
#val1 " " #op " " #val2)) \
::tensorflow::internal::LogMessageFatal(__FILE__, __LINE__) << *(_result.str_)
#define CHECK_OP(name, op, val1, val2) CHECK_OP_LOG(name, op, val1, val2)
// CHECK_EQ/NE/...
#define CHECK_EQ(val1, val2) CHECK_OP(Check_EQ, ==, val1, val2)
#define CHECK_NE(val1, val2) CHECK_OP(Check_NE, !=, val1, val2)
#define CHECK_LE(val1, val2) CHECK_OP(Check_LE, <=, val1, val2)
#define CHECK_LT(val1, val2) CHECK_OP(Check_LT, <, val1, val2)
#define CHECK_GE(val1, val2) CHECK_OP(Check_GE, >=, val1, val2)
#define CHECK_GT(val1, val2) CHECK_OP(Check_GT, >, val1, val2)
#define CHECK_NOTNULL(val) \
::tensorflow::internal::CheckNotNull(__FILE__, __LINE__, \
"'" #val "' Must be non NULL", (val))
#ifndef NDEBUG
// DCHECK_EQ/NE/...
#define DCHECK(condition) CHECK(condition)
#define DCHECK_EQ(val1, val2) CHECK_EQ(val1, val2)
#define DCHECK_NE(val1, val2) CHECK_NE(val1, val2)
#define DCHECK_LE(val1, val2) CHECK_LE(val1, val2)
#define DCHECK_LT(val1, val2) CHECK_LT(val1, val2)
#define DCHECK_GE(val1, val2) CHECK_GE(val1, val2)
#define DCHECK_GT(val1, val2) CHECK_GT(val1, val2)
#else
#define DCHECK(condition) \
while (false && (condition)) LOG(FATAL)
// NDEBUG is defined, so DCHECK_EQ(x, y) and so on do nothing.
// However, we still want the compiler to parse x and y, because
// we don't want to lose potentially useful errors and warnings.
// _DCHECK_NOP is a helper, and should not be used outside of this file.
#define _TF_DCHECK_NOP(x, y) \
while (false && ((void)(x), (void)(y), 0)) LOG(FATAL)
#define DCHECK_EQ(x, y) _TF_DCHECK_NOP(x, y)
#define DCHECK_NE(x, y) _TF_DCHECK_NOP(x, y)
#define DCHECK_LE(x, y) _TF_DCHECK_NOP(x, y)
#define DCHECK_LT(x, y) _TF_DCHECK_NOP(x, y)
#define DCHECK_GE(x, y) _TF_DCHECK_NOP(x, y)
#define DCHECK_GT(x, y) _TF_DCHECK_NOP(x, y)
#endif
// These are for when you don't want a CHECK failure to print a verbose
// stack trace. The implementation of CHECK* in this file already doesn't.
#define QCHECK(condition) CHECK(condition)
#define QCHECK_EQ(x, y) CHECK_EQ(x, y)
#define QCHECK_NE(x, y) CHECK_NE(x, y)
#define QCHECK_LE(x, y) CHECK_LE(x, y)
#define QCHECK_LT(x, y) CHECK_LT(x, y)
#define QCHECK_GE(x, y) CHECK_GE(x, y)
#define QCHECK_GT(x, y) CHECK_GT(x, y)
template <typename T>
T&& CheckNotNull(const char* file, int line, const char* exprtext, T&& t) {
if (t == nullptr) {
LogMessageFatal(file, line) << string(exprtext);
}
return std::forward<T>(t);
}
} // namespace internal
} // namespace tensorflow
#endif // TENSORFLOW_PLATFORM_DEFAULT_LOGGING_H_
|
{
"pile_set_name": "Github"
}
|
###
### DO NOT MODIFY THIS FILE. THIS FILE HAS BEEN AUTOGENERATED
###
FROM circleci/php:7.2.21-fpm-buster
#
# Install Java 11 LTS / OpenJDK 11
#
RUN if grep -q Debian /etc/os-release && grep -q stretch /etc/os-release; then \
echo 'deb http://deb.debian.org/debian stretch-backports main' | sudo tee -a /etc/apt/sources.list.d/stretch-backports.list; \
elif grep -q Ubuntu /etc/os-release && grep -q xenial /etc/os-release; then \
sudo apt-get update && sudo apt-get install -y software-properties-common && \
sudo add-apt-repository -y ppa:openjdk-r/ppa; \
fi && \
sudo apt-get update && sudo apt-get install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless && \
sudo apt-get install -y bzip2 libgconf-2-4 # for extracting firefox and running chrome, respectively
ENV OPENSSL_CONF /
## install phantomjs
#
RUN PHANTOMJS_URL="https://circle-downloads.s3.amazonaws.com/circleci-images/cache/linux-amd64/phantomjs-latest.tar.bz2" \
&& sudo apt-get install libfontconfig \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/phantomjs.tar.bz2 ${PHANTOMJS_URL} \
&& tar -x -C /tmp -f /tmp/phantomjs.tar.bz2 \
&& sudo mv /tmp/phantomjs-*-linux-x86_64/bin/phantomjs /usr/local/bin \
&& rm -rf /tmp/phantomjs.tar.bz2 /tmp/phantomjs-* \
&& phantomjs --version
# install firefox
# If you are upgrading to any version newer than 47.0.1, you must check the compatibility with
# selenium. See https://github.com/SeleniumHQ/selenium/issues/2559#issuecomment-237079591
RUN FIREFOX_URL="https://s3.amazonaws.com/circle-downloads/firefox-mozilla-build_47.0.1-0ubuntu1_amd64.deb" \
&& curl --silent --show-error --location --fail --retry 3 --output /tmp/firefox.deb $FIREFOX_URL \
&& echo 'ef016febe5ec4eaf7d455a34579834bcde7703cb0818c80044f4d148df8473bb /tmp/firefox.deb' | sha256sum -c \
&& sudo dpkg -i /tmp/firefox.deb || sudo apt-get -f install \
&& sudo apt-get install -y libgtk3.0-cil-dev libasound2 libasound2 libdbus-glib-1-2 libdbus-1-3 \
&& rm -rf /tmp/firefox.deb \
&& firefox --version
# install geckodriver—disabling this temporarily, we will likely want this code in the future, but until we're ready to upgrade our version of firefox to 53+, geckodriver wont' be compatible...
# RUN export GECKODRIVER_LATEST_RELEASE_URL=$(curl https://api.github.com/repos/mozilla/geckodriver/releases/latest | jq -r ".assets[] | select(.name | test(\"linux64\")) | .browser_download_url") \
# && curl --silent --show-error --location --fail --retry 3 --output /tmp/geckodriver_linux64.tar.gz "$GECKODRIVER_LATEST_RELEASE_URL" \
# && cd /tmp \
# && tar xf geckodriver_linux64.tar.gz \
# && rm -rf geckodriver_linux64.tar.gz \
# && sudo mv geckodriver /usr/local/bin/geckodriver \
# && sudo chmod +x /usr/local/bin/geckodriver \
# && geckodriver --version
# install chrome
RUN curl --silent --show-error --location --fail --retry 3 --output /tmp/google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& (sudo dpkg -i /tmp/google-chrome-stable_current_amd64.deb || sudo apt-get -fy install) \
&& rm -rf /tmp/google-chrome-stable_current_amd64.deb \
&& sudo sed -i 's|HERE/chrome"|HERE/chrome" --disable-setuid-sandbox --no-sandbox|g' \
"/opt/google/chrome/google-chrome" \
&& google-chrome --version
RUN CHROME_VERSION="$(google-chrome --version)" \
&& export CHROMEDRIVER_RELEASE="$(echo $CHROME_VERSION | sed 's/^Google Chrome //')" && export CHROMEDRIVER_RELEASE=${CHROMEDRIVER_RELEASE%%.*} \
&& CHROMEDRIVER_VERSION=$(curl --silent --show-error --location --fail --retry 4 --retry-delay 5 http://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROMEDRIVER_RELEASE}) \
&& curl --silent --show-error --location --fail --retry 4 --retry-delay 5 --output /tmp/chromedriver_linux64.zip "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip" \
&& cd /tmp \
&& unzip chromedriver_linux64.zip \
&& rm -rf chromedriver_linux64.zip \
&& sudo mv chromedriver /usr/local/bin/chromedriver \
&& sudo chmod +x /usr/local/bin/chromedriver \
&& chromedriver --version
# install libgconf-2-4 manually since chrome no longer pulls it in automatically
RUN sudo apt-get install -y libgconf-2-4
# start xvfb automatically to avoid needing to express in circle.yml
ENV DISPLAY :99
RUN printf '#!/bin/sh\nXvfb :99 -screen 0 1280x1024x24 &\nexec "$@"\n' > /tmp/entrypoint \
&& chmod +x /tmp/entrypoint \
&& sudo mv /tmp/entrypoint /docker-entrypoint.sh
# ensure that the build agent doesn't override the entrypoint
LABEL com.circleci.preserve-entrypoint=true
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/bin/sh"]
|
{
"pile_set_name": "Github"
}
|
[](https://gitter.im/moment/moment?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![MIT License][license-image]][license-url] [![Build Status][travis-image]][travis-url]
[](https://coveralls.io/r/moment/moment?branch=develop)
A lightweight JavaScript date library for parsing, validating, manipulating, and formatting dates.
**[Documentation](http://momentjs.com/docs/)**
## Port to ECMAScript 6 (version 2.10.0)
Moment 2.10.0 does not bring any new features, but the code is now written in
ECMAScript 6 modules and placed inside `src/`. Previously `moment.js`, `locale/*.js` and
`test/moment/*.js`, `test/locale/*.js` contained the source of the project. Now
the source is in `src/`, temporary build (ECMAScript 5) files are placed under
`build/umd/` (for running tests during development), and the `moment.js` and
`locale/*.js` files are updated only on release.
If you want to use a particular revision of the code, make sure to run
`grunt transpile update-index`, so `moment.js` and `locales/*.js` are synced
with `src/*`. We might place that in a commit hook in the future.
## Upgrading to 2.0.0
There are a number of small backwards incompatible changes with version 2.0.0. [See the full descriptions here](https://gist.github.com/timrwood/e72f2eef320ed9e37c51#backwards-incompatible-changes)
* Changed language ordinal method to return the number + ordinal instead of just the ordinal.
* Changed two digit year parsing cutoff to match strptime.
* Removed `moment#sod` and `moment#eod` in favor of `moment#startOf` and `moment#endOf`.
* Removed `moment.humanizeDuration()` in favor of `moment.duration().humanize()`.
* Removed the lang data objects from the top level namespace.
* Duplicate `Date` passed to `moment()` instead of referencing it.
## [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
## [Contributing](https://github.com/moment/moment/blob/develop/CONTRIBUTING.md)
We're looking for co-maintainers! If you want to become a master of time please
write to [ichernev](https://github.com/ichernev).
## License
Moment.js is freely distributable under the terms of the [MIT license](https://github.com/moment/moment/blob/develop/LICENSE).
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
[license-url]: LICENSE
[npm-url]: https://npmjs.org/package/moment
[npm-version-image]: http://img.shields.io/npm/v/moment.svg?style=flat
[npm-downloads-image]: http://img.shields.io/npm/dm/moment.svg?style=flat
[travis-url]: http://travis-ci.org/moment/moment
[travis-image]: http://img.shields.io/travis/moment/moment/develop.svg?style=flat
|
{
"pile_set_name": "Github"
}
|
/**
* @file
* @brief Configuration parameter origin.
*/
/*
*
* Copyright (C) 2016 Red Hat
*
* This file is part of tlog.
*
* Tlog 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.
*
* Tlog 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 tlog; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _TLOG_CONF_ORIGIN_H
#define _TLOG_CONF_ORIGIN_H
/** Configuration parameter origin codes, lowest priority first */
enum tlog_conf_origin {
TLOG_CONF_ORIGIN_FILE = 1, /**< Configuration file */
TLOG_CONF_ORIGIN_ENV, /**< Environment variable(s) */
TLOG_CONF_ORIGIN_NAME, /**< Command name (argv[0]) */
TLOG_CONF_ORIGIN_OPTS, /**< Command-line options */
TLOG_CONF_ORIGIN_ARGS /**< Command-line positional arguments */
};
#endif /* _TLOG_CONF_ORIGIN_H */
|
{
"pile_set_name": "Github"
}
|
/*!
@file
Forward declares `boost::hana::hash`.
@copyright Louis Dionne 2016
@copyright Jason Rice 2016
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_FWD_HASH_HPP
#define BOOST_HANA_FWD_HASH_HPP
#include <boost/hana/config.hpp>
#include <boost/hana/core/when.hpp>
BOOST_HANA_NAMESPACE_BEGIN
//! Returns a `hana::type` representing the compile-time hash of an object.
//! @ingroup group-Hashable
//!
//! Given an arbitrary object `x`, `hana::hash` returns a `hana::type`
//! representing the hash of `x`. In normal programming, hashes are
//! usually numerical values that can be used e.g. as indices in an
//! array as part of the implementation of a hash table. In the context
//! of metaprogramming, we are interested in type-level hashes instead.
//! Thus, `hana::hash` must return a `hana::type` object instead of an
//! integer. This `hana::type` must somehow summarize the object being
//! hashed, but that summary may of course lose some information.
//!
//! In order for the `hash` function to be defined properly, it must be
//! the case that whenever `x` is equal to `y`, then `hash(x)` is equal
//! to `hash(y)`. This ensures that `hana::hash` is a function in the
//! mathematical sense of the term.
//!
//!
//! Signature
//! ---------
//! Given a `Hashable` `H`, the signature is
//! \f$
//! \mathtt{hash} : H \to \mathtt{type\_tag}
//! \f$
//!
//! @param x
//! An object whose hash is to be computed.
//!
//!
//! Example
//! -------
//! @include example/hash.cpp
#ifdef BOOST_HANA_DOXYGEN_INVOKED
constexpr auto hash = [](auto const& x) {
return tag-dispatched;
};
#else
template <typename T, typename = void>
struct hash_impl : hash_impl<T, when<true>> { };
struct hash_t {
template <typename X>
constexpr auto operator()(X const& x) const;
};
constexpr hash_t hash{};
#endif
BOOST_HANA_NAMESPACE_END
#endif // !BOOST_HANA_FWD_HASH_HPP
|
{
"pile_set_name": "Github"
}
|
<woof>
<http-continuations>
<http-continuation path="/db" secure="false" x="87" y="172">
<section name="Logic" input="db"/>
</http-continuation>
<http-continuation path="/json" secure="false" x="84" y="123">
<section name="Logic" input="json"/>
</http-continuation>
<http-continuation path="/queries" secure="false" x="80" y="222">
<section name="Logic" input="queries"/>
</http-continuation>
<http-continuation path="/update" secure="false" x="80" y="275">
<section name="Logic" input="update"/>
</http-continuation>
</http-continuations>
<http-inputs>
</http-inputs>
<templates>
<template path="/fortunes" location="fortunes.html" class="net.officefloor.benchmark.FortunesLogic" content-type="text/html;charset=utf-8" charset="" secure="false" redirect-values-function="" link-separator-character="" x="276" y="44">
</template>
<template path="/plaintext" location="plaintext.html" class="" content-type="text/plain" charset="" secure="false" redirect-values-function="" link-separator-character="" x="64" y="46">
</template>
</templates>
<sections>
<section name="Logic" source="net.officefloor.plugin.section.clazz.ClassSectionSource" location="net.officefloor.benchmark.Logic" x="281" y="140">
<input name="db" parameter-type=""/>
<input name="getEntry" parameter-type="net.officefloor.benchmark.Logic$GetEntry"/>
<input name="json" parameter-type=""/>
<input name="queries" parameter-type=""/>
<input name="update" parameter-type=""/>
<input name="updateEntry" parameter-type="net.officefloor.benchmark.Logic$UpdateEntry"/>
</section>
</sections>
<securities>
</securities>
<governances>
</governances>
<resources>
</resources>
<exceptions>
</exceptions>
<starting>
</starting>
</woof>
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Entitas: Entitas/Entitas/Context/Exceptions/ContextStillHasRetainedEntitiesException.cs Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="docs-logo.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Entitas
 <span id="projectnumber">1.13.0</span>
</div>
<div id="projectbrief">Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('_context_still_has_retained_entities_exception_8cs_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">ContextStillHasRetainedEntitiesException.cs</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="keyword">using</span> System.Linq;</div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> </div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="keyword">namespace </span><a class="code" href="namespace_entitas.html">Entitas</a> {</div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> </div><div class="line"><a name="l00005"></a><span class="lineno"><a class="line" href="class_entitas_1_1_context_still_has_retained_entities_exception.html"> 5</a></span>  <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_entitas_1_1_context_still_has_retained_entities_exception.html">ContextStillHasRetainedEntitiesException</a> : <a class="code" href="class_entitas_1_1_entitas_exception.html">EntitasException</a> {</div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> </div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>  <span class="keyword">public</span> <a class="code" href="class_entitas_1_1_context_still_has_retained_entities_exception.html">ContextStillHasRetainedEntitiesException</a>(<a class="code" href="interface_entitas_1_1_i_context.html">IContext</a> context, <a class="code" href="interface_entitas_1_1_i_entity.html">IEntity</a>[] entities)</div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>  : base(<span class="stringliteral">"'"</span> + context + <span class="stringliteral">"' detected retained entities "</span> +</div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>  <span class="stringliteral">"although all entities got destroyed!"</span>,</div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>  <span class="stringliteral">"Did you release all entities? Try calling systems.DeactivateReactiveSystems()"</span> +</div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>  <span class="stringliteral">"before calling context.DestroyAllEntities() to avoid memory leaks."</span> +</div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>  <span class="stringliteral">"Do not forget to activate them back when needed.\n"</span> +</div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>  <span class="keywordtype">string</span>.Join(<span class="stringliteral">"\n"</span>, entities</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  .Select(e => {</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>  var safeAerc = e.aerc as <a class="code" href="class_entitas_1_1_safe_a_e_r_c.html">SafeAERC</a>;</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  <span class="keywordflow">if</span> (safeAerc != <span class="keyword">null</span>) {</div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  <span class="keywordflow">return</span> e + <span class="stringliteral">" - "</span> + <span class="keywordtype">string</span>.Join(<span class="stringliteral">", "</span>, safeAerc.owners</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  .Select(o => o.ToString())</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  .ToArray());</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  }</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> </div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="keywordflow">return</span> e.ToString();</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  })</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  .ToArray()</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  )</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  ) {</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  }</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  }</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> }</div><div class="ttc" id="interface_entitas_1_1_i_context_html"><div class="ttname"><a href="interface_entitas_1_1_i_context.html">Entitas.IContext</a></div><div class="ttdef"><b>Definition:</b> <a href="_i_context_8cs_source.html#l00008">IContext.cs:8</a></div></div>
<div class="ttc" id="namespace_entitas_html"><div class="ttname"><a href="namespace_entitas.html">Entitas</a></div><div class="ttdef"><b>Definition:</b> <a href="_collector_8cs_source.html#l00005">Collector.cs:5</a></div></div>
<div class="ttc" id="class_entitas_1_1_context_still_has_retained_entities_exception_html"><div class="ttname"><a href="class_entitas_1_1_context_still_has_retained_entities_exception.html">Entitas.ContextStillHasRetainedEntitiesException</a></div><div class="ttdef"><b>Definition:</b> <a href="_context_still_has_retained_entities_exception_8cs_source.html#l00005">ContextStillHasRetainedEntitiesException.cs:5</a></div></div>
<div class="ttc" id="interface_entitas_1_1_i_entity_html"><div class="ttname"><a href="interface_entitas_1_1_i_entity.html">Entitas.IEntity</a></div><div class="ttdef"><b>Definition:</b> <a href="_i_entity_8cs_source.html#l00016">IEntity.cs:16</a></div></div>
<div class="ttc" id="class_entitas_1_1_entitas_exception_html"><div class="ttname"><a href="class_entitas_1_1_entitas_exception.html">Entitas.EntitasException</a></div><div class="ttdoc">Base exception used by Entitas.</div><div class="ttdef"><b>Definition:</b> <a href="_entitas_exception_8cs_source.html#l00006">EntitasException.cs:6</a></div></div>
<div class="ttc" id="class_entitas_1_1_safe_a_e_r_c_html"><div class="ttname"><a href="class_entitas_1_1_safe_a_e_r_c.html">Entitas.SafeAERC</a></div><div class="ttdef"><b>Definition:</b> <a href="_safe_a_e_r_c_8cs_source.html#l00012">SafeAERC.cs:12</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_2445fa600638ca0377a838c43b60c5d0.html">Entitas</a></li><li class="navelem"><a class="el" href="dir_18d0583636d1f7adc70f46fa7dc6fd22.html">Entitas</a></li><li class="navelem"><a class="el" href="dir_55c21c1f668bdbeef61d727804a0de12.html">Context</a></li><li class="navelem"><a class="el" href="dir_c99a51b1778bc6979b97974e60b03bb4.html">Exceptions</a></li><li class="navelem"><b>ContextStillHasRetainedEntitiesException.cs</b></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
</ul>
</div>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
#!/usr/bin/env python
"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.common import Backend
from lib.core.common import Format
from lib.core.common import getCurrentThreadData
from lib.core.common import randomStr
from lib.core.common import wasLastResponseDBMSError
from lib.core.data import conf
from lib.core.data import kb
from lib.core.data import logger
from lib.core.enums import DBMS
from lib.core.session import setDbms
from lib.core.settings import ACCESS_ALIASES
from lib.core.settings import METADB_SUFFIX
from lib.request import inject
from plugins.generic.fingerprint import Fingerprint as GenericFingerprint
class Fingerprint(GenericFingerprint):
def __init__(self):
GenericFingerprint.__init__(self, DBMS.ACCESS)
def _sandBoxCheck(self):
# Reference: http://milw0rm.com/papers/198
retVal = None
table = None
if Backend.isVersionWithin(("97", "2000")):
table = "MSysAccessObjects"
elif Backend.isVersionWithin(("2002-2003", "2007")):
table = "MSysAccessStorage"
if table is not None:
result = inject.checkBooleanExpression("EXISTS(SELECT CURDIR() FROM %s)" % table)
retVal = "not sandboxed" if result else "sandboxed"
return retVal
def _sysTablesCheck(self):
infoMsg = "executing system table(s) existence fingerprint"
logger.info(infoMsg)
# Microsoft Access table reference updated on 01/2010
sysTables = {
"97": ("MSysModules2", "MSysAccessObjects"),
"2000" : ("!MSysModules2", "MSysAccessObjects"),
"2002-2003" : ("MSysAccessStorage", "!MSysNavPaneObjectIDs"),
"2007" : ("MSysAccessStorage", "MSysNavPaneObjectIDs"),
}
# MSysAccessXML is not a reliable system table because it doesn't always exist
# ("Access through Access", p6, should be "normally doesn't exist" instead of "is normally empty")
for version, tables in sysTables.items():
exist = True
for table in tables:
negate = False
if table[0] == '!':
negate = True
table = table[1:]
result = inject.checkBooleanExpression("EXISTS(SELECT * FROM %s WHERE [RANDNUM]=[RANDNUM])" % table)
if result is None:
result = False
if negate:
result = not result
exist &= result
if not exist:
break
if exist:
return version
return None
def _getDatabaseDir(self):
retVal = None
infoMsg = "searching for database directory"
logger.info(infoMsg)
randStr = randomStr()
inject.checkBooleanExpression("EXISTS(SELECT * FROM %s.%s WHERE [RANDNUM]=[RANDNUM])" % (randStr, randStr))
if wasLastResponseDBMSError():
threadData = getCurrentThreadData()
match = re.search("Could not find file\s+'([^']+?)'", threadData.lastErrorPage[1])
if match:
retVal = match.group(1).rstrip("%s.mdb" % randStr)
if retVal.endswith('\\'):
retVal = retVal[:-1]
return retVal
def getFingerprint(self):
value = ""
wsOsFp = Format.getOs("web server", kb.headersFp)
if wsOsFp:
value += "%s\n" % wsOsFp
if kb.data.banner:
dbmsOsFp = Format.getOs("back-end DBMS", kb.bannerFp)
if dbmsOsFp:
value += "%s\n" % dbmsOsFp
value += "back-end DBMS: "
if not conf.extensiveFp:
value += DBMS.ACCESS
return value
actVer = Format.getDbms() + " (%s)" % (self._sandBoxCheck())
blank = " " * 15
value += "active fingerprint: %s" % actVer
if kb.bannerFp:
banVer = kb.bannerFp["dbmsVersion"]
if re.search("-log$", kb.data.banner):
banVer += ", logging enabled"
banVer = Format.getDbms([banVer])
value += "\n%sbanner parsing fingerprint: %s" % (blank, banVer)
htmlErrorFp = Format.getErrorParsedDBMSes()
if htmlErrorFp:
value += "\n%shtml error message fingerprint: %s" % (blank, htmlErrorFp)
value += "\ndatabase directory: '%s'" % self._getDatabaseDir()
return value
def checkDbms(self):
if not conf.extensiveFp and (Backend.isDbmsWithin(ACCESS_ALIASES) or (conf.dbms or "").lower() in ACCESS_ALIASES):
setDbms(DBMS.ACCESS)
return True
infoMsg = "testing %s" % DBMS.ACCESS
logger.info(infoMsg)
result = inject.checkBooleanExpression("VAL(CVAR(1))=1")
if result:
infoMsg = "confirming %s" % DBMS.ACCESS
logger.info(infoMsg)
result = inject.checkBooleanExpression("IIF(ATN(2)>0,1,0) BETWEEN 2 AND 0")
if not result:
warnMsg = "the back-end DBMS is not %s" % DBMS.ACCESS
logger.warn(warnMsg)
return False
setDbms(DBMS.ACCESS)
if not conf.extensiveFp:
return True
infoMsg = "actively fingerprinting %s" % DBMS.ACCESS
logger.info(infoMsg)
version = self._sysTablesCheck()
if version is not None:
Backend.setVersion(version)
return True
else:
warnMsg = "the back-end DBMS is not %s" % DBMS.ACCESS
logger.warn(warnMsg)
return False
def forceDbmsEnum(self):
conf.db = ("%s%s" % (DBMS.ACCESS, METADB_SUFFIX)).replace(' ', '_')
|
{
"pile_set_name": "Github"
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace NavigationExample
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used such as when the application is launched to open a specific file.
/// </summary>
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
#if DEBUG
if (System.Diagnostics.Debugger.IsAttached)
{
this.DebugSettings.EnableFrameRateCounter = true;
}
#endif
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
/// <param name="sender">The Frame which failed navigation</param>
/// <param name="e">Details about the navigation failure</param>
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* 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.
*
* Copyright (C) 2010 John Crispin <blogic@openwrt.org>
*/
#ifndef _LTQ_XWAY_H__
#define _LTQ_XWAY_H__
#ifdef CONFIG_SOC_TYPE_XWAY
#include <lantiq.h>
/* Chip IDs */
#define SOC_ID_DANUBE1 0x129
#define SOC_ID_DANUBE2 0x12B
#define SOC_ID_TWINPASS 0x12D
#define SOC_ID_AMAZON_SE 0x152
#define SOC_ID_ARX188 0x16C
#define SOC_ID_ARX168 0x16D
#define SOC_ID_ARX182 0x16F
/* SoC Types */
#define SOC_TYPE_DANUBE 0x01
#define SOC_TYPE_TWINPASS 0x02
#define SOC_TYPE_AR9 0x03
#define SOC_TYPE_VR9 0x04
#define SOC_TYPE_AMAZON_SE 0x05
/* ASC0/1 - serial port */
#define LTQ_ASC0_BASE_ADDR 0x1E100400
#define LTQ_ASC1_BASE_ADDR 0x1E100C00
#define LTQ_ASC_SIZE 0x400
/* RCU - reset control unit */
#define LTQ_RCU_BASE_ADDR 0x1F203000
#define LTQ_RCU_SIZE 0x1000
/* GPTU - general purpose timer unit */
#define LTQ_GPTU_BASE_ADDR 0x18000300
#define LTQ_GPTU_SIZE 0x100
/* EBU - external bus unit */
#define LTQ_EBU_GPIO_START 0x14000000
#define LTQ_EBU_GPIO_SIZE 0x1000
#define LTQ_EBU_BASE_ADDR 0x1E105300
#define LTQ_EBU_SIZE 0x100
#define LTQ_EBU_BUSCON0 0x0060
#define LTQ_EBU_PCC_CON 0x0090
#define LTQ_EBU_PCC_IEN 0x00A4
#define LTQ_EBU_PCC_ISTAT 0x00A0
#define LTQ_EBU_BUSCON1 0x0064
#define LTQ_EBU_ADDRSEL1 0x0024
#define EBU_WRDIS 0x80000000
/* CGU - clock generation unit */
#define LTQ_CGU_BASE_ADDR 0x1F103000
#define LTQ_CGU_SIZE 0x1000
/* ICU - interrupt control unit */
#define LTQ_ICU_BASE_ADDR 0x1F880200
#define LTQ_ICU_SIZE 0x100
/* EIU - external interrupt unit */
#define LTQ_EIU_BASE_ADDR 0x1F101000
#define LTQ_EIU_SIZE 0x1000
/* PMU - power management unit */
#define LTQ_PMU_BASE_ADDR 0x1F102000
#define LTQ_PMU_SIZE 0x1000
#define PMU_DMA 0x0020
#define PMU_USB 0x8041
#define PMU_LED 0x0800
#define PMU_GPT 0x1000
#define PMU_PPE 0x2000
#define PMU_FPI 0x4000
#define PMU_SWITCH 0x10000000
/* ETOP - ethernet */
#define LTQ_ETOP_BASE_ADDR 0x1E180000
#define LTQ_ETOP_SIZE 0x40000
/* DMA */
#define LTQ_DMA_BASE_ADDR 0x1E104100
#define LTQ_DMA_SIZE 0x800
/* PCI */
#define PCI_CR_BASE_ADDR 0x1E105400
#define PCI_CR_SIZE 0x400
/* WDT */
#define LTQ_WDT_BASE_ADDR 0x1F8803F0
#define LTQ_WDT_SIZE 0x10
/* STP - serial to parallel conversion unit */
#define LTQ_STP_BASE_ADDR 0x1E100BB0
#define LTQ_STP_SIZE 0x40
/* GPIO */
#define LTQ_GPIO0_BASE_ADDR 0x1E100B10
#define LTQ_GPIO1_BASE_ADDR 0x1E100B40
#define LTQ_GPIO2_BASE_ADDR 0x1E100B70
#define LTQ_GPIO_SIZE 0x30
/* SSC */
#define LTQ_SSC_BASE_ADDR 0x1e100800
#define LTQ_SSC_SIZE 0x100
/* MEI - dsl core */
#define LTQ_MEI_BASE_ADDR 0x1E116000
/* DEU - data encryption unit */
#define LTQ_DEU_BASE_ADDR 0x1E103100
/* MPS - multi processor unit (voice) */
#define LTQ_MPS_BASE_ADDR (KSEG1 + 0x1F107000)
#define LTQ_MPS_CHIPID ((u32 *)(LTQ_MPS_BASE_ADDR + 0x0344))
/* request a non-gpio and set the PIO config */
extern int ltq_gpio_request(unsigned int pin, unsigned int alt0,
unsigned int alt1, unsigned int dir, const char *name);
extern void ltq_pmu_enable(unsigned int module);
extern void ltq_pmu_disable(unsigned int module);
static inline int ltq_is_ar9(void)
{
return (ltq_get_soc_type() == SOC_TYPE_AR9);
}
static inline int ltq_is_vr9(void)
{
return (ltq_get_soc_type() == SOC_TYPE_VR9);
}
#endif /* CONFIG_SOC_TYPE_XWAY */
#endif /* _LTQ_XWAY_H__ */
|
{
"pile_set_name": "Github"
}
|
//
// VLCStyledVideoView.h
// Lunettes
//
// Created by Pierre d'Herbemont on 2/9/10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import <WebKit/WebKit.h>
#import <VLCKit/VLCKit.h>
#import "VLCStyledView.h"
@interface VLCStyledVideoView : VLCStyledView {
NSUInteger _listCount;
NSUInteger _sublistCount;
NSString *_listCountString;
NSString *_title;
VLCMediaPlayerState _mediaPlayerState;
BOOL _viewedPlaying;
BOOL _seekable;
BOOL _showPlaylist;
}
@property (copy) NSString *windowTitle;
@property (copy) NSString *listCountString;
@property BOOL viewedPlaying;
@property BOOL seekable;
@property NSUInteger listCount;
@property NSUInteger sublistCount;
@property BOOL showPlaylist;
@property VLCMediaPlayerState mediaPlayerState;
- (VLCMediaPlayer *)mediaPlayer;
- (VLCMediaListPlayer *)mediaListPlayer;
@end
|
{
"pile_set_name": "Github"
}
|
;******************************************************************************
;* VP8 MMXEXT optimizations
;* Copyright (c) 2010 Ronald S. Bultje <rsbultje@gmail.com>
;* Copyright (c) 2010 Fiona Glaser <fiona@x264.com>
;*
;* This file is part of FFmpeg.
;*
;* FFmpeg 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.
;*
;* FFmpeg 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 FFmpeg; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "libavutil/x86/x86util.asm"
SECTION_RODATA
fourtap_filter_hw_m: times 4 dw -6, 123
times 4 dw 12, -1
times 4 dw -9, 93
times 4 dw 50, -6
times 4 dw -6, 50
times 4 dw 93, -9
times 4 dw -1, 12
times 4 dw 123, -6
sixtap_filter_hw_m: times 4 dw 2, -11
times 4 dw 108, 36
times 4 dw -8, 1
times 4 dw 3, -16
times 4 dw 77, 77
times 4 dw -16, 3
times 4 dw 1, -8
times 4 dw 36, 108
times 4 dw -11, 2
fourtap_filter_hb_m: times 8 db -6, 123
times 8 db 12, -1
times 8 db -9, 93
times 8 db 50, -6
times 8 db -6, 50
times 8 db 93, -9
times 8 db -1, 12
times 8 db 123, -6
sixtap_filter_hb_m: times 8 db 2, 1
times 8 db -11, 108
times 8 db 36, -8
times 8 db 3, 3
times 8 db -16, 77
times 8 db 77, -16
times 8 db 1, 2
times 8 db -8, 36
times 8 db 108, -11
fourtap_filter_v_m: times 8 dw -6
times 8 dw 123
times 8 dw 12
times 8 dw -1
times 8 dw -9
times 8 dw 93
times 8 dw 50
times 8 dw -6
times 8 dw -6
times 8 dw 50
times 8 dw 93
times 8 dw -9
times 8 dw -1
times 8 dw 12
times 8 dw 123
times 8 dw -6
sixtap_filter_v_m: times 8 dw 2
times 8 dw -11
times 8 dw 108
times 8 dw 36
times 8 dw -8
times 8 dw 1
times 8 dw 3
times 8 dw -16
times 8 dw 77
times 8 dw 77
times 8 dw -16
times 8 dw 3
times 8 dw 1
times 8 dw -8
times 8 dw 36
times 8 dw 108
times 8 dw -11
times 8 dw 2
bilinear_filter_vw_m: times 8 dw 1
times 8 dw 2
times 8 dw 3
times 8 dw 4
times 8 dw 5
times 8 dw 6
times 8 dw 7
bilinear_filter_vb_m: times 8 db 7, 1
times 8 db 6, 2
times 8 db 5, 3
times 8 db 4, 4
times 8 db 3, 5
times 8 db 2, 6
times 8 db 1, 7
%ifdef PIC
%define fourtap_filter_hw picregq
%define sixtap_filter_hw picregq
%define fourtap_filter_hb picregq
%define sixtap_filter_hb picregq
%define fourtap_filter_v picregq
%define sixtap_filter_v picregq
%define bilinear_filter_vw picregq
%define bilinear_filter_vb picregq
%define npicregs 1
%else
%define fourtap_filter_hw fourtap_filter_hw_m
%define sixtap_filter_hw sixtap_filter_hw_m
%define fourtap_filter_hb fourtap_filter_hb_m
%define sixtap_filter_hb sixtap_filter_hb_m
%define fourtap_filter_v fourtap_filter_v_m
%define sixtap_filter_v sixtap_filter_v_m
%define bilinear_filter_vw bilinear_filter_vw_m
%define bilinear_filter_vb bilinear_filter_vb_m
%define npicregs 0
%endif
filter_h2_shuf: db 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8
filter_h4_shuf: db 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10
filter_h6_shuf1: db 0, 5, 1, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 7, 12
filter_h6_shuf2: db 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9
filter_h6_shuf3: db 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11
pw_20091: times 4 dw 20091
pw_17734: times 4 dw 17734
cextern pw_3
cextern pw_4
cextern pw_64
cextern pw_256
SECTION .text
;-------------------------------------------------------------------------------
; subpel MC functions:
;
; void ff_put_vp8_epel<size>_h<htap>v<vtap>_<opt>(uint8_t *dst, ptrdiff_t deststride,
; uint8_t *src, ptrdiff_t srcstride,
; int height, int mx, int my);
;-------------------------------------------------------------------------------
%macro FILTER_SSSE3 1
cglobal put_vp8_epel%1_h6, 6, 6 + npicregs, 8, dst, dststride, src, srcstride, height, mx, picreg
lea mxd, [mxq*3]
mova m3, [filter_h6_shuf2]
mova m4, [filter_h6_shuf3]
%ifdef PIC
lea picregq, [sixtap_filter_hb_m]
%endif
mova m5, [sixtap_filter_hb+mxq*8-48] ; set up 6tap filter in bytes
mova m6, [sixtap_filter_hb+mxq*8-32]
mova m7, [sixtap_filter_hb+mxq*8-16]
.nextrow:
movu m0, [srcq-2]
mova m1, m0
mova m2, m0
%if mmsize == 8
; For epel4, we need 9 bytes, but only 8 get loaded; to compensate, do the
; shuffle with a memory operand
punpcklbw m0, [srcq+3]
%else
pshufb m0, [filter_h6_shuf1]
%endif
pshufb m1, m3
pshufb m2, m4
pmaddubsw m0, m5
pmaddubsw m1, m6
pmaddubsw m2, m7
paddsw m0, m1
paddsw m0, m2
pmulhrsw m0, [pw_256]
packuswb m0, m0
movh [dstq], m0 ; store
; go to next line
add dstq, dststrideq
add srcq, srcstrideq
dec heightd ; next row
jg .nextrow
REP_RET
cglobal put_vp8_epel%1_h4, 6, 6 + npicregs, 7, dst, dststride, src, srcstride, height, mx, picreg
shl mxd, 4
mova m2, [pw_256]
mova m3, [filter_h2_shuf]
mova m4, [filter_h4_shuf]
%ifdef PIC
lea picregq, [fourtap_filter_hb_m]
%endif
mova m5, [fourtap_filter_hb+mxq-16] ; set up 4tap filter in bytes
mova m6, [fourtap_filter_hb+mxq]
.nextrow:
movu m0, [srcq-1]
mova m1, m0
pshufb m0, m3
pshufb m1, m4
pmaddubsw m0, m5
pmaddubsw m1, m6
paddsw m0, m1
pmulhrsw m0, m2
packuswb m0, m0
movh [dstq], m0 ; store
; go to next line
add dstq, dststrideq
add srcq, srcstrideq
dec heightd ; next row
jg .nextrow
REP_RET
cglobal put_vp8_epel%1_v4, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my
shl myd, 4
%ifdef PIC
lea picregq, [fourtap_filter_hb_m]
%endif
mova m5, [fourtap_filter_hb+myq-16]
mova m6, [fourtap_filter_hb+myq]
mova m7, [pw_256]
; read 3 lines
sub srcq, srcstrideq
movh m0, [srcq]
movh m1, [srcq+ srcstrideq]
movh m2, [srcq+2*srcstrideq]
add srcq, srcstrideq
.nextrow:
movh m3, [srcq+2*srcstrideq] ; read new row
mova m4, m0
mova m0, m1
punpcklbw m4, m1
mova m1, m2
punpcklbw m2, m3
pmaddubsw m4, m5
pmaddubsw m2, m6
paddsw m4, m2
mova m2, m3
pmulhrsw m4, m7
packuswb m4, m4
movh [dstq], m4
; go to next line
add dstq, dststrideq
add srcq, srcstrideq
dec heightd ; next row
jg .nextrow
REP_RET
cglobal put_vp8_epel%1_v6, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my
lea myd, [myq*3]
%ifdef PIC
lea picregq, [sixtap_filter_hb_m]
%endif
lea myq, [sixtap_filter_hb+myq*8]
; read 5 lines
sub srcq, srcstrideq
sub srcq, srcstrideq
movh m0, [srcq]
movh m1, [srcq+srcstrideq]
movh m2, [srcq+srcstrideq*2]
lea srcq, [srcq+srcstrideq*2]
add srcq, srcstrideq
movh m3, [srcq]
movh m4, [srcq+srcstrideq]
.nextrow:
movh m5, [srcq+2*srcstrideq] ; read new row
mova m6, m0
punpcklbw m6, m5
mova m0, m1
punpcklbw m1, m2
mova m7, m3
punpcklbw m7, m4
pmaddubsw m6, [myq-48]
pmaddubsw m1, [myq-32]
pmaddubsw m7, [myq-16]
paddsw m6, m1
paddsw m6, m7
mova m1, m2
mova m2, m3
pmulhrsw m6, [pw_256]
mova m3, m4
packuswb m6, m6
mova m4, m5
movh [dstq], m6
; go to next line
add dstq, dststrideq
add srcq, srcstrideq
dec heightd ; next row
jg .nextrow
REP_RET
%endmacro
INIT_MMX ssse3
FILTER_SSSE3 4
INIT_XMM ssse3
FILTER_SSSE3 8
; 4x4 block, H-only 4-tap filter
INIT_MMX mmxext
cglobal put_vp8_epel4_h4, 6, 6 + npicregs, 0, dst, dststride, src, srcstride, height, mx, picreg
shl mxd, 4
%ifdef PIC
lea picregq, [fourtap_filter_hw_m]
%endif
movq mm4, [fourtap_filter_hw+mxq-16] ; set up 4tap filter in words
movq mm5, [fourtap_filter_hw+mxq]
movq mm7, [pw_64]
pxor mm6, mm6
.nextrow:
movq mm1, [srcq-1] ; (ABCDEFGH) load 8 horizontal pixels
; first set of 2 pixels
movq mm2, mm1 ; byte ABCD..
punpcklbw mm1, mm6 ; byte->word ABCD
pshufw mm0, mm2, 9 ; byte CDEF..
punpcklbw mm0, mm6 ; byte->word CDEF
pshufw mm3, mm1, 0x94 ; word ABBC
pshufw mm1, mm0, 0x94 ; word CDDE
pmaddwd mm3, mm4 ; multiply 2px with F0/F1
movq mm0, mm1 ; backup for second set of pixels
pmaddwd mm1, mm5 ; multiply 2px with F2/F3
paddd mm3, mm1 ; finish 1st 2px
; second set of 2 pixels, use backup of above
punpckhbw mm2, mm6 ; byte->word EFGH
pmaddwd mm0, mm4 ; multiply backed up 2px with F0/F1
pshufw mm1, mm2, 0x94 ; word EFFG
pmaddwd mm1, mm5 ; multiply 2px with F2/F3
paddd mm0, mm1 ; finish 2nd 2px
; merge two sets of 2 pixels into one set of 4, round/clip/store
packssdw mm3, mm0 ; merge dword->word (4px)
paddsw mm3, mm7 ; rounding
psraw mm3, 7
packuswb mm3, mm6 ; clip and word->bytes
movd [dstq], mm3 ; store
; go to next line
add dstq, dststrideq
add srcq, srcstrideq
dec heightd ; next row
jg .nextrow
REP_RET
; 4x4 block, H-only 6-tap filter
INIT_MMX mmxext
cglobal put_vp8_epel4_h6, 6, 6 + npicregs, 0, dst, dststride, src, srcstride, height, mx, picreg
lea mxd, [mxq*3]
%ifdef PIC
lea picregq, [sixtap_filter_hw_m]
%endif
movq mm4, [sixtap_filter_hw+mxq*8-48] ; set up 4tap filter in words
movq mm5, [sixtap_filter_hw+mxq*8-32]
movq mm6, [sixtap_filter_hw+mxq*8-16]
movq mm7, [pw_64]
pxor mm3, mm3
.nextrow:
movq mm1, [srcq-2] ; (ABCDEFGH) load 8 horizontal pixels
; first set of 2 pixels
movq mm2, mm1 ; byte ABCD..
punpcklbw mm1, mm3 ; byte->word ABCD
pshufw mm0, mm2, 0x9 ; byte CDEF..
punpckhbw mm2, mm3 ; byte->word EFGH
punpcklbw mm0, mm3 ; byte->word CDEF
pshufw mm1, mm1, 0x94 ; word ABBC
pshufw mm2, mm2, 0x94 ; word EFFG
pmaddwd mm1, mm4 ; multiply 2px with F0/F1
pshufw mm3, mm0, 0x94 ; word CDDE
movq mm0, mm3 ; backup for second set of pixels
pmaddwd mm3, mm5 ; multiply 2px with F2/F3
paddd mm1, mm3 ; add to 1st 2px cache
movq mm3, mm2 ; backup for second set of pixels
pmaddwd mm2, mm6 ; multiply 2px with F4/F5
paddd mm1, mm2 ; finish 1st 2px
; second set of 2 pixels, use backup of above
movd mm2, [srcq+3] ; byte FGHI (prevent overreads)
pmaddwd mm0, mm4 ; multiply 1st backed up 2px with F0/F1
pmaddwd mm3, mm5 ; multiply 2nd backed up 2px with F2/F3
paddd mm0, mm3 ; add to 2nd 2px cache
pxor mm3, mm3
punpcklbw mm2, mm3 ; byte->word FGHI
pshufw mm2, mm2, 0xE9 ; word GHHI
pmaddwd mm2, mm6 ; multiply 2px with F4/F5
paddd mm0, mm2 ; finish 2nd 2px
; merge two sets of 2 pixels into one set of 4, round/clip/store
packssdw mm1, mm0 ; merge dword->word (4px)
paddsw mm1, mm7 ; rounding
psraw mm1, 7
packuswb mm1, mm3 ; clip and word->bytes
movd [dstq], mm1 ; store
; go to next line
add dstq, dststrideq
add srcq, srcstrideq
dec heightd ; next row
jg .nextrow
REP_RET
INIT_XMM sse2
cglobal put_vp8_epel8_h4, 6, 6 + npicregs, 10, dst, dststride, src, srcstride, height, mx, picreg
shl mxd, 5
%ifdef PIC
lea picregq, [fourtap_filter_v_m]
%endif
lea mxq, [fourtap_filter_v+mxq-32]
pxor m7, m7
mova m4, [pw_64]
mova m5, [mxq+ 0]
mova m6, [mxq+16]
%ifdef m8
mova m8, [mxq+32]
mova m9, [mxq+48]
%endif
.nextrow:
movq m0, [srcq-1]
movq m1, [srcq-0]
movq m2, [srcq+1]
movq m3, [srcq+2]
punpcklbw m0, m7
punpcklbw m1, m7
punpcklbw m2, m7
punpcklbw m3, m7
pmullw m0, m5
pmullw m1, m6
%ifdef m8
pmullw m2, m8
pmullw m3, m9
%else
pmullw m2, [mxq+32]
pmullw m3, [mxq+48]
%endif
paddsw m0, m1
paddsw m2, m3
paddsw m0, m2
paddsw m0, m4
psraw m0, 7
packuswb m0, m7
movh [dstq], m0 ; store
; go to next line
add dstq, dststrideq
add srcq, srcstrideq
dec heightd ; next row
jg .nextrow
REP_RET
INIT_XMM sse2
cglobal put_vp8_epel8_h6, 6, 6 + npicregs, 14, dst, dststride, src, srcstride, height, mx, picreg
lea mxd, [mxq*3]
shl mxd, 4
%ifdef PIC
lea picregq, [sixtap_filter_v_m]
%endif
lea mxq, [sixtap_filter_v+mxq-96]
pxor m7, m7
mova m6, [pw_64]
%ifdef m8
mova m8, [mxq+ 0]
mova m9, [mxq+16]
mova m10, [mxq+32]
mova m11, [mxq+48]
mova m12, [mxq+64]
mova m13, [mxq+80]
%endif
.nextrow:
movq m0, [srcq-2]
movq m1, [srcq-1]
movq m2, [srcq-0]
movq m3, [srcq+1]
movq m4, [srcq+2]
movq m5, [srcq+3]
punpcklbw m0, m7
punpcklbw m1, m7
punpcklbw m2, m7
punpcklbw m3, m7
punpcklbw m4, m7
punpcklbw m5, m7
%ifdef m8
pmullw m0, m8
pmullw m1, m9
pmullw m2, m10
pmullw m3, m11
pmullw m4, m12
pmullw m5, m13
%else
pmullw m0, [mxq+ 0]
pmullw m1, [mxq+16]
pmullw m2, [mxq+32]
pmullw m3, [mxq+48]
pmullw m4, [mxq+64]
pmullw m5, [mxq+80]
%endif
paddsw m1, m4
paddsw m0, m5
paddsw m1, m2
paddsw m0, m3
paddsw m0, m1
paddsw m0, m6
psraw m0, 7
packuswb m0, m7
movh [dstq], m0 ; store
; go to next line
add dstq, dststrideq
add srcq, srcstrideq
dec heightd ; next row
jg .nextrow
REP_RET
%macro FILTER_V 1
; 4x4 block, V-only 4-tap filter
cglobal put_vp8_epel%1_v4, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my
shl myd, 5
%ifdef PIC
lea picregq, [fourtap_filter_v_m]
%endif
lea myq, [fourtap_filter_v+myq-32]
mova m6, [pw_64]
pxor m7, m7
mova m5, [myq+48]
; read 3 lines
sub srcq, srcstrideq
movh m0, [srcq]
movh m1, [srcq+ srcstrideq]
movh m2, [srcq+2*srcstrideq]
add srcq, srcstrideq
punpcklbw m0, m7
punpcklbw m1, m7
punpcklbw m2, m7
.nextrow:
; first calculate negative taps (to prevent losing positive overflows)
movh m4, [srcq+2*srcstrideq] ; read new row
punpcklbw m4, m7
mova m3, m4
pmullw m0, [myq+0]
pmullw m4, m5
paddsw m4, m0
; then calculate positive taps
mova m0, m1
pmullw m1, [myq+16]
paddsw m4, m1
mova m1, m2
pmullw m2, [myq+32]
paddsw m4, m2
mova m2, m3
; round/clip/store
paddsw m4, m6
psraw m4, 7
packuswb m4, m7
movh [dstq], m4
; go to next line
add dstq, dststrideq
add srcq, srcstrideq
dec heightd ; next row
jg .nextrow
REP_RET
; 4x4 block, V-only 6-tap filter
cglobal put_vp8_epel%1_v6, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my
shl myd, 4
lea myq, [myq*3]
%ifdef PIC
lea picregq, [sixtap_filter_v_m]
%endif
lea myq, [sixtap_filter_v+myq-96]
pxor m7, m7
; read 5 lines
sub srcq, srcstrideq
sub srcq, srcstrideq
movh m0, [srcq]
movh m1, [srcq+srcstrideq]
movh m2, [srcq+srcstrideq*2]
lea srcq, [srcq+srcstrideq*2]
add srcq, srcstrideq
movh m3, [srcq]
movh m4, [srcq+srcstrideq]
punpcklbw m0, m7
punpcklbw m1, m7
punpcklbw m2, m7
punpcklbw m3, m7
punpcklbw m4, m7
.nextrow:
; first calculate negative taps (to prevent losing positive overflows)
mova m5, m1
pmullw m5, [myq+16]
mova m6, m4
pmullw m6, [myq+64]
paddsw m6, m5
; then calculate positive taps
movh m5, [srcq+2*srcstrideq] ; read new row
punpcklbw m5, m7
pmullw m0, [myq+0]
paddsw m6, m0
mova m0, m1
mova m1, m2
pmullw m2, [myq+32]
paddsw m6, m2
mova m2, m3
pmullw m3, [myq+48]
paddsw m6, m3
mova m3, m4
mova m4, m5
pmullw m5, [myq+80]
paddsw m6, m5
; round/clip/store
paddsw m6, [pw_64]
psraw m6, 7
packuswb m6, m7
movh [dstq], m6
; go to next line
add dstq, dststrideq
add srcq, srcstrideq
dec heightd ; next row
jg .nextrow
REP_RET
%endmacro
INIT_MMX mmxext
FILTER_V 4
INIT_XMM sse2
FILTER_V 8
%macro FILTER_BILINEAR 1
%if cpuflag(ssse3)
cglobal put_vp8_bilinear%1_v, 7, 7, 5, dst, dststride, src, srcstride, height, picreg, my
shl myd, 4
%ifdef PIC
lea picregq, [bilinear_filter_vb_m]
%endif
pxor m4, m4
mova m3, [bilinear_filter_vb+myq-16]
.nextrow:
movh m0, [srcq+srcstrideq*0]
movh m1, [srcq+srcstrideq*1]
movh m2, [srcq+srcstrideq*2]
punpcklbw m0, m1
punpcklbw m1, m2
pmaddubsw m0, m3
pmaddubsw m1, m3
psraw m0, 2
psraw m1, 2
pavgw m0, m4
pavgw m1, m4
%if mmsize==8
packuswb m0, m0
packuswb m1, m1
movh [dstq+dststrideq*0], m0
movh [dstq+dststrideq*1], m1
%else
packuswb m0, m1
movh [dstq+dststrideq*0], m0
movhps [dstq+dststrideq*1], m0
%endif
%else ; cpuflag(ssse3)
cglobal put_vp8_bilinear%1_v, 7, 7, 7, dst, dststride, src, srcstride, height, picreg, my
shl myd, 4
%ifdef PIC
lea picregq, [bilinear_filter_vw_m]
%endif
pxor m6, m6
mova m5, [bilinear_filter_vw+myq-1*16]
neg myq
mova m4, [bilinear_filter_vw+myq+7*16]
.nextrow:
movh m0, [srcq+srcstrideq*0]
movh m1, [srcq+srcstrideq*1]
movh m3, [srcq+srcstrideq*2]
punpcklbw m0, m6
punpcklbw m1, m6
punpcklbw m3, m6
mova m2, m1
pmullw m0, m4
pmullw m1, m5
pmullw m2, m4
pmullw m3, m5
paddsw m0, m1
paddsw m2, m3
psraw m0, 2
psraw m2, 2
pavgw m0, m6
pavgw m2, m6
%if mmsize == 8
packuswb m0, m0
packuswb m2, m2
movh [dstq+dststrideq*0], m0
movh [dstq+dststrideq*1], m2
%else
packuswb m0, m2
movh [dstq+dststrideq*0], m0
movhps [dstq+dststrideq*1], m0
%endif
%endif ; cpuflag(ssse3)
lea dstq, [dstq+dststrideq*2]
lea srcq, [srcq+srcstrideq*2]
sub heightd, 2
jg .nextrow
REP_RET
%if cpuflag(ssse3)
cglobal put_vp8_bilinear%1_h, 6, 6 + npicregs, 5, dst, dststride, src, srcstride, height, mx, picreg
shl mxd, 4
%ifdef PIC
lea picregq, [bilinear_filter_vb_m]
%endif
pxor m4, m4
mova m2, [filter_h2_shuf]
mova m3, [bilinear_filter_vb+mxq-16]
.nextrow:
movu m0, [srcq+srcstrideq*0]
movu m1, [srcq+srcstrideq*1]
pshufb m0, m2
pshufb m1, m2
pmaddubsw m0, m3
pmaddubsw m1, m3
psraw m0, 2
psraw m1, 2
pavgw m0, m4
pavgw m1, m4
%if mmsize==8
packuswb m0, m0
packuswb m1, m1
movh [dstq+dststrideq*0], m0
movh [dstq+dststrideq*1], m1
%else
packuswb m0, m1
movh [dstq+dststrideq*0], m0
movhps [dstq+dststrideq*1], m0
%endif
%else ; cpuflag(ssse3)
cglobal put_vp8_bilinear%1_h, 6, 6 + npicregs, 7, dst, dststride, src, srcstride, height, mx, picreg
shl mxd, 4
%ifdef PIC
lea picregq, [bilinear_filter_vw_m]
%endif
pxor m6, m6
mova m5, [bilinear_filter_vw+mxq-1*16]
neg mxq
mova m4, [bilinear_filter_vw+mxq+7*16]
.nextrow:
movh m0, [srcq+srcstrideq*0+0]
movh m1, [srcq+srcstrideq*0+1]
movh m2, [srcq+srcstrideq*1+0]
movh m3, [srcq+srcstrideq*1+1]
punpcklbw m0, m6
punpcklbw m1, m6
punpcklbw m2, m6
punpcklbw m3, m6
pmullw m0, m4
pmullw m1, m5
pmullw m2, m4
pmullw m3, m5
paddsw m0, m1
paddsw m2, m3
psraw m0, 2
psraw m2, 2
pavgw m0, m6
pavgw m2, m6
%if mmsize == 8
packuswb m0, m0
packuswb m2, m2
movh [dstq+dststrideq*0], m0
movh [dstq+dststrideq*1], m2
%else
packuswb m0, m2
movh [dstq+dststrideq*0], m0
movhps [dstq+dststrideq*1], m0
%endif
%endif ; cpuflag(ssse3)
lea dstq, [dstq+dststrideq*2]
lea srcq, [srcq+srcstrideq*2]
sub heightd, 2
jg .nextrow
REP_RET
%endmacro
INIT_MMX mmxext
FILTER_BILINEAR 4
INIT_XMM sse2
FILTER_BILINEAR 8
INIT_MMX ssse3
FILTER_BILINEAR 4
INIT_XMM ssse3
FILTER_BILINEAR 8
INIT_MMX mmx
cglobal put_vp8_pixels8, 5, 5, 0, dst, dststride, src, srcstride, height
.nextrow:
movq mm0, [srcq+srcstrideq*0]
movq mm1, [srcq+srcstrideq*1]
lea srcq, [srcq+srcstrideq*2]
movq [dstq+dststrideq*0], mm0
movq [dstq+dststrideq*1], mm1
lea dstq, [dstq+dststrideq*2]
sub heightd, 2
jg .nextrow
REP_RET
%if ARCH_X86_32
INIT_MMX mmx
cglobal put_vp8_pixels16, 5, 5, 0, dst, dststride, src, srcstride, height
.nextrow:
movq mm0, [srcq+srcstrideq*0+0]
movq mm1, [srcq+srcstrideq*0+8]
movq mm2, [srcq+srcstrideq*1+0]
movq mm3, [srcq+srcstrideq*1+8]
lea srcq, [srcq+srcstrideq*2]
movq [dstq+dststrideq*0+0], mm0
movq [dstq+dststrideq*0+8], mm1
movq [dstq+dststrideq*1+0], mm2
movq [dstq+dststrideq*1+8], mm3
lea dstq, [dstq+dststrideq*2]
sub heightd, 2
jg .nextrow
REP_RET
%endif
INIT_XMM sse
cglobal put_vp8_pixels16, 5, 5, 2, dst, dststride, src, srcstride, height
.nextrow:
movups xmm0, [srcq+srcstrideq*0]
movups xmm1, [srcq+srcstrideq*1]
lea srcq, [srcq+srcstrideq*2]
movaps [dstq+dststrideq*0], xmm0
movaps [dstq+dststrideq*1], xmm1
lea dstq, [dstq+dststrideq*2]
sub heightd, 2
jg .nextrow
REP_RET
;-----------------------------------------------------------------------------
; void ff_vp8_idct_dc_add_<opt>(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
;-----------------------------------------------------------------------------
%macro ADD_DC 4
%4 m2, [dst1q+%3]
%4 m3, [dst1q+strideq+%3]
%4 m4, [dst2q+%3]
%4 m5, [dst2q+strideq+%3]
paddusb m2, %1
paddusb m3, %1
paddusb m4, %1
paddusb m5, %1
psubusb m2, %2
psubusb m3, %2
psubusb m4, %2
psubusb m5, %2
%4 [dst1q+%3], m2
%4 [dst1q+strideq+%3], m3
%4 [dst2q+%3], m4
%4 [dst2q+strideq+%3], m5
%endmacro
%if ARCH_X86_32
INIT_MMX mmx
cglobal vp8_idct_dc_add, 3, 3, 0, dst, block, stride
; load data
movd m0, [blockq]
; calculate DC
paddw m0, [pw_4]
pxor m1, m1
psraw m0, 3
movd [blockq], m1
psubw m1, m0
packuswb m0, m0
packuswb m1, m1
punpcklbw m0, m0
punpcklbw m1, m1
punpcklwd m0, m0
punpcklwd m1, m1
; add DC
DEFINE_ARGS dst1, dst2, stride
lea dst2q, [dst1q+strideq*2]
ADD_DC m0, m1, 0, movh
RET
%endif
%macro VP8_IDCT_DC_ADD 0
cglobal vp8_idct_dc_add, 3, 3, 6, dst, block, stride
; load data
movd m0, [blockq]
pxor m1, m1
; calculate DC
paddw m0, [pw_4]
movd [blockq], m1
DEFINE_ARGS dst1, dst2, stride
lea dst2q, [dst1q+strideq*2]
movd m2, [dst1q]
movd m3, [dst1q+strideq]
movd m4, [dst2q]
movd m5, [dst2q+strideq]
psraw m0, 3
pshuflw m0, m0, 0
punpcklqdq m0, m0
punpckldq m2, m3
punpckldq m4, m5
punpcklbw m2, m1
punpcklbw m4, m1
paddw m2, m0
paddw m4, m0
packuswb m2, m4
movd [dst1q], m2
%if cpuflag(sse4)
pextrd [dst1q+strideq], m2, 1
pextrd [dst2q], m2, 2
pextrd [dst2q+strideq], m2, 3
%else
psrldq m2, 4
movd [dst1q+strideq], m2
psrldq m2, 4
movd [dst2q], m2
psrldq m2, 4
movd [dst2q+strideq], m2
%endif
RET
%endmacro
INIT_XMM sse2
VP8_IDCT_DC_ADD
INIT_XMM sse4
VP8_IDCT_DC_ADD
;-----------------------------------------------------------------------------
; void ff_vp8_idct_dc_add4y_<opt>(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride);
;-----------------------------------------------------------------------------
%if ARCH_X86_32
INIT_MMX mmx
cglobal vp8_idct_dc_add4y, 3, 3, 0, dst, block, stride
; load data
movd m0, [blockq+32*0] ; A
movd m1, [blockq+32*2] ; C
punpcklwd m0, [blockq+32*1] ; A B
punpcklwd m1, [blockq+32*3] ; C D
punpckldq m0, m1 ; A B C D
pxor m6, m6
; calculate DC
paddw m0, [pw_4]
movd [blockq+32*0], m6
movd [blockq+32*1], m6
movd [blockq+32*2], m6
movd [blockq+32*3], m6
psraw m0, 3
psubw m6, m0
packuswb m0, m0
packuswb m6, m6
punpcklbw m0, m0 ; AABBCCDD
punpcklbw m6, m6 ; AABBCCDD
movq m1, m0
movq m7, m6
punpcklbw m0, m0 ; AAAABBBB
punpckhbw m1, m1 ; CCCCDDDD
punpcklbw m6, m6 ; AAAABBBB
punpckhbw m7, m7 ; CCCCDDDD
; add DC
DEFINE_ARGS dst1, dst2, stride
lea dst2q, [dst1q+strideq*2]
ADD_DC m0, m6, 0, mova
ADD_DC m1, m7, 8, mova
RET
%endif
INIT_XMM sse2
cglobal vp8_idct_dc_add4y, 3, 3, 6, dst, block, stride
; load data
movd m0, [blockq+32*0] ; A
movd m1, [blockq+32*2] ; C
punpcklwd m0, [blockq+32*1] ; A B
punpcklwd m1, [blockq+32*3] ; C D
punpckldq m0, m1 ; A B C D
pxor m1, m1
; calculate DC
paddw m0, [pw_4]
movd [blockq+32*0], m1
movd [blockq+32*1], m1
movd [blockq+32*2], m1
movd [blockq+32*3], m1
psraw m0, 3
psubw m1, m0
packuswb m0, m0
packuswb m1, m1
punpcklbw m0, m0
punpcklbw m1, m1
punpcklbw m0, m0
punpcklbw m1, m1
; add DC
DEFINE_ARGS dst1, dst2, stride
lea dst2q, [dst1q+strideq*2]
ADD_DC m0, m1, 0, mova
RET
;-----------------------------------------------------------------------------
; void ff_vp8_idct_dc_add4uv_<opt>(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride);
;-----------------------------------------------------------------------------
INIT_MMX mmx
cglobal vp8_idct_dc_add4uv, 3, 3, 0, dst, block, stride
; load data
movd m0, [blockq+32*0] ; A
movd m1, [blockq+32*2] ; C
punpcklwd m0, [blockq+32*1] ; A B
punpcklwd m1, [blockq+32*3] ; C D
punpckldq m0, m1 ; A B C D
pxor m6, m6
; calculate DC
paddw m0, [pw_4]
movd [blockq+32*0], m6
movd [blockq+32*1], m6
movd [blockq+32*2], m6
movd [blockq+32*3], m6
psraw m0, 3
psubw m6, m0
packuswb m0, m0
packuswb m6, m6
punpcklbw m0, m0 ; AABBCCDD
punpcklbw m6, m6 ; AABBCCDD
movq m1, m0
movq m7, m6
punpcklbw m0, m0 ; AAAABBBB
punpckhbw m1, m1 ; CCCCDDDD
punpcklbw m6, m6 ; AAAABBBB
punpckhbw m7, m7 ; CCCCDDDD
; add DC
DEFINE_ARGS dst1, dst2, stride
lea dst2q, [dst1q+strideq*2]
ADD_DC m0, m6, 0, mova
lea dst1q, [dst1q+strideq*4]
lea dst2q, [dst2q+strideq*4]
ADD_DC m1, m7, 0, mova
RET
;-----------------------------------------------------------------------------
; void ff_vp8_idct_add_<opt>(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
;-----------------------------------------------------------------------------
; calculate %1=mul_35468(%1)-mul_20091(%2); %2=mul_20091(%1)+mul_35468(%2)
; this macro assumes that m6/m7 have words for 20091/17734 loaded
%macro VP8_MULTIPLY_SUMSUB 4
mova %3, %1
mova %4, %2
pmulhw %3, m6 ;20091(1)
pmulhw %4, m6 ;20091(2)
paddw %3, %1
paddw %4, %2
paddw %1, %1
paddw %2, %2
pmulhw %1, m7 ;35468(1)
pmulhw %2, m7 ;35468(2)
psubw %1, %4
paddw %2, %3
%endmacro
; calculate x0=%1+%3; x1=%1-%3
; x2=mul_35468(%2)-mul_20091(%4); x3=mul_20091(%2)+mul_35468(%4)
; %1=x0+x3 (tmp0); %2=x1+x2 (tmp1); %3=x1-x2 (tmp2); %4=x0-x3 (tmp3)
; %5/%6 are temporary registers
; we assume m6/m7 have constant words 20091/17734 loaded in them
%macro VP8_IDCT_TRANSFORM4x4_1D 6
SUMSUB_BA w, %3, %1, %5 ;t0, t1
VP8_MULTIPLY_SUMSUB m%2, m%4, m%5,m%6 ;t2, t3
SUMSUB_BA w, %4, %3, %5 ;tmp0, tmp3
SUMSUB_BA w, %2, %1, %5 ;tmp1, tmp2
SWAP %4, %1
SWAP %4, %3
%endmacro
%macro VP8_IDCT_ADD 0
cglobal vp8_idct_add, 3, 3, 0, dst, block, stride
; load block data
movq m0, [blockq+ 0]
movq m1, [blockq+ 8]
movq m2, [blockq+16]
movq m3, [blockq+24]
movq m6, [pw_20091]
movq m7, [pw_17734]
%if cpuflag(sse)
xorps xmm0, xmm0
movaps [blockq+ 0], xmm0
movaps [blockq+16], xmm0
%else
pxor m4, m4
movq [blockq+ 0], m4
movq [blockq+ 8], m4
movq [blockq+16], m4
movq [blockq+24], m4
%endif
; actual IDCT
VP8_IDCT_TRANSFORM4x4_1D 0, 1, 2, 3, 4, 5
TRANSPOSE4x4W 0, 1, 2, 3, 4
paddw m0, [pw_4]
VP8_IDCT_TRANSFORM4x4_1D 0, 1, 2, 3, 4, 5
TRANSPOSE4x4W 0, 1, 2, 3, 4
; store
pxor m4, m4
DEFINE_ARGS dst1, dst2, stride
lea dst2q, [dst1q+2*strideq]
STORE_DIFFx2 m0, m1, m6, m7, m4, 3, dst1q, strideq
STORE_DIFFx2 m2, m3, m6, m7, m4, 3, dst2q, strideq
RET
%endmacro
%if ARCH_X86_32
INIT_MMX mmx
VP8_IDCT_ADD
%endif
INIT_MMX sse
VP8_IDCT_ADD
;-----------------------------------------------------------------------------
; void ff_vp8_luma_dc_wht(int16_t block[4][4][16], int16_t dc[16])
;-----------------------------------------------------------------------------
%macro SCATTER_WHT 3
movd dc1d, m%1
movd dc2d, m%2
mov [blockq+2*16*(0+%3)], dc1w
mov [blockq+2*16*(1+%3)], dc2w
shr dc1d, 16
shr dc2d, 16
psrlq m%1, 32
psrlq m%2, 32
mov [blockq+2*16*(4+%3)], dc1w
mov [blockq+2*16*(5+%3)], dc2w
movd dc1d, m%1
movd dc2d, m%2
mov [blockq+2*16*(8+%3)], dc1w
mov [blockq+2*16*(9+%3)], dc2w
shr dc1d, 16
shr dc2d, 16
mov [blockq+2*16*(12+%3)], dc1w
mov [blockq+2*16*(13+%3)], dc2w
%endmacro
%macro HADAMARD4_1D 4
SUMSUB_BADC w, %2, %1, %4, %3
SUMSUB_BADC w, %4, %2, %3, %1
SWAP %1, %4, %3
%endmacro
%macro VP8_DC_WHT 0
cglobal vp8_luma_dc_wht, 2, 3, 0, block, dc1, dc2
movq m0, [dc1q]
movq m1, [dc1q+8]
movq m2, [dc1q+16]
movq m3, [dc1q+24]
%if cpuflag(sse)
xorps xmm0, xmm0
movaps [dc1q+ 0], xmm0
movaps [dc1q+16], xmm0
%else
pxor m4, m4
movq [dc1q+ 0], m4
movq [dc1q+ 8], m4
movq [dc1q+16], m4
movq [dc1q+24], m4
%endif
HADAMARD4_1D 0, 1, 2, 3
TRANSPOSE4x4W 0, 1, 2, 3, 4
paddw m0, [pw_3]
HADAMARD4_1D 0, 1, 2, 3
psraw m0, 3
psraw m1, 3
psraw m2, 3
psraw m3, 3
SCATTER_WHT 0, 1, 0
SCATTER_WHT 2, 3, 2
RET
%endmacro
%if ARCH_X86_32
INIT_MMX mmx
VP8_DC_WHT
%endif
INIT_MMX sse
VP8_DC_WHT
|
{
"pile_set_name": "Github"
}
|
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:copy_name",
"source": "block_entity"
},
{
"function": "minecraft:copy_nbt",
"source": "block_entity",
"ops": [
{
"source": "Lock",
"target": "BlockEntityTag.Lock",
"op": "replace"
},
{
"source": "LootTable",
"target": "BlockEntityTag.LootTable",
"op": "replace"
},
{
"source": "LootTableSeed",
"target": "BlockEntityTag.LootTableSeed",
"op": "replace"
}
]
},
{
"function": "minecraft:set_contents",
"entries": [
{
"type": "minecraft:dynamic",
"name": "minecraft:contents"
}
]
}
],
"name": "minecraft:brown_shulker_box"
}
]
}
]
}
|
{
"pile_set_name": "Github"
}
|
// Uva10340 All in All
// ³Â·æ
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
string s, t;
while(cin>>s>>t)
{
bool found = true;
string::size_type pos = -1;
for(string::iterator ps = s.begin(); ps != s.end(); ps++)
{
pos = t.find(*ps, pos + 1);
if(pos == string::npos)
{
found = false;
break;
}
}
cout<<(found ? "Yes" : "No")<<endl;
}
return 0;
}
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "../dtd/ldmlKeyboard.dtd">
<keyboard locale="bn-t-k0-windows-legacy">
<version platform="10" number="$Revision$"/>
<names>
<name value="Bengali - INSCRIPT (Legacy)"/>
</names>
<settings fallback="omit"/>
<keyMap>
<map iso="E01" to="১"/> <!-- 1 -->
<map iso="E02" to="২"/> <!-- 2 -->
<map iso="E03" to="৩"/> <!-- 3 -->
<map iso="E04" to="৪"/> <!-- 4 -->
<map iso="E05" to="৫"/> <!-- 5 -->
<map iso="E06" to="৬"/> <!-- 6 -->
<map iso="E07" to="৭"/> <!-- 7 -->
<map iso="E08" to="৮"/> <!-- 8 -->
<map iso="E09" to="৯"/> <!-- 9 -->
<map iso="E10" to="০"/> <!-- 0 -->
<map iso="E11" to="-"/>
<map iso="E12" to="\u{9C3}"/> <!-- = to= ৃ -->
<map iso="D01" to="\u{9CC}"/> <!-- Q to= ৌ -->
<map iso="D02" to="\u{9C8}"/> <!-- W to= ৈ -->
<map iso="D03" to="\u{9BE}"/> <!-- E to= া -->
<map iso="D04" to="\u{9C0}"/> <!-- R to= ী -->
<map iso="D05" to="\u{9C2}"/> <!-- T to= ূ -->
<map iso="D06" to="ব"/> <!-- Y -->
<map iso="D07" to="হ"/> <!-- U -->
<map iso="D08" to="গ"/> <!-- I -->
<map iso="D09" to="দ"/> <!-- O -->
<map iso="D10" to="জ"/> <!-- P -->
<map iso="D11" to="ড"/> <!-- [ -->
<map iso="D12" to="\u{9BC}"/> <!-- ] to= ় -->
<map iso="C01" to="\u{9CB}"/> <!-- A to= ো -->
<map iso="C02" to="\u{9C7}"/> <!-- S to= ে -->
<map iso="C03" to="\u{9CD}"/> <!-- D to= ্ -->
<map iso="C04" to="\u{9BF}"/> <!-- F to= ি -->
<map iso="C05" to="\u{9C1}"/> <!-- G to= ু -->
<map iso="C06" to="প"/> <!-- H -->
<map iso="C07" to="র"/> <!-- J -->
<map iso="C08" to="ক"/> <!-- K -->
<map iso="C09" to="ত"/> <!-- L -->
<map iso="C10" to="চ"/> <!-- ; -->
<map iso="C11" to="ট"/> <!-- ' -->
<map iso="B02" to="\u{982}"/> <!-- X to= ং -->
<map iso="B03" to="ম"/> <!-- C -->
<map iso="B04" to="ন"/> <!-- V -->
<map iso="B05" to="ব"/> <!-- B -->
<map iso="B06" to="ল"/> <!-- N -->
<map iso="B07" to="স"/> <!-- M -->
<map iso="B08" to=","/>
<map iso="B09" to="."/>
<map iso="B10" to="য়"/> <!-- / -->
<map iso="A03" to=" "/> <!-- space -->
</keyMap>
<keyMap modifiers="shift+caps?">
<map iso="E01" to="!"/> <!-- 1 base=১ -->
<map iso="E02" to="@"/> <!-- 2 base=২ -->
<map iso="E04" to="র\u{9CD}"/> <!-- 4 base=৪ to= র্ -->
<map iso="E05" to="জ\u{9CD}ঞ"/> <!-- 5 base=৫ to= জ্ঞ -->
<map iso="E06" to="ত\u{9CD}র"/> <!-- 6 base=৬ to= ত্র -->
<map iso="E07" to="ক\u{9CD}ষ"/> <!-- 7 base=৭ to= ক্ষ -->
<map iso="E08" to="শ\u{9CD}র"/> <!-- 8 base=৮ to= শ্র -->
<map iso="E09" to="("/> <!-- 9 base=৯ -->
<map iso="E10" to=")"/> <!-- 0 base=০ -->
<map iso="E11" to="\u{983}"/> <!-- - to= ঃ -->
<map iso="E12" to="ঋ"/> <!-- = base=ৃ -->
<map iso="D01" to="ঔ"/> <!-- Q base=ৌ -->
<map iso="D02" to="ঐ"/> <!-- W base=ৈ -->
<map iso="D03" to="আ"/> <!-- E base=া -->
<map iso="D04" to="ঈ"/> <!-- R base=ী -->
<map iso="D05" to="ঊ"/> <!-- T base=ূ -->
<map iso="D06" to="ভ"/> <!-- Y base=ব -->
<map iso="D07" to="ঙ"/> <!-- U base=হ -->
<map iso="D08" to="ঘ"/> <!-- I base=গ -->
<map iso="D09" to="ধ"/> <!-- O base=দ -->
<map iso="D10" to="ঝ"/> <!-- P base=জ -->
<map iso="D11" to="ঢ"/> <!-- [ base=ড -->
<map iso="D12" to="ঞ"/> <!-- ] base=় -->
<map iso="C01" to="ও"/> <!-- A base=ো -->
<map iso="C02" to="এ"/> <!-- S base=ে -->
<map iso="C03" to="অ"/> <!-- D base=্ -->
<map iso="C04" to="ই"/> <!-- F base=ি -->
<map iso="C05" to="উ"/> <!-- G base=ু -->
<map iso="C06" to="ফ"/> <!-- H base=প -->
<map iso="C08" to="খ"/> <!-- K base=ক -->
<map iso="C09" to="থ"/> <!-- L base=ত -->
<map iso="C10" to="ছ"/> <!-- ; base=চ -->
<map iso="C11" to="ঠ"/> <!-- ' base=ট -->
<map iso="B02" to="\u{981}"/> <!-- X base=ং to= ঁ -->
<map iso="B03" to="ণ"/> <!-- C base=ম -->
<map iso="B07" to="শ"/> <!-- M base=স -->
<map iso="B08" to="ষ"/> <!-- , -->
<map iso="B10" to="য"/> <!-- / base=য় -->
<map iso="A03" to=" "/> <!-- space -->
</keyMap>
<keyMap modifiers="ctrl+shift+caps?">
<map iso="E01" to="\u{200D}"/> <!-- 1 base=১ -->
<map iso="E02" to="\u{200C}"/> <!-- 2 base=২ -->
<map iso="E04" to="₹"/> <!-- 4 base=৪ -->
</keyMap>
</keyboard>
|
{
"pile_set_name": "Github"
}
|
/*
* r.js
*
* Copyright (C) 2009-11 by RStudio, Inc.
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* 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 Ajax.org B.V. 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 AJAX.ORG B.V. 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
*
*/
define(function(require, exports, module) {
"use strict";
var Range = require("../range").Range;
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var RHighlightRules = require("./r_highlight_rules").RHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var Mode = function(){
this.HighlightRules = RHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = this.$defaultBehaviour;
};
oop.inherits(Mode, TextMode);
(function()
{
this.lineCommentStart = "#";
// todo import codeModel from RStudio
/*this.tokenRe = new RegExp("^["
+ unicode.packages.L
+ unicode.packages.Mn + unicode.packages.Mc
+ unicode.packages.Nd
+ unicode.packages.Pc + "._]+", "g"
);
this.nonTokenRe = new RegExp("^(?:[^"
+ unicode.packages.L
+ unicode.packages.Mn + unicode.packages.Mc
+ unicode.packages.Nd
+ unicode.packages.Pc + "._]|\s])+", "g"
);
this.$complements = {
"(": ")",
"[": "]",
'"': '"',
"'": "'",
"{": "}"
};
this.$reOpen = /^[(["'{]$/;
this.$reClose = /^[)\]"'}]$/;
this.getNextLineIndent = function(state, line, tab, tabSize, row)
{
return this.codeModel.getNextLineIndent(row, line, state, tab, tabSize);
};
this.allowAutoInsert = this.smartAllowAutoInsert;
this.checkOutdent = function(state, line, input) {
if (! /^\s+$/.test(line))
return false;
return /^\s*[\{\}\)]/.test(input);
};
this.getIndentForOpenBrace = function(openBracePos)
{
return this.codeModel.getIndentForOpenBrace(openBracePos);
};
this.autoOutdent = function(state, doc, row) {
if (row == 0)
return 0;
var line = doc.getLine(row);
var match = line.match(/^(\s*[\}\)])/);
if (match)
{
var column = match[1].length;
var openBracePos = doc.findMatchingBracket({row: row, column: column});
if (!openBracePos || openBracePos.row == row) return 0;
var indent = this.codeModel.getIndentForOpenBrace(openBracePos);
doc.replace(new Range(row, 0, row, column-1), indent);
}
match = line.match(/^(\s*\{)/);
if (match)
{
var column = match[1].length;
var indent = this.codeModel.getBraceIndent(row-1);
doc.replace(new Range(row, 0, row, column-1), indent);
}
};
this.$getIndent = function(line) {
var match = line.match(/^(\s+)/);
if (match) {
return match[1];
}
return "";
};
this.transformAction = function(state, action, editor, session, text) {
if (action === 'insertion' && text === "\n") {
// If newline in a doxygen comment, continue the comment
var pos = editor.getSelectionRange().start;
var match = /^((\s*#+')\s*)/.exec(session.doc.getLine(pos.row));
if (match && editor.getSelectionRange().start.column >= match[2].length) {
return {text: "\n" + match[1]};
}
}
return false;
};*/
this.$id = "ace/mode/r";
}).call(Mode.prototype);
exports.Mode = Mode;
});
|
{
"pile_set_name": "Github"
}
|
/**
** Gridlock.java * * Copyright 2011 by Sarah Wise, Mark Coletti, Andrew
* Crooks, and * George Mason University. * * Licensed under the Academic Free
* License version 3.0 * * See the file "LICENSE" for more information * $Id:
* Gridlock.java 878 2013-03-28 18:35:54Z joey.f.harrison $
* <p/>
*
*/
package sim.app.geo.gridlock;
import sim.app.geo.gridlock.data.GridlockData;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.planargraph.Node;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
import sim.engine.SimState;
import sim.engine.Steppable;
import sim.field.geo.GeomVectorField;
import sim.io.geo.ShapeFileImporter;
import sim.util.geo.GeomPlanarGraph;
import sim.util.geo.GeomPlanarGraphEdge;
import sim.util.geo.MasonGeometry;
/**
* The simulation core.
* <p/>
* The simulation can require a LOT of memory, so make sure the virtual machine
* has enough. Do this by adding the following to the command line, or by
* setting up your run configuration in Eclipse to include the VM argument:
* <p/>
* -Xmx2048M
* <p/>
* With smaller simulations this chunk of memory is obviously not necessary. You
* can take it down to -Xmx800M or some such. If you get an OutOfMemory error,
* push it up.
*/
public class Gridlock extends SimState
{
private static final long serialVersionUID = 1L;
/**
* Main function allows simulation to be run in stand-alone, non-GUI mode
*/
public static void main(String[] args)
{
doLoop(Gridlock.class, args);
System.exit(0);
}
public GeomVectorField roads = new GeomVectorField();
public GeomVectorField censusTracts = new GeomVectorField();
// traversable network
public GeomPlanarGraph network = new GeomPlanarGraph();
public GeomVectorField junctions = new GeomVectorField();
// mapping between unique edge IDs and edge structures themselves
HashMap<Integer, GeomPlanarGraphEdge> idsToEdges =
new HashMap<Integer, GeomPlanarGraphEdge>();
HashMap<GeomPlanarGraphEdge, ArrayList<Agent>> edgeTraffic =
new HashMap<GeomPlanarGraphEdge, ArrayList<Agent>>();
public GeomVectorField agents = new GeomVectorField();
ArrayList<Agent> agentList = new ArrayList<Agent>();
// system parameter: can force agents to go to or from work at any time
boolean goToWork = true;
// cheap, hacky, hard-coded way to identify which edges are associated with
// goal Nodes. Done because we cannot seem to read in .shp file for goal nodes because
// of an NegativeArraySize error? Any suggestions very welcome!
Integer[] goals =
{
72142, 72176, 72235, 72178
};
/**
* Constructor
*/
public Gridlock(long seed)
{
super(seed);
}
public boolean getGoToWork()
{
return goToWork;
}
public void setGoToWork(boolean val)
{
goToWork = val;
}
/**
* Initialization
*/
@Override
public void start()
{
super.start();
try
{
// read in the roads to create the transit network
System.out.println("reading roads layer...");
URL roadsFile = GridlockData.class.getResource("roads.shp");
URL roadsDB = GridlockData.class.getResource("roads.dbf");
ShapeFileImporter.read(roadsFile, roadsDB, roads);
Envelope MBR = roads.getMBR();
// read in the tracts to create the background
System.out.println("reading tracts layer...");
URL areasFile = GridlockData.class.getResource("areas.shp");
URL areasDB = GridlockData.class.getResource("areas.dbf");
ShapeFileImporter.read(areasFile, areasDB, censusTracts);
MBR.expandToInclude(censusTracts.getMBR());
createNetwork();
// update so that everyone knows what the standard MBR is
roads.setMBR(MBR);
censusTracts.setMBR(MBR);
// initialize agents
populate("data/roads_points_place.csv");
agents.setMBR(MBR);
// Ensure that the spatial index is updated after all the agents
// move
schedule.scheduleRepeating(agents.scheduleSpatialIndexUpdater(), Integer.MAX_VALUE, 1.0);
/**
* Steppable that flips Agent paths once everyone reaches their
* destinations
*/
Steppable flipper = new Steppable()
{
@Override
public void step(SimState state)
{
Gridlock gstate = (Gridlock) state;
// pass to check if anyone has not yet reached work
for (Agent a : gstate.agentList)
{
if (!a.reachedDestination)
{
return; // someone is still moving: let him do so
}
}
// send everyone back in the opposite direction now
boolean toWork = gstate.goToWork;
gstate.goToWork = !toWork;
// otherwise everyone has reached their latest destination:
// turn them back
for (Agent a : gstate.agentList)
{
a.flipPath();
}
}
};
schedule.scheduleRepeating(flipper, 10);
} catch (FileNotFoundException ex)
{
System.out.println("Error: missing required data file");
} catch (IOException ex)
{
Logger.getLogger(Gridlock.class.getName()).log(Level.SEVERE, null, ex);
} catch (Exception ex)
{
Logger.getLogger(Gridlock.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* Create the road network the agents will traverse
* <p/>
*/
private void createNetwork()
{
System.out.println("creating network...");
network.createFromGeomField(roads);
for (Object o : network.getEdges())
{
GeomPlanarGraphEdge e = (GeomPlanarGraphEdge) o;
//System.out.println(e.getDoubleAttribute("ID_ID"));
idsToEdges.put(e.getDoubleAttribute("ID_ID").intValue(), e);
e.setData(new ArrayList<Agent>());
}
addIntersectionNodes(network.nodeIterator(), junctions);
}
/**
* Read in the population file and create an appropriate pop
* <p/>
* @param filename
*/
public void populate(String filename)
{
try
{
String filePath = Gridlock.class
.getResource(filename).getPath();
FileInputStream fstream = new FileInputStream(filePath);
BufferedReader d = new BufferedReader(new InputStreamReader(fstream));
String s;
d.readLine(); // get rid of the header
while ((s = d.readLine()) != null)
{ // read in all data
String[] bits = s.split(",");
int pop = Integer.parseInt(bits[11]); // TODO: reset me if desired!
String workTract = bits[5];
String homeTract = bits[8];
String id_id = bits[13];
GeomPlanarGraphEdge startingEdge =
idsToEdges.get(
(int) Double.parseDouble(id_id));
GeomPlanarGraphEdge goalEdge = idsToEdges.get(
goals[ random.nextInt(goals.length)]);
for (int i = 0; i < 1; i++)
{//pop; i++){
Agent a = new Agent(this, homeTract, workTract, startingEdge, goalEdge);
boolean successfulStart = a.start(this);
if (!successfulStart)
{
continue; // DON'T ADD IT if it's bad
}
// MasonGeometry newGeometry = new MasonGeometry(a.getGeometry());
MasonGeometry newGeometry = a.getGeometry();
newGeometry.isMovable = true;
agents.addGeometry(newGeometry);
agentList.add(a);
schedule.scheduleRepeating(a);
}
}
// clean up
d.close();
} catch (Exception e)
{
System.out.println("ERROR: issue with population file: " + e);
}
}
/**
* adds nodes corresponding to road intersections to GeomVectorField
* <p/>
* @param nodeIterator Points to first node
* @param intersections GeomVectorField containing intersection geometry
* <p/>
* Nodes will belong to a planar graph populated from LineString network.
*/
private void addIntersectionNodes(Iterator<?> nodeIterator,
GeomVectorField intersections)
{
GeometryFactory fact = new GeometryFactory();
Coordinate coord = null;
Point point = null;
int counter = 0;
while (nodeIterator.hasNext())
{
Node node = (Node) nodeIterator.next();
coord = node.getCoordinate();
point = fact.createPoint(coord);
junctions.addGeometry(new MasonGeometry(point));
counter++;
}
}
}
|
{
"pile_set_name": "Github"
}
|
UPDATE `quest_template` SET `RequiredRaces`=0 WHERE `Id`=7848;
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2013 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/
#include "priv.h"
static const struct nvkm_volt_func
nv40_volt = {
.vid_get = nvkm_voltgpio_get,
.vid_set = nvkm_voltgpio_set,
};
int
nv40_volt_new(struct nvkm_device *device, int index, struct nvkm_volt **pvolt)
{
struct nvkm_volt *volt;
int ret;
ret = nvkm_volt_new_(&nv40_volt, device, index, &volt);
*pvolt = volt;
if (ret)
return ret;
return nvkm_voltgpio_init(volt);
}
|
{
"pile_set_name": "Github"
}
|
{
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"removeComments": false,
"preserveConstEnums": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"noImplicitAny": false,
"allowSyntheticDefaultImports": true,
"outDir": "lib",
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"sourceMap": true,
"baseUrl": ".",
"rootDir": ".",
"jsx": "react",
"jsxFactory": "React.createElement",
"allowJs": true,
"resolveJsonModule": true,
"typeRoots": [
"node_modules/@types",
"global.d.ts"
]
},
"exclude": [
"node_modules",
"dist"
],
"compileOnSave": false
}
|
{
"pile_set_name": "Github"
}
|
package com.tencent.mm.svg.a.a;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.graphics.Paint.Join;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.os.Looper;
import com.tencent.mm.svg.WeChatSVGRenderC2Java;
import com.tencent.mm.svg.c;
public final class ow
extends c
{
private final int height = 108;
private final int width = 108;
protected final int i(int paramInt, Object... paramVarArgs)
{
switch (paramInt)
{
}
for (;;)
{
return 0;
return 108;
return 108;
Canvas localCanvas = (Canvas)paramVarArgs[0];
paramVarArgs = (Looper)paramVarArgs[1];
Object localObject1 = c.d(paramVarArgs);
Object localObject2 = c.c(paramVarArgs);
Paint localPaint1 = c.g(paramVarArgs);
localPaint1.setFlags(385);
localPaint1.setStyle(Paint.Style.FILL);
Paint localPaint2 = c.g(paramVarArgs);
localPaint2.setFlags(385);
localPaint2.setStyle(Paint.Style.STROKE);
localPaint1.setColor(-16777216);
localPaint2.setStrokeWidth(1.0F);
localPaint2.setStrokeCap(Paint.Cap.BUTT);
localPaint2.setStrokeJoin(Paint.Join.MITER);
localPaint2.setStrokeMiter(4.0F);
localPaint2.setPathEffect(null);
c.a(localPaint2, paramVarArgs).setStrokeWidth(1.0F);
localCanvas.save();
localPaint1 = c.a(localPaint1, paramVarArgs);
localPaint1.setColor(-5460820);
localObject2 = c.a((float[])localObject2, 1.0F, 0.0F, 21.0F, 0.0F, 1.0F, 45.0F);
((Matrix)localObject1).reset();
((Matrix)localObject1).setValues((float[])localObject2);
localCanvas.concat((Matrix)localObject1);
localCanvas.save();
localObject1 = c.a(localPaint1, paramVarArgs);
localObject2 = c.h(paramVarArgs);
((Path)localObject2).moveTo(4.65F, 1.76F);
((Path)localObject2).cubicTo(9.01F, -0.47F, 14.83F, 2.41F, 15.78F, 7.19F);
((Path)localObject2).cubicTo(17.06F, 11.98F, 12.97F, 17.14F, 8.02F, 16.99F);
((Path)localObject2).cubicTo(4.06F, 17.14F, 0.96F, 13.96F, 0.0F, 10.33F);
((Path)localObject2).lineTo(0.0F, 7.82F);
((Path)localObject2).cubicTo(0.8F, 5.35F, 2.09F, 2.76F, 4.65F, 1.76F);
((Path)localObject2).lineTo(4.65F, 1.76F);
((Path)localObject2).close();
WeChatSVGRenderC2Java.setFillType((Path)localObject2, 2);
localCanvas.drawPath((Path)localObject2, (Paint)localObject1);
localCanvas.restore();
localCanvas.save();
localObject1 = c.a(localPaint1, paramVarArgs);
localObject2 = c.h(paramVarArgs);
((Path)localObject2).moveTo(30.29F, 1.49F);
((Path)localObject2).cubicTo(34.28F, -0.09F, 39.2F, 2.27F, 40.52F, 6.32F);
((Path)localObject2).cubicTo(42.18F, 10.54F, 39.41F, 15.74F, 35.0F, 16.73F);
((Path)localObject2).cubicTo(31.13F, 17.86F, 26.72F, 15.45F, 25.47F, 11.65F);
((Path)localObject2).cubicTo(23.92F, 7.68F, 26.28F, 2.83F, 30.29F, 1.49F);
((Path)localObject2).lineTo(30.29F, 1.49F);
((Path)localObject2).close();
WeChatSVGRenderC2Java.setFillType((Path)localObject2, 2);
localCanvas.drawPath((Path)localObject2, (Paint)localObject1);
localCanvas.restore();
localCanvas.save();
localPaint1 = c.a(localPaint1, paramVarArgs);
localObject1 = c.h(paramVarArgs);
((Path)localObject1).moveTo(50.23F, 10.85F);
((Path)localObject1).cubicTo(48.89F, 6.03F, 53.07F, 0.83F, 58.04F, 1.01F);
((Path)localObject1).cubicTo(61.98F, 0.89F, 65.03F, 4.05F, 66.0F, 7.66F);
((Path)localObject1).lineTo(66.0F, 10.07F);
((Path)localObject1).cubicTo(65.25F, 12.58F, 63.98F, 15.22F, 61.39F, 16.23F);
((Path)localObject1).cubicTo(57.03F, 18.47F, 51.21F, 15.62F, 50.23F, 10.85F);
((Path)localObject1).lineTo(50.23F, 10.85F);
((Path)localObject1).close();
WeChatSVGRenderC2Java.setFillType((Path)localObject1, 2);
localCanvas.drawPath((Path)localObject1, localPaint1);
localCanvas.restore();
localCanvas.restore();
c.f(paramVarArgs);
}
}
}
/* Location:
* Qualified Name: com.tencent.mm.svg.a.a.ow
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|
{
"pile_set_name": "Github"
}
|
"""defines various GUI unit tests"""
import os
import unittest
#from pyNastran.gui.arg_handling import get_inputs
from pyNastran.bdf.test.test_bdf import test_bdf_argparse
class TestBDFParsing(unittest.TestCase):
"""tests parsing of the pyNastranGUI command line"""
def test_parse_1(self):
"""tests parsing of the pyNastranGUI command line"""
#keys_to_remove = ['noupdate', 'log', 'test', 'geomscript', 'postscript', 'qt',
#'plugin', 'is_groups', 'user_geom', 'user_points', 'debug']
with open('fem.bdf', 'w') as unused_bdf_file:
pass
args = ['test_bdf', 'fem.bdf']
out = test_bdf_argparse(argv=args)
#print(out)
#args = ['test_bdf', 'fem.bdf', 'fem2.bdf']
#out = test_bdf_argparse(argv=args)
#assert isinstance(out, str), out # error
args = ['test_bdf', 'fem.bdf', '-x']
out = test_bdf_argparse(argv=args)
args = ['test_bdf', 'fem.bdf', '--xref']
out = test_bdf_argparse(argv=args)
args = ['test_bdf', 'fem.bdf', '--safe']
out = test_bdf_argparse(argv=args)
#args = ['test_bdf', 'fem.bdf', '--safe', '--xref']
#out = test_bdf_argparse(argv=args)
#assert isinstance(out, str), out # error
args = ['test_bdf', 'fem.bdf', '-xc']
out = test_bdf_argparse(argv=args)
#print(out)
args = ['test_bdf', 'fem.bdf', '-xcdL']
out = test_bdf_argparse(argv=args)
args = ['test_bdf', 'fem.bdf', '-xclL']
out = test_bdf_argparse(argv=args)
args = ['test_bdf', 'fem.bdf', '--encoding', 'latin1']
out = test_bdf_argparse(argv=args)
args = ['test_bdf', 'fem.bdf', '-e', '100']
out = test_bdf_argparse(argv=args)
args = ['test_bdf', 'fem.bdf', '--dumplines']
out = test_bdf_argparse(argv=args)
args = ['test_bdf', 'fem.bdf', '--dictsort']
out = test_bdf_argparse(argv=args)
args = ['test_bdf', 'fem.bdf', '--profile']
out = test_bdf_argparse(argv=args)
str(out)
#args = ['test_bdf', '-h']
#out = test_bdf_argparse(argv=args)
#print(out)
os.remove('fem.bdf')
#def remove_args(dicti, *keys_to_remove):
#"""removes keys from a dictionary to declutter the comparison"""
#for key in keys_to_remove:
#if key in dicti:
#del dicti[key]
if __name__ == '__main__': # pragma: no cover
unittest.main()
|
{
"pile_set_name": "Github"
}
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Common stuff related to name introduction
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%[(8 codegen grin)
ATTR AllGrPat [ | | introNmL USE {++} {[]}: {[HsName]} ]
SEM GrPatAlt
| Node lhs . introNmL = @fldL
%%[[10
| NodeSplit lhs . introNmL = @nm : @fldL.introNmL
%%]
SEM GrPatLam
| Var lhs . introNmL = [@nm]
| VarNode lhs . introNmL = tail @fldL.introNmL
| BasicNode EnumNode BasicAnnot EnumAnnot PtrAnnot PtrNode OpaqueNode OpaqueAnnot
lhs . introNmL = [@nm]
SEM GrVar
| Var lhs . introNmL = [@nm]
| KnownTag lhs . introNmL = [ error "introNmL known tag" ]
| Ignore lhs . introNmL = [ ]
%%]
%%[(10 codegen grin)
SEM GrSplit
| Sel lhs . introNmL = [@nm]
%%]
|
{
"pile_set_name": "Github"
}
|
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="SupplyRequest"/>
<meta>
<lastUpdated value="2017-07-27T08:19:05.564-04:00"/>
</meta>
<extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
<valueInteger value="0"/>
</extension>
<url value="http://hl7.org/fhir/StructureDefinition/SupplyRequest"/>
<name value="SupplyRequest"/>
<status value="draft"/>
<publisher value="Health Level Seven International (Orders and Observations)"/>
<contact>
<telecom>
<system value="other"/>
<value value="http://hl7.org/fhir"/>
</telecom>
</contact>
<contact>
<telecom>
<system value="other"/>
<value value="http://www.hl7.org/Special/committees/orders/index.cfm"/>
</telecom>
</contact>
<date value="2017-07-27T08:19:05-04:00"/>
<description value="Base StructureDefinition for SupplyRequest Resource"/>
<fhirVersion value="1.0.2"/>
<mapping>
<identity value="rim"/>
<uri value="http://hl7.org/v3"/>
<name value="RIM"/>
</mapping>
<mapping>
<identity value="w5"/>
<uri value="http://hl7.org/fhir/w5"/>
<name value="W5 Mapping"/>
</mapping>
<kind value="resource"/>
<abstract value="false"/>
<base value="http://hl7.org/fhir/StructureDefinition/DomainResource"/>
<snapshot>
<element>
<path value="SupplyRequest"/>
<short value="Request for a medication, substance or device"/>
<definition value="A record of a request for a medication, substance or device used in the healthcare setting."/>
<min value="0"/>
<max value="*"/>
<type>
<code value="DomainResource"/>
</type>
<isSummary value="true"/>
<mapping>
<identity value="rim"/>
<map value="Supply[moodCode=RQO]"/>
</mapping>
<mapping>
<identity value="w5"/>
<map value="workflow.order"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.id"/>
<short value="Logical id of this artifact"/>
<definition value="The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes."/>
<comments value="The only time that a resource does not have an id is when it is being submitted to the server using a create operation. Bundles always have an id, though it is usually a generated UUID."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="id"/>
</type>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.meta"/>
<short value="Metadata about the resource"/>
<definition value="The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Meta"/>
</type>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.implicitRules"/>
<short value="A set of rules under which this content was created"/>
<definition value="A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content."/>
<comments value="Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element as much as possible."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="uri"/>
</type>
<isModifier value="true"/>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.language"/>
<short value="Language of the resource content"/>
<definition value="The base language in which the resource is written."/>
<comments value="Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute)."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="code"/>
</type>
<binding>
<strength value="required"/>
<description value="A human language."/>
<valueSetUri value="http://tools.ietf.org/html/bcp47"/>
</binding>
</element>
<element>
<path value="SupplyRequest.text"/>
<short value="Text summary of the resource, for human interpretation"/>
<definition value="A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety."/>
<comments value="Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative."/>
<alias value="narrative"/>
<alias value="html"/>
<alias value="xhtml"/>
<alias value="display"/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Narrative"/>
</type>
<condition value="dom-1"/>
<mapping>
<identity value="rim"/>
<map value="Act.text?"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.contained"/>
<short value="Contained, inline Resources"/>
<definition value="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope."/>
<comments value="This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again."/>
<alias value="inline resources"/>
<alias value="anonymous resources"/>
<alias value="contained resources"/>
<min value="0"/>
<max value="*"/>
<type>
<code value="Resource"/>
</type>
<mapping>
<identity value="rim"/>
<map value="N/A"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.extension"/>
<short value="Additional Content defined by implementations"/>
<definition value="May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension."/>
<comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone."/>
<alias value="extensions"/>
<alias value="user content"/>
<min value="0"/>
<max value="*"/>
<type>
<code value="Extension"/>
</type>
<mapping>
<identity value="rim"/>
<map value="N/A"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.modifierExtension"/>
<short value="Extensions that cannot be ignored"/>
<definition value="May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions."/>
<comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone."/>
<alias value="extensions"/>
<alias value="user content"/>
<min value="0"/>
<max value="*"/>
<type>
<code value="Extension"/>
</type>
<isModifier value="true"/>
<mapping>
<identity value="rim"/>
<map value="N/A"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.patient"/>
<short value="Patient for whom the item is supplied"/>
<definition value="A link to a resource representing the person whom the ordered item is for."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
</type>
<isSummary value="true"/>
<mapping>
<identity value="rim"/>
<map value=".participation[typeCode=SBJ].role"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.source"/>
<short value="Who initiated this order"/>
<definition value="The Practitioner , Organization or Patient who initiated this order for the supply."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Practitioner"/>
</type>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Organization"/>
</type>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
</type>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.date"/>
<short value="When the request was made"/>
<definition value="When the request was made."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="dateTime"/>
</type>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.identifier"/>
<short value="Unique identifier"/>
<definition value="Unique identifier for this supply request."/>
<comments value="This is assigned by the orderer, and used to refer to this order in other external standards."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Identifier"/>
</type>
<isSummary value="true"/>
<mapping>
<identity value="rim"/>
<map value=".id"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.status"/>
<short value="requested | completed | failed | cancelled"/>
<definition value="Status of the supply request."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="code"/>
</type>
<isModifier value="true"/>
<isSummary value="true"/>
<binding>
<strength value="required"/>
<description value="Status of the supply request"/>
<valueSetReference>
<reference value="http://hl7.org/fhir/ValueSet/supplyrequest-status"/>
</valueSetReference>
</binding>
<mapping>
<identity value="rim"/>
<map value=".statusCode, also existence of fulfillment events"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.kind"/>
<short value="The kind of supply (central, non-stock, etc.)"/>
<definition value="Category of supply, e.g. central, non-stock, etc. This is used to support work flows associated with the supply process."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="CodeableConcept"/>
</type>
<isSummary value="true"/>
<binding>
<strength value="required"/>
<description value="Category of supply request"/>
<valueSetReference>
<reference value="http://hl7.org/fhir/ValueSet/supplyrequest-kind"/>
</valueSetReference>
</binding>
<mapping>
<identity value="rim"/>
<map value=".code"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.orderedItem"/>
<short value="Medication, Substance, or Device requested to be supplied"/>
<definition value="The item that is requested to be supplied."/>
<comments value="Note that there's a difference between a prescription - an instruction to take a medication, along with a (sometimes) implicit supply, and an explicit request to supply, with no explicit instructions."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Medication"/>
</type>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Substance"/>
</type>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Device"/>
</type>
<isSummary value="true"/>
<mapping>
<identity value="rim"/>
<map value=".participation[typeCode=PRD].role"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.supplier"/>
<short value="Who is intended to fulfill the request"/>
<definition value="Who is intended to fulfill the request."/>
<min value="0"/>
<max value="*"/>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Organization"/>
</type>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.reason[x]"/>
<short value="Why the supply item was requested"/>
<definition value="Why the supply item was requested."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="CodeableConcept"/>
</type>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Resource"/>
</type>
<isSummary value="true"/>
<binding>
<strength value="example"/>
<description value="Why the supply item was requested"/>
<valueSetReference>
<reference value="http://hl7.org/fhir/ValueSet/supplyrequest-reason"/>
</valueSetReference>
</binding>
</element>
<element>
<path value="SupplyRequest.when"/>
<short value="When the request should be fulfilled"/>
<definition value="When the request should be fulfilled."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="BackboneElement"/>
</type>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.when.id"/>
<representation value="xmlAttr"/>
<short value="xml:id (or equivalent in JSON)"/>
<definition value="unique id for the element within a resource (for internal references)."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="id"/>
</type>
<mapping>
<identity value="rim"/>
<map value="n/a"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.when.extension"/>
<short value="Additional Content defined by implementations"/>
<definition value="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension."/>
<comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone."/>
<alias value="extensions"/>
<alias value="user content"/>
<min value="0"/>
<max value="*"/>
<type>
<code value="Extension"/>
</type>
<mapping>
<identity value="rim"/>
<map value="n/a"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.when.modifierExtension"/>
<short value="Extensions that cannot be ignored"/>
<definition value="May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions."/>
<comments value="There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone."/>
<alias value="extensions"/>
<alias value="user content"/>
<alias value="modifiers"/>
<min value="0"/>
<max value="*"/>
<type>
<code value="Extension"/>
</type>
<isModifier value="true"/>
<mapping>
<identity value="rim"/>
<map value="N/A"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.when.code"/>
<short value="Fulfilment code"/>
<definition value="Code indicating when the request should be fulfilled."/>
<comments value="Code may simply be a priority code."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="CodeableConcept"/>
</type>
<isSummary value="true"/>
<binding>
<strength value="example"/>
<description value="When the request should be fulfilled"/>
<valueSetReference>
<reference value="http://hl7.org/fhir/ValueSet/supplyrequest-when"/>
</valueSetReference>
</binding>
</element>
<element>
<path value="SupplyRequest.when.schedule"/>
<short value="Formal fulfillment schedule"/>
<definition value="Formal fulfillment schedule."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Timing"/>
</type>
<isSummary value="true"/>
</element>
</snapshot>
<differential>
<element>
<path value="SupplyRequest"/>
<short value="Request for a medication, substance or device"/>
<definition value="A record of a request for a medication, substance or device used in the healthcare setting."/>
<min value="0"/>
<max value="*"/>
<type>
<code value="DomainResource"/>
</type>
<isSummary value="true"/>
<mapping>
<identity value="rim"/>
<map value="Supply[moodCode=RQO]"/>
</mapping>
<mapping>
<identity value="w5"/>
<map value="workflow.order"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.patient"/>
<short value="Patient for whom the item is supplied"/>
<definition value="A link to a resource representing the person whom the ordered item is for."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
</type>
<isSummary value="true"/>
<mapping>
<identity value="rim"/>
<map value=".participation[typeCode=SBJ].role"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.source"/>
<short value="Who initiated this order"/>
<definition value="The Practitioner , Organization or Patient who initiated this order for the supply."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Practitioner"/>
</type>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Organization"/>
</type>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
</type>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.date"/>
<short value="When the request was made"/>
<definition value="When the request was made."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="dateTime"/>
</type>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.identifier"/>
<short value="Unique identifier"/>
<definition value="Unique identifier for this supply request."/>
<comments value="This is assigned by the orderer, and used to refer to this order in other external standards."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Identifier"/>
</type>
<isSummary value="true"/>
<mapping>
<identity value="rim"/>
<map value=".id"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.status"/>
<short value="requested | completed | failed | cancelled"/>
<definition value="Status of the supply request."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="code"/>
</type>
<isModifier value="true"/>
<isSummary value="true"/>
<binding>
<strength value="required"/>
<description value="Status of the supply request"/>
<valueSetReference>
<reference value="http://hl7.org/fhir/ValueSet/supplyrequest-status"/>
</valueSetReference>
</binding>
<mapping>
<identity value="rim"/>
<map value=".statusCode, also existence of fulfillment events"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.kind"/>
<short value="The kind of supply (central, non-stock, etc.)"/>
<definition value="Category of supply, e.g. central, non-stock, etc. This is used to support work flows associated with the supply process."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="CodeableConcept"/>
</type>
<isSummary value="true"/>
<binding>
<strength value="required"/>
<description value="Category of supply request"/>
<valueSetReference>
<reference value="http://hl7.org/fhir/ValueSet/supplyrequest-kind"/>
</valueSetReference>
</binding>
<mapping>
<identity value="rim"/>
<map value=".code"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.orderedItem"/>
<short value="Medication, Substance, or Device requested to be supplied"/>
<definition value="The item that is requested to be supplied."/>
<comments value="Note that there's a difference between a prescription - an instruction to take a medication, along with a (sometimes) implicit supply, and an explicit request to supply, with no explicit instructions."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Medication"/>
</type>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Substance"/>
</type>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Device"/>
</type>
<isSummary value="true"/>
<mapping>
<identity value="rim"/>
<map value=".participation[typeCode=PRD].role"/>
</mapping>
</element>
<element>
<path value="SupplyRequest.supplier"/>
<short value="Who is intended to fulfill the request"/>
<definition value="Who is intended to fulfill the request."/>
<min value="0"/>
<max value="*"/>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Organization"/>
</type>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.reason[x]"/>
<short value="Why the supply item was requested"/>
<definition value="Why the supply item was requested."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="CodeableConcept"/>
</type>
<type>
<code value="Reference"/>
<profile value="http://hl7.org/fhir/StructureDefinition/Resource"/>
</type>
<isSummary value="true"/>
<binding>
<strength value="example"/>
<description value="Why the supply item was requested"/>
<valueSetReference>
<reference value="http://hl7.org/fhir/ValueSet/supplyrequest-reason"/>
</valueSetReference>
</binding>
</element>
<element>
<path value="SupplyRequest.when"/>
<short value="When the request should be fulfilled"/>
<definition value="When the request should be fulfilled."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="BackboneElement"/>
</type>
<isSummary value="true"/>
</element>
<element>
<path value="SupplyRequest.when.code"/>
<short value="Fulfilment code"/>
<definition value="Code indicating when the request should be fulfilled."/>
<comments value="Code may simply be a priority code."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="CodeableConcept"/>
</type>
<isSummary value="true"/>
<binding>
<strength value="example"/>
<description value="When the request should be fulfilled"/>
<valueSetReference>
<reference value="http://hl7.org/fhir/ValueSet/supplyrequest-when"/>
</valueSetReference>
</binding>
</element>
<element>
<path value="SupplyRequest.when.schedule"/>
<short value="Formal fulfillment schedule"/>
<definition value="Formal fulfillment schedule."/>
<min value="0"/>
<max value="1"/>
<type>
<code value="Timing"/>
</type>
<isSummary value="true"/>
</element>
</differential>
</StructureDefinition>
|
{
"pile_set_name": "Github"
}
|
/**
* Loads a Wavefront .obj file with materials
*
* @author mrdoob / http://mrdoob.com/
* @author angelxuanchang
*/
THREE.OBJMTLLoader = function ( manager ) {
this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
};
THREE.OBJMTLLoader.prototype = {
constructor: THREE.OBJMTLLoader,
load: function ( url, mtlurl, onLoad, onProgress, onError ) {
var scope = this;
var mtlLoader = new THREE.MTLLoader( url.substr( 0, url.lastIndexOf( "/" ) + 1 ) );
mtlLoader.crossOrigin = scope.crossOrigin;
mtlLoader.load( mtlurl, function ( materials ) {
var materialsCreator = materials;
materialsCreator.preload();
var loader = new THREE.XHRLoader( scope.manager );
loader.setCrossOrigin( scope.crossOrigin );
loader.load( url, function ( text ) {
var object = scope.parse( text );
object.traverse( function ( object ) {
if ( object instanceof THREE.Mesh ) {
if ( object.material.name ) {
var material = materialsCreator.create( object.material.name );
if ( material ) object.material = material;
}
}
} );
onLoad( object );
}, onProgress, onError );
}, onProgress, onError );
},
/**
* Parses loaded .obj file
* @param data - content of .obj file
* @param mtllibCallback - callback to handle mtllib declaration (optional)
* @return {THREE.Object3D} - Object3D (with default material)
*/
parse: function ( data, mtllibCallback ) {
function vector( x, y, z ) {
return new THREE.Vector3( x, y, z );
}
function uv( u, v ) {
return new THREE.Vector2( u, v );
}
function face3( a, b, c, normals ) {
return new THREE.Face3( a, b, c, normals );
}
var face_offset = 0;
function meshN( meshName, materialName ) {
if ( vertices.length > 0 ) {
geometry.vertices = vertices;
geometry.mergeVertices();
geometry.computeFaceNormals();
geometry.computeBoundingSphere();
object.add( mesh );
geometry = new THREE.Geometry();
mesh = new THREE.Mesh( geometry, material );
}
if ( meshName !== undefined ) mesh.name = meshName;
if ( materialName !== undefined ) {
material = new THREE.MeshLambertMaterial();
material.name = materialName;
mesh.material = material;
}
}
var group = new THREE.Group();
var object = group;
var geometry = new THREE.Geometry();
var material = new THREE.MeshLambertMaterial();
var mesh = new THREE.Mesh( geometry, material );
var vertices = [];
var normals = [];
var uvs = [];
function add_face( a, b, c, normals_inds ) {
if ( normals_inds === undefined ) {
geometry.faces.push( face3(
parseInt( a ) - (face_offset + 1),
parseInt( b ) - (face_offset + 1),
parseInt( c ) - (face_offset + 1)
) );
} else {
geometry.faces.push( face3(
parseInt( a ) - (face_offset + 1),
parseInt( b ) - (face_offset + 1),
parseInt( c ) - (face_offset + 1),
[
normals[ parseInt( normals_inds[ 0 ] ) - 1 ].clone(),
normals[ parseInt( normals_inds[ 1 ] ) - 1 ].clone(),
normals[ parseInt( normals_inds[ 2 ] ) - 1 ].clone()
]
) );
}
}
function add_uvs( a, b, c ) {
geometry.faceVertexUvs[ 0 ].push( [
uvs[ parseInt( a ) - 1 ].clone(),
uvs[ parseInt( b ) - 1 ].clone(),
uvs[ parseInt( c ) - 1 ].clone()
] );
}
function handle_face_line(faces, uvs, normals_inds) {
if ( faces[ 3 ] === undefined ) {
add_face( faces[ 0 ], faces[ 1 ], faces[ 2 ], normals_inds );
if (!(uvs === undefined) && uvs.length > 0) {
add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 2 ] );
}
} else {
if (!(normals_inds === undefined) && normals_inds.length > 0) {
add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ], [ normals_inds[ 0 ], normals_inds[ 1 ], normals_inds[ 3 ] ]);
add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ], [ normals_inds[ 1 ], normals_inds[ 2 ], normals_inds[ 3 ] ]);
} else {
add_face( faces[ 0 ], faces[ 1 ], faces[ 3 ]);
add_face( faces[ 1 ], faces[ 2 ], faces[ 3 ]);
}
if (!(uvs === undefined) && uvs.length > 0) {
add_uvs( uvs[ 0 ], uvs[ 1 ], uvs[ 3 ] );
add_uvs( uvs[ 1 ], uvs[ 2 ], uvs[ 3 ] );
}
}
}
// v float float float
var vertex_pattern = /v( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/;
// vn float float float
var normal_pattern = /vn( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/;
// vt float float
var uv_pattern = /vt( +[\d|\.|\+|\-|e]+)( +[\d|\.|\+|\-|e]+)/;
// f vertex vertex vertex ...
var face_pattern1 = /f( +\d+)( +\d+)( +\d+)( +\d+)?/;
// f vertex/uv vertex/uv vertex/uv ...
var face_pattern2 = /f( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))( +(\d+)\/(\d+))?/;
// f vertex/uv/normal vertex/uv/normal vertex/uv/normal ...
var face_pattern3 = /f( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))( +(\d+)\/(\d+)\/(\d+))?/;
// f vertex//normal vertex//normal vertex//normal ...
var face_pattern4 = /f( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))( +(\d+)\/\/(\d+))?/
//
var lines = data.split( "\n" );
for ( var i = 0; i < lines.length; i ++ ) {
var line = lines[ i ];
line = line.trim();
var result;
if ( line.length === 0 || line.charAt( 0 ) === '#' ) {
continue;
} else if ( ( result = vertex_pattern.exec( line ) ) !== null ) {
// ["v 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
vertices.push( vector(
parseFloat( result[ 1 ] ),
parseFloat( result[ 2 ] ),
parseFloat( result[ 3 ] )
) );
} else if ( ( result = normal_pattern.exec( line ) ) !== null ) {
// ["vn 1.0 2.0 3.0", "1.0", "2.0", "3.0"]
normals.push( vector(
parseFloat( result[ 1 ] ),
parseFloat( result[ 2 ] ),
parseFloat( result[ 3 ] )
) );
} else if ( ( result = uv_pattern.exec( line ) ) !== null ) {
// ["vt 0.1 0.2", "0.1", "0.2"]
uvs.push( uv(
parseFloat( result[ 1 ] ),
parseFloat( result[ 2 ] )
) );
} else if ( ( result = face_pattern1.exec( line ) ) !== null ) {
// ["f 1 2 3", "1", "2", "3", undefined]
handle_face_line([ result[ 1 ], result[ 2 ], result[ 3 ], result[ 4 ] ]);
} else if ( ( result = face_pattern2.exec( line ) ) !== null ) {
// ["f 1/1 2/2 3/3", " 1/1", "1", "1", " 2/2", "2", "2", " 3/3", "3", "3", undefined, undefined, undefined]
handle_face_line(
[ result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ] ], //faces
[ result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ] ] //uv
);
} else if ( ( result = face_pattern3.exec( line ) ) !== null ) {
// ["f 1/1/1 2/2/2 3/3/3", " 1/1/1", "1", "1", "1", " 2/2/2", "2", "2", "2", " 3/3/3", "3", "3", "3", undefined, undefined, undefined, undefined]
handle_face_line(
[ result[ 2 ], result[ 6 ], result[ 10 ], result[ 14 ] ], //faces
[ result[ 3 ], result[ 7 ], result[ 11 ], result[ 15 ] ], //uv
[ result[ 4 ], result[ 8 ], result[ 12 ], result[ 16 ] ] //normal
);
} else if ( ( result = face_pattern4.exec( line ) ) !== null ) {
// ["f 1//1 2//2 3//3", " 1//1", "1", "1", " 2//2", "2", "2", " 3//3", "3", "3", undefined, undefined, undefined]
handle_face_line(
[ result[ 2 ], result[ 5 ], result[ 8 ], result[ 11 ] ], //faces
[ ], //uv
[ result[ 3 ], result[ 6 ], result[ 9 ], result[ 12 ] ] //normal
);
} else if ( /^o /.test( line ) ) {
// object
meshN();
face_offset = face_offset + vertices.length;
vertices = [];
object = new THREE.Object3D();
object.name = line.substring( 2 ).trim();
group.add( object );
} else if ( /^g /.test( line ) ) {
// group
meshN( line.substring( 2 ).trim(), undefined );
} else if ( /^usemtl /.test( line ) ) {
// material
meshN( undefined, line.substring( 7 ).trim() );
} else if ( /^mtllib /.test( line ) ) {
// mtl file
if ( mtllibCallback ) {
var mtlfile = line.substring( 7 );
mtlfile = mtlfile.trim();
mtllibCallback( mtlfile );
}
} else if ( /^s /.test( line ) ) {
// Smooth shading
} else {
console.log( "THREE.OBJMTLLoader: Unhandled line " + line );
}
}
//Add last object
meshN(undefined, undefined);
return group;
}
};
THREE.EventDispatcher.prototype.apply( THREE.OBJMTLLoader.prototype );
|
{
"pile_set_name": "Github"
}
|
/*
* ModeShape (http://www.modeshape.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.modeshape.jboss.subsystem;
import org.jboss.as.controller.PathElement;
import org.jboss.as.controller.SimpleResourceDefinition;
import org.jboss.as.controller.registry.ManagementResourceRegistration;
/**
* {@link SimpleResourceDefinition} which handles <db-binary-storage/> elements.
*/
public class ModeShapeDatabaseBinaryStorageResource extends SimpleResourceDefinition {
protected final static ModeShapeDatabaseBinaryStorageResource DEFAULT = new ModeShapeDatabaseBinaryStorageResource(
PathElement.pathElement(ModelKeys.STORAGE_TYPE, ModelKeys.DB_BINARY_STORAGE));
protected final static ModeShapeDatabaseBinaryStorageResource NESTED = new ModeShapeDatabaseBinaryStorageResource(
PathElement.pathElement(ModelKeys.NESTED_STORAGE_TYPE_DB, PathElement.WILDCARD_VALUE));
private ModeShapeDatabaseBinaryStorageResource(PathElement pathElement) {
super(pathElement,
ModeShapeExtension.getResourceDescriptionResolver(ModelKeys.REPOSITORY, ModelKeys.DB_BINARY_STORAGE),
AddDatabaseBinaryStorage.INSTANCE, RemoveBinaryStorage.INSTANCE);
}
@Override
public void registerAttributes( ManagementResourceRegistration resourceRegistration ) {
BinaryStorageWriteAttributeHandler.DATABASE_BINARY_STORAGE_INSTANCE.registerAttributes(resourceRegistration);
}
}
|
{
"pile_set_name": "Github"
}
|
{
"name": "hfs",
"description": "HTTP File Server",
"keywords": [
"file server",
"http server"
],
"version": "0.1.7",
"license": "GPL-3.0",
"homepage": "http://www.rejetto.com/hfs",
"author": "Massimo Melina <a@rejetto.com> (http://rejetto.com)",
"repository": {
"type": "git",
"url": "https://github.com/rejetto/hfs"
},
"bugs": {
"email": "a@rejetto.com",
"url": "http://www.rejetto.com/forum/index.php/board,28.0.html"
},
"directories": {
"lib": "./lib",
"static": "./static"
},
"main": "./main.js",
"dependencies": {
"socket.io": "1.3.6",
"socket.io-client": "1.3.6",
"async": "1.4.1",
"js-yaml": "3.3.1"
},
"bundleDependencies": [
],
"devDependencies": {
},
"engines": {
"node": "0.8",
"npm": "1"
},
"os": ["win32", "linux", "darwin"],
"licenses": [
{
"type": "GPLv2",
"url": "http://www.gnu.org/licenses/gpl-2.0.html"
}
]
}
|
{
"pile_set_name": "Github"
}
|
declare module "fuse.js" {
declare type FuseOptions = {
caseSensitive?: boolean,
includeScore?: boolean,
includeMatches?: boolean,
minMatchCharLength?: number,
shouldSort?: boolean,
tokenize?: boolean,
matchAllTokens?: boolean,
findAllMatches?: boolean,
id?: string,
keys?: $ReadOnlyArray<any>,
location?: number,
threshold?: number,
distance?: number,
maxPatternLength?: number,
getFn?: (obj: any, path: string) => any,
sortFn?: (a: any, b: any) => boolean,
verbose?: boolean,
tokenSeparator?: RegExp,
...
};
declare class Fuse<T> {
constructor(items: $ReadOnlyArray<T>, options?: FuseOptions): Fuse<T>;
search(pattern: string): Array<T>;
setCollection<U: $ReadOnlyArray<T>>(list: U): U;
}
declare module.exports: typeof Fuse;
}
|
{
"pile_set_name": "Github"
}
|
import styles from './CustomMonthPicker.less';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import getYearOptions from './getYearOptions';
import Dropdown from '../../Dropdown/Dropdown';
import FieldLabel from '../../FieldLabel/FieldLabel';
import ScreenReaderOnly from '../../ScreenReaderOnly/ScreenReaderOnly';
import { TONE } from '../../private/tone';
const months = [
{ value: '1', label: 'Jan' },
{ value: '2', label: 'Feb' },
{ value: '3', label: 'Mar' },
{ value: '4', label: 'Apr' },
{ value: '5', label: 'May' },
{ value: '6', label: 'Jun' },
{ value: '7', label: 'Jul' },
{ value: '8', label: 'Aug' },
{ value: '9', label: 'Sep' },
{ value: '10', label: 'Oct' },
{ value: '11', label: 'Nov' },
{ value: '12', label: 'Dec' }
];
/* eslint-disable react/no-deprecated */
export default class CustomMonthPicker extends Component {
static displayName = 'CustomMonthPicker';
static propTypes = {
id: PropTypes.string.isRequired,
onChange: PropTypes.func,
onBlur: PropTypes.func,
onFocus: PropTypes.func,
value: PropTypes.shape({
month: PropTypes.number,
year: PropTypes.number
}),
valid: PropTypes.bool,
tone: PropTypes.oneOf([
TONE.POSITIVE,
TONE.INFO,
TONE.CRITICAL,
TONE.NEUTRAL
]),
minYear: PropTypes.number.isRequired,
maxYear: PropTypes.number.isRequired,
ascendingYears: PropTypes.bool.isRequired,
fieldMessageId: PropTypes.string.isRequired
};
static defaultProps = {
value: {}
};
constructor({ minYear, maxYear, ascendingYears }) {
super();
this.handleMonthChange = this.handleMonthChange.bind(this);
this.handleYearChange = this.handleYearChange.bind(this);
this.storeMonthReference = this.storeMonthReference.bind(this);
this.storeYearReference = this.storeYearReference.bind(this);
this.handleBlur = this.handleBlur.bind(this);
this.handleFocus = this.handleFocus.bind(this);
this.blurIfNotFocussed = this.blurIfNotFocussed.bind(this);
this.yearOptions = getYearOptions(minYear, maxYear, ascendingYears);
}
componentWillUpdate(newProps) {
if (
['minYear', 'maxYear', 'ascendingYears'].filter(
key => newProps[key] !== this.props[key]
)
) {
this.yearOptions = getYearOptions(
newProps.minYear,
newProps.maxYear,
newProps.ascendingYears
);
}
}
storeMonthReference(input) {
if (input !== null) {
this.monthInput = input;
}
}
storeYearReference(input) {
if (input !== null) {
this.yearInput = input;
}
}
handleMonthChange({ target: { value } }) {
const {
onChange,
value: { year }
} = this.props;
if (typeof onChange === 'function') {
onChange({
month: parseInt(value, 10),
year
});
}
}
handleYearChange({ target: { value } }) {
const {
onChange,
value: { month }
} = this.props;
if (typeof onChange === 'function') {
onChange({
month,
year: parseInt(value, 10)
});
}
}
blurIfNotFocussed(active) {
const { onBlur, value } = this.props;
if (active !== this.monthInput && active !== this.yearInput) {
onBlur(value);
}
}
handleBlur({ relatedTarget }) {
const { onBlur } = this.props;
if (typeof onBlur === 'function') {
if (relatedTarget !== null) {
this.blurIfNotFocussed(relatedTarget);
} else {
// IE 9 - 11 Hack -- relatedTarget is null in blur event
setTimeout(() => {
const { activeElement } = document;
this.blurIfNotFocussed(activeElement);
});
}
}
}
handleFocus(evt) {
const { onFocus } = this.props;
if (typeof onFocus === 'function') {
onFocus(evt);
}
}
render() {
const { id, value, valid, tone, fieldMessageId } = this.props;
// eslint-disable-next-line react/prop-types
const { label, labelProps, secondaryLabel, tertiaryLabel } = this.props;
const { month, year } = value;
const monthValue = String(month || '');
const yearValue = String(year || '');
return (
<div>
<FieldLabel
{...{
id: `${id}-month`,
label: (
<span>
{label}
<ScreenReaderOnly> Month</ScreenReaderOnly>
</span>
),
labelProps,
secondaryLabel,
tertiaryLabel
}}
/>
<FieldLabel
{...{
id: `${id}-year`,
label: <ScreenReaderOnly>{label} Year</ScreenReaderOnly>,
raw: true
}}
/>
<div className={styles.dropdownWrapper}>
<Dropdown
id={`${id}-month`}
options={months}
className={styles.dropdown}
valid={valid}
tone={tone}
message={false}
placeholder="Month"
onChange={this.handleMonthChange}
onBlur={this.handleBlur}
onFocus={this.handleFocus}
value={monthValue}
inputProps={{
ref: this.storeMonthReference,
'aria-describedby': fieldMessageId
}}
/>
<Dropdown
id={`${id}-year`}
options={this.yearOptions}
className={styles.dropdown}
valid={valid}
tone={tone}
message={false}
placeholder="Year"
onChange={this.handleYearChange}
onBlur={this.handleBlur}
onFocus={this.handleFocus}
value={yearValue}
inputProps={{
ref: this.storeYearReference,
'aria-describedby': fieldMessageId
}}
/>
</div>
</div>
);
}
}
|
{
"pile_set_name": "Github"
}
|
{
"name": "Noctis Lux",
"type": "light",
"colors": {
"selection.background": "#169fb155",
"descriptionForeground": "#929ea0",
"errorForeground": "#ff4000",
"widget.shadow": "#00000055",
"editor.background": "#fef8ec",
"editor.foreground": "#005661",
"editorLineNumber.foreground": "#a0abac",
"editorLineNumber.activeForeground": "#0099ad",
"editorCursor.foreground": "#0092a8",
"badge.background": "#0099ad",
"badge.foreground": "#fef8ec",
"activityBar.background": "#fef8ec",
"activityBar.dropBackground": "#0099ad65",
"activityBar.foreground": "#0099ad",
"activityBar.border": "#ece2c600",
"activityBarBadge.background": "#0099ad",
"activityBarBadge.foreground": "#fef8ec",
"activityBar.activeBackground": "#0099ad33",
"activityBar.activeBorder": "#0099ad",
"sideBar.background": "#f8efdd",
"sideBar.foreground": "#888477",
"sideBar.border": "#ece2c600",
"sideBar.dropBackground": "#f8efdd",
"sideBarTitle.foreground": "#888477",
"sideBarSectionHeader.background": "#f0e3c2",
"sideBarSectionHeader.foreground": "#888477",
"statusBar.background": "#ebe4d1",
"statusBar.foreground": "#0099ad",
"statusBar.border": "#ece2c600",
"statusBar.debuggingBackground": "#f8efdd",
"statusBar.debuggingForeground": "#e9498150",
"statusBar.debuggingBorder": "#e94981af",
"statusBar.noFolderForeground": "#87a7ab",
"statusBar.noFolderBackground": "#f8efdd",
"statusBar.noFolderBorder": "#f8efdd",
"statusBarItem.activeBackground": "#dfeff1",
"statusBarItem.hoverBackground": "#d1e8eb",
"statusBarItem.prominentBackground": "#c1d4d7",
"statusBarItem.prominentHoverBackground": "#bfdee3",
"button.background": "#099",
"button.foreground": "#f1f1f1",
"button.hoverBackground": "#0cc",
"dropdown.background": "#fef8ec",
"dropdown.border": "#fef8ec",
"dropdown.foreground": "#005661",
"editorMarkerNavigation.background": "#3a3a5e29",
"editorMarkerNavigationError.background": "#ff4000",
"editorMarkerNavigationWarning.background": "#e69533",
"editorError.border": "#fef8ec",
"editorError.foreground": "#ff4000",
"editorWarning.border": "#fef8ec",
"editorWarning.foreground": "#e69533",
"editorInfo.border": "#fef8ec",
"editorInfo.foreground": "#00c6e0",
"editorHint.border": "#58cc6d00",
"editorHint.foreground": "#58cc6d",
"editorGroup.emptyBackground": "#b8ae9333",
"editorGroup.border": "#f0e7d1",
"editorGroup.dropBackground": "#b8ae9333",
"editorGroupHeader.noTabsBackground": "#ebe4d1",
"editorGroupHeader.tabsBackground": "#ebe4d1",
"editorGroupHeader.tabsBorder": "#ebe4d100",
"tab.activeBackground": "#fef8ec",
"tab.unfocusedActiveBackground": "#f7f2e3",
"tab.activeForeground": "#0099ad",
"tab.border": "#e6d7b2",
"tab.inactiveBackground": "#ebe4d1",
"tab.inactiveForeground": "#888477",
"tab.unfocusedActiveForeground": "#888477",
"tab.unfocusedInactiveForeground": "#888477",
"tab.activeBorderTop": "#00c6e0",
"tab.activeModifiedBorder": "#00b368",
"tab.activeBorder": "#fef8ec",
"tab.unfocusedActiveBorder": "#fef8ec00",
"tab.unfocusedHoverBackground": "#0099ad21",
"textBlockQuote.background": "#f8efdd",
"textBlockQuote.border": "#00899e",
"textCodeBlock.background": "#f8efdd",
"textLink.activeForeground": "#00c6e0",
"textLink.foreground": "#00c6e0",
"textPreformat.foreground": "#e9a149",
"textSeparator.foreground": "#f8efdd",
"walkThrough.embeddedEditorBackground": "#f8efdd",
"welcomePage.buttonBackground": "#f8efdd",
"welcomePage.buttonHoverBackground": "#e1e0d0",
"input.background": "#fef8ec",
"input.border": "#f2edde",
"input.foreground": "#6a7a7c",
"input.placeholderForeground": "#9fabad",
"inputOption.activeBorder": "#0099ad",
"inputValidation.errorBackground": "#ff400041",
"inputValidation.errorBorder": "#ff4000",
"inputValidation.infoBackground": "#00c6e0cc",
"inputValidation.infoBorder": "#00c6e0",
"inputValidation.warningBackground": "#ffa587cc",
"inputValidation.warningBorder": "#ffa487",
"editorWidget.background": "#f2edde",
"editorWidget.border": "#ece2c600",
"editorHoverWidget.background": "#f2edde",
"editorHoverWidget.border": "#ece2c600",
"editorSuggestWidget.background": "#f2edde",
"editorSuggestWidget.border": "#ece2c600",
"editorSuggestWidget.foreground": "#6a7a7c",
"editorSuggestWidget.highlightForeground": "#0099ad",
"editorSuggestWidget.selectedBackground": "#dbfaff",
"editorGutter.background": "#fef8ec",
"editorGutter.addedBackground": "#8ce99a",
"editorGutter.deletedBackground": "#ff4000",
"editorGutter.modifiedBackground": "#e9a149",
"editor.selectionBackground": "#ade2eb77",
"editor.selectionHighlightBackground": "#14a5ff33",
"editor.selectionHighlightBorder": "#14a5ff00",
"editor.inactiveSelectionBackground": "#ade2eb55",
"editor.wordHighlightStrongBackground": "#b5890027",
"editor.wordHighlightStrongBorder": "#b5890000",
"editor.wordHighlightBackground": "#e9a14922",
"editor.wordHighlightBorder": "#e9a14900",
"editor.findMatchBackground": "#8ce99a55",
"editor.findMatchBorder": "#8ce99a00",
"editor.findMatchHighlightBackground": "#148f9f33",
"editor.findMatchHighlightBorder": "#148f9f00",
"editor.findRangeHighlightBackground": "#99e62a55",
"editor.findRangeHighlightBorder": "#58CC6D00",
"editor.hoverHighlightBackground": "#0099ad3f",
"editor.lineHighlightBackground": "#d1ebefcc",
"editor.lineHighlightBorder": "#d1ebef00",
"editor.rangeHighlightBackground": "#f1e9d5a1",
"editorLink.activeForeground": "#14a5ff",
"editorWhitespace.foreground": "#d3cec5bb",
"editorIndentGuide.background": "#d3cec5aa",
"editorIndentGuide.activeBackground": "#88adc3",
"editorBracketMatch.background": "#0099ad20",
"editorBracketMatch.border": "#0099ad",
"editorRuler.foreground": "#f1e6d0",
"editorCodeLens.foreground": "#77aaca",
"terminal.ansiBlack": "#003b42",
"terminal.ansiRed": "#e34e1c",
"terminal.ansiGreen": "#00b368",
"terminal.ansiYellow": "#f49725",
"terminal.ansiBlue": "#0094f0",
"terminal.ansiMagenta": "#ff5792",
"terminal.ansiCyan": "#00bdd6",
"terminal.ansiWhite": "#8ca6a6",
"terminal.ansiBrightBlack": "#004d57",
"terminal.ansiBrightRed": "#ff4000",
"terminal.ansiBrightGreen": "#00d17a",
"terminal.ansiBrightYellow": "#ff8c00",
"terminal.ansiBrightBlue": "#0fa3ff",
"terminal.ansiBrightMagenta": "#ff6b9f",
"terminal.ansiBrightCyan": "#00cbe6",
"terminal.ansiBrightWhite": "#bbc3c4",
"terminal.background": "#f6ebd5",
"terminal.foreground": "#005661",
"terminalCursor.background": "#f6ebd5",
"terminalCursor.foreground": "#005661",
"merge.border": "#fef8ec00",
"merge.currentContentBackground": "#33e7ff33",
"merge.currentHeaderBackground": "#33e7ff55",
"merge.incomingContentBackground": "#9d92f233",
"merge.incomingHeaderBackground": "#9d92f255",
"merge.commonContentBackground": "#ffc18033",
"merge.commonHeaderBackground": "#ffc18055",
"editorOverviewRuler.currentContentForeground": "#33e7ff55",
"editorOverviewRuler.incomingContentForeground": "#9d92f255",
"editorOverviewRuler.commonContentForeground": "#ffc18055",
"editorOverviewRuler.border": "#fef8ec",
"notificationCenter.border": "#f2edde",
"notificationCenterHeader.foreground": "#005661",
"notificationCenterHeader.background": "#f2edde",
"notificationToast.border": "#f2edde",
"notifications.foreground": "#005661",
"notifications.background": "#f2edde",
"notifications.border": "#f2edde",
"notificationLink.foreground": "#005661",
"diffEditor.insertedTextBackground": "#14b83230",
"diffEditor.removedTextBackground": "#BB1F0522",
"debugToolBar.background": "#f8efdd",
"debugExceptionWidget.background": "#f8efdd",
"debugExceptionWidget.border": "#00899e",
"extensionButton.prominentBackground": "#099",
"extensionButton.prominentForeground": "#e5f5f5",
"extensionButton.prominentHoverBackground": "#0cc",
"focusBorder": "#f2edde",
"foreground": "#005661",
"panel.background": "#f6ebd5",
"panel.border": "#00c6e0",
"panelTitle.activeBorder": "#00c6e0",
"panelTitle.activeForeground": "#0099ad",
"panelTitle.inactiveForeground": "#888477",
"peekView.border": "#0099ad",
"peekViewEditor.background": "#fff7e5",
"peekViewEditor.matchHighlightBackground": "#148f9f33",
"peekViewEditor.matchHighlightBorder": "#148f9f79",
"peekViewEditorGutter.background": "#fff7e5",
"peekViewResult.background": "#f8efdd",
"peekViewResult.fileForeground": "#e9a149",
"peekViewResult.lineForeground": "#87a7ab",
"peekViewResult.matchHighlightBackground": "#f2edde",
"peekViewResult.selectionBackground": "#f2edde",
"peekViewResult.selectionForeground": "#6a7a7c",
"peekViewTitle.background": "#f8efdd",
"peekViewTitleDescription.foreground": "#87a7ab",
"peekViewTitleLabel.foreground": "#e9a149",
"progressBar.background": "#00c6e0",
"scrollbar.shadow": "#00000055",
"scrollbarSlider.activeBackground": "#0099adad",
"scrollbarSlider.background": "#6a90955b",
"scrollbarSlider.hoverBackground": "#0099ad62",
"gitDecoration.addedResourceForeground": "#009456",
"gitDecoration.modifiedResourceForeground": "#14b832",
"gitDecoration.deletedResourceForeground": "#ff4000",
"gitDecoration.untrackedResourceForeground": "#00c6e0",
"gitDecoration.ignoredResourceForeground": "#a8a28faa",
"gitDecoration.conflictingResourceForeground": "#e9a149",
"pickerGroup.border": "#00c6e0",
"pickerGroup.foreground": "#0099ad",
"list.activeSelectionBackground": "#b6e1e7",
"list.activeSelectionForeground": "#005661",
"list.dropBackground": "#cdcbb2",
"list.focusBackground": "#bee3ea",
"list.focusForeground": "#005661",
"list.highlightForeground": "#0099ad",
"list.hoverBackground": "#d2f3f9",
"list.hoverForeground": "#005661",
"list.inactiveFocusBackground": "#c9eaed",
"list.inactiveSelectionBackground": "#d5eef1",
"list.inactiveSelectionForeground": "#949384",
"list.errorForeground": "#c9481d",
"list.warningForeground": "#e07a52",
"listFilterWidget.background": "#d5eef1",
"listFilterWidget.outline": "#14b832",
"listFilterWidget.noMatchesOutline": "#ff4000",
"tree.indentGuidesStroke": "#d3cec5",
"settings.headerForeground": "#004d57",
"settings.modifiedItemIndicator": "#00bd23",
"settings.dropdownListBorder": "#ade2eb88",
"settings.dropdownBackground": "#f2edde",
"settings.dropdownForeground": "#0bb",
"settings.dropdownBorder": "#f2edde",
"settings.checkboxBackground": "#f2edde",
"settings.checkboxForeground": "#0bb",
"settings.checkboxBorder": "#f2edde",
"settings.textInputBackground": "#f2edde",
"settings.textInputForeground": "#0bb",
"settings.textInputBorder": "#f2edde",
"settings.numberInputBackground": "#f0e7d1",
"settings.numberInputForeground": "#5842ff",
"settings.numberInputBorder": "#f0e7d1",
"breadcrumb.foreground": "#888477",
"breadcrumb.background": "#fef8ec",
"breadcrumb.focusForeground": "#0099ad",
"breadcrumb.activeSelectionForeground": "#005661",
"breadcrumbPicker.background": "#f2edde",
"titleBar.activeBackground": "#f8efdd",
"titleBar.activeForeground": "#005661",
"titleBar.inactiveBackground": "#f8efdd",
"titleBar.inactiveForeground": "#888477",
"menu.background": "#f2edde",
"menu.foreground": "#888477",
"menu.selectionBackground": "#d2f3f9",
"menu.selectionForeground": "#0099ad",
"menu.selectionBorder": "#d2f3f9",
"menubar.selectionBackground": "#d2f3f9",
"menubar.selectionForeground": "#0099ad",
"menubar.selectionBorder": "#d2f3f9",
"editor.snippetTabstopHighlightBackground": "#fdefd3",
"editor.snippetTabstopHighlightBorder": "#fdf3dd",
"editor.snippetFinalTabstopHighlightBackground": "#fdefd3",
"editor.snippetFinalTabstopHighlightBorder": "#fdf3dd",
"minimap.findMatchHighlight": "#0099adaa",
"minimap.errorHighlight": "#ff4000ee",
"minimap.warningHighlight": "#e69533ee",
"minimapGutter.addedBackground": "#009456",
"minimapGutter.modifiedBackground": "#14b832",
"minimapGutter.deletedBackground": "#ff4000",
"minimap.background": "#fef8ec99"
},
"tokenColors": [
{
"name": "COMMENT",
"scope": [
"comment",
"punctuation.definition.comment",
"punctuation.definition.tag",
"comment.block.documentation punctuation.definition.bracket",
"source.ocaml comment constant.regexp meta.separator",
"markup.other.anchor support.constant",
"markup.fenced_code",
"markup.fenced_code punctuation.definition"
],
"settings": {
"foreground": "#8ca6a6"
}
},
{
"name": "TEXT",
"scope": [
"constant.character",
"constant.escape",
"text.html.markdown",
"punctuation.definition.list_item",
"keyword.begin.tag.ejs",
"constant.name.attribute.tag.pug",
"source.clojure meta.symbol",
"constant.other.description.jsdoc",
"keyword.other.array.phpdoc.php",
"keyword.operator.other.powershell",
"meta.link.inline punctuation.definition.string",
"source.sql",
"source meta.brace",
"source punctuation",
"text.html punctuation",
"markup meta punctuation.definition",
"meta.bracket.julia",
"meta.array.julia",
"punctuation.separator.key-value",
"entity.name.footnote",
"source.ocaml punctuation.definition.tag",
"source.ocaml entity.name.filename",
"source.reason entity.name.filename",
"entity.other.attribute-name strong",
"binding.fsharp keyword.symbol.fsharp",
"entity.name.record.field.elm",
"entity.name.record.field.accessor.elm",
"storage.modifier.array.bracket",
"source.css entity.other",
"meta.attribute-selector punctuation.definition.entity",
"markup.other.anchor string"
],
"settings": {
"foreground": "#004d57"
}
},
{
"name": "KEYWORD",
"scope": [
"keyword",
"keyword.control",
"keyword.other.template",
"keyword.other.substitution",
"storage.modifier",
"meta.tag.sgml",
"punctuation.accessor",
"constant.other.color",
"entity.name.section",
"markup.heading",
"markup.heading punctuation.definition",
"entity.other.attribute-name.pseudo-class",
"entity.other.attribute-name.pseudo-element",
"tag.decorator.js entity.name.tag.js",
"tag.decorator.js punctuation.definition.tag.js",
"storage.type.function.pug",
"text.pug storage.type",
"text.pug meta.tag.other",
"source.clojure storage.control",
"meta.expression.clojure",
"punctuation.separator.slice.python",
"punctuation.separator.question-mark.cs",
"punctuation.definition.parameters.varargs",
"source.go keyword.operator",
"punctuation.separator.pointer-access",
"punctuation.separator.other.ruby",
"keyword.package",
"keyword.import",
"punctuation.definition.keyword",
"punctuation.separator.hash.cs",
"entity.other.attribute-name.pseudo-class.css punctuation.definition.entity.css",
"entity.other.attribute-name.pseudo-element.css punctuation.definition.entity.css",
"source.kotlin storage.type.import",
"source.kotlin storage.type.package",
"constant.string.documentation.powershell",
"punctuation.section.directive",
"storage.type.rust",
"punctuation.definition.attribute",
"punctuation.definition.preprocessor",
"punctuation.separator.namespace",
"punctuation.separator.method",
"keyword.control punctuation.definition.function",
"source.ocaml variable.interpolation string",
"source.reason variable.interpolation",
"punctuation.definition.directive",
"storage.type.modifier",
"keyword.other.class.fileds",
"source.toml entity.other.attribute-name",
"source.css entity.name.tag.custom",
"sharing.modifier",
"keyword.control.class.ruby",
"keyword.control.def.ruby"
],
"settings": {
"foreground": "#ff5792"
}
},
{
"name": "VARIABLE",
"scope": [
"variable",
"variable.object",
"variable.other",
"variable.parameter",
"support",
"entity.name.module",
"variable.import.parameter",
"variable.other.class",
"meta.toc-list.id.html",
"source.json meta.structure.dictionary.json support.type.property-name.json",
"meta.var.clojure",
"entity.name.variable",
"source.java meta.class.body.java",
"entity.name.package.go",
"source.c",
"source.cpp",
"source.go",
"source.python",
"meta.function-call.arguments.python",
"source.ruby",
"source.coffee.embedded.source",
"source.coffee",
"storage.modifier.import",
"storage.modifier.package",
"storage.type.annotation",
"punctuation.definition.annotation",
"source.groovy.embedded.source",
"punctuation.definition.variable",
"source.powershell",
"string.quoted.interpolated.vala constant.character.escape.vala",
"source.apacheconf",
"source.objc",
"source.crystal",
"string.quoted.double.kotlin entity.string.template.element.kotlin",
"entity.name.package.kotlin",
"meta.template.expression.kotlin",
"parameter.variable.function",
"variable.other.constant.elixir",
"source.elixir.embedded.source",
"source.sql.embedded",
"punctuation.definition.placeholder",
"source.swift",
"source.julia",
"source.shell",
"variable.other.normal punctuation.definition.variable.shell",
"source.reason variable.language",
"source.reason variable.language string.other.link",
"source.elm meta.value",
"source.elm meta.declaration.module",
"meta.embedded.block variable punctuation.definition.variable.php",
"string.quoted.double.class.other",
"source.toml keyword",
"support.type.nim",
"source.tf meta.template.expression",
"source.scala entity.name.import",
"markup.code"
],
"settings": {
"foreground": "#f49725"
}
},
{
"name": "ANNOTATION",
"scope": [
"support.variable.property",
"constant.other.symbol.hashkey.ruby",
"constant.other.symbol.hashkey.ruby punctuation.definition.constant.ruby",
"entity.other.attribute-name.id",
"entity.other.attribute-name.id punctuation.definition.entity",
"entity.name.type.annotation.kotlin",
"support.type.primitive",
"meta.type.parameters entity.name.type",
"meta.type.annotation entity.name.type",
"punctuation.definition.typeparameters",
"source.python support.type.python",
"comment.block.documentation.phpdoc.php keyword.other.type.php",
"storage.type.php",
"keyword.type",
"storage.type.cs",
"storage.type.c",
"storage.type.objc",
"punctuation.definition.storage.type.objc",
"markup punctuation.definition",
"storage.type.powershell",
"comment.block.documentation entity.name.type",
"source.java storage.type",
"storage.type.primitive",
"source.groovy storage.type",
"storage.type.r",
"source.haskell storage.type",
"punctuation.separator.clause-head-body",
"source.go storage.type",
"storage.type.core.rust",
"storage.class.std.rust",
"storage.modifier.lifetime.rust",
"entity.name.lifetime.rust",
"support.type.vb",
"entity.name.type.kotlin",
"support.type.julia",
"constant.other.reference",
"source.graphql support.type",
"source.reason support.type string",
"entity.name.type.fsharp",
"source.elm storage.type",
"storage.type.user-defined",
"storage.type.built-in",
"support.type.builtin",
"source.swift support.type",
"support.class.crystal",
"storage.type.integral",
"source.cpp storage.type.cpp",
"source.vala storage.type",
"source.hlsl storage.type.basic",
"source.hlsl support.type.other",
"source.apex storage.type",
"source.nim storage.type",
"source.cpp entity.name.type",
"support.class.builtin",
"source.tf meta.keyword.string",
"source.tf meta.keyword.number",
"source.scala entity.name.class",
"markup.raw.monospace",
"markup.mark",
"markup.meta.attribute-list"
],
"settings": {
"foreground": "#b3694d"
}
},
{
"name": "CONSTANT",
"scope": [
"constant",
"variable.other.constant",
"support.constant",
"punctuation.definition.entity",
"constant.character.entity",
"support.variable.magic",
"markup.quote",
"entity.name.type.type-parameter.cs",
"punctuation.bracket.angle",
"entity.name.function.preprocessor.c",
"storage.type.scala",
"entity.helper.apacheconf",
"variable.language.crystal",
"punctuation.definition.constant",
"support.constant punctuation.definition.variable",
"constant.character.math",
"support.class.math",
"source.graphql constant.character",
"source.reason constant.language.list",
"source.cpp variable.other.enummember",
"support.variable.class.hideshow",
"entity.other.attribute-name.class",
"meta.attribute.id entity.other.attribute-name",
"text.html entity.other.attribute-name",
"meta.tag.attributes entity.other.attribute-name",
"text.xml entity.other.attribute-name",
"source.cs entity.other.attribute-name",
"constant.character.format.placeholder",
"constant.other.placeholder",
"source.vue entity.other.attribute-name",
"entity.other.attribute-name.mjml",
"source.vue meta.directive punctuation.separator.key-value",
"meta.definition.attribute-entry punctuation.separator"
],
"settings": {
"foreground": "#a88c00"
}
},
{
"name": "TAG",
"scope": [
"variable.language",
"variable.parameter.function.language.special",
"markup.bold",
"markup.italic",
"punctuation.definition.italic",
"punctuation.definition.bold",
"entity.name.tag",
"variable.language punctuation.definition.variable",
"keyword.control.clojure",
"support.type.exception.python",
"keyword.other.this.cs",
"keyword.other.base.cs",
"keyword.other.var.cs",
"storage.modifier.super",
"source.go keyword",
"keyword.function.go",
"meta.separator",
"keyword.other.fn.rust",
"storage.modifier.static.rust",
"source.r meta.function.r keyword.control.r",
"storage.type.def",
"meta.class.identifier storage.modifier",
"source.scala keyword.declaration",
"storage.type",
"comment.block.documentation punctuation.definition.block.tag",
"comment.block.documentation punctuation.definition.inline.tag",
"entity.tag.apacheconf",
"keyword.other.julia",
"source.julia storage.modifier",
"constant.language.empty-list.haskell",
"meta.function.powershell storage.type.powershell",
"keyword.control.fun",
"punctuation.terminator.function",
"keyword.other.rust",
"keyword.other.declaration-specifier.swift",
"keyword.control.class",
"keyword.control.def",
"source.ocaml keyword markup.underline",
"source.ocaml storage.type markup.underline",
"binding.fsharp keyword",
"function.anonymous keyword",
"function.anonymous keyword.symbol.fsharp",
"meta.embedded.block variable.language punctuation.definition.variable.php",
"keyword.declaration.dart",
"source.wsd keyword.other.class",
"source.wsd keyword.other.linebegin",
"keyword.other.skinparam.keyword",
"keyword.other.nim",
"markup.deleted.diff",
"source.tf support.class.variable",
"meta.function.lua keyword.control.lua",
"markup.italic punctuation.definition",
"markup.bold punctuation.definition",
"markup.block entity.name.tag"
],
"settings": {
"foreground": "#e64100"
}
},
{
"name": "STRING",
"scope": [
"string",
"punctuation.definition.string",
"source.css support.constant",
"entity.name.import.go",
"markup.raw.texttt",
"markup.inserted.diff",
"source.scala punctuation.definition.character",
"constant.character.literal.scala",
"source.tf entity.name"
],
"settings": {
"foreground": "#00b368"
}
},
{
"name": "STRINGINTERPOLATED",
"scope": [
"string.template",
"punctuation.definition.string.template",
"string.interpolated.python string.quoted.single.python",
"string.quoted.double.heredoc",
"string.quoted.interpolated.vala",
"string.quoted.interpolated.vala punctuation.definition.string",
"string.regexp.apacheconf",
"markup.inline.raw.string",
"markup.inline.raw punctuation.definition.raw",
"string.quoted.double.interpolated.crystal",
"string.quoted.double.interpolated.crystal punctuation.definition.string",
"text.tex markup.raw"
],
"settings": {
"foreground": "#009456"
}
},
{
"name": "NUMBER",
"scope": [
"constant.numeric",
"constant.language",
"punctuation.separator.decimal.period.php",
"keyword.operator.null-conditional.cs",
"punctuation.separator.question-mark.cs",
"constant.integer.apacheconf",
"keyword.operator.nullable-type",
"constant.language punctuation.definition.variable",
"constant.others.fsharp",
"keyword.other.unit",
"string.quoted.double.skinparam.value",
"source.toml constant"
],
"settings": {
"foreground": "#5842ff"
}
},
{
"name": "FUNCTION",
"scope": [
"variable.function",
"support.type.property-name",
"entity.name.function",
"string.other.link",
"markup.link",
"support.type.vendored",
"support.other.variable",
"meta.function-call.generic.python",
"meta.method-call.groovy meta.method.groovy",
"meta.class.body.groovy meta.method.body.java storage.type.groovy",
"punctuation.definition.decorator",
"support.function.any-method",
"text.tex support.function",
"text.tex punctuation.definition.function",
"entity.name.section.fsharp entity.name.section.fsharp",
"support.variable.class.function",
"keyword.control.cucumber.table",
"punctuation.decorator",
"source.tf support.class"
],
"settings": {
"foreground": "#0095a8"
}
},
{
"name": "SUPPORT",
"scope": [
"entity.name",
"entity.other",
"support.orther.namespace.use.php",
"meta.use.php",
"support.other.namespace.php",
"support.type",
"support.class",
"punctuation.definition.parameters",
"support.function",
"support.function.construct",
"markup.changed.git_gutter",
"markup.underline.link",
"markup.underline.link.image",
"markup.underline",
"meta.symbol.namespace.clojure",
"entity.mime-type.apacheconf",
"keyword.operator.function.infix",
"entity.name.function.infix",
"entity.name.function.call.kotlin",
"text.tex support.function.verb",
"text.tex support.function.texttt",
"source.reason constant.language.unit",
"source.ocaml constant.language constant.numeric entity.other.attribute-name.id.css",
"source.reason entity.other.attribute-name constant.language constant.numeric",
"constant.language.unit.fsharp",
"source.wsd support.class.preprocessings",
"keyword.language.gherkin.feature.scenario",
"source.nim keyword.other.common.function",
"entity.name.type.namespace",
"entity.name.scope-resolution.function.call"
],
"settings": {
"foreground": "#00bdd6"
}
},
{
"name": "MISC",
"scope": [
"source.js constant.other.object.key.js string.unquoted.label.js",
"source.js punctuation.section.embedded",
"punctuation.definition.template-expression",
"support.class",
"entity.name.type",
"storage.type.string.python",
"string.interpolated.pug",
"support.constant.handlebars",
"source.clojure punctuation.section.set",
"source.clojure punctuation.section.metadata",
"entity.global.clojure",
"source.python meta.function-call.python support.type.python",
"entity.other.inherited-class.python",
"punctuation.definition.interpolation",
"punctuation.section.embedded.begin.ruby",
"punctuation.section.embedded.end.ruby source.ruby",
"support.constant.math",
"entity.namespace.r",
"meta.method-call.groovy storage.type.groovy",
"source.scala entity.name.class.declaration",
"constant.character.escape",
"support.function.macro.julia",
"string.replacement.apacheconf",
"storage.modifier.using.vala",
"constant.other.haskell",
"source.objc entity.name.tag",
"string.quoted.other.literal.upper.crystal punctuation.definition.string",
"meta.embedded.line.crystal punctuation.section.embedded",
"meta.embedded.line.crystal punctuation.section.embedded source.crystal",
"punctuation.section.embedded",
"punctuation.section.tag",
"punctuation.section.embedded source.swift",
"variable.other.bracket punctuation.definition.variable",
"string.interpolated.dollar punctuation.definition.string",
"constant.character.escape punctuation.definition.keyword",
"source.ocaml entity.name.class constant.numeric",
"source.reason entity.name.class",
"keyword.format.specifier.fsharp",
"support.module.elm",
"meta.embedded.block.php punctuation.definition.variable.php",
"source.vala storage.type",
"support.variable.class.group",
"entity.name.type.class",
"source.tf meta.keyword.list",
"source.tf meta.keyword.map",
"entity.name.class.lua",
"markup.substitution"
],
"settings": {
"foreground": "#0094f0"
}
},
{
"name": "INVALID",
"scope": [
"invalid",
"invalid.illegal"
],
"settings": {
"foreground": "#ff530f"
}
},
{
"name": "ITALIC",
"scope": [
"comment",
"storage.modifier",
"punctuation.definition.comment",
"entity.other",
"variable.language",
"support.type.vendored",
"support.constant.vendored",
"markup.quote",
"markup.italic",
"tag.decorator.js entity.name.tag.js",
"tag.decorator.js punctuation.definition.tag.js",
"keyword.control.clojure",
"source.clojure meta.symbol.dynamic",
"keyword.other.this.cs",
"keyword.other.base.cs",
"variable.other.member.c",
"support.type.core.rust",
"variable.other.object.property",
"variable.other.property",
"source.r meta.function.r keyword.control.r",
"comment.line.roxygen.r keyword",
"comment.line.roxygen.r variable.parameter.r",
"keyword.control.inheritance.coffee",
"comment.block.documentation.phpdoc.php keyword",
"keyword.other.array.phpdoc.php",
"storage.type.modifier",
"comment.block.javadoc.java keyword",
"comment.block.javadoc.java variable.parameter.java",
"keyword.operator.documentation.powershell",
"storage.type.scala",
"variable.parameter.function.language.special",
"comment.block.documentation.scala keyword",
"comment.block.documentation.scala variable.parameter",
"support.function.builtin.go",
"constant.other.symbol.hashkey.ruby",
"constant.other.symbol.hashkey.ruby punctuation.definition.constant.ruby",
"constant.other.symbol.ruby",
"source.vala storage.type.generic",
"constant.other.table-name",
"constant.other.placeholder",
"variable.other.field",
"entity.alias.import.go",
"source.swift keyword.other.declaration-specifier",
"support.variable.swift",
"keyword.other.capture-specifier",
"text.tex support.function.emph",
"constant.other.math",
"support.function.textit",
"entity.name.footnote",
"entity.name.function.directive.graphql",
"source.graphql support.type.enum",
"source.ocaml entity.name.filename",
"source.reason entity.name.filename",
"abstract.definition.fsharp keyword",
"abstract.definition.fsharp entity",
"function.anonymous keyword",
"entity.name.record.field.accessor.elm",
"support.type.primitive",
"support.type.builtin",
"keyword.type.cs",
"storage.type.built-in",
"storage.type.primitive",
"source.python support.type.python",
"storage.type.core.rust",
"source.swift support.type",
"source.go storage.type",
"storage.type.php",
"storage.type.function.kotlin",
"entity.name.type.kotlin",
"support.type.julia",
"variable.other.member",
"keyword.other.import",
"keyword.package",
"keyword.import",
"source.wsd keyword.control.diagram",
"keyword.language.gherkin.feature.step",
"source.hlsl storage.type.basic",
"source.apex keyword.type",
"sharing.modifier",
"source.nim storage.type.concrete",
"meta.preprocessor.pragma.nim",
"storage.type.integral",
"entity.name.scope-resolution.function.call",
"support.class.builtin",
"comment.block.documentation storage.type.class",
"source.tf meta.keyword.string",
"source.tf meta.keyword.number",
"source.scala entity.name.class",
"meta.import keyword.control",
"keyword.control.export",
"source.vue meta.directive punctuation.separator.key-value",
"keyword.local.lua",
"markup.list",
"markup.mark.constrained markup.mark",
"markup.block.open"
],
"settings": {
"fontStyle": "italic"
}
},
{
"name": "BOLD",
"scope": [
"keyword",
"keyword.control",
"keyword.operator",
"keyword.other.template",
"keyword.other.substitution",
"storage.type.function.arrow",
"constant.other.color",
"punctuation.accessor",
"entity.name.section",
"markup.bold",
"markup.bold string",
"markdown.heading",
"markup.inline.raw punctuation.definition.raw",
"markup.heading",
"storage.type.function.pug",
"storage.type.function.python",
"storage.type.annotation",
"punctuation.bracket.angle",
"keyword.other.new",
"punctuation.separator.question-mark.cs",
"storage.type.generic.wildcard",
"source.go keyword.operator",
"punctuation.separator.namespace",
"constant.other.symbol.ruby punctuation.definition.constant.ruby",
"variable.parameter",
"support.function.builtin.rust",
"storage.type.function.coffee",
"entity.name.variable.parameter",
"punctuation.separator.hash.cs",
"constant.other.symbol.ruby punctuation.definition.constant.ruby",
"constant.other.symbol.hashkey.ruby punctuation.definition.constant.ruby",
"meta.function.parameters variable.other",
"entity.name.type.annotation.kotlin",
"storage.type.objc",
"parameter.variable.function",
"markup punctuation.definition",
"punctuation.section.directive",
"punctuation.definition.preprocessor",
"source.ruby punctuation.definition.variable",
"punctuation.separator.method",
"support.function.textbf",
"source.graphql support.type.builtin",
"source.ocaml variable.interpolation string",
"entity.name.function.definition.special.constructor",
"entity.name.function.definition.special.member.destructor.",
"meta.function.parameters variable punctuation.definition.variable.php",
"source.wsd keyword.other.activity",
"keyword.control.class.ruby",
"keyword.control.def.ruby",
"keyword.function.go",
"keyword.other.fn.rust",
"markup.other.anchor",
"markup.list.bullet",
"markup.list punctuation.definition"
],
"settings": {
"fontStyle": "bold"
}
},
{
"name": "BOLD-ITALIC",
"scope": [
"markup.bold markup.italic",
"markup.italic markup.bold",
"markup.quote markup.bold",
"markup.bold markup.italic string",
"markup.italic markup.bold string",
"markup.quote markup.bold string",
"text.html punctuation.section.embedded",
"variable.other.c",
"storage.modifier.lifetime.rust",
"entity.name.lifetime.rust",
"source.rust meta.attribute.rust",
"meta.attribute.id entity.other.attribute-name",
"source.ocaml punctuation.definition.tag emphasis",
"source.tf entity.name",
"markup.quote punctuation.definition",
"markup.fenced_code punctuation.definition",
"fenced_code.block.language"
],
"settings": {
"fontStyle": "bold italic"
}
},
{
"name": "NORMAL",
"scope": [
"keyword.begin.tag.ejs",
"source.python meta.function.decorator.python support.type.python",
"source.cs keyword.other",
"keyword.other.var.cs",
"source.go keyword",
"storage.modifier.static.rust",
"variable.parameter.r",
"variable.parameter.handlebars",
"storage.modifier.import",
"storage.modifier.package",
"meta.class.identifier storage.modifier",
"keyword.operator.other.powershell",
"source.css variable.parameter",
"string.interpolated variable.parameter",
"source.apacheconf keyword",
"keyword.other.julia",
"storage.modifier.using.vala",
"source.objc keyword.other.property.attribute",
"source.sql keyword.other",
"keyword.other.using.vala",
"keyword.operator.function.infix",
"keyword.control.directive",
"keyword.other.rust",
"keyword.other.declaration-specifier.swift",
"entity.name.function.swift",
"keyword.control.class",
"keyword.control.def",
"punctuation.definition.variable",
"entity.name.section.latex",
"source.ocaml keyword markup.underline",
"source.ocaml constant.language constant.numeric entity.other.attribute-name.id.css",
"source.reason entity.other.attribute-name constant.language constant.numeric",
"keyword.format.specifier.fsharp",
"entity.name.section.fsharp",
"binding.fsharp keyword",
"binding.fsharp keyword.symbol",
"record.fsharp keyword",
"keyword.symbol.fsharp",
"entity.name.section.fsharp keyword",
"namespace.open.fsharp keyword",
"namespace.open.fsharp entity",
"storage.type",
"source.cpp keyword.other",
"source.c keyword.other",
"keyword.other.unit",
"storage.modifier.array.bracket",
"keyword.control.default",
"meta.import.haskell keyword",
"keyword.declaration.dart",
"source.wsd keyword.other",
"keyword.other.skinparam",
"source.css keyword.control",
"source.css keyword.operator",
"keyword.language.gherkin.feature.scenario",
"keyword.control.cucumber.table",
"source.toml entity.other.attribute-name",
"source.toml keyword",
"keyword.other.nim",
"source.nim keyword.other.common.function",
"source.nim keyword.other",
"source.scala keyword.declaration",
"source.scala entity.name.class.declaration",
"keyword.control.lua"
],
"settings": {
"fontStyle": ""
}
}
]
}
|
{
"pile_set_name": "Github"
}
|
/*
BAREOS® - Backup Archiving REcovery Open Sourced
Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
Copyright (C) 2016-2020 Bareos GmbH & Co. KG
This program is Free Software; you can redistribute it and/or
modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
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
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
/*
* Kern Sibbald, May MM
*/
/**
* @file
* BAREOS Sock Class definition
* Note, the old non-class code is in bnet.c, and the
* new class code associated with this file is in bsock.c
*
* Zero message_length from other end indicates soft eof (usually
* end of some binary data stream, but not end of conversation).
*
* Negative message_length, is special "signal" (no data follows).
* See below for SIGNAL codes.
*/
#ifndef BAREOS_LIB_BSOCK_H_
#define BAREOS_LIB_BSOCK_H_
#include <include/bareos.h>
#include <mutex>
#include <functional>
#include <cassert>
#include "lib/address_conf.h"
#include "lib/bnet_network_dump.h"
#include "lib/tls.h"
#include "lib/s_password.h"
#include "lib/tls_conf.h"
#include "include/version_numbers.h"
struct btimer_t; /* forward reference */
class BareosSocket;
class Tls;
class BStringList;
class QualifiedResourceNameTypeConverter;
class dlist;
btimer_t* StartBsockTimer(BareosSocket* bs, uint32_t wait);
void StopBsockTimer(btimer_t* wid);
class BareosSocket {
/*
* Note, keep this public part before the private otherwise
* bat breaks on some systems such as RedHat.
*/
public:
int fd_; /* Socket file descriptor */
uint64_t read_seqno; /* Read sequence number */
POOLMEM* msg; /* Message pool buffer */
POOLMEM* errmsg; /* Edited error message */
int spool_fd_; /* Spooling file */
IPADDR* src_addr; /* IP address to source connections from */
uint32_t in_msg_no; /* Input message number */
uint32_t out_msg_no; /* Output message number */
int32_t message_length; /* Message length */
volatile time_t timer_start; /* Time started read/write */
int b_errno; /* BareosSocket errno */
int blocking_; /* Blocking state (0 = nonblocking, 1 = blocking) */
volatile int errors; /* Incremented for each error on socket */
volatile bool suppress_error_msgs_; /* Set to suppress error messages */
int sleep_time_after_authentication_error;
struct sockaddr client_addr; /* Client's IP address */
struct sockaddr_in peer_addr; /* Peer's IP address */
void SetTlsEstablished() { tls_established_ = true; }
bool TlsEstablished() const { return tls_established_; }
std::shared_ptr<Tls> tls_conn; /* Associated tls connection */
std::unique_ptr<Tls> tls_conn_init; /* during initialization */
BareosVersionNumber connected_daemon_version_;
protected:
JobControlRecord* jcr_; /* JobControlRecord or NULL for error msgs */
std::shared_ptr<std::mutex> mutex_;
char* who_; /* Name of daemon to which we are talking */
char* host_; /* Host name/IP */
int port_; /* Desired port */
btimer_t* tid_; /* Timer id */
boffset_t data_end_; /* Offset of last valid data written */
int32_t FileIndex_; /* Last valid attr spool FI */
bool timed_out_; /* Timed out in read/write */
bool terminated_; /* Set when BNET_TERMINATE arrives */
bool cloned_; /* Set if cloned BareosSocket */
bool spool_; /* Set for spooling */
bool use_bursting_; /* Set to use bandwidth bursting */
bool use_keepalive_; /* Set to use keepalive on the socket */
int64_t bwlimit_; /* Set to limit bandwidth */
int64_t nb_bytes_; /* Bytes sent/recv since the last tick */
btime_t last_tick_; /* Last tick used by bwlimit */
bool tls_established_; /* is true when tls connection is established */
std::unique_ptr<BnetDump> bnet_dump_;
virtual void FinInit(JobControlRecord* jcr,
int sockfd,
const char* who,
const char* host,
int port,
struct sockaddr* lclient_addr) = 0;
virtual bool open(JobControlRecord* jcr,
const char* name,
const char* host,
char* service,
int port,
utime_t heart_beat,
int* fatal) = 0;
private:
bool TwoWayAuthenticate(JobControlRecord* jcr,
const std::string own_qualified_name,
const char* identity,
s_password& password,
TlsResource* tls_resource,
bool initiated_by_remote);
bool DoTlsHandshakeWithClient(TlsConfigCert* local_tls_cert,
JobControlRecord* jcr);
bool DoTlsHandshakeWithServer(TlsConfigCert* local_tls_cert,
const char* identity,
const char* password,
JobControlRecord* jcr);
void ParameterizeTlsCert(Tls* tls_conn, TlsResource* tls_resource);
void SetBnetDump(std::unique_ptr<BnetDump>&& bnet_dump)
{
// do not set twice
assert(!bnet_dump_);
bnet_dump_ = std::move(bnet_dump);
}
public:
BareosSocket();
BareosSocket(const BareosSocket& other);
virtual ~BareosSocket();
/* Methods -- in bsock.c */
// void free_bsock();
void CloseTlsConnectionAndFreeMemory();
virtual BareosSocket* clone() = 0;
virtual bool connect(JobControlRecord* jcr,
int retry_interval,
utime_t max_retry_time,
utime_t heart_beat,
const char* name,
const char* host,
char* service,
int port,
bool verbose) = 0;
virtual int32_t recv() = 0;
virtual bool send() = 0;
virtual int32_t read_nbytes(char* ptr, int32_t nbytes) = 0;
virtual int32_t write_nbytes(char* ptr, int32_t nbytes) = 0;
virtual void close() = 0; /* close connection and destroy packet */
virtual void destroy() = 0; /* destroy socket packet */
virtual int GetPeer(char* buf, socklen_t buflen) = 0;
virtual bool SetBufferSize(uint32_t size, int rw) = 0;
virtual int SetNonblocking() = 0;
virtual int SetBlocking() = 0;
virtual void RestoreBlocking(int flags) = 0;
virtual bool ConnectionReceivedTerminateSignal() = 0;
/*
* Returns: 1 if data available, 0 if timeout, -1 if error
*/
virtual int WaitData(int sec, int usec = 0) = 0;
virtual int WaitDataIntr(int sec, int usec = 0) = 0;
bool fsend(const char*, ...);
bool vfsend(const char* fmt, va_list ap);
bool send(const char* msg_in, uint32_t nbytes);
void SetKillable(bool killable);
bool signal(int signal);
const char* bstrerror(); /* last error on socket */
bool despool(void UpdateAttrSpoolSize(ssize_t size), ssize_t tsize);
bool ConsoleAuthenticateWithDirector(JobControlRecord* jcr,
const char* name,
s_password& password,
TlsResource* tls_resource,
const std::string& own_qualified_name,
BStringList& response_args,
uint32_t& response_id);
bool ParameterizeAndInitTlsConnection(TlsResource* tls_resource,
const char* identity,
const char* password,
bool initiated_by_remote);
bool ParameterizeAndInitTlsConnectionAsAServer(ConfigurationParser* config);
bool DoTlsHandshake(TlsPolicy remote_tls_policy,
TlsResource* tls_resource,
bool initiated_by_remote,
const char* identity,
const char* password,
JobControlRecord* jcr);
bool DoTlsHandshakeAsAServer(ConfigurationParser* config,
JobControlRecord* jcr = nullptr);
bool SetLocking(); /* in bsock.c */
void ClearLocking(); /* in bsock.c */
void SetSourceAddress(dlist* src_addr_list);
void ControlBwlimit(int bytes); /* in bsock.c */
bool EvaluateCleartextBareosHello(bool& cleartext,
std::string& client_name_out,
std::string& r_code_str_out,
BareosVersionNumber& version_out) const;
void OutputCipherMessageString(std::function<void(const char*)>);
void GetCipherMessageString(std::string& str) const;
bool ReceiveAndEvaluateResponseMessage(uint32_t& id_out,
BStringList& args_out);
bool FormatAndSendResponseMessage(uint32_t id,
const BStringList& list_of_agruments);
bool FormatAndSendResponseMessage(uint32_t id, const std::string& str);
bool AuthenticateOutboundConnection(JobControlRecord* jcr,
const std::string own_qualified_name,
const char* identity,
s_password& password,
TlsResource* tls_resource);
bool AuthenticateInboundConnection(JobControlRecord* jcr,
ConfigurationParser* my_config,
const char* name,
s_password& password,
TlsResource* tls_resource);
void SetJcr(JobControlRecord* jcr) { jcr_ = jcr; }
void SetWho(char* who) { who_ = who; }
void SetHost(char* host) { host_ = host; }
void SetPort(int port) { port_ = port; }
char* who() { return who_; }
char* host() { return host_; }
int port() { return port_; }
JobControlRecord* jcr() { return jcr_; }
JobControlRecord* get_jcr() { return jcr_; }
bool IsSpooling() { return spool_; }
bool IsTerminated() { return terminated_; }
bool IsTimedOut() { return timed_out_; }
bool IsStop() { return errors || IsTerminated(); }
bool IsError()
{
errno = b_errno;
return errors;
}
void SetDataEnd(int32_t FileIndex)
{
if (spool_ && FileIndex > FileIndex_) {
FileIndex_ = FileIndex - 1;
data_end_ = lseek(spool_fd_, 0, SEEK_CUR);
}
}
boffset_t get_data_end() { return data_end_; }
int32_t get_FileIndex() { return FileIndex_; }
void SetBwlimit(int64_t maxspeed) { bwlimit_ = maxspeed; }
bool UseBwlimit() { return bwlimit_ > 0; }
void SetBwlimitBursting() { use_bursting_ = true; }
void clear_bwlimit_bursting() { use_bursting_ = false; }
void SetSpooling() { spool_ = true; }
void ClearSpooling() { spool_ = false; }
void SetTimedOut() { timed_out_ = true; }
void ClearTimedOut() { timed_out_ = false; }
void SetTerminated() { terminated_ = true; }
void StartTimer(int sec) { tid_ = StartBsockTimer(this, sec); }
void StopTimer() { StopBsockTimer(tid_); }
void LockMutex();
void UnlockMutex();
void InitBnetDump(std::string own_qualified_name);
void SetBnetDumpDestinationQualifiedName(
std::string destination_qualified_name);
bool IsBnetDumpEnabled() const { return bnet_dump_.get() != nullptr; }
};
/**
* Signal definitions for use in BnetSig()
* Note! These must be negative. There are signals that are generated
* by the bsock software not by the OS ...
*/
enum
{
BNET_EOD = -1, /* End of data stream, new data may follow */
BNET_EOD_POLL = -2, /* End of data and poll all in one */
BNET_STATUS = -3, /* Send full status */
BNET_TERMINATE = -4, /* Conversation terminated, doing close() */
BNET_POLL = -5, /* Poll request, I'm hanging on a read */
BNET_HEARTBEAT = -6, /* Heartbeat Response requested */
BNET_HB_RESPONSE = -7, /* Only response permited to HB */
BNET_xxxxxxPROMPT = -8, /* No longer used -- Prompt for subcommand */
BNET_BTIME = -9, /* Send UTC btime */
BNET_BREAK = -10, /* Stop current command -- ctl-c */
BNET_START_SELECT = -11, /* Start of a selection list */
BNET_END_SELECT = -12, /* End of a select list */
BNET_INVALID_CMD = -13, /* Invalid command sent */
BNET_CMD_FAILED = -14, /* Command failed */
BNET_CMD_OK = -15, /* Command succeeded */
BNET_CMD_BEGIN = -16, /* Start command execution */
BNET_MSGS_PENDING = -17, /* Messages pending */
BNET_MAIN_PROMPT = -18, /* Server ready and waiting */
BNET_SELECT_INPUT = -19, /* Return selection input */
BNET_WARNING_MSG = -20, /* Warning message */
BNET_ERROR_MSG = -21, /* Error message -- command failed */
BNET_INFO_MSG = -22, /* Info message -- status line */
BNET_RUN_CMD = -23, /* Run command follows */
BNET_YESNO = -24, /* Request yes no response */
BNET_START_RTREE = -25, /* Start restore tree mode */
BNET_END_RTREE = -26, /* End restore tree mode */
BNET_SUB_PROMPT = -27, /* Indicate we are at a subprompt */
BNET_TEXT_INPUT = -28 /* Get text input from user */
};
#define BNET_SETBUF_READ 1 /* Arg for BnetSetBufferSize */
#define BNET_SETBUF_WRITE 2 /* Arg for BnetSetBufferSize */
/**
* Return status from BnetRecv()
* Note, the HARDEOF and ERROR refer to comm status/problems
* rather than the BNET_xxx above, which are software signals.
*/
enum
{
BNET_SIGNAL = -1,
BNET_HARDEOF = -2,
BNET_ERROR = -3
};
#endif /* BAREOS_LIB_BSOCK_H_ */
|
{
"pile_set_name": "Github"
}
|
/**
* SHA-512 routines supporting the Power 7+ Nest Accelerators driver
*
* Copyright (C) 2011-2012 International Business Machines Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 only.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Kent Yoder <yoder1@us.ibm.com>
*/
#include <crypto/internal/hash.h>
#include <crypto/sha.h>
#include <linux/module.h>
#include <asm/vio.h>
#include "nx_csbcpb.h"
#include "nx.h"
static int nx_crypto_ctx_sha512_init(struct crypto_tfm *tfm)
{
struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(tfm);
int err;
err = nx_crypto_ctx_sha_init(tfm);
if (err)
return err;
nx_ctx_init(nx_ctx, HCOP_FC_SHA);
nx_ctx->ap = &nx_ctx->props[NX_PROPS_SHA512];
NX_CPB_SET_DIGEST_SIZE(nx_ctx->csbcpb, NX_DS_SHA512);
return 0;
}
static int nx_sha512_init(struct shash_desc *desc)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
memset(sctx, 0, sizeof *sctx);
sctx->state[0] = __cpu_to_be64(SHA512_H0);
sctx->state[1] = __cpu_to_be64(SHA512_H1);
sctx->state[2] = __cpu_to_be64(SHA512_H2);
sctx->state[3] = __cpu_to_be64(SHA512_H3);
sctx->state[4] = __cpu_to_be64(SHA512_H4);
sctx->state[5] = __cpu_to_be64(SHA512_H5);
sctx->state[6] = __cpu_to_be64(SHA512_H6);
sctx->state[7] = __cpu_to_be64(SHA512_H7);
sctx->count[0] = 0;
return 0;
}
static int nx_sha512_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base);
struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb;
struct nx_sg *out_sg;
u64 to_process, leftover = 0, total;
unsigned long irq_flags;
int rc = 0;
int data_len;
u32 max_sg_len;
u64 buf_len = (sctx->count[0] % SHA512_BLOCK_SIZE);
spin_lock_irqsave(&nx_ctx->lock, irq_flags);
/* 2 cases for total data len:
* 1: < SHA512_BLOCK_SIZE: copy into state, return 0
* 2: >= SHA512_BLOCK_SIZE: process X blocks, copy in leftover
*/
total = (sctx->count[0] % SHA512_BLOCK_SIZE) + len;
if (total < SHA512_BLOCK_SIZE) {
memcpy(sctx->buf + buf_len, data, len);
sctx->count[0] += len;
goto out;
}
memcpy(csbcpb->cpb.sha512.message_digest, sctx->state, SHA512_DIGEST_SIZE);
NX_CPB_FDM(csbcpb) |= NX_FDM_INTERMEDIATE;
NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION;
max_sg_len = min_t(u64, nx_ctx->ap->sglen,
nx_driver.of.max_sg_len/sizeof(struct nx_sg));
max_sg_len = min_t(u64, max_sg_len,
nx_ctx->ap->databytelen/NX_PAGE_SIZE);
data_len = SHA512_DIGEST_SIZE;
out_sg = nx_build_sg_list(nx_ctx->out_sg, (u8 *)sctx->state,
&data_len, max_sg_len);
nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg);
if (data_len != SHA512_DIGEST_SIZE) {
rc = -EINVAL;
goto out;
}
do {
int used_sgs = 0;
struct nx_sg *in_sg = nx_ctx->in_sg;
if (buf_len) {
data_len = buf_len;
in_sg = nx_build_sg_list(in_sg,
(u8 *) sctx->buf,
&data_len, max_sg_len);
if (data_len != buf_len) {
rc = -EINVAL;
goto out;
}
used_sgs = in_sg - nx_ctx->in_sg;
}
/* to_process: SHA512_BLOCK_SIZE aligned chunk to be
* processed in this iteration. This value is restricted
* by sg list limits and number of sgs we already used
* for leftover data. (see above)
* In ideal case, we could allow NX_PAGE_SIZE * max_sg_len,
* but because data may not be aligned, we need to account
* for that too. */
to_process = min_t(u64, total,
(max_sg_len - 1 - used_sgs) * NX_PAGE_SIZE);
to_process = to_process & ~(SHA512_BLOCK_SIZE - 1);
data_len = to_process - buf_len;
in_sg = nx_build_sg_list(in_sg, (u8 *) data,
&data_len, max_sg_len);
nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg);
if (data_len != (to_process - buf_len)) {
rc = -EINVAL;
goto out;
}
to_process = data_len + buf_len;
leftover = total - to_process;
/*
* we've hit the nx chip previously and we're updating
* again, so copy over the partial digest.
*/
memcpy(csbcpb->cpb.sha512.input_partial_digest,
csbcpb->cpb.sha512.message_digest,
SHA512_DIGEST_SIZE);
if (!nx_ctx->op.inlen || !nx_ctx->op.outlen) {
rc = -EINVAL;
goto out;
}
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
if (rc)
goto out;
atomic_inc(&(nx_ctx->stats->sha512_ops));
total -= to_process;
data += to_process - buf_len;
buf_len = 0;
} while (leftover >= SHA512_BLOCK_SIZE);
/* copy the leftover back into the state struct */
if (leftover)
memcpy(sctx->buf, data, leftover);
sctx->count[0] += len;
memcpy(sctx->state, csbcpb->cpb.sha512.message_digest, SHA512_DIGEST_SIZE);
out:
spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);
return rc;
}
static int nx_sha512_final(struct shash_desc *desc, u8 *out)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(&desc->tfm->base);
struct nx_csbcpb *csbcpb = (struct nx_csbcpb *)nx_ctx->csbcpb;
struct nx_sg *in_sg, *out_sg;
u32 max_sg_len;
u64 count0;
unsigned long irq_flags;
int rc = 0;
int len;
spin_lock_irqsave(&nx_ctx->lock, irq_flags);
max_sg_len = min_t(u64, nx_ctx->ap->sglen,
nx_driver.of.max_sg_len/sizeof(struct nx_sg));
max_sg_len = min_t(u64, max_sg_len,
nx_ctx->ap->databytelen/NX_PAGE_SIZE);
/* final is represented by continuing the operation and indicating that
* this is not an intermediate operation */
if (sctx->count[0] >= SHA512_BLOCK_SIZE) {
/* we've hit the nx chip previously, now we're finalizing,
* so copy over the partial digest */
memcpy(csbcpb->cpb.sha512.input_partial_digest, sctx->state,
SHA512_DIGEST_SIZE);
NX_CPB_FDM(csbcpb) &= ~NX_FDM_INTERMEDIATE;
NX_CPB_FDM(csbcpb) |= NX_FDM_CONTINUATION;
} else {
NX_CPB_FDM(csbcpb) &= ~NX_FDM_INTERMEDIATE;
NX_CPB_FDM(csbcpb) &= ~NX_FDM_CONTINUATION;
}
NX_CPB_FDM(csbcpb) &= ~NX_FDM_INTERMEDIATE;
count0 = sctx->count[0] * 8;
csbcpb->cpb.sha512.message_bit_length_lo = count0;
len = sctx->count[0] & (SHA512_BLOCK_SIZE - 1);
in_sg = nx_build_sg_list(nx_ctx->in_sg, sctx->buf, &len,
max_sg_len);
if (len != (sctx->count[0] & (SHA512_BLOCK_SIZE - 1))) {
rc = -EINVAL;
goto out;
}
len = SHA512_DIGEST_SIZE;
out_sg = nx_build_sg_list(nx_ctx->out_sg, out, &len,
max_sg_len);
nx_ctx->op.inlen = (nx_ctx->in_sg - in_sg) * sizeof(struct nx_sg);
nx_ctx->op.outlen = (nx_ctx->out_sg - out_sg) * sizeof(struct nx_sg);
if (!nx_ctx->op.outlen) {
rc = -EINVAL;
goto out;
}
rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
if (rc)
goto out;
atomic_inc(&(nx_ctx->stats->sha512_ops));
atomic64_add(sctx->count[0], &(nx_ctx->stats->sha512_bytes));
memcpy(out, csbcpb->cpb.sha512.message_digest, SHA512_DIGEST_SIZE);
out:
spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);
return rc;
}
static int nx_sha512_export(struct shash_desc *desc, void *out)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
memcpy(out, sctx, sizeof(*sctx));
return 0;
}
static int nx_sha512_import(struct shash_desc *desc, const void *in)
{
struct sha512_state *sctx = shash_desc_ctx(desc);
memcpy(sctx, in, sizeof(*sctx));
return 0;
}
struct shash_alg nx_shash_sha512_alg = {
.digestsize = SHA512_DIGEST_SIZE,
.init = nx_sha512_init,
.update = nx_sha512_update,
.final = nx_sha512_final,
.export = nx_sha512_export,
.import = nx_sha512_import,
.descsize = sizeof(struct sha512_state),
.statesize = sizeof(struct sha512_state),
.base = {
.cra_name = "sha512",
.cra_driver_name = "sha512-nx",
.cra_priority = 300,
.cra_flags = CRYPTO_ALG_TYPE_SHASH,
.cra_blocksize = SHA512_BLOCK_SIZE,
.cra_module = THIS_MODULE,
.cra_ctxsize = sizeof(struct nx_crypto_ctx),
.cra_init = nx_crypto_ctx_sha512_init,
.cra_exit = nx_crypto_ctx_exit,
}
};
|
{
"pile_set_name": "Github"
}
|
// 20010613 gdr
// Copyright (C) 2001-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// This is DR-253. Test for accessible assignment-operators.
#include <valarray>
#include <testsuite_hooks.h>
int main()
{
bool test __attribute__((unused)) = true;
using std::valarray;
using std::slice;
valarray<int> v(1, 10), w(2, 10);
w[slice(0, 3, 3)] = v[slice(2, 3, 3)];
VERIFY(v[0] == 1 && w[0] == 1);
VERIFY(v[3] == 1 && w[3] == 1);
VERIFY(v[6] == 1 && w[6] == 1);
std::slice_array<int> t __attribute__((unused)) = v[slice(0, 10, 1)];
return 0;
}
|
{
"pile_set_name": "Github"
}
|
///////////////////////////////////////////////////////////////////////////////
// Name: src/common/base64.cpp
// Purpose: implementation of BASE64 encoding/decoding functions
// Author: Charles Reimers, Vadim Zeitlin
// Created: 2007-06-18
// RCS-ID: $Id$
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_BASE64
#include "wx/base64.h"
size_t
wxBase64Encode(char *dst, size_t dstLen, const void *src_, size_t srcLen)
{
wxCHECK_MSG( src_, wxCONV_FAILED, wxT("NULL input buffer") );
const unsigned char *src = static_cast<const unsigned char *>(src_);
static const char b64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
size_t encLen = 0;
// encode blocks of 3 bytes into 4 base64 characters
for ( ; srcLen >= 3; srcLen -= 3, src += 3 )
{
encLen += 4;
if ( dst )
{
if ( encLen > dstLen )
return wxCONV_FAILED;
*dst++ = b64[src[0] >> 2];
*dst++ = b64[((src[0] & 0x03) << 4) | ((src[1] & 0xf0) >> 4)];
*dst++ = b64[((src[1] & 0x0f) << 2) | ((src[2] & 0xc0) >> 6)];
*dst++ = b64[src[2] & 0x3f];
}
}
// finish with the remaining characters
if ( srcLen )
{
encLen += 4;
if ( dst )
{
if ( encLen > dstLen )
return wxCONV_FAILED;
// we have definitely one and maybe two bytes remaining
unsigned char next = srcLen == 2 ? src[1] : 0;
*dst++ = b64[src[0] >> 2];
*dst++ = b64[((src[0] & 0x03) << 4) | ((next & 0xf0) >> 4)];
*dst++ = srcLen == 2 ? b64[((next & 0x0f) << 2)] : '=';
*dst = '=';
}
}
return encLen;
}
size_t
wxBase64Decode(void *dst_, size_t dstLen,
const char *src, size_t srcLen,
wxBase64DecodeMode mode,
size_t *posErr)
{
wxCHECK_MSG( src, wxCONV_FAILED, wxT("NULL input buffer") );
unsigned char *dst = static_cast<unsigned char *>(dst_);
size_t decLen = 0;
if ( srcLen == wxNO_LEN )
srcLen = strlen(src);
// this table contains the values, in base 64, of all valid characters and
// special values WSP or INV for white space and invalid characters
// respectively as well as a special PAD value for '='
enum
{
WSP = 200,
INV,
PAD
};
static const unsigned char decode[256] =
{
WSP,INV,INV,INV,INV,INV,INV,INV,INV,WSP,WSP,INV,WSP,WSP,INV,INV,
INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,
WSP,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,076,INV,INV,INV,077,
064,065,066,067,070,071,072,073,074,075,INV,INV,INV,PAD,INV,INV,
INV,000,001,002,003,004,005,006,007,010,011,012,013,014,015,016,
017,020,021,022,023,024,025,026,027,030,031,INV,INV,INV,INV,INV,
INV,032,033,034,035,036,037,040,041,042,043,044,045,046,047,050,
051,052,053,054,055,056,057,060,061,062,063,INV,INV,INV,INV,INV,
INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,
INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,
INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,
INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,
INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,
INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,
INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,
INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,INV,
};
// we decode input by groups of 4 characters but things are complicated by
// the fact that there can be whitespace and other junk in it too so keep
// record of where exactly we're inside the current quartet in this var
int n = 0;
unsigned char in[4]; // current quartet
bool end = false; // set when we find padding
size_t padLen = 0; // length lost to padding
const char *p;
for ( p = src; srcLen; p++, srcLen-- )
{
const unsigned char c = decode[static_cast<unsigned char>(*p)];
switch ( c )
{
case WSP:
if ( mode == wxBase64DecodeMode_SkipWS )
continue;
// fall through
case INV:
if ( mode == wxBase64DecodeMode_Relaxed )
continue;
// force the loop to stop and an error to be returned
n = -1;
srcLen = 1;
break;
case PAD:
// set the flag telling us that we're past the end now
end = true;
// there can be either a single '=' at the end of a quartet or
// "==" in positions 2 and 3
if ( n == 3 )
{
padLen = 1;
in[n++] = '\0';
}
else if ( (n == 2) && (--srcLen && *++p == '=') )
{
padLen = 2;
in[n++] = '\0';
in[n++] = '\0';
}
else // invalid padding
{
// force the loop terminate with an error
n = -1;
srcLen = 1;
}
break;
default:
if ( end )
{
// nothing is allowed after the end so provoke error return
n = -1;
srcLen = 1;
break;
}
in[n++] = c;
}
if ( n == 4 )
{
// got entire block, decode
decLen += 3 - padLen;
if ( dst )
{
if ( decLen > dstLen )
return wxCONV_FAILED;
// undo the bit shifting done during encoding
*dst++ = in[0] << 2 | in[1] >> 4;
// be careful to not overwrite the output buffer with NUL pad
// bytes
if ( padLen != 2 )
{
*dst++ = in[1] << 4 | in[2] >> 2;
if ( !padLen )
*dst++ = in[2] << 6 | in[3];
}
}
n = 0;
}
}
if ( n )
{
if ( posErr )
{
// notice that the error was on a previous position as we did one
// extra "p++" in the loop line after it
*posErr = p - src - 1;
}
return wxCONV_FAILED;
}
return decLen;
}
wxMemoryBuffer wxBase64Decode(const char *src,
size_t srcLen,
wxBase64DecodeMode mode,
size_t *posErr)
{
wxMemoryBuffer buf;
wxCHECK_MSG( src, buf, wxT("NULL input buffer") );
if ( srcLen == wxNO_LEN )
srcLen = strlen(src);
size_t len = wxBase64DecodedSize(srcLen);
len = wxBase64Decode(buf.GetWriteBuf(len), len, src, srcLen, mode, posErr);
if ( len == wxCONV_FAILED )
len = 0;
buf.SetDataLen(len);
return buf;
}
#endif // wxUSE_BASE64
|
{
"pile_set_name": "Github"
}
|
package logisticspipes.network;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import logisticspipes.LogisticsPipes;
import logisticspipes.network.abstractguis.GuiProvider;
import logisticspipes.network.abstractguis.PopupGuiProvider;
import logisticspipes.network.exception.TargetNotFoundException;
import logisticspipes.network.packets.gui.OpenGUIPacket;
import logisticspipes.proxy.MainProxy;
import logisticspipes.utils.StaticResolverUtil;
import logisticspipes.utils.gui.LogisticsBaseGuiScreen;
import logisticspipes.utils.gui.SubGuiScreen;
import network.rs485.logisticspipes.util.LPDataIOWrapper;
public class NewGuiHandler {
public static List<GuiProvider> guilist;
public static Map<Class<? extends GuiProvider>, GuiProvider> guimap;
private NewGuiHandler() { }
@SuppressWarnings("unchecked") // Suppressed because this cast should never fail.
public static <T extends GuiProvider> T getGui(Class<T> clazz) {
return (T) NewGuiHandler.guimap.get(clazz).template();
}
public static void initialize() {
Set<Class<? extends GuiProvider>> classes = StaticResolverUtil.findClassesByType(GuiProvider.class);
loadGuiProviders(classes);
if (NewGuiHandler.guilist == null || NewGuiHandler.guilist.isEmpty()) {
throw new RuntimeException("Cannot load GuiProvider Classes");
}
}
private static void loadGuiProviders(Set<Class<? extends GuiProvider>> classesIn) {
List<Class<? extends GuiProvider>> classes = classesIn.stream()
.sorted(Comparator.comparing(Class::getCanonicalName))
.collect(Collectors.toList());
NewGuiHandler.guilist = new ArrayList<>(classes.size());
NewGuiHandler.guimap = new HashMap<>(classes.size());
int currentId = 0;
for (Class<? extends GuiProvider> cls : classes) {
try {
final GuiProvider instance = (GuiProvider) cls.getConstructors()[0].newInstance(currentId);
NewGuiHandler.guilist.add(instance);
NewGuiHandler.guimap.put(cls, instance);
currentId++;
} catch (Throwable ignoredButPrinted) {
ignoredButPrinted.printStackTrace();
}
}
}
public static void openGui(GuiProvider guiProvider, EntityPlayer oPlayer) {
if (!(oPlayer instanceof EntityPlayerMP)) {
throw new UnsupportedOperationException("Gui can only be opened on the server side");
}
EntityPlayerMP player = (EntityPlayerMP) oPlayer;
Container container = guiProvider.getContainer(player);
if (container == null) {
if (guiProvider instanceof PopupGuiProvider) {
OpenGUIPacket packet = PacketHandler.getPacket(OpenGUIPacket.class);
packet.setGuiID(guiProvider.getId());
packet.setWindowID(-2);
packet.setGuiData(LPDataIOWrapper.collectData(guiProvider::writeData));
MainProxy.sendPacketToPlayer(packet, player);
}
return;
}
player.getNextWindowId();
player.closeContainer();
int windowId = player.currentWindowId;
OpenGUIPacket packet = PacketHandler.getPacket(OpenGUIPacket.class);
packet.setGuiID(guiProvider.getId());
packet.setWindowID(windowId);
packet.setGuiData(LPDataIOWrapper.collectData(guiProvider::writeData));
MainProxy.sendPacketToPlayer(packet, player);
player.openContainer = container;
player.openContainer.windowId = windowId;
player.openContainer.addListener(player);
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(player, player.openContainer));
}
@SideOnly(Side.CLIENT)
public static void openGui(OpenGUIPacket packet, EntityPlayer player) {
int guiID = packet.getGuiID();
GuiProvider provider = NewGuiHandler.guilist.get(guiID).template();
LPDataIOWrapper.provideData(packet.getGuiData(), provider::readData);
if (provider instanceof PopupGuiProvider && packet.getWindowID() == -2) {
if (FMLClientHandler.instance().getClient().currentScreen instanceof LogisticsBaseGuiScreen) {
LogisticsBaseGuiScreen baseGUI = (LogisticsBaseGuiScreen) FMLClientHandler.instance().getClient().currentScreen;
SubGuiScreen newSub;
try {
newSub = (SubGuiScreen) provider.getClientGui(player);
} catch (TargetNotFoundException e) {
throw e;
} catch (Exception e) {
LogisticsPipes.log.error(packet.getClass().getName());
LogisticsPipes.log.error(packet.toString());
throw new RuntimeException(e);
}
if (newSub != null) {
if (!baseGUI.hasSubGui()) {
baseGUI.setSubGui(newSub);
} else {
SubGuiScreen canidate = baseGUI.getSubGui();
while (canidate.hasSubGui()) {
canidate = canidate.getSubGui();
}
canidate.setSubGui(newSub);
}
}
}
} else {
GuiContainer screen;
try {
screen = (GuiContainer) provider.getClientGui(player);
} catch (TargetNotFoundException e) {
throw e;
} catch (Exception e) {
LogisticsPipes.log.error(packet.getClass().getName());
LogisticsPipes.log.error(packet.toString());
throw new RuntimeException(e);
}
screen.inventorySlots.windowId = packet.getWindowID();
FMLCommonHandler.instance().showGuiScreen(screen);
}
}
}
|
{
"pile_set_name": "Github"
}
|
struct S1 {
unsigned char f0;
short f1;
};
struct S1 g_77 = {0x73,9};
struct S1 * volatile g_85 = &g_77;
struct S1 g_204 = {0xAD,0x9086};
void func_1(void)
{
*g_85 = g_204;
}
|
{
"pile_set_name": "Github"
}
|
GL_EXT_texture_compression_latc
http://developer.download.nvidia.com/opengl/specs/GL_EXT_texture_compression_latc.txt
GL_EXT_texture_compression_latc
GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
|
{
"pile_set_name": "Github"
}
|
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
CHOST="i686-gentoo-linux-uclibc"
# Anthony G. Basile <blueness@gentoo.org> (2014-07-01)
# Multilib-related setup, bug #515130
MULTILIB_ABIS="x86"
CHOST_x86="${CHOST}"
LIBDIR_x86="lib"
|
{
"pile_set_name": "Github"
}
|
// Dependent component styles from node_modules
@import 'ej2-base/styles/material-dark.scss';
@import 'ej2-inputs/styles/material-dark.scss';
@import 'ej2-buttons/styles/material-dark.scss';
@import 'ej2-dropdowns/styles/material-dark.scss';
@import 'ej2-popups/styles/material-dark.scss';
@import 'ej2-lists/styles/material-dark.scss';
@import 'ej2-splitbuttons/styles/material-dark.scss';
@import 'ej2-navigations/styles/material-dark.scss';
@import 'ej2-calendars/styles/material-dark.scss';
// Local dependent component styles from current repository
@import '../styles/material-dark.scss';
|
{
"pile_set_name": "Github"
}
|
// -*- C++ -*-
// Copyright (C) 2007-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file parallel/parallel.h
* @brief End-user include file. Provides advanced settings and
* tuning options.
* This file is a GNU parallel extension to the Standard C++ Library.
*/
// Written by Felix Putze and Johannes Singler.
#ifndef _GLIBCXX_PARALLEL_PARALLEL_H
#define _GLIBCXX_PARALLEL_PARALLEL_H 1
#include <parallel/features.h>
#include <parallel/compiletime_settings.h>
#include <parallel/types.h>
#include <parallel/tags.h>
#include <parallel/settings.h>
#endif /* _GLIBCXX_PARALLEL_PARALLEL_H */
|
{
"pile_set_name": "Github"
}
|
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <objbase.h>
#include "MainWnd.hpp"
#include "SteamCAD.rh"
//HANDLE g_hConsole;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR szCmdLine, int iCmdShow)
{
CoInitialize(NULL);
/*AllocConsole();
g_hConsole = CreateConsoleScreenBuffer(GENERIC_WRITE, FILE_SHARE_READ,
NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
SetConsoleMode(g_hConsole, ENABLE_PROCESSED_OUTPUT);
SetConsoleActiveScreenBuffer(g_hConsole);*/
INITCOMMONCONTROLSEX ictr;
ictr.dwSize = sizeof(INITCOMMONCONTROLSEX);
//ictr.dwICC = ICC_STANDARD_CLASSES | ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES |
// ICC_TAB_CLASSES | ICC_PAGESCROLLER_CLASS;
ictr.dwICC = ICC_BAR_CLASSES;
InitCommonControlsEx(&ictr);
CMainWnd *mw = new CMainWnd(hInstance);
HWND wnd = mw->DisplayWindow();
if(!wnd)
{
DWORD dwErr = GetLastError();
wchar_t buf[64];
swprintf(buf, L"Error: %.8X", dwErr);
//FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, dwErr, 0, buf, 64, 0);
MessageBox(0, buf, L"Error", MB_OK);
delete mw;
ExitProcess(0);
return(0);
}
HACCEL hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(1));
ShowWindow(wnd, SW_SHOW);
MSG msg;
BOOL res, finish = FALSE;
while(!finish)
{
res = GetMessage(&msg, 0, 0, 0);
if (!TranslateAccelerator(wnd, hAccel, &msg))
{
switch (res)
{
case -1:
MessageBox(wnd, L"Error?", L"Debug", MB_OK);
case 0:
finish = true;
default:
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
delete mw;
//FreeConsole();
CoUninitialize();
ExitProcess(0);
return(0);
}
|
{
"pile_set_name": "Github"
}
|
var find_query = function () {
var _map = window.location.search.substr(1).split('&').map(function (a) {
return a.split('=');
}).reduce(function (p, v) {
if (v.length > 1)
p[v[0]] = decodeURIComponent(v[1].replace(/\+/g, " "));
else
p[v[0]] = true;
return p;
}, {});
return function (field) {
return _map[field] || null;
};
}();
var resizeMode = (find_query('resize') || 'widhei').toLowerCase();
// apply resizing to a chart or charts
// if resizeMode is on, use viewbox resizing, which stretches the SVG instead of redrawing it
// otherwise, add a window.onresize handler to set the chart sizes based on the size of the window
// adjustX and adjustY are either adjustment functions
// or numbers to subtract from window.innerWidth and window.innerHeight
function apply_resizing(chart, adjustX, adjustY, onresize) {
if (resizeMode === 'viewbox') {
if(Array.isArray(chart))
chart.forEach(c => apply_resizing(c, adjustX, adjustY, onresize));
else {
chart
.width(600)
.height(400)
.useViewBoxResizing(true);
d3.select(chart.anchor()).classed('fullsize', true);
}
} else {
if(!Array.isArray(chart))
chart = [chart];
if(!isNaN(adjustX))
adjustX = (dx => x => x-dx)(adjustX);
adjustX = adjustX || (x => x);
if(!isNaN(adjustY))
adjustY = (dy => y => y-dy)(adjustY);
adjustY = adjustY || adjustX || (y => y);
chart.forEach(c => c.width(adjustX(window.innerWidth))
.height(adjustY(window.innerHeight)));
window.onresize = function () {
if (onresize) {
chart.forEach(onresize);
}
chart.forEach(c => {
c.width(adjustX(window.innerWidth))
.height(adjustY(window.innerHeight));
if (c.rescale) {
c.rescale();
}
});
redraw_chart_no_transitions(chart);
};
}
}
|
{
"pile_set_name": "Github"
}
|
package system // import "github.com/docker/docker/pkg/system"
import (
"syscall"
"unsafe"
"golang.org/x/sys/unix"
)
// LUtimesNano is used to change access and modification time of the specified path.
// It's used for symbol link file because unix.UtimesNano doesn't support a NOFOLLOW flag atm.
func LUtimesNano(path string, ts []syscall.Timespec) error {
atFdCwd := unix.AT_FDCWD
var _path *byte
_path, err := unix.BytePtrFromString(path)
if err != nil {
return err
}
if _, _, err := unix.Syscall6(unix.SYS_UTIMENSAT, uintptr(atFdCwd), uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), unix.AT_SYMLINK_NOFOLLOW, 0, 0); err != 0 && err != unix.ENOSYS {
return err
}
return nil
}
|
{
"pile_set_name": "Github"
}
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <MediaPlayer/MPMediaEntity.h>
@class MPMediaItem, MPMediaQuery, NSArray;
@interface MPMediaItemCollection : MPMediaEntity
{
unsigned long long _containedMediaTypes;
_Bool _initializedContainedMediaTypes;
NSArray *_items;
unsigned long long _itemsCount;
MPMediaQuery *_itemsQuery;
MPMediaItem *_representativeItem;
}
+ (id)representativePersistentIDPropertyForGroupingType:(long long)arg1;
+ (id)sortTitlePropertyForGroupingType:(long long)arg1;
+ (id)titlePropertyForGroupingType:(long long)arg1;
+ (_Bool)supportsSecureCoding;
+ (id)collectionWithItems:(id)arg1;
- (void).cxx_destruct;
- (void)setValue:(id)arg1 forProperty:(id)arg2 withCompletionBlock:(CDUnknownBlockType)arg3;
- (_Bool)setValue:(id)arg1 forProperty:(id)arg2;
- (id)multiverseIdentifier;
@property(readonly, nonatomic) long long groupingType;
@property(readonly, nonatomic) unsigned long long mediaTypes;
@property(readonly, nonatomic) unsigned long long count;
@property(readonly, nonatomic) MPMediaItem *representativeItem;
@property(readonly, nonatomic) NSArray *items;
- (id)itemsQuery;
- (void)encodeWithCoder:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (id)init;
- (id)initWithMultiverseIdentifier:(id)arg1;
- (id)initWithItemsQuery:(id)arg1;
- (id)initWithItems:(id)arg1;
- (id)artistArtworkCatalog;
- (id)albumArtistArtworkCatalog;
- (id)artworkCatalog;
- (_Bool)MPSD_hasDownloadingItem;
- (_Bool)MPSD_hasDownloadableItem;
@end
|
{
"pile_set_name": "Github"
}
|
#region
using System;
using System.Linq;
using System.Threading.Tasks;
using EvilDICOM.Core;
using EvilDICOM.Core.Helpers;
using EvilDICOM.Network.DIMSE;
using EvilDICOM.Network.Enums;
using EvilDICOM.Network.Extensions;
using EvilDICOM.Network.Messaging;
using Microsoft.Extensions.Logging;
#endregion
namespace EvilDICOM.Network.Services
{
/// <summary>
/// This class handles incoming DIMSE messaging. It logs the message, creates and sends the appropriate response
/// </summary>
public class DIMSEService
{
//DICOM Object Received
public delegate void DIMSERequestHandler<T>(T req, Association asc) where T : AbstractDIMSERequest;
public delegate void DIMSEResponseHandler<T>(T req, Association asc) where T : AbstractDIMSEResponse;
public delegate void LogHandler(string toLog);
public DIMSEService()
{
this.CStoreService = new CStoreService(this);
this.CFindService = new CFindService(this);
this.NActionService = new NActionService(this);
this.NEventReportService = new NEventReportService(this);
this.StorageCommitmentService = new StorageCommitmentService(this);
SetDefaultActions();
}
public CStoreService CStoreService { get; private set; }
public CFindService CFindService { get; private set; }
public NActionService NActionService { get; private set; }
public NEventReportService NEventReportService { get; private set; }
public StorageCommitmentService StorageCommitmentService { get; private set; }
public Action<CEchoRequest, Association> CEchoRequestReceivedAction { get; private set; }
public Action<CEchoResponse, Association> CEchoResponseReceivedAction { get; private set; }
public Action<CMoveRequest, Association> CMoveRequestReceivedAction { get; set; }
public Action<CMoveResponse, Association> CMoveResponseReceivedAction { get; private set; }
public Action<CGetRequest, Association> CGetRequestReceivedAction { get; private set; }
public Action<CGetResponse, Association> CGetResponseReceivedAction { get; private set; }
private void SetDefaultActions()
{
CEchoRequestReceivedAction = (cEchoReq, asc) =>
{
asc.Logger.LogInformation("<-- DIMSE" + cEchoReq.GetLogString());
if (!asc.ServiceClass.SupportedAbstractSyntaxes.Contains(AbstractSyntax.VERIFICATION)) return;
asc.LastActive = DateTime.Now;
asc.State = NetworkState.TRANSPORT_CONNECTION_OPEN;
var response = new CEchoResponse(cEchoReq, Status.SUCCESS);
PDataMessenger.Send(response, asc);
RaiseDIMSERequestReceived(cEchoReq, asc);
};
CEchoResponseReceivedAction = (cEchoRp, asc) =>
{
asc.Logger.LogInformation("<-- DIMSE" + cEchoRp.GetLogString());
asc.LastActive = DateTime.Now;
RaiseDIMSEResponseReceived(cEchoRp, asc);
AssociationMessenger.SendReleaseRequest(asc);
};
CGetRequestReceivedAction = (cGetReq, asc) =>
{
asc.Logger.LogInformation("<-- DIMSE" + cGetReq.GetLogString());
cGetReq.LogData(asc);
asc.LastActive = DateTime.Now;
asc.State = NetworkState.TRANSPORT_CONNECTION_OPEN;
RaiseDIMSERequestReceived(cGetReq, asc);
throw new NotImplementedException();
};
CGetResponseReceivedAction = (cGetRes, asc) =>
{
asc.Logger.LogInformation("<-- DIMSE" + cGetRes.GetLogString());
cGetRes.LogData(asc);
asc.LastActive = DateTime.Now;
RaiseDIMSEResponseReceived(cGetRes, asc);
if (cGetRes.Status != (ushort)Status.PENDING)
AssociationMessenger.SendReleaseRequest(asc);
};
CMoveRequestReceivedAction = (cMoveReq, asc) =>
{
asc.Logger.LogInformation("<-- DIMSE" + cMoveReq.GetLogString());
cMoveReq.LogData(asc);
asc.LastActive = DateTime.Now;
asc.State = NetworkState.TRANSPORT_CONNECTION_OPEN;
RaiseDIMSERequestReceived(cMoveReq, asc);
throw new NotImplementedException();
};
CMoveResponseReceivedAction = (cMoveRes, asc) =>
{
asc.Logger.LogInformation("<-- DIMSE" + cMoveRes.GetLogString());
cMoveRes.LogData(asc);
asc.LastActive = DateTime.Now;
RaiseDIMSEResponseReceived(cMoveRes, asc);
if (cMoveRes.Status != (ushort)Status.PENDING)
AssociationMessenger.SendReleaseRequest(asc);
};
}
public void Subscribe<T>(DIMSEResponseHandler<T> cr) where T : AbstractDIMSEResponse
{
if (typeof(T) == typeof(CEchoResponse))
CEchoResponseReceived += (cr as DIMSEResponseHandler<CEchoResponse>);
if (typeof(T) == typeof(CFindResponse))
CFindResponseReceived += (cr as DIMSEResponseHandler<CFindResponse>);
if (typeof(T) == typeof(CMoveResponse))
CMoveResponseReceived += (cr as DIMSEResponseHandler<CMoveResponse>);
if (typeof(T) == typeof(CStoreResponse))
CStoreResponseReceived += (cr as DIMSEResponseHandler<CStoreResponse>);
if (typeof(T) == typeof(CGetResponse))
CGetResponseReceived += (cr as DIMSEResponseHandler<CGetResponse>);
if (typeof(T) == typeof(NActionResponse))
NActionResponseReceived += (cr as DIMSEResponseHandler<NActionResponse>);
if (typeof(T) == typeof(NEventReportResponse))
NEventReportResponseReceived += (cr as DIMSEResponseHandler<NEventReportResponse>);
}
public void Unsubscribe<T>(DIMSEResponseHandler<T> cr) where T : AbstractDIMSEResponse
{
if (typeof(T) == typeof(CEchoResponse))
CEchoResponseReceived -= (cr as DIMSEResponseHandler<CEchoResponse>);
if (typeof(T) == typeof(CFindResponse))
CFindResponseReceived -= (cr as DIMSEResponseHandler<CFindResponse>);
if (typeof(T) == typeof(CMoveResponse))
CMoveResponseReceived -= (cr as DIMSEResponseHandler<CMoveResponse>);
if (typeof(T) == typeof(CStoreResponse))
CStoreResponseReceived -= (cr as DIMSEResponseHandler<CStoreResponse>);
if (typeof(T) == typeof(CGetResponse))
CGetResponseReceived -= (cr as DIMSEResponseHandler<CGetResponse>);
if (typeof(T) == typeof(NActionResponse))
NActionResponseReceived -= (cr as DIMSEResponseHandler<NActionResponse>);
if (typeof(T) == typeof(NEventReportResponse))
NEventReportResponseReceived -= (cr as DIMSEResponseHandler<NEventReportResponse>);
}
public void Subscribe<T>(DIMSERequestHandler<T> cr) where T : AbstractDIMSERequest
{
if (typeof(T) == typeof(CEchoRequest))
CEchoRequestReceived += (cr as DIMSERequestHandler<CEchoRequest>);
if (typeof(T) == typeof(CFindRequest))
CFindRequestReceived += (cr as DIMSERequestHandler<CFindRequest>);
if (typeof(T) == typeof(CMoveRequest))
CMoveRequestReceived += (cr as DIMSERequestHandler<CMoveRequest>);
if (typeof(T) == typeof(CStoreRequest))
CStoreRequestReceived += (cr as DIMSERequestHandler<CStoreRequest>);
if (typeof(T) == typeof(CGetRequest))
CGetRequestReceived += (cr as DIMSERequestHandler<CGetRequest>);
if (typeof(T) == typeof(NActionRequest))
NActionRequestRecieved += (cr as DIMSERequestHandler<NActionRequest>);
if (typeof(T) == typeof(NEventReportRequest))
NEventReportRequestRecieved += (cr as DIMSERequestHandler<NEventReportRequest>);
}
public void Unsubscribe<T>(DIMSERequestHandler<T> cr) where T : AbstractDIMSERequest
{
if (typeof(T) == typeof(CEchoRequest))
CEchoRequestReceived -= (cr as DIMSERequestHandler<CEchoRequest>);
if (typeof(T) == typeof(CFindRequest))
CFindRequestReceived -= (cr as DIMSERequestHandler<CFindRequest>);
if (typeof(T) == typeof(CMoveRequest))
CMoveRequestReceived -= (cr as DIMSERequestHandler<CMoveRequest>);
if (typeof(T) == typeof(CStoreRequest))
CStoreRequestReceived -= (cr as DIMSERequestHandler<CStoreRequest>);
if (typeof(T) == typeof(CGetRequest))
CGetRequestReceived -= (cr as DIMSERequestHandler<CGetRequest>);
if (typeof(T) == typeof(NActionRequest))
NActionRequestRecieved -= (cr as DIMSERequestHandler<NActionRequest>);
if (typeof(T) == typeof(NEventReportRequest))
NEventReportRequestRecieved -= (cr as DIMSERequestHandler<NEventReportRequest>);
}
//---------------DIMSE REQUESTS----------------------
public event DIMSERequestHandler<CEchoRequest> CEchoRequestReceived;
public event DIMSERequestHandler<CFindRequest> CFindRequestReceived;
public event DIMSERequestHandler<CMoveRequest> CMoveRequestReceived;
public event DIMSERequestHandler<CStoreRequest> CStoreRequestReceived;
public event DIMSERequestHandler<CGetRequest> CGetRequestReceived;
public event DIMSERequestHandler<NActionRequest> NActionRequestRecieved;
public event DIMSERequestHandler<NEventReportRequest> NEventReportRequestRecieved;
internal void RaiseDIMSERequestReceived<T>(T req, Association asc) where T : AbstractDIMSERequest
{
if (typeof(T) == typeof(CEchoRequest))
CEchoRequestReceived?.Invoke(req as CEchoRequest, asc);
if (typeof(T) == typeof(CFindRequest))
CFindRequestReceived?.Invoke(req as CFindRequest, asc);
if (typeof(T) == typeof(CMoveRequest))
CMoveRequestReceived?.Invoke(req as CMoveRequest, asc);
if (typeof(T) == typeof(CStoreRequest))
CStoreRequestReceived?.Invoke(req as CStoreRequest, asc);
if (typeof(T) == typeof(CGetRequest))
CGetRequestReceived?.Invoke(req as CGetRequest, asc);
if (typeof(T) == typeof(NActionRequest))
NActionRequestRecieved?.Invoke(req as NActionRequest, asc);
if (typeof(T) == typeof(NEventReportRequest))
NEventReportRequestRecieved?.Invoke(req as NEventReportRequest, asc);
}
//----------------DIMSE RESPONSES-------------------------
public event DIMSEResponseHandler<CEchoResponse> CEchoResponseReceived;
public event DIMSEResponseHandler<CFindResponse> CFindResponseReceived;
public event DIMSEResponseHandler<CMoveResponse> CMoveResponseReceived;
public event DIMSEResponseHandler<CStoreResponse> CStoreResponseReceived;
public event DIMSEResponseHandler<CGetResponse> CGetResponseReceived;
public event DIMSEResponseHandler<NActionResponse> NActionResponseReceived;
public event DIMSEResponseHandler<NEventReportResponse> NEventReportResponseReceived;
internal void RaiseDIMSEResponseReceived<T>(T resp, Association asc) where T : AbstractDIMSEResponse
{
if (typeof(T) == typeof(CEchoResponse))
CEchoResponseReceived?.Invoke(resp as CEchoResponse, asc);
if (typeof(T) == typeof(CFindResponse))
CFindResponseReceived?.Invoke(resp as CFindResponse, asc);
if (typeof(T) == typeof(CMoveResponse))
CMoveResponseReceived?.Invoke(resp as CMoveResponse, asc);
if (typeof(T) == typeof(CStoreResponse))
CStoreResponseReceived?.Invoke(resp as CStoreResponse, asc);
if (typeof(T) == typeof(CGetResponse))
CGetResponseReceived?.Invoke(resp as CGetResponse, asc);
if (typeof(T) == typeof(NActionResponse))
NActionResponseReceived?.Invoke(resp as NActionResponse, asc);
if (typeof(T) == typeof(NEventReportResponse))
NEventReportResponseReceived?.Invoke(resp as NEventReportResponse, asc);
}
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2009, 2012, 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.
*
* 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 jtt.optimize;
/*
* Tests optimization of integer operations.
* @Harness: java
* @Runs: 0=80L; 1=11L; 2=12L; 3=13L; 4=64L
*/
public class Reduce_LongShift02 {
public static long test(long arg) {
if (arg == 0) {
return shift0(arg + 80);
}
if (arg == 1) {
return shift1(arg + 0x800000000000000aL);
}
if (arg == 2) {
return shift2(arg + 192);
}
if (arg == 3) {
return shift3(arg + 208);
}
if (arg == 4) {
return shift4(arg);
}
return 0;
}
public static long shift0(long x) {
return x >>> 3 << 3;
}
public static long shift1(long x) {
return x << 3 >>> 3;
}
public static long shift2(long x) {
return x >> 3 >> 1;
}
public static long shift3(long x) {
return x >>> 3 >>> 1;
}
public static long shift4(long x) {
return x << 3 << 1;
}
}
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.6" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="wsattacker.main.Preferences" name="preferences">
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="wsattacker.main.Preferences.getInstance()"/>
</AuxValues>
</Component>
</NonVisualComponents>
<Properties>
<Property name="name" type="java.lang.String" value="Configuration" noResource="true"/>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="httpProxyPortLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="httpProxyHostLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="httpProxyHostValue" min="-2" pref="171" max="-2" attributes="0"/>
<Component id="httpProxyPortValue" min="-2" pref="171" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="12" pref="12" max="-2" attributes="0"/>
<Component id="soapHttpClientConfigurationLabel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace pref="121" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="soapHttpClientConfigurationLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="httpProxyHostLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="httpProxyHostValue" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="httpProxyPortLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="httpProxyPortValue" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="317" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="soapHttpClientConfigurationLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="SOAP HTTP Client Configuration"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="httpProxyHostLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Proxy Host"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="httpProxyHostValue">
<BindingProperties>
<BindingProperty name="text" source="preferences" sourcePath="${httpConfig.proxyHost}" target="httpProxyHostValue" targetPath="text" updateStrategy="0" immediately="false">
<BindingParameter name="javax.swing.binding.ParameterKeys.TEXT_CHANGE_STRATEGY" value="javax.swing.binding.TextChangeStrategy.ON_TYPE"/>
</BindingProperty>
</BindingProperties>
</Component>
<Component class="javax.swing.JLabel" name="httpProxyPortLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Proxy Port"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="httpProxyPortValue">
<BindingProperties>
<BindingProperty name="text" source="preferences" sourcePath="${httpConfig.proxyPort}" target="httpProxyPortValue" targetPath="text" updateStrategy="0" immediately="false">
<BindingParameter name="javax.swing.binding.ParameterKeys.TEXT_CHANGE_STRATEGY" value="javax.swing.binding.TextChangeStrategy.ON_TYPE"/>
</BindingProperty>
</BindingProperties>
</Component>
</SubComponents>
</Form>
|
{
"pile_set_name": "Github"
}
|
package javax.xml.transform.stream;
class StreamSource {
int reader;
int inputStream;
int systemId;
int publicId;
int FEATURE;
}
class StreamResult {
int writer;
int outputStream;
int systemId;
int FEATURE;
}
|
{
"pile_set_name": "Github"
}
|
--
-- d/actions/visuald.lua
-- Generate a VisualD .visualdproj project.
-- Copyright (c) 2012-2015 Manu Evans and the Premake project
--
local p = premake
local m = p.modules.d
m.visuald = {}
require ("vstudio")
local vstudio = p.vstudio
local workspace = p.workspace
local project = p.project
local config = p.config
local tree = p.tree
--
-- Patch the vstudio actions with D support...
--
for k,v in pairs({ "vs2005", "vs2008", "vs2010", "vs2012", "vs2013", "vs2015", "vs2017", "vs2019" }) do
local vs = p.action.get(v)
if vs ~= nil then
table.insert( vs.valid_languages, p.D )
vs.valid_tools.dc = { "dmd", "gdc", "ldc" }
p.override(vs, "onProject", function(oldfn, prj)
oldfn(prj)
if project.isd(prj) then
p.generate(prj, ".visualdproj", m.visuald.generate)
end
end)
end
end
--
-- Patch a bunch of other functions
--
p.override(project, "isnative", function(oldfn, prj)
return project.isd(prj) or oldfn(prj)
end)
p.override(vstudio, "projectfile", function(oldfn, prj)
if project.isd(prj) then
return p.filename(prj, ".visualdproj")
end
return oldfn(prj)
end)
p.override(vstudio, "tool", function(oldfn, prj)
if project.isd(prj) then
return "002A2DE9-8BB6-484D-9802-7E4AD4084715"
end
return oldfn(prj)
end)
--
-- Generate a Visual D project.
--
m.elements.project = function(prj)
return {
m.visuald.header,
m.visuald.globals,
m.visuald.projectConfigurations,
m.visuald.files,
}
end
function m.visuald.generate(prj)
p.eol("\r\n")
p.indent(" ")
p.callArray(m.elements.project, prj)
_p('</DProject>')
end
function m.visuald.header(prj)
-- for some reason Visual D projects don't seem to have an xml header
--_p('<?xml version="1.0" encoding="utf-8"?>')
_p('<DProject>')
end
function m.visuald.globals(prj)
_p(1,'<ProjectGuid>{%s}</ProjectGuid>', prj.uuid)
end
--
-- Write out the list of project configurations, which pairs build
-- configurations with architectures.
--
function m.visuald.projectConfigurations(prj)
-- build a list of all architectures used in this project
for cfg in project.eachconfig(prj) do
local prjPlatform = p.esc(vstudio.projectPlatform(cfg))
local slnPlatform = vstudio.solutionPlatform(cfg)
local is64bit = slnPlatform == "x64" -- TODO: this seems like a hack
_p(1,'<Config name="%s" platform="%s">', prjPlatform, slnPlatform)
_p(2,'<obj>0</obj>')
_p(2,'<link>0</link>')
local isWindows = false
local isDebug = string.find(cfg.buildcfg, 'Debug') ~= nil
local isOptimised = config.isOptimizedBuild(cfg)
if cfg.kind == p.CONSOLEAPP then
_p(2,'<lib>0</lib>')
_p(2,'<subsystem>1</subsystem>')
elseif cfg.kind == p.STATICLIB then
_p(2,'<lib>1</lib>')
_p(2,'<subsystem>0</subsystem>')
elseif cfg.kind == p.SHAREDLIB then
_p(2,'<lib>2</lib>')
_p(2,'<subsystem>0</subsystem>') -- SHOULD THIS BE '2' (windows)??
else
_p(2,'<lib>0</lib>')
_p(2,'<subsystem>2</subsystem>')
isWindows = true
end
_p(2,'<multiobj>0</multiobj>')
_p(2,'<singleFileCompilation>0</singleFileCompilation>')
_p(2,'<oneobj>0</oneobj>')
_p(2,'<trace>%s</trace>', iif(cfg.flags.Profile, '1', '0'))
_p(2,'<quiet>%s</quiet>', iif(cfg.flags.Quiet, '1', '0'))
_p(2,'<verbose>%s</verbose>', iif(cfg.flags.Verbose, '1', '0'))
_p(2,'<vtls>0</vtls>')
_p(2,'<symdebug>%s</symdebug>', iif(cfg.symbols == p.ON or cfg.symbols == "FastLink" or cfg.symbols == "Full", iif(cfg.flags.SymbolsLikeC, '2', '1'), '0'))
_p(2,'<optimize>%s</optimize>', iif(isOptimised, '1', '0'))
_p(2,'<cpu>0</cpu>')
_p(2,'<isX86_64>%s</isX86_64>', iif(is64bit, '1', '0'))
_p(2,'<isLinux>0</isLinux>')
_p(2,'<isOSX>0</isOSX>')
_p(2,'<isWindows>%s</isWindows>', iif(isWindows, '1', '0'))
_p(2,'<isFreeBSD>0</isFreeBSD>')
_p(2,'<isSolaris>0</isSolaris>')
_p(2,'<scheduler>0</scheduler>')
_p(2,'<useDeprecated>%s</useDeprecated>', iif(cfg.deprecatedfeatures == "Allow", '1', '0'))
_p(2,'<errDeprecated>0</errDeprecated>')
_p(2,'<useAssert>0</useAssert>')
_p(2,'<useInvariants>0</useInvariants>')
_p(2,'<useIn>0</useIn>')
_p(2,'<useOut>0</useOut>')
_p(2,'<useArrayBounds>0</useArrayBounds>')
_p(2,'<noboundscheck>%s</noboundscheck>', iif(cfg.boundscheck == "Off", '1', '0'))
_p(2,'<useSwitchError>0</useSwitchError>')
_p(2,'<useUnitTests>%s</useUnitTests>', iif(cfg.flags.UnitTest, '1', '0'))
_p(2,'<useInline>%s</useInline>', iif(cfg.flags.Inline or isOptimised, '1', '0'))
_p(2,'<release>%s</release>', iif(cfg.flags.Release or not isDebug, '1', '0'))
_p(2,'<preservePaths>0</preservePaths>')
_p(2,'<warnings>%s</warnings>', iif(cfg.flags.FatalCompileWarnings, '1', '0'))
_p(2,'<infowarnings>%s</infowarnings>', iif(cfg.warnings and cfg.warnings ~= "Off", '1', '0'))
_p(2,'<checkProperty>0</checkProperty>')
_p(2,'<genStackFrame>0</genStackFrame>')
_p(2,'<pic>%s</pic>', iif(cfg.pic == "On", '1', '0'))
_p(2,'<cov>%s</cov>', iif(cfg.flags.CodeCoverage, '1', '0'))
_p(2,'<nofloat>%s</nofloat>', iif(cfg.floatingpoint and cfg.floatingpoint == "None", '1', '0'))
_p(2,'<Dversion>2</Dversion>')
_p(2,'<ignoreUnsupportedPragmas>0</ignoreUnsupportedPragmas>')
local compiler = { dmd="0", gdc="1", ldc="2" }
m.visuald.element(2, "compiler", compiler[_OPTIONS.dc or cfg.toolset or "dmd"])
m.visuald.element(2, "otherDMD", '0')
m.visuald.element(2, "program", '$(DMDInstallDir)windows\\bin\\dmd.exe')
local impdirs
if #cfg.importdirs > 0 then
impdirs = vstudio.path(cfg, cfg.importdirs)
end
m.visuald.element(2, "imppath", impdirs)
m.visuald.element(2, "fileImppath")
m.visuald.element(2, "outdir", path.translate(project.getrelative(cfg.project, cfg.buildtarget.directory)))
m.visuald.element(2, "objdir", path.translate(project.getrelative(cfg.project, cfg.objdir)))
m.visuald.element(2, "objname")
m.visuald.element(2, "libname")
m.visuald.element(2, "doDocComments", iif(cfg.flags.Documentation, '1', '0'))
m.visuald.element(2, "docdir", cfg.docdir)
m.visuald.element(2, "docname", cfg.docname)
m.visuald.element(2, "modules_ddoc")
m.visuald.element(2, "ddocfiles")
m.visuald.element(2, "doHdrGeneration", iif(cfg.flags.GenerateHeader, '1', '0'))
m.visuald.element(2, "hdrdir", cfg.headerdir)
m.visuald.element(2, "hdrname", cfg.headername)
m.visuald.element(2, "doXGeneration", iif(cfg.flags.GenerateJSON, '1', '0'))
m.visuald.element(2, "xfilename", '$(IntDir)\\$(TargetName).json')
m.visuald.element(2, "debuglevel", iif(cfg.debuglevel, tostring(cfg.debuglevel), '0'))
m.visuald.element(2, "debugids", cfg.debugconstants)
m.visuald.element(2, "versionlevel", iif(cfg.versionlevel, tostring(cfg.versionlevel), '0'))
m.visuald.element(2, "versionids", cfg.versionconstants)
_p(2,'<dump_source>0</dump_source>')
_p(2,'<mapverbosity>0</mapverbosity>')
_p(2,'<createImplib>%s</createImplib>', iif(cfg.kind ~= p.SHAREDLIB or cfg.flags.NoImportLib, '0', '1'))
_p(2,'<defaultlibname />')
_p(2,'<debuglibname />')
_p(2,'<moduleDepsFile />')
_p(2,'<run>0</run>')
_p(2,'<runargs />')
-- _p(2,'<runCv2pdb>%s</runCv2pdb>', iif(cfg.symbols == p.ON, '1', '0'))
_p(2,'<runCv2pdb>1</runCv2pdb>') -- we will just leave this always enabled, since it's ignored if no debuginfo is written
_p(2,'<pathCv2pdb>$(VisualDInstallDir)cv2pdb\\cv2pdb.exe</pathCv2pdb>')
_p(2,'<cv2pdbPre2043>0</cv2pdbPre2043>')
_p(2,'<cv2pdbNoDemangle>0</cv2pdbNoDemangle>')
_p(2,'<cv2pdbEnumType>0</cv2pdbEnumType>')
_p(2,'<cv2pdbOptions />')
_p(2,'<objfiles />')
_p(2,'<linkswitches />')
local links
local explicit = vstudio.needsExplicitLink(cfg)
-- check to see if this project uses an external toolset. If so, let the
-- toolset define the format of the links
local toolset = config.toolset(cfg)
if toolset then
links = toolset.getlinks(cfg, not explicit)
else
local scope = iif(explicit, "all", "system")
links = config.getlinks(cfg, scope, "fullpath")
end
m.visuald.element(2, "libfiles", table.concat(links, " "))
m.visuald.element(2, "libpaths", cfg.libdirs)
_p(2,'<deffile />')
_p(2,'<resfile />')
local target = config.gettargetinfo(cfg)
_p(2,'<exefile>$(OutDir)\\%s</exefile>', target.name)
_p(2,'<useStdLibPath>1</useStdLibPath>')
local runtime = 0
if not cfg.flags.OmitDefaultLibrary then
if config.isDebugBuild(cfg) then
runtime = iif(cfg.flags.StaticRuntime, "2", "4")
else
runtime = iif(cfg.flags.StaticRuntime, "1", "3")
end
end
m.visuald.element(2, "cRuntime", runtime)
local additionalOptions
if #cfg.buildoptions > 0 then
additionalOptions = table.concat(cfg.buildoptions, " ")
end
if #cfg.linkoptions > 0 then
local linkOpts = table.implode(cfg.linkoptions, "-L", "", " ")
if additionalOptions then
additionalOptions = additionalOptions .. " " .. linkOpts
else
additionalOptions = linkOpts
end
end
m.visuald.element(2, "additionalOptions", additionalOptions)
if #cfg.prebuildcommands > 0 then
_p(2,'<preBuildCommand>%s</preBuildCommand>',p.esc(table.implode(cfg.prebuildcommands, "", "", "\r\n")))
else
_p(2,'<preBuildCommand />')
end
if #cfg.postbuildcommands > 0 then
_p(2,'<postBuildCommand>%s</postBuildCommand>',p.esc(table.implode(cfg.postbuildcommands, "", "", "\r\n")))
else
_p(2,'<postBuildCommand />')
end
_p(2,'<filesToClean>*.obj;*.cmd;*.build;*.json;*.dep;*.o</filesToClean>')
_p(1,'</Config>')
end
end
--
-- Write out the source file tree.
--
function m.visuald.files(prj)
_p(1,'<Folder name="%s">', prj.name)
local tr = project.getsourcetree(prj)
tree.traverse(tr, {
-- folders, virtual or otherwise, are handled at the internal nodes
onbranchenter = function(node, depth)
_p(depth, '<Folder name="%s">', node.name)
end,
onbranchexit = function(node, depth)
_p(depth, '</Folder>')
end,
-- source files are handled at the leaves
onleaf = function(node, depth)
_p(depth, '<File path="%s" />', path.translate(node.relpath))
-- _p(depth, '<File path="%s">', path.translate(node.relpath))
-- m.visuald.fileConfiguration(prj, node, depth + 1)
-- _p(depth, '</File>')
end
}, false, 2)
_p(1,'</Folder>')
end
function m.visuald.fileConfiguration(prj, node, depth)
-- maybe we'll need this in the future...
end
--
-- Output an individual project XML element.
--
function m.visuald.element(depth, name, value, ...)
local isTable = type(value) == "table"
if not value or (isTable and #value == 0) then
_p(depth, '<%s />', name)
else
if isTable then
value = p.esc(table.implode(value, "", "", ";"))
_p(depth, '<%s>%s</%s>', name, value, name)
else
if select('#',...) == 0 then
value = p.esc(value)
end
_x(depth, string.format('<%s>%s</%s>', name, value, name), ...)
end
end
end
|
{
"pile_set_name": "Github"
}
|
f144ac3cc4b14d4d6596850804d32d471fca22a204b1fdcc803bf624dd1a395d8e8b566eb3918ea4a4aa4d4e80649334410dcf2c83afcf765859b375ce60aa50
|
{
"pile_set_name": "Github"
}
|
# [1128. Number of Equivalent Domino Pairs](https://leetcode.com/problems/number-of-equivalent-domino-pairs/)
Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if either (a==c and b==d), or (a==d and b==c) - that is, one domino can be rotated to be equal to another domino.
Return the number of pairs (i, j) for which 0 <= i < j < dominoes.length, and dominoes[i] is equivalent to dominoes[j].
Example 1:
```text
Input: dominoes = [[1,2],[2,1],[3,4],[5,6]]
Output: 1
```
Constraints:
- `1 <= dominoes.length <= 40000`
- `1 <= dominoes[i][j] <= 9`
|
{
"pile_set_name": "Github"
}
|
using NaughtyAttributes;
using System.Collections;
using UnityEngine;
using UnityEngine.Events;
namespace GameplayIngredients.Logic
{
public class Logic : LogicBase
{
[ReorderableList]
public Callable[] Calls;
public override void Execute(GameObject instigator = null)
{
Callable.Call(Calls, instigator);
}
}
}
|
{
"pile_set_name": "Github"
}
|
{
"id": "tacky-sweater",
"name": "Tacky Sweater",
"category": "Tops",
"games": {
"nl": {
"orderable": false,
"fashionThemes": [
"Iconic"
],
"sellPrice": {
"currency": "bells",
"value": 1300
},
"sources": [
"GracieGrace (during sales)"
],
"buyPrices": [
{
"currency": "bells",
"value": 5200
}
]
}
}
}
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using BuildXL.Cache.ContentStore.Hashing;
using Xunit;
namespace BuildXL.Cache.ContentStore.InterfacesTest.Hashing
{
public class ContentHasherFactoryTests
{
[Fact]
public void EveryHashTypeProducesInstance()
{
foreach (HashType hashType in Enum.GetValues(typeof(HashType)))
{
if (hashType == HashType.Unknown)
{
continue;
}
if (hashType == HashType.DeprecatedVso0 || hashType == HashType.DedupNode)
{
continue;
}
using (var hasher = HashInfoLookup.Find(hashType).CreateContentHasher())
{
Assert.NotNull(hasher);
Assert.Equal(hashType, hasher.Info.HashType);
}
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2016-2019 David Karnok
*
* 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 hu.akarnokd.rxjava3.basetypes;
import org.reactivestreams.Subscriber;
import hu.akarnokd.rxjava3.basetypes.SoloMap.MapSubscriber;
import io.reactivex.rxjava3.functions.Function;
/**
* Map the value of upstream via a function.
*
* @param <T> the source value type
* @param <R> the result value type
*/
final class PerhapsMap<T, R> extends Perhaps<R> {
final Perhaps<T> source;
final Function<? super T, ? extends R> mapper;
PerhapsMap(Perhaps<T> source, Function<? super T, ? extends R> mapper) {
this.source = source;
this.mapper = mapper;
}
@Override
protected void subscribeActual(Subscriber<? super R> s) {
source.subscribe(new MapSubscriber<T, R>(s, mapper));
}
}
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0) on Sun Jul 19 11:36:55 PDT 2015 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class com.fasterxml.jackson.databind.introspect.VirtualAnnotatedMember (jackson-databind 2.6.0 API)</title>
<meta name="date" content="2015-07-19">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class com.fasterxml.jackson.databind.introspect.VirtualAnnotatedMember (jackson-databind 2.6.0 API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../com/fasterxml/jackson/databind/introspect/VirtualAnnotatedMember.html" title="class in com.fasterxml.jackson.databind.introspect">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/fasterxml/jackson/databind/introspect/class-use/VirtualAnnotatedMember.html" target="_top">Frames</a></li>
<li><a href="VirtualAnnotatedMember.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class com.fasterxml.jackson.databind.introspect.VirtualAnnotatedMember" class="title">Uses of Class<br>com.fasterxml.jackson.databind.introspect.VirtualAnnotatedMember</h2>
</div>
<div class="classUseContainer">No usage of com.fasterxml.jackson.databind.introspect.VirtualAnnotatedMember</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../com/fasterxml/jackson/databind/introspect/VirtualAnnotatedMember.html" title="class in com.fasterxml.jackson.databind.introspect">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/fasterxml/jackson/databind/introspect/class-use/VirtualAnnotatedMember.html" target="_top">Frames</a></li>
<li><a href="VirtualAnnotatedMember.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2014–2015 <a href="http://fasterxml.com/">FasterXML</a>. All rights reserved.</small></p>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
import { NgModule } from '@angular/core';
import { ServerModule, ServerTransferStateModule } from '@angular/platform-server';
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
@NgModule({
imports: [
AppModule,
ServerModule,
ModuleMapLoaderModule,
ServerTransferStateModule
],
providers: [
// Add universal-only providers here
],
bootstrap: [ AppComponent ],
})
export class AppServerModule {}
|
{
"pile_set_name": "Github"
}
|
/*******************************************************************************
* Copyright (c) 2000, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.ui.text.correction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.model.ILanguage;
import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.core.model.ASTCache.ASTRunnable;
import org.eclipse.cdt.internal.ui.actions.ActionUtil;
import org.eclipse.cdt.internal.ui.editor.ASTProvider;
import org.eclipse.cdt.internal.ui.editor.CEditor;
import org.eclipse.cdt.internal.ui.text.correction.proposals.LinkedNamesAssistProposal;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.text.ICCompletionProposal;
import org.eclipse.cdt.ui.text.IInvocationContext;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.bindings.TriggerSequence;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension;
import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.keys.IBindingService;
/**
* Handler to be used to run a quick fix or assist by keyboard shortcut
*/
public class CorrectionCommandHandler extends AbstractHandler {
private final CEditor fEditor;
private final String fId;
private final boolean fIsAssist;
public CorrectionCommandHandler(CEditor editor, String id, boolean isAssist) {
fEditor = editor;
fId = id;
fIsAssist = isAssist;
}
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
doExecute();
return null;
}
/**
* Try to execute the correction command.
*
* @return <code>true</code> iff the correction could be started
* @since 5.3
*/
public boolean doExecute() {
ISelection selection = fEditor.getSelectionProvider().getSelection();
ITranslationUnit tu = CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(fEditor.getEditorInput());
IAnnotationModel model = CUIPlugin.getDefault().getDocumentProvider()
.getAnnotationModel(fEditor.getEditorInput());
if (selection instanceof ITextSelection && tu != null && model != null) {
if (!ActionUtil.isEditable(fEditor)) {
return false;
}
ICompletionProposal proposal = findCorrection(fId, fIsAssist, (ITextSelection) selection, tu, model);
if (proposal != null) {
invokeProposal(proposal, ((ITextSelection) selection).getOffset());
}
}
return false;
}
private ICompletionProposal findCorrection(String id, boolean isAssist, ITextSelection selection,
ITranslationUnit tu, IAnnotationModel model) {
CorrectionContext context = new CorrectionContext(tu, selection.getOffset(), selection.getLength());
Collection<ICCompletionProposal> proposals = new ArrayList<>(10);
if (isAssist) {
if (id.equals(LinkedNamesAssistProposal.ASSIST_ID)) {
return getLocalRenameProposal(context); // shortcut for local rename
}
CCorrectionProcessor.collectAssists(context, new ProblemLocation[0], proposals);
} else {
try {
boolean goToClosest = selection.getLength() == 0;
Annotation[] annotations = getAnnotations(selection.getOffset(), goToClosest);
CCorrectionProcessor.collectProposals(context, model, annotations, true, false, proposals);
} catch (BadLocationException e) {
return null;
}
}
for (Iterator<ICCompletionProposal> iter = proposals.iterator(); iter.hasNext();) {
Object curr = iter.next();
if (curr instanceof ICommandAccess) {
if (id.equals(((ICommandAccess) curr).getCommandId())) {
return (ICompletionProposal) curr;
}
}
}
return null;
}
private Annotation[] getAnnotations(int offset, boolean goToClosest) throws BadLocationException {
ArrayList<Annotation> resultingAnnotations = new ArrayList<>();
CCorrectionAssistant.collectQuickFixableAnnotations(fEditor, offset, goToClosest, resultingAnnotations);
return resultingAnnotations.toArray(new Annotation[resultingAnnotations.size()]);
}
private ICompletionProposal getLocalRenameProposal(final IInvocationContext context) {
final ICCompletionProposal[] proposals = new ICCompletionProposal[1];
ASTProvider.getASTProvider().runOnAST(context.getTranslationUnit(), ASTProvider.WAIT_ACTIVE_ONLY,
new NullProgressMonitor(), new ASTRunnable() {
@Override
public IStatus runOnAST(ILanguage lang, IASTTranslationUnit astRoot) throws CoreException {
IASTNodeSelector selector = astRoot.getNodeSelector(null);
IASTName name = selector.findEnclosingName(context.getSelectionOffset(),
context.getSelectionLength());
// Activate the proposal only if a simple name is selected.
if (name != null && name == name.getLastName()) {
IBinding binding = name.resolveBinding();
if (binding != null) {
proposals[0] = new LinkedNamesAssistProposal(context.getTranslationUnit());
}
}
return Status.OK_STATUS;
}
});
return proposals[0];
}
private IDocument getDocument() {
return CUIPlugin.getDefault().getDocumentProvider().getDocument(fEditor.getEditorInput());
}
private void invokeProposal(ICompletionProposal proposal, int offset) {
if (proposal instanceof ICompletionProposalExtension2) {
ITextViewer viewer = fEditor.getViewer();
if (viewer != null) {
((ICompletionProposalExtension2) proposal).apply(viewer, (char) 0, 0, offset);
return;
}
} else if (proposal instanceof ICompletionProposalExtension) {
IDocument document = getDocument();
if (document != null) {
((ICompletionProposalExtension) proposal).apply(document, (char) 0, offset);
return;
}
}
IDocument document = getDocument();
if (document != null) {
proposal.apply(document);
}
}
public static String getShortCutString(String proposalId) {
if (proposalId != null) {
IBindingService bindingService = PlatformUI.getWorkbench().getAdapter(IBindingService.class);
if (bindingService != null) {
TriggerSequence[] activeBindingsFor = bindingService.getActiveBindingsFor(proposalId);
if (activeBindingsFor.length > 0) {
return activeBindingsFor[0].format();
}
}
}
return null;
}
}
|
{
"pile_set_name": "Github"
}
|
/*
*/
from simple.core.Object
module simple.reflection
class Method : Object
|
{
"pile_set_name": "Github"
}
|
// Copyright 2013 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.
//
// This is part of java port of project hosted at https://github.com/google/woff2
package com.itextpdf.io.font.woff2;
// Helper for rounding
class Round {
// Round a value up to the nearest multiple of 4. Don't round the value in the
// case that rounding up overflows.
public static int round4(int value) {
if (Integer.MAX_VALUE - value < 3) {
return value;
}
return (value + 3) & ~3;
}
public static long round4(long value) {
if (Long.MAX_VALUE - value < 3) {
return value;
}
return (value + 3) & ~3;
}
}
|
{
"pile_set_name": "Github"
}
|
<view class="container">
<text>{{messageTip}}</text>
<scroll-view scroll-y="true" style="height: 260px;" bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll">
<!-- 消息列表 -->
<block wx:for="{{messageTextArr}}"
wx:for-index="index"
wx:key="{{index}}"
wx:for-item="msgItem">
<view class="messageItem">
<text class="messageTime">{{msgItem.time}}</text>
<text class="messageContext">{{msgItem.content}}</text>
</view>
</block>
</scroll-view>
</view>
<view>
<form bindsubmit="formSubmit" report-submit="true">
<view class="flex-wrp" style="flex-direction:column;">
<view class="flex-item submitContent">
<input placeholder="输入内容" name="messageContent" class="txtContent" value="{{messageContent}}" />
</view>
<view class="flex-item submitButton">
<button type="primary" formType="submit" class="btnSubmit">
发送
</button>
</view>
</view>
</form>
</view>
|
{
"pile_set_name": "Github"
}
|
FROM ubuntu:16.04
LABEL maintainer="aaronmarkham@fb.com"
# caffe2 install with cpu support
########## REQUIRED DEPENDENCIES ################
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
curl \
git \
libgoogle-glog-dev \
libprotobuf-dev \
python-pip \
protobuf-compiler \
python-dev \
&& rm -rf /var/lib/apt/lists/*
# Don't use deb package because trusty's pip is too old for --no-cache-dir
RUN curl -O https://bootstrap.pypa.io/get-pip.py \
&& python get-pip.py \
&& rm get-pip.py
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
RUN pip install --no-cache-dir future hypothesis numpy protobuf six
########## INSTALLATION STEPS ###################
RUN git clone --branch master --recursive https://github.com/caffe2/caffe2.git
RUN cd caffe2 && mkdir build && cd build \
&& cmake .. \
-DUSE_CUDA=OFF \
-DUSE_NNPACK=OFF \
-DUSE_ROCKSDB=OFF \
&& make -j"$(nproc)" install \
&& ldconfig \
&& make clean \
&& cd .. \
&& rm -rf build
ENV PYTHONPATH /usr/local
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1992-1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
#ifndef _I386_FP_SAVE_H_
#define _I386_FP_SAVE_H_
/*
* Control register
*/
#define FPC_IE 0x0001 /* enable invalid operation
exception */
#define FPC_IM FPC_IE
#define FPC_DE 0x0002 /* enable denormalized operation
exception */
#define FPC_DM FPC_DE
#define FPC_ZE 0x0004 /* enable zero-divide exception */
#define FPC_ZM FPC_ZE
#define FPC_OE 0x0008 /* enable overflow exception */
#define FPC_OM FPC_OE
#define FPC_UE 0x0010 /* enable underflow exception */
#define FPC_PE 0x0020 /* enable precision exception */
#define FPC_PC 0x0300 /* precision control: */
#define FPC_PC_24 0x0000 /* 24 bits */
#define FPC_PC_53 0x0200 /* 53 bits */
#define FPC_PC_64 0x0300 /* 64 bits */
#define FPC_RC 0x0c00 /* rounding control: */
#define FPC_RC_RN 0x0000 /* round to nearest or even */
#define FPC_RC_RD 0x0400 /* round down */
#define FPC_RC_RU 0x0800 /* round up */
#define FPC_RC_CHOP 0x0c00 /* chop */
#define FPC_IC 0x1000 /* infinity control (obsolete) */
#define FPC_IC_PROJ 0x0000 /* projective infinity */
#define FPC_IC_AFF 0x1000 /* affine infinity (std) */
/*
* Status register
*/
#define FPS_IE 0x0001 /* invalid operation */
#define FPS_DE 0x0002 /* denormalized operand */
#define FPS_ZE 0x0004 /* divide by zero */
#define FPS_OE 0x0008 /* overflow */
#define FPS_UE 0x0010 /* underflow */
#define FPS_PE 0x0020 /* precision */
#define FPS_SF 0x0040 /* stack flag */
#define FPS_ES 0x0080 /* error summary */
#define FPS_C0 0x0100 /* condition code bit 0 */
#define FPS_C1 0x0200 /* condition code bit 1 */
#define FPS_C2 0x0400 /* condition code bit 2 */
#define FPS_TOS 0x3800 /* top-of-stack pointer */
#define FPS_TOS_SHIFT 11
#define FPS_C3 0x4000 /* condition code bit 3 */
#define FPS_BUSY 0x8000 /* FPU busy */
/*
* Kind of floating-point support provided by kernel.
*/
#define FP_NO 0 /* no floating point */
#define FP_SOFT 1 /* software FP emulator */
#define FP_287 2 /* 80287 */
#define FP_387 3 /* 80387 or 80486 */
#define FP_FXSR 4 /* Fast save/restore SIMD Extension */
#endif /* _I386_FP_SAVE_H_ */
|
{
"pile_set_name": "Github"
}
|
.\" Copyright 2001 Andries Brouwer <aeb@cwi.nl>.
.\"
.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH FSEEKO 3 2017-09-15 "" "Linux Programmer's Manual"
.SH NAME
fseeko, ftello \- seek to or report file position
.SH SYNOPSIS
.nf
.B #include <stdio.h>
.PP
.BI "int fseeko(FILE *" stream ", off_t " offset ", int " whence );
.PP
.BI "off_t ftello(FILE *" stream );
.fi
.PP
.in -4n
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.PP
.BR fseeko (),
.BR ftello ():
.br
.RS 4
.ad l
_FILE_OFFSET_BITS\ ==\ 64 || _POSIX_C_SOURCE\ >=\ 200112L
.br
(defining the obsolete _LARGEFILE_SOURCE macro also works)
.RE
.ad
.SH DESCRIPTION
The
.BR fseeko ()
and
.BR ftello ()
functions are identical to
.BR fseek (3)
and
.BR ftell (3)
(see
.BR fseek (3)),
respectively, except that the
.I offset
argument of
.BR fseeko ()
and the return value of
.BR ftello ()
is of type
.I off_t
instead of
.IR long .
.PP
On some architectures, both
.IR off_t
and
.I long
are 32-bit types, but defining
.BR _FILE_OFFSET_BITS
with the value 64 (before including
.I any
header files)
will turn
.I off_t
into a 64-bit type.
.SH RETURN VALUE
On successful completion,
.BR fseeko ()
returns 0, while
.BR ftello ()
returns the current offset.
Otherwise, \-1 is returned and
.I errno
is set to indicate the error.
.SH ERRORS
See the ERRORS in
.BR fseek (3).
.SH VERSIONS
These functions are available under glibc since version 2.1.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.TS
allbox;
lbw18 lb lb
l l l.
Interface Attribute Value
T{
.BR fseeko (),
.BR ftello ()
T} Thread safety MT-Safe
.TE
.sp 1
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SUSv2.
.SH SEE ALSO
.BR fseek (3)
|
{
"pile_set_name": "Github"
}
|
package org.easydarwin.audio;
/**
* Created by John on 2016/3/18.
*/
public class AudioCodec {
static {
System.loadLibrary("proffmpeg");
System.loadLibrary("AudioCodecer");
}
public static native long create(int codec, int sample_rate, int channels, int sample_bit);
public static native int decode(long handle, byte[] buffer, int offset, int length, byte[] pcm, int[] outLen);
public static native void close(long handle);
}
|
{
"pile_set_name": "Github"
}
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Foundation code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@pobox.com>
* Masayuki Nakano <masayuki@d-toybox.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_PLATFORM_H
#define GFX_PLATFORM_H
#include "prtypes.h"
#include "nsVoidArray.h"
#include "nsIObserver.h"
#include "gfxTypes.h"
#include "gfxASurface.h"
#include "gfxColor.h"
#include "qcms.h"
#ifdef XP_OS2
#undef OS2EMX_PLAIN_CHAR
#endif
class gfxImageSurface;
class gfxFont;
class gfxFontGroup;
struct gfxFontStyle;
class gfxUserFontSet;
class gfxFontEntry;
class gfxProxyFontEntry;
class nsIURI;
// pref lang id's for font prefs
// !!! needs to match the list of pref font.default.xx entries listed in all.js !!!
enum eFontPrefLang {
eFontPrefLang_Western = 0,
eFontPrefLang_CentEuro = 1,
eFontPrefLang_Japanese = 2,
eFontPrefLang_ChineseTW = 3,
eFontPrefLang_ChineseCN = 4,
eFontPrefLang_ChineseHK = 5,
eFontPrefLang_Korean = 6,
eFontPrefLang_Cyrillic = 7,
eFontPrefLang_Baltic = 8,
eFontPrefLang_Greek = 9,
eFontPrefLang_Turkish = 10,
eFontPrefLang_Thai = 11,
eFontPrefLang_Hebrew = 12,
eFontPrefLang_Arabic = 13,
eFontPrefLang_Devanagari = 14,
eFontPrefLang_Tamil = 15,
eFontPrefLang_Armenian = 16,
eFontPrefLang_Bengali = 17,
eFontPrefLang_Canadian = 18,
eFontPrefLang_Ethiopic = 19,
eFontPrefLang_Georgian = 20,
eFontPrefLang_Gujarati = 21,
eFontPrefLang_Gurmukhi = 22,
eFontPrefLang_Khmer = 23,
eFontPrefLang_Malayalam = 24,
eFontPrefLang_Oriya = 25,
eFontPrefLang_Telugu = 26,
eFontPrefLang_Kannada = 27,
eFontPrefLang_Sinhala = 28,
eFontPrefLang_LangCount = 29, // except Others and UserDefined.
eFontPrefLang_Others = 29, // x-unicode
eFontPrefLang_UserDefined = 30,
eFontPrefLang_CJKSet = 31, // special code for CJK set
eFontPrefLang_AllCount = 32
};
enum eCMSMode {
eCMSMode_Off = 0, // No color management
eCMSMode_All = 1, // Color manage everything
eCMSMode_TaggedOnly = 2, // Color manage tagged Images Only
eCMSMode_AllCount = 3
};
// when searching through pref langs, max number of pref langs
const PRUint32 kMaxLenPrefLangList = 32;
class THEBES_API gfxPlatform {
public:
/**
* Return a pointer to the current active platform.
* This is a singleton; it contains mostly convenience
* functions to obtain platform-specific objects.
*/
static gfxPlatform *GetPlatform();
/**
* Start up Thebes. This can fail.
*/
static nsresult Init();
/**
* Clean up static objects to shut down thebes.
*/
static void Shutdown();
/**
* Create an offscreen surface of the given dimensions
* and image format.
*/
virtual already_AddRefed<gfxASurface> CreateOffscreenSurface(const gfxIntSize& size,
gfxASurface::gfxImageFormat imageFormat) = 0;
virtual already_AddRefed<gfxASurface> OptimizeImage(gfxImageSurface *aSurface,
gfxASurface::gfxImageFormat format);
/*
* Font bits
*/
/**
* Fill aListOfFonts with the results of querying the list of font names
* that correspond to the given language group or generic font family
* (or both, or neither).
*/
virtual nsresult GetFontList(const nsACString& aLangGroup,
const nsACString& aGenericFamily,
nsStringArray& aListOfFonts);
/**
* Rebuilds the any cached system font lists
*/
virtual nsresult UpdateFontList();
/**
* Font name resolver, this returns actual font name(s) by the callback
* function. If the font doesn't exist, the callback function is not called.
* If the callback function returns PR_FALSE, the aAborted value is set to
* PR_TRUE, otherwise, PR_FALSE.
*/
typedef PRBool (*FontResolverCallback) (const nsAString& aName,
void *aClosure);
virtual nsresult ResolveFontName(const nsAString& aFontName,
FontResolverCallback aCallback,
void *aClosure,
PRBool& aAborted) = 0;
/**
* Resolving a font name to family name. The result MUST be in the result of GetFontList().
* If the name doesn't in the system, aFamilyName will be empty string, but not failed.
*/
virtual nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) = 0;
/**
* Create the appropriate platform font group
*/
virtual gfxFontGroup *CreateFontGroup(const nsAString& aFamilies,
const gfxFontStyle *aStyle,
gfxUserFontSet *aUserFontSet) = 0;
/**
* Look up a local platform font using the full font face name.
* (Needed to support @font-face src local().)
* Ownership of the returned gfxFontEntry is passed to the caller,
* who must either AddRef() or delete.
*/
virtual gfxFontEntry* LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
const nsAString& aFontName)
{ return nsnull; }
/**
* Activate a platform font. (Needed to support @font-face src url().)
* aFontData must persist as long as a reference is held to aLoader.
* Ownership of the returned gfxFontEntry is passed to the caller,
* who must either AddRef() or delete.
*/
virtual gfxFontEntry* MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
nsISupports *aLoader,
const PRUint8 *aFontData,
PRUint32 aLength)
{ return nsnull; }
/**
* Whether to allow downloadable fonts via @font-face rules
*/
virtual PRBool DownloadableFontsEnabled();
// check whether format is supported on a platform or not (if unclear, returns true)
virtual PRBool IsFontFormatSupported(nsIURI *aFontURI, PRUint32 aFormatFlags) { return PR_FALSE; }
void GetPrefFonts(const char *aLangGroup, nsString& array, PRBool aAppendUnicode = PR_TRUE);
/**
* Iterate over pref fonts given a list of lang groups. For a single lang
* group, multiple pref fonts are possible. If error occurs, returns PR_FALSE,
* PR_TRUE otherwise. Callback returns PR_FALSE to abort process.
*/
typedef PRBool (*PrefFontCallback) (eFontPrefLang aLang, const nsAString& aName,
void *aClosure);
static PRBool ForEachPrefFont(eFontPrefLang aLangArray[], PRUint32 aLangArrayLen,
PrefFontCallback aCallback,
void *aClosure);
// convert a lang group string to enum constant (i.e. "zh-TW" ==> eFontPrefLang_ChineseTW)
static eFontPrefLang GetFontPrefLangFor(const char* aLang);
// convert a enum constant to lang group string (i.e. eFontPrefLang_ChineseTW ==> "zh-TW")
static const char* GetPrefLangName(eFontPrefLang aLang);
// returns true if a pref lang is CJK
static PRBool IsLangCJK(eFontPrefLang aLang);
// helper method to add a pref lang to an array, if not already in array
static void AppendPrefLang(eFontPrefLang aPrefLangs[], PRUint32& aLen, eFontPrefLang aAddLang);
/**
* Are we going to try color management?
*/
static eCMSMode GetCMSMode();
/**
* Determines the rendering intent for color management.
*
* If the value in the pref gfx.color_management.rendering_intent is a
* valid rendering intent as defined in modules/lcms/include/lcms.h, that
* value is returned. Otherwise, -1 is returned and the embedded intent
* should be used.
*
* See bug 444014 for details.
*/
static int GetRenderingIntent();
/**
* Convert a pixel using a cms transform in an endian-aware manner.
*
* Sets 'out' to 'in' if transform is NULL.
*/
static void TransformPixel(const gfxRGBA& in, gfxRGBA& out, qcms_transform *transform);
/**
* Return the output device ICC profile.
*/
static qcms_profile* GetCMSOutputProfile();
/**
* Return the sRGB ICC profile.
*/
static qcms_profile* GetCMSsRGBProfile();
/**
* Return sRGB -> output device transform.
*/
static qcms_transform* GetCMSRGBTransform();
/**
* Return output -> sRGB device transform.
*/
static qcms_transform* GetCMSInverseRGBTransform();
/**
* Return sRGBA -> output device transform.
*/
static qcms_transform* GetCMSRGBATransform();
protected:
gfxPlatform() { }
virtual ~gfxPlatform();
private:
virtual qcms_profile* GetPlatformCMSOutputProfile();
nsCOMPtr<nsIObserver> overrideObserver;
};
#endif /* GFX_PLATFORM_H */
|
{
"pile_set_name": "Github"
}
|
/*=============================================================================
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef BOOST_SPIRIT_ACTOR_REF_ACTOR_HPP
#define BOOST_SPIRIT_ACTOR_REF_ACTOR_HPP
#include <boost/spirit/home/classic/namespace.hpp>
namespace boost { namespace spirit {
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
///////////////////////////////////////////////////////////////////////////
// Summary:
// A semantic action policy holder. This holder stores a reference to ref,
// act methods are fead with this reference. The parse result is not used
// by this holder.
//
// (This doc uses convention available in actors.hpp)
//
// Constructor:
// ...(T& ref_);
// where ref_ is stored.
//
// Action calls:
// act(ref);
//
// () operators: both
//
///////////////////////////////////////////////////////////////////////////
template<
typename T,
typename ActionT
>
class ref_actor : public ActionT
{
private:
T& ref;
public:
explicit
ref_actor(T& ref_)
: ref(ref_){}
template<typename T2>
void operator()(T2 const& /*val*/) const
{
this->act(ref); // defined in ActionT
}
template<typename IteratorT>
void operator()(
IteratorT const& /*first*/,
IteratorT const& /*last*/
) const
{
this->act(ref); // defined in ActionT
}
};
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
}}
#endif
|
{
"pile_set_name": "Github"
}
|
/**
* This file is copyright 2017 State of the Netherlands (Ministry of Interior Affairs and Kingdom Relations).
* It is made available under the terms of the GNU Affero General Public License, version 3 as published by the Free Software Foundation.
* The project of which this file is part, may be found at https://github.com/MinBZK/operatieBRP.
*/
package nl.bzk.brp.model.validatie.validator;
import java.util.HashSet;
import java.util.Set;
import junit.framework.Assert;
import nl.bzk.brp.model.algemeen.attribuuttype.kern.Volgnummer;
import nl.bzk.brp.model.algemeen.attribuuttype.kern.Voornaam;
import nl.bzk.brp.model.bericht.kern.PersoonNationaliteitBericht;
import nl.bzk.brp.model.bericht.kern.PersoonVoornaamBericht;
import nl.bzk.brp.model.bericht.kern.PersoonVoornaamStandaardGroepBericht;
import nl.bzk.brp.util.StatischeObjecttypeBuilder;
import org.junit.Ignore;
import org.junit.Test;
public class CollectieMetUniekeWaardenValidatorTest {
private final CollectieMetUniekeWaardenValidator validator = new CollectieMetUniekeWaardenValidator();
@Test
public void test1Waarde() {
Set<PersoonVoornaamBericht> persoonVoornamen = new HashSet<PersoonVoornaamBericht>();
PersoonVoornaamBericht voornaam = new PersoonVoornaamBericht();
voornaam.setVolgnummer(new Volgnummer(1));
PersoonVoornaamStandaardGroepBericht standaardGroep = new PersoonVoornaamStandaardGroepBericht();
standaardGroep.setNaam(new Voornaam("Piet"));
voornaam.setStandaard(standaardGroep);
persoonVoornamen.add(voornaam);
Assert.assertTrue(validator.isValid(persoonVoornamen, null));
}
@Test
@Ignore
public void testDezelfdeVolgnummers() {
Set<PersoonVoornaamBericht> persoonVoornamen = new HashSet<PersoonVoornaamBericht>();
PersoonVoornaamBericht voornaam = new PersoonVoornaamBericht();
voornaam.setVolgnummer(new Volgnummer(1));
PersoonVoornaamStandaardGroepBericht standaardGroep = new PersoonVoornaamStandaardGroepBericht();
standaardGroep.setNaam(new Voornaam("Piet"));
voornaam.setStandaard(standaardGroep);
persoonVoornamen.add(voornaam);
PersoonVoornaamBericht voornaam2 = new PersoonVoornaamBericht();
voornaam2.setVolgnummer(new Volgnummer(1));
PersoonVoornaamStandaardGroepBericht standaardGroep2 = new PersoonVoornaamStandaardGroepBericht();
standaardGroep2.setNaam(new Voornaam("Jan"));
voornaam2.setStandaard(standaardGroep2);
persoonVoornamen.add(voornaam2);
Assert.assertFalse(validator.isValid(persoonVoornamen, null));
}
@Test
public void testVerschillendeVolgnummers() {
Set<PersoonVoornaamBericht> persoonVoornamen = new HashSet<PersoonVoornaamBericht>();
PersoonVoornaamBericht voornaam = new PersoonVoornaamBericht();
voornaam.setVolgnummer(new Volgnummer(1));
PersoonVoornaamStandaardGroepBericht standaardGroep = new PersoonVoornaamStandaardGroepBericht();
standaardGroep.setNaam(new Voornaam("Piet"));
voornaam.setStandaard(standaardGroep);
persoonVoornamen.add(voornaam);
PersoonVoornaamBericht voornaam2 = new PersoonVoornaamBericht();
voornaam2.setVolgnummer(new Volgnummer(2));
PersoonVoornaamStandaardGroepBericht standaardGroep2 = new PersoonVoornaamStandaardGroepBericht();
standaardGroep2.setNaam(new Voornaam("Jan"));
voornaam2.setStandaard(standaardGroep2);
persoonVoornamen.add(voornaam2);
Assert.assertTrue(validator.isValid(persoonVoornamen, null));
}
@Test
public void testVerschillendeVolgnummersMaarDezelfdeNaam() {
Set<PersoonVoornaamBericht> persoonVoornamen = new HashSet<PersoonVoornaamBericht>();
PersoonVoornaamBericht voornaam = new PersoonVoornaamBericht();
voornaam.setVolgnummer(new Volgnummer(1));
PersoonVoornaamStandaardGroepBericht standaardGroep = new PersoonVoornaamStandaardGroepBericht();
standaardGroep.setNaam(new Voornaam("Piet"));
voornaam.setStandaard(standaardGroep);
persoonVoornamen.add(voornaam);
PersoonVoornaamBericht voornaam2 = new PersoonVoornaamBericht();
voornaam2.setVolgnummer(new Volgnummer(2));
PersoonVoornaamStandaardGroepBericht standaardGroep2 = new PersoonVoornaamStandaardGroepBericht();
standaardGroep2.setNaam(new Voornaam("Piet"));
voornaam2.setStandaard(standaardGroep2);
persoonVoornamen.add(voornaam2);
Assert.assertTrue(validator.isValid(persoonVoornamen, null));
}
@Test
@Ignore
public void testDezelfdeVolgnummersMaarVerschillendeNamen() {
Set<PersoonVoornaamBericht> persoonVoornamen = new HashSet<PersoonVoornaamBericht>();
PersoonVoornaamBericht voornaam = new PersoonVoornaamBericht();
voornaam.setVolgnummer(new Volgnummer(1));
PersoonVoornaamStandaardGroepBericht standaardGroep = new PersoonVoornaamStandaardGroepBericht();
standaardGroep.setNaam(new Voornaam("Piet"));
voornaam.setStandaard(standaardGroep);
persoonVoornamen.add(voornaam);
PersoonVoornaamBericht voornaam2 = new PersoonVoornaamBericht();
voornaam2.setVolgnummer(new Volgnummer(1));
PersoonVoornaamStandaardGroepBericht standaardGroep2 = new PersoonVoornaamStandaardGroepBericht();
standaardGroep2.setNaam(new Voornaam("Jan"));
voornaam2.setStandaard(standaardGroep2);
persoonVoornamen.add(voornaam2);
Assert.assertFalse(validator.isValid(persoonVoornamen, null));
}
@Test
@Ignore
public void testDezelfdeNationaliteiten() {
Set<PersoonNationaliteitBericht> persoonNationalteiten = new HashSet<PersoonNationaliteitBericht>();
PersoonNationaliteitBericht persNation1 = new PersoonNationaliteitBericht();
// Nationaliteit nation1 = new Nationaliteit(new Nationaliteitcode("2"), null, null, null);
persNation1.setNationaliteit(StatischeObjecttypeBuilder.NATIONALITEIT_NEDERLANDS);
PersoonNationaliteitBericht persNation2 = new PersoonNationaliteitBericht();
// Nationaliteit nation2 = new Nationaliteit(new Nationaliteitcode("2"), null, null, null);
persNation2.setNationaliteit(StatischeObjecttypeBuilder.NATIONALITEIT_NEDERLANDS);
//2x toevoegen!
persoonNationalteiten.add(persNation1);
persoonNationalteiten.add(persNation2);
Assert.assertFalse(validator.isValid(persoonNationalteiten, null));
}
}
|
{
"pile_set_name": "Github"
}
|
/*
Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package validation
import (
"strings"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/apimachinery/pkg/util/validation/field"
)
const IsNegativeErrorMsg string = `must be greater than or equal to 0`
// ValidateNameFunc validates that the provided name is valid for a given resource type.
// Not all resources have the same validation rules for names. Prefix is true
// if the name will have a value appended to it. If the name is not valid,
// this returns a list of descriptions of individual characteristics of the
// value that were not valid. Otherwise this returns an empty list or nil.
type ValidateNameFunc func(name string, prefix bool) []string
// NameIsDNSSubdomain is a ValidateNameFunc for names that must be a DNS subdomain.
func NameIsDNSSubdomain(name string, prefix bool) []string {
if prefix {
name = maskTrailingDash(name)
}
return validation.IsDNS1123Subdomain(name)
}
// NameIsDNSLabel is a ValidateNameFunc for names that must be a DNS 1123 label.
func NameIsDNSLabel(name string, prefix bool) []string {
if prefix {
name = maskTrailingDash(name)
}
return validation.IsDNS1123Label(name)
}
// NameIsDNS1035Label is a ValidateNameFunc for names that must be a DNS 952 label.
func NameIsDNS1035Label(name string, prefix bool) []string {
if prefix {
name = maskTrailingDash(name)
}
return validation.IsDNS1035Label(name)
}
// ValidateNamespaceName can be used to check whether the given namespace name is valid.
// Prefix indicates this name will be used as part of generation, in which case
// trailing dashes are allowed.
var ValidateNamespaceName = NameIsDNSLabel
// ValidateServiceAccountName can be used to check whether the given service account name is valid.
// Prefix indicates this name will be used as part of generation, in which case
// trailing dashes are allowed.
var ValidateServiceAccountName = NameIsDNSSubdomain
// maskTrailingDash replaces the final character of a string with a subdomain safe
// value if is a dash.
func maskTrailingDash(name string) string {
if strings.HasSuffix(name, "-") {
return name[:len(name)-2] + "a"
}
return name
}
// Validates that given value is not negative.
func ValidateNonnegativeField(value int64, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if value < 0 {
allErrs = append(allErrs, field.Invalid(fldPath, value, IsNegativeErrorMsg))
}
return allErrs
}
|
{
"pile_set_name": "Github"
}
|
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=4:tabstop=4:
*/
/*
* Copyright (C) 2015-2016 CEA/DAM
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the CeCILL License.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license (http://www.cecill.info) and that you
* accept its terms.
*/
/**
* \file modules.h
* \author Henri Doreau
* \brief Dynamic modules management
*/
#ifndef _RBH_MODULES_H
#define _RBH_MODULES_H
#include "policy_rules.h"
#include "policy_run.h"
#include "status_manager.h"
/**
* Operations exposed by robinhood dynamic modules. These should be invoked
* using the static inline wrappers defined below.
*
* 'mod_get_name' and 'mod_get_version' are mandatory.
* Other operations are optional.
*/
struct rbh_module_operations {
const char *(*mod_get_name)(void);
int (*mod_get_version)(void);
status_manager_t *(*mod_get_status_manager)(void);
action_func_t (*mod_get_action)(const char *);
action_scheduler_t *(*mod_get_scheduler)(const char *);
};
/** current version of modules */
#define RBH_MODULE_VERSION 1
typedef struct rbh_module {
const char *name; /**< Module name */
int version; /**< Module version */
void *sym_hdl; /**< Private dlsym handle */
struct rbh_module_operations mod_ops; /**< Module operation vector */
} rbh_module_t;
/**
* Get the status manager associated to a robinhood dynamic module. This
* function will dlopen() the appropriate module if need be. The library handle
* will then remain cached until module_unload_all() is called.
*
* \param[in] name Module name from which to acquire the SM.
*
* \return The status manager or NULL on error
*/
status_manager_t *module_get_status_manager(const char *name);
/**
* Get an action function from a robinhood dynamic module. Actions function
* names are of the form <module_name>.<action>. We expect the whole string
* here. This function will dlopen() the appropriate module if need be. The
* library handle will then remain cached until module_unload_all() is called.
*
* \param[in] name The function name, <module_name>.<action>
*
* \return A pointer to the desired function or NULL if no suitable action
* of this name was found.
*/
action_func_t module_get_action(const char *name);
/**
* Get an action scheduler from a robinhood dynamic module.
* Scheduler are names of the form <module_name>.<sched_name>.
* We expect the whole string here.
* This function will dlopen() the appropriate module if needed.
* The library handle will then remain cached until module_unload_all() is
* called.
*
* \param[in] name The scheduler name: <module_name>.<sched_name>.
*
* \return A pointer to the desired scheduler or NULL if no item matches this
* name.
*/
action_scheduler_t *module_get_scheduler(const char *name);
/**
* Release resources associated to robinhood dynamic modules.
*
* \return 0 on success, appropriate negative error code on failure
*/
int module_unload_all(void);
#endif
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" standalone="yes" encoding="UTF-8"?>
<doc/>
|
{
"pile_set_name": "Github"
}
|
'use strict';
if (!require('./is-implemented')()) {
Object.defineProperty(Math, 'asinh', { value: require('./shim'),
configurable: true, enumerable: false, writable: true });
}
|
{
"pile_set_name": "Github"
}
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../../mode/sql/sql"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../../mode/sql/sql"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
var tables;
var defaultTable;
var keywords;
var CONS = {
QUERY_DIV: ";",
ALIAS_KEYWORD: "AS"
};
var Pos = CodeMirror.Pos;
function getKeywords(editor) {
var mode = editor.doc.modeOption;
if (mode === "sql") mode = "text/x-sql";
return CodeMirror.resolveMode(mode).keywords;
}
function getText(item) {
return typeof item == "string" ? item : item.text;
}
function getItem(list, item) {
if (!list.slice) return list[item];
for (var i = list.length - 1; i >= 0; i--) if (getText(list[i]) == item)
return list[i];
}
function shallowClone(object) {
var result = {};
for (var key in object) if (object.hasOwnProperty(key))
result[key] = object[key];
return result;
}
function match(string, word) {
var len = string.length;
var sub = getText(word).substr(0, len);
return string.toUpperCase() === sub.toUpperCase();
}
function addMatches(result, search, wordlist, formatter) {
for (var word in wordlist) {
if (!wordlist.hasOwnProperty(word)) continue;
if (Array.isArray(wordlist)) {
word = wordlist[word];
}
if (match(search, word)) {
result.push(formatter(word));
}
}
}
function cleanName(name) {
// Get rid name from backticks(`) and preceding dot(.)
if (name.charAt(0) == ".") {
name = name.substr(1);
}
return name.replace(/`/g, "");
}
function insertBackticks(name) {
var nameParts = getText(name).split(".");
for (var i = 0; i < nameParts.length; i++)
nameParts[i] = "`" + nameParts[i] + "`";
var escaped = nameParts.join(".");
if (typeof name == "string") return escaped;
name = shallowClone(name);
name.text = escaped;
return name;
}
function nameCompletion(cur, token, result, editor) {
// Try to complete table, colunm names and return start position of completion
var useBacktick = false;
var nameParts = [];
var start = token.start;
var cont = true;
while (cont) {
cont = (token.string.charAt(0) == ".");
useBacktick = useBacktick || (token.string.charAt(0) == "`");
start = token.start;
nameParts.unshift(cleanName(token.string));
token = editor.getTokenAt(Pos(cur.line, token.start));
if (token.string == ".") {
cont = true;
token = editor.getTokenAt(Pos(cur.line, token.start));
}
}
// Try to complete table names
var string = nameParts.join(".");
addMatches(result, string, tables, function(w) {
return useBacktick ? insertBackticks(w) : w;
});
// Try to complete columns from defaultTable
addMatches(result, string, defaultTable, function(w) {
return useBacktick ? insertBackticks(w) : w;
});
// Try to complete columns
string = nameParts.pop();
var table = nameParts.join(".");
// Check if table is available. If not, find table by Alias
if (!getItem(tables, table))
table = findTableByAlias(table, editor);
var columns = getItem(tables, table);
if (columns && Array.isArray(tables) && columns.columns)
columns = columns.columns;
if (columns) {
addMatches(result, string, columns, function(w) {
if (typeof w == "string") {
w = table + "." + w;
} else {
w = shallowClone(w);
w.text = table + "." + w.text;
}
return useBacktick ? insertBackticks(w) : w;
});
}
return start;
}
function eachWord(lineText, f) {
if (!lineText) return;
var excepted = /[,;]/g;
var words = lineText.split(" ");
for (var i = 0; i < words.length; i++) {
f(words[i]?words[i].replace(excepted, '') : '');
}
}
function convertCurToNumber(cur) {
// max characters of a line is 999,999.
return cur.line + cur.ch / Math.pow(10, 6);
}
function convertNumberToCur(num) {
return Pos(Math.floor(num), +num.toString().split('.').pop());
}
function findTableByAlias(alias, editor) {
var doc = editor.doc;
var fullQuery = doc.getValue();
var aliasUpperCase = alias.toUpperCase();
var previousWord = "";
var table = "";
var separator = [];
var validRange = {
start: Pos(0, 0),
end: Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).length)
};
//add separator
var indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV);
while(indexOfSeparator != -1) {
separator.push(doc.posFromIndex(indexOfSeparator));
indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV, indexOfSeparator+1);
}
separator.unshift(Pos(0, 0));
separator.push(Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).text.length));
//find valid range
var prevItem = 0;
var current = convertCurToNumber(editor.getCursor());
for (var i=0; i< separator.length; i++) {
var _v = convertCurToNumber(separator[i]);
if (current > prevItem && current <= _v) {
validRange = { start: convertNumberToCur(prevItem), end: convertNumberToCur(_v) };
break;
}
prevItem = _v;
}
var query = doc.getRange(validRange.start, validRange.end, false);
for (var i = 0; i < query.length; i++) {
var lineText = query[i];
eachWord(lineText, function(word) {
var wordUpperCase = word.toUpperCase();
if (wordUpperCase === aliasUpperCase && getItem(tables, previousWord))
table = previousWord;
if (wordUpperCase !== CONS.ALIAS_KEYWORD)
previousWord = word;
});
if (table) break;
}
return table;
}
CodeMirror.registerHelper("hint", "sql", function(editor, options) {
tables = (options && options.tables) || {};
var defaultTableName = options && options.defaultTable;
defaultTable = (defaultTableName && getItem(tables, defaultTableName)) || [];
keywords = keywords || getKeywords(editor);
var cur = editor.getCursor();
var result = [];
var token = editor.getTokenAt(cur), start, end, search;
if (token.end > cur.ch) {
token.end = cur.ch;
token.string = token.string.slice(0, cur.ch - token.start);
}
if (token.string.match(/^[.`\w@]\w*$/)) {
search = token.string;
start = token.start;
end = token.end;
} else {
start = end = cur.ch;
search = "";
}
if (search.charAt(0) == "." || search.charAt(0) == "`") {
start = nameCompletion(cur, token, result, editor);
} else {
addMatches(result, search, tables, function(w) {return w;});
addMatches(result, search, defaultTable, function(w) {return w;});
addMatches(result, search, keywords, function(w) {return w.toUpperCase();});
}
return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)};
});
});
|
{
"pile_set_name": "Github"
}
|
// This is a trick taken from Esprima. It turns out that, on
// non-Chrome browsers, to check whether a string is in a set, a
// predicate containing a big ugly `switch` statement is faster than
// a regular expression, and on Chrome the two are about on par.
// This function uses `eval` (non-lexical) to produce such a
// predicate from a space-separated string of words.
//
// It starts by sorting the words by length.
// Reserved word lists for various dialects of the language
export const reservedWords = {
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
5: "class enum extends super const export import",
6: "enum",
strict: "implements interface let package private protected public static yield",
strictBind: "eval arguments"
}
// And the keywords
var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"
export const keywords = {
5: ecma5AndLessKeywords,
6: ecma5AndLessKeywords + " let const class extends export import yield super"
}
// ## Character categories
// Big ugly regular expressions that match characters in the
// whitespace, identifier, and identifier-start categories. These
// are only applied when a character is found to actually have a
// code point above 128.
// Generated by `bin/generate-identifier-regex.js`.
let nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0-\u08b2\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua7ad\ua7b0\ua7b1\ua7f7-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab5f\uab64\uab65\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc"
let nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d01-\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19b0-\u19c0\u19c8\u19c9\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1cf8\u1cf9\u1dc0-\u1df5\u1dfc-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2d\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f"
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]")
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]")
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null
// These are a run-length and offset encoded representation of the
// >0xffff code points that are a valid part of identifiers. The
// offset starts at 0x10000, and each pair of numbers represents an
// offset to the next range, and then a size of the range. They were
// generated by tools/generate-identifier-regex.js
var astralIdentifierStartCodes = [0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,99,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,98,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,955,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,38,17,2,24,133,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,32,4,287,47,21,1,2,0,185,46,82,47,21,0,60,42,502,63,32,0,449,56,1288,920,104,110,2962,1070,13266,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,16481,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,1340,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,16355,541]
var astralIdentifierCodes = [509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,16,9,83,11,168,11,6,9,8,2,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,316,19,13,9,214,6,3,8,112,16,16,9,82,12,9,9,535,9,20855,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,4305,6,792618,239]
// This has a complexity linear to the value of the code. The
// assumption is that looking up astral identifier characters is
// rare.
function isInAstralSet(code, set) {
let pos = 0x10000
for (let i = 0; i < set.length; i += 2) {
pos += set[i]
if (pos > code) return false
pos += set[i + 1]
if (pos >= code) return true
}
}
// Test whether a given character code starts an identifier.
export function isIdentifierStart(code, astral) {
if (code < 65) return code === 36
if (code < 91) return true
if (code < 97) return code === 95
if (code < 123) return true
if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code))
if (astral === false) return false
return isInAstralSet(code, astralIdentifierStartCodes)
}
// Test whether a given character is part of an identifier.
export function isIdentifierChar(code, astral) {
if (code < 48) return code === 36
if (code < 58) return true
if (code < 65) return false
if (code < 91) return true
if (code < 97) return code === 95
if (code < 123) return true
if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code))
if (astral === false) return false
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes)
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2014-2016 Media for Mobile
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.m4m.domain;
import org.m4m.AudioFormat;
import org.m4m.MediaFileInfo;
import org.m4m.Uri;
import org.m4m.VideoFormat;
import org.junit.Assert;
import org.junit.Test;
import java.io.FileDescriptor;
import static org.junit.Assert.assertEquals;
public class WhenGetFileInfo extends TestBase {
@Test
public void basicTest() throws Exception {
MediaSource mediaSource = create.mediaSource()
.with(create.videoFormat().withFrameSize(1024, 768).withBitRate(100).construct())
.with(create.audioFormat().withBitRate(200).construct())
.construct();
MediaFileInfo mediaFileInfo = create.mediaFileInfo().with(mediaSource).construct();
mediaFileInfo.setFileName("");
VideoFormat videoFormat = (VideoFormat) mediaFileInfo.getVideoFormat();
Assert.assertEquals(100, videoFormat.getVideoBitRateInKBytes());
AudioFormat audioFormat = (AudioFormat) mediaFileInfo.getAudioFormat();
Assert.assertEquals(200, audioFormat.getAudioBitrateInBytes());
Assert.assertEquals(0xFFFFFF, mediaFileInfo.getDurationInMicroSec());
int rotation = mediaFileInfo.getRotation();
}
@Test
public void getFileNameReturnsNull() throws Exception {
MediaFileInfo mediaFileInfo = create.mediaFileInfo().construct();
assertEquals(null, mediaFileInfo.getFileName());
}
@Test
public void getFileDescriptorReturnsNull() throws Exception {
MediaFileInfo mediaFileInfo = create.mediaFileInfo().construct();
assertEquals(null, mediaFileInfo.getFileDescriptor());
}
@Test
public void getUriReturnsNull() throws Exception {
MediaFileInfo mediaFileInfo = create.mediaFileInfo().construct();
assertEquals(null, mediaFileInfo.getUri());
}
@Test
public void addFileNameByFileName() throws Exception {
MediaFileInfo mediaFileInfo = create.mediaFileInfo().construct();
mediaFileInfo.setFileName("1.mp4");
String filename = mediaFileInfo.getFileName();
assertEquals("1.mp4", mediaFileInfo.getFileName());
assertEquals(null, mediaFileInfo.getFileDescriptor());
assertEquals(null, mediaFileInfo.getUri());
}
@Test
public void addFileNameByFileDescriptor() throws Exception {
FileDescriptor fileDescriptor = new FileDescriptor();
MediaFileInfo mediaFileInfo = create.mediaFileInfo().construct();
mediaFileInfo.setFileDescriptor(fileDescriptor);
assertEquals(fileDescriptor, mediaFileInfo.getFileDescriptor());
assertEquals(null, mediaFileInfo.getFileName());
assertEquals(null, mediaFileInfo.getUri());
}
@Test
public void addFileNameByUri() throws Exception {
MediaFileInfo mediaFileInfo = create.mediaFileInfo().construct();
mediaFileInfo.setUri(new Uri("uri://mp4"));
assertEquals("uri://mp4", mediaFileInfo.getUri().getString());
assertEquals(null, mediaFileInfo.getFileName());
assertEquals(null, mediaFileInfo.getFileDescriptor());
}
}
|
{
"pile_set_name": "Github"
}
|
slash\slash
space\ space
2slash\\2slash
|
{
"pile_set_name": "Github"
}
|
@available(watchOS 2.0, *)
class EKParticipant : EKObject, NSCopying {
var url: NSURL { get }
var name: String? { get }
var participantStatus: EKParticipantStatus { get }
var participantRole: EKParticipantRole { get }
var participantType: EKParticipantType { get }
@available(watchOS 2.0, *)
var isCurrentUser: Bool { get }
@available(watchOS 2.0, *)
var contactPredicate: NSPredicate { get }
@available(watchOS 2.0, *)
func copy(with zone: NSZone = nil) -> AnyObject
}
|
{
"pile_set_name": "Github"
}
|
. "/usr/share/cont-lib/cont-lib.sh"
# SEMICOLON_SPLIT VAR
# -------------------
# Split the contents of string variable VAR into list of strings (on separate
# line), each of those strings will be printed to standard output. The ';' and
# newline characters are used as split separators. You can use quadrigraph @.,@
# for ';' character not splitting the VAR (and use @&t@ to expand into empty
# string). More info about quadrigraphs may be found in autoconf info page.
cont_semicolon_split()
{
eval set -- "\"\$$1\""
test x = x"$1" && return 0
echo "$1" \
| sed \
-e 's/[[:space:]]*;[[:space:]]*/\n/g' \
-e 's/^[[:space:]]*//g' \
-e 's/\([^\\]\)[[:space:]]*$/\1/g' \
| sed \
-e 's|@.,@|;|g' \
-e 's|@&t@||g'
}
# CONT_PARSER_SIMPLE_CONFIG CONFIG_VAR CALLBACK [ARGS]
# ----------------------------------------------------
# Parse contents of variable of name CONFIG_VAR, call CALLBACK function (or
# command) for each parsed configuration option.
#
# The format of configuration file is:
#
# <key> = <value> [; ...]
#
# Content of <key> is not limited, but keep it sane please (lets say we support
# the C syntax of identifiers). The <value> must be single-line string. Should
# the <value> contain ';' or '\' character, it must be escaped by '\'.
#
# The semantics of CALLBACK you *must* provide is:
#
# CALLBACK KEY VALUE [ARGS]
# -------------------------
# KEY and VALUE are strings with parsed result. ARGS is additional payload
# you may provide during CONTAINER_SIMPLE_CONFIG_PARSER call.
#
# Example of usage:
#
# $ cat script.sh
# callback()
# {
# local var="$1" val="$2"
# shift 2
# test -n "$*" && local payload=" [$*]"
# echo "$var=$val$payload"
# }
# config='URL = "http://example.com"; semicolon = "@.,@"'
# cont_parser_simple_config config callback additional data
#
# $ ./script
# URL="http://example.com" [additional data]
# semicolon=";" [additional data]
cont_parser_simple_config()
{
local conf_var="$1"
local callback="$2"
shift 2
while read line; do
test -z "$line" && continue
if [[ $line =~ ^([^[:space:]]+)[[:space:]]*=[[:space:]]*(.*)$ ]]
then
local k="${BASH_REMATCH[1]}" v="${BASH_REMATCH[2]}"
cont_debug3 "calling callback with: $k = $v"
"$callback" "$k" "$v" "$@" || {
cont_error "$FUNCNAME: callback failed"
return 1
}
else
cont_warn "wrong config: $line"
fi
done < <(cont_semicolon_split "$conf_var")
return 0
}
|
{
"pile_set_name": "Github"
}
|
from __future__ import absolute_import, division, print_function, unicode_literals
import math
from pi3d.util import Utility
from pi3d.Shape import Shape
import logging
LOGGER = logging.getLogger(__name__)
class Sphere(Shape):
""" 3d model inherits from Shape"""
def __init__(self, camera=None, light=None,
radius=1, slices=12, sides=12, hemi=0.0, name="",
x=0.0, y=0.0, z=0.0, rx=0.0, ry=0.0, rz=0.0,
sx=1.0, sy=1.0, sz=1.0, cx=0.0, cy=0.0, cz=0.0, invert=False):
"""uses standard constructor for Shape extra Keyword arguments:
*radius*
radius of sphere
*slices*
number of latitude edges
*hemi*
if set to 0.5 it will only construct the top half of sphere
*sides*
number of sides for Shape._lathe() to use
*invert*
normals will face inwards, Texture will need flip=True
"""
super(Sphere, self).__init__(camera, light, name, x, y, z, rx, ry, rz,
sx, sy, sz, cx, cy, cz)
LOGGER.debug("Creating sphere ...")
path = []
#extra points added at poles to reduce distortion (mainly normals)
st = ((math.pi - 0.002) * (1.0 - hemi)) / slices
path.append((0.0, radius))
for r in range(slices + 1):
x, y = Utility.from_polar_rad(r * st + 0.001, radius)
path.append((y, x))
x, y = Utility.from_polar_rad(r * st + 0.002, radius)
path.append((y, x))
if invert:
path.reverse()
self.radius = radius
self.slices = slices
self.hemi = hemi
self.buf = [self._lathe(path, sides)]
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
* All rights reserved.
*
* This software may be modified and distributed under the terms of the
* BSD-3-Clause license. See the accompanying LICENSE file for details.
*/
#ifndef YARP_DEVICE_FAKE_MOTIONCONTROL
#define YARP_DEVICE_FAKE_MOTIONCONTROL
#include <yarp/os/Time.h>
#include <yarp/os/Bottle.h>
#include <yarp/sig/Vector.h>
#include <yarp/os/PeriodicThread.h>
#include <yarp/dev/DeviceDriver.h>
#include <yarp/dev/ControlBoardInterfaces.h>
#include <yarp/dev/ControlBoardInterfacesImpl.h>
#include <yarp/dev/IVirtualAnalogSensor.h>
#include <yarp/dev/ImplementVirtualAnalogSensor.h>
#include <mutex>
struct ImpedanceLimits
{
double min_stiff;
double max_stiff;
double min_damp;
double max_damp;
double param_a;
double param_b;
double param_c;
public:
ImpedanceLimits()
{
min_stiff=0;
max_stiff=0;
min_damp=0;
max_damp=0;
param_a=0;
param_b=0;
param_c=0;
}
double get_min_stiff()
{
return min_stiff;
}
double get_max_stiff()
{
return max_stiff;
}
double get_min_damp()
{
return min_damp;
}
double get_max_damp()
{
return max_damp;
}
};
struct ImpedanceParameters
{
double stiffness;
double damping;
ImpedanceLimits limits;
ImpedanceParameters() {stiffness=0; damping=0;}
};
/*
* @ingroup dev_impl_fake dev_impl_motor
*
* Documentation to be added
*
* The aim of this device is to mimic the expected behavior of a
* real motion control device to help testing the high level software.
*
* This device is implementing last version of interfaces and it is compatible
* with ControlBoardWrapper2 device.
*
* WIP - it is very basic now, not all interfaces are implemented yet.
*/
class FakeMotionControl :
public yarp::dev::DeviceDriver,
// public yarp::dev::DeviceResponder,
public yarp::os::PeriodicThread,
public yarp::dev::IPidControlRaw,
public yarp::dev::IControlCalibrationRaw,
public yarp::dev::IAmplifierControlRaw,
public yarp::dev::IEncodersTimedRaw,
public yarp::dev::IMotorEncodersRaw,
public yarp::dev::IMotorRaw,
public yarp::dev::IPositionControlRaw,
public yarp::dev::IVelocityControlRaw,
public yarp::dev::IControlModeRaw,
public yarp::dev::IControlLimitsRaw,
public yarp::dev::IPositionDirectRaw,
public yarp::dev::ITorqueControlRaw,
public yarp::dev::ICurrentControlRaw,
public yarp::dev::IPWMControlRaw,
public yarp::dev::IImpedanceControlRaw,
public yarp::dev::IInteractionModeRaw,
public yarp::dev::IAxisInfoRaw,
public yarp::dev::IVirtualAnalogSensorRaw, //*
public yarp::dev::ImplementControlCalibration,
public yarp::dev::ImplementAmplifierControl,
public yarp::dev::ImplementPidControl,
public yarp::dev::ImplementEncodersTimed,
public yarp::dev::ImplementPositionControl,
public yarp::dev::ImplementVelocityControl,
public yarp::dev::ImplementControlMode,
public yarp::dev::ImplementImpedanceControl,
public yarp::dev::ImplementMotorEncoders,
public yarp::dev::ImplementTorqueControl,
public yarp::dev::ImplementControlLimits,
public yarp::dev::ImplementPositionDirect,
public yarp::dev::ImplementInteractionMode,
public yarp::dev::ImplementCurrentControl,
public yarp::dev::ImplementPWMControl,
public yarp::dev::ImplementMotor,
public yarp::dev::ImplementAxisInfo,
public yarp::dev::ImplementVirtualAnalogSensor //*
{
private:
enum VerboseLevel
{
MUTE = 0, // only errors that prevent device from working
QUIET = 1, // adds errors that can cause malfunctioning
DEFAULT = 2, // adds warnings // DEFAULT // show noisy messages about back-compatible changes
CHATTY = 3, // adds info messages
VERBOSE = 4, // adds debug messages
VERY_VERBOSE = 5, // adds trace of events (shows thread running and catch if they get stuck)
VERY_VERY_VERBOSE = 6 // adds messages printed every cycle, so too much verbose for usage, only for deep debugging
};
std::mutex _mutex;
int _njoints;
int *_axisMap; /** axis remapping lookup-table */
double *_angleToEncoder; /** angle to iCubDegrees conversion factors */
double *_encodersStamp; /** keep information about acquisition time for encoders read */
double *_ampsToSensor;
double *_dutycycleToPWM;
float *_DEPRECATED_encoderconversionfactor; /** iCubDegrees to encoder conversion factors */
float *_DEPRECATED_encoderconversionoffset; /** iCubDegrees offset */
// uint8_t *_jointEncoderType; /** joint encoder type*/
int *_jointEncoderRes; /** joint encoder resolution */
int *_rotorEncoderRes; /** rotor encoder resolution */
// uint8_t *_rotorEncoderType; /** rotor encoder type*/
double *_gearbox; /** the gearbox ratio */
bool *_hasHallSensor; /** */
bool *_hasTempSensor; /** */
bool *_hasRotorEncoder; /** */
bool *_hasRotorEncoderIndex; /** */
int *_rotorIndexOffset; /** */
int *_motorPoles; /** */
double *_rotorlimits_max; /** */
double *_rotorlimits_min; /** */
yarp::dev::Pid *_ppids; /** initial position gains */
yarp::dev::Pid *_tpids; /** initial torque gains */
yarp::dev::Pid *_cpids; /** initial current gains */
yarp::dev::Pid *_vpids; /** initial velocity gains */
bool *_ppids_ena;
bool *_tpids_ena;
bool *_cpids_ena;
bool *_vpids_ena;
double *_ppids_lim;
double *_tpids_lim;
double *_cpids_lim;
double *_vpids_lim;
double *_ppids_ref;
double *_tpids_ref;
double *_cpids_ref;
double *_vpids_ref;
std::string *_axisName; /** axis name */
yarp::dev::JointTypeEnum *_jointType; /** axis type */
// ImpedanceLimits *_impedance_limits; /** impedance limits */
double *_limitsMin; /** joint limits, max*/
double *_limitsMax; /** joint limits, min*/
double *_kinematic_mj; /** the kinematic coupling matrix from joints space to motor space */
//double *_currentLimits; /** current limits */
// MotorCurrentLimits *_currentLimits;
double *_maxJntCmdVelocity; /** max joint commanded velocity */
double *_maxMotorVelocity; /** max motor velocity */
int *_velocityShifts; /** velocity shifts */
int *_velocityTimeout; /** velocity shifts */
double *_kbemf; /** back-emf compensation parameter */
double *_ktau; /** motor torque constant */
int *_kbemf_scale; /** back-emf compensation parameter */
int *_ktau_scale; /** motor torque constant */
int * _filterType; /** the filter type (int value) used by the force control algorithm */
int *_torqueSensorId; /** Id of associated Joint Torque Sensor */
int *_torqueSensorChan; /** Channel of associated Joint Torque Sensor */
double *_maxTorque; /** Max torque of a joint */
double *_newtonsToSensor; /** Newtons to force sensor units conversion factors */
bool *checking_motiondone; /* flag telling if I'm already waiting for motion done */
double *_last_position_move_time; /** time stamp for last received position move command*/
double *_motorPwmLimits; /** motors PWM limits*/
double *_torques; /** joint torques */
// ImpedanceParameters *_impedance_params; /** impedance parameters */
bool verbosewhenok;
bool useRawEncoderData;
bool _pwmIsLimited; /** set to true if pwm is limited */
bool _torqueControlEnabled; /** set to true if the torque control parameters are successfully loaded. If false, boards cannot switch in torque mode */
enum torqueControlUnitsType {T_MACHINE_UNITS=0, T_METRIC_UNITS=1};
torqueControlUnitsType _torqueControlUnits;
enum positionControlUnitsType {P_MACHINE_UNITS=0, P_METRIC_UNITS=1};
positionControlUnitsType _positionControlUnits;
// internal stuff
int *_controlModes;
int *_interactMode;
bool *_enabledAmp; // Middle step toward a full enabled motor controller. Amp (pwm) plus Pid enable command must be sent in order to get the joint into an active state.
bool *_enabledPid; // Depends on enabledAmp. When both are set, the joint exits the idle mode and goes into position mode. If one of them is disabled, it falls to idle.
bool *_calibrated; // Flag to know if the calibrate function has been called for the joint
double *_posCtrl_references; // used for position control.
double *_posDir_references; // used for position Direct control.
double *_ref_speeds; // used for position control.
double *_command_speeds; // used for velocity control.
double *_ref_accs; // for velocity control, in position min jerk eq is used.
double *_ref_torques; // for torque control.
double *_ref_currents;
yarp::sig::Vector current, nominalCurrent, maxCurrent, peakCurrent;
yarp::sig::Vector pwm, pwmLimit, refpwm, supplyVoltage,last_velocity_command, last_pwm_command;
yarp::sig::Vector pos, dpos, vel, speed, acc, loc, amp;
double prev_time;
bool opened;
// debugging
VerboseLevel verbose;
public:
FakeMotionControl();
~FakeMotionControl();
// Device Driver
bool open(yarp::os::Searchable &par) override;
bool close() override;
bool fromConfig(yarp::os::Searchable &config);
virtual bool initialised();
/**
* Allocated buffers.
*/
bool alloc(int njoints);
/**
* Resize previously allocated buffers.
*/
void resizeBuffers();
bool threadInit() override;
void threadRelease() override;
///////// PID INTERFACE /////////
bool setPidRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, const yarp::dev::Pid &pid) override;
bool setPidsRaw(const yarp::dev::PidControlTypeEnum& pidtype,const yarp::dev::Pid *pids) override;
bool setPidReferenceRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double ref) override;
bool setPidReferencesRaw(const yarp::dev::PidControlTypeEnum& pidtype,const double *refs) override;
bool setPidErrorLimitRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double limit) override;
bool setPidErrorLimitsRaw(const yarp::dev::PidControlTypeEnum& pidtype,const double *limits) override;
bool getPidErrorRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double *err) override;
bool getPidErrorsRaw(const yarp::dev::PidControlTypeEnum& pidtype, double *errs) override;
bool getPidOutputRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double *out) override;
bool getPidOutputsRaw(const yarp::dev::PidControlTypeEnum& pidtype,double *outs) override;
bool getPidRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, yarp::dev::Pid *pid) override;
bool getPidsRaw(const yarp::dev::PidControlTypeEnum& pidtype, yarp::dev::Pid *pids) override;
bool getPidReferenceRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double *ref) override;
bool getPidReferencesRaw(const yarp::dev::PidControlTypeEnum& pidtype,double *refs) override;
bool getPidErrorLimitRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double *limit) override;
bool getPidErrorLimitsRaw(const yarp::dev::PidControlTypeEnum& pidtype,double *limits) override;
bool resetPidRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j) override;
bool disablePidRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j) override;
bool enablePidRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j) override;
bool setPidOffsetRaw(const yarp::dev::PidControlTypeEnum& pidtype,int j, double v) override;
bool isPidEnabledRaw(const yarp::dev::PidControlTypeEnum& pidtype, int j, bool* enabled) override;
// POSITION CONTROL INTERFACE RAW
bool getAxes(int *ax) override;
bool positionMoveRaw(int j, double ref) override;
bool positionMoveRaw(const double *refs) override;
bool relativeMoveRaw(int j, double delta) override;
bool relativeMoveRaw(const double *deltas) override;
bool checkMotionDoneRaw(bool *flag) override;
bool checkMotionDoneRaw(int j, bool *flag) override;
bool setRefSpeedRaw(int j, double sp) override;
bool setRefSpeedsRaw(const double *spds) override;
bool setRefAccelerationRaw(int j, double acc) override;
bool setRefAccelerationsRaw(const double *accs) override;
bool getRefSpeedRaw(int j, double *ref) override;
bool getRefSpeedsRaw(double *spds) override;
bool getRefAccelerationRaw(int j, double *acc) override;
bool getRefAccelerationsRaw(double *accs) override;
bool stopRaw(int j) override;
bool stopRaw() override;
// Position Control2 Interface
bool positionMoveRaw(const int n_joint, const int *joints, const double *refs) override;
bool relativeMoveRaw(const int n_joint, const int *joints, const double *deltas) override;
bool checkMotionDoneRaw(const int n_joint, const int *joints, bool *flags) override;
bool setRefSpeedsRaw(const int n_joint, const int *joints, const double *spds) override;
bool setRefAccelerationsRaw(const int n_joint, const int *joints, const double *accs) override;
bool getRefSpeedsRaw(const int n_joint, const int *joints, double *spds) override;
bool getRefAccelerationsRaw(const int n_joint, const int *joints, double *accs) override;
bool stopRaw(const int n_joint, const int *joints) override;
bool getTargetPositionRaw(const int joint, double *ref) override;
bool getTargetPositionsRaw(double *refs) override;
bool getTargetPositionsRaw(const int n_joint, const int *joints, double *refs) override;
// Velocity control interface raw
bool velocityMoveRaw(int j, double sp) override;
bool velocityMoveRaw(const double *sp) override;
// calibration2raw
bool setCalibrationParametersRaw(int axis, const yarp::dev::CalibrationParameters& params) override;
bool calibrateAxisWithParamsRaw(int axis, unsigned int type, double p1, double p2, double p3) override;
bool calibrationDoneRaw(int j) override;
/////////////////////////////// END Position Control INTERFACE
// ControlMode
bool getControlModeRaw(int j, int *v) override;
bool getControlModesRaw(int *v) override;
// ControlMode 2
bool getControlModesRaw(const int n_joint, const int *joints, int *modes) override;
bool setControlModeRaw(const int j, const int mode) override;
bool setControlModesRaw(const int n_joint, const int *joints, int *modes) override;
bool setControlModesRaw(int *modes) override;
//////////////////////// BEGIN EncoderInterface
bool resetEncoderRaw(int j) override;
bool resetEncodersRaw() override;
bool setEncoderRaw(int j, double val) override;
bool setEncodersRaw(const double *vals) override;
bool getEncoderRaw(int j, double *v) override;
bool getEncodersRaw(double *encs) override;
bool getEncoderSpeedRaw(int j, double *sp) override;
bool getEncoderSpeedsRaw(double *spds) override;
bool getEncoderAccelerationRaw(int j, double *spds) override;
bool getEncoderAccelerationsRaw(double *accs) override;
///////////////////////// END Encoder Interface
bool getEncodersTimedRaw(double *encs, double *stamps) override;
bool getEncoderTimedRaw(int j, double *encs, double *stamp) override;
//////////////////////// BEGIN MotorEncoderInterface
bool getNumberOfMotorEncodersRaw(int * num) override;
bool resetMotorEncoderRaw(int m) override;
bool resetMotorEncodersRaw() override;
bool setMotorEncoderRaw(int m, const double val) override;
bool setMotorEncodersRaw(const double *vals) override;
bool getMotorEncoderRaw(int m, double *v) override;
bool getMotorEncodersRaw(double *encs) override;
bool getMotorEncoderSpeedRaw(int m, double *sp) override;
bool getMotorEncoderSpeedsRaw(double *spds) override;
bool getMotorEncoderAccelerationRaw(int m, double *spds) override;
bool getMotorEncoderAccelerationsRaw(double *accs) override;
bool getMotorEncodersTimedRaw(double *encs, double *stamps) override;
bool getMotorEncoderTimedRaw(int m, double *encs, double *stamp) override;\
bool getMotorEncoderCountsPerRevolutionRaw(int m, double *v) override;
bool setMotorEncoderCountsPerRevolutionRaw(int m, const double cpr) override;
///////////////////////// END MotorEncoder Interface
//////////////////////// BEGIN IAxisInfo Interface
bool getAxisNameRaw(int axis, std::string& name) override;
bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum& type) override;
///////////////////////// END IAxisInfo Interface
//Internal use, not exposed by Yarp (yet)
bool getGearboxRatioRaw(int m, double *gearbox) override;
virtual bool getRotorEncoderResolutionRaw(int m, double &rotres);
virtual bool getJointEncoderResolutionRaw(int m, double &jntres);
virtual bool getJointEncoderTypeRaw(int j, int &type);
virtual bool getRotorEncoderTypeRaw(int j, int &type);
virtual bool getKinematicMJRaw(int j, double &rotres);
virtual bool getHasTempSensorsRaw(int j, int& ret);
virtual bool getHasHallSensorRaw(int j, int& ret);
virtual bool getHasRotorEncoderRaw(int j, int& ret);
virtual bool getHasRotorEncoderIndexRaw(int j, int& ret);
virtual bool getMotorPolesRaw(int j, int& poles);
virtual bool getRotorIndexOffsetRaw(int j, double& rotorOffset);
virtual bool getTorqueControlFilterType(int j, int& type);
////// Amplifier interface
bool enableAmpRaw(int j) override;
bool disableAmpRaw(int j) override;
bool getCurrentsRaw(double *vals) override;
bool getCurrentRaw(int j, double *val) override;
bool getNominalCurrentRaw(int m, double *val) override;
bool setNominalCurrentRaw(int m, const double val) override;
bool setMaxCurrentRaw(int j, double val) override;
bool getMaxCurrentRaw(int j, double *val) override;
bool getPeakCurrentRaw(int m, double *val) override;
bool setPeakCurrentRaw(int m, const double val) override;
bool getAmpStatusRaw(int *st) override;
bool getAmpStatusRaw(int j, int *st) override;
bool getPWMRaw(int j, double* val) override;
bool getPWMLimitRaw(int j, double* val) override;
bool setPWMLimitRaw(int j, const double val) override;
bool getPowerSupplyVoltageRaw(int j, double* val) override;
/////////////// END AMPLIFIER INTERFACE
// Limits
bool setLimitsRaw(int axis, double min, double max) override;
bool getLimitsRaw(int axis, double *min, double *max) override;
// Limits 2
bool setVelLimitsRaw(int axis, double min, double max) override;
bool getVelLimitsRaw(int axis, double *min, double *max) override;
// Torque control
bool getTorqueRaw(int j, double *t) override;
bool getTorquesRaw(double *t) override;
bool getTorqueRangeRaw(int j, double *min, double *max) override;
bool getTorqueRangesRaw(double *min, double *max) override;
bool setRefTorquesRaw(const double *t) override;
bool setRefTorqueRaw(int j, double t) override;
bool setRefTorquesRaw(const int n_joint, const int *joints, const double *t) override;
bool getRefTorquesRaw(double *t) override;
bool getRefTorqueRaw(int j, double *t) override;
bool getMotorTorqueParamsRaw(int j, yarp::dev::MotorTorqueParameters *params) override;
bool setMotorTorqueParamsRaw(int j, const yarp::dev::MotorTorqueParameters params) override;
// int32_t getRefSpeedInTbl(uint8_t boardNum, int j, eOmeas_position_t pos) override;
// IVelocityControl2
bool velocityMoveRaw(const int n_joint, const int *joints, const double *spds) override;
bool getRefVelocityRaw(const int joint, double *ref) override;
bool getRefVelocitiesRaw(double *refs) override;
bool getRefVelocitiesRaw(const int n_joint, const int *joints, double *refs) override;
// Impedance interface
bool getImpedanceRaw(int j, double *stiffness, double *damping) override;
bool setImpedanceRaw(int j, double stiffness, double damping) override;
bool setImpedanceOffsetRaw(int j, double offset) override;
bool getImpedanceOffsetRaw(int j, double *offset) override;
bool getCurrentImpedanceLimitRaw(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp) override;
// PositionDirect Interface
bool setPositionRaw(int j, double ref) override;
bool setPositionsRaw(const int n_joint, const int *joints, const double *refs) override;
bool setPositionsRaw(const double *refs) override;
bool getRefPositionRaw(const int joint, double *ref) override;
bool getRefPositionsRaw(double *refs) override;
bool getRefPositionsRaw(const int n_joint, const int *joints, double *refs) override;
// InteractionMode interface
bool getInteractionModeRaw(int j, yarp::dev::InteractionModeEnum* _mode) override;
bool getInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum* modes) override;
bool getInteractionModesRaw(yarp::dev::InteractionModeEnum* modes) override;
bool setInteractionModeRaw(int j, yarp::dev::InteractionModeEnum _mode) override;
bool setInteractionModesRaw(int n_joints, int *joints, yarp::dev::InteractionModeEnum* modes) override;
bool setInteractionModesRaw(yarp::dev::InteractionModeEnum* modes) override;
// IMotor interface
bool getNumberOfMotorsRaw(int * num) override;
bool getTemperatureRaw(int m, double* val) override;
bool getTemperaturesRaw(double *vals) override;
bool getTemperatureLimitRaw(int m, double *temp) override;
bool setTemperatureLimitRaw(int m, const double temp) override;
// PWM interface
bool setRefDutyCycleRaw(int j, double v) override;
bool setRefDutyCyclesRaw(const double *v) override;
bool getRefDutyCycleRaw(int j, double *v) override;
bool getRefDutyCyclesRaw(double *v) override;
bool getDutyCycleRaw(int j, double *v) override;
bool getDutyCyclesRaw(double *v) override;
// Current interface
//bool getAxes(int *ax) override;
//bool getCurrentRaw(int j, double *t) override;
//bool getCurrentsRaw(double *t) override;
bool getCurrentRangeRaw(int j, double *min, double *max) override;
bool getCurrentRangesRaw(double *min, double *max) override;
bool setRefCurrentsRaw(const double *t) override;
bool setRefCurrentRaw(int j, double t) override;
bool setRefCurrentsRaw(const int n_joint, const int *joints, const double *t) override;
bool getRefCurrentsRaw(double *t) override;
bool getRefCurrentRaw(int j, double *t) override;
yarp::dev::VAS_status getVirtualAnalogSensorStatusRaw(int ch) override;
int getVirtualAnalogSensorChannelsRaw() override;
bool updateVirtualAnalogSensorMeasureRaw(yarp::sig::Vector &measure) override;
bool updateVirtualAnalogSensorMeasureRaw(int ch, double &measure) override;
void run() override;
private:
void cleanup();
bool dealloc();
bool parsePositionPidsGroup(yarp::os::Bottle& pidsGroup, yarp::dev::Pid myPid[]);
bool parseTorquePidsGroup(yarp::os::Bottle& pidsGroup, yarp::dev::Pid myPid[], double kbemf[], double ktau[], int filterType[]);
bool parseImpedanceGroup_NewFormat(yarp::os::Bottle& pidsGroup, ImpedanceParameters vals[]);
bool extractGroup(yarp::os::Bottle &input, yarp::os::Bottle &out, const std::string &key1, const std::string &txt, int size);
};
#endif // YARP_DEVICE_FAKE_MOTIONCONTROL
|
{
"pile_set_name": "Github"
}
|
import { Subject } from '../Subject';
import { Observable } from '../Observable';
import { ConnectableObservable } from '../observable/ConnectableObservable';
import { multicast as higherOrder } from '../operators/multicast';
import { FactoryOrValue, MonoTypeOperatorFunction, OperatorFunction } from '../interfaces';
/* tslint:disable:max-line-length */
export function multicast<T>(this: Observable<T>, subjectOrSubjectFactory: FactoryOrValue<Subject<T>>): ConnectableObservable<T>;
export function multicast<T>(SubjectFactory: (this: Observable<T>) => Subject<T>, selector?: MonoTypeOperatorFunction<T>): Observable<T>;
export function multicast<T, R>(SubjectFactory: (this: Observable<T>) => Subject<T>, selector?: OperatorFunction<T, R>): Observable<R>;
/* tslint:enable:max-line-length */
/**
* Allows source Observable to be subscribed only once with a Subject of choice,
* while still sharing its values between multiple subscribers.
*
* <span class="informal">Subscribe to Observable once, but send its values to multiple subscribers.</span>
*
* <img src="./img/multicast.png" width="100%">
*
* `multicast` is an operator that works in two modes.
*
* In the first mode you provide a single argument to it, which can be either an initialized Subject or a Subject
* factory. As a result you will get a special kind of an Observable - a {@link ConnectableObservable}. It can be
* subscribed multiple times, just as regular Observable, but it won't subscribe to the source Observable at that
* moment. It will do it only if you call its `connect` method. This means you can essentially control by hand, when
* source Observable will be actually subscribed. What is more, ConnectableObservable will share this one subscription
* between all of its subscribers. This means that, for example, `ajax` Observable will only send a request once,
* even though usually it would send a request per every subscriber. Since it sends a request at the moment of
* subscription, here request would be sent when the `connect` method of a ConnectableObservable is called.
*
* The most common pattern of using ConnectableObservable is calling `connect` when the first consumer subscribes,
* keeping the subscription alive while several consumers come and go and finally unsubscribing from the source
* Observable, when the last consumer unsubscribes. To not implement that logic over and over again,
* ConnectableObservable has a special operator, `refCount`. When called, it returns an Observable, which will count
* the number of consumers subscribed to it and keep ConnectableObservable connected as long as there is at least
* one consumer. So if you don't actually need to decide yourself when to connect and disconnect a
* ConnectableObservable, use `refCount`.
*
* The second mode is invoked by calling `multicast` with an additional, second argument - selector function.
* This function accepts an Observable - which basically mirrors the source Observable - and returns Observable
* as well, which should be the input stream modified by any operators you want. Note that in this
* mode you cannot provide initialized Subject as a first argument - it has to be a Subject factory. If
* you provide selector function, `multicast` returns just a regular Observable, instead of ConnectableObservable.
* Thus, as usual, each subscription to this stream triggers subscription to the source Observable. However,
* if inside the selector function you subscribe to the input Observable multiple times, actual source stream
* will be subscribed only once. So if you have a chain of operators that use some Observable many times,
* but you want to subscribe to that Observable only once, this is the mode you would use.
*
* Subject provided as a first parameter of `multicast` is used as a proxy for the single subscription to the
* source Observable. It means that all values from the source stream go through that Subject. Thus, if a Subject
* has some special properties, Observable returned by `multicast` will have them as well. If you want to use
* `multicast` with a Subject that is one of the ones included in RxJS by default - {@link Subject},
* {@link AsyncSubject}, {@link BehaviorSubject}, or {@link ReplaySubject} - simply use {@link publish},
* {@link publishLast}, {@link publishBehavior} or {@link publishReplay} respectively. These are actually
* just wrappers around `multicast`, with a specific Subject hardcoded inside.
*
* Also, if you use {@link publish} or {@link publishReplay} with a ConnectableObservables `refCount` operator,
* you can simply use {@link share} and {@link shareReplay} respectively, which chain these two.
*
* @example <caption>Use ConnectableObservable</caption>
* const seconds = Rx.Observable.interval(1000);
* const connectableSeconds = seconds.multicast(new Subject());
*
* connectableSeconds.subscribe(value => console.log('first: ' + value));
* connectableSeconds.subscribe(value => console.log('second: ' + value));
*
* // At this point still nothing happens, even though we subscribed twice.
*
* connectableSeconds.connect();
*
* // From now on `seconds` are being logged to the console,
* // twice per every second. `seconds` Observable was however only subscribed once,
* // so under the hood Observable.interval had only one clock started.
*
* @example <caption>Use selector</caption>
* const seconds = Rx.Observable.interval(1000);
*
* seconds
* .multicast(
* () => new Subject(),
* seconds => seconds.zip(seconds) // Usually zip would subscribe to `seconds` twice.
* // Because we are inside selector, `seconds` is subscribed once,
* ) // thus starting only one clock used internally by Observable.interval.
* .subscribe();
*
* @see {@link publish}
* @see {@link publishLast}
* @see {@link publishBehavior}
* @see {@link publishReplay}
* @see {@link share}
* @see {@link shareReplay}
*
* @param {Function|Subject} subjectOrSubjectFactory - Factory function to create an intermediate Subject through
* which the source sequence's elements will be multicast to the selector function input Observable or
* ConnectableObservable returned by the operator.
* @param {Function} [selector] - Optional selector function that can use the input stream
* as many times as needed, without causing multiple subscriptions to the source stream.
* Subscribers to the input source will receive all notifications of the source from the
* time of the subscription forward.
* @return {Observable<T>|ConnectableObservable<T>} An Observable that emits the results of invoking the selector
* on the source stream or a special {@link ConnectableObservable}, if selector was not provided.
*
* @method multicast
* @owner Observable
*/
export function multicast<T, R>(this: Observable<T>, subjectOrSubjectFactory: Subject<T> | (() => Subject<T>),
selector?: (source: Observable<T>) => Observable<R>): Observable<R> | ConnectableObservable<R> {
return higherOrder(<any>subjectOrSubjectFactory, selector)(this);
}
|
{
"pile_set_name": "Github"
}
|
:import {
-st-from: "./recursive-import-2.st.css";
-st-default: Comp;
}
.gaga {
-st-extends: Comp;
-st-states: lala;
}
.gaga::bobo::shlomo|
|
{
"pile_set_name": "Github"
}
|
JASC-PAL
0100
16
230 230 230
255 255 255
222 222 222
180 180 180
90 90 90
230 123 189
189 82 148
131 41 106
82 0 41
255 0 255
255 0 255
255 205 74
213 172 0
172 115 0
123 32 0
16 16 16
|
{
"pile_set_name": "Github"
}
|
package io.adaptivecards.adaptivecardssample.CustomObjects.Media;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import io.adaptivecards.renderer.GenericImageLoaderAsync;
import io.adaptivecards.renderer.IResourceResolver;
import io.adaptivecards.renderer.http.HttpRequestResult;
public class LocalResourcesLoader implements IResourceResolver
{
public LocalResourcesLoader(Activity activity)
{
m_activity = activity;
}
@Override
public HttpRequestResult<Bitmap> resolveImageResource(String url, GenericImageLoaderAsync loader) throws IOException, URISyntaxException
{
// Get image identifier
String authority = m_activity.getPackageName();
Resources resources = m_activity.getResources();
// For host app only provides image file name as url, host app can pass "package:[IMAGE NAME]" as replacement for
// meeting the valid URL format checking. Here we will remove this prefix to get file name.
if (url.startsWith("package:"))
{
url = url.replace("package:", "drawable/");
}
int identifier = resources.getIdentifier(url, "", authority);
if (identifier == 0)
{
throw new IOException("Image not found: " + url);
}
InputStream ins = resources.openRawResource(identifier);
Bitmap bitmap = BitmapFactory.decodeStream(ins);
if (bitmap == null)
{
throw new IOException("Failed to convert local content to bitmap: " + url);
}
return new HttpRequestResult<>(bitmap);
}
@Override
public HttpRequestResult<Bitmap> resolveImageResource(String url, GenericImageLoaderAsync loader, int maxWidth) throws IOException, URISyntaxException
{
return resolveImageResource(url, loader);
}
private Activity m_activity;
}
|
{
"pile_set_name": "Github"
}
|
/*******************************
Theme Overrides
*******************************/
|
{
"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>SchemeUserState</key>
<dict>
<key>RxSwiftTableViewSection.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>8C67DCCD1E8AA90400714CE7</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
|
{
"pile_set_name": "Github"
}
|
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Task Oriented Chatbot"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"+ Background\n",
"+ Pipeline\n",
"+ Question Parsing\n",
"+ Question Parsing and Generating\n",
"+ Information Retrieval \n",
"+ Mul-round QA"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import random"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"## 1. pattern :> customer's input\n",
"## 2. response :> host's output"
]
},
{
"cell_type": "code",
"execution_count": 163,
"metadata": {},
"outputs": [],
"source": [
"human = \"\"\"\n",
"human = 自己 寻找 活动\n",
"自己 = 我 | 俺 | 我们 \n",
"寻找 = 看看 | 找找 | 想找点\n",
"活动 = 乐子 | 玩的\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 164,
"metadata": {},
"outputs": [],
"source": [
"number_response = \"\"\"\n",
"number_response = 你能做什么 几号\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 165,
"metadata": {},
"outputs": [],
"source": [
"host = \"\"\"\n",
"host = 寒暄 报数 询问 业务相关 结尾 \n",
"报数 = 我是 数字 号 ,\n",
"数字 = 单个数字 | 数字 单个数字 \n",
"单个数字 = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 \n",
"寒暄 = 称谓 打招呼 | 打招呼\n",
"称谓 = 人称 ,\n",
"人称 = 先生 | 女士 | 小朋友\n",
"打招呼 = 你好 | 您好 \n",
"询问 = 请问你要 | 您需要\n",
"业务相关 = 玩玩 具体业务\n",
"玩玩 = 耍一耍 | 玩一玩\n",
"具体业务 = 喝酒 | 打牌 | 打猎 | 赌博\n",
"结尾 = 吗?\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 146,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'我是2号'"
]
},
"execution_count": 146,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'我是 2 号'"
]
},
{
"cell_type": "code",
"execution_count": 148,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'先生你好'"
]
},
"execution_count": 148,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"'先生 你好'"
]
},
{
"cell_type": "code",
"execution_count": 152,
"metadata": {},
"outputs": [],
"source": [
"human_pattern = {}\n",
"host_pattern = {}\n",
"\n",
"def generate_grammer(grammer_define, grammer_pattern):\n",
" for line in grammer_define.split('\\n'):\n",
" if not line: continue\n",
" key, rules = line.split('=')\n",
" key = key.strip()\n",
" rules = rules.split('|')\n",
" grammer_pattern[key] = rules\n",
" grammer_pattern[key] = [r.split() for r in rules]\n",
" return grammer_pattern"
]
},
{
"cell_type": "code",
"execution_count": 153,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'host': [['寒暄', '报数', '询问', '业务相关', '结尾']],\n",
" '报数': [['我是', '数字', '号', ',']],\n",
" '数字': [['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']],\n",
" '寒暄': [['称谓', '打招呼'], ['打招呼']],\n",
" '称谓': [['人称', ',']],\n",
" '人称': [['先生'], ['女士'], ['小朋友']],\n",
" '打招呼': [['你好'], ['您好']],\n",
" '询问': [['请问你要'], ['您需要']],\n",
" '业务相关': [['玩玩', '具体业务']],\n",
" '玩玩': [['耍一耍'], ['玩一玩']],\n",
" '具体业务': [['喝酒'], ['打牌'], ['打猎'], ['赌博']],\n",
" '结尾': [['吗?']]}"
]
},
"execution_count": 153,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"generate_grammer(host, host_pattern)"
]
},
{
"cell_type": "code",
"execution_count": 154,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'human': [['自己', '寻找', '活动']],\n",
" '自己': [['我'], ['俺'], ['我们']],\n",
" '寻找': [['看看'], ['找找'], ['想找点']],\n",
" '活动': [['乐子'], ['玩的']]}"
]
},
"execution_count": 154,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"generate_grammer(human, human_pattern)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Data Driven\n",
"## Logic Programming"
]
},
{
"cell_type": "code",
"execution_count": 100,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'sentence': [['寒暄', '报数', '询问', '业务相关', '结尾']],\n",
" '报数': [['我是', '数字', '号', ',']],\n",
" '数字': [['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']],\n",
" '寒暄': [['称谓', '打招呼'], ['打招呼']],\n",
" '称谓': [['人称', ',']],\n",
" '人称': [['先生'], ['女士'], ['小朋友']],\n",
" '打招呼': [['你好'], ['您好']],\n",
" '询问': [['请问你要'], ['您需要']],\n",
" '业务相关': [['具体业务', '业务']],\n",
" '具体业务': [['喝酒'], ['打牌'], ['打猎'], ['赌博']],\n",
" '结尾': [['吗?']]}"
]
},
"execution_count": 100,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"host_pattern"
]
},
{
"cell_type": "code",
"execution_count": 101,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'sentence': [['自己', '寻找', '活动']],\n",
" '自己': [['我'], ['俺'], ['我们']],\n",
" '寻找': [['看看'], ['找找'], ['想找点']],\n",
" '活动': [['乐子'], ['玩的']]}"
]
},
"execution_count": 101,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"human_pattern"
]
},
{
"cell_type": "code",
"execution_count": 177,
"metadata": {},
"outputs": [],
"source": [
"def generate(p, target):\n",
" if target not in p: return target\n",
" \n",
" sub_target = random.choice(p[target])\n",
" return ' '.join(generate(p, r) for r in sub_target)"
]
},
{
"cell_type": "code",
"execution_count": 178,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'俺 想找点 乐子'"
]
},
"execution_count": 178,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"generate(human_pattern, 'human')"
]
},
{
"cell_type": "code",
"execution_count": 180,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'女士 , 你好 我是 4 号 , 请问你要 耍一耍 赌博 吗?'"
]
},
"execution_count": 180,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"generate(host_pattern, 'host')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## response pattern"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"input_sentence = ''\n",
"output_"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Tokenize"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. How to get the root? "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"host_response = \"\"\"\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 143,
"metadata": {},
"outputs": [],
"source": [
"QA = ('human', 'host')\n",
"QA = ('host', 'host_respon')"
]
},
{
"cell_type": "code",
"execution_count": 168,
"metadata": {},
"outputs": [],
"source": [
"def find_pattern_name(sentence): \n",
" \"\"\"get the fit pattern name given a stence\"\"\"\n",
" pass"
]
},
{
"cell_type": "code",
"execution_count": 169,
"metadata": {},
"outputs": [
{
"ename": "AssertionError",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-169-632060de46fc>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32massert\u001b[0m \u001b[0mfind_pattern_name\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'先生,您好我是8号,请问你要耍一耍打牌吗?'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'host'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mfind_pattern_name\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'俺想找点乐子'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'human'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0mfind_pattern_name\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'我是9号,'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'报数'\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mAssertionError\u001b[0m: "
]
}
],
"source": [
"assert find_pattern_name('先生,您好我是8号,请问你要耍一耍打牌吗?') == 'host'\n",
"assert find_pattern_name('俺想找点乐子') == 'human'\n",
"assert find_pattern_name('我是9号,') == '报数'"
]
},
{
"cell_type": "code",
"execution_count": 170,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'你好我是1号,请问你要耍一耍打牌吗?'"
]
},
"execution_count": 170,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"generate(host_pattern, 'host')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"'human' ==》 host"
]
},
{
"cell_type": "code",
"execution_count": 171,
"metadata": {},
"outputs": [],
"source": [
"cact = ''.join"
]
},
{
"cell_type": "code",
"execution_count": 173,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'host': [['寒暄', '报数', '询问', '业务相关', '结尾']],\n",
" '报数': [['我是', '数字', '号', ',']],\n",
" '数字': [['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']],\n",
" '寒暄': [['称谓', '打招呼'], ['打招呼']],\n",
" '称谓': [['人称', ',']],\n",
" '人称': [['先生'], ['女士'], ['小朋友']],\n",
" '打招呼': [['你好'], ['您好']],\n",
" '询问': [['请问你要'], ['您需要']],\n",
" '业务相关': [['玩玩', '具体业务']],\n",
" '玩玩': [['耍一耍'], ['玩一玩']],\n",
" '具体业务': [['喝酒'], ['打牌'], ['打猎'], ['赌博']],\n",
" '结尾': [['吗?']]}"
]
},
"execution_count": 173,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"host_pattern"
]
},
{
"cell_type": "code",
"execution_count": 224,
"metadata": {},
"outputs": [],
"source": [
"## pattern mapper reverse\n",
"\n",
"token_stmt_mapper = {}\n",
"human_stmt_mapper = {}\n",
"\n",
"def get_stmt_mapper(pattern):\n",
" token_stmt_mapper = {}\n",
" for k, v in pattern.items():\n",
" for candidate in v:\n",
" token_stmt_mapper[cact(candidate).strip()] = k\n",
" return token_stmt_mapper\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 227,
"metadata": {},
"outputs": [],
"source": [
"human_stmt_mapper = get_stmt_mapper(human_pattern)\n",
"host_stmt_mapper = get_stmt_mapper(host_pattern)"
]
},
{
"cell_type": "code",
"execution_count": 228,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'寒暄报数询问业务相关结尾': 'host',\n",
" '我是数字号,': '报数',\n",
" '1': '数字',\n",
" '2': '数字',\n",
" '3': '数字',\n",
" '4': '数字',\n",
" '5': '数字',\n",
" '6': '数字',\n",
" '7': '数字',\n",
" '8': '数字',\n",
" '9': '数字',\n",
" '称谓打招呼': '寒暄',\n",
" '打招呼': '寒暄',\n",
" '人称,': '称谓',\n",
" '先生': '人称',\n",
" '女士': '人称',\n",
" '小朋友': '人称',\n",
" '你好': '打招呼',\n",
" '您好': '打招呼',\n",
" '请问你要': '询问',\n",
" '您需要': '询问',\n",
" '玩玩具体业务': '业务相关',\n",
" '耍一耍': '玩玩',\n",
" '玩一玩': '玩玩',\n",
" '喝酒': '具体业务',\n",
" '打牌': '具体业务',\n",
" '打猎': '具体业务',\n",
" '赌博': '具体业务',\n",
" '吗?': '结尾'}"
]
},
"execution_count": 228,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"host_stmt_mapper"
]
},
{
"cell_type": "code",
"execution_count": 175,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'寒暄报数询问业务相关结尾': 'host',\n",
" '我是数字号,': '报数',\n",
" '1': '数字',\n",
" '2': '数字',\n",
" '3': '数字',\n",
" '4': '数字',\n",
" '5': '数字',\n",
" '6': '数字',\n",
" '7': '数字',\n",
" '8': '数字',\n",
" '9': '数字',\n",
" '称谓打招呼': '寒暄',\n",
" '打招呼': '寒暄',\n",
" '人称,': '称谓',\n",
" '先生': '人称',\n",
" '女士': '人称',\n",
" '小朋友': '人称',\n",
" '你好': '打招呼',\n",
" '您好': '打招呼',\n",
" '请问你要': '询问',\n",
" '您需要': '询问',\n",
" '玩玩具体业务': '业务相关',\n",
" '耍一耍': '玩玩',\n",
" '玩一玩': '玩玩',\n",
" '喝酒': '具体业务',\n",
" '打牌': '具体业务',\n",
" '打猎': '具体业务',\n",
" '赌博': '具体业务',\n",
" '吗?': '结尾'}"
]
},
"execution_count": 175,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"token_stmt_mapper"
]
},
{
"cell_type": "code",
"execution_count": 237,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'host': [['寒暄', '报数', '询问', '业务相关', '结尾']],\n",
" '报数': [['我是', '数字', '号', ',']],\n",
" '数字': [['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']],\n",
" '寒暄': [['称谓', '打招呼'], ['打招呼']],\n",
" '称谓': [['人称', ',']],\n",
" '人称': [['先生'], ['女士'], ['小朋友']],\n",
" '打招呼': [['你好'], ['您好']],\n",
" '询问': [['请问你要'], ['您需要']],\n",
" '业务相关': [['玩玩', '具体业务']],\n",
" '玩玩': [['耍一耍'], ['玩一玩']],\n",
" '具体业务': [['喝酒'], ['打牌'], ['打猎'], ['赌博']],\n",
" '结尾': [['吗?']]}"
]
},
"execution_count": 237,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"host_pattern"
]
},
{
"cell_type": "code",
"execution_count": 240,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'host': [['寒暄', '报数', '询问', '业务相关', '结尾']],\n",
" '报数': [['我是', '数字', '号', ',']],\n",
" '数字': [['1'], ['2'], ['3'], ['4'], ['5'], ['6'], ['7'], ['8'], ['9']],\n",
" '寒暄': [['称谓', '打招呼'], ['打招呼']],\n",
" '称谓': [['人称', ',']],\n",
" '人称': [['先生'], ['女士'], ['小朋友']],\n",
" '打招呼': [['你好'], ['您好']],\n",
" '询问': [['请问你要'], ['您需要']],\n",
" '业务相关': [['玩玩', '具体业务']],\n",
" '玩玩': [['耍一耍'], ['玩一玩']],\n",
" '具体业务': [['喝酒'], ['打牌'], ['打猎'], ['赌博']],\n",
" '结尾': [['吗?']]}"
]
},
"execution_count": 240,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"token_stmt_mapper"
]
},
{
"cell_type": "code",
"execution_count": 238,
"metadata": {},
"outputs": [],
"source": [
"def get_parent(token):\n",
" if token in token_stmt_mapper: return get_parent(token_stmt_mapper[token])\n",
" else:\n",
" return token\n",
" \n",
"def parse_tokens(tokens):\n",
" find_parents_tokens = [get_parent(t) for t in tokens]\n",
" return find_parents_tokens\n",
"\n",
"cact = ''.join\n",
"\n",
"def find_longest_match(tokens_with_stmts):\n",
" fit_indices = [i for i in range(len(tokens_with_stmts)+1) if cact(tokens_with_stmts[:i]) in token_stmt_mapper]\n",
" if fit_indices: return max(fit_indices)\n",
" else: return 1\n",
"\n",
"\n",
"def merge_tokens_one_epoch(tokens_with_stmts):\n",
" if len(tokens_with_stmts) == 0: return []\n",
"\n",
" index = find_longest_match(tokens_with_stmts)\n",
" return [cact(tokens_with_stmts[:index])] + merge_tokens_one_epoch(tokens_with_stmts[index:])\n",
"\n",
"def merge_tokens(tokens_with_stmts):\n",
" merged_one_epoch = merge_tokens_one_epoch(tokens_with_stmts)\n",
" merged_one_epoch = parse_tokens(merged_one_epoch)\n",
" \n",
" if len(merged_one_epoch) == 1: return merged_one_epoch[0]\n",
" elif merged_one_epoch != tokens_with_stmts:\n",
" return merge_tokens(merged_one_epoch)\n",
" else:\n",
" raise TypeError('these tokens cannot parsed as a statement', merged_one_epoch)"
]
},
{
"cell_type": "code",
"execution_count": 242,
"metadata": {},
"outputs": [],
"source": [
"t = ['你好', '我是' ,'8' ,'号' ',', '请问你要', '玩一玩', '赌博', '吗?']"
]
},
{
"cell_type": "code",
"execution_count": 243,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"1"
]
},
"execution_count": 243,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"find_longest_match(t)"
]
},
{
"cell_type": "code",
"execution_count": 194,
"metadata": {},
"outputs": [],
"source": [
"import jieba"
]
},
{
"cell_type": "code",
"execution_count": 195,
"metadata": {},
"outputs": [],
"source": [
"def cut(string): return list(jieba.cut(string))"
]
},
{
"cell_type": "code",
"execution_count": 234,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'我 想找点 乐子'"
]
},
"execution_count": 234,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"generate(human_pattern, 'human')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Recap"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. 对话机器人"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. 信息检索式的\n",
"#### 1. 信息如何获取, Dependancy Parsing, NER, ... Web, \n",
"#### 2. 短文本匹配\n",
"#### 3. 根据找到的问题回答\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. 基于模式识别的\n",
"#### 1. Syntax Tree\n",
"#### 2. 自动机的理论去解析\n",
"#### 3. DSF, Bottom-Top(Deducation)\n",
"#### 4. response_mapper = {'pattern-1': 'pattern-2', 'pattern-3': 'pattern-4'}\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4. 意图识别"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1. Classification\n",
"### 2. Sklearning(Bayes, DTree), (CNN, RNN, GRU)\n",
"\n",
"\n",
"+ '飞猪上买的机票怎么退' ==> '机票'('飞猪')\n",
"+ '我想办信用卡' ==> '银行' \n",
"+ '附近有什么吃的' ==> '餐饮'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"可以用到的信息: \n",
"+ \"身份信息, 登录历史\" \n",
"\n",
"### Intention"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
|
{
"pile_set_name": "Github"
}
|
auto-sklearn==0.5.2
Click==7.0
google-cloud-language==1.1.0
protobuf==3.6.1
python-dotenv==0.10.3
websocket-client==0.54.0
|
{
"pile_set_name": "Github"
}
|
/* crypto/srp/srp.h */
/*
* Written by Christophe Renou (christophe.renou@edelweb.fr) with the
* precious help of Peter Sylvester (peter.sylvester@edelweb.fr) for the
* EdelKey project and contributed to the OpenSSL project 2004.
*/
/* ====================================================================
* Copyright (c) 2004 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#ifndef __SRP_H__
# define __SRP_H__
# ifndef OPENSSL_NO_SRP
# include <stdio.h>
# include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
# include <openssl/safestack.h>
# include <openssl/bn.h>
# include <openssl/crypto.h>
typedef struct SRP_gN_cache_st {
char *b64_bn;
BIGNUM *bn;
} SRP_gN_cache;
DECLARE_STACK_OF(SRP_gN_cache)
typedef struct SRP_user_pwd_st {
char *id;
BIGNUM *s;
BIGNUM *v;
const BIGNUM *g;
const BIGNUM *N;
char *info;
} SRP_user_pwd;
DECLARE_STACK_OF(SRP_user_pwd)
typedef struct SRP_VBASE_st {
STACK_OF(SRP_user_pwd) *users_pwd;
STACK_OF(SRP_gN_cache) *gN_cache;
/* to simulate a user */
char *seed_key;
BIGNUM *default_g;
BIGNUM *default_N;
} SRP_VBASE;
/*
* Structure interne pour retenir les couples N et g
*/
typedef struct SRP_gN_st {
char *id;
BIGNUM *g;
BIGNUM *N;
} SRP_gN;
DECLARE_STACK_OF(SRP_gN)
SRP_VBASE *SRP_VBASE_new(char *seed_key);
int SRP_VBASE_free(SRP_VBASE *vb);
int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
char *SRP_create_verifier(const char *user, const char *pass, char **salt,
char **verifier, const char *N, const char *g);
int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
BIGNUM **verifier, BIGNUM *N, BIGNUM *g);
# define SRP_NO_ERROR 0
# define SRP_ERR_VBASE_INCOMPLETE_FILE 1
# define SRP_ERR_VBASE_BN_LIB 2
# define SRP_ERR_OPEN_FILE 3
# define SRP_ERR_MEMORY 4
# define DB_srptype 0
# define DB_srpverifier 1
# define DB_srpsalt 2
# define DB_srpid 3
# define DB_srpgN 4
# define DB_srpinfo 5
# undef DB_NUMBER
# define DB_NUMBER 6
# define DB_SRP_INDEX 'I'
# define DB_SRP_VALID 'V'
# define DB_SRP_REVOKED 'R'
# define DB_SRP_MODIF 'v'
/* see srp.c */
char *SRP_check_known_gN_param(BIGNUM *g, BIGNUM *N);
SRP_gN *SRP_get_default_gN(const char *id);
/* server side .... */
BIGNUM *SRP_Calc_server_key(BIGNUM *A, BIGNUM *v, BIGNUM *u, BIGNUM *b,
BIGNUM *N);
BIGNUM *SRP_Calc_B(BIGNUM *b, BIGNUM *N, BIGNUM *g, BIGNUM *v);
int SRP_Verify_A_mod_N(BIGNUM *A, BIGNUM *N);
BIGNUM *SRP_Calc_u(BIGNUM *A, BIGNUM *B, BIGNUM *N);
/* client side .... */
BIGNUM *SRP_Calc_x(BIGNUM *s, const char *user, const char *pass);
BIGNUM *SRP_Calc_A(BIGNUM *a, BIGNUM *N, BIGNUM *g);
BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x,
BIGNUM *a, BIGNUM *u);
int SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N);
# define SRP_MINIMAL_N 1024
#ifdef __cplusplus
}
#endif
# endif
#endif
|
{
"pile_set_name": "Github"
}
|
How to list all files in a directory that match a filename extension in Java
Create system file paths using the `Path` class
Using buffered streams
Reading file attributes
List contents of a directory with `newDirectoryStream`
|
{
"pile_set_name": "Github"
}
|
{
"id": "tropical-tank",
"name": "Tropical Tank",
"category": "Tops",
"games": {
"nl": {
"orderable": true,
"interiorThemes": [
"Harmonious"
],
"fashionThemes": [
"Iconic"
],
"sellPrice": {
"currency": "bells",
"value": 70
},
"sources": [
"Able Sisters (summer)"
],
"buyPrices": [
{
"currency": "bells",
"value": 280
}
]
}
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
/******************************************************************
iLBC Speech Coder ANSI-C Source Code
WebRtcIlbcfix_UnpackBits.h
******************************************************************/
#ifndef MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_UNPACK_BITS_H_
#define MODULES_AUDIO_CODING_CODECS_ILBC_MAIN_SOURCE_UNPACK_BITS_H_
#include "modules/audio_coding/codecs/ilbc/defines.h"
/*----------------------------------------------------------------*
* unpacking of bits from bitstream, i.e., vector of bytes
*---------------------------------------------------------------*/
int16_t
WebRtcIlbcfix_UnpackBits(/* (o) "Empty" frame indicator */
const uint16_t*
bitstream, /* (i) The packatized bitstream */
iLBC_bits*
enc_bits, /* (o) Paramerers from bitstream */
int16_t mode /* (i) Codec mode (20 or 30) */
);
#endif
|
{
"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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hdds.server.http;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Servlet filter to add no caching headers.
*/
public class NoCacheFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain)
throws IOException, ServletException {
HttpServletResponse httpRes = (HttpServletResponse) res;
httpRes.setHeader("Cache-Control", "no-cache");
long now = System.currentTimeMillis();
httpRes.addDateHeader("Expires", now);
httpRes.addDateHeader("Date", now);
httpRes.addHeader("Pragma", "no-cache");
chain.doFilter(req, res);
}
@Override
public void destroy() {
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* builtin-report.c
*
* Builtin report command: Analyze the perf.data input file,
* look up and read DSOs and symbol information and display
* a histogram of results, along various sorting keys.
*/
#include "builtin.h"
#include "util/util.h"
#include "util/cache.h"
#include "util/annotate.h"
#include "util/color.h"
#include <linux/list.h>
#include <linux/rbtree.h>
#include "util/symbol.h"
#include "util/callchain.h"
#include "util/strlist.h"
#include "util/values.h"
#include "perf.h"
#include "util/debug.h"
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/header.h"
#include "util/session.h"
#include "util/tool.h"
#include "util/parse-options.h"
#include "util/parse-events.h"
#include "util/thread.h"
#include "util/sort.h"
#include "util/hist.h"
#include "util/data.h"
#include "arch/common.h"
#include "util/auxtrace.h"
#include <dlfcn.h>
#include <linux/bitmap.h>
struct report {
struct perf_tool tool;
struct perf_session *session;
bool use_tui, use_gtk, use_stdio;
bool hide_unresolved;
bool dont_use_callchains;
bool show_full_info;
bool show_threads;
bool inverted_callchain;
bool mem_mode;
bool header;
bool header_only;
bool nonany_branch_mode;
int max_stack;
struct perf_read_values show_threads_values;
const char *pretty_printing_style;
const char *cpu_list;
const char *symbol_filter_str;
float min_percent;
u64 nr_entries;
u64 queue_size;
int socket_filter;
DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
};
static int report__config(const char *var, const char *value, void *cb)
{
struct report *rep = cb;
if (!strcmp(var, "report.group")) {
symbol_conf.event_group = perf_config_bool(var, value);
return 0;
}
if (!strcmp(var, "report.percent-limit")) {
rep->min_percent = strtof(value, NULL);
return 0;
}
if (!strcmp(var, "report.children")) {
symbol_conf.cumulate_callchain = perf_config_bool(var, value);
return 0;
}
if (!strcmp(var, "report.queue-size")) {
rep->queue_size = perf_config_u64(var, value);
return 0;
}
return perf_default_config(var, value, cb);
}
static int hist_iter__report_callback(struct hist_entry_iter *iter,
struct addr_location *al, bool single,
void *arg)
{
int err = 0;
struct report *rep = arg;
struct hist_entry *he = iter->he;
struct perf_evsel *evsel = iter->evsel;
struct mem_info *mi;
struct branch_info *bi;
if (!ui__has_annotation())
return 0;
hist__account_cycles(iter->sample->branch_stack, al, iter->sample,
rep->nonany_branch_mode);
if (sort__mode == SORT_MODE__BRANCH) {
bi = he->branch_info;
err = addr_map_symbol__inc_samples(&bi->from, evsel->idx);
if (err)
goto out;
err = addr_map_symbol__inc_samples(&bi->to, evsel->idx);
} else if (rep->mem_mode) {
mi = he->mem_info;
err = addr_map_symbol__inc_samples(&mi->daddr, evsel->idx);
if (err)
goto out;
err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
} else if (symbol_conf.cumulate_callchain) {
if (single)
err = hist_entry__inc_addr_samples(he, evsel->idx,
al->addr);
} else {
err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
}
out:
return err;
}
static int process_sample_event(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample,
struct perf_evsel *evsel,
struct machine *machine)
{
struct report *rep = container_of(tool, struct report, tool);
struct addr_location al;
struct hist_entry_iter iter = {
.evsel = evsel,
.sample = sample,
.hide_unresolved = rep->hide_unresolved,
.add_entry_cb = hist_iter__report_callback,
};
int ret = 0;
if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) {
pr_debug("problem processing %d event, skipping it.\n",
event->header.type);
return -1;
}
if (rep->hide_unresolved && al.sym == NULL)
goto out_put;
if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap))
goto out_put;
if (sort__mode == SORT_MODE__BRANCH) {
/*
* A non-synthesized event might not have a branch stack if
* branch stacks have been synthesized (using itrace options).
*/
if (!sample->branch_stack)
goto out_put;
iter.ops = &hist_iter_branch;
} else if (rep->mem_mode) {
iter.ops = &hist_iter_mem;
} else if (symbol_conf.cumulate_callchain) {
iter.ops = &hist_iter_cumulative;
} else {
iter.ops = &hist_iter_normal;
}
if (al.map != NULL)
al.map->dso->hit = 1;
ret = hist_entry_iter__add(&iter, &al, rep->max_stack, rep);
if (ret < 0)
pr_debug("problem adding hist entry, skipping event\n");
out_put:
addr_location__put(&al);
return ret;
}
static int process_read_event(struct perf_tool *tool,
union perf_event *event,
struct perf_sample *sample __maybe_unused,
struct perf_evsel *evsel,
struct machine *machine __maybe_unused)
{
struct report *rep = container_of(tool, struct report, tool);
if (rep->show_threads) {
const char *name = evsel ? perf_evsel__name(evsel) : "unknown";
perf_read_values_add_value(&rep->show_threads_values,
event->read.pid, event->read.tid,
event->read.id,
name,
event->read.value);
}
dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid,
evsel ? perf_evsel__name(evsel) : "FAIL",
event->read.value);
return 0;
}
/* For pipe mode, sample_type is not currently set */
static int report__setup_sample_type(struct report *rep)
{
struct perf_session *session = rep->session;
u64 sample_type = perf_evlist__combined_sample_type(session->evlist);
bool is_pipe = perf_data_file__is_pipe(session->file);
if (session->itrace_synth_opts->callchain ||
(!is_pipe &&
perf_header__has_feat(&session->header, HEADER_AUXTRACE) &&
!session->itrace_synth_opts->set))
sample_type |= PERF_SAMPLE_CALLCHAIN;
if (session->itrace_synth_opts->last_branch)
sample_type |= PERF_SAMPLE_BRANCH_STACK;
if (!is_pipe && !(sample_type & PERF_SAMPLE_CALLCHAIN)) {
if (sort__has_parent) {
ui__error("Selected --sort parent, but no "
"callchain data. Did you call "
"'perf record' without -g?\n");
return -EINVAL;
}
if (symbol_conf.use_callchain) {
ui__error("Selected -g or --branch-history but no "
"callchain data. Did\n"
"you call 'perf record' without -g?\n");
return -1;
}
} else if (!rep->dont_use_callchains &&
callchain_param.mode != CHAIN_NONE &&
!symbol_conf.use_callchain) {
symbol_conf.use_callchain = true;
if (callchain_register_param(&callchain_param) < 0) {
ui__error("Can't register callchain params.\n");
return -EINVAL;
}
}
if (symbol_conf.cumulate_callchain) {
/* Silently ignore if callchain is missing */
if (!(sample_type & PERF_SAMPLE_CALLCHAIN)) {
symbol_conf.cumulate_callchain = false;
perf_hpp__cancel_cumulate();
}
}
if (sort__mode == SORT_MODE__BRANCH) {
if (!is_pipe &&
!(sample_type & PERF_SAMPLE_BRANCH_STACK)) {
ui__error("Selected -b but no branch data. "
"Did you call perf record without -b?\n");
return -1;
}
}
if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) {
if ((sample_type & PERF_SAMPLE_REGS_USER) &&
(sample_type & PERF_SAMPLE_STACK_USER))
callchain_param.record_mode = CALLCHAIN_DWARF;
else if (sample_type & PERF_SAMPLE_BRANCH_STACK)
callchain_param.record_mode = CALLCHAIN_LBR;
else
callchain_param.record_mode = CALLCHAIN_FP;
}
/* ??? handle more cases than just ANY? */
if (!(perf_evlist__combined_branch_type(session->evlist) &
PERF_SAMPLE_BRANCH_ANY))
rep->nonany_branch_mode = true;
return 0;
}
static void sig_handler(int sig __maybe_unused)
{
session_done = 1;
}
static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report *rep,
const char *evname, FILE *fp)
{
size_t ret;
char unit;
unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
u64 nr_events = hists->stats.total_period;
struct perf_evsel *evsel = hists_to_evsel(hists);
char buf[512];
size_t size = sizeof(buf);
int socked_id = hists->socket_filter;
if (symbol_conf.filter_relative) {
nr_samples = hists->stats.nr_non_filtered_samples;
nr_events = hists->stats.total_non_filtered_period;
}
if (perf_evsel__is_group_event(evsel)) {
struct perf_evsel *pos;
perf_evsel__group_desc(evsel, buf, size);
evname = buf;
for_each_group_member(pos, evsel) {
const struct hists *pos_hists = evsel__hists(pos);
if (symbol_conf.filter_relative) {
nr_samples += pos_hists->stats.nr_non_filtered_samples;
nr_events += pos_hists->stats.total_non_filtered_period;
} else {
nr_samples += pos_hists->stats.nr_events[PERF_RECORD_SAMPLE];
nr_events += pos_hists->stats.total_period;
}
}
}
nr_samples = convert_unit(nr_samples, &unit);
ret = fprintf(fp, "# Samples: %lu%c", nr_samples, unit);
if (evname != NULL)
ret += fprintf(fp, " of event '%s'", evname);
if (symbol_conf.show_ref_callgraph &&
strstr(evname, "call-graph=no")) {
ret += fprintf(fp, ", show reference callgraph");
}
if (rep->mem_mode) {
ret += fprintf(fp, "\n# Total weight : %" PRIu64, nr_events);
ret += fprintf(fp, "\n# Sort order : %s", sort_order ? : default_mem_sort_order);
} else
ret += fprintf(fp, "\n# Event count (approx.): %" PRIu64, nr_events);
if (socked_id > -1)
ret += fprintf(fp, "\n# Processor Socket: %d", socked_id);
return ret + fprintf(fp, "\n#\n");
}
static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
struct report *rep,
const char *help)
{
struct perf_evsel *pos;
fprintf(stdout, "#\n# Total Lost Samples: %" PRIu64 "\n#\n", evlist->stats.total_lost_samples);
evlist__for_each(evlist, pos) {
struct hists *hists = evsel__hists(pos);
const char *evname = perf_evsel__name(pos);
if (symbol_conf.event_group &&
!perf_evsel__is_group_leader(pos))
continue;
hists__fprintf_nr_sample_events(hists, rep, evname, stdout);
hists__fprintf(hists, true, 0, 0, rep->min_percent, stdout);
fprintf(stdout, "\n\n");
}
if (sort_order == NULL &&
parent_pattern == default_parent_pattern)
fprintf(stdout, "#\n# (%s)\n#\n", help);
if (rep->show_threads) {
bool style = !strcmp(rep->pretty_printing_style, "raw");
perf_read_values_display(stdout, &rep->show_threads_values,
style);
perf_read_values_destroy(&rep->show_threads_values);
}
return 0;
}
static void report__warn_kptr_restrict(const struct report *rep)
{
struct map *kernel_map = machine__kernel_map(&rep->session->machines.host);
struct kmap *kernel_kmap = kernel_map ? map__kmap(kernel_map) : NULL;
if (kernel_map == NULL ||
(kernel_map->dso->hit &&
(kernel_kmap->ref_reloc_sym == NULL ||
kernel_kmap->ref_reloc_sym->addr == 0))) {
const char *desc =
"As no suitable kallsyms nor vmlinux was found, kernel samples\n"
"can't be resolved.";
if (kernel_map) {
const struct dso *kdso = kernel_map->dso;
if (!RB_EMPTY_ROOT(&kdso->symbols[MAP__FUNCTION])) {
desc = "If some relocation was applied (e.g. "
"kexec) symbols may be misresolved.";
}
}
ui__warning(
"Kernel address maps (/proc/{kallsyms,modules}) were restricted.\n\n"
"Check /proc/sys/kernel/kptr_restrict before running 'perf record'.\n\n%s\n\n"
"Samples in kernel modules can't be resolved as well.\n\n",
desc);
}
}
static int report__gtk_browse_hists(struct report *rep, const char *help)
{
int (*hist_browser)(struct perf_evlist *evlist, const char *help,
struct hist_browser_timer *timer, float min_pcnt);
hist_browser = dlsym(perf_gtk_handle, "perf_evlist__gtk_browse_hists");
if (hist_browser == NULL) {
ui__error("GTK browser not found!\n");
return -1;
}
return hist_browser(rep->session->evlist, help, NULL, rep->min_percent);
}
static int report__browse_hists(struct report *rep)
{
int ret;
struct perf_session *session = rep->session;
struct perf_evlist *evlist = session->evlist;
const char *help = "For a higher level overview, try: perf report --sort comm,dso";
switch (use_browser) {
case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent,
&session->header.env);
/*
* Usually "ret" is the last pressed key, and we only
* care if the key notifies us to switch data file.
*/
if (ret != K_SWITCH_INPUT_DATA)
ret = 0;
break;
case 2:
ret = report__gtk_browse_hists(rep, help);
break;
default:
ret = perf_evlist__tty_browse_hists(evlist, rep, help);
break;
}
return ret;
}
static void report__collapse_hists(struct report *rep)
{
struct ui_progress prog;
struct perf_evsel *pos;
ui_progress__init(&prog, rep->nr_entries, "Merging related events...");
evlist__for_each(rep->session->evlist, pos) {
struct hists *hists = evsel__hists(pos);
if (pos->idx == 0)
hists->symbol_filter_str = rep->symbol_filter_str;
hists->socket_filter = rep->socket_filter;
hists__collapse_resort(hists, &prog);
/* Non-group events are considered as leader */
if (symbol_conf.event_group &&
!perf_evsel__is_group_leader(pos)) {
struct hists *leader_hists = evsel__hists(pos->leader);
hists__match(leader_hists, hists);
hists__link(leader_hists, hists);
}
}
ui_progress__finish();
}
static void report__output_resort(struct report *rep)
{
struct ui_progress prog;
struct perf_evsel *pos;
ui_progress__init(&prog, rep->nr_entries, "Sorting events for output...");
evlist__for_each(rep->session->evlist, pos)
hists__output_resort(evsel__hists(pos), &prog);
ui_progress__finish();
}
static int __cmd_report(struct report *rep)
{
int ret;
struct perf_session *session = rep->session;
struct perf_evsel *pos;
struct perf_data_file *file = session->file;
signal(SIGINT, sig_handler);
if (rep->cpu_list) {
ret = perf_session__cpu_bitmap(session, rep->cpu_list,
rep->cpu_bitmap);
if (ret)
return ret;
}
if (rep->show_threads)
perf_read_values_init(&rep->show_threads_values);
ret = report__setup_sample_type(rep);
if (ret)
return ret;
ret = perf_session__process_events(session);
if (ret)
return ret;
report__warn_kptr_restrict(rep);
evlist__for_each(session->evlist, pos)
rep->nr_entries += evsel__hists(pos)->nr_entries;
if (use_browser == 0) {
if (verbose > 3)
perf_session__fprintf(session, stdout);
if (verbose > 2)
perf_session__fprintf_dsos(session, stdout);
if (dump_trace) {
perf_session__fprintf_nr_events(session, stdout);
perf_evlist__fprintf_nr_events(session->evlist, stdout);
return 0;
}
}
report__collapse_hists(rep);
if (session_done())
return 0;
/*
* recalculate number of entries after collapsing since it
* might be changed during the collapse phase.
*/
rep->nr_entries = 0;
evlist__for_each(session->evlist, pos)
rep->nr_entries += evsel__hists(pos)->nr_entries;
if (rep->nr_entries == 0) {
ui__error("The %s file has no samples!\n", file->path);
return 0;
}
report__output_resort(rep);
return report__browse_hists(rep);
}
static int
report_parse_callchain_opt(const struct option *opt, const char *arg, int unset)
{
struct report *rep = (struct report *)opt->value;
/*
* --no-call-graph
*/
if (unset) {
rep->dont_use_callchains = true;
return 0;
}
return parse_callchain_report_opt(arg);
}
int
report_parse_ignore_callees_opt(const struct option *opt __maybe_unused,
const char *arg, int unset __maybe_unused)
{
if (arg) {
int err = regcomp(&ignore_callees_regex, arg, REG_EXTENDED);
if (err) {
char buf[BUFSIZ];
regerror(err, &ignore_callees_regex, buf, sizeof(buf));
pr_err("Invalid --ignore-callees regex: %s\n%s", arg, buf);
return -1;
}
have_ignore_callees = 1;
}
return 0;
}
static int
parse_branch_mode(const struct option *opt __maybe_unused,
const char *str __maybe_unused, int unset)
{
int *branch_mode = opt->value;
*branch_mode = !unset;
return 0;
}
static int
parse_percent_limit(const struct option *opt, const char *str,
int unset __maybe_unused)
{
struct report *rep = opt->value;
rep->min_percent = strtof(str, NULL);
return 0;
}
#define CALLCHAIN_DEFAULT_OPT "graph,0.5,caller,function"
const char report_callchain_help[] = "Display call graph (stack chain/backtrace):\n\n"
CALLCHAIN_REPORT_HELP
"\n\t\t\t\tDefault: " CALLCHAIN_DEFAULT_OPT;
int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
{
struct perf_session *session;
struct itrace_synth_opts itrace_synth_opts = { .set = 0, };
struct stat st;
bool has_br_stack = false;
int branch_mode = -1;
bool branch_call_mode = false;
char callchain_default_opt[] = CALLCHAIN_DEFAULT_OPT;
const char * const report_usage[] = {
"perf report [<options>]",
NULL
};
struct report report = {
.tool = {
.sample = process_sample_event,
.mmap = perf_event__process_mmap,
.mmap2 = perf_event__process_mmap2,
.comm = perf_event__process_comm,
.exit = perf_event__process_exit,
.fork = perf_event__process_fork,
.lost = perf_event__process_lost,
.read = process_read_event,
.attr = perf_event__process_attr,
.tracing_data = perf_event__process_tracing_data,
.build_id = perf_event__process_build_id,
.id_index = perf_event__process_id_index,
.auxtrace_info = perf_event__process_auxtrace_info,
.auxtrace = perf_event__process_auxtrace,
.ordered_events = true,
.ordering_requires_timestamps = true,
},
.max_stack = PERF_MAX_STACK_DEPTH,
.pretty_printing_style = "normal",
.socket_filter = -1,
};
const struct option options[] = {
OPT_STRING('i', "input", &input_name, "file",
"input file name"),
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show symbol address, etc)"),
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
"file", "kallsyms pathname"),
OPT_BOOLEAN('f', "force", &symbol_conf.force, "don't complain, do it"),
OPT_BOOLEAN('m', "modules", &symbol_conf.use_modules,
"load module symbols - WARNING: use only with -k and LIVE kernel"),
OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
"Show a column with the number of samples"),
OPT_BOOLEAN('T', "threads", &report.show_threads,
"Show per-thread event counters"),
OPT_STRING(0, "pretty", &report.pretty_printing_style, "key",
"pretty printing style key: normal raw"),
OPT_BOOLEAN(0, "tui", &report.use_tui, "Use the TUI interface"),
OPT_BOOLEAN(0, "gtk", &report.use_gtk, "Use the GTK2 interface"),
OPT_BOOLEAN(0, "stdio", &report.use_stdio,
"Use the stdio interface"),
OPT_BOOLEAN(0, "header", &report.header, "Show data header."),
OPT_BOOLEAN(0, "header-only", &report.header_only,
"Show only data header."),
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
"sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline, ..."
" Please refer the man page for the complete list."),
OPT_STRING('F', "fields", &field_order, "key[,keys...]",
"output field(s): overhead, period, sample plus all of sort keys"),
OPT_BOOLEAN(0, "show-cpu-utilization", &symbol_conf.show_cpu_utilization,
"Show sample percentage for different cpu modes"),
OPT_BOOLEAN_FLAG(0, "showcpuutilization", &symbol_conf.show_cpu_utilization,
"Show sample percentage for different cpu modes", PARSE_OPT_HIDDEN),
OPT_STRING('p', "parent", &parent_pattern, "regex",
"regex filter to identify parent, see: '--sort parent'"),
OPT_BOOLEAN('x', "exclude-other", &symbol_conf.exclude_other,
"Only display entries with parent-match"),
OPT_CALLBACK_DEFAULT('g', "call-graph", &report,
"print_type,threshold[,print_limit],order,sort_key[,branch]",
report_callchain_help, &report_parse_callchain_opt,
callchain_default_opt),
OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
"Accumulate callchains of children and show total overhead as well"),
OPT_INTEGER(0, "max-stack", &report.max_stack,
"Set the maximum stack depth when parsing the callchain, "
"anything beyond the specified depth will be ignored. "
"Default: " __stringify(PERF_MAX_STACK_DEPTH)),
OPT_BOOLEAN('G', "inverted", &report.inverted_callchain,
"alias for inverted call graph"),
OPT_CALLBACK(0, "ignore-callees", NULL, "regex",
"ignore callees of these functions in call graphs",
report_parse_ignore_callees_opt),
OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]",
"only consider symbols in these dsos"),
OPT_STRING('c', "comms", &symbol_conf.comm_list_str, "comm[,comm...]",
"only consider symbols in these comms"),
OPT_STRING(0, "pid", &symbol_conf.pid_list_str, "pid[,pid...]",
"only consider symbols in these pids"),
OPT_STRING(0, "tid", &symbol_conf.tid_list_str, "tid[,tid...]",
"only consider symbols in these tids"),
OPT_STRING('S', "symbols", &symbol_conf.sym_list_str, "symbol[,symbol...]",
"only consider these symbols"),
OPT_STRING(0, "symbol-filter", &report.symbol_filter_str, "filter",
"only show symbols that (partially) match with this filter"),
OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str,
"width[,width...]",
"don't try to adjust column width, use these fixed values"),
OPT_STRING_NOEMPTY('t', "field-separator", &symbol_conf.field_sep, "separator",
"separator for columns, no spaces will be added between "
"columns '.' is reserved."),
OPT_BOOLEAN('U', "hide-unresolved", &report.hide_unresolved,
"Only display entries resolved to a symbol"),
OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory",
"Look for files with symbols relative to this directory"),
OPT_STRING('C', "cpu", &report.cpu_list, "cpu",
"list of cpus to profile"),
OPT_BOOLEAN('I', "show-info", &report.show_full_info,
"Display extended information about perf.data file"),
OPT_BOOLEAN(0, "source", &symbol_conf.annotate_src,
"Interleave source code with assembly code (default)"),
OPT_BOOLEAN(0, "asm-raw", &symbol_conf.annotate_asm_raw,
"Display raw encoding of assembly instructions (default)"),
OPT_STRING('M', "disassembler-style", &disassembler_style, "disassembler style",
"Specify disassembler style (e.g. -M intel for intel syntax)"),
OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
"Show a column with the sum of periods"),
OPT_BOOLEAN(0, "group", &symbol_conf.event_group,
"Show event group information together"),
OPT_CALLBACK_NOOPT('b', "branch-stack", &branch_mode, "",
"use branch records for per branch histogram filling",
parse_branch_mode),
OPT_BOOLEAN(0, "branch-history", &branch_call_mode,
"add last branch records to call history"),
OPT_STRING(0, "objdump", &objdump_path, "path",
"objdump binary to use for disassembly and annotations"),
OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle,
"Disable symbol demangling"),
OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
"Enable kernel symbol demangling"),
OPT_BOOLEAN(0, "mem-mode", &report.mem_mode, "mem access profile"),
OPT_CALLBACK(0, "percent-limit", &report, "percent",
"Don't show entries under that percent", parse_percent_limit),
OPT_CALLBACK(0, "percentage", NULL, "relative|absolute",
"how to display percentage of filtered entries", parse_filter_percentage),
OPT_CALLBACK_OPTARG(0, "itrace", &itrace_synth_opts, NULL, "opts",
"Instruction Tracing options",
itrace_parse_synth_opts),
OPT_BOOLEAN(0, "full-source-path", &srcline_full_filename,
"Show full source file name path for source lines"),
OPT_BOOLEAN(0, "show-ref-call-graph", &symbol_conf.show_ref_callgraph,
"Show callgraph from reference event"),
OPT_INTEGER(0, "socket-filter", &report.socket_filter,
"only show processor socket that match with this filter"),
OPT_END()
};
struct perf_data_file file = {
.mode = PERF_DATA_MODE_READ,
};
int ret = hists__init();
if (ret < 0)
return ret;
perf_config(report__config, &report);
argc = parse_options(argc, argv, options, report_usage, 0);
if (symbol_conf.vmlinux_name &&
access(symbol_conf.vmlinux_name, R_OK)) {
pr_err("Invalid file: %s\n", symbol_conf.vmlinux_name);
return -EINVAL;
}
if (symbol_conf.kallsyms_name &&
access(symbol_conf.kallsyms_name, R_OK)) {
pr_err("Invalid file: %s\n", symbol_conf.kallsyms_name);
return -EINVAL;
}
if (report.use_stdio)
use_browser = 0;
else if (report.use_tui)
use_browser = 1;
else if (report.use_gtk)
use_browser = 2;
if (report.inverted_callchain)
callchain_param.order = ORDER_CALLER;
if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
callchain_param.order = ORDER_CALLER;
if (itrace_synth_opts.callchain &&
(int)itrace_synth_opts.callchain_sz > report.max_stack)
report.max_stack = itrace_synth_opts.callchain_sz;
if (!input_name || !strlen(input_name)) {
if (!fstat(STDIN_FILENO, &st) && S_ISFIFO(st.st_mode))
input_name = "-";
else
input_name = "perf.data";
}
file.path = input_name;
file.force = symbol_conf.force;
repeat:
session = perf_session__new(&file, false, &report.tool);
if (session == NULL)
return -1;
if (report.queue_size) {
ordered_events__set_alloc_size(&session->ordered_events,
report.queue_size);
}
session->itrace_synth_opts = &itrace_synth_opts;
report.session = session;
has_br_stack = perf_header__has_feat(&session->header,
HEADER_BRANCH_STACK);
if (itrace_synth_opts.last_branch)
has_br_stack = true;
/*
* Branch mode is a tristate:
* -1 means default, so decide based on the file having branch data.
* 0/1 means the user chose a mode.
*/
if (((branch_mode == -1 && has_br_stack) || branch_mode == 1) &&
!branch_call_mode) {
sort__mode = SORT_MODE__BRANCH;
symbol_conf.cumulate_callchain = false;
}
if (branch_call_mode) {
callchain_param.key = CCKEY_ADDRESS;
callchain_param.branch_callstack = 1;
symbol_conf.use_callchain = true;
callchain_register_param(&callchain_param);
if (sort_order == NULL)
sort_order = "srcline,symbol,dso";
}
if (report.mem_mode) {
if (sort__mode == SORT_MODE__BRANCH) {
pr_err("branch and mem mode incompatible\n");
goto error;
}
sort__mode = SORT_MODE__MEMORY;
symbol_conf.cumulate_callchain = false;
}
if (setup_sorting() < 0) {
if (sort_order)
parse_options_usage(report_usage, options, "s", 1);
if (field_order)
parse_options_usage(sort_order ? NULL : report_usage,
options, "F", 1);
goto error;
}
/* Force tty output for header output and per-thread stat. */
if (report.header || report.header_only || report.show_threads)
use_browser = 0;
if (strcmp(input_name, "-") != 0)
setup_browser(true);
else
use_browser = 0;
if (report.header || report.header_only) {
perf_session__fprintf_info(session, stdout,
report.show_full_info);
if (report.header_only) {
ret = 0;
goto error;
}
} else if (use_browser == 0) {
fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
stdout);
}
/*
* Only in the TUI browser we are doing integrated annotation,
* so don't allocate extra space that won't be used in the stdio
* implementation.
*/
if (ui__has_annotation()) {
symbol_conf.priv_size = sizeof(struct annotation);
machines__set_symbol_filter(&session->machines,
symbol__annotate_init);
/*
* For searching by name on the "Browse map details".
* providing it only in verbose mode not to bloat too
* much struct symbol.
*/
if (verbose) {
/*
* XXX: Need to provide a less kludgy way to ask for
* more space per symbol, the u32 is for the index on
* the ui browser.
* See symbol__browser_index.
*/
symbol_conf.priv_size += sizeof(u32);
symbol_conf.sort_by_name = true;
}
}
if (symbol__init(&session->header.env) < 0)
goto error;
if (argc) {
/*
* Special case: if there's an argument left then assume that
* it's a symbol filter:
*/
if (argc > 1)
usage_with_options(report_usage, options);
report.symbol_filter_str = argv[0];
}
sort__setup_elide(stdout);
ret = __cmd_report(&report);
if (ret == K_SWITCH_INPUT_DATA) {
perf_session__delete(session);
goto repeat;
} else
ret = 0;
error:
perf_session__delete(session);
return ret;
}
|
{
"pile_set_name": "Github"
}
|
// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT.
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Package idna implements IDNA2008 using the compatibility processing
// defined by UTS (Unicode Technical Standard) #46, which defines a standard to
// deal with the transition from IDNA2003.
//
// IDNA2008 (Internationalized Domain Names for Applications), is defined in RFC
// 5890, RFC 5891, RFC 5892, RFC 5893 and RFC 5894.
// UTS #46 is defined in http://www.unicode.org/reports/tr46.
// See http://unicode.org/cldr/utility/idna.jsp for a visualization of the
// differences between these two standards.
package idna // import "golang.org/x/net/idna"
import (
"fmt"
"strings"
"unicode/utf8"
"golang.org/x/text/secure/bidirule"
"golang.org/x/text/unicode/bidi"
"golang.org/x/text/unicode/norm"
)
// NOTE: Unlike common practice in Go APIs, the functions will return a
// sanitized domain name in case of errors. Browsers sometimes use a partially
// evaluated string as lookup.
// TODO: the current error handling is, in my opinion, the least opinionated.
// Other strategies are also viable, though:
// Option 1) Return an empty string in case of error, but allow the user to
// specify explicitly which errors to ignore.
// Option 2) Return the partially evaluated string if it is itself a valid
// string, otherwise return the empty string in case of error.
// Option 3) Option 1 and 2.
// Option 4) Always return an empty string for now and implement Option 1 as
// needed, and document that the return string may not be empty in case of
// error in the future.
// I think Option 1 is best, but it is quite opinionated.
// ToASCII is a wrapper for Punycode.ToASCII.
func ToASCII(s string) (string, error) {
return Punycode.process(s, true)
}
// ToUnicode is a wrapper for Punycode.ToUnicode.
func ToUnicode(s string) (string, error) {
return Punycode.process(s, false)
}
// An Option configures a Profile at creation time.
type Option func(*options)
// Transitional sets a Profile to use the Transitional mapping as defined in UTS
// #46. This will cause, for example, "ß" to be mapped to "ss". Using the
// transitional mapping provides a compromise between IDNA2003 and IDNA2008
// compatibility. It is used by most browsers when resolving domain names. This
// option is only meaningful if combined with MapForLookup.
func Transitional(transitional bool) Option {
return func(o *options) { o.transitional = true }
}
// VerifyDNSLength sets whether a Profile should fail if any of the IDN parts
// are longer than allowed by the RFC.
func VerifyDNSLength(verify bool) Option {
return func(o *options) { o.verifyDNSLength = verify }
}
// RemoveLeadingDots removes leading label separators. Leading runes that map to
// dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well.
//
// This is the behavior suggested by the UTS #46 and is adopted by some
// browsers.
func RemoveLeadingDots(remove bool) Option {
return func(o *options) { o.removeLeadingDots = remove }
}
// ValidateLabels sets whether to check the mandatory label validation criteria
// as defined in Section 5.4 of RFC 5891. This includes testing for correct use
// of hyphens ('-'), normalization, validity of runes, and the context rules.
func ValidateLabels(enable bool) Option {
return func(o *options) {
// Don't override existing mappings, but set one that at least checks
// normalization if it is not set.
if o.mapping == nil && enable {
o.mapping = normalize
}
o.trie = trie
o.validateLabels = enable
o.fromPuny = validateFromPunycode
}
}
// StrictDomainName limits the set of permissible ASCII characters to those
// allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the
// hyphen). This is set by default for MapForLookup and ValidateForRegistration.
//
// This option is useful, for instance, for browsers that allow characters
// outside this range, for example a '_' (U+005F LOW LINE). See
// http://www.rfc-editor.org/std/std3.txt for more details This option
// corresponds to the UseSTD3ASCIIRules option in UTS #46.
func StrictDomainName(use bool) Option {
return func(o *options) {
o.trie = trie
o.useSTD3Rules = use
o.fromPuny = validateFromPunycode
}
}
// NOTE: the following options pull in tables. The tables should not be linked
// in as long as the options are not used.
// BidiRule enables the Bidi rule as defined in RFC 5893. Any application
// that relies on proper validation of labels should include this rule.
func BidiRule() Option {
return func(o *options) { o.bidirule = bidirule.ValidString }
}
// ValidateForRegistration sets validation options to verify that a given IDN is
// properly formatted for registration as defined by Section 4 of RFC 5891.
func ValidateForRegistration() Option {
return func(o *options) {
o.mapping = validateRegistration
StrictDomainName(true)(o)
ValidateLabels(true)(o)
VerifyDNSLength(true)(o)
BidiRule()(o)
}
}
// MapForLookup sets validation and mapping options such that a given IDN is
// transformed for domain name lookup according to the requirements set out in
// Section 5 of RFC 5891. The mappings follow the recommendations of RFC 5894,
// RFC 5895 and UTS 46. It does not add the Bidi Rule. Use the BidiRule option
// to add this check.
//
// The mappings include normalization and mapping case, width and other
// compatibility mappings.
func MapForLookup() Option {
return func(o *options) {
o.mapping = validateAndMap
StrictDomainName(true)(o)
ValidateLabels(true)(o)
}
}
type options struct {
transitional bool
useSTD3Rules bool
validateLabels bool
verifyDNSLength bool
removeLeadingDots bool
trie *idnaTrie
// fromPuny calls validation rules when converting A-labels to U-labels.
fromPuny func(p *Profile, s string) error
// mapping implements a validation and mapping step as defined in RFC 5895
// or UTS 46, tailored to, for example, domain registration or lookup.
mapping func(p *Profile, s string) (mapped string, isBidi bool, err error)
// bidirule, if specified, checks whether s conforms to the Bidi Rule
// defined in RFC 5893.
bidirule func(s string) bool
}
// A Profile defines the configuration of an IDNA mapper.
type Profile struct {
options
}
func apply(o *options, opts []Option) {
for _, f := range opts {
f(o)
}
}
// New creates a new Profile.
//
// With no options, the returned Profile is the most permissive and equals the
// Punycode Profile. Options can be passed to further restrict the Profile. The
// MapForLookup and ValidateForRegistration options set a collection of options,
// for lookup and registration purposes respectively, which can be tailored by
// adding more fine-grained options, where later options override earlier
// options.
func New(o ...Option) *Profile {
p := &Profile{}
apply(&p.options, o)
return p
}
// ToASCII converts a domain or domain label to its ASCII form. For example,
// ToASCII("bücher.example.com") is "xn--bcher-kva.example.com", and
// ToASCII("golang") is "golang". If an error is encountered it will return
// an error and a (partially) processed result.
func (p *Profile) ToASCII(s string) (string, error) {
return p.process(s, true)
}
// ToUnicode converts a domain or domain label to its Unicode form. For example,
// ToUnicode("xn--bcher-kva.example.com") is "bücher.example.com", and
// ToUnicode("golang") is "golang". If an error is encountered it will return
// an error and a (partially) processed result.
func (p *Profile) ToUnicode(s string) (string, error) {
pp := *p
pp.transitional = false
return pp.process(s, false)
}
// String reports a string with a description of the profile for debugging
// purposes. The string format may change with different versions.
func (p *Profile) String() string {
s := ""
if p.transitional {
s = "Transitional"
} else {
s = "NonTransitional"
}
if p.useSTD3Rules {
s += ":UseSTD3Rules"
}
if p.validateLabels {
s += ":ValidateLabels"
}
if p.verifyDNSLength {
s += ":VerifyDNSLength"
}
return s
}
var (
// Punycode is a Profile that does raw punycode processing with a minimum
// of validation.
Punycode *Profile = punycode
// Lookup is the recommended profile for looking up domain names, according
// to Section 5 of RFC 5891. The exact configuration of this profile may
// change over time.
Lookup *Profile = lookup
// Display is the recommended profile for displaying domain names.
// The configuration of this profile may change over time.
Display *Profile = display
// Registration is the recommended profile for checking whether a given
// IDN is valid for registration, according to Section 4 of RFC 5891.
Registration *Profile = registration
punycode = &Profile{}
lookup = &Profile{options{
transitional: true,
useSTD3Rules: true,
validateLabels: true,
trie: trie,
fromPuny: validateFromPunycode,
mapping: validateAndMap,
bidirule: bidirule.ValidString,
}}
display = &Profile{options{
useSTD3Rules: true,
validateLabels: true,
trie: trie,
fromPuny: validateFromPunycode,
mapping: validateAndMap,
bidirule: bidirule.ValidString,
}}
registration = &Profile{options{
useSTD3Rules: true,
validateLabels: true,
verifyDNSLength: true,
trie: trie,
fromPuny: validateFromPunycode,
mapping: validateRegistration,
bidirule: bidirule.ValidString,
}}
// TODO: profiles
// Register: recommended for approving domain names: don't do any mappings
// but rather reject on invalid input. Bundle or block deviation characters.
)
type labelError struct{ label, code_ string }
func (e labelError) code() string { return e.code_ }
func (e labelError) Error() string {
return fmt.Sprintf("idna: invalid label %q", e.label)
}
type runeError rune
func (e runeError) code() string { return "P1" }
func (e runeError) Error() string {
return fmt.Sprintf("idna: disallowed rune %U", e)
}
// process implements the algorithm described in section 4 of UTS #46,
// see http://www.unicode.org/reports/tr46.
func (p *Profile) process(s string, toASCII bool) (string, error) {
var err error
var isBidi bool
if p.mapping != nil {
s, isBidi, err = p.mapping(p, s)
}
// Remove leading empty labels.
if p.removeLeadingDots {
for ; len(s) > 0 && s[0] == '.'; s = s[1:] {
}
}
// TODO: allow for a quick check of the tables data.
// It seems like we should only create this error on ToASCII, but the
// UTS 46 conformance tests suggests we should always check this.
if err == nil && p.verifyDNSLength && s == "" {
err = &labelError{s, "A4"}
}
labels := labelIter{orig: s}
for ; !labels.done(); labels.next() {
label := labels.label()
if label == "" {
// Empty labels are not okay. The label iterator skips the last
// label if it is empty.
if err == nil && p.verifyDNSLength {
err = &labelError{s, "A4"}
}
continue
}
if strings.HasPrefix(label, acePrefix) {
u, err2 := decode(label[len(acePrefix):])
if err2 != nil {
if err == nil {
err = err2
}
// Spec says keep the old label.
continue
}
isBidi = isBidi || bidirule.DirectionString(u) != bidi.LeftToRight
labels.set(u)
if err == nil && p.validateLabels {
err = p.fromPuny(p, u)
}
if err == nil {
// This should be called on NonTransitional, according to the
// spec, but that currently does not have any effect. Use the
// original profile to preserve options.
err = p.validateLabel(u)
}
} else if err == nil {
err = p.validateLabel(label)
}
}
if isBidi && p.bidirule != nil && err == nil {
for labels.reset(); !labels.done(); labels.next() {
if !p.bidirule(labels.label()) {
err = &labelError{s, "B"}
break
}
}
}
if toASCII {
for labels.reset(); !labels.done(); labels.next() {
label := labels.label()
if !ascii(label) {
a, err2 := encode(acePrefix, label)
if err == nil {
err = err2
}
label = a
labels.set(a)
}
n := len(label)
if p.verifyDNSLength && err == nil && (n == 0 || n > 63) {
err = &labelError{label, "A4"}
}
}
}
s = labels.result()
if toASCII && p.verifyDNSLength && err == nil {
// Compute the length of the domain name minus the root label and its dot.
n := len(s)
if n > 0 && s[n-1] == '.' {
n--
}
if len(s) < 1 || n > 253 {
err = &labelError{s, "A4"}
}
}
return s, err
}
func normalize(p *Profile, s string) (mapped string, isBidi bool, err error) {
// TODO: consider first doing a quick check to see if any of these checks
// need to be done. This will make it slower in the general case, but
// faster in the common case.
mapped = norm.NFC.String(s)
isBidi = bidirule.DirectionString(mapped) == bidi.RightToLeft
return mapped, isBidi, nil
}
func validateRegistration(p *Profile, s string) (idem string, bidi bool, err error) {
// TODO: filter need for normalization in loop below.
if !norm.NFC.IsNormalString(s) {
return s, false, &labelError{s, "V1"}
}
for i := 0; i < len(s); {
v, sz := trie.lookupString(s[i:])
if sz == 0 {
return s, bidi, runeError(utf8.RuneError)
}
bidi = bidi || info(v).isBidi(s[i:])
// Copy bytes not copied so far.
switch p.simplify(info(v).category()) {
// TODO: handle the NV8 defined in the Unicode idna data set to allow
// for strict conformance to IDNA2008.
case valid, deviation:
case disallowed, mapped, unknown, ignored:
r, _ := utf8.DecodeRuneInString(s[i:])
return s, bidi, runeError(r)
}
i += sz
}
return s, bidi, nil
}
func (c info) isBidi(s string) bool {
if !c.isMapped() {
return c&attributesMask == rtl
}
// TODO: also store bidi info for mapped data. This is possible, but a bit
// cumbersome and not for the common case.
p, _ := bidi.LookupString(s)
switch p.Class() {
case bidi.R, bidi.AL, bidi.AN:
return true
}
return false
}
func validateAndMap(p *Profile, s string) (vm string, bidi bool, err error) {
var (
b []byte
k int
)
// combinedInfoBits contains the or-ed bits of all runes. We use this
// to derive the mayNeedNorm bit later. This may trigger normalization
// overeagerly, but it will not do so in the common case. The end result
// is another 10% saving on BenchmarkProfile for the common case.
var combinedInfoBits info
for i := 0; i < len(s); {
v, sz := trie.lookupString(s[i:])
if sz == 0 {
b = append(b, s[k:i]...)
b = append(b, "\ufffd"...)
k = len(s)
if err == nil {
err = runeError(utf8.RuneError)
}
break
}
combinedInfoBits |= info(v)
bidi = bidi || info(v).isBidi(s[i:])
start := i
i += sz
// Copy bytes not copied so far.
switch p.simplify(info(v).category()) {
case valid:
continue
case disallowed:
if err == nil {
r, _ := utf8.DecodeRuneInString(s[start:])
err = runeError(r)
}
continue
case mapped, deviation:
b = append(b, s[k:start]...)
b = info(v).appendMapping(b, s[start:i])
case ignored:
b = append(b, s[k:start]...)
// drop the rune
case unknown:
b = append(b, s[k:start]...)
b = append(b, "\ufffd"...)
}
k = i
}
if k == 0 {
// No changes so far.
if combinedInfoBits&mayNeedNorm != 0 {
s = norm.NFC.String(s)
}
} else {
b = append(b, s[k:]...)
if norm.NFC.QuickSpan(b) != len(b) {
b = norm.NFC.Bytes(b)
}
// TODO: the punycode converters require strings as input.
s = string(b)
}
return s, bidi, err
}
// A labelIter allows iterating over domain name labels.
type labelIter struct {
orig string
slice []string
curStart int
curEnd int
i int
}
func (l *labelIter) reset() {
l.curStart = 0
l.curEnd = 0
l.i = 0
}
func (l *labelIter) done() bool {
return l.curStart >= len(l.orig)
}
func (l *labelIter) result() string {
if l.slice != nil {
return strings.Join(l.slice, ".")
}
return l.orig
}
func (l *labelIter) label() string {
if l.slice != nil {
return l.slice[l.i]
}
p := strings.IndexByte(l.orig[l.curStart:], '.')
l.curEnd = l.curStart + p
if p == -1 {
l.curEnd = len(l.orig)
}
return l.orig[l.curStart:l.curEnd]
}
// next sets the value to the next label. It skips the last label if it is empty.
func (l *labelIter) next() {
l.i++
if l.slice != nil {
if l.i >= len(l.slice) || l.i == len(l.slice)-1 && l.slice[l.i] == "" {
l.curStart = len(l.orig)
}
} else {
l.curStart = l.curEnd + 1
if l.curStart == len(l.orig)-1 && l.orig[l.curStart] == '.' {
l.curStart = len(l.orig)
}
}
}
func (l *labelIter) set(s string) {
if l.slice == nil {
l.slice = strings.Split(l.orig, ".")
}
l.slice[l.i] = s
}
// acePrefix is the ASCII Compatible Encoding prefix.
const acePrefix = "xn--"
func (p *Profile) simplify(cat category) category {
switch cat {
case disallowedSTD3Mapped:
if p.useSTD3Rules {
cat = disallowed
} else {
cat = mapped
}
case disallowedSTD3Valid:
if p.useSTD3Rules {
cat = disallowed
} else {
cat = valid
}
case deviation:
if !p.transitional {
cat = valid
}
case validNV8, validXV8:
// TODO: handle V2008
cat = valid
}
return cat
}
func validateFromPunycode(p *Profile, s string) error {
if !norm.NFC.IsNormalString(s) {
return &labelError{s, "V1"}
}
// TODO: detect whether string may have to be normalized in the following
// loop.
for i := 0; i < len(s); {
v, sz := trie.lookupString(s[i:])
if sz == 0 {
return runeError(utf8.RuneError)
}
if c := p.simplify(info(v).category()); c != valid && c != deviation {
return &labelError{s, "V6"}
}
i += sz
}
return nil
}
const (
zwnj = "\u200c"
zwj = "\u200d"
)
type joinState int8
const (
stateStart joinState = iota
stateVirama
stateBefore
stateBeforeVirama
stateAfter
stateFAIL
)
var joinStates = [][numJoinTypes]joinState{
stateStart: {
joiningL: stateBefore,
joiningD: stateBefore,
joinZWNJ: stateFAIL,
joinZWJ: stateFAIL,
joinVirama: stateVirama,
},
stateVirama: {
joiningL: stateBefore,
joiningD: stateBefore,
},
stateBefore: {
joiningL: stateBefore,
joiningD: stateBefore,
joiningT: stateBefore,
joinZWNJ: stateAfter,
joinZWJ: stateFAIL,
joinVirama: stateBeforeVirama,
},
stateBeforeVirama: {
joiningL: stateBefore,
joiningD: stateBefore,
joiningT: stateBefore,
},
stateAfter: {
joiningL: stateFAIL,
joiningD: stateBefore,
joiningT: stateAfter,
joiningR: stateStart,
joinZWNJ: stateFAIL,
joinZWJ: stateFAIL,
joinVirama: stateAfter, // no-op as we can't accept joiners here
},
stateFAIL: {
0: stateFAIL,
joiningL: stateFAIL,
joiningD: stateFAIL,
joiningT: stateFAIL,
joiningR: stateFAIL,
joinZWNJ: stateFAIL,
joinZWJ: stateFAIL,
joinVirama: stateFAIL,
},
}
// validateLabel validates the criteria from Section 4.1. Item 1, 4, and 6 are
// already implicitly satisfied by the overall implementation.
func (p *Profile) validateLabel(s string) (err error) {
if s == "" {
if p.verifyDNSLength {
return &labelError{s, "A4"}
}
return nil
}
if !p.validateLabels {
return nil
}
trie := p.trie // p.validateLabels is only set if trie is set.
if len(s) > 4 && s[2] == '-' && s[3] == '-' {
return &labelError{s, "V2"}
}
if s[0] == '-' || s[len(s)-1] == '-' {
return &labelError{s, "V3"}
}
// TODO: merge the use of this in the trie.
v, sz := trie.lookupString(s)
x := info(v)
if x.isModifier() {
return &labelError{s, "V5"}
}
// Quickly return in the absence of zero-width (non) joiners.
if strings.Index(s, zwj) == -1 && strings.Index(s, zwnj) == -1 {
return nil
}
st := stateStart
for i := 0; ; {
jt := x.joinType()
if s[i:i+sz] == zwj {
jt = joinZWJ
} else if s[i:i+sz] == zwnj {
jt = joinZWNJ
}
st = joinStates[st][jt]
if x.isViramaModifier() {
st = joinStates[st][joinVirama]
}
if i += sz; i == len(s) {
break
}
v, sz = trie.lookupString(s[i:])
x = info(v)
}
if st == stateFAIL || st == stateAfter {
return &labelError{s, "C"}
}
return nil
}
func ascii(s string) bool {
for i := 0; i < len(s); i++ {
if s[i] >= utf8.RuneSelf {
return false
}
}
return true
}
|
{
"pile_set_name": "Github"
}
|
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. 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 dtfmt
type builder struct {
elements []element
}
func newBuilder() *builder {
return &builder{}
}
func (b *builder) estimateSize() int {
sz := 0
for _, e := range b.elements {
sz += e.estimateSize()
}
return sz
}
func (b *builder) createConfig() (ctxConfig, error) {
cfg := ctxConfig{}
for _, e := range b.elements {
if err := e.requires(&cfg); err != nil {
return ctxConfig{}, err
}
}
return cfg, nil
}
func (b *builder) compile() (prog, error) {
p := prog{}
for _, e := range b.elements {
tmp, err := e.compile()
if err != nil {
return prog{}, err
}
p.p = append(p.p, tmp.p...)
}
return p, nil
}
func (b *builder) optimize() {
if len(b.elements) == 0 {
return
}
// combine rune/string literals
el := b.elements[:1]
for _, e := range b.elements[1:] {
last := el[len(el)-1]
if r, ok := e.(runeLiteral); ok {
if l, ok := last.(runeLiteral); ok {
el[len(el)-1] = stringLiteral{
append(append([]byte{}, string(l.r)...), string(r.r)...),
}
} else if l, ok := last.(stringLiteral); ok {
el[len(el)-1] = stringLiteral{append(l.s, string(r.r)...)}
} else {
el = append(el, e)
}
} else if s, ok := e.(stringLiteral); ok {
if l, ok := last.(runeLiteral); ok {
el[len(el)-1] = stringLiteral{
append(append([]byte{}, string(l.r)...), s.s...),
}
} else if l, ok := last.(stringLiteral); ok {
el[len(el)-1] = stringLiteral{append(l.s, s.s...)}
} else {
el = append(el, e)
}
} else {
el = append(el, e)
}
}
b.elements = el
}
func (b *builder) add(e element) {
b.elements = append(b.elements, e)
}
func (b *builder) millisOfSecond(digits int) {
if digits <= 0 {
return
}
switch digits {
case 1:
b.appendExtDecimal(ftMillisOfSecond, 100, 1, 1)
case 2:
b.appendExtDecimal(ftMillisOfSecond, 10, 2, 2)
case 3:
b.appendExtDecimal(ftMillisOfSecond, 0, 3, 3)
default:
b.appendExtDecimal(ftMillisOfSecond, 0, 3, 3)
b.appendZeros(digits - 3)
}
}
func (b *builder) millisOfDay(digits int) {
b.appendDecimal(ftMillisOfDay, digits, 8)
}
func (b *builder) secondOfMinute(digits int) {
b.appendDecimal(ftSecondOfMinute, digits, 2)
}
func (b *builder) secondOfDay(digits int) {
b.appendDecimal(ftSecondOfDay, digits, 5)
}
func (b *builder) minuteOfHour(digits int) {
b.appendDecimal(ftMinuteOfHour, digits, 2)
}
func (b *builder) minuteOfDay(digits int) {
b.appendDecimal(ftMinuteOfDay, digits, 4)
}
func (b *builder) hourOfDay(digits int) {
b.appendDecimal(ftHourOfDay, digits, 2)
}
func (b *builder) clockhourOfDay(digits int) {
b.appendDecimal(ftClockhourOfDay, digits, 2)
}
func (b *builder) hourOfHalfday(digits int) {
b.appendDecimal(ftHourOfHalfday, digits, 2)
}
func (b *builder) clockhourOfHalfday(digits int) {
b.appendDecimal(ftClockhourOfHalfday, digits, 2)
}
func (b *builder) dayOfWeek(digits int) {
b.appendDecimal(ftDayOfWeek, digits, 1)
}
func (b *builder) dayOfMonth(digits int) {
b.appendDecimal(ftDayOfMonth, digits, 2)
}
func (b *builder) dayOfYear(digits int) {
b.appendDecimal(ftDayOfYear, digits, 3)
}
func (b *builder) weekOfWeekyear(digits int) {
b.appendDecimal(ftWeekOfWeekyear, digits, 2)
}
func (b *builder) weekyear(minDigits, maxDigits int) {
b.appendDecimal(ftWeekyear, minDigits, maxDigits)
}
func (b *builder) monthOfYear(digits int) {
b.appendDecimal(ftMonthOfYear, digits, 2)
}
func (b *builder) year(minDigits, maxDigits int) {
b.appendSigned(ftYear, minDigits, maxDigits)
}
func (b *builder) twoDigitYear() {
b.add(twoDigitYear{ftYear})
}
func (b *builder) twoDigitWeekYear() {
b.add(twoDigitYear{ftWeekyear})
}
func (b *builder) halfdayOfDayText() {
b.appendText(ftHalfdayOfDay)
}
func (b *builder) dayOfWeekText() {
b.appendText(ftDayOfWeek)
}
func (b *builder) dayOfWeekShortText() {
b.appendShortText(ftDayOfWeek)
}
func (b *builder) monthOfYearText() {
b.appendText(ftMonthOfYear)
}
func (b *builder) monthOfYearShortText() {
b.appendShortText(ftMonthOfYear)
}
func (b *builder) timeZoneOffsetText() {
b.appendText(ftTimeZoneOffset)
}
func (b *builder) appendRune(r rune) {
b.add(runeLiteral{r})
}
func (b *builder) appendLiteral(l string) {
switch len(l) {
case 0:
case 1:
b.add(runeLiteral{rune(l[0])})
default:
b.add(stringLiteral{[]byte(l)})
}
}
func (b *builder) appendDecimalValue(ft fieldType, minDigits, maxDigits int, signed bool) {
if maxDigits < minDigits {
maxDigits = minDigits
}
if minDigits <= 1 {
b.add(unpaddedNumber{ft, maxDigits, signed})
} else {
b.add(paddedNumber{ft, 0, minDigits, maxDigits, signed})
}
}
func (b *builder) appendExtDecimal(ft fieldType, div, minDigits, maxDigits int) {
b.add(paddedNumber{ft, div, minDigits, maxDigits, false})
}
func (b *builder) appendDecimal(ft fieldType, minDigits, maxDigits int) {
b.appendDecimalValue(ft, minDigits, maxDigits, false)
}
func (b *builder) appendSigned(ft fieldType, minDigits, maxDigits int) {
b.appendDecimalValue(ft, minDigits, maxDigits, true)
}
func (b *builder) appendZeros(count int) {
b.add(paddingZeros{count})
}
func (b *builder) appendText(ft fieldType) {
b.add(textField{ft, false})
}
func (b *builder) appendShortText(ft fieldType) {
b.add(textField{ft, true})
}
|
{
"pile_set_name": "Github"
}
|
import { IconDefinition, IconPrefix, IconName } from "@fortawesome/fontawesome-common-types";
export const definition: IconDefinition;
export const faBatteryEmpty: IconDefinition;
export const prefix: IconPrefix;
export const iconName: IconName;
export const width: number;
export const height: number;
export const ligatures: string[];
export const unicode: string;
export const svgPathData: string;
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.