text
stringlengths 2
100k
| meta
dict |
---|---|
<?php namespace app\system\controller;
use houdunwang\request\Request;
use houdunwang\wechat\WeChat;
use system\model\Modules;
use system\model\SiteModules;
use system\model\SitePackage;
use system\model\SiteTemplate;
use system\model\SiteUser;
use system\model\SiteWeChat;
use system\model\Site as SiteModel;
use system\model\User;
use system\model\Package;
use system\model\Template;
/**
* 站点管理
* Class Site
*
* @package app\system\controller
*/
class Site extends Admin
{
public function __construct()
{
$this->auth();
}
/**
* 站点列表
*
* @return mixed
*/
public function lists()
{
$where = [];
//按网站名称搜索
if ($sitename = Request::post('sitename')) {
$where[] = ['name', 'like', "%{$sitename}%"];
}
$sites = SiteModel::getSiteByCondition($where);
$user = User::find(v('user.info.uid'));
return view('', compact('sites', 'user'));
}
//网站列表页面,获取站点包信息
public function package()
{
//根据站长所在会员组获取套餐
$pids = \Package::getSiteAllPackageIds(siteid());
$package = [];
if (in_array(-1, $pids)) {
$package[] = "所有服务";
} else if ( ! empty($pids)) {
$package = Db::table('package')->whereIn('id', $pids)->lists('name');
}
//获取模块
$modules = \Module::getSiteAllModules();
return ['package' => $package, 'modules' => $modules];
}
/**
* 为站点设置权限/默认站点使用站长的权限
* 但我们可以为站点独立添加一些权限
*
* @param \system\model\User $user
* @param \system\model\Package $package
* @param \system\model\Site $site
* @param \system\model\Template $template
* @param \system\model\Modules $module
*
* @return mixed|string
*/
public function access_setting(User $user, Package $package, SiteModel $site, Template $template, Modules $module)
{
//非系统管理员直接跳转到第四步,只有系统管理员可以设置用户扩展套餐与模块
if ($user->superUserAuth() === false) {
return message('没有操作权限', '', 'error');
}
if (IS_POST) {
//站点允许使用的空间大小
$model = SiteModel::find(siteid());
$model['allfilesize'] = Request::post('allfilesize');
$model->save();
//删除站点旧的套餐
SitePackage::where('siteid', siteid())->delete();
if ($packageIds = Request::post('package_id', [])) {
foreach ($packageIds as $id) {
SitePackage::insert(
['siteid' => siteid(), 'package_id' => $id,]
);
}
}
//添加扩展模块
SiteModules::where('siteid', siteid())->delete();
if ($modules = Request::post('modules', [])) {
foreach ($modules as $name) {
SiteModules::insert(
['siteid' => siteid(), 'module' => $name,]
);
}
}
//添加扩展模板
SiteTemplate::where('siteid', siteid())->delete();
if ($templates = Request::post('templates', [])) {
foreach ($templates as $name) {
SiteTemplate::insert(
['siteid' => siteid(), 'template' => $name,]
);
}
}
//设置站长
if ($uid = Request::post('uid', 0, 'intval')) {
SiteUser::setSiteOwner(siteid(), $uid);
}
$site->updateCache();
return message('站点信息修改成功');
}
//获取站长信息
return view('access_setting')->with(
[
'systemAllPackages' => $package->getSystemAllPackageData(),
'extPackage' => $package->getSiteExtPackageIds(),
'defaultPackage' => $package->getSiteDefaultPackageIds(),
'extModule' => $module->getSiteExtModules(siteid()),
'extTemplate' => $template->getSiteExtTemplates(siteid()),
'user' => $user->getSiteOwner(siteid()),
'site' => SiteModel::find(siteid()),
]
);
}
/**
* 设置站点微信公众号
*
* @param \system\model\User $user
* @param \system\model\Site $site
*
* @return mixed|string
*/
public function wechat(User $user, SiteModel $site)
{
if ($user->isManage() == false) {
return message('您不是网站管理员无法操作');
}
switch (Request::get('step')) {
//修改微信公众号
case 'wechat':
//微信帐号管理
if (IS_POST) {
if ($weid = SiteWechat::where('siteid', siteid())->pluck('weid')) {
//编辑站点
$SiteWechatModel = SiteWechat::find($weid);
} else {
//新增公众号
$SiteWechatModel = new SiteWechat();
}
$SiteWechatModel['siteid'] = siteid();
$SiteWechatModel['wename'] = Request::post('wename');
$SiteWechatModel['account'] = Request::post('account');
$SiteWechatModel['original'] = Request::post('original');
$SiteWechatModel['level'] = Request::post('level');
$SiteWechatModel['appid'] = Request::post('appid');
$SiteWechatModel['appsecret'] = Request::post('appsecret');
$SiteWechatModel['qrcode'] = Request::post('qrcode');
$SiteWechatModel['icon'] = Request::post('icon');
$weid = $SiteWechatModel->save();
//设置站点微信记录编号
$site = SiteModel::find(siteid());
$site['weid'] = $weid;
$site->save();
//更新站点缓存
$site->updateCache();
return message('保存成功');
}
$wechat = SiteWeChat::where('siteid', siteid())->first();
//更新站点缓存
$site->updateCache(siteid());
return view()->with('field', $wechat);
case 'explain':
//引导页面
$wechat = SiteWechat::where('siteid', siteid())->first();
if ($wechat) {
return view('explain')->with(compact('wechat'));
} else {
return message('您还没有设置公众号信息', 'back', 'warning');
}
}
}
/**
* 删除站点
*
* @param \system\model\User $user
* @param \system\model\Site $site
*
* @return mixed|string
*/
public function remove(User $user, SiteModel $site)
{
if ($user->isManage() == false) {
return message('你不是站长不可以删除网站', 'with');
}
$site->remove(siteid());
return message('网站删除成功', 'with');
}
/**
* 编辑站点
*
* @param \system\model\User $user
*
* @return mixed|string
*/
public function edit(User $user)
{
if ($user->isManage() == false) {
return message('你没有编辑站点的权限', '', 'error');
}
if (IS_POST) {
//更新站点数据
$site = SiteModel::find(siteid());
$site->save(Request::post());
$site->updateCache();
return message('网站数据保存成功', 'back', 'success');
}
$site = SiteModel::find(siteid());
return view('', compact('site'));
}
/**
* 添加站点
*
* @param \system\model\Site $site
*
* @return mixed|string
*/
public function addSite(SiteModel $site)
{
if (IS_POST) {
$site->addSite(Request::post());
return message('站点添加成功', 'lists');
}
return view('site_setting');
}
/**
* 公众号连接测试
*/
public function connect()
{
//与微信官网通信绑定验证
$status = WeChat::getAccessToken();
SiteWechat::where('siteid', siteid())->update(['is_connect' => $status ? 1 : 0]);
if ($status) {
return ['valid' => true, 'message' => '恭喜, 微信公众号接入成功'];
} else {
return ['valid' => false, 'message' => '公众号接入失败'];
}
}
/**
* 移除站长
* 只有系统管理员可以操作这个功能
*
* @param \system\model\User $UserModel
* @param \system\model\Site $siteModel
*
* @return mixed|string
*/
public function delOwner(User $UserModel, SiteModel $siteModel)
{
if ($UserModel->superUserAuth() != true) {
return message('您不是系统管理员,不允许操作', '', 'error');
}
SiteUser::where('siteid', siteid())->where('role', 'owner')->delete();
$siteModel->updateCache();
return message('删除站长成功', 'back', 'success');
}
/**
* 获取拥有桌面主面访问的模块列表
*/
public function getModuleHasWebPage()
{
$modules = \Module::getModuleHasWebPage();
return view()->with('modules', $modules);
}
} | {
"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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/** \file
* \ingroup pymathutils
*/
#include <Python.h>
#include "mathutils.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "../generic/py_capi_utils.h"
#include "../generic/python_utildefines.h"
#ifndef MATH_STANDALONE
# include "BLI_dynstr.h"
#endif
#define QUAT_SIZE 4
static PyObject *quat__apply_to_copy(PyObject *(*quat_func)(QuaternionObject *),
QuaternionObject *self);
static void quat__axis_angle_sanitize(float axis[3], float *angle);
static PyObject *Quaternion_copy(QuaternionObject *self);
static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args);
/* -----------------------------METHODS------------------------------ */
/* note: BaseMath_ReadCallback must be called beforehand */
static PyObject *Quaternion_to_tuple_ext(QuaternionObject *self, int ndigits)
{
PyObject *ret;
int i;
ret = PyTuple_New(QUAT_SIZE);
if (ndigits >= 0) {
for (i = 0; i < QUAT_SIZE; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(double_round((double)self->quat[i], ndigits)));
}
}
else {
for (i = 0; i < QUAT_SIZE; i++) {
PyTuple_SET_ITEM(ret, i, PyFloat_FromDouble(self->quat[i]));
}
}
return ret;
}
PyDoc_STRVAR(Quaternion_to_euler_doc,
".. method:: to_euler(order, euler_compat)\n"
"\n"
" Return Euler representation of the quaternion.\n"
"\n"
" :arg order: Optional rotation order argument in\n"
" ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'].\n"
" :type order: string\n"
" :arg euler_compat: Optional euler argument the new euler will be made\n"
" compatible with (no axis flipping between them).\n"
" Useful for converting a series of matrices to animation curves.\n"
" :type euler_compat: :class:`Euler`\n"
" :return: Euler representation of the quaternion.\n"
" :rtype: :class:`Euler`\n");
static PyObject *Quaternion_to_euler(QuaternionObject *self, PyObject *args)
{
float tquat[4];
float eul[3];
const char *order_str = NULL;
short order = EULER_ORDER_XYZ;
EulerObject *eul_compat = NULL;
if (!PyArg_ParseTuple(args, "|sO!:to_euler", &order_str, &euler_Type, &eul_compat)) {
return NULL;
}
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
if (order_str) {
order = euler_order_from_string(order_str, "Matrix.to_euler()");
if (order == -1) {
return NULL;
}
}
normalize_qt_qt(tquat, self->quat);
if (eul_compat) {
if (BaseMath_ReadCallback(eul_compat) == -1) {
return NULL;
}
if (order == EULER_ORDER_XYZ) {
quat_to_compatible_eul(eul, eul_compat->eul, tquat);
}
else {
quat_to_compatible_eulO(eul, eul_compat->eul, order, tquat);
}
}
else {
if (order == EULER_ORDER_XYZ) {
quat_to_eul(eul, tquat);
}
else {
quat_to_eulO(eul, order, tquat);
}
}
return Euler_CreatePyObject(eul, order, NULL);
}
PyDoc_STRVAR(Quaternion_to_matrix_doc,
".. method:: to_matrix()\n"
"\n"
" Return a matrix representation of the quaternion.\n"
"\n"
" :return: A 3x3 rotation matrix representation of the quaternion.\n"
" :rtype: :class:`Matrix`\n");
static PyObject *Quaternion_to_matrix(QuaternionObject *self)
{
float mat[9]; /* all values are set */
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
quat_to_mat3((float(*)[3])mat, self->quat);
return Matrix_CreatePyObject(mat, 3, 3, NULL);
}
PyDoc_STRVAR(Quaternion_to_axis_angle_doc,
".. method:: to_axis_angle()\n"
"\n"
" Return the axis, angle representation of the quaternion.\n"
"\n"
" :return: axis, angle.\n"
" :rtype: (:class:`Vector`, float) pair\n");
static PyObject *Quaternion_to_axis_angle(QuaternionObject *self)
{
PyObject *ret;
float tquat[4];
float axis[3];
float angle;
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
normalize_qt_qt(tquat, self->quat);
quat_to_axis_angle(axis, &angle, tquat);
quat__axis_angle_sanitize(axis, &angle);
ret = PyTuple_New(2);
PyTuple_SET_ITEMS(ret, Vector_CreatePyObject(axis, 3, NULL), PyFloat_FromDouble(angle));
return ret;
}
PyDoc_STRVAR(Quaternion_to_swing_twist_doc,
".. method:: to_swing_twist(axis)\n"
"\n"
" Split the rotation into a swing quaternion with the specified\n"
" axis fixed at zero, and the remaining twist rotation angle.\n"
"\n"
" :arg axis: twist axis as a string in ['X', 'Y', 'Z']\n"
" :return: swing, twist angle.\n"
" :rtype: (:class:`Quaternion`, float) pair\n");
static PyObject *Quaternion_to_swing_twist(QuaternionObject *self, PyObject *axis_arg)
{
PyObject *ret;
const char *axis_str = NULL;
float swing[4], twist;
int axis;
if (axis_arg && PyUnicode_Check(axis_arg)) {
axis_str = _PyUnicode_AsString(axis_arg);
}
if (axis_str && axis_str[0] >= 'X' && axis_str[0] <= 'Z' && axis_str[1] == 0) {
axis = axis_str[0] - 'X';
}
else {
PyErr_SetString(PyExc_ValueError,
"Quaternion.to_swing_twist(): "
"the axis argument must be "
"a string in 'X', 'Y', 'Z'");
return NULL;
}
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
twist = quat_split_swing_and_twist(self->quat, axis, swing, NULL);
ret = PyTuple_New(2);
PyTuple_SET_ITEMS(
ret, Quaternion_CreatePyObject(swing, Py_TYPE(self)), PyFloat_FromDouble(twist));
return ret;
}
PyDoc_STRVAR(
Quaternion_to_exponential_map_doc,
".. method:: to_exponential_map()\n"
"\n"
" Return the exponential map representation of the quaternion.\n"
"\n"
" This representation consist of the rotation axis multiplied by the rotation angle.\n"
" Such a representation is useful for interpolation between multiple orientations.\n"
"\n"
" :return: exponential map.\n"
" :rtype: :class:`Vector` of size 3\n"
"\n"
" To convert back to a quaternion, pass it to the :class:`Quaternion` constructor.\n");
static PyObject *Quaternion_to_exponential_map(QuaternionObject *self)
{
float expmap[3];
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
quat_to_expmap(expmap, self->quat);
return Vector_CreatePyObject(expmap, 3, NULL);
}
PyDoc_STRVAR(Quaternion_cross_doc,
".. method:: cross(other)\n"
"\n"
" Return the cross product of this quaternion and another.\n"
"\n"
" :arg other: The other quaternion to perform the cross product with.\n"
" :type other: :class:`Quaternion`\n"
" :return: The cross product.\n"
" :rtype: :class:`Quaternion`\n");
static PyObject *Quaternion_cross(QuaternionObject *self, PyObject *value)
{
float quat[QUAT_SIZE], tquat[QUAT_SIZE];
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
if (mathutils_array_parse(
tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.cross(other), invalid 'other' arg") ==
-1) {
return NULL;
}
mul_qt_qtqt(quat, self->quat, tquat);
return Quaternion_CreatePyObject(quat, Py_TYPE(self));
}
PyDoc_STRVAR(Quaternion_dot_doc,
".. method:: dot(other)\n"
"\n"
" Return the dot product of this quaternion and another.\n"
"\n"
" :arg other: The other quaternion to perform the dot product with.\n"
" :type other: :class:`Quaternion`\n"
" :return: The dot product.\n"
" :rtype: float\n");
static PyObject *Quaternion_dot(QuaternionObject *self, PyObject *value)
{
float tquat[QUAT_SIZE];
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
if (mathutils_array_parse(
tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.dot(other), invalid 'other' arg") ==
-1) {
return NULL;
}
return PyFloat_FromDouble(dot_qtqt(self->quat, tquat));
}
PyDoc_STRVAR(Quaternion_rotation_difference_doc,
".. function:: rotation_difference(other)\n"
"\n"
" Returns a quaternion representing the rotational difference.\n"
"\n"
" :arg other: second quaternion.\n"
" :type other: :class:`Quaternion`\n"
" :return: the rotational difference between the two quat rotations.\n"
" :rtype: :class:`Quaternion`\n");
static PyObject *Quaternion_rotation_difference(QuaternionObject *self, PyObject *value)
{
float tquat[QUAT_SIZE], quat[QUAT_SIZE];
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
if (mathutils_array_parse(tquat,
QUAT_SIZE,
QUAT_SIZE,
value,
"Quaternion.difference(other), invalid 'other' arg") == -1) {
return NULL;
}
rotation_between_quats_to_quat(quat, self->quat, tquat);
return Quaternion_CreatePyObject(quat, Py_TYPE(self));
}
PyDoc_STRVAR(Quaternion_slerp_doc,
".. function:: slerp(other, factor)\n"
"\n"
" Returns the interpolation of two quaternions.\n"
"\n"
" :arg other: value to interpolate with.\n"
" :type other: :class:`Quaternion`\n"
" :arg factor: The interpolation value in [0.0, 1.0].\n"
" :type factor: float\n"
" :return: The interpolated rotation.\n"
" :rtype: :class:`Quaternion`\n");
static PyObject *Quaternion_slerp(QuaternionObject *self, PyObject *args)
{
PyObject *value;
float tquat[QUAT_SIZE], quat[QUAT_SIZE], fac;
if (!PyArg_ParseTuple(args, "Of:slerp", &value, &fac)) {
PyErr_SetString(PyExc_TypeError,
"quat.slerp(): "
"expected Quaternion types and float");
return NULL;
}
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
if (mathutils_array_parse(
tquat, QUAT_SIZE, QUAT_SIZE, value, "Quaternion.slerp(other), invalid 'other' arg") ==
-1) {
return NULL;
}
if (fac > 1.0f || fac < 0.0f) {
PyErr_SetString(PyExc_ValueError,
"quat.slerp(): "
"interpolation factor must be between 0.0 and 1.0");
return NULL;
}
interp_qt_qtqt(quat, self->quat, tquat, fac);
return Quaternion_CreatePyObject(quat, Py_TYPE(self));
}
PyDoc_STRVAR(Quaternion_rotate_doc,
".. method:: rotate(other)\n"
"\n"
" Rotates the quaternion by another mathutils value.\n"
"\n"
" :arg other: rotation component of mathutils value\n"
" :type other: :class:`Euler`, :class:`Quaternion` or :class:`Matrix`\n");
static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
{
float self_rmat[3][3], other_rmat[3][3], rmat[3][3];
float tquat[4], length;
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return NULL;
}
if (mathutils_any_to_rotmat(other_rmat, value, "Quaternion.rotate(value)") == -1) {
return NULL;
}
length = normalize_qt_qt(tquat, self->quat);
quat_to_mat3(self_rmat, tquat);
mul_m3_m3m3(rmat, other_rmat, self_rmat);
mat3_to_quat(self->quat, rmat);
mul_qt_fl(self->quat, length); /* maintain length after rotating */
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
PyDoc_STRVAR(Quaternion_make_compatible_doc,
".. method:: make_compatible(other)\n"
"\n"
" Make this quaternion compatible with another,\n"
" so interpolating between them works as intended.\n");
static PyObject *Quaternion_make_compatible(QuaternionObject *self, PyObject *value)
{
float quat[QUAT_SIZE];
float tquat[QUAT_SIZE];
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return NULL;
}
if (mathutils_array_parse(tquat,
QUAT_SIZE,
QUAT_SIZE,
value,
"Quaternion.make_compatible(other), invalid 'other' arg") == -1) {
return NULL;
}
/* Can only operate on unit length quaternions. */
const float quat_len = normalize_qt_qt(quat, self->quat);
quat_to_compatible_quat(self->quat, quat, tquat);
mul_qt_fl(self->quat, quat_len);
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
/* ----------------------------Quaternion.normalize()---------------- */
/* Normalize the quaternion. This may change the angle as well as the
* rotation axis, as all of (w, x, y, z) are scaled. */
PyDoc_STRVAR(Quaternion_normalize_doc,
".. function:: normalize()\n"
"\n"
" Normalize the quaternion.\n");
static PyObject *Quaternion_normalize(QuaternionObject *self)
{
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return NULL;
}
normalize_qt(self->quat);
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
PyDoc_STRVAR(Quaternion_normalized_doc,
".. function:: normalized()\n"
"\n"
" Return a new normalized quaternion.\n"
"\n"
" :return: a normalized copy.\n"
" :rtype: :class:`Quaternion`\n");
static PyObject *Quaternion_normalized(QuaternionObject *self)
{
return quat__apply_to_copy(Quaternion_normalize, self);
}
PyDoc_STRVAR(Quaternion_invert_doc,
".. function:: invert()\n"
"\n"
" Set the quaternion to its inverse.\n");
static PyObject *Quaternion_invert(QuaternionObject *self)
{
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return NULL;
}
invert_qt(self->quat);
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
PyDoc_STRVAR(Quaternion_inverted_doc,
".. function:: inverted()\n"
"\n"
" Return a new, inverted quaternion.\n"
"\n"
" :return: the inverted value.\n"
" :rtype: :class:`Quaternion`\n");
static PyObject *Quaternion_inverted(QuaternionObject *self)
{
return quat__apply_to_copy(Quaternion_invert, self);
}
PyDoc_STRVAR(Quaternion_identity_doc,
".. function:: identity()\n"
"\n"
" Set the quaternion to an identity quaternion.\n"
"\n"
" :rtype: :class:`Quaternion`\n");
static PyObject *Quaternion_identity(QuaternionObject *self)
{
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return NULL;
}
unit_qt(self->quat);
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
PyDoc_STRVAR(Quaternion_negate_doc,
".. function:: negate()\n"
"\n"
" Set the quaternion to its negative.\n"
"\n"
" :rtype: :class:`Quaternion`\n");
static PyObject *Quaternion_negate(QuaternionObject *self)
{
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return NULL;
}
mul_qt_fl(self->quat, -1.0f);
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
PyDoc_STRVAR(Quaternion_conjugate_doc,
".. function:: conjugate()\n"
"\n"
" Set the quaternion to its conjugate (negate x, y, z).\n");
static PyObject *Quaternion_conjugate(QuaternionObject *self)
{
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return NULL;
}
conjugate_qt(self->quat);
(void)BaseMath_WriteCallback(self);
Py_RETURN_NONE;
}
PyDoc_STRVAR(Quaternion_conjugated_doc,
".. function:: conjugated()\n"
"\n"
" Return a new conjugated quaternion.\n"
"\n"
" :return: a new quaternion.\n"
" :rtype: :class:`Quaternion`\n");
static PyObject *Quaternion_conjugated(QuaternionObject *self)
{
return quat__apply_to_copy(Quaternion_conjugate, self);
}
PyDoc_STRVAR(Quaternion_copy_doc,
".. function:: copy()\n"
"\n"
" Returns a copy of this quaternion.\n"
"\n"
" :return: A copy of the quaternion.\n"
" :rtype: :class:`Quaternion`\n"
"\n"
" .. note:: use this to get a copy of a wrapped quaternion with\n"
" no reference to the original data.\n");
static PyObject *Quaternion_copy(QuaternionObject *self)
{
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
return Quaternion_CreatePyObject(self->quat, Py_TYPE(self));
}
static PyObject *Quaternion_deepcopy(QuaternionObject *self, PyObject *args)
{
if (!PyC_CheckArgs_DeepCopy(args)) {
return NULL;
}
return Quaternion_copy(self);
}
/* print the object to screen */
static PyObject *Quaternion_repr(QuaternionObject *self)
{
PyObject *ret, *tuple;
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
tuple = Quaternion_to_tuple_ext(self, -1);
ret = PyUnicode_FromFormat("Quaternion(%R)", tuple);
Py_DECREF(tuple);
return ret;
}
#ifndef MATH_STANDALONE
static PyObject *Quaternion_str(QuaternionObject *self)
{
DynStr *ds;
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
ds = BLI_dynstr_new();
BLI_dynstr_appendf(ds,
"<Quaternion (w=%.4f, x=%.4f, y=%.4f, z=%.4f)>",
self->quat[0],
self->quat[1],
self->quat[2],
self->quat[3]);
return mathutils_dynstr_to_py(ds); /* frees ds */
}
#endif
static PyObject *Quaternion_richcmpr(PyObject *a, PyObject *b, int op)
{
PyObject *res;
int ok = -1; /* zero is true */
if (QuaternionObject_Check(a) && QuaternionObject_Check(b)) {
QuaternionObject *quatA = (QuaternionObject *)a;
QuaternionObject *quatB = (QuaternionObject *)b;
if (BaseMath_ReadCallback(quatA) == -1 || BaseMath_ReadCallback(quatB) == -1) {
return NULL;
}
ok = (EXPP_VectorsAreEqual(quatA->quat, quatB->quat, QUAT_SIZE, 1)) ? 0 : -1;
}
switch (op) {
case Py_NE:
ok = !ok;
ATTR_FALLTHROUGH;
case Py_EQ:
res = ok ? Py_False : Py_True;
break;
case Py_LT:
case Py_LE:
case Py_GT:
case Py_GE:
res = Py_NotImplemented;
break;
default:
PyErr_BadArgument();
return NULL;
}
return Py_INCREF_RET(res);
}
static Py_hash_t Quaternion_hash(QuaternionObject *self)
{
if (BaseMath_ReadCallback(self) == -1) {
return -1;
}
if (BaseMathObject_Prepare_ForHash(self) == -1) {
return -1;
}
return mathutils_array_hash(self->quat, QUAT_SIZE);
}
/* ---------------------SEQUENCE PROTOCOLS------------------------ */
/* ----------------------------len(object)------------------------ */
/* sequence length */
static int Quaternion_len(QuaternionObject *UNUSED(self))
{
return QUAT_SIZE;
}
/* ----------------------------object[]--------------------------- */
/* sequence accessor (get) */
static PyObject *Quaternion_item(QuaternionObject *self, int i)
{
if (i < 0) {
i = QUAT_SIZE - i;
}
if (i < 0 || i >= QUAT_SIZE) {
PyErr_SetString(PyExc_IndexError,
"quaternion[attribute]: "
"array index out of range");
return NULL;
}
if (BaseMath_ReadIndexCallback(self, i) == -1) {
return NULL;
}
return PyFloat_FromDouble(self->quat[i]);
}
/* ----------------------------object[]------------------------- */
/* sequence accessor (set) */
static int Quaternion_ass_item(QuaternionObject *self, int i, PyObject *ob)
{
float f;
if (BaseMath_Prepare_ForWrite(self) == -1) {
return -1;
}
f = (float)PyFloat_AsDouble(ob);
if (f == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
PyErr_SetString(PyExc_TypeError,
"quaternion[index] = x: "
"assigned value not a number");
return -1;
}
if (i < 0) {
i = QUAT_SIZE - i;
}
if (i < 0 || i >= QUAT_SIZE) {
PyErr_SetString(PyExc_IndexError,
"quaternion[attribute] = x: "
"array assignment index out of range");
return -1;
}
self->quat[i] = f;
if (BaseMath_WriteIndexCallback(self, i) == -1) {
return -1;
}
return 0;
}
/* ----------------------------object[z:y]------------------------ */
/* sequence slice (get) */
static PyObject *Quaternion_slice(QuaternionObject *self, int begin, int end)
{
PyObject *tuple;
int count;
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
CLAMP(begin, 0, QUAT_SIZE);
if (end < 0) {
end = (QUAT_SIZE + 1) + end;
}
CLAMP(end, 0, QUAT_SIZE);
begin = MIN2(begin, end);
tuple = PyTuple_New(end - begin);
for (count = begin; count < end; count++) {
PyTuple_SET_ITEM(tuple, count - begin, PyFloat_FromDouble(self->quat[count]));
}
return tuple;
}
/* ----------------------------object[z:y]------------------------ */
/* sequence slice (set) */
static int Quaternion_ass_slice(QuaternionObject *self, int begin, int end, PyObject *seq)
{
int i, size;
float quat[QUAT_SIZE];
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return -1;
}
CLAMP(begin, 0, QUAT_SIZE);
if (end < 0) {
end = (QUAT_SIZE + 1) + end;
}
CLAMP(end, 0, QUAT_SIZE);
begin = MIN2(begin, end);
if ((size = mathutils_array_parse(
quat, 0, QUAT_SIZE, seq, "mathutils.Quaternion[begin:end] = []")) == -1) {
return -1;
}
if (size != (end - begin)) {
PyErr_SetString(PyExc_ValueError,
"quaternion[begin:end] = []: "
"size mismatch in slice assignment");
return -1;
}
/* parsed well - now set in vector */
for (i = 0; i < size; i++) {
self->quat[begin + i] = quat[i];
}
(void)BaseMath_WriteCallback(self);
return 0;
}
static PyObject *Quaternion_subscript(QuaternionObject *self, PyObject *item)
{
if (PyIndex_Check(item)) {
Py_ssize_t i;
i = PyNumber_AsSsize_t(item, PyExc_IndexError);
if (i == -1 && PyErr_Occurred()) {
return NULL;
}
if (i < 0) {
i += QUAT_SIZE;
}
return Quaternion_item(self, i);
}
if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0) {
return NULL;
}
if (slicelength <= 0) {
return PyTuple_New(0);
}
if (step == 1) {
return Quaternion_slice(self, start, stop);
}
PyErr_SetString(PyExc_IndexError, "slice steps not supported with quaternions");
return NULL;
}
PyErr_Format(
PyExc_TypeError, "quaternion indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
return NULL;
}
static int Quaternion_ass_subscript(QuaternionObject *self, PyObject *item, PyObject *value)
{
if (PyIndex_Check(item)) {
Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError);
if (i == -1 && PyErr_Occurred()) {
return -1;
}
if (i < 0) {
i += QUAT_SIZE;
}
return Quaternion_ass_item(self, i, value);
}
if (PySlice_Check(item)) {
Py_ssize_t start, stop, step, slicelength;
if (PySlice_GetIndicesEx(item, QUAT_SIZE, &start, &stop, &step, &slicelength) < 0) {
return -1;
}
if (step == 1) {
return Quaternion_ass_slice(self, start, stop, value);
}
PyErr_SetString(PyExc_IndexError, "slice steps not supported with quaternion");
return -1;
}
PyErr_Format(
PyExc_TypeError, "quaternion indices must be integers, not %.200s", Py_TYPE(item)->tp_name);
return -1;
}
/* ------------------------NUMERIC PROTOCOLS---------------------- */
/* ------------------------obj + obj------------------------------ */
/* addition */
static PyObject *Quaternion_add(PyObject *q1, PyObject *q2)
{
float quat[QUAT_SIZE];
QuaternionObject *quat1 = NULL, *quat2 = NULL;
if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) {
PyErr_Format(PyExc_TypeError,
"Quaternion addition: (%s + %s) "
"invalid type for this operation",
Py_TYPE(q1)->tp_name,
Py_TYPE(q2)->tp_name);
return NULL;
}
quat1 = (QuaternionObject *)q1;
quat2 = (QuaternionObject *)q2;
if (BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1) {
return NULL;
}
add_qt_qtqt(quat, quat1->quat, quat2->quat, 1.0f);
return Quaternion_CreatePyObject(quat, Py_TYPE(q1));
}
/* ------------------------obj - obj------------------------------ */
/* subtraction */
static PyObject *Quaternion_sub(PyObject *q1, PyObject *q2)
{
int x;
float quat[QUAT_SIZE];
QuaternionObject *quat1 = NULL, *quat2 = NULL;
if (!QuaternionObject_Check(q1) || !QuaternionObject_Check(q2)) {
PyErr_Format(PyExc_TypeError,
"Quaternion subtraction: (%s - %s) "
"invalid type for this operation",
Py_TYPE(q1)->tp_name,
Py_TYPE(q2)->tp_name);
return NULL;
}
quat1 = (QuaternionObject *)q1;
quat2 = (QuaternionObject *)q2;
if (BaseMath_ReadCallback(quat1) == -1 || BaseMath_ReadCallback(quat2) == -1) {
return NULL;
}
for (x = 0; x < QUAT_SIZE; x++) {
quat[x] = quat1->quat[x] - quat2->quat[x];
}
return Quaternion_CreatePyObject(quat, Py_TYPE(q1));
}
static PyObject *quat_mul_float(QuaternionObject *quat, const float scalar)
{
float tquat[4];
copy_qt_qt(tquat, quat->quat);
mul_qt_fl(tquat, scalar);
return Quaternion_CreatePyObject(tquat, Py_TYPE(quat));
}
/*------------------------obj * obj------------------------------
* multiplication */
static PyObject *Quaternion_mul(PyObject *q1, PyObject *q2)
{
float scalar;
QuaternionObject *quat1 = NULL, *quat2 = NULL;
if (QuaternionObject_Check(q1)) {
quat1 = (QuaternionObject *)q1;
if (BaseMath_ReadCallback(quat1) == -1) {
return NULL;
}
}
if (QuaternionObject_Check(q2)) {
quat2 = (QuaternionObject *)q2;
if (BaseMath_ReadCallback(quat2) == -1) {
return NULL;
}
}
if (quat1 && quat2) { /* QUAT * QUAT (element-wise product) */
float quat[QUAT_SIZE];
mul_vn_vnvn(quat, quat1->quat, quat2->quat, QUAT_SIZE);
return Quaternion_CreatePyObject(quat, Py_TYPE(q1));
}
/* the only case this can happen (for a supported type is "FLOAT * QUAT") */
if (quat2) { /* FLOAT * QUAT */
if (((scalar = PyFloat_AsDouble(q1)) == -1.0f && PyErr_Occurred()) == 0) {
return quat_mul_float(quat2, scalar);
}
}
else if (quat1) { /* QUAT * FLOAT */
if ((((scalar = PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred()) == 0)) {
return quat_mul_float(quat1, scalar);
}
}
PyErr_Format(PyExc_TypeError,
"Element-wise multiplication: "
"not supported between '%.200s' and '%.200s' types",
Py_TYPE(q1)->tp_name,
Py_TYPE(q2)->tp_name);
return NULL;
}
/*------------------------obj *= obj------------------------------
* in-place multiplication */
static PyObject *Quaternion_imul(PyObject *q1, PyObject *q2)
{
float scalar;
QuaternionObject *quat1 = NULL, *quat2 = NULL;
if (QuaternionObject_Check(q1)) {
quat1 = (QuaternionObject *)q1;
if (BaseMath_ReadCallback(quat1) == -1) {
return NULL;
}
}
if (QuaternionObject_Check(q2)) {
quat2 = (QuaternionObject *)q2;
if (BaseMath_ReadCallback(quat2) == -1) {
return NULL;
}
}
if (quat1 && quat2) { /* QUAT *= QUAT (in-place element-wise product). */
mul_vn_vn(quat1->quat, quat2->quat, QUAT_SIZE);
}
else if (quat1 && (((scalar = PyFloat_AsDouble(q2)) == -1.0f && PyErr_Occurred()) == 0)) {
/* QUAT *= FLOAT */
mul_qt_fl(quat1->quat, scalar);
}
else {
PyErr_Format(PyExc_TypeError,
"Element-wise multiplication: "
"not supported between '%.200s' and '%.200s' types",
Py_TYPE(q1)->tp_name,
Py_TYPE(q2)->tp_name);
return NULL;
}
(void)BaseMath_WriteCallback(quat1);
Py_INCREF(q1);
return q1;
}
/*------------------------obj @ obj------------------------------
* quaternion multiplication */
static PyObject *Quaternion_matmul(PyObject *q1, PyObject *q2)
{
float quat[QUAT_SIZE];
QuaternionObject *quat1 = NULL, *quat2 = NULL;
if (QuaternionObject_Check(q1)) {
quat1 = (QuaternionObject *)q1;
if (BaseMath_ReadCallback(quat1) == -1) {
return NULL;
}
}
if (QuaternionObject_Check(q2)) {
quat2 = (QuaternionObject *)q2;
if (BaseMath_ReadCallback(quat2) == -1) {
return NULL;
}
}
if (quat1 && quat2) { /* QUAT @ QUAT (cross product) */
mul_qt_qtqt(quat, quat1->quat, quat2->quat);
return Quaternion_CreatePyObject(quat, Py_TYPE(q1));
}
if (quat1) {
/* QUAT @ VEC */
if (VectorObject_Check(q2)) {
VectorObject *vec2 = (VectorObject *)q2;
float tvec[3];
if (vec2->size != 3) {
PyErr_SetString(PyExc_ValueError,
"Vector multiplication: "
"only 3D vector rotations (with quats) "
"currently supported");
return NULL;
}
if (BaseMath_ReadCallback(vec2) == -1) {
return NULL;
}
copy_v3_v3(tvec, vec2->vec);
mul_qt_v3(quat1->quat, tvec);
return Vector_CreatePyObject(tvec, 3, Py_TYPE(vec2));
}
}
PyErr_Format(PyExc_TypeError,
"Quaternion multiplication: "
"not supported between '%.200s' and '%.200s' types",
Py_TYPE(q1)->tp_name,
Py_TYPE(q2)->tp_name);
return NULL;
}
/*------------------------obj @= obj------------------------------
* in-place quaternion multiplication */
static PyObject *Quaternion_imatmul(PyObject *q1, PyObject *q2)
{
float quat[QUAT_SIZE];
QuaternionObject *quat1 = NULL, *quat2 = NULL;
if (QuaternionObject_Check(q1)) {
quat1 = (QuaternionObject *)q1;
if (BaseMath_ReadCallback(quat1) == -1) {
return NULL;
}
}
if (QuaternionObject_Check(q2)) {
quat2 = (QuaternionObject *)q2;
if (BaseMath_ReadCallback(quat2) == -1) {
return NULL;
}
}
if (quat1 && quat2) { /* QUAT @ QUAT (cross product) */
mul_qt_qtqt(quat, quat1->quat, quat2->quat);
copy_qt_qt(quat1->quat, quat);
}
else {
PyErr_Format(PyExc_TypeError,
"In place quaternion multiplication: "
"not supported between '%.200s' and '%.200s' types",
Py_TYPE(q1)->tp_name,
Py_TYPE(q2)->tp_name);
return NULL;
}
(void)BaseMath_WriteCallback(quat1);
Py_INCREF(q1);
return q1;
}
/* -obj
* returns the negative of this object*/
static PyObject *Quaternion_neg(QuaternionObject *self)
{
float tquat[QUAT_SIZE];
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
negate_v4_v4(tquat, self->quat);
return Quaternion_CreatePyObject(tquat, Py_TYPE(self));
}
/* -----------------PROTOCOL DECLARATIONS-------------------------- */
static PySequenceMethods Quaternion_SeqMethods = {
(lenfunc)Quaternion_len, /* sq_length */
(binaryfunc)NULL, /* sq_concat */
(ssizeargfunc)NULL, /* sq_repeat */
(ssizeargfunc)Quaternion_item, /* sq_item */
(ssizessizeargfunc)NULL, /* sq_slice, deprecated */
(ssizeobjargproc)Quaternion_ass_item, /* sq_ass_item */
(ssizessizeobjargproc)NULL, /* sq_ass_slice, deprecated */
(objobjproc)NULL, /* sq_contains */
(binaryfunc)NULL, /* sq_inplace_concat */
(ssizeargfunc)NULL, /* sq_inplace_repeat */
};
static PyMappingMethods Quaternion_AsMapping = {
(lenfunc)Quaternion_len,
(binaryfunc)Quaternion_subscript,
(objobjargproc)Quaternion_ass_subscript,
};
static PyNumberMethods Quaternion_NumMethods = {
(binaryfunc)Quaternion_add, /*nb_add*/
(binaryfunc)Quaternion_sub, /*nb_subtract*/
(binaryfunc)Quaternion_mul, /*nb_multiply*/
NULL, /*nb_remainder*/
NULL, /*nb_divmod*/
NULL, /*nb_power*/
(unaryfunc)Quaternion_neg, /*nb_negative*/
(unaryfunc)Quaternion_copy, /*tp_positive*/
(unaryfunc)0, /*tp_absolute*/
(inquiry)0, /*tp_bool*/
(unaryfunc)0, /*nb_invert*/
NULL, /*nb_lshift*/
(binaryfunc)0, /*nb_rshift*/
NULL, /*nb_and*/
NULL, /*nb_xor*/
NULL, /*nb_or*/
NULL, /*nb_int*/
NULL, /*nb_reserved*/
NULL, /*nb_float*/
NULL, /* nb_inplace_add */
NULL, /* nb_inplace_subtract */
(binaryfunc)Quaternion_imul, /* nb_inplace_multiply */
NULL, /* nb_inplace_remainder */
NULL, /* nb_inplace_power */
NULL, /* nb_inplace_lshift */
NULL, /* nb_inplace_rshift */
NULL, /* nb_inplace_and */
NULL, /* nb_inplace_xor */
NULL, /* nb_inplace_or */
NULL, /* nb_floor_divide */
NULL, /* nb_true_divide */
NULL, /* nb_inplace_floor_divide */
NULL, /* nb_inplace_true_divide */
NULL, /* nb_index */
(binaryfunc)Quaternion_matmul, /* nb_matrix_multiply */
(binaryfunc)Quaternion_imatmul, /* nb_inplace_matrix_multiply */
};
PyDoc_STRVAR(Quaternion_axis_doc, "Quaternion axis value.\n\n:type: float");
static PyObject *Quaternion_axis_get(QuaternionObject *self, void *type)
{
return Quaternion_item(self, POINTER_AS_INT(type));
}
static int Quaternion_axis_set(QuaternionObject *self, PyObject *value, void *type)
{
return Quaternion_ass_item(self, POINTER_AS_INT(type), value);
}
PyDoc_STRVAR(Quaternion_magnitude_doc, "Size of the quaternion (read-only).\n\n:type: float");
static PyObject *Quaternion_magnitude_get(QuaternionObject *self, void *UNUSED(closure))
{
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
return PyFloat_FromDouble(sqrtf(dot_qtqt(self->quat, self->quat)));
}
PyDoc_STRVAR(Quaternion_angle_doc, "Angle of the quaternion.\n\n:type: float");
static PyObject *Quaternion_angle_get(QuaternionObject *self, void *UNUSED(closure))
{
float tquat[4];
float angle;
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
normalize_qt_qt(tquat, self->quat);
angle = 2.0f * saacos(tquat[0]);
quat__axis_angle_sanitize(NULL, &angle);
return PyFloat_FromDouble(angle);
}
static int Quaternion_angle_set(QuaternionObject *self, PyObject *value, void *UNUSED(closure))
{
float tquat[4];
float len;
float axis[3], angle_dummy;
float angle;
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return -1;
}
len = normalize_qt_qt(tquat, self->quat);
quat_to_axis_angle(axis, &angle_dummy, tquat);
angle = PyFloat_AsDouble(value);
if (angle == -1.0f && PyErr_Occurred()) { /* parsed item not a number */
PyErr_SetString(PyExc_TypeError, "Quaternion.angle = value: float expected");
return -1;
}
angle = angle_wrap_rad(angle);
quat__axis_angle_sanitize(axis, &angle);
axis_angle_to_quat(self->quat, axis, angle);
mul_qt_fl(self->quat, len);
if (BaseMath_WriteCallback(self) == -1) {
return -1;
}
return 0;
}
PyDoc_STRVAR(Quaternion_axis_vector_doc, "Quaternion axis as a vector.\n\n:type: :class:`Vector`");
static PyObject *Quaternion_axis_vector_get(QuaternionObject *self, void *UNUSED(closure))
{
float tquat[4];
float axis[3];
float angle_dummy;
if (BaseMath_ReadCallback(self) == -1) {
return NULL;
}
normalize_qt_qt(tquat, self->quat);
quat_to_axis_angle(axis, &angle_dummy, tquat);
quat__axis_angle_sanitize(axis, NULL);
return Vector_CreatePyObject(axis, 3, NULL);
}
static int Quaternion_axis_vector_set(QuaternionObject *self,
PyObject *value,
void *UNUSED(closure))
{
float tquat[4];
float len;
float axis[3];
float angle;
if (BaseMath_ReadCallback_ForWrite(self) == -1) {
return -1;
}
len = normalize_qt_qt(tquat, self->quat);
quat_to_axis_angle(axis, &angle, tquat); /* axis value is unused */
if (mathutils_array_parse(axis, 3, 3, value, "quat.axis = other") == -1) {
return -1;
}
quat__axis_angle_sanitize(axis, &angle);
axis_angle_to_quat(self->quat, axis, angle);
mul_qt_fl(self->quat, len);
if (BaseMath_WriteCallback(self) == -1) {
return -1;
}
return 0;
}
/* ----------------------------------mathutils.Quaternion() -------------- */
static PyObject *Quaternion_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *seq = NULL;
double angle = 0.0f;
float quat[QUAT_SIZE];
unit_qt(quat);
if (kwds && PyDict_Size(kwds)) {
PyErr_SetString(PyExc_TypeError,
"mathutils.Quaternion(): "
"takes no keyword args");
return NULL;
}
if (!PyArg_ParseTuple(args, "|Od:mathutils.Quaternion", &seq, &angle)) {
return NULL;
}
switch (PyTuple_GET_SIZE(args)) {
case 0:
break;
case 1: {
int size;
if ((size = mathutils_array_parse(quat, 3, QUAT_SIZE, seq, "mathutils.Quaternion()")) ==
-1) {
return NULL;
}
if (size == 4) {
/* 4d: Quaternion (common case) */
}
else {
/* 3d: Interpret as exponential map */
BLI_assert(size == 3);
expmap_to_quat(quat, quat);
}
break;
}
case 2: {
float axis[3];
if (mathutils_array_parse(axis, 3, 3, seq, "mathutils.Quaternion()") == -1) {
return NULL;
}
angle = angle_wrap_rad(angle); /* clamp because of precision issues */
axis_angle_to_quat(quat, axis, angle);
break;
/* PyArg_ParseTuple assures no more than 2 */
}
}
return Quaternion_CreatePyObject(quat, type);
}
static PyObject *quat__apply_to_copy(PyObject *(*quat_func)(QuaternionObject *),
QuaternionObject *self)
{
PyObject *ret = Quaternion_copy(self);
PyObject *ret_dummy = quat_func((QuaternionObject *)ret);
if (ret_dummy) {
Py_DECREF(ret_dummy);
return ret;
}
/* error */
Py_DECREF(ret);
return NULL;
}
/* axis vector suffers from precision errors, use this function to ensure */
static void quat__axis_angle_sanitize(float axis[3], float *angle)
{
if (axis) {
if (is_zero_v3(axis) || !isfinite(axis[0]) || !isfinite(axis[1]) || !isfinite(axis[2])) {
axis[0] = 1.0f;
axis[1] = 0.0f;
axis[2] = 0.0f;
}
else if (EXPP_FloatsAreEqual(axis[0], 0.0f, 10) && EXPP_FloatsAreEqual(axis[1], 0.0f, 10) &&
EXPP_FloatsAreEqual(axis[2], 0.0f, 10)) {
axis[0] = 1.0f;
}
}
if (angle) {
if (!isfinite(*angle)) {
*angle = 0.0f;
}
}
}
/* -----------------------METHOD DEFINITIONS ---------------------- */
static struct PyMethodDef Quaternion_methods[] = {
/* in place only */
{"identity", (PyCFunction)Quaternion_identity, METH_NOARGS, Quaternion_identity_doc},
{"negate", (PyCFunction)Quaternion_negate, METH_NOARGS, Quaternion_negate_doc},
/* operate on original or copy */
{"conjugate", (PyCFunction)Quaternion_conjugate, METH_NOARGS, Quaternion_conjugate_doc},
{"conjugated", (PyCFunction)Quaternion_conjugated, METH_NOARGS, Quaternion_conjugated_doc},
{"invert", (PyCFunction)Quaternion_invert, METH_NOARGS, Quaternion_invert_doc},
{"inverted", (PyCFunction)Quaternion_inverted, METH_NOARGS, Quaternion_inverted_doc},
{"normalize", (PyCFunction)Quaternion_normalize, METH_NOARGS, Quaternion_normalize_doc},
{"normalized", (PyCFunction)Quaternion_normalized, METH_NOARGS, Quaternion_normalized_doc},
/* return converted representation */
{"to_euler", (PyCFunction)Quaternion_to_euler, METH_VARARGS, Quaternion_to_euler_doc},
{"to_matrix", (PyCFunction)Quaternion_to_matrix, METH_NOARGS, Quaternion_to_matrix_doc},
{"to_axis_angle",
(PyCFunction)Quaternion_to_axis_angle,
METH_NOARGS,
Quaternion_to_axis_angle_doc},
{"to_swing_twist",
(PyCFunction)Quaternion_to_swing_twist,
METH_O,
Quaternion_to_swing_twist_doc},
{"to_exponential_map",
(PyCFunction)Quaternion_to_exponential_map,
METH_NOARGS,
Quaternion_to_exponential_map_doc},
/* operation between 2 or more types */
{"cross", (PyCFunction)Quaternion_cross, METH_O, Quaternion_cross_doc},
{"dot", (PyCFunction)Quaternion_dot, METH_O, Quaternion_dot_doc},
{"rotation_difference",
(PyCFunction)Quaternion_rotation_difference,
METH_O,
Quaternion_rotation_difference_doc},
{"slerp", (PyCFunction)Quaternion_slerp, METH_VARARGS, Quaternion_slerp_doc},
{"rotate", (PyCFunction)Quaternion_rotate, METH_O, Quaternion_rotate_doc},
{"make_compatible",
(PyCFunction)Quaternion_make_compatible,
METH_O,
Quaternion_make_compatible_doc},
/* base-math methods */
{"freeze", (PyCFunction)BaseMathObject_freeze, METH_NOARGS, BaseMathObject_freeze_doc},
{"copy", (PyCFunction)Quaternion_copy, METH_NOARGS, Quaternion_copy_doc},
{"__copy__", (PyCFunction)Quaternion_copy, METH_NOARGS, Quaternion_copy_doc},
{"__deepcopy__", (PyCFunction)Quaternion_deepcopy, METH_VARARGS, Quaternion_copy_doc},
{NULL, NULL, 0, NULL},
};
/*****************************************************************************/
/* Python attributes get/set structure: */
/*****************************************************************************/
static PyGetSetDef Quaternion_getseters[] = {
{"w",
(getter)Quaternion_axis_get,
(setter)Quaternion_axis_set,
Quaternion_axis_doc,
(void *)0},
{"x",
(getter)Quaternion_axis_get,
(setter)Quaternion_axis_set,
Quaternion_axis_doc,
(void *)1},
{"y",
(getter)Quaternion_axis_get,
(setter)Quaternion_axis_set,
Quaternion_axis_doc,
(void *)2},
{"z",
(getter)Quaternion_axis_get,
(setter)Quaternion_axis_set,
Quaternion_axis_doc,
(void *)3},
{"magnitude", (getter)Quaternion_magnitude_get, (setter)NULL, Quaternion_magnitude_doc, NULL},
{"angle",
(getter)Quaternion_angle_get,
(setter)Quaternion_angle_set,
Quaternion_angle_doc,
NULL},
{"axis",
(getter)Quaternion_axis_vector_get,
(setter)Quaternion_axis_vector_set,
Quaternion_axis_vector_doc,
NULL},
{"is_wrapped",
(getter)BaseMathObject_is_wrapped_get,
(setter)NULL,
BaseMathObject_is_wrapped_doc,
NULL},
{"is_frozen",
(getter)BaseMathObject_is_frozen_get,
(setter)NULL,
BaseMathObject_is_frozen_doc,
NULL},
{"owner", (getter)BaseMathObject_owner_get, (setter)NULL, BaseMathObject_owner_doc, NULL},
{NULL, NULL, NULL, NULL, NULL} /* Sentinel */
};
/* ------------------PY_OBECT DEFINITION-------------------------- */
PyDoc_STRVAR(quaternion_doc,
".. class:: Quaternion([seq, [angle]])\n"
"\n"
" This object gives access to Quaternions in Blender.\n"
"\n"
" :param seq: size 3 or 4\n"
" :type seq: :class:`Vector`\n"
" :param angle: rotation angle, in radians\n"
" :type angle: float\n"
"\n"
" The constructor takes arguments in various forms:\n"
"\n"
" (), *no args*\n"
" Create an identity quaternion\n"
" (*wxyz*)\n"
" Create a quaternion from a ``(w, x, y, z)`` vector.\n"
" (*exponential_map*)\n"
" Create a quaternion from a 3d exponential map vector.\n"
"\n"
" .. seealso:: :meth:`to_exponential_map`\n"
" (*axis, angle*)\n"
" Create a quaternion representing a rotation of *angle* radians over *axis*.\n"
"\n"
" .. seealso:: :meth:`to_axis_angle`\n");
PyTypeObject quaternion_Type = {
PyVarObject_HEAD_INIT(NULL, 0) "Quaternion", /* tp_name */
sizeof(QuaternionObject), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)BaseMathObject_dealloc, /* tp_dealloc */
(printfunc)NULL, /* tp_print */
NULL, /* tp_getattr */
NULL, /* tp_setattr */
NULL, /* tp_compare */
(reprfunc)Quaternion_repr, /* tp_repr */
&Quaternion_NumMethods, /* tp_as_number */
&Quaternion_SeqMethods, /* tp_as_sequence */
&Quaternion_AsMapping, /* tp_as_mapping */
(hashfunc)Quaternion_hash, /* tp_hash */
NULL, /* tp_call */
#ifndef MATH_STANDALONE
(reprfunc)Quaternion_str, /* tp_str */
#else
NULL, /* tp_str */
#endif
NULL, /* tp_getattro */
NULL, /* tp_setattro */
NULL, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */
quaternion_doc, /* tp_doc */
(traverseproc)BaseMathObject_traverse, /* tp_traverse */
(inquiry)BaseMathObject_clear, /* tp_clear */
(richcmpfunc)Quaternion_richcmpr, /* tp_richcompare */
0, /* tp_weaklistoffset */
NULL, /* tp_iter */
NULL, /* tp_iternext */
Quaternion_methods, /* tp_methods */
NULL, /* tp_members */
Quaternion_getseters, /* tp_getset */
NULL, /* tp_base */
NULL, /* tp_dict */
NULL, /* tp_descr_get */
NULL, /* tp_descr_set */
0, /* tp_dictoffset */
NULL, /* tp_init */
NULL, /* tp_alloc */
Quaternion_new, /* tp_new */
NULL, /* tp_free */
NULL, /* tp_is_gc */
NULL, /* tp_bases */
NULL, /* tp_mro */
NULL, /* tp_cache */
NULL, /* tp_subclasses */
NULL, /* tp_weaklist */
NULL, /* tp_del */
};
PyObject *Quaternion_CreatePyObject(const float quat[4], PyTypeObject *base_type)
{
QuaternionObject *self;
float *quat_alloc;
quat_alloc = PyMem_Malloc(QUAT_SIZE * sizeof(float));
if (UNLIKELY(quat_alloc == NULL)) {
PyErr_SetString(PyExc_MemoryError,
"Quaternion(): "
"problem allocating data");
return NULL;
}
self = BASE_MATH_NEW(QuaternionObject, quaternion_Type, base_type);
if (self) {
self->quat = quat_alloc;
/* init callbacks as NULL */
self->cb_user = NULL;
self->cb_type = self->cb_subtype = 0;
/* NEW */
if (!quat) { /* new empty */
unit_qt(self->quat);
}
else {
copy_qt_qt(self->quat, quat);
}
self->flag = BASE_MATH_FLAG_DEFAULT;
}
else {
PyMem_Free(quat_alloc);
}
return (PyObject *)self;
}
PyObject *Quaternion_CreatePyObject_wrap(float quat[4], PyTypeObject *base_type)
{
QuaternionObject *self;
self = BASE_MATH_NEW(QuaternionObject, quaternion_Type, base_type);
if (self) {
/* init callbacks as NULL */
self->cb_user = NULL;
self->cb_type = self->cb_subtype = 0;
/* WRAP */
self->quat = quat;
self->flag = BASE_MATH_FLAG_DEFAULT | BASE_MATH_FLAG_IS_WRAP;
}
return (PyObject *)self;
}
PyObject *Quaternion_CreatePyObject_cb(PyObject *cb_user, uchar cb_type, uchar cb_subtype)
{
QuaternionObject *self = (QuaternionObject *)Quaternion_CreatePyObject(NULL, NULL);
if (self) {
Py_INCREF(cb_user);
self->cb_user = cb_user;
self->cb_type = cb_type;
self->cb_subtype = cb_subtype;
PyObject_GC_Track(self);
}
return (PyObject *)self;
}
| {
"pile_set_name": "Github"
} |
module I18n
module Backend
autoload :Base, 'i18n/backend/base'
autoload :InterpolationCompiler, 'i18n/backend/interpolation_compiler'
autoload :Cache, 'i18n/backend/cache'
autoload :Cascade, 'i18n/backend/cascade'
autoload :Chain, 'i18n/backend/chain'
autoload :Fallbacks, 'i18n/backend/fallbacks'
autoload :Flatten, 'i18n/backend/flatten'
autoload :Gettext, 'i18n/backend/gettext'
autoload :KeyValue, 'i18n/backend/key_value'
autoload :Memoize, 'i18n/backend/memoize'
autoload :Metadata, 'i18n/backend/metadata'
autoload :Pluralization, 'i18n/backend/pluralization'
autoload :Simple, 'i18n/backend/simple'
autoload :Transliterator, 'i18n/backend/transliterator'
end
end
| {
"pile_set_name": "Github"
} |
/*
Example:
viewB = new Text
text: 'lol'
fontSize: 64
color: 'black'
parent: viewA
Below Phone, [
view: viewA
properties:
width: 40
bc: 'blue'
,
view: viewB
properties:
fontSize: 12
color: 'red'
]
Below Mobile, viewA,
width: 100
bc: 'purple'
Below Mobile, viewB,
fontSize: 40
Above Mobile, viewB,
backgroundColor: 'green'
*/
var Above, Below, Desktop, Mobile, Netbook, Phone, QHD, Screen, TV, Tablet, UHD, Watch, When, iPad, iPhone5, iPhone7;
Watch = 'Watch';
Mobile = 'Mobile';
Phone = 'Phone';
Tablet = 'Tablet';
Netbook = 'Netbook';
Desktop = 'Desktop';
TV = 'TV';
QHD = 'QHD';
UHD = 'UHD';
iPad = 'iPad';
iPhone5 = 'iPhone5';
iPhone7 = 'iPhone7';
When = function(direction, def, actions) {
var action, arr, key, keys, responsives, _i, _j, _k, _len, _len1, _len2;
direction = Utils.capitalizeFirst(direction);
responsives = {};
if (arguments[3] && Utils.isObject(arguments[3])) {
actions = {
view: arguments[2],
properties: arguments[3]
};
}
if (Utils.isObject(actions) && !Utils.isArray(actions)) {
actions = [actions];
}
for (_i = 0, _len = actions.length; _i < _len; _i++) {
action = actions[_i];
if (action.view && action.properties) {
if (!action.view._originalValues) {
action.view._originalValues = {};
keys = Object.keys(action.properties);
for (_j = 0, _len1 = keys.length; _j < _len1; _j++) {
key = keys[_j];
if (key in action.view) {
action.view._originalValues[key] = action.view[key];
}
}
} else {
arr = [];
keys = Object.keys(action.properties);
for (_k = 0, _len2 = keys.length; _k < _len2; _k++) {
key = keys[_k];
if (key in action.view) {
arr[key] = action.view[key];
}
}
action.view._originalValues = Utils.defaults(action.view._originalValues, arr);
}
if (!action.view['_' + direction + def]) {
action.view['_' + direction + def] = {};
}
action.view['_' + direction + def] = Utils.extend(action.view['_' + direction + def], action.properties);
App._responsives[action.view.id] = action.view;
responsives[action.view.id] = action.view;
}
}
return App._updateResponsives(responsives);
};
App.when = When;
Below = function(def, actions, optional) {
return When('below', def, actions, optional);
};
Above = function(def, actions, optional) {
return When('above', def, actions, optional);
};
Screen = {
definitions: {
Watch: 0,
iPhone5: 320,
Mobile: 320,
iPhone7: 375,
Phone: 480,
Tablet: 760,
iPad: 768,
Netbook: 960,
Desktop: 1200,
TV: 1600,
QHD: 1980,
UHD: 2600
},
below: [UHD, QHD, TV, Desktop, Netbook, iPad, Tablet, Phone, iPhone7, Mobile, iPhone5, Watch],
above: [Watch, iPhone5, Mobile, iPhone7, Phone, Tablet, iPad, Netbook, Desktop, TV, QHD, UHD]
};
App._updateResponsivesStates = function() {
var definition, w;
Below.states = {
Watch: false,
iPhone5: false,
Mobile: false,
iPhone7: false,
Phone: false,
Tablet: false,
iPad: false,
Netbook: false,
UHD: false,
QHD: false,
TV: false,
Desktop: false
};
Above.states = {
Watch: false,
iPhone5: false,
Mobile: false,
Phone: false,
Tablet: false,
iPad: false,
Netbook: false,
UHD: false,
QHD: false,
TV: false,
Desktop: false
};
for (definition in Screen.definitions) {
w = App.width;
if (App.device && App.device.content) {
w = App.device.content.width;
}
if (w >= Screen.definitions[definition]) {
Above.states[definition] = true;
}
if (w <= Screen.definitions[definition]) {
Below.states[definition] = true;
}
}
if (!App.page) {
return;
}
App._updateResponsives(App._responsives);
};
App._updateResponsives = function(responsives) {
var def, props, view, viewID, _i, _j, _len, _len1, _ref, _ref1;
for (viewID in responsives) {
view = responsives[viewID];
props = {};
_ref = Screen.below;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
def = _ref[_i];
if (view['_Below' + def] && Below.states[def] === true) {
props = Utils.extend(props, view['_Below' + def]);
}
}
_ref1 = Screen.above;
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
def = _ref1[_j];
if (view['_Above' + def] && Above.states[def] === true) {
props = Utils.extend(props, view['_Above' + def]);
}
}
view.props = view._originalValues;
view.props = props;
}
};
| {
"pile_set_name": "Github"
} |
//! A paths provider for k8s logs.
#![deny(missing_docs)]
use super::path_helpers::build_pod_logs_directory;
use crate::kubernetes as k8s;
use evmap::ReadHandle;
use file_source::paths_provider::PathsProvider;
use k8s_openapi::api::core::v1::Pod;
use std::path::PathBuf;
/// A paths provider implementation that uses the state obtained from the
/// the k8s API.
pub struct K8sPathsProvider {
pods_state_reader: ReadHandle<String, k8s::state::evmap::Value<Pod>>,
}
impl K8sPathsProvider {
/// Create a new [`K8sPathsProvider`].
pub fn new(pods_state_reader: ReadHandle<String, k8s::state::evmap::Value<Pod>>) -> Self {
Self { pods_state_reader }
}
}
impl PathsProvider for K8sPathsProvider {
type IntoIter = Vec<PathBuf>;
fn paths(&self) -> Vec<PathBuf> {
let read_ref = match self.pods_state_reader.read() {
Some(v) => v,
None => {
// The state is not initialized or gone, fallback to using an
// empty array.
// TODO: consider `panic`ing here instead - fail-fast approach
// is always better if possible, but it's not clear if it's
// a sane strategy here.
warn!(message = "Unable to read the state of the pods");
return Vec::new();
}
};
read_ref
.into_iter()
.flat_map(|(uid, values)| {
let pod = values
.get_one()
.expect("we are supposed to be working with single-item values only");
trace!(message = "Providing log paths for pod", ?uid);
list_pod_log_paths(real_glob, pod)
})
.collect()
}
}
fn extract_pod_logs_directory(pod: &Pod) -> Option<PathBuf> {
let metadata = &pod.metadata;
let namespace = metadata.namespace.as_ref()?;
let name = metadata.name.as_ref()?;
let uid = metadata.uid.as_ref()?;
Some(build_pod_logs_directory(&namespace, &name, &uid))
}
fn list_pod_log_paths<'a, G, GI>(mut glob_impl: G, pod: &Pod) -> impl Iterator<Item = PathBuf> + 'a
where
G: FnMut(&str) -> GI + 'a,
GI: Iterator<Item = PathBuf> + 'a,
{
extract_pod_logs_directory(pod)
.into_iter()
.flat_map(move |dir| {
glob_impl(
// We seek to match the paths like
// `<pod_logs_dir>/<container_name>/<n>.log` - paths managed by
// the `kubelet` as part of Kubernetes core logging
// architecture.
// In some setups, there will also be paths like
// `<pod_logs_dir>/<hash>.log` - those we want to skip.
&[
dir.to_str()
.expect("non-utf8 path to pod logs dir is not supported"),
"*/*.log",
]
.join("/"),
)
})
}
fn real_glob(pattern: &str) -> impl Iterator<Item = PathBuf> {
glob::glob(pattern)
.expect("the pattern is supposed to always be correct")
.flat_map(|paths| paths.into_iter())
}
#[cfg(test)]
mod tests {
use super::{extract_pod_logs_directory, list_pod_log_paths};
use k8s_openapi::{api::core::v1::Pod, apimachinery::pkg::apis::meta::v1::ObjectMeta};
use std::path::PathBuf;
#[test]
fn test_extract_pod_logs_directory() {
let cases = vec![
(Pod::default(), None),
(
Pod {
metadata: ObjectMeta {
namespace: Some("sandbox0-ns".to_owned()),
name: Some("sandbox0-name".to_owned()),
uid: Some("sandbox0-uid".to_owned()),
..ObjectMeta::default()
},
..Pod::default()
},
Some("/var/log/pods/sandbox0-ns_sandbox0-name_sandbox0-uid"),
),
(
Pod {
metadata: ObjectMeta {
namespace: Some("sandbox0-ns".to_owned()),
name: Some("sandbox0-name".to_owned()),
..ObjectMeta::default()
},
..Pod::default()
},
None,
),
(
Pod {
metadata: ObjectMeta {
namespace: Some("sandbox0-ns".to_owned()),
uid: Some("sandbox0-uid".to_owned()),
..ObjectMeta::default()
},
..Pod::default()
},
None,
),
(
Pod {
metadata: ObjectMeta {
name: Some("sandbox0-name".to_owned()),
uid: Some("sandbox0-uid".to_owned()),
..ObjectMeta::default()
},
..Pod::default()
},
None,
),
];
for (pod, expected) in cases {
assert_eq!(
extract_pod_logs_directory(&pod),
expected.map(PathBuf::from)
);
}
}
#[test]
fn test_list_pod_log_paths() {
let cases = vec![
// Pod exists and has some containers that write logs.
(
Pod {
metadata: ObjectMeta {
namespace: Some("sandbox0-ns".to_owned()),
name: Some("sandbox0-name".to_owned()),
uid: Some("sandbox0-uid".to_owned()),
..ObjectMeta::default()
},
..Pod::default()
},
// Calls to the glob mock.
vec![(
// The pattern to expect at the mock.
"/var/log/pods/sandbox0-ns_sandbox0-name_sandbox0-uid/*/*.log",
// The paths to return from the mock.
vec![
"/var/log/pods/sandbox0-ns_sandbox0-name_sandbox0-uid/container1/qwe.log",
"/var/log/pods/sandbox0-ns_sandbox0-name_sandbox0-uid/container2/qwe.log",
"/var/log/pods/sandbox0-ns_sandbox0-name_sandbox0-uid/container3/qwe.log",
],
)],
// Expected result.
vec![
"/var/log/pods/sandbox0-ns_sandbox0-name_sandbox0-uid/container1/qwe.log",
"/var/log/pods/sandbox0-ns_sandbox0-name_sandbox0-uid/container2/qwe.log",
"/var/log/pods/sandbox0-ns_sandbox0-name_sandbox0-uid/container3/qwe.log",
],
),
// Pod doesn't have the metadata set.
(Pod::default(), vec![], vec![]),
// Pod has proper metadata, but doesn't have log files.
(
Pod {
metadata: ObjectMeta {
namespace: Some("sandbox0-ns".to_owned()),
name: Some("sandbox0-name".to_owned()),
uid: Some("sandbox0-uid".to_owned()),
..ObjectMeta::default()
},
..Pod::default()
},
vec![(
"/var/log/pods/sandbox0-ns_sandbox0-name_sandbox0-uid/*/*.log",
vec![],
)],
vec![],
),
];
for (pod, expected_calls, expected_paths) in cases {
// Prepare the mock fn.
let mut expected_calls = expected_calls.into_iter();
let mock_glob = move |pattern: &str| {
let (expected_pattern, paths_to_return) = expected_calls
.next()
.expect("implementation did a call that wasn't expected");
assert_eq!(pattern, expected_pattern);
paths_to_return.into_iter().map(PathBuf::from)
};
let actual_paths: Vec<_> = list_pod_log_paths(mock_glob, &pod).collect();
let expected_paths: Vec<_> = expected_paths.into_iter().map(PathBuf::from).collect();
assert_eq!(actual_paths, expected_paths)
}
}
}
| {
"pile_set_name": "Github"
} |
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs.Serialization](./DefaultEcs-Serialization.md 'DefaultEcs.Serialization')
## TextSerializationContext Class
Represents a context used by the [TextSerializer](./DefaultEcs-Serialization-TextSerializer.md 'DefaultEcs.Serialization.TextSerializer') to convert types during serialization and deserialization operations.
```csharp
public sealed class TextSerializationContext :
IDisposable
```
Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System.Object') 🡒 TextSerializationContext
Implements [System.IDisposable](https://docs.microsoft.com/en-us/dotnet/api/System.IDisposable 'System.IDisposable')
### Constructors
- [TextSerializationContext()](./DefaultEcs-Serialization-TextSerializationContext-TextSerializationContext().md 'DefaultEcs.Serialization.TextSerializationContext.TextSerializationContext()')
### Methods
- [Dispose()](./DefaultEcs-Serialization-TextSerializationContext-Dispose().md 'DefaultEcs.Serialization.TextSerializationContext.Dispose()')
- [Marshal<TIn,TOut>(System.Func<TIn,TOut>)](./DefaultEcs-Serialization-TextSerializationContext-Marshal-TIn_TOut-(System-Func-TIn_TOut-).md 'DefaultEcs.Serialization.TextSerializationContext.Marshal<TIn,TOut>(System.Func<TIn,TOut>)')
- [Unmarshal<TIn,TOut>(System.Func<TIn,TOut>)](./DefaultEcs-Serialization-TextSerializationContext-Unmarshal-TIn_TOut-(System-Func-TIn_TOut-).md 'DefaultEcs.Serialization.TextSerializationContext.Unmarshal<TIn,TOut>(System.Func<TIn,TOut>)')
| {
"pile_set_name": "Github"
} |
package com.open.androidtvwidget.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.provider.Settings;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
/**
* 设置默认APP(类似小米的). <br>
* 比如有很多浏览器,你可以设置默认的. <br>
* 如何使用,查看DEMO,http://git.oschina.net/hailongqiu/demo-test <br>
* @author hailong.qiu [email protected]
*
*/
public class CustomApplicationHelper {
private Context mContext;
private PackageManager pm;
public CustomApplicationHelper(Context context) {
this.mContext = context;
if (mContext != null) {
this.pm = context.getPackageManager();
}
}
public List<ResolveInfo> getSpeAppResolveInfos(Intent intent) {
List<ResolveInfo> resolveInfos = null;
if (intent != null && pm != null) {
resolveInfos = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
}
return resolveInfos;
}
public List<InputMethodInfo> getAllInputMethod() {
InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> methodList = imm.getInputMethodList();
return methodList;
}
public void setDefaultInputMethod(InputMethodInfo info) {
// 设置默认输入法.
String packName = info.getPackageName();
String serviceName = info.getServiceName();
int lastIndex = serviceName.lastIndexOf(".");
if (lastIndex != -1) {
String setInfo = packName + "/" + serviceName.substring(lastIndex);
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD,
"" + setInfo);
}
}
public boolean isDefualtInputMethod(InputMethodInfo info) {
// 获取当前默认输入法.
String currentInputmethod = Settings.Secure.getString(mContext.getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD);
if (currentInputmethod.contains("" + info.getPackageName())) {
return true;
}
return false;
}
/**
* 处理Intent.
*/
public Intent intentForResolveInfo(ResolveInfo dri, Intent initIntent) {
Intent intent = new Intent(initIntent);
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
ActivityInfo ai = dri.activityInfo;
intent.setComponent(new ComponentName(ai.applicationInfo.packageName, ai.name));
return intent;
}
/**
* 设置默认APP.
*/
public void setDefaultApplication(Intent initIntent, ResolveInfo dri, List<ResolveInfo> resolveInfos) {
// 获取 Intent.
Intent intent = intentForResolveInfo(dri, initIntent);
//
IntentFilter filter = new IntentFilter();
// 初始化 action.
if (intent.getAction() != null) {
filter.addAction(intent.getAction());
}
// 初始化 CATEGORY.
Set<String> categories = intent.getCategories();
if (categories != null) {
for (String cat : categories) {
filter.addCategory(cat);
}
}
filter.addCategory(Intent.CATEGORY_DEFAULT);
//
Uri data = intent.getData();
int cat = dri.match & IntentFilter.MATCH_CATEGORY_MASK;
if (cat == IntentFilter.MATCH_CATEGORY_TYPE) {
String mimeType = intent.resolveType(mContext);
if (mimeType != null) {
try {
filter.addDataType(mimeType);
} catch (IntentFilter.MalformedMimeTypeException e) {
filter = null;
}
}
} else if (data != null && data.getScheme() != null) { // 一般是设置了数据,比如浏览器.
filter.addDataScheme(data.getScheme());
}
// 设置默认应用.
if (filter != null && pm != null) {
final int N = resolveInfos.size();
ComponentName[] set = new ComponentName[N];
int bestMatch = 0;
for (int i = 0; i < N; i++) {
ResolveInfo r = resolveInfos.get(i);
set[i] = new ComponentName(r.activityInfo.packageName, r.activityInfo.name);
if (r.match > bestMatch)
bestMatch = r.match;
}
pm.addPreferredActivity(filter, bestMatch, set, intent.getComponent());
}
}
/**
* 清除默认选择. 清除之前的选项.
*/
public void clearDefaultApp(List<ResolveInfo> resolveInfos) {
if (resolveInfos != null) {
for (int i = 0; i < resolveInfos.size(); i++) {
ResolveInfo resolveInfo = resolveInfos.get(i);
ActivityInfo activityInfo = resolveInfo.activityInfo;
String packageName = activityInfo.packageName;
String className = activityInfo.name;
pm.clearPackagePreferredActivities(packageName);
}
}
}
/**
* 获取所有默认的APP. 注意,如果只有一个,以前没有设置过.
*/
public List<ComponentName> getAllDefaultApp() {
List<ComponentName> activities = new ArrayList<ComponentName>();
List<IntentFilter> filters = new ArrayList<IntentFilter>();
final IntentFilter filter = new IntentFilter(Intent.ACTION_VIEW);
filters.add(filter);
pm.getPreferredActivities(filters, activities, null);
return activities;
}
/**
* 判断是否为默认启动项.
*/
public boolean isDefaultApp(String packName) {
List<ComponentName> activities = getAllDefaultApp();
for (ComponentName cn : activities) {
String pn = cn.getPackageName();
if (pn.equals(packName)) {
return true;
}
}
return false;
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>LCD Library: LiquidCrystal_I2C.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="logoGoogle.jpg"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">LCD Library <span id="projectnumber">1.3.0</span></div>
<div id="projectbrief">LCD Library - LCD control class hierarchy library. Drop in replacement for the LiquidCrystal Library.</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li id="searchli">
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('_liquid_crystal___i2_c_8cpp.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#define-members">Defines</a> </div>
<div class="headertitle">
<div class="title">LiquidCrystal_I2C.cpp File Reference</div> </div>
</div>
<div class="contents">
<div class="textblock"><code>#include <WProgram.h></code><br/>
<code>#include <inttypes.h></code><br/>
<code>#include "<a class="el" href="_i2_c_i_o_8h_source.html">I2CIO.h</a>"</code><br/>
<code>#include "<a class="el" href="_liquid_crystal___i2_c_8h_source.html">LiquidCrystal_I2C.h</a>"</code><br/>
</div>
<p><a href="_liquid_crystal___i2_c_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Defines</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_liquid_crystal___i2_c_8cpp.html#a3d9bb178282c3cb69740c94ba1e48fed">D4</a>   0</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_liquid_crystal___i2_c_8cpp.html#a2ddd4183d444d6d128cbdbd6269e4e0c">D5</a>   1</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_liquid_crystal___i2_c_8cpp.html#a79a18a7f5ccf7a7ca31f302bd62527a6">D6</a>   2</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_liquid_crystal___i2_c_8cpp.html#a2ba78f059a7ebebc95e7beef690e88d6">D7</a>   3</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_liquid_crystal___i2_c_8cpp.html#a22e6626f2c98ed902f8ded47f6438c05">EN</a>   6</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_liquid_crystal___i2_c_8cpp.html#ac059d24dfe9c1e1f7c07cb7869a1833b">LCD_BACKLIGHT</a>   0xFF</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_liquid_crystal___i2_c_8cpp.html#a65fa786d6e31fe8b1aa51784a9736581">LCD_NOBACKLIGHT</a>   0x00</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_liquid_crystal___i2_c_8cpp.html#af8903d8eea3868940c60af887473b152">RS</a>   4</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="_liquid_crystal___i2_c_8cpp.html#afc4ded33ac0ca43defcce639e965748a">RW</a>   5</td></tr>
</table>
<hr/><h2>Define Documentation</h2>
<a class="anchor" id="a3d9bb178282c3cb69740c94ba1e48fed"></a><!-- doxytag: member="LiquidCrystal_I2C.cpp::D4" ref="a3d9bb178282c3cb69740c94ba1e48fed" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define D4   0</td>
</tr>
</table>
</div>
<div class="memdoc">
<p><a class="el" href="class_l_c_d.html">LCD</a> dataline allocation this library only supports 4 bit <a class="el" href="class_l_c_d.html">LCD</a> control mode. D4, D5, D6, D7 <a class="el" href="class_l_c_d.html">LCD</a> data lines pin mapping of the extender module </p>
<p>Definition at line <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html#l00088">88</a> of file <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html">LiquidCrystal_I2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a2ddd4183d444d6d128cbdbd6269e4e0c"></a><!-- doxytag: member="LiquidCrystal_I2C.cpp::D5" ref="a2ddd4183d444d6d128cbdbd6269e4e0c" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define D5   1</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html#l00089">89</a> of file <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html">LiquidCrystal_I2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a79a18a7f5ccf7a7ca31f302bd62527a6"></a><!-- doxytag: member="LiquidCrystal_I2C.cpp::D6" ref="a79a18a7f5ccf7a7ca31f302bd62527a6" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define D6   2</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html#l00090">90</a> of file <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html">LiquidCrystal_I2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a2ba78f059a7ebebc95e7beef690e88d6"></a><!-- doxytag: member="LiquidCrystal_I2C.cpp::D7" ref="a2ba78f059a7ebebc95e7beef690e88d6" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define D7   3</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Definition at line <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html#l00091">91</a> of file <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html">LiquidCrystal_I2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a22e6626f2c98ed902f8ded47f6438c05"></a><!-- doxytag: member="LiquidCrystal_I2C.cpp::EN" ref="a22e6626f2c98ed902f8ded47f6438c05" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define EN   6</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Enable bit of the <a class="el" href="class_l_c_d.html">LCD</a> Defines the IO of the expander connected to the <a class="el" href="class_l_c_d.html">LCD</a> Enable </p>
<p>Definition at line <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html#l00066">66</a> of file <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html">LiquidCrystal_I2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="ac059d24dfe9c1e1f7c07cb7869a1833b"></a><!-- doxytag: member="LiquidCrystal_I2C.cpp::LCD_BACKLIGHT" ref="ac059d24dfe9c1e1f7c07cb7869a1833b" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define LCD_BACKLIGHT   0xFF</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>LCD_BACKLIGHT BACKLIGHT MASK used when backlight is on </p>
<p>Definition at line <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html#l00055">55</a> of file <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html">LiquidCrystal_I2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="a65fa786d6e31fe8b1aa51784a9736581"></a><!-- doxytag: member="LiquidCrystal_I2C.cpp::LCD_NOBACKLIGHT" ref="a65fa786d6e31fe8b1aa51784a9736581" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define LCD_NOBACKLIGHT   0x00</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>LCD_NOBACKLIGHT NO BACKLIGHT MASK </p>
<p>Definition at line <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html#l00048">48</a> of file <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html">LiquidCrystal_I2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="af8903d8eea3868940c60af887473b152"></a><!-- doxytag: member="LiquidCrystal_I2C.cpp::RS" ref="af8903d8eea3868940c60af887473b152" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define RS   4</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Register bit of the <a class="el" href="class_l_c_d.html">LCD</a> Defines the IO of the expander connected to the <a class="el" href="class_l_c_d.html">LCD</a> Register select pin </p>
<p>Definition at line <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html#l00080">80</a> of file <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html">LiquidCrystal_I2C.cpp</a>.</p>
</div>
</div>
<a class="anchor" id="afc4ded33ac0ca43defcce639e965748a"></a><!-- doxytag: member="LiquidCrystal_I2C.cpp::RW" ref="afc4ded33ac0ca43defcce639e965748a" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define RW   5</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Read/Write bit of the <a class="el" href="class_l_c_d.html">LCD</a> Defines the IO of the expander connected to the <a class="el" href="class_l_c_d.html">LCD</a> Rw pin </p>
<p>Definition at line <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html#l00073">73</a> of file <a class="el" href="_liquid_crystal___i2_c_8cpp_source.html">LiquidCrystal_I2C.cpp</a>.</p>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="_liquid_crystal___i2_c_8cpp.html">LiquidCrystal_I2C.cpp</a> </li>
<li class="footer">Generated on Sat Aug 3 2013 22:34:05 for LCD Library by 
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Defines</a></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>
</body>
</html>
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Exception;
use lib 't/lib';
my $pkg;
BEGIN {
$pkg = 'Catmandu::Serializer';
use_ok $pkg;
}
require_ok $pkg;
{
package T::Serializer;
use Moo;
with $pkg;
}
my $t = T::Serializer->new;
can_ok $t, qw(serialize deserialize serializer serialization_format);
isa_ok $t->serializer, 'Catmandu::Serializer::json';
my $data = {foo => 'bar'};
is_deeply $data, $t->deserialize($t->serialize($data));
$t = T::Serializer->new(serialization_format => 'dumper');
isa_ok $t->serializer, 'Catmandu::Serializer::dumper';
done_testing 6;
| {
"pile_set_name": "Github"
} |
# 11.1.4 Receive one message and deliver to multiple parties
## When to use
Publish and subscribe pattern is very common in asynchronous messaging. It basically enables user to publish one message to \
middleware layer and same copy of the message will be distributed to multiple subscribers.
There are two basic patterns to be considered here.
- Subscribers are non durable : subscribers will receive messages during the time they are active on messaging provider (a message broker)
- Subscribers are durable : subscribers will register to messaging provider first and then receive messages. Even if subscriber
goes offline, broker will keep that subscribers copy. In this way subscribers can receive messages independently
with different delivery grantees.
## Sample use case
Invoke multiple endpoint in asynchronous way with the same message. System should be able to register a new subscriber
without any changes to message publish side.
## Prerequisites
- A Message Broker
- A SOAP backend
- A HTTP Client
## Development guidelines
- Use EI tooling to develop EI artifacts
- Use broker's console to define topics
## Deployment guidelines
Deploy broker in a container
## Supported versions
This is supported in all the EI and ESB versions
## Test cases
| ID | Summary |
| ----------|:------------------------------------------------------:|
| 11.1.1.1 | |
| 11.1.1 | |
| 11.1.1 | |
| {
"pile_set_name": "Github"
} |
Migrated to Bazel
bazel test //javatests/jflex/testcase/buffer:all
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2000-2005 Silicon Graphics, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would 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 the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __XFS_SB_H__
#define __XFS_SB_H__
/*
* Super block
* Fits into a sector-sized buffer at address 0 of each allocation group.
* Only the first of these is ever updated except during growfs.
*/
struct xfs_buf;
struct xfs_mount;
#define XFS_SB_MAGIC 0x58465342 /* 'XFSB' */
#define XFS_SB_VERSION_1 1 /* 5.3, 6.0.1, 6.1 */
#define XFS_SB_VERSION_2 2 /* 6.2 - attributes */
#define XFS_SB_VERSION_3 3 /* 6.2 - new inode version */
#define XFS_SB_VERSION_4 4 /* 6.2+ - bitmask version */
#define XFS_SB_VERSION_NUMBITS 0x000f
#define XFS_SB_VERSION_ALLFBITS 0xfff0
#define XFS_SB_VERSION_SASHFBITS 0xf000
#define XFS_SB_VERSION_REALFBITS 0x0ff0
#define XFS_SB_VERSION_ATTRBIT 0x0010
#define XFS_SB_VERSION_NLINKBIT 0x0020
#define XFS_SB_VERSION_QUOTABIT 0x0040
#define XFS_SB_VERSION_ALIGNBIT 0x0080
#define XFS_SB_VERSION_DALIGNBIT 0x0100
#define XFS_SB_VERSION_SHAREDBIT 0x0200
#define XFS_SB_VERSION_LOGV2BIT 0x0400
#define XFS_SB_VERSION_SECTORBIT 0x0800
#define XFS_SB_VERSION_EXTFLGBIT 0x1000
#define XFS_SB_VERSION_DIRV2BIT 0x2000
#define XFS_SB_VERSION_BORGBIT 0x4000 /* ASCII only case-insens. */
#define XFS_SB_VERSION_MOREBITSBIT 0x8000
#define XFS_SB_VERSION_OKSASHFBITS \
(XFS_SB_VERSION_EXTFLGBIT | \
XFS_SB_VERSION_DIRV2BIT | \
XFS_SB_VERSION_BORGBIT)
#define XFS_SB_VERSION_OKREALFBITS \
(XFS_SB_VERSION_ATTRBIT | \
XFS_SB_VERSION_NLINKBIT | \
XFS_SB_VERSION_QUOTABIT | \
XFS_SB_VERSION_ALIGNBIT | \
XFS_SB_VERSION_DALIGNBIT | \
XFS_SB_VERSION_SHAREDBIT | \
XFS_SB_VERSION_LOGV2BIT | \
XFS_SB_VERSION_SECTORBIT | \
XFS_SB_VERSION_MOREBITSBIT)
#define XFS_SB_VERSION_OKREALBITS \
(XFS_SB_VERSION_NUMBITS | \
XFS_SB_VERSION_OKREALFBITS | \
XFS_SB_VERSION_OKSASHFBITS)
/*
* There are two words to hold XFS "feature" bits: the original
* word, sb_versionnum, and sb_features2. Whenever a bit is set in
* sb_features2, the feature bit XFS_SB_VERSION_MOREBITSBIT must be set.
*
* These defines represent bits in sb_features2.
*/
#define XFS_SB_VERSION2_REALFBITS 0x00ffffff /* Mask: features */
#define XFS_SB_VERSION2_RESERVED1BIT 0x00000001
#define XFS_SB_VERSION2_LAZYSBCOUNTBIT 0x00000002 /* Superblk counters */
#define XFS_SB_VERSION2_RESERVED4BIT 0x00000004
#define XFS_SB_VERSION2_ATTR2BIT 0x00000008 /* Inline attr rework */
#define XFS_SB_VERSION2_OKREALFBITS \
(XFS_SB_VERSION2_LAZYSBCOUNTBIT | \
XFS_SB_VERSION2_ATTR2BIT)
#define XFS_SB_VERSION2_OKSASHFBITS \
(0)
#define XFS_SB_VERSION2_OKREALBITS \
(XFS_SB_VERSION2_OKREALFBITS | \
XFS_SB_VERSION2_OKSASHFBITS )
/*
* Superblock - in core version. Must match the ondisk version below.
* Must be padded to 64 bit alignment.
*/
typedef struct xfs_sb {
__uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */
__uint32_t sb_blocksize; /* logical block size, bytes */
xfs_drfsbno_t sb_dblocks; /* number of data blocks */
xfs_drfsbno_t sb_rblocks; /* number of realtime blocks */
xfs_drtbno_t sb_rextents; /* number of realtime extents */
uuid_t sb_uuid; /* file system unique id */
xfs_dfsbno_t sb_logstart; /* starting block of log if internal */
xfs_ino_t sb_rootino; /* root inode number */
xfs_ino_t sb_rbmino; /* bitmap inode for realtime extents */
xfs_ino_t sb_rsumino; /* summary inode for rt bitmap */
xfs_agblock_t sb_rextsize; /* realtime extent size, blocks */
xfs_agblock_t sb_agblocks; /* size of an allocation group */
xfs_agnumber_t sb_agcount; /* number of allocation groups */
xfs_extlen_t sb_rbmblocks; /* number of rt bitmap blocks */
xfs_extlen_t sb_logblocks; /* number of log blocks */
__uint16_t sb_versionnum; /* header version == XFS_SB_VERSION */
__uint16_t sb_sectsize; /* volume sector size, bytes */
__uint16_t sb_inodesize; /* inode size, bytes */
__uint16_t sb_inopblock; /* inodes per block */
char sb_fname[12]; /* file system name */
__uint8_t sb_blocklog; /* log2 of sb_blocksize */
__uint8_t sb_sectlog; /* log2 of sb_sectsize */
__uint8_t sb_inodelog; /* log2 of sb_inodesize */
__uint8_t sb_inopblog; /* log2 of sb_inopblock */
__uint8_t sb_agblklog; /* log2 of sb_agblocks (rounded up) */
__uint8_t sb_rextslog; /* log2 of sb_rextents */
__uint8_t sb_inprogress; /* mkfs is in progress, don't mount */
__uint8_t sb_imax_pct; /* max % of fs for inode space */
/* statistics */
/*
* These fields must remain contiguous. If you really
* want to change their layout, make sure you fix the
* code in xfs_trans_apply_sb_deltas().
*/
__uint64_t sb_icount; /* allocated inodes */
__uint64_t sb_ifree; /* free inodes */
__uint64_t sb_fdblocks; /* free data blocks */
__uint64_t sb_frextents; /* free realtime extents */
/*
* End contiguous fields.
*/
xfs_ino_t sb_uquotino; /* user quota inode */
xfs_ino_t sb_gquotino; /* group quota inode */
__uint16_t sb_qflags; /* quota flags */
__uint8_t sb_flags; /* misc. flags */
__uint8_t sb_shared_vn; /* shared version number */
xfs_extlen_t sb_inoalignmt; /* inode chunk alignment, fsblocks */
__uint32_t sb_unit; /* stripe or raid unit */
__uint32_t sb_width; /* stripe or raid width */
__uint8_t sb_dirblklog; /* log2 of dir block size (fsbs) */
__uint8_t sb_logsectlog; /* log2 of the log sector size */
__uint16_t sb_logsectsize; /* sector size for the log, bytes */
__uint32_t sb_logsunit; /* stripe unit size for the log */
__uint32_t sb_features2; /* additional feature bits */
/*
* bad features2 field as a result of failing to pad the sb
* structure to 64 bits. Some machines will be using this field
* for features2 bits. Easiest just to mark it bad and not use
* it for anything else.
*/
__uint32_t sb_bad_features2;
/* must be padded to 64 bit alignment */
} xfs_sb_t;
/*
* Superblock - on disk version. Must match the in core version above.
* Must be padded to 64 bit alignment.
*/
typedef struct xfs_dsb {
__be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */
__be32 sb_blocksize; /* logical block size, bytes */
__be64 sb_dblocks; /* number of data blocks */
__be64 sb_rblocks; /* number of realtime blocks */
__be64 sb_rextents; /* number of realtime extents */
uuid_t sb_uuid; /* file system unique id */
__be64 sb_logstart; /* starting block of log if internal */
__be64 sb_rootino; /* root inode number */
__be64 sb_rbmino; /* bitmap inode for realtime extents */
__be64 sb_rsumino; /* summary inode for rt bitmap */
__be32 sb_rextsize; /* realtime extent size, blocks */
__be32 sb_agblocks; /* size of an allocation group */
__be32 sb_agcount; /* number of allocation groups */
__be32 sb_rbmblocks; /* number of rt bitmap blocks */
__be32 sb_logblocks; /* number of log blocks */
__be16 sb_versionnum; /* header version == XFS_SB_VERSION */
__be16 sb_sectsize; /* volume sector size, bytes */
__be16 sb_inodesize; /* inode size, bytes */
__be16 sb_inopblock; /* inodes per block */
char sb_fname[12]; /* file system name */
__u8 sb_blocklog; /* log2 of sb_blocksize */
__u8 sb_sectlog; /* log2 of sb_sectsize */
__u8 sb_inodelog; /* log2 of sb_inodesize */
__u8 sb_inopblog; /* log2 of sb_inopblock */
__u8 sb_agblklog; /* log2 of sb_agblocks (rounded up) */
__u8 sb_rextslog; /* log2 of sb_rextents */
__u8 sb_inprogress; /* mkfs is in progress, don't mount */
__u8 sb_imax_pct; /* max % of fs for inode space */
/* statistics */
/*
* These fields must remain contiguous. If you really
* want to change their layout, make sure you fix the
* code in xfs_trans_apply_sb_deltas().
*/
__be64 sb_icount; /* allocated inodes */
__be64 sb_ifree; /* free inodes */
__be64 sb_fdblocks; /* free data blocks */
__be64 sb_frextents; /* free realtime extents */
/*
* End contiguous fields.
*/
__be64 sb_uquotino; /* user quota inode */
__be64 sb_gquotino; /* group quota inode */
__be16 sb_qflags; /* quota flags */
__u8 sb_flags; /* misc. flags */
__u8 sb_shared_vn; /* shared version number */
__be32 sb_inoalignmt; /* inode chunk alignment, fsblocks */
__be32 sb_unit; /* stripe or raid unit */
__be32 sb_width; /* stripe or raid width */
__u8 sb_dirblklog; /* log2 of dir block size (fsbs) */
__u8 sb_logsectlog; /* log2 of the log sector size */
__be16 sb_logsectsize; /* sector size for the log, bytes */
__be32 sb_logsunit; /* stripe unit size for the log */
__be32 sb_features2; /* additional feature bits */
/*
* bad features2 field as a result of failing to pad the sb
* structure to 64 bits. Some machines will be using this field
* for features2 bits. Easiest just to mark it bad and not use
* it for anything else.
*/
__be32 sb_bad_features2;
/* must be padded to 64 bit alignment */
} xfs_dsb_t;
/*
* Sequence number values for the fields.
*/
typedef enum {
XFS_SBS_MAGICNUM, XFS_SBS_BLOCKSIZE, XFS_SBS_DBLOCKS, XFS_SBS_RBLOCKS,
XFS_SBS_REXTENTS, XFS_SBS_UUID, XFS_SBS_LOGSTART, XFS_SBS_ROOTINO,
XFS_SBS_RBMINO, XFS_SBS_RSUMINO, XFS_SBS_REXTSIZE, XFS_SBS_AGBLOCKS,
XFS_SBS_AGCOUNT, XFS_SBS_RBMBLOCKS, XFS_SBS_LOGBLOCKS,
XFS_SBS_VERSIONNUM, XFS_SBS_SECTSIZE, XFS_SBS_INODESIZE,
XFS_SBS_INOPBLOCK, XFS_SBS_FNAME, XFS_SBS_BLOCKLOG,
XFS_SBS_SECTLOG, XFS_SBS_INODELOG, XFS_SBS_INOPBLOG, XFS_SBS_AGBLKLOG,
XFS_SBS_REXTSLOG, XFS_SBS_INPROGRESS, XFS_SBS_IMAX_PCT, XFS_SBS_ICOUNT,
XFS_SBS_IFREE, XFS_SBS_FDBLOCKS, XFS_SBS_FREXTENTS, XFS_SBS_UQUOTINO,
XFS_SBS_GQUOTINO, XFS_SBS_QFLAGS, XFS_SBS_FLAGS, XFS_SBS_SHARED_VN,
XFS_SBS_INOALIGNMT, XFS_SBS_UNIT, XFS_SBS_WIDTH, XFS_SBS_DIRBLKLOG,
XFS_SBS_LOGSECTLOG, XFS_SBS_LOGSECTSIZE, XFS_SBS_LOGSUNIT,
XFS_SBS_FEATURES2, XFS_SBS_BAD_FEATURES2,
XFS_SBS_FIELDCOUNT
} xfs_sb_field_t;
/*
* Mask values, defined based on the xfs_sb_field_t values.
* Only define the ones we're using.
*/
#define XFS_SB_MVAL(x) (1LL << XFS_SBS_ ## x)
#define XFS_SB_UUID XFS_SB_MVAL(UUID)
#define XFS_SB_FNAME XFS_SB_MVAL(FNAME)
#define XFS_SB_ROOTINO XFS_SB_MVAL(ROOTINO)
#define XFS_SB_RBMINO XFS_SB_MVAL(RBMINO)
#define XFS_SB_RSUMINO XFS_SB_MVAL(RSUMINO)
#define XFS_SB_VERSIONNUM XFS_SB_MVAL(VERSIONNUM)
#define XFS_SB_UQUOTINO XFS_SB_MVAL(UQUOTINO)
#define XFS_SB_GQUOTINO XFS_SB_MVAL(GQUOTINO)
#define XFS_SB_QFLAGS XFS_SB_MVAL(QFLAGS)
#define XFS_SB_SHARED_VN XFS_SB_MVAL(SHARED_VN)
#define XFS_SB_UNIT XFS_SB_MVAL(UNIT)
#define XFS_SB_WIDTH XFS_SB_MVAL(WIDTH)
#define XFS_SB_ICOUNT XFS_SB_MVAL(ICOUNT)
#define XFS_SB_IFREE XFS_SB_MVAL(IFREE)
#define XFS_SB_FDBLOCKS XFS_SB_MVAL(FDBLOCKS)
#define XFS_SB_FEATURES2 XFS_SB_MVAL(FEATURES2)
#define XFS_SB_BAD_FEATURES2 XFS_SB_MVAL(BAD_FEATURES2)
#define XFS_SB_NUM_BITS ((int)XFS_SBS_FIELDCOUNT)
#define XFS_SB_ALL_BITS ((1LL << XFS_SB_NUM_BITS) - 1)
#define XFS_SB_MOD_BITS \
(XFS_SB_UUID | XFS_SB_ROOTINO | XFS_SB_RBMINO | XFS_SB_RSUMINO | \
XFS_SB_VERSIONNUM | XFS_SB_UQUOTINO | XFS_SB_GQUOTINO | \
XFS_SB_QFLAGS | XFS_SB_SHARED_VN | XFS_SB_UNIT | XFS_SB_WIDTH | \
XFS_SB_ICOUNT | XFS_SB_IFREE | XFS_SB_FDBLOCKS | XFS_SB_FEATURES2 | \
XFS_SB_BAD_FEATURES2)
/*
* Misc. Flags - warning - these will be cleared by xfs_repair unless
* a feature bit is set when the flag is used.
*/
#define XFS_SBF_NOFLAGS 0x00 /* no flags set */
#define XFS_SBF_READONLY 0x01 /* only read-only mounts allowed */
/*
* define max. shared version we can interoperate with
*/
#define XFS_SB_MAX_SHARED_VN 0
#define XFS_SB_VERSION_NUM(sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS)
#ifdef __KERNEL__
static inline int xfs_sb_good_version(xfs_sb_t *sbp)
{
return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \
(sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
!((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
(sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) && \
(sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN)));
}
#else
static inline int xfs_sb_good_version(xfs_sb_t *sbp)
{
return (((sbp->sb_versionnum >= XFS_SB_VERSION_1) && \
(sbp->sb_versionnum <= XFS_SB_VERSION_3)) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
!((sbp->sb_versionnum & ~XFS_SB_VERSION_OKREALBITS) || \
((sbp->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT) && \
(sbp->sb_features2 & ~XFS_SB_VERSION2_OKREALBITS))) && \
(!(sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) || \
(sbp->sb_shared_vn <= XFS_SB_MAX_SHARED_VN))));
}
#endif /* __KERNEL__ */
/*
* Detect a mismatched features2 field. Older kernels read/wrote
* this into the wrong slot, so to be safe we keep them in sync.
*/
static inline int xfs_sb_has_mismatched_features2(xfs_sb_t *sbp)
{
return (sbp->sb_bad_features2 != sbp->sb_features2);
}
static inline unsigned xfs_sb_version_tonew(unsigned v)
{
return ((((v) == XFS_SB_VERSION_1) ? \
0 : \
(((v) == XFS_SB_VERSION_2) ? \
XFS_SB_VERSION_ATTRBIT : \
(XFS_SB_VERSION_ATTRBIT | XFS_SB_VERSION_NLINKBIT))) | \
XFS_SB_VERSION_4);
}
static inline unsigned xfs_sb_version_toold(unsigned v)
{
return (((v) & (XFS_SB_VERSION_QUOTABIT | XFS_SB_VERSION_ALIGNBIT)) ? \
0 : \
(((v) & XFS_SB_VERSION_NLINKBIT) ? \
XFS_SB_VERSION_3 : \
(((v) & XFS_SB_VERSION_ATTRBIT) ? \
XFS_SB_VERSION_2 : \
XFS_SB_VERSION_1)));
}
static inline int xfs_sb_version_hasattr(xfs_sb_t *sbp)
{
return ((sbp)->sb_versionnum == XFS_SB_VERSION_2) || \
((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_ATTRBIT));
}
static inline void xfs_sb_version_addattr(xfs_sb_t *sbp)
{
(sbp)->sb_versionnum = (((sbp)->sb_versionnum == XFS_SB_VERSION_1) ? \
XFS_SB_VERSION_2 : \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) ? \
((sbp)->sb_versionnum | XFS_SB_VERSION_ATTRBIT) : \
(XFS_SB_VERSION_4 | XFS_SB_VERSION_ATTRBIT)));
}
static inline int xfs_sb_version_hasnlink(xfs_sb_t *sbp)
{
return ((sbp)->sb_versionnum == XFS_SB_VERSION_3) || \
((XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_NLINKBIT));
}
static inline void xfs_sb_version_addnlink(xfs_sb_t *sbp)
{
(sbp)->sb_versionnum = ((sbp)->sb_versionnum <= XFS_SB_VERSION_2 ? \
XFS_SB_VERSION_3 : \
((sbp)->sb_versionnum | XFS_SB_VERSION_NLINKBIT));
}
static inline int xfs_sb_version_hasquota(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_QUOTABIT);
}
static inline void xfs_sb_version_addquota(xfs_sb_t *sbp)
{
(sbp)->sb_versionnum = \
(XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4 ? \
((sbp)->sb_versionnum | XFS_SB_VERSION_QUOTABIT) : \
(xfs_sb_version_tonew((sbp)->sb_versionnum) | \
XFS_SB_VERSION_QUOTABIT));
}
static inline int xfs_sb_version_hasalign(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_ALIGNBIT);
}
static inline int xfs_sb_version_hasdalign(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_DALIGNBIT);
}
static inline int xfs_sb_version_hasshared(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_SHAREDBIT);
}
static inline int xfs_sb_version_hasdirv2(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_DIRV2BIT);
}
static inline int xfs_sb_version_haslogv2(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_LOGV2BIT);
}
static inline int xfs_sb_version_hasextflgbit(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_EXTFLGBIT);
}
static inline int xfs_sb_version_hassector(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_SECTORBIT);
}
static inline int xfs_sb_version_hasasciici(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
(sbp->sb_versionnum & XFS_SB_VERSION_BORGBIT);
}
static inline int xfs_sb_version_hasmorebits(xfs_sb_t *sbp)
{
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) && \
((sbp)->sb_versionnum & XFS_SB_VERSION_MOREBITSBIT);
}
/*
* sb_features2 bit version macros.
*
* For example, for a bit defined as XFS_SB_VERSION2_FUNBIT, has a macro:
*
* SB_VERSION_HASFUNBIT(xfs_sb_t *sbp)
* ((xfs_sb_version_hasmorebits(sbp) &&
* ((sbp)->sb_features2 & XFS_SB_VERSION2_FUNBIT)
*/
static inline int xfs_sb_version_haslazysbcount(xfs_sb_t *sbp)
{
return (xfs_sb_version_hasmorebits(sbp) && \
((sbp)->sb_features2 & XFS_SB_VERSION2_LAZYSBCOUNTBIT));
}
static inline int xfs_sb_version_hasattr2(xfs_sb_t *sbp)
{
return (xfs_sb_version_hasmorebits(sbp)) && \
((sbp)->sb_features2 & XFS_SB_VERSION2_ATTR2BIT);
}
static inline void xfs_sb_version_addattr2(xfs_sb_t *sbp)
{
((sbp)->sb_versionnum = \
((sbp)->sb_versionnum | XFS_SB_VERSION_MOREBITSBIT), \
((sbp)->sb_features2 = \
((sbp)->sb_features2 | XFS_SB_VERSION2_ATTR2BIT)));
}
static inline void xfs_sb_version_removeattr2(xfs_sb_t *sbp)
{
sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT;
if (!sbp->sb_features2)
sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT;
}
/*
* end of superblock version macros
*/
#define XFS_SB_DADDR ((xfs_daddr_t)0) /* daddr in filesystem/ag */
#define XFS_SB_BLOCK(mp) XFS_HDR_BLOCK(mp, XFS_SB_DADDR)
#define XFS_BUF_TO_SBP(bp) ((xfs_dsb_t *)XFS_BUF_PTR(bp))
#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d))
#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \
XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
/*
* File system sector to basic block conversions.
*/
#define XFS_FSS_TO_BB(mp,sec) ((sec) << (mp)->m_sectbb_log)
/*
* File system block to basic block conversions.
*/
#define XFS_FSB_TO_BB(mp,fsbno) ((fsbno) << (mp)->m_blkbb_log)
#define XFS_BB_TO_FSB(mp,bb) \
(((bb) + (XFS_FSB_TO_BB(mp,1) - 1)) >> (mp)->m_blkbb_log)
#define XFS_BB_TO_FSBT(mp,bb) ((bb) >> (mp)->m_blkbb_log)
#define XFS_BB_FSB_OFFSET(mp,bb) ((bb) & ((mp)->m_bsize - 1))
/*
* File system block to byte conversions.
*/
#define XFS_FSB_TO_B(mp,fsbno) ((xfs_fsize_t)(fsbno) << (mp)->m_sb.sb_blocklog)
#define XFS_B_TO_FSB(mp,b) \
((((__uint64_t)(b)) + (mp)->m_blockmask) >> (mp)->m_sb.sb_blocklog)
#define XFS_B_TO_FSBT(mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)
#define XFS_B_FSB_OFFSET(mp,b) ((b) & (mp)->m_blockmask)
#endif /* __XFS_SB_H__ */
| {
"pile_set_name": "Github"
} |
.menu {
position: absolute;
margin: 0;
padding: 2px;
border-width: 1px;
border-style: solid;
overflow: hidden;
}
.menu-inline {
position: relative;
}
.menu-item {
position: relative;
margin: 0;
padding: 0;
overflow: hidden;
white-space: nowrap;
cursor: pointer;
border-width: 1px;
border-style: solid;
}
.menu-text {
height: 20px;
line-height: 20px;
float: left;
padding-left: 28px;
}
.menu-icon {
position: absolute;
width: 16px;
height: 16px;
left: 2px;
top: 50%;
margin-top: -8px;
}
.menu-rightarrow {
position: absolute;
width: 16px;
height: 16px;
right: 0;
top: 50%;
margin-top: -8px;
}
.menu-line {
position: absolute;
left: 26px;
top: 0;
height: 2000px;
font-size: 1px;
}
.menu-sep {
margin: 3px 0px 3px 25px;
font-size: 1px;
}
.menu-noline .menu-line {
display: none;
}
.menu-noline .menu-sep {
margin-left: 0;
margin-right: 0;
}
.menu-active {
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
}
.menu-item-disabled {
opacity: 0.5;
filter: alpha(opacity=50);
cursor: default;
}
.menu-text,
.menu-text span {
font-size: 12px;
}
.menu-shadow {
position: absolute;
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
background: #ccc;
-moz-box-shadow: 2px 2px 3px #cccccc;
-webkit-box-shadow: 2px 2px 3px #cccccc;
box-shadow: 2px 2px 3px #cccccc;
filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2);
}
.menu-rightarrow {
background: url('images/menu_arrows.png') no-repeat -32px center;
}
.menu-line {
border-left: 1px solid #ccc;
border-right: 1px solid #fff;
}
.menu-sep {
border-top: 1px solid #ccc;
border-bottom: 1px solid #fff;
}
.menu {
background-color: #fafafa;
border-color: #ddd;
color: #444;
}
.menu-content {
background: #ffffff;
}
.menu-item {
border-color: transparent;
_border-color: #fafafa;
}
.menu-active {
border-color: #b7d2ff;
color: #000000;
background: #eaf2ff;
}
.menu-active-disabled {
border-color: transparent;
background: transparent;
color: #444;
}
| {
"pile_set_name": "Github"
} |
configuration reflection
{
shadows_pssm false
fog false
water_reflect false
water_refract false
}
configuration impostor_rtt
{
shadows_pssm false
fog false
wind false
}
| {
"pile_set_name": "Github"
} |
--------------------------------
-- @module EffectSprite3D
-- @extend Sprite3D
-- @parent_module cc
--------------------------------
--
-- @function [parent=#EffectSprite3D] setEffect3D
-- @param self
-- @param #cc.Effect3D effect
-- @return EffectSprite3D#EffectSprite3D self (return value: cc.EffectSprite3D)
--------------------------------
--
-- @function [parent=#EffectSprite3D] addEffect
-- @param self
-- @param #vec3_table outlineColor
-- @param #float width
-- @param #int order
-- @return EffectSprite3D#EffectSprite3D self (return value: cc.EffectSprite3D)
--------------------------------
--
-- @function [parent=#EffectSprite3D] getMesh
-- @param self
-- @return array_table#array_table ret (return value: array_table)
--------------------------------
--
-- @function [parent=#EffectSprite3D] getMeshNum
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
--
-- @function [parent=#EffectSprite3D] create
-- @param self
-- @param #string modelPath
-- @return EffectSprite3D#EffectSprite3D ret (return value: cc.EffectSprite3D)
--------------------------------
--
-- @function [parent=#EffectSprite3D] createFromObjFileAndTexture
-- @param self
-- @param #string objFilePath
-- @param #string textureFilePath
-- @return EffectSprite3D#EffectSprite3D ret (return value: cc.EffectSprite3D)
--------------------------------
--
-- @function [parent=#EffectSprite3D] draw
-- @param self
-- @param #cc.Renderer renderer
-- @param #mat4_table transform
-- @param #unsigned int flags
-- @return EffectSprite3D#EffectSprite3D self (return value: cc.EffectSprite3D)
return nil
| {
"pile_set_name": "Github"
} |
namespace Blog.Services.Models
{
using System;
public class ArticleListingServiceModel
{
public int Id { get; set; }
public string Title { get; set; }
public DateTime? PublishedOn { get; set; }
public string Author { get; set; }
}
}
| {
"pile_set_name": "Github"
} |
{% extends "message.html" %}
{% block message %}
<h2>Вас забанили</h2>
{% if me.is_banned_until %}
<p>
Бан истечет {{ me.is_banned_until | date:"j E Y" }}
</p>
{% endif %}
<p>
<br><img src="https://i.vas3k.ru/lk8.jpg" alt="" style="width: 100%;">
</p>
<p>
<br><a href="{% url "logout" %}" class="button">Выйти</a>
</p>
{% endblock %}
| {
"pile_set_name": "Github"
} |
/* Persian (Farsi) Translation for the jQuery UI date picker plugin. */
/* Javad Mowlanezhad -- [email protected] */
/* Jalali calendar should supported soon! (Its implemented but I have to test it) */
jQuery(function($) {
$.datepicker.regional['fa'] = {
closeText: 'بستن',
prevText: '<قبلی',
nextText: 'بعدی>',
currentText: 'امروز',
monthNames: [
'فروردين',
'ارديبهشت',
'خرداد',
'تير',
'مرداد',
'شهريور',
'مهر',
'آبان',
'آذر',
'دی',
'بهمن',
'اسفند'
],
monthNamesShort: ['1','2','3','4','5','6','7','8','9','10','11','12'],
dayNames: [
'يکشنبه',
'دوشنبه',
'سهشنبه',
'چهارشنبه',
'پنجشنبه',
'جمعه',
'شنبه'
],
dayNamesShort: [
'ی',
'د',
'س',
'چ',
'پ',
'ج',
'ش'
],
dayNamesMin: [
'ی',
'د',
'س',
'چ',
'پ',
'ج',
'ش'
],
weekHeader: 'هف',
dateFormat: 'yy/mm/dd',
firstDay: 6,
isRTL: true,
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['fa']);
});
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2015 Toradex AG
*
* Stefan Agner <[email protected]>
*
* Freescale TCON device driver
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/mm.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include "fsl_tcon.h"
void fsl_tcon_bypass_disable(struct fsl_tcon *tcon)
{
regmap_update_bits(tcon->regs, FSL_TCON_CTRL1,
FSL_TCON_CTRL1_TCON_BYPASS, 0);
}
void fsl_tcon_bypass_enable(struct fsl_tcon *tcon)
{
regmap_update_bits(tcon->regs, FSL_TCON_CTRL1,
FSL_TCON_CTRL1_TCON_BYPASS,
FSL_TCON_CTRL1_TCON_BYPASS);
}
static struct regmap_config fsl_tcon_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.name = "tcon",
};
static int fsl_tcon_init_regmap(struct device *dev,
struct fsl_tcon *tcon,
struct device_node *np)
{
struct resource res;
void __iomem *regs;
if (of_address_to_resource(np, 0, &res))
return -EINVAL;
regs = devm_ioremap_resource(dev, &res);
if (IS_ERR(regs))
return PTR_ERR(regs);
tcon->regs = devm_regmap_init_mmio(dev, regs,
&fsl_tcon_regmap_config);
return PTR_ERR_OR_ZERO(tcon->regs);
}
struct fsl_tcon *fsl_tcon_init(struct device *dev)
{
struct fsl_tcon *tcon;
struct device_node *np;
int ret;
/* TCON node is not mandatory, some devices do not provide TCON */
np = of_parse_phandle(dev->of_node, "fsl,tcon", 0);
if (!np)
return NULL;
tcon = devm_kzalloc(dev, sizeof(*tcon), GFP_KERNEL);
if (!tcon)
goto err_node_put;
ret = fsl_tcon_init_regmap(dev, tcon, np);
if (ret) {
dev_err(dev, "Couldn't create the TCON regmap\n");
goto err_node_put;
}
tcon->ipg_clk = of_clk_get_by_name(np, "ipg");
if (IS_ERR(tcon->ipg_clk)) {
dev_err(dev, "Couldn't get the TCON bus clock\n");
goto err_node_put;
}
ret = clk_prepare_enable(tcon->ipg_clk);
if (ret) {
dev_err(dev, "Couldn't enable the TCON clock\n");
goto err_node_put;
}
of_node_put(np);
dev_info(dev, "Using TCON in bypass mode\n");
return tcon;
err_node_put:
of_node_put(np);
return NULL;
}
void fsl_tcon_free(struct fsl_tcon *tcon)
{
clk_disable_unprepare(tcon->ipg_clk);
clk_put(tcon->ipg_clk);
}
| {
"pile_set_name": "Github"
} |
// Type definitions for Select2 4.0
// Project: http://ivaynberg.github.com/select2/, https://select2.org
// Definitions by: Boris Yankov <https://github.com/borisyankov>
// denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="jquery"/>
/// <reference types="requirejs"/>
export as namespace Select2;
// --------------------------------------------------------------------------
// For jQuery v1 and v2 backward compatibility
// --------------------------------------------------------------------------
export type Sub<O extends string, D extends string> =
{[K in O]: (Record<D, never> & Record<string, K>)[K]}[O];
/**
* Same as jQuery v3 `JQuery.AjaxSettingsBase`.
*/
export type JQueryAjaxSettingsBase =
Pick<JQueryAjaxSettings, Sub<keyof JQueryAjaxSettings, "url">>;
/**
* Same as jQuery v3 `JQuery.EventHandlerBase`.
*/
export type JQueryEventHandlerBase<TContext, T> =
(this: TContext, t: T, ...args: any[]) => void | false;
/**
* Same as jQuery v3 `JQuery.PlainObject`.
*/
export interface PlainObject<T = any> {
[key: string]: T;
}
// --------------------------------------------------------------------------
// Some Interfaces
// --------------------------------------------------------------------------
export interface Select2 {
$container: JQuery;
$dropdown: JQuery;
$selection: JQuery;
$results: JQuery;
dropdown: any;
id: string;
options: { options: Options };
results: any;
selection: any;
}
export interface QueryOptions {
term?: string;
page?: number;
}
export interface SearchOptions {
term: string;
}
export interface DataFormat {
id: number | string;
text: string;
selected?: boolean;
disabled?: boolean;
}
export interface GroupedDataFormat {
text: string;
children?: DataFormat[];
id?: undefined;
}
export interface ProcessedResult<Result = DataFormat | GroupedDataFormat> {
results: Result[];
pagination?: {more: boolean};
}
export interface LoadingData {
loading: boolean;
text: string;
id?: undefined;
element?: undefined;
}
export interface OptGroupData {
children: OptionData[];
disabled: boolean;
element: HTMLOptGroupElement;
selected: boolean;
text: string;
title: string;
loading?: undefined;
}
export interface OptionData {
disabled: boolean;
element: HTMLOptionElement;
id: string;
selected: boolean;
text: string;
title: string;
loading?: undefined;
children?: undefined;
}
export interface IdTextPair {
id: string;
text: string;
loading?: undefined;
element?: undefined;
}
export interface TranslationArg {
input: string;
minimum: number;
maximum: number;
}
export interface Translation {
errorLoading?: () => string;
inputTooLong?: (arg: TranslationArg) => string;
inputTooShort?: (arg: TranslationArg) => string;
loadingMore?: () => string;
maximumSelected?: (arg: TranslationArg) => string;
noResults?: () => string;
searching?: () => string;
}
export interface DataParams {
data: OptionData; // TODO: must be data source
originalEvent: BaseJQueryEventObject;
}
export interface IngParams {
name: "select" | "open" | "close" | "unselect";
prevented: boolean;
}
export interface Event<TElement, T> extends BaseJQueryEventObject {
params: T;
}
export interface Trigger {
type: "select2:select";
params: {
data: IdTextPair;
};
}
// --------------------------------------------------------------------------
// Ajax Option
// --------------------------------------------------------------------------
export interface AjaxOptions<Result = DataFormat | GroupedDataFormat, RemoteResult = any> extends JQueryAjaxSettingsBase {
delay?: number;
url?: string | ((params: QueryOptions) => string);
data?: (params: QueryOptions) => PlainObject;
transport?: (settings: JQueryAjaxSettings, success?: (data: RemoteResult) => undefined, failure?: () => undefined) => void;
processResults?: (data: RemoteResult, params: QueryOptions) => ProcessedResult<Result>;
}
// --------------------------------------------------------------------------
// Options
// --------------------------------------------------------------------------
export interface Options<Result = DataFormat | GroupedDataFormat, RemoteResult = any> {
ajax?: AjaxOptions<Result, RemoteResult>;
allowClear?: boolean;
amdBase?: string;
amdLanguageBase?: string;
closeOnSelect?: boolean;
containerCss?: any;
containerCssClass?: string;
data?: DataFormat[] | GroupedDataFormat[];
dataAdapter?: any;
debug?: boolean;
dir?: "ltr" | "rtl";
disabled?: boolean;
dropdownAdapter?: any;
dropdownAutoWidth?: boolean;
dropdownCss?: any;
dropdownCssClass?: string;
dropdownParent?: JQuery;
escapeMarkup?: (markup: string) => string;
initSelection?: (element: JQuery, callback: (data: any) => void) => void;
language?: string | Translation;
matcher?: (params: SearchOptions, data: OptGroupData | OptionData) => OptGroupData | OptionData | null;
maximumInputLength?: number;
maximumSelectionLength?: number;
minimumInputLength?: number;
minimumResultsForSearch?: number;
multiple?: boolean;
placeholder?: string | IdTextPair;
resultsAdapter?: any;
selectionAdapter?: any;
selectOnClose?: boolean;
sorter?: (data: Array<OptGroupData | OptionData | IdTextPair>) => Array<OptGroupData | OptionData | IdTextPair>;
tags?: boolean;
templateResult?: (result: LoadingData | Result) => string | JQuery | null;
templateSelection?: (selection: IdTextPair | LoadingData | Result) => string | JQuery;
theme?: string;
tokenizer?: (input: string, selection: any[], selectCallback: () => void, options: Options) => string;
tokenSeparators?: string[];
width?: string;
// Not in https://select2.org/configuration/options-api
createTag?: (params: SearchOptions) => IdTextPair | null;
insertTag?: (data: Array<OptionData | IdTextPair>, tag: IdTextPair) => void;
}
// --------------------------------------------------------------------------
// jQuery And Select2 Plugin
// --------------------------------------------------------------------------
export interface Select2Plugin<TElement = HTMLElement> {
amd: { require: Require; };
defaults: {
set: (key: string, value: any) => void;
reset: () => void;
};
(): JQuery<TElement>;
// tslint:disable-next-line:no-unnecessary-generics
<Result = DataFormat | GroupedDataFormat, RemoteResult = any>(options: Options<Result, RemoteResult>): JQuery<TElement>;
/**
* Get the data object of the current selection
*/
(method: "data"): OptionData[];
/**
* Reverts changes to DOM done by Select2. Any selection done via Select2 will be preserved.
*/
(method: "destroy"): JQuery<TElement>;
/**
* Opens the dropdown
*/
(method: "open"): JQuery<TElement>;
/**
* Closes the dropdown
*/
(method: "close"): JQuery<TElement>;
}
declare global {
interface JQuery<TElement = HTMLElement> {
select2: Select2Plugin<TElement>;
data(key: "select2"): Select2;
trigger(events: Trigger): void;
// TODO: events "change" and "change.select2"
on(events: "select2:closing", handler?: JQueryEventHandlerBase<TElement, Event<TElement, IngParams>>): this;
on(events: "select2:close", handler?: JQueryEventHandlerBase<TElement, Event<TElement, {}>>): this;
on(events: "select2:opening", handler?: JQueryEventHandlerBase<TElement, Event<TElement, IngParams>>): this;
on(events: "select2:open", handler?: JQueryEventHandlerBase<TElement, Event<TElement, {}>>): this;
on(events: "select2:selecting", handler?: JQueryEventHandlerBase<TElement, Event<TElement, IngParams>>): this;
on(events: "select2:select", handler?: JQueryEventHandlerBase<TElement, Event<TElement, DataParams>>): this;
on(events: "select2:unselecting", handler?: JQueryEventHandlerBase<TElement, Event<TElement, IngParams>>): this;
on(events: "select2:unselect", handler?: JQueryEventHandlerBase<TElement, Event<TElement, DataParams>>): this;
}
}
| {
"pile_set_name": "Github"
} |
class Proselint < Formula
include Language::Python::Virtualenv
desc "Linter for prose"
homepage "http://proselint.com"
url "https://files.pythonhosted.org/packages/42/ff/8e7ad0108b8faffdf2ec7d170b4a8a3c9bc91f5077debf5381ef14702588/proselint-0.10.2.tar.gz"
sha256 "3a87eb393056d1bc77d898e4bcf8998f50e9ad84f7b9ff7cf2720509ac8ef904"
license "BSD-3-Clause"
revision OS.mac? ? 3 : 4
head "https://github.com/amperser/proselint.git"
livecheck do
url :stable
end
bottle do
cellar :any_skip_relocation
sha256 "16677bb488b626f2a5ebab9c85b52e5aa34501861aaf146dd093fdeab9c8d7af" => :catalina
sha256 "2cb69c3b259812c1eeb11cc83ec7fcd5d0e6a01485a784ecdb76c75e55a5ad18" => :mojave
sha256 "51b225461669feb8926219f46de1fa4c438e875e9b6b9669f9191bd883679617" => :high_sierra
sha256 "bd89e661ead0970e14a67aa149af02f9d647b5990e80e1a3e1d3df39ce078396" => :x86_64_linux
end
depends_on "[email protected]"
resource "click" do
url "https://files.pythonhosted.org/packages/95/d9/c3336b6b5711c3ab9d1d3a80f1a3e2afeb9d8c02a7166462f6cc96570897/click-6.7.tar.gz"
sha256 "f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b"
end
resource "future" do
url "https://files.pythonhosted.org/packages/00/2b/8d082ddfed935f3608cc61140df6dcbf0edea1bc3ab52fb6c29ae3e81e85/future-0.16.0.tar.gz"
sha256 "e39ced1ab767b5936646cedba8bcce582398233d6a627067d4c6a454c90cfedb"
end
resource "six" do
url "https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six-1.11.0.tar.gz"
sha256 "70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9"
end
def install
virtualenv_install_with_resources
end
test do
output = pipe_output("#{bin}/proselint --compact -", "John is very unique.")
assert_match "Comparison of an uncomparable", output
end
end
| {
"pile_set_name": "Github"
} |
# Использование конструкторов с параметрами при объявлении структуры (NestedConstructorsInStructureDeclaration)
Тип | Поддерживаются<br>языки | Важность | Включена<br>по умолчанию | Время на<br>исправление (мин) | Тэги
:-: | :-: | :-: | :-: | :-: | :-:
`Дефект кода` | `BSL`<br>`OS` | `Незначительный` | `Да` | `10` | `badpractice`<br>`brainoverload`
<!-- Блоки выше заполняются автоматически, не трогать -->
## Описание диагностики
Не рекомендуется в конструкторе структуры использовать конструкторы других объектов, если эти конструкторы принимают параметры. В частности в конструкторе одной структуры не рекомендуется создавать другие структуры с объявлением значений свойств.
## Примеры
Неправильно
```bsl
НоменклатураСервер.ЗаполнитьСлужебныеРеквизитыПоНоменклатуреВКоллекции(
Объект.Товары,
Новый Структура(
"ЗаполнитьПризнакХарактеристикиИспользуются,
|ЗаполнитьПризнакТипНоменклатуры, ЗаполнитьПризнакВариантОформленияПродажи",
Новый Структура("Номенклатура", "ХарактеристикиИспользуются"),
Новый Структура("Номенклатура", "ТипНоменклатуры"),
Новый Структура("Номенклатура", "ВариантОформленияПродажи")
)
);
```
Правильно
```bsl
ПараметрыЗаполненияРеквизитов = Новый Структура;
ПараметрыЗаполненияРеквизитов.Вставить("ЗаполнитьПризнакХарактеристикиИспользуются",
Новый Структура("Номенклатура", "ХарактеристикиИспользуются"));
ПараметрыЗаполненияРеквизитов.Вставить("ЗаполнитьПризнакТипНоменклатуры",
Новый Структура("Номенклатура", "ТипНоменклатуры"));
НоменклатураСервер.ЗаполнитьСлужебныеРеквизитыПоНоменклатуреВКоллекции(Объект.Товары,
ПараметрыЗаполненияРеквизитов);
```
## Сниппеты
<!-- Блоки ниже заполняются автоматически, не трогать -->
### Экранирование кода
```bsl
// BSLLS:NestedConstructorsInStructureDeclaration-off
// BSLLS:NestedConstructorsInStructureDeclaration-on
```
### Параметр конфигурационного файла
```json
"NestedConstructorsInStructureDeclaration": false
```
| {
"pile_set_name": "Github"
} |
import * as React from 'react';
import PropertyFieldHeader from '../../common/propertyFieldHeader/PropertyFieldHeader';
import { IPropertyFieldToggleWithCalloutHostProps } from './IPropertyFieldToggleWithCalloutHost';
import * as telemetry from '../../common/telemetry';
import { Toggle } from 'office-ui-fabric-react/lib/components/Toggle';
import omit from 'lodash/omit';
export default class PropertyFieldToggleWithCalloutHost extends React.Component<IPropertyFieldToggleWithCalloutHostProps, null> {
constructor(props: IPropertyFieldToggleWithCalloutHostProps) {
super(props);
telemetry.track('PropertyFieldToggleWithCallout', {
disabled: props.disabled
});
}
public render(): JSX.Element {
return (
<div>
<PropertyFieldHeader
{...this.props}
label={this.props.label.toString()} />
<Toggle {...omit(this.props, ['label'])} />
</div>
);
}
}
| {
"pile_set_name": "Github"
} |
//@ts-nocheck
export * from './SingleStatBaseOptions';
| {
"pile_set_name": "Github"
} |
Deploy by running `mvn appengine:deploy` ([Documentation](https://cloud.google.com/appengine/docs/standard/java/tools/uploadinganapp))
| {
"pile_set_name": "Github"
} |
#pragma once
#include <AH/Math/IncreaseBitDepth.hpp>
#include <Control_Surface/Control_Surface_Class.hpp>
BEGIN_CS_NAMESPACE
/**
* @brief Class that sends continuous MIDI pitch bend messages with a
* resolution of 14 bits.
*
* @tparam INPUT_PRECISION_BITS
* The resolution of the input values. For example, if
* @p INPUT_PRECISION_BITS == 10, the send function expects a @p value
* between 0 and 1023.
*
* @ingroup MIDI_Senders
*/
template <uint8_t INPUT_PRECISION_BITS>
class PitchBendSender {
public:
/// Send a MIDI pitch bend message with the given value and channel+CN.
/// address.getAddress() is ignored.
/// Value should be @p INPUT_PRECISION_BITS wide.
static void send(uint16_t value, MIDIAddress address) {
value = AH::increaseBitDepth<14, precision(), uint16_t>(value);
// ignore address byte, just use channel and cable numbers
MIDIChannelCN channelCN = {address.getChannel(),
address.getCableNumber()};
Control_Surface.sendPB(channelCN, value);
}
/// Get this sender's precision.
constexpr static uint8_t precision() {
static_assert(INPUT_PRECISION_BITS <= 14,
"Maximum pitch bend resolution is 14 bits");
return INPUT_PRECISION_BITS;
}
};
END_CS_NAMESPACE | {
"pile_set_name": "Github"
} |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\Cms\Controller\Adminhtml\Wysiwyg\Images;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Controller\Result\Json as JsonResponse;
use Magento\Framework\App\Response\HttpFactory as ResponseFactory;
use Magento\Framework\App\Response\Http as Response;
/**
* Test for \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\Upload class.
*/
class UploadTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\Upload
*/
private $model;
/**
* @var \Magento\Framework\Filesystem\Directory\WriteInterface
*/
private $mediaDirectory;
/**
* @var string
*/
private $fullDirectoryPath;
/**
* @var string
*/
private $fullExcludedDirectoryPath;
/**
* @var string
*/
private $fileName = 'magento_small_image.jpg';
/**
* @var \Magento\Framework\Filesystem
*/
private $filesystem;
/**
* @var \Magento\Framework\ObjectManagerInterface
*/
private $objectManager;
/**
* @var HttpFactory
*/
private $responseFactory;
/**
* @inheritdoc
*/
protected function setUp()
{
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$directoryName = 'directory1';
$excludedDirName = 'downloadable';
$this->filesystem = $this->objectManager->get(\Magento\Framework\Filesystem::class);
/** @var \Magento\Cms\Helper\Wysiwyg\Images $imagesHelper */
$imagesHelper = $this->objectManager->get(\Magento\Cms\Helper\Wysiwyg\Images::class);
$this->mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA);
$this->fullDirectoryPath = $imagesHelper->getStorageRoot() . DIRECTORY_SEPARATOR . $directoryName;
$this->fullExcludedDirectoryPath = $imagesHelper->getStorageRoot() . DIRECTORY_SEPARATOR . $excludedDirName;
$this->mediaDirectory->create($this->mediaDirectory->getRelativePath($this->fullDirectoryPath));
$this->responseFactory = $this->objectManager->get(ResponseFactory::class);
$this->model = $this->objectManager->get(\Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\Upload::class);
$fixtureDir = realpath(__DIR__ . '/../../../../../Catalog/_files');
$tmpFile = $this->filesystem->getDirectoryRead(DirectoryList::PUB)->getAbsolutePath() . $this->fileName;
copy($fixtureDir . DIRECTORY_SEPARATOR . $this->fileName, $tmpFile);
$_FILES = [
'image' => [
'name' => $this->fileName,
'type' => 'image/png',
'tmp_name' => $tmpFile,
'error' => 0,
'size' => filesize($fixtureDir),
],
];
}
/**
* Execute method with correct directory path and file name to check that file can be uploaded to the directory
* located under WYSIWYG media.
*
* @return void
* @magentoAppIsolation enabled
*/
public function testExecute()
{
$this->model->getRequest()->setParams(['type' => 'image/png']);
$this->model->getRequest()->setMethod('POST');
$this->model->getStorage()->getSession()->setCurrentPath($this->fullDirectoryPath);
/** @var JsonResponse $jsonResponse */
$jsonResponse = $this->model->execute();
/** @var Response $response */
$jsonResponse->renderResult($response = $this->responseFactory->create());
$data = json_decode($response->getBody(), true);
$this->assertTrue(
$this->mediaDirectory->isExist(
$this->mediaDirectory->getRelativePath(
$this->fullDirectoryPath . DIRECTORY_SEPARATOR . $this->fileName
)
)
);
//Asserting that response contains only data needed by clients.
$keys = ['name', 'type', 'error', 'size', 'file'];
sort($keys);
$dataKeys = array_keys($data);
sort($dataKeys);
$this->assertEquals($keys, $dataKeys);
}
/**
* Execute method with excluded directory path and file name to check that file can't be uploaded.
*
* @return void
* @magentoAppIsolation enabled
*/
public function testExecuteWithExcludedDirectory()
{
$expectedError = 'We can\'t upload the file to current folder right now. Please try another folder.';
$this->model->getRequest()->setParams(['type' => 'image/png']);
$this->model->getRequest()->setMethod('POST');
$this->model->getStorage()->getSession()->setCurrentPath($this->fullExcludedDirectoryPath);
/** @var JsonResponse $jsonResponse */
$jsonResponse = $this->model->execute();
/** @var Response $response */
$jsonResponse->renderResult($response = $this->responseFactory->create());
$data = json_decode($response->getBody(), true);
$this->assertEquals($expectedError, $data['error']);
$this->assertFalse(
$this->mediaDirectory->isExist(
$this->mediaDirectory->getRelativePath(
$this->fullExcludedDirectoryPath . DIRECTORY_SEPARATOR . $this->fileName
)
)
);
}
/**
* Execute method with correct directory path and file name to check that file can be uploaded to the directory
* located under linked folder.
*
* @return void
* @magentoDataFixture Magento/Cms/_files/linked_media.php
*/
public function testExecuteWithLinkedMedia()
{
$directoryName = 'linked_media';
$fullDirectoryPath = $this->filesystem->getDirectoryRead(DirectoryList::PUB)
->getAbsolutePath() . DIRECTORY_SEPARATOR . $directoryName;
$wysiwygDir = $this->mediaDirectory->getAbsolutePath() . '/wysiwyg';
$this->model->getRequest()->setParams(['type' => 'image/png']);
$this->model->getStorage()->getSession()->setCurrentPath($wysiwygDir);
$this->model->execute();
$this->assertTrue(is_file($fullDirectoryPath . DIRECTORY_SEPARATOR . $this->fileName));
}
/**
* Execute method with traversal directory path to check that there is no ability to create file not
* under media directory.
*
* @return void
*/
public function testExecuteWithWrongPath()
{
$dirPath = '/../../../etc/';
$this->model->getRequest()->setParams(['type' => 'image/png']);
$this->model->getStorage()->getSession()->setCurrentPath($dirPath);
$this->model->execute();
$this->assertFileNotExists(
$this->fullDirectoryPath . $dirPath . $this->fileName
);
}
/**
* Execute method with traversal file path to check that there is no ability to create file not
* under media directory.
*
* @return void
*/
public function testExecuteWithWrongFileName()
{
$newFilename = '/../../../../etc/new_file.png';
$_FILES['image']['name'] = $newFilename;
$_FILES['image']['tmp_name'] = __DIR__ . DIRECTORY_SEPARATOR . $this->fileName;
$this->model->getRequest()->setParams(['type' => 'image/png']);
$this->model->getStorage()->getSession()->setCurrentPath($this->fullDirectoryPath);
$this->model->execute();
$this->assertFileNotExists($this->fullDirectoryPath . $newFilename);
}
/**
* @inheritdoc
*/
public static function tearDownAfterClass()
{
$filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
->get(\Magento\Framework\Filesystem::class);
/** @var \Magento\Framework\Filesystem\Directory\WriteInterface $directory */
$directory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
if ($directory->isExist('wysiwyg')) {
$directory->delete('wysiwyg');
}
}
}
| {
"pile_set_name": "Github"
} |
// mksyscall.pl -tags linux,mips64le syscall_linux.go syscall_linux_mips64x.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build linux,mips64le
package unix
import (
"syscall"
"unsafe"
)
var _ syscall.Errno
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func fchmodat(dirfd int, path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ioctl(fd int, req uint, arg uintptr) (err error) {
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(oldpath)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(newpath)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(buf) > 0 {
_p1 = unsafe.Pointer(&buf[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(oldpath)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(newpath)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unlinkat(dirfd int, path string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func utimes(path string, times *[2]Timeval) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) {
_, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getcwd(buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) {
r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0)
wpid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(arg2)
if err != nil {
return
}
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(arg3)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(arg4)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
var _p0 unsafe.Pointer
if len(payload) > 0 {
_p0 = unsafe.Pointer(&payload[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
ret = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(arg)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(source)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(target)
if err != nil {
return
}
var _p2 *byte
_p2, err = BytePtrFromString(fstype)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Acct(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(keyType)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(description)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(payload) > 0 {
_p2 = unsafe.Pointer(&payload[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
id = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Adjtimex(buf *Timex) (state int, err error) {
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
state = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chdir(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chroot(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup(oldfd int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup3(oldfd int, newfd int, flags int) (err error) {
_, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollCreate(size int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollCreate1(flag int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) {
_, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Eventfd(initval uint, flags int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_EVENTFD2, uintptr(initval), uintptr(flags), 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Exit(code int) {
Syscall(SYS_EXIT_GROUP, uintptr(code), 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fallocate(fd int, mode uint32, off int64, len int64) (err error) {
_, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchdir(fd int) (err error) {
_, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchmod(fd int, mode uint32) (err error) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func fcntl(fd int, cmd int, arg int) (val int, err error) {
r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fdatasync(fd int) (err error) {
_, _, e1 := Syscall(SYS_FDATASYNC, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Flock(fd int, how int) (err error) {
_, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fsync(fd int) (err error) {
_, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpgid(pid int) (pgid int, err error) {
r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0)
pgid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpid() (pid int) {
r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
pid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getppid() (ppid int) {
r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
ppid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpriority(which int, who int) (prio int, err error) {
r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
prio = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrandom(buf []byte, flags int) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETRANDOM, uintptr(_p0), uintptr(len(buf)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getsid(pid int) (sid int, err error) {
r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0)
sid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettid() (tid int) {
r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0)
tid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(dest) > 0 {
_p2 = unsafe.Pointer(&dest[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func InotifyInit1(flags int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) {
r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0)
success = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Kill(pid int, sig syscall.Signal) (err error) {
_, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Klogctl(typ int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(dest) > 0 {
_p2 = unsafe.Pointer(&dest[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Listxattr(path string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(dest) > 0 {
_p1 = unsafe.Pointer(&dest[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Llistxattr(path string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(dest) > 0 {
_p1 = unsafe.Pointer(&dest[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lremovexattr(path string, attr string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(data) > 0 {
_p2 = unsafe.Pointer(&data[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
_, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func PivotRoot(newroot string, putold string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(newroot)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(putold)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) {
_, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func read(fd int, p []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Removexattr(path string, attr string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(oldpath)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(newpath)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(keyType)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(description)
if err != nil {
return
}
var _p2 *byte
_p2, err = BytePtrFromString(callback)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
id = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setdomainname(p []byte) (err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Sethostname(p []byte) (err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setpgid(pid int, pgid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setsid() (pid int, err error) {
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
pid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Settimeofday(tv *Timeval) (err error) {
_, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setns(fd int, nstype int) (err error) {
_, _, e1 := Syscall(SYS_SETNS, uintptr(fd), uintptr(nstype), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setpriority(which int, who int, prio int) (err error) {
_, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setxattr(path string, attr string, data []byte, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(data) > 0 {
_p2 = unsafe.Pointer(&data[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Sync() {
Syscall(SYS_SYNC, 0, 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Syncfs(fd int) (err error) {
_, _, e1 := Syscall(SYS_SYNCFS, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Sysinfo(info *Sysinfo_t) (err error) {
_, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0)
n = int64(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) {
_, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Times(tms *Tms) (ticks uintptr, err error) {
r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0)
ticks = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Umask(mask int) (oldmask int) {
r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0)
oldmask = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Uname(buf *Utsname) (err error) {
_, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unmount(target string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(target)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unshare(flags int) (err error) {
_, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ustat(dev int, ubuf *Ustat_t) (err error) {
_, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func write(fd int, p []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func exitThread(code int) (err error) {
_, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func readlen(fd int, p *byte, np int) (n int, err error) {
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func writelen(fd int, p *byte, np int) (n int, err error) {
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func munmap(addr uintptr, length uintptr) (err error) {
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Madvise(b []byte, advice int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mprotect(b []byte, prot int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mlock(b []byte) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mlockall(flags int) (err error) {
_, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Msync(b []byte, flags int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Munlock(b []byte) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Munlockall() (err error) {
_, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchown(fd int, uid int, gid int) (err error) {
_, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_NEWFSTATAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatfs(fd int, buf *Statfs_t) (err error) {
_, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ftruncate(fd int, length int64) (err error) {
_, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getegid() (egid int) {
r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
egid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Geteuid() (euid int) {
r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
euid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getgid() (gid int) {
r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
gid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getuid() (uid int) {
r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
uid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lchown(path string, uid int, gid int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Listen(s int, n int) (err error) {
_, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pause() (err error) {
_, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pread(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Seek(fd int, offset int64, whence int) (off int64, err error) {
r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
off = int64(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0)
written = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setfsgid(gid int) (err error) {
_, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setfsuid(uid int) (err error) {
_, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setregid(rgid int, egid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setresgid(rgid int, egid int, sgid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setresuid(ruid int, euid int, suid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setreuid(ruid int, euid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Shutdown(fd int, how int) (err error) {
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
n = int64(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Statfs(path string, buf *Statfs_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func SyncFileRange(fd int, off int64, n int64, flags int) (err error) {
_, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE, uintptr(fd), uintptr(off), uintptr(n), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Truncate(path string, length int64) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
_, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
_, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getgroups(n int, list *_Gid_t) (nn int, err error) {
r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
nn = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setgroups(n int, list *_Gid_t) (err error) {
_, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
_, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
_, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func socket(domain int, typ int, proto int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
_, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
xaddr = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettimeofday(tv *Timeval) (err error) {
_, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Utime(path string, buf *Utimbuf) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func pipe2(p *[2]_C_int, flags int) (err error) {
_, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func fstat(fd int, st *stat_t) (err error) {
_, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(st)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func lstat(path string, st *stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(st)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func stat(path string, st *stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(st)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JavaScript - Popover</title>
<!-- Styleguide CSS -->
<link rel="stylesheet" href="./theme-build/css/vendors.css">
<link rel="stylesheet" href="./theme-build/css/cortana.css">
<!-- Source CSS -->
<link rel="stylesheet" href="css/bootsketch.css">
<!--[if lt IE 9]>
<script src="theme-build/polyfill/html5shiv.js"></script>
<script src="theme-build/polyfill/respond.min.js"></script>
<![endif]-->
</head>
<body class="cortana-body">
<div class="sb-slidebar sb-left cortana-sidenav sb-style-push">
<nav class="cortana-nav">
<ul>
<li><a href="index.html">Home</a></li>
</ul>
<h3>JavaScript</h3>
<ul>
<li><a href="javascript_-_collapse.html">Collapse</a></li>
<li><a href="javascript_-_alert.html">Alert</a></li>
<li><a href="javascript_-_buttons_js.html">Buttons JS</a></li>
<li><a href="javascript_-_carousel.html">Carousel</a></li>
<li><a href="javascript_-_dropdown.html">Dropdown</a></li>
<li><a href="javascript_-_modal.html">Modal</a></li>
<li><a class="active" href="javascript_-_popover.html">Popover</a></li>
<li><a href="javascript_-_scrollspy.html">ScrollSpy</a></li>
<li><a href="javascript_-_tooltips.html">Tooltips</a></li>
</ul>
<h3>Components</h3>
<ul>
<li><a href="components_-_alerts.html">Alerts</a></li>
<li><a href="components_-_badges.html">Badges</a></li>
<li><a href="components_-_progress_bar.html">Progress bar</a></li>
<li><a href="components_-_breadcrumb.html">Breadcrumb</a></li>
<li><a href="components_-_pager.html">Pager</a></li>
<li><a href="components_-_pagination.html">Pagination</a></li>
<li><a href="components_-_button_groups.html">Button Groups</a></li>
<li><a href="components_-_input_groups.html">Input groups</a></li>
<li><a href="components_-_jumbotron.html">Jumbotron</a></li>
<li><a href="components_-_labels.html">Labels</a></li>
<li><a href="components_-_list_group.html">List group</a></li>
<li><a href="components_-_media.html">Media</a></li>
<li><a href="components_-_navbar.html">Navbar</a></li>
<li><a href="components_-_panels.html">Panels</a></li>
<li><a href="components_-_nav.html">Nav</a></li>
<li><a href="components_-_thumbnails.html">Thumbnails</a></li>
<li><a href="components_-_well.html">Well</a></li>
</ul>
<h3>Layout</h3>
<ul>
<li><a href="layout_-_tables.html">Tables</a></li>
<li><a href="layout_-_colors.html">Colors</a></li>
<li><a href="layout_-_icons.html">Icons</a></li>
<li><a href="layout_-_images.html">Images</a></li>
<li><a href="layout_-_code.html">Code</a></li>
<li><a href="layout_-_form.html">Form</a></li>
<li><a href="layout_-_typography.html">Typography</a></li>
<li><a href="layout_-_buttons.html">Buttons</a></li>
</ul>
</nav>
</div>
<header class="cortana-header sb-slide">
<h1>Popover</h1>
<div id="open-left" class="cortana-menu-btn">
<span></span>
<span></span>
<span></span>
</div>
<input id="cortana-search" class="cortana-search" type="text" placeholder="Search">
</header>
<div id="sb-site">
<div class="cortana-container">
<nav id="cortana-inside-nav" class="cortana-inside-nav">
<ul>
<li><a href="#a-popover">Popover</a></li>
</ul>
</nav>
<div class="cortana-content-wrapper">
<h1 id="a-popover" class="styleguide">Popover</h1>
<div class="codeExample">
<div class="exampleOutput">
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="left" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
Popover on left
</button>
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
Popover on top
</button>
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="bottom" data-content="Vivamus
sagittis lacus vel augue laoreet rutrum faucibus.">
Popover on bottom
</button>
<button type="button" class="btn btn-default" data-container="body" data-toggle="popover" data-placement="right" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
Popover on right
</button>
</div>
<div class="codeBlock">
<div class="highlight">
<pre><span class="nt"><button</span> <span class="na">type=</span><span class="s">"button"</span> <span class="na">class=</span><span class="s">"btn btn-default"</span> <span class="na">data-container=</span><span class="s">"body"</span> <span class="na">data-toggle=</span><span class="s">"popover"</span> <span class="na">data-placement=</span><span class="s">"left"</span> <span class="na">data-content=</span><span class="s">"Vivamus sagittis lacus vel augue laoreet rutrum faucibus."</span><span class="nt">></span>
Popover on left
<span class="nt"></button></span>
<span class="nt"><button</span> <span class="na">type=</span><span class="s">"button"</span> <span class="na">class=</span><span class="s">"btn btn-default"</span> <span class="na">data-container=</span><span class="s">"body"</span> <span class="na">data-toggle=</span><span class="s">"popover"</span> <span class="na">data-placement=</span><span class="s">"top"</span> <span class="na">data-content=</span><span class="s">"Vivamus sagittis lacus vel augue laoreet rutrum faucibus."</span><span class="nt">></span>
Popover on top
<span class="nt"></button></span>
<span class="nt"><button</span> <span class="na">type=</span><span class="s">"button"</span> <span class="na">class=</span><span class="s">"btn btn-default"</span> <span class="na">data-container=</span><span class="s">"body"</span> <span class="na">data-toggle=</span><span class="s">"popover"</span> <span class="na">data-placement=</span><span class="s">"bottom"</span> <span class="na">data-content=</span><span class="s">"Vivamus
sagittis lacus vel augue laoreet rutrum faucibus."</span><span class="nt">></span>
Popover on bottom
<span class="nt"></button></span>
<span class="nt"><button</span> <span class="na">type=</span><span class="s">"button"</span> <span class="na">class=</span><span class="s">"btn btn-default"</span> <span class="na">data-container=</span><span class="s">"body"</span> <span class="na">data-toggle=</span><span class="s">"popover"</span> <span class="na">data-placement=</span><span class="s">"right"</span> <span class="na">data-content=</span><span class="s">"Vivamus sagittis lacus vel augue laoreet rutrum faucibus."</span><span class="nt">></span>
Popover on right
<span class="nt"></button></span></pre>
</div>
</div>
</div>
</div>
</div>
<footer class="cortana-footer">
Build with love using Trulia's <a href="https://github.com/trulia/hologram">Hologram</a> and <a href="https://github.com/Yago31/Cortana">Cortana</a> !
</footer>
</div>
<script src="theme-build/js/vendors.min.js"></script>
<script type="text/javascript">
// avoid conflict with potential other jQuery loaded on the styleguide
var jQuery_no_conflict = $.noConflict(true);
</script>
<script src="theme-build/js/main.js"></script>
<script>
var searchData =
[
{
"title": "Accordion",
"breadcrumb": "JavaScript - Collapse > Accordion",
"path": "javascript_-_collapse.html#a-accordion",
"tokens": ["JavaScript - Collapse","Accordion"]
},
{
"title": "Collapse button",
"breadcrumb": "JavaScript - Collapse > Collapse button",
"path": "javascript_-_collapse.html#b-collapse-button",
"tokens": ["JavaScript - Collapse","Collapse button"]
},
{
"title": "Alert message",
"breadcrumb": "JavaScript - Alert > Alert message",
"path": "javascript_-_alert.html#a-alert-message",
"tokens": ["JavaScript - Alert","Alert message"]
},
{
"title": "Alerts",
"breadcrumb": "Components - Alerts > Alerts",
"path": "components_-_alerts.html#a-alerts",
"tokens": ["Components - Alerts","Alerts"]
},
{
"title": "Dismissable alerts",
"breadcrumb": "Components - Alerts > Dismissable alerts",
"path": "components_-_alerts.html#b-dismissable-alerts",
"tokens": ["Components - Alerts","Dismissable alerts"]
},
{
"title": "Default badge",
"breadcrumb": "Components - Badges > Default badge",
"path": "components_-_badges.html#a-badge",
"tokens": ["Components - Badges","Default badge"]
},
{
"title": "Nav states",
"breadcrumb": "Components - Badges > Nav states",
"path": "components_-_badges.html#b-nav-states",
"tokens": ["Components - Badges","Nav states"]
},
{
"title": "Basic progress bar",
"breadcrumb": "Components - Progress bar > Basic progress bar",
"path": "components_-_progress_bar.html#a-basic-bar",
"tokens": ["Components - Progress bar","Basic progress bar"]
},
{
"title": "With label",
"breadcrumb": "Components - Progress bar > With label",
"path": "components_-_progress_bar.html#b-with-label",
"tokens": ["Components - Progress bar","With label"]
},
{
"title": "Contextual",
"breadcrumb": "Components - Progress bar > Contextual",
"path": "components_-_progress_bar.html#c-contextual",
"tokens": ["Components - Progress bar","Contextual"]
},
{
"title": "Striped",
"breadcrumb": "Components - Progress bar > Striped",
"path": "components_-_progress_bar.html#c-striped",
"tokens": ["Components - Progress bar","Striped"]
},
{
"title": "Animated",
"breadcrumb": "Components - Progress bar > Animated",
"path": "components_-_progress_bar.html#d-animated",
"tokens": ["Components - Progress bar","Animated"]
},
{
"title": "Stacked",
"breadcrumb": "Components - Progress bar > Stacked",
"path": "components_-_progress_bar.html#e-stacked",
"tokens": ["Components - Progress bar","Stacked"]
},
{
"title": "Basic table",
"breadcrumb": "Layout - Tables > Basic table",
"path": "layout_-_tables.html#a-basic-table",
"tokens": ["Layout - Tables","Basic table"]
},
{
"title": "Striped table",
"breadcrumb": "Layout - Tables > Striped table",
"path": "layout_-_tables.html#b-striped-table",
"tokens": ["Layout - Tables","Striped table"]
},
{
"title": "Bordered table",
"breadcrumb": "Layout - Tables > Bordered table",
"path": "layout_-_tables.html#c-bordered-table",
"tokens": ["Layout - Tables","Bordered table"]
},
{
"title": "Hover table",
"breadcrumb": "Layout - Tables > Hover table",
"path": "layout_-_tables.html#d-hover-table",
"tokens": ["Layout - Tables","Hover table"]
},
{
"title": "Condensed table",
"breadcrumb": "Layout - Tables > Condensed table",
"path": "layout_-_tables.html#e-condensed-table",
"tokens": ["Layout - Tables","Condensed table"]
},
{
"title": "Highlight table",
"breadcrumb": "Layout - Tables > Highlight table",
"path": "layout_-_tables.html#f-highlight-table",
"tokens": ["Layout - Tables","Highlight table"]
},
{
"title": "Breadcrumb",
"breadcrumb": "Components - Breadcrumb > Breadcrumb",
"path": "components_-_breadcrumb.html#a-breadcrumb",
"tokens": ["Components - Breadcrumb","Breadcrumb"]
},
{
"title": "Buttons",
"breadcrumb": "JavaScript - Buttons JS > Buttons",
"path": "javascript_-_buttons_js.html#a-buttons",
"tokens": ["JavaScript - Buttons JS","Buttons"]
},
{
"title": "Single toggle",
"breadcrumb": "JavaScript - Buttons JS > Single toggle",
"path": "javascript_-_buttons_js.html#b-single-toggle",
"tokens": ["JavaScript - Buttons JS","Single toggle"]
},
{
"title": "Checkbox",
"breadcrumb": "JavaScript - Buttons JS > Checkbox",
"path": "javascript_-_buttons_js.html#c-checkbox",
"tokens": ["JavaScript - Buttons JS","Checkbox"]
},
{
"title": "Radio",
"breadcrumb": "JavaScript - Buttons JS > Radio",
"path": "javascript_-_buttons_js.html#d-radio",
"tokens": ["JavaScript - Buttons JS","Radio"]
},
{
"title": "Carousel",
"breadcrumb": "JavaScript - Carousel > Carousel",
"path": "javascript_-_carousel.html#a-carousel",
"tokens": ["JavaScript - Carousel","Carousel"]
},
{
"title": "Colors",
"breadcrumb": "Layout - Colors > Colors",
"path": "layout_-_colors.html#a-colors",
"tokens": ["Layout - Colors","Colors"]
},
{
"title": "Default pager",
"breadcrumb": "Components - Pager > Default pager",
"path": "components_-_pager.html#a-default-pager",
"tokens": ["Components - Pager","Default pager"]
},
{
"title": "Align links",
"breadcrumb": "Components - Pager > Align links",
"path": "components_-_pager.html#b-align-link",
"tokens": ["Components - Pager","Align links"]
},
{
"title": "Disabled",
"breadcrumb": "Components - Pager > Disabled",
"path": "components_-_pager.html#c-disabled",
"tokens": ["Components - Pager","Disabled"]
},
{
"title": "Default pagination",
"breadcrumb": "Components - Pagination > Default pagination",
"path": "components_-_pagination.html#a-default-pagination",
"tokens": ["Components - Pagination","Default pagination"]
},
{
"title": "Active - Disabled",
"breadcrumb": "Components - Pagination > Active - Disabled",
"path": "components_-_pagination.html#b-active-disabled",
"tokens": ["Components - Pagination","Active - Disabled"]
},
{
"title": "Dropdown button",
"breadcrumb": "JavaScript - Dropdown > Dropdown button",
"path": "javascript_-_dropdown.html#a-dropdown-button",
"tokens": ["JavaScript - Dropdown","Dropdown button"]
},
{
"title": "Split dropdown button",
"breadcrumb": "JavaScript - Dropdown > Split dropdown button",
"path": "javascript_-_dropdown.html#b-split-dropdown-button",
"tokens": ["JavaScript - Dropdown","Split dropdown button"]
},
{
"title": "Sizes",
"breadcrumb": "JavaScript - Dropdown > Sizes",
"path": "javascript_-_dropdown.html#c-size",
"tokens": ["JavaScript - Dropdown","Sizes"]
},
{
"title": "Group",
"breadcrumb": "Components - Button Groups > Group",
"path": "components_-_button_groups.html#a-group",
"tokens": ["Components - Button Groups","Group"]
},
{
"title": "Sizes",
"breadcrumb": "Components - Button Groups > Sizes",
"path": "components_-_button_groups.html#b-sizes",
"tokens": ["Components - Button Groups","Sizes"]
},
{
"title": "With dropdown",
"breadcrumb": "Components - Button Groups > With dropdown",
"path": "components_-_button_groups.html#c-with-dropdown",
"tokens": ["Components - Button Groups","With dropdown"]
},
{
"title": "Icons",
"breadcrumb": "Layout - Icons > Icons",
"path": "layout_-_icons.html#a-icons",
"tokens": ["Layout - Icons","Icons"]
},
{
"title": "Images",
"breadcrumb": "Layout - Images > Images",
"path": "layout_-_images.html#a-images",
"tokens": ["Layout - Images","Images"]
},
{
"title": "Figure",
"breadcrumb": "Layout - Images > Figure",
"path": "layout_-_images.html#b-figure",
"tokens": ["Layout - Images","Figure"]
},
{
"title": "Images shapes",
"breadcrumb": "Layout - Images > Images shapes",
"path": "layout_-_images.html#c-images-shape",
"tokens": ["Layout - Images","Images shapes"]
},
{
"title": "Inline code",
"breadcrumb": "Layout - Code > Inline code",
"path": "layout_-_code.html#a-inline-code",
"tokens": ["Layout - Code","Inline code"]
},
{
"title": "User input",
"breadcrumb": "Layout - Code > User input",
"path": "layout_-_code.html#b-user-input",
"tokens": ["Layout - Code","User input"]
},
{
"title": "Code block",
"breadcrumb": "Layout - Code > Code block",
"path": "layout_-_code.html#c-code-block",
"tokens": ["Layout - Code","Code block"]
},
{
"title": "Input",
"breadcrumb": "Layout - Form > Input",
"path": "layout_-_form.html#a-input",
"tokens": ["Layout - Form","Input"]
},
{
"title": "Textarea",
"breadcrumb": "Layout - Form > Textarea",
"path": "layout_-_form.html#a-textarea",
"tokens": ["Layout - Form","Textarea"]
},
{
"title": "Checkboxes and radios",
"breadcrumb": "Layout - Form > Checkboxes and radios",
"path": "layout_-_form.html#b-checkbox-radio",
"tokens": ["Layout - Form","Checkboxes and radios"]
},
{
"title": "Inline checkboxes",
"breadcrumb": "Layout - Form > Inline checkboxes",
"path": "layout_-_form.html#c-inline-checkbox",
"tokens": ["Layout - Form","Inline checkboxes"]
},
{
"title": "Selects",
"breadcrumb": "Layout - Form > Selects",
"path": "layout_-_form.html#d-select",
"tokens": ["Layout - Form","Selects"]
},
{
"title": "Static control",
"breadcrumb": "Layout - Form > Static control",
"path": "layout_-_form.html#e-static",
"tokens": ["Layout - Form","Static control"]
},
{
"title": "Basic form",
"breadcrumb": "Layout - Form > Basic form",
"path": "layout_-_form.html#i-basic-form",
"tokens": ["Layout - Form","Basic form"]
},
{
"title": "Inline form",
"breadcrumb": "Layout - Form > Inline form",
"path": "layout_-_form.html#j-inline-form",
"tokens": ["Layout - Form","Inline form"]
},
{
"title": "Horizontal form",
"breadcrumb": "Layout - Form > Horizontal form",
"path": "layout_-_form.html#k-horizontal-form",
"tokens": ["Layout - Form","Horizontal form"]
},
{
"title": "Validations",
"breadcrumb": "Layout - Form > Validations",
"path": "layout_-_form.html#l-validation",
"tokens": ["Layout - Form","Validations"]
},
{
"title": "Input groups",
"breadcrumb": "Components - Input groups > Input groups",
"path": "components_-_input_groups.html#a-input-groups",
"tokens": ["Components - Input groups","Input groups"]
},
{
"title": "Sizes",
"breadcrumb": "Components - Input groups > Sizes",
"path": "components_-_input_groups.html#c-sizes",
"tokens": ["Components - Input groups","Sizes"]
},
{
"title": "Checkbox-Radio addon",
"breadcrumb": "Components - Input groups > Checkbox-Radio addon",
"path": "components_-_input_groups.html#d-checkbox-addon",
"tokens": ["Components - Input groups","Checkbox-Radio addon"]
},
{
"title": "Button addon",
"breadcrumb": "Components - Input groups > Button addon",
"path": "components_-_input_groups.html#e-button-addon",
"tokens": ["Components - Input groups","Button addon"]
},
{
"title": "Dropdown addon",
"breadcrumb": "Components - Input groups > Dropdown addon",
"path": "components_-_input_groups.html#f-dropdown-addon",
"tokens": ["Components - Input groups","Dropdown addon"]
},
{
"title": "Jumbotron",
"breadcrumb": "Components - Jumbotron > Jumbotron",
"path": "components_-_jumbotron.html#a-jumbotron",
"tokens": ["Components - Jumbotron","Jumbotron"]
},
{
"title": "Default label",
"breadcrumb": "Components - Labels > Default label",
"path": "components_-_labels.html#a-labels",
"tokens": ["Components - Labels","Default label"]
},
{
"title": "Variations",
"breadcrumb": "Components - Labels > Variations",
"path": "components_-_labels.html#b-variations",
"tokens": ["Components - Labels","Variations"]
},
{
"title": "List group",
"breadcrumb": "Components - List group > List group",
"path": "components_-_list_group.html#a-list-group",
"tokens": ["Components - List group","List group"]
},
{
"title": "Badge",
"breadcrumb": "Components - List group > Badge",
"path": "components_-_list_group.html#b-badge",
"tokens": ["Components - List group","Badge"]
},
{
"title": "Linked items",
"breadcrumb": "Components - List group > Linked items",
"path": "components_-_list_group.html#c-linked-item",
"tokens": ["Components - List group","Linked items"]
},
{
"title": "Contextual",
"breadcrumb": "Components - List group > Contextual",
"path": "components_-_list_group.html#d-contextual",
"tokens": ["Components - List group","Contextual"]
},
{
"title": "Custom content",
"breadcrumb": "Components - List group > Custom content",
"path": "components_-_list_group.html#e-custom-content",
"tokens": ["Components - List group","Custom content"]
},
{
"title": "Default media",
"breadcrumb": "Components - Media > Default media",
"path": "components_-_media.html#a-media",
"tokens": ["Components - Media","Default media"]
},
{
"title": "Media list",
"breadcrumb": "Components - Media > Media list",
"path": "components_-_media.html#b-media-list",
"tokens": ["Components - Media","Media list"]
},
{
"title": "Modal",
"breadcrumb": "JavaScript - Modal > Modal",
"path": "javascript_-_modal.html#a-modal",
"tokens": ["JavaScript - Modal","Modal"]
},
{
"title": "Navbar",
"breadcrumb": "Components - Navbar > Navbar",
"path": "components_-_navbar.html#a-navbar",
"tokens": ["Components - Navbar","Navbar"]
},
{
"title": "Inverted navbar",
"breadcrumb": "Components - Navbar > Inverted navbar",
"path": "components_-_navbar.html#b-inverted-navbar",
"tokens": ["Components - Navbar","Inverted navbar"]
},
{
"title": "Form",
"breadcrumb": "Components - Navbar > Form",
"path": "components_-_navbar.html#c-form",
"tokens": ["Components - Navbar","Form"]
},
{
"title": "Text",
"breadcrumb": "Components - Navbar > Text",
"path": "components_-_navbar.html#d-text",
"tokens": ["Components - Navbar","Text"]
},
{
"title": "Dropdown",
"breadcrumb": "Components - Navbar > Dropdown",
"path": "components_-_navbar.html#e-dropdown",
"tokens": ["Components - Navbar","Dropdown"]
},
{
"title": "Basic panel",
"breadcrumb": "Components - Panels > Basic panel",
"path": "components_-_panels.html#a-panel",
"tokens": ["Components - Panels","Basic panel"]
},
{
"title": "Panel with heading",
"breadcrumb": "Components - Panels > Panel with heading",
"path": "components_-_panels.html#b-panel-heading",
"tokens": ["Components - Panels","Panel with heading"]
},
{
"title": "Panel with footer",
"breadcrumb": "Components - Panels > Panel with footer",
"path": "components_-_panels.html#c-panel-footer",
"tokens": ["Components - Panels","Panel with footer"]
},
{
"title": "Panel with table",
"breadcrumb": "Components - Panels > Panel with table",
"path": "components_-_panels.html#e-panel-table",
"tokens": ["Components - Panels","Panel with table"]
},
{
"title": "Panel with list",
"breadcrumb": "Components - Panels > Panel with list",
"path": "components_-_panels.html#f-panel-list",
"tokens": ["Components - Panels","Panel with list"]
},
{
"title": "Popover",
"breadcrumb": "JavaScript - Popover > Popover",
"path": "javascript_-_popover.html#a-popover",
"tokens": ["JavaScript - Popover","Popover"]
},
{
"title": "ScrollSpy",
"breadcrumb": "JavaScript - ScrollSpy > ScrollSpy",
"path": "javascript_-_scrollspy.html#a-scrollspy",
"tokens": ["JavaScript - ScrollSpy","ScrollSpy"]
},
{
"title": "Tabs",
"breadcrumb": "Components - Nav > Tabs",
"path": "components_-_nav.html#a-tabs",
"tokens": ["Components - Nav","Tabs"]
},
{
"title": "Pills",
"breadcrumb": "Components - Nav > Pills",
"path": "components_-_nav.html#b-pills",
"tokens": ["Components - Nav","Pills"]
},
{
"title": "Default thumbnail",
"breadcrumb": "Components - Thumbnails > Default thumbnail",
"path": "components_-_thumbnails.html#a-thumbnail",
"tokens": ["Components - Thumbnails","Default thumbnail"]
},
{
"title": "Custom content",
"breadcrumb": "Components - Thumbnails > Custom content",
"path": "components_-_thumbnails.html#b-custom-content",
"tokens": ["Components - Thumbnails","Custom content"]
},
{
"title": "Titles",
"breadcrumb": "Layout - Typography > Titles",
"path": "layout_-_typography.html#a-titles",
"tokens": ["Layout - Typography","Titles"]
},
{
"title": "Lead",
"breadcrumb": "Layout - Typography > Lead",
"path": "layout_-_typography.html#b-lead",
"tokens": ["Layout - Typography","Lead"]
},
{
"title": "Paragraphs",
"breadcrumb": "Layout - Typography > Paragraphs",
"path": "layout_-_typography.html#c-paragraphs",
"tokens": ["Layout - Typography","Paragraphs"]
},
{
"title": "Contextual color",
"breadcrumb": "Layout - Typography > Contextual color",
"path": "layout_-_typography.html#d-context-color",
"tokens": ["Layout - Typography","Contextual color"]
},
{
"title": "Contextual background",
"breadcrumb": "Layout - Typography > Contextual background",
"path": "layout_-_typography.html#e-context-background",
"tokens": ["Layout - Typography","Contextual background"]
},
{
"title": "Blockquote",
"breadcrumb": "Layout - Typography > Blockquote",
"path": "layout_-_typography.html#f-blockquote",
"tokens": ["Layout - Typography","Blockquote"]
},
{
"title": "Small",
"breadcrumb": "Layout - Typography > Small",
"path": "layout_-_typography.html#g-small",
"tokens": ["Layout - Typography","Small"]
},
{
"title": "Text elements",
"breadcrumb": "Layout - Typography > Text elements",
"path": "layout_-_typography.html#h-text-element",
"tokens": ["Layout - Typography","Text elements"]
},
{
"title": "Address",
"breadcrumb": "Layout - Typography > Address",
"path": "layout_-_typography.html#i-address",
"tokens": ["Layout - Typography","Address"]
},
{
"title": "List",
"breadcrumb": "Layout - Typography > List",
"path": "layout_-_typography.html#j-list",
"tokens": ["Layout - Typography","List"]
},
{
"title": "Description",
"breadcrumb": "Layout - Typography > Description",
"path": "layout_-_typography.html#k-description",
"tokens": ["Layout - Typography","Description"]
},
{
"title": "Tooltips",
"breadcrumb": "JavaScript - Tooltips > Tooltips",
"path": "javascript_-_tooltips.html#a-tooltips",
"tokens": ["JavaScript - Tooltips","Tooltips"]
},
{
"title": "Default well",
"breadcrumb": "Components - Well > Default well",
"path": "components_-_well.html#a-well",
"tokens": ["Components - Well","Default well"]
},
{
"title": "Sizes",
"breadcrumb": "Layout - Buttons > Sizes",
"path": "layout_-_buttons.html#b-size",
"tokens": ["Layout - Buttons","Sizes"]
},
{
"title": "Active / Disabled",
"breadcrumb": "Layout - Buttons > Active / Disabled",
"path": "layout_-_buttons.html#c-active-disabled",
"tokens": ["Layout - Buttons","Active / Disabled"]
},
{}];
(function($) {
$('#cortana-search').typeahead({
name: 'cortana_search',
local: searchData,
template: [
'<a href="{{path}}">',
'<p class="cortana-search-title">{{title}}</p>',
'<p class="cortana-search-path">{{breadcrumb}}</p>',
'</a>'
].join(''),
updater: function () {
/* navigate to the selected item */
alert('ok');
},
engine: Hogan
}).on('typeahead:selected', function(event, data) {
window.location.replace(data.path);
});
}) (jQuery_no_conflict);
</script>
<script type="text/javascript" src="js/vendors.min.js"></script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
;;; gv.el --- generalized variables -*- lexical-binding: t -*-
;; Copyright (C) 2012-2017 Free Software Foundation, Inc.
;; Author: Stefan Monnier <[email protected]>
;; Keywords: extensions
;; Package: emacs
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This is a re-implementation of the setf machinery using a different
;; underlying approach than the one used earlier in CL, which was based on
;; define-setf-expander.
;; `define-setf-expander' makes every "place-expander" return a 5-tuple
;; (VARS VALUES STORES GETTER SETTER)
;; where STORES is a list with a single variable (Common-Lisp allows multiple
;; variables for use with multiple-return-values, but this is rarely used and
;; not applicable to Elisp).
;; It basically says that GETTER is an expression that returns the place's
;; value, and (lambda STORES SETTER) is an expression that assigns the value(s)
;; passed to that function to the place, and that you need to wrap the whole
;; thing within a `(let* ,(zip VARS VALUES) ...).
;;
;; Instead, we use here a higher-order approach: instead
;; of a 5-tuple, a place-expander returns a function.
;; If you think about types, the old approach return things of type
;; {vars: List Var, values: List Exp,
;; stores: List Var, getter: Exp, setter: Exp}
;; whereas the new approach returns a function of type
;; (do: ((getter: Exp, setter: ((store: Exp) -> Exp)) -> Exp)) -> Exp.
;; You can get the new function from the old 5-tuple with something like:
;; (lambda (do)
;; `(let* ,(zip VARS VALUES)
;; (funcall do GETTER (lambda ,STORES ,SETTER))))
;; You can't easily do the reverse, because this new approach is more
;; expressive than the old one, so we can't provide a backward-compatible
;; get-setf-method.
;;
;; While it may seem intimidating for people not used to higher-order
;; functions, you will quickly see that its use (especially with the
;; `gv-letplace' macro) is actually much easier and more elegant than the old
;; approach which is clunky and often leads to unreadable code.
;; Food for thought: the syntax of places does not actually conflict with the
;; pcase patterns. The `cons' gv works just like a `(,a . ,b) pcase
;; pattern, and actually the `logand' gv is even closer since it should
;; arguably fail when trying to set a value outside of the mask.
;; Generally, places are used for destructors (gethash, aref, car, ...)
;; whereas pcase patterns are used for constructors (backquote, constants,
;; vectors, ...).
;;; Code:
(require 'macroexp)
;; What we call a "gvar" is basically a function of type "(getter * setter ->
;; code) -> code", where "getter" is code and setter is "code -> code".
;; (defvar gv--macro-environment nil
;; "Macro expanders for generalized variables.")
(define-error 'gv-invalid-place "%S is not a valid place expression")
;;;###autoload
(defun gv-get (place do)
"Build the code that applies DO to PLACE.
PLACE must be a valid generalized variable.
DO must be a function; it will be called with 2 arguments: GETTER and SETTER,
where GETTER is a (copyable) Elisp expression that returns the value of PLACE,
and SETTER is a function which returns the code to set PLACE when called
with a (not necessarily copyable) Elisp expression that returns the value to
set it to.
DO must return an Elisp expression."
(cond
((symbolp place) (funcall do place (lambda (v) `(setq ,place ,v))))
((not (consp place)) (signal 'gv-invalid-place (list place)))
(t
(let* ((head (car place))
(gf (function-get head 'gv-expander 'autoload)))
(if gf (apply gf do (cdr place))
(let ((me (macroexpand-1 place
;; (append macroexpand-all-environment
;; gv--macro-environment)
macroexpand-all-environment)))
(if (and (eq me place) (get head 'compiler-macro))
;; Expand compiler macros: this takes care of all the accessors
;; defined via cl-defsubst, such as cXXXr and defstruct slots.
(setq me (apply (get head 'compiler-macro) place (cdr place))))
(if (and (eq me place) (fboundp head)
(symbolp (symbol-function head)))
;; Follow aliases.
(setq me (cons (symbol-function head) (cdr place))))
(if (eq me place)
(if (and (symbolp head) (get head 'setf-method))
(error "Incompatible place needs recompilation: %S" head)
(let* ((setter (gv-setter head)))
(gv--defsetter head (lambda (&rest args) `(,setter ,@args))
do (cdr place))))
(gv-get me do))))))))
(defun gv-setter (name)
;; The name taken from Scheme's SRFI-17. Actually, for SRFI-17, the argument
;; could/should be a function value rather than a symbol.
"Return the symbol where the (setf NAME) function should be placed."
(if (get name 'gv-expander)
(error "gv-expander conflicts with (setf %S)" name))
;; FIXME: This is wrong if `name' is uninterned (or interned elsewhere).
(intern (format "(setf %s)" name)))
;;;###autoload
(defmacro gv-letplace (vars place &rest body)
"Build the code manipulating the generalized variable PLACE.
GETTER will be bound to a copyable expression that returns the value
of PLACE.
SETTER will be bound to a function that takes an expression V and returns
a new expression that sets PLACE to V.
BODY should return some Elisp expression E manipulating PLACE via GETTER
and SETTER.
The returned value will then be an Elisp expression that first evaluates
all the parts of PLACE that can be evaluated and then runs E.
\(fn (GETTER SETTER) PLACE &rest BODY)"
(declare (indent 2) (debug (sexp form body)))
`(gv-get ,place (lambda ,vars ,@body)))
;; Different ways to declare a generalized variable.
;;;###autoload
(defmacro gv-define-expander (name handler)
"Use HANDLER to handle NAME as a generalized var.
NAME is a symbol: the name of a function, macro, or special form.
HANDLER is a function which takes an argument DO followed by the same
arguments as NAME. DO is a function as defined in `gv-get'."
(declare (indent 1) (debug (sexp form)))
;; Use eval-and-compile so the method can be used in the same file as it
;; is defined.
;; FIXME: Just like byte-compile-macro-environment, we should have something
;; like byte-compile-symbolprop-environment so as to handle these things
;; cleanly without affecting the running Emacs.
`(eval-and-compile (put ',name 'gv-expander ,handler)))
;;;###autoload
(defun gv--defun-declaration (symbol name args handler &optional fix)
`(progn
;; No need to autoload this part, since gv-get will auto-load the
;; function's definition before checking the `gv-expander' property.
:autoload-end
,(pcase (cons symbol handler)
(`(gv-expander . (lambda (,do) . ,body))
`(gv-define-expander ,name (lambda (,do ,@args) ,@body)))
(`(gv-expander . ,(pred symbolp))
`(gv-define-expander ,name #',handler))
(`(gv-setter . (lambda (,store) . ,body))
`(gv-define-setter ,name (,store ,@args) ,@body))
(`(gv-setter . ,(pred symbolp))
`(gv-define-simple-setter ,name ,handler ,fix))
;; (`(expand ,expander) `(gv-define-expand ,name ,expander))
(_ (message "Unknown %s declaration %S" symbol handler) nil))))
;;;###autoload
(or (assq 'gv-expander defun-declarations-alist)
(let ((x `(gv-expander
,(apply-partially #'gv--defun-declaration 'gv-expander))))
(push x macro-declarations-alist)
(push x defun-declarations-alist)))
;;;###autoload
(or (assq 'gv-setter defun-declarations-alist)
(push `(gv-setter ,(apply-partially #'gv--defun-declaration 'gv-setter))
defun-declarations-alist))
;; (defmacro gv-define-expand (name expander)
;; "Use EXPANDER to handle NAME as a generalized var.
;; NAME is a symbol: the name of a function, macro, or special form.
;; EXPANDER is a function that will be called as a macro-expander to reduce
;; uses of NAME to some other generalized variable."
;; (declare (debug (sexp form)))
;; `(eval-and-compile
;; (if (not (boundp 'gv--macro-environment))
;; (setq gv--macro-environment nil))
;; (push (cons ',name ,expander) gv--macro-environment)))
(defun gv--defsetter (name setter do args &optional vars)
"Helper function used by code generated by `gv-define-setter'.
NAME is the name of the getter function.
SETTER is a function that generates the code for the setter.
NAME accept ARGS as arguments and SETTER accepts (NEWVAL . ARGS).
VARS is used internally for recursive calls."
(if (null args)
(let ((vars (nreverse vars)))
(funcall do `(,name ,@vars) (lambda (v) (apply setter v vars))))
;; FIXME: Often it would be OK to skip this `let', but in general,
;; `do' may have all kinds of side-effects.
(macroexp-let2 nil v (car args)
(gv--defsetter name setter do (cdr args) (cons v vars)))))
;;;###autoload
(defmacro gv-define-setter (name arglist &rest body)
"Define a setter method for generalized variable NAME.
This macro is an easy-to-use substitute for `gv-define-expander' that works
well for simple place forms.
Assignments of VAL to (NAME ARGS...) are expanded by binding the argument
forms (VAL ARGS...) according to ARGLIST, then executing BODY, which must
return a Lisp form that does the assignment.
The first arg in ARGLIST (the one that receives VAL) receives an expression
which can do arbitrary things, whereas the other arguments are all guaranteed
to be pure and copyable. Example use:
(gv-define-setter aref (v a i) \\=`(aset ,a ,i ,v))"
(declare (indent 2) (debug (&define name sexp body)))
`(gv-define-expander ,name
(lambda (do &rest args)
(gv--defsetter ',name (lambda ,arglist ,@body) do args))))
;;;###autoload
(defmacro gv-define-simple-setter (name setter &optional fix-return)
"Define a simple setter method for generalized variable NAME.
This macro is an easy-to-use substitute for `gv-define-expander' that works
well for simple place forms. Assignments of VAL to (NAME ARGS...) are
turned into calls of the form (SETTER ARGS... VAL).
If FIX-RETURN is non-nil, then SETTER is not assumed to return VAL and
instead the assignment is turned into something equivalent to
(let ((temp VAL))
(SETTER ARGS... temp)
temp)
so as to preserve the semantics of `setf'."
(declare (debug (sexp (&or symbolp lambda-expr) &optional sexp)))
(when (eq 'lambda (car-safe setter))
(message "Use `gv-define-setter' or name %s's setter function" name))
`(gv-define-setter ,name (val &rest args)
,(if fix-return
`(macroexp-let2 nil v val
`(progn
(,',setter ,@args ,v)
,v))
``(,',setter ,@args ,val))))
;;; Typical operations on generalized variables.
;;;###autoload
(defmacro setf (&rest args)
"Set each PLACE to the value of its VAL.
This is a generalized version of `setq'; the PLACEs may be symbolic
references such as (car x) or (aref x i), as well as plain symbols.
For example, (setf (cadr x) y) is equivalent to (setcar (cdr x) y).
The return value is the last VAL in the list.
\(fn PLACE VAL PLACE VAL ...)"
(declare (debug (&rest [gv-place form])))
(if (/= (logand (length args) 1) 0)
(signal 'wrong-number-of-arguments (list 'setf (length args))))
(if (and args (null (cddr args)))
(let ((place (pop args))
(val (car args)))
(gv-letplace (_getter setter) place
(funcall setter val)))
(let ((sets nil))
(while args (push `(setf ,(pop args) ,(pop args)) sets))
(cons 'progn (nreverse sets)))))
;; (defmacro gv-pushnew! (val place)
;; "Like `gv-push!' but only adds VAL if it's not yet in PLACE.
;; Presence is checked with `member'.
;; The return value is unspecified."
;; (declare (debug (form gv-place)))
;; (macroexp-let2 macroexp-copyable-p v val
;; (gv-letplace (getter setter) place
;; `(if (member ,v ,getter) nil
;; ,(funcall setter `(cons ,v ,getter))))))
;; (defmacro gv-inc! (place &optional val)
;; "Increment PLACE by VAL (default to 1)."
;; (declare (debug (gv-place &optional form)))
;; (gv-letplace (getter setter) place
;; (funcall setter `(+ ,getter ,(or val 1)))))
;; (defmacro gv-dec! (place &optional val)
;; "Decrement PLACE by VAL (default to 1)."
;; (declare (debug (gv-place &optional form)))
;; (gv-letplace (getter setter) place
;; (funcall setter `(- ,getter ,(or val 1)))))
;; For Edebug, the idea is to let Edebug instrument gv-places just like it does
;; for normal expressions, and then give it a gv-expander to DTRT.
;; Maybe this should really be in edebug.el rather than here.
;; Autoload this `put' since a user might use C-u C-M-x on an expression
;; containing a non-trivial `push' even before gv.el was loaded.
;;;###autoload
(put 'gv-place 'edebug-form-spec 'edebug-match-form)
;; CL did the equivalent of:
;;(gv-define-macroexpand edebug-after (lambda (before index place) place))
(put 'edebug-after 'gv-expander
(lambda (do before index place)
(gv-letplace (getter setter) place
(funcall do `(edebug-after ,before ,index ,getter)
setter))))
;;; The common generalized variables.
(gv-define-simple-setter aref aset)
(gv-define-simple-setter car setcar)
(gv-define-simple-setter cdr setcdr)
;; FIXME: add compiler-macros for `cXXr' instead!
(gv-define-setter caar (val x) `(setcar (car ,x) ,val))
(gv-define-setter cadr (val x) `(setcar (cdr ,x) ,val))
(gv-define-setter cdar (val x) `(setcdr (car ,x) ,val))
(gv-define-setter cddr (val x) `(setcdr (cdr ,x) ,val))
(gv-define-setter elt (store seq n)
`(if (listp ,seq) (setcar (nthcdr ,n ,seq) ,store)
(aset ,seq ,n ,store)))
(gv-define-simple-setter get put)
(gv-define-setter gethash (val k h &optional _d) `(puthash ,k ,val ,h))
;; (gv-define-expand nth (lambda (idx list) `(car (nthcdr ,idx ,list))))
(put 'nth 'gv-expander
(lambda (do idx list)
(macroexp-let2 nil c `(nthcdr ,idx ,list)
(funcall do `(car ,c) (lambda (v) `(setcar ,c ,v))))))
(gv-define-simple-setter symbol-function fset)
(gv-define-simple-setter symbol-plist setplist)
(gv-define-simple-setter symbol-value set)
(put 'nthcdr 'gv-expander
(lambda (do n place)
(macroexp-let2 nil idx n
(gv-letplace (getter setter) place
(funcall do `(nthcdr ,idx ,getter)
(lambda (v) `(if (<= ,idx 0) ,(funcall setter v)
(setcdr (nthcdr (1- ,idx) ,getter) ,v))))))))
;;; Elisp-specific generalized variables.
(gv-define-simple-setter default-value set-default)
(gv-define-simple-setter frame-parameter set-frame-parameter 'fix)
(gv-define-simple-setter terminal-parameter set-terminal-parameter)
(gv-define-simple-setter keymap-parent set-keymap-parent)
(gv-define-simple-setter match-data set-match-data 'fix)
(gv-define-simple-setter overlay-get overlay-put)
(gv-define-setter overlay-start (store ov)
`(progn (move-overlay ,ov ,store (overlay-end ,ov)) ,store))
(gv-define-setter overlay-end (store ov)
`(progn (move-overlay ,ov (overlay-start ,ov) ,store) ,store))
(gv-define-simple-setter process-buffer set-process-buffer)
(gv-define-simple-setter process-filter set-process-filter)
(gv-define-simple-setter process-sentinel set-process-sentinel)
(gv-define-simple-setter process-get process-put)
(gv-define-simple-setter window-parameter set-window-parameter)
(gv-define-setter window-buffer (v &optional w)
(macroexp-let2 nil v v
`(progn (set-window-buffer ,w ,v) ,v)))
(gv-define-setter window-display-table (v &optional w)
(macroexp-let2 nil v v
`(progn (set-window-display-table ,w ,v) ,v)))
(gv-define-setter window-dedicated-p (v &optional w)
`(set-window-dedicated-p ,w ,v))
(gv-define-setter window-hscroll (v &optional w) `(set-window-hscroll ,w ,v))
(gv-define-setter window-point (v &optional w) `(set-window-point ,w ,v))
(gv-define-setter window-start (v &optional w) `(set-window-start ,w ,v))
(gv-define-setter buffer-local-value (val var buf)
(macroexp-let2 nil v val
`(with-current-buffer ,buf (set (make-local-variable ,var) ,v))))
(gv-define-expander alist-get
(lambda (do key alist &optional default remove)
(macroexp-let2 macroexp-copyable-p k key
(gv-letplace (getter setter) alist
(macroexp-let2 nil p `(assq ,k ,getter)
(funcall do (if (null default) `(cdr ,p)
`(if ,p (cdr ,p) ,default))
(lambda (v)
(macroexp-let2 nil v v
(let ((set-exp
`(if ,p (setcdr ,p ,v)
,(funcall setter
`(cons (setq ,p (cons ,k ,v))
,getter)))))
(cond
((null remove) set-exp)
((or (eql v default)
(and (eq (car-safe v) 'quote)
(eq (car-safe default) 'quote)
(eql (cadr v) (cadr default))))
`(if ,p ,(funcall setter `(delq ,p ,getter))))
(t
`(cond
((not (eql ,default ,v)) ,set-exp)
(,p ,(funcall setter
`(delq ,p ,getter)))))))))))))))
;;; Some occasionally handy extensions.
;; While several of the "places" below are not terribly useful for direct use,
;; they can show up as the output of the macro expansion of reasonable places,
;; such as struct-accessors.
(put 'progn 'gv-expander
(lambda (do &rest exps)
(let ((start (butlast exps))
(end (car (last exps))))
(if (null start) (gv-get end do)
`(progn ,@start ,(gv-get end do))))))
(let ((let-expander
(lambda (letsym)
(lambda (do bindings &rest body)
`(,letsym ,bindings
,@(macroexp-unprogn
(gv-get (macroexp-progn body) do)))))))
(put 'let 'gv-expander (funcall let-expander 'let))
(put 'let* 'gv-expander (funcall let-expander 'let*)))
(put 'if 'gv-expander
(lambda (do test then &rest else)
(if (or (not lexical-binding) ;The other code requires lexical-binding.
(macroexp-small-p (funcall do 'dummy (lambda (_) 'dummy))))
;; This duplicates the `do' code, which is a problem if that
;; code is large, but otherwise results in more efficient code.
`(if ,test ,(gv-get then do)
,@(macroexp-unprogn (gv-get (macroexp-progn else) do)))
(let ((v (make-symbol "v")))
(macroexp-let2 nil
gv `(if ,test ,(gv-letplace (getter setter) then
`(cons (lambda () ,getter)
(lambda (,v) ,(funcall setter v))))
,(gv-letplace (getter setter) (macroexp-progn else)
`(cons (lambda () ,getter)
(lambda (,v) ,(funcall setter v)))))
(funcall do `(funcall (car ,gv))
(lambda (v) `(funcall (cdr ,gv) ,v))))))))
(put 'cond 'gv-expander
(lambda (do &rest branches)
(if (or (not lexical-binding) ;The other code requires lexical-binding.
(macroexp-small-p (funcall do 'dummy (lambda (_) 'dummy))))
;; This duplicates the `do' code, which is a problem if that
;; code is large, but otherwise results in more efficient code.
`(cond
,@(mapcar (lambda (branch)
(if (cdr branch)
(cons (car branch)
(macroexp-unprogn
(gv-get (macroexp-progn (cdr branch)) do)))
(gv-get (car branch) do)))
branches))
(let ((v (make-symbol "v")))
(macroexp-let2 nil
gv `(cond
,@(mapcar
(lambda (branch)
(if (cdr branch)
`(,(car branch)
,@(macroexp-unprogn
(gv-letplace (getter setter)
(macroexp-progn (cdr branch))
`(cons (lambda () ,getter)
(lambda (,v) ,(funcall setter v))))))
(gv-letplace (getter setter)
(car branch)
`(cons (lambda () ,getter)
(lambda (,v) ,(funcall setter v))))))
branches))
(funcall do `(funcall (car ,gv))
(lambda (v) `(funcall (cdr ,gv) ,v))))))))
(defmacro gv-synthetic-place (getter setter)
"Special place described by its setter and getter.
GETTER and SETTER (typically obtained via `gv-letplace') get and
set that place. I.e. This macro allows you to do the \"reverse\" of what
`gv-letplace' does.
This macro only makes sense when used in a place."
(declare (gv-expander funcall))
(ignore setter)
getter)
(defmacro gv-delay-error (place)
"Special place which delays the `gv-invalid-place' error to run-time.
It behaves just like PLACE except that in case PLACE is not a valid place,
the `gv-invalid-place' error will only be signaled at run-time when (and if)
we try to use the setter.
This macro only makes sense when used in a place."
(declare
(gv-expander
(lambda (do)
(condition-case err
(gv-get place do)
(gv-invalid-place
;; Delay the error until we try to use the setter.
(funcall do place (lambda (_) `(signal ',(car err) ',(cdr err)))))))))
place)
;;; Even more debatable extensions.
(put 'cons 'gv-expander
(lambda (do a d)
(gv-letplace (agetter asetter) a
(gv-letplace (dgetter dsetter) d
(funcall do
`(cons ,agetter ,dgetter)
(lambda (v) `(progn
,(funcall asetter `(car ,v))
,(funcall dsetter `(cdr ,v)))))))))
(put 'logand 'gv-expander
(lambda (do place &rest masks)
(gv-letplace (getter setter) place
(macroexp-let2 macroexp-copyable-p
mask (if (cdr masks) `(logand ,@masks) (car masks))
(funcall
do `(logand ,getter ,mask)
(lambda (v)
(funcall setter
`(logior (logand ,v ,mask)
(logand ,getter (lognot ,mask))))))))))
;;; References
;;;###autoload
(defmacro gv-ref (place)
"Return a reference to PLACE.
This is like the `&' operator of the C language.
Note: this only works reliably with lexical binding mode, except for very
simple PLACEs such as (symbol-function \\='foo) which will also work in dynamic
binding mode."
(let ((code
(gv-letplace (getter setter) place
`(cons (lambda () ,getter)
(lambda (gv--val) ,(funcall setter 'gv--val))))))
(if (or lexical-binding
;; If `code' still starts with `cons' then presumably gv-letplace
;; did not add any new let-bindings, so the `lambda's don't capture
;; any new variables. As a consequence, the code probably works in
;; dynamic binding mode as well.
(eq (car-safe code) 'cons))
code
(macroexp--warn-and-return
"Use of gv-ref probably requires lexical-binding"
code))))
(defsubst gv-deref (ref)
"Dereference REF, returning the referenced value.
This is like the `*' operator of the C language.
REF must have been previously obtained with `gv-ref'."
(funcall (car ref)))
;; Don't use `declare' because it seems to introduce circularity problems:
;; Warning: Eager macro-expansion skipped due to cycle:
;; … => (load "gv.el") => (macroexpand-all (defsubst gv-deref …)) => (macroexpand (defun …)) => (load "gv.el")
(gv-define-setter gv-deref (v ref) `(funcall (cdr ,ref) ,v))
;; (defmacro gv-letref (vars place &rest body)
;; (declare (indent 2) (debug (sexp form &rest body)))
;; (require 'cl-lib) ;Can't require cl-lib at top-level for bootstrap reasons!
;; (gv-letplace (getter setter) place
;; `(cl-macrolet ((,(nth 0 vars) () ',getter)
;; (,(nth 1 vars) (v) (funcall ',setter v)))
;; ,@body)))
(provide 'gv)
;;; gv.el ends here
| {
"pile_set_name": "Github"
} |
\version "2.16.0"
violaSecondMov = \relative g {
\key c \major
\clef alto
g4(\p f)
| e r
| g2 ~
| g4 r
| e d
| c( g'8.[ f16)]
| e8[( f)] e[( a)]
| g4 ~ g8 r
| f2(
% 10
| e8) r r4
| R2*2
| b'4( a) ~
| a8 r r4
| e4( f)
| e8 r r4
| c'4(\p f)
| e8 r r4
| b( c)
% 20
| g8 r r4
| f'4( e
| d g)
| a8[ b16( gis)] a8[ f]
| g[ c,16( e)] g,8 r
| f'2(
| e8) r r4
| f4 r32 e32[( f g)] f16[ f]
| e8 r r4
| r32 fisis[( gis a)] gis16[ gis] r32 gis[( a b)] a16[ a]
% 30
| f8 r r4
| r32 fis,[( g a)] g16[ g] r32 fis[( g a)] g16[ g]
| c32[(\f d) es-. es-.] es[-. es-. es-. es-.] g,4-> ~
| g8 r r4
| as32[( bes) c c] c[ c c c] g4(
| es8) r r4
| as:32\f g:
| as8[ as'] g4(
| f)( es8)[ fis,]
| g8 r r4
% 40
| r32 g'[ g g] g[ g g g] fis[( g) g g] fis[( g) g g]
| \repeat unfold 2 { r32 cis,[( d es)] d16[ d] }
| r32 eis[( fis g)] fis16[ fis] r32 fis[( g a)] g16[ g]
| fis8 r r4
| c32[( b c d)] c16[ c] c32[( b c d)] c16[ c]
| b d,[( g d] g[ d g d)]
\tag #'autograph {
| \repeat "tremolo" 4 { g16( d) }
| \repeat "tremolo" 4 { a'( d,) }
| \repeat "tremolo" 4 { g( d) }
}
\tag #'edited {
| g16[( d g d)] g[( d g d)]
| a'[( d, a' d,)] a'[( d, a' d,)]
| g[( d g d)] g[( d g d)]
}
| e[( a cis a] cis[ a cis a)]
% 50
| d8 r e16 r e r
| d fis[( eis e)] d[( c! b a)]
\tag #'autograph {
| \repeat "percent" 2 { \repeat "tremolo" 4 { g16( d) } }
| \repeat "tremolo" 4 { a'16 d, }
| \repeat "tremolo" 4 { g( d) }
| \repeat "tremolo" 4 { g( b) }
}
\tag #'edited {
| \repeat unfold 2 { g16[( d g d) g( d g d)] }
% [E] Slurs not present in the autograph
| a'16[( d, a' d,)] a'[( d, a' d,)]
| g[( d g d)] g[( d g d)]
| g[( b g b)] g[( b g b)]
}
| g8 r <a c> r
\tag #'autograph {
| <g b>16 s r s g s r s \bar "" \noBreak % [R] There is a mistake here!
| g s r s g s r s
\set Score.currentBarNumber = #59
}
\tag #'edited {
| <g b>16 r r8 g16 r r8
| g16 r r8 g16 r r8
}
| r32 d[(\f es f)] es16[ es] r32 dis[( e f)] e16[ e]
% 60
| r32 e32[( f g)] f[ f f f] r32 eis[( fis g)] fis[ fis fis fis]
\tag #'autograph {
| g16 s r s g s r s \bar "" \noBreak % [R] Ditto
| g s r s g s r s
\set Score.currentBarNumber = #62
}
\tag #'edited {
| g16 r r8 g16 r r8
| g16 r r8 g16 r r8
}
| r32 e[( f! g)] f16[ f] r32 cis32[( d e)] d16[ d]
| r32 d![( es f!)] es[ es es es] r32 cis[( d e)] d[ d d d]
| r8 r32 dis[ dis dis] e4 ~
\tag #'autograph {
| e8[ e] % [R] eis? Or better: eis32 eis es eis
}
\tag #'edited {
| e8[ eis] % [E] Maybe eis32 eis es eis
}
fis4 ~
| fis8[ fis] % [R] Maybe fis32 fis fis fis
g4
| g8[ e(] fis)[ d]
| d''[( b)] g[( e)]
| r32 b[( c d)] c[ c c c] r b[( c d)] c[ c c c]
% 70
| r dis[( e fis)] e[ e e e] r dis[( e fis)] e[ e e e]
| d8.[\f d32 d] d8.[ d32 d]
| <d f!>8.[ <d f>32 <d f>] <d f>8.[ <d f>32 <d f>]
| <d f!>2 ~
| <d f>4 r
| bes4( as
| g) r
| bes2 ~
| bes4 r
| bes2(
% 80
| es,4) bes'8.[( as16)]
| g8[( as g)] c
| bes4 ~ bes8 r
| r32 as[( c bes)] as4 as16[( g32 f)]
| g8 r r4
| r32 dis[( e! f] g[ as bes b)] c8.[( bes16)]
| as4~ as16 as[-.\p as-. as-.]
| as8 r32 c[-. d!-. es-.] c,8 r32 c'[-. d-. es-.]
| a,!8[( as)] g[( fis)]
| g16 r <b d>8 <c es>4
% 90
| r32 ces[( d es)] d[ d d d] r d[( es f)] es[ es es es]
| d8 r r4
\tag #'autograph {
% [R] There is a mistake here!
| f,32[( e f g)] f16[ f] f32[( e f g)] f16[ f]
| \repeat "percent" 2 { \repeat "tremolo" 4 { e16( g) } }
| \repeat "tremolo" 4 { f( g) }
| \repeat "tremolo" 4 { e( g) }
| \repeat "tremolo" 4 { fis( a) }
}
\tag #'edited {
| f32[( e f g)] f16[ f] f32[( e f g)] f16[ f]
| \repeat unfold 2 { e16[( g e g)] e[( g e g)] }
| f[( g f g)] f[( g f g)]
| e[( g e g)] e[( g e g)]
| fis[( a fis a)] fis[( a fis a)]
}
| g8 r c16 r fis, r
\tag #'autograph {
| g d'[( cis c)] b[( a g f)] % [R] Last f with a cautionary natural?
}
\tag #'edited {
| g d'[( cis c)] b[( a g f!)] % [E]
}
% 100
| e[( e') c( g)] c[( g c g)]
\tag #'autograph {
| \repeat "tremolo" 4 { c( g) }
| \repeat "tremolo" 4 { b( g) }
| \repeat "tremolo" 4 { c( e) }
| \repeat "tremolo" 4 { d( f) }
}
\tag #'edited {
| c[( g c g)] c[( g c g)]
| b[( g b g)] b[( g b g)]
| c[( e c e)] c[( e c e)]
| d[( f d f)] d[( f d f)]
}
| c8 r g r
| r32 dis[-. e-. f-.] e8[( e'16)] r r8
| r32 e,[-. f-. g] f8[( f'16)] r r8
| r32 fis,[-. g-. a-.] g8[( g'16)] r r8
| a,8[( fis)] d'4
% 110
\tag #'autograph {
| c16[( s b s a s g) s] \bar "" \noBreak % [R] There is a mistake here!
| f[( s e s d s c) s]
\set Score.currentBarNumber = #111
| f s r s d' s r s \bar "" \noBreak % [R] Ditto
| d s r s d s r s
\set Score.currentBarNumber = #112
}
\tag #'edited {
| c8[( b a g)] f[( e d c)]
| f16 r r8 d'16 r r8
| d16 r r8 d16 r r8
}
| d8 r r4
| c2(
| d16)[( c b a)] g8[( d')]
\tag #'autograph {
| \repeat "percent" 2
{ c32[( b c d)] c16[-. c-.] c32[( b c d)] c16[-. c-.] }
}
\tag #'edited {
| \repeat unfold 2
{ c32[( b c d)] c16[-. c-.] c32[( b c d)] c16[-. c-.] }
}
| c8 c[( d e)]
| f4( f,)
| e( d)
% 120
| c g'8.[( f16)] % [R] The slur is different from bar 6
| e2(->
| f8) r b16[( a)] g[( f)]
| e4( f)
| e8 r r4
| f2(
\tag #'autograph {
| e8) r r4_ \markup{\italic "dim."}
}
\tag #'edited {
| e8) r r4 % [E]
}
| d32[( cis d e)] d16[-. d-.] d32[( cis d e)] d16[-. d-.]
| e8 r e8[(-.\p e)-.]
| e r e r
% 130
| e4 r\fermata
\bar "||"
}
| {
"pile_set_name": "Github"
} |
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.aurora.scheduler.http;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableSet;
import org.apache.aurora.gen.AssignedTask;
import org.apache.aurora.gen.ScheduleStatus;
import org.apache.aurora.gen.ScheduledTask;
import org.apache.aurora.gen.TaskConfig;
import org.apache.aurora.scheduler.storage.entities.IJobKey;
import org.apache.aurora.scheduler.storage.entities.IScheduledTask;
import static org.apache.aurora.gen.Resource.diskMb;
import static org.apache.aurora.gen.Resource.numCpus;
import static org.apache.aurora.gen.Resource.ramMb;
public final class TestUtils {
private TestUtils() { }
/**
* Make task and set status to the given {@link ScheduleStatus}.
*
* @param jobKey The task group key.
* @param id The task id.
* @param instanceId The id of the instance of the task.
* @param taskStatus The status of the task.
* @param numCPUs The number of CPUs required for the task.
* @param ramMB The amount of RAM (in MegaBytes) required for the task.
* @param diskMB The amount of disk space (in MegaBytes) required for the task.
* @return Task.
*/
@VisibleForTesting
public static IScheduledTask makeTask(
IJobKey jobKey, String id, int instanceId,
ScheduleStatus taskStatus, double numCPUs, long ramMB, long diskMB) {
return IScheduledTask.build(new ScheduledTask()
.setStatus(taskStatus)
.setAssignedTask(new AssignedTask()
.setInstanceId(instanceId)
.setTaskId(id)
.setTask(new TaskConfig()
.setJob(jobKey.newBuilder())
.setResources(ImmutableSet.of(
numCpus(numCPUs),
ramMb(ramMB),
diskMb(diskMB))))));
}
}
| {
"pile_set_name": "Github"
} |
// Copyright David Abrahams 2006. 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_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
# define BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
# include <boost/config.hpp>
# include <boost/preprocessor/cat.hpp>
# include <boost/concept/detail/backward_compatibility.hpp>
# ifdef BOOST_OLD_CONCEPT_SUPPORT
# include <boost/concept/detail/has_constraints.hpp>
# include <boost/mpl/if.hpp>
# endif
// This implementation works on Comeau and GCC, all the way back to
// 2.95
namespace boost { namespace concepts {
template <class ModelFn>
struct requirement_;
namespace detail
{
template <void(*)()> struct instantiate {};
}
template <class Model>
struct requirement
{
static void failed() { ((Model*)0)->~Model(); }
};
struct failed {};
template <class Model>
struct requirement<failed ************ Model::************>
{
static void failed() { ((Model*)0)->~Model(); }
};
# ifdef BOOST_OLD_CONCEPT_SUPPORT
template <class Model>
struct constraint
{
static void failed() { ((Model*)0)->constraints(); }
};
template <class Model>
struct requirement_<void(*)(Model)>
: mpl::if_<
concepts::not_satisfied<Model>
, constraint<Model>
, requirement<failed ************ Model::************>
>::type
{};
# else
// For GCC-2.x, these can't have exactly the same name
template <class Model>
struct requirement_<void(*)(Model)>
: requirement<failed ************ Model::************>
{};
# endif
# define BOOST_CONCEPT_ASSERT_FN( ModelFnPtr ) \
typedef ::boost::concepts::detail::instantiate< \
&::boost::concepts::requirement_<ModelFnPtr>::failed> \
BOOST_PP_CAT(boost_concept_check,__LINE__) \
BOOST_ATTRIBUTE_UNUSED
}}
#endif // BOOST_CONCEPT_DETAIL_GENERAL_DWA2006429_HPP
| {
"pile_set_name": "Github"
} |
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the components of NT OS/2
#
!INCLUDE $(NTMAKEENV)\makefile.def
| {
"pile_set_name": "Github"
} |
package otto
import (
"strconv"
"unicode/utf8"
)
type _stringObject interface {
Length() int
At(int) rune
String() string
}
type _stringASCII string
func (str _stringASCII) Length() int {
return len(str)
}
func (str _stringASCII) At(at int) rune {
return rune(str[at])
}
func (str _stringASCII) String() string {
return string(str)
}
type _stringWide struct {
string string
length int
runes []rune
}
func (str _stringWide) Length() int {
return str.length
}
func (str _stringWide) At(at int) rune {
if str.runes == nil {
str.runes = []rune(str.string)
}
return str.runes[at]
}
func (str _stringWide) String() string {
return str.string
}
func _newStringObject(str string) _stringObject {
for i := 0; i < len(str); i++ {
if str[i] >= utf8.RuneSelf {
goto wide
}
}
return _stringASCII(str)
wide:
return &_stringWide{
string: str,
length: utf8.RuneCountInString(str),
}
}
func stringAt(str _stringObject, index int) rune {
if 0 <= index && index < str.Length() {
return str.At(index)
}
return utf8.RuneError
}
func (runtime *_runtime) newStringObject(value Value) *_object {
str := _newStringObject(value.string())
self := runtime.newClassObject("String")
self.defineProperty("length", toValue_int(str.Length()), 0, false)
self.objectClass = _classString
self.value = str
return self
}
func (self *_object) stringValue() _stringObject {
if str, ok := self.value.(_stringObject); ok {
return str
}
return nil
}
func stringEnumerate(self *_object, all bool, each func(string) bool) {
if str := self.stringValue(); str != nil {
length := str.Length()
for index := 0; index < length; index++ {
if !each(strconv.FormatInt(int64(index), 10)) {
return
}
}
}
objectEnumerate(self, all, each)
}
func stringGetOwnProperty(self *_object, name string) *_property {
if property := objectGetOwnProperty(self, name); property != nil {
return property
}
// TODO Test a string of length >= +int32 + 1?
if index := stringToArrayIndex(name); index >= 0 {
if chr := stringAt(self.stringValue(), int(index)); chr != utf8.RuneError {
return &_property{toValue_string(string(chr)), 0}
}
}
return nil
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_13) on Thu Feb 21 16:35:36 EST 2008 -->
<TITLE>
CompoundResolver
</TITLE>
<META NAME="keywords" CONTENT="polyglot.types.CompoundResolver class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="CompoundResolver";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../polyglot/types/CodeInstance.html" title="interface in polyglot.types"><B>PREV CLASS</B></A>
<A HREF="../../polyglot/types/ConstructorInstance.html" title="interface in polyglot.types"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?polyglot/types/CompoundResolver.html" target="_top"><B>FRAMES</B></A>
<A HREF="CompoundResolver.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
polyglot.types</FONT>
<BR>
Class CompoundResolver</H2>
<PRE>
java.lang.Object
<IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>polyglot.types.CompoundResolver</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../polyglot/types/Resolver.html" title="interface in polyglot.types">Resolver</A>, <A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>CompoundResolver</B><DT>extends java.lang.Object<DT>implements <A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A></DL>
</PRE>
<P>
An <code>CompoundResolver</code> resolves names using more than one
context.
<P>
<P>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../polyglot/types/CompoundResolver.html#head">head</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected <A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../polyglot/types/CompoundResolver.html#tail">tail</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../polyglot/types/CompoundResolver.html#CompoundResolver(polyglot.types.TopLevelResolver, polyglot.types.TopLevelResolver)">CompoundResolver</A></B>(<A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A> head,
<A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A> tail)</CODE>
<BR>
Create a compound resolver.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../polyglot/types/Named.html" title="interface in polyglot.types">Named</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../polyglot/types/CompoundResolver.html#find(java.lang.String)">find</A></B>(java.lang.String name)</CODE>
<BR>
Find a type object by name.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../polyglot/types/CompoundResolver.html#packageExists(java.lang.String)">packageExists</A></B>(java.lang.String name)</CODE>
<BR>
Check if a package exists.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../polyglot/types/CompoundResolver.html#toString()">toString</A></B>()</CODE>
<BR>
</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="head"><!-- --></A><H3>
head</H3>
<PRE>
protected <A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A> <B>head</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="tail"><!-- --></A><H3>
tail</H3>
<PRE>
protected <A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A> <B>tail</B></PRE>
<DL>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="CompoundResolver(polyglot.types.TopLevelResolver, polyglot.types.TopLevelResolver)"><!-- --></A><H3>
CompoundResolver</H3>
<PRE>
public <B>CompoundResolver</B>(<A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A> head,
<A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A> tail)</PRE>
<DL>
<DD>Create a compound resolver.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>head</CODE> - The first resolver to search.<DD><CODE>tail</CODE> - The second resolver to search.</DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public java.lang.String <B>toString</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="packageExists(java.lang.String)"><!-- --></A><H3>
packageExists</H3>
<PRE>
public boolean <B>packageExists</B>(java.lang.String name)</PRE>
<DL>
<DD>Check if a package exists.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../polyglot/types/TopLevelResolver.html#packageExists(java.lang.String)">packageExists</A></CODE> in interface <CODE><A HREF="../../polyglot/types/TopLevelResolver.html" title="interface in polyglot.types">TopLevelResolver</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="find(java.lang.String)"><!-- --></A><H3>
find</H3>
<PRE>
public <A HREF="../../polyglot/types/Named.html" title="interface in polyglot.types">Named</A> <B>find</B>(java.lang.String name)
throws <A HREF="../../polyglot/types/SemanticException.html" title="class in polyglot.types">SemanticException</A></PRE>
<DL>
<DD>Find a type object by name.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../polyglot/types/Resolver.html#find(java.lang.String)">find</A></CODE> in interface <CODE><A HREF="../../polyglot/types/Resolver.html" title="interface in polyglot.types">Resolver</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="../../polyglot/types/SemanticException.html" title="class in polyglot.types">SemanticException</A></CODE></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../polyglot/types/CodeInstance.html" title="interface in polyglot.types"><B>PREV CLASS</B></A>
<A HREF="../../polyglot/types/ConstructorInstance.html" title="interface in polyglot.types"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?polyglot/types/CompoundResolver.html" target="_top"><B>FRAMES</B></A>
<A HREF="CompoundResolver.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| {
"pile_set_name": "Github"
} |
module Facets
SUPPORTED_CORE_OBJECTS = [:host, :hostgroup]
module_function
def registered_facets(facet_type = nil)
facets = configuration.dup
return facets unless facet_type
facets.select { |_, facet| facet.has_configuration(facet_type) }
end
def find_facet_by_class(facet_class, facet_type = :host)
hash = registered_facets(facet_type).select { |_, facet| facet.configuration_for(facet_type).model == facet_class }
hash.first
end
# Registers a new facet. Specify a model class for facet's data.
# You can optionally specify a name that will be used to create
# the assotiation on the host object.
# Use block to add more initialization code for the facet.
# Example:
# Facets.register(ExampleFacet, :example_facet_relation) do
# extend_model ExampleHostExtensions
# add_helper ExampleFacetHelper
# add_tabs :example_tabs
# api_view :list => 'api/v2/example_facets/base', :single => 'api/v2/example_facets/single_host_view'
# template_compatibility_properties :environment_id, :example_proxy_id
# end
# For more detailed description of the registration methods, see <tt>Facets::Entry</tt> documentation.
def register(facet_model = nil, facet_name = nil, &block)
if facet_model.is_a?(Symbol) && facet_name.nil?
facet_name = facet_model
facet_model = nil
end
entry = Facets::Entry.new(facet_model, facet_name)
entry.instance_eval(&block) if block_given?
# create host configuration if no block was specified
entry.configure_host unless block_given?
configuration[entry.name] = entry
publish_entry_created(entry)
# TODO MERGE
# Facets::ManagedHostExtensions.register_facet_relation(Host::Managed, entry)
# Facets::BaseHostExtensions.register_facet_relation(Host::Base, entry)
entry
end
# subscription method to know when a facet entry is created.
# The callback will receive a single parameter - the entry that was created.
def after_entry_created(&block)
entry_created_callbacks << block
end
# declare private module methods.
class << self
private
def configuration
@configuration ||= Hash[entries_from_plugins.map { |entry| [entry.name, entry] }]
end
def entries_from_plugins
Foreman::Plugin.all.map { |plugin| plugin.facets }.compact.flatten
end
def entry_created_callbacks
@entry_created_callbacks ||= []
end
def publish_entry_created(entry)
entry_created_callbacks.each do |callback|
callback.call(entry)
end
end
end
end
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 25 2017 03:49:04).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import "FolderAlbum.h"
@class NSString;
@interface PublishServiceCollection : FolderAlbum
{
NSString *_serviceKey;
NSString *_username;
NSString *_displayName;
}
+ (struct IPAlbumList *)albumsForService:(id)arg1 withUsername:(id)arg2 inDB:(id)arg3;
+ (id)albumsForServiceKey:(id)arg1 withUsername:(id)arg2;
+ (void)determinePublishedSectionNameForDB:(id)arg1;
+ (void)removePublishedAlbum:(id)arg1 fromParent:(id)arg2;
+ (void)sortAndRebuildAlbums:(id)arg1;
+ (BOOL)addPublishedAlbum:(id)arg1 toDB:(id)arg2 select:(BOOL)arg3;
- (void)eject;
- (BOOL)isEjectable;
- (void)setDisplayName:(id)arg1;
- (id)displayName;
- (void)setUsername:(id)arg1;
- (id)username;
- (id)name;
- (void)setServiceKey:(id)arg1;
- (id)serviceKey;
- (void)setParentAlbum:(id)arg1;
- (void)setSubgroup:(id)arg1;
- (BOOL)isInGroup:(unsigned long long)arg1 andSubgroup:(id)arg2;
- (id)subgroup;
- (void)loadSqAlbum:(id)arg1 fromDB:(id)arg2;
- (void)setRKAlbum:(id)arg1;
- (void)_readFromPhotocastURL;
- (void)addToDB:(id)arg1;
- (void)dealloc;
- (id)initWithServiceKey:(id)arg1 andUsername:(id)arg2;
- (id)init;
@end
| {
"pile_set_name": "Github"
} |
/*
* This file is part of wl1251
*
* Copyright (C) 2009 Nokia Corporation
*
* 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.
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include "init.h"
#include "wl12xx_80211.h"
#include "acx.h"
#include "cmd.h"
#include "reg.h"
int wl1251_hw_init_hwenc_config(struct wl1251 *wl)
{
int ret;
ret = wl1251_acx_feature_cfg(wl);
if (ret < 0) {
wl1251_warning("couldn't set feature config");
return ret;
}
ret = wl1251_acx_default_key(wl, wl->default_key);
if (ret < 0) {
wl1251_warning("couldn't set default key");
return ret;
}
return 0;
}
int wl1251_hw_init_templates_config(struct wl1251 *wl)
{
int ret;
u8 partial_vbm[PARTIAL_VBM_MAX];
/* send empty templates for fw memory reservation */
ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, NULL,
sizeof(struct wl12xx_probe_req_template));
if (ret < 0)
return ret;
ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, NULL,
sizeof(struct wl12xx_null_data_template));
if (ret < 0)
return ret;
ret = wl1251_cmd_template_set(wl, CMD_PS_POLL, NULL,
sizeof(struct wl12xx_ps_poll_template));
if (ret < 0)
return ret;
ret = wl1251_cmd_template_set(wl, CMD_QOS_NULL_DATA, NULL,
sizeof
(struct wl12xx_qos_null_data_template));
if (ret < 0)
return ret;
ret = wl1251_cmd_template_set(wl, CMD_PROBE_RESP, NULL,
sizeof
(struct wl12xx_probe_resp_template));
if (ret < 0)
return ret;
ret = wl1251_cmd_template_set(wl, CMD_BEACON, NULL,
sizeof
(struct wl12xx_beacon_template));
if (ret < 0)
return ret;
/* tim templates, first reserve space then allocate an empty one */
memset(partial_vbm, 0, PARTIAL_VBM_MAX);
ret = wl1251_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, PARTIAL_VBM_MAX, 0);
if (ret < 0)
return ret;
ret = wl1251_cmd_vbm(wl, TIM_ELE_ID, partial_vbm, 1, 0);
if (ret < 0)
return ret;
return 0;
}
int wl1251_hw_init_rx_config(struct wl1251 *wl, u32 config, u32 filter)
{
int ret;
ret = wl1251_acx_rx_msdu_life_time(wl, RX_MSDU_LIFETIME_DEF);
if (ret < 0)
return ret;
ret = wl1251_acx_rx_config(wl, config, filter);
if (ret < 0)
return ret;
return 0;
}
int wl1251_hw_init_phy_config(struct wl1251 *wl)
{
int ret;
ret = wl1251_acx_pd_threshold(wl);
if (ret < 0)
return ret;
ret = wl1251_acx_slot(wl, DEFAULT_SLOT_TIME);
if (ret < 0)
return ret;
ret = wl1251_acx_group_address_tbl(wl);
if (ret < 0)
return ret;
ret = wl1251_acx_service_period_timeout(wl);
if (ret < 0)
return ret;
ret = wl1251_acx_rts_threshold(wl, RTS_THRESHOLD_DEF);
if (ret < 0)
return ret;
return 0;
}
int wl1251_hw_init_beacon_filter(struct wl1251 *wl)
{
int ret;
/* disable beacon filtering at this stage */
ret = wl1251_acx_beacon_filter_opt(wl, false);
if (ret < 0)
return ret;
ret = wl1251_acx_beacon_filter_table(wl);
if (ret < 0)
return ret;
return 0;
}
int wl1251_hw_init_pta(struct wl1251 *wl)
{
int ret;
ret = wl1251_acx_sg_enable(wl);
if (ret < 0)
return ret;
ret = wl1251_acx_sg_cfg(wl);
if (ret < 0)
return ret;
return 0;
}
int wl1251_hw_init_energy_detection(struct wl1251 *wl)
{
int ret;
ret = wl1251_acx_cca_threshold(wl);
if (ret < 0)
return ret;
return 0;
}
int wl1251_hw_init_beacon_broadcast(struct wl1251 *wl)
{
int ret;
ret = wl1251_acx_bcn_dtim_options(wl);
if (ret < 0)
return ret;
return 0;
}
int wl1251_hw_init_power_auth(struct wl1251 *wl)
{
return wl1251_acx_sleep_auth(wl, WL1251_PSM_CAM);
}
int wl1251_hw_init_mem_config(struct wl1251 *wl)
{
int ret;
ret = wl1251_acx_mem_cfg(wl);
if (ret < 0)
return ret;
wl->target_mem_map = kzalloc(sizeof(struct wl1251_acx_mem_map),
GFP_KERNEL);
if (!wl->target_mem_map) {
wl1251_error("couldn't allocate target memory map");
return -ENOMEM;
}
/* we now ask for the firmware built memory map */
ret = wl1251_acx_mem_map(wl, wl->target_mem_map,
sizeof(struct wl1251_acx_mem_map));
if (ret < 0) {
wl1251_error("couldn't retrieve firmware memory map");
kfree(wl->target_mem_map);
wl->target_mem_map = NULL;
return ret;
}
return 0;
}
static int wl1251_hw_init_txq_fill(u8 qid,
struct acx_tx_queue_qos_config *config,
u32 num_blocks)
{
config->qid = qid;
switch (qid) {
case QOS_AC_BE:
config->high_threshold =
(QOS_TX_HIGH_BE_DEF * num_blocks) / 100;
config->low_threshold =
(QOS_TX_LOW_BE_DEF * num_blocks) / 100;
break;
case QOS_AC_BK:
config->high_threshold =
(QOS_TX_HIGH_BK_DEF * num_blocks) / 100;
config->low_threshold =
(QOS_TX_LOW_BK_DEF * num_blocks) / 100;
break;
case QOS_AC_VI:
config->high_threshold =
(QOS_TX_HIGH_VI_DEF * num_blocks) / 100;
config->low_threshold =
(QOS_TX_LOW_VI_DEF * num_blocks) / 100;
break;
case QOS_AC_VO:
config->high_threshold =
(QOS_TX_HIGH_VO_DEF * num_blocks) / 100;
config->low_threshold =
(QOS_TX_LOW_VO_DEF * num_blocks) / 100;
break;
default:
wl1251_error("Invalid TX queue id: %d", qid);
return -EINVAL;
}
return 0;
}
static int wl1251_hw_init_tx_queue_config(struct wl1251 *wl)
{
struct acx_tx_queue_qos_config *config;
struct wl1251_acx_mem_map *wl_mem_map = wl->target_mem_map;
int ret, i;
wl1251_debug(DEBUG_ACX, "acx tx queue config");
config = kzalloc(sizeof(*config), GFP_KERNEL);
if (!config) {
ret = -ENOMEM;
goto out;
}
for (i = 0; i < MAX_NUM_OF_AC; i++) {
ret = wl1251_hw_init_txq_fill(i, config,
wl_mem_map->num_tx_mem_blocks);
if (ret < 0)
goto out;
ret = wl1251_cmd_configure(wl, ACX_TX_QUEUE_CFG,
config, sizeof(*config));
if (ret < 0)
goto out;
}
wl1251_acx_ac_cfg(wl, AC_BE, CWMIN_BE, CWMAX_BE, AIFS_DIFS, TXOP_BE);
wl1251_acx_ac_cfg(wl, AC_BK, CWMIN_BK, CWMAX_BK, AIFS_DIFS, TXOP_BK);
wl1251_acx_ac_cfg(wl, AC_VI, CWMIN_VI, CWMAX_VI, AIFS_DIFS, TXOP_VI);
wl1251_acx_ac_cfg(wl, AC_VO, CWMIN_VO, CWMAX_VO, AIFS_DIFS, TXOP_VO);
out:
kfree(config);
return ret;
}
static int wl1251_hw_init_data_path_config(struct wl1251 *wl)
{
int ret;
/* asking for the data path parameters */
wl->data_path = kzalloc(sizeof(struct acx_data_path_params_resp),
GFP_KERNEL);
if (!wl->data_path) {
wl1251_error("Couldnt allocate data path parameters");
return -ENOMEM;
}
ret = wl1251_acx_data_path_params(wl, wl->data_path);
if (ret < 0) {
kfree(wl->data_path);
wl->data_path = NULL;
return ret;
}
return 0;
}
int wl1251_hw_init(struct wl1251 *wl)
{
struct wl1251_acx_mem_map *wl_mem_map;
int ret;
ret = wl1251_hw_init_hwenc_config(wl);
if (ret < 0)
return ret;
/* Template settings */
ret = wl1251_hw_init_templates_config(wl);
if (ret < 0)
return ret;
/* Default memory configuration */
ret = wl1251_hw_init_mem_config(wl);
if (ret < 0)
return ret;
/* Default data path configuration */
ret = wl1251_hw_init_data_path_config(wl);
if (ret < 0)
goto out_free_memmap;
/* RX config */
ret = wl1251_hw_init_rx_config(wl,
RX_CFG_PROMISCUOUS | RX_CFG_TSF,
RX_FILTER_OPTION_DEF);
/* RX_CONFIG_OPTION_ANY_DST_ANY_BSS,
RX_FILTER_OPTION_FILTER_ALL); */
if (ret < 0)
goto out_free_data_path;
/* TX queues config */
ret = wl1251_hw_init_tx_queue_config(wl);
if (ret < 0)
goto out_free_data_path;
/* PHY layer config */
ret = wl1251_hw_init_phy_config(wl);
if (ret < 0)
goto out_free_data_path;
/* Initialize connection monitoring thresholds */
ret = wl1251_acx_conn_monit_params(wl);
if (ret < 0)
goto out_free_data_path;
/* Beacon filtering */
ret = wl1251_hw_init_beacon_filter(wl);
if (ret < 0)
goto out_free_data_path;
/* Bluetooth WLAN coexistence */
ret = wl1251_hw_init_pta(wl);
if (ret < 0)
goto out_free_data_path;
/* Energy detection */
ret = wl1251_hw_init_energy_detection(wl);
if (ret < 0)
goto out_free_data_path;
/* Beacons and boradcast settings */
ret = wl1251_hw_init_beacon_broadcast(wl);
if (ret < 0)
goto out_free_data_path;
/* Enable data path */
ret = wl1251_cmd_data_path(wl, wl->channel, 1);
if (ret < 0)
goto out_free_data_path;
/* Default power state */
ret = wl1251_hw_init_power_auth(wl);
if (ret < 0)
goto out_free_data_path;
wl_mem_map = wl->target_mem_map;
wl1251_info("%d tx blocks at 0x%x, %d rx blocks at 0x%x",
wl_mem_map->num_tx_mem_blocks,
wl->data_path->tx_control_addr,
wl_mem_map->num_rx_mem_blocks,
wl->data_path->rx_control_addr);
return 0;
out_free_data_path:
kfree(wl->data_path);
out_free_memmap:
kfree(wl->target_mem_map);
return ret;
}
| {
"pile_set_name": "Github"
} |
/*
* Licensed to Cloudkick, Inc ('Cloudkick') under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* Cloudkick 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.
*/
var sys = require('sys');
var fs = require('fs');
var path = require('path');
var querystring = require('querystring');
var sprintf = require('sprintf').sprintf;
var async = require('async');
var http = require('util/http');
var misc = require('util/misc');
var dotfiles = require('util/client_dotfiles');
var manifest = require('manifest');
var MANIFEST_FILENAME = require('manifest/constants').MANIFEST_FILENAME;
var clientUtils = require('util/client');
var Errorf = misc.Errorf;
var config = {
shortDescription: 'Create a new application instance',
longDescription: 'Create a new application instance using a bundle specified in the format [[name@]version]. ' +
'If no bundle name is specified, the name will be inferred from the cast manifest in the ' +
'current working directory. If no version is specified the version will be inferred based on ' +
'the most recently created bundle for the cast project in the current working directory.',
requiredArguments: [
['name', 'Instance name']
],
optionalArguments: [
['bundle', 'Bundle specifier in the format [[name@]version]']
],
options: [
{
names: ['--enable'],
dest: 'enable',
action: 'store_true',
desc: 'Enable and start the instance service after it has been created'
}
],
usesGlobalOptions: ['debug', 'remote']
};
function splitBundleSpecifier(specifier) {
if (specifier.indexOf('@') !== -1) {
return specifier.split('@', 2);
}
else {
return [undefined, specifier];
}
}
function handleCommand(args, parser, callback) {
var chunks, bundleName, bundleVersion;
var cwd = process.cwd();
var manifestPath = path.join(cwd, MANIFEST_FILENAME);
if (args.bundle) {
chunks = splitBundleSpecifier(args.bundle);
bundleName = chunks[0];
bundleVersion = chunks[1];
}
async.series([
// Fill in missing bundle name/version
function(callback) {
if (bundleName && !bundleVersion) {
callback(new Error('Bundle specifiers that contain a name must also include a version'));
return;
}
else if (!bundleVersion) {
dotfiles.getNewestBundle(cwd, function(err, bundle) {
if (!err) {
chunks = splitBundleSpecifier(bundle);
bundleName = chunks[0];
bundleVersion = chunks[1];
sys.puts('Using bundle \'' + bundleName + '@' + bundleVersion + '\'');
}
callback(err);
return;
});
}
else if (!bundleName) {
manifest.validateManifest(manifestPath, function(err, appManifest) {
if (!err) {
bundleName = misc.getValidBundleName(appManifest.name);
sys.puts('Using bundle \'' + bundleName + '@' + bundleVersion + '\'');
}
callback(err);
return;
});
}
else {
callback();
return;
}
},
// Do the request
function(callback) {
var remotePath = sprintf('/instances/%s/', args.name);
var body = querystring.stringify({
bundle_name: bundleName,
bundle_version: bundleVersion,
enable_service: args.enable
});
http.executeRemoteJob(args.remote, remotePath, 'PUT', body, callback);
}
],
function(err) {
var successMessage = sprintf('Instance "%s" created', args.name);
callback(err, successMessage);
});
}
exports.config = config;
exports.handleCommand = handleCommand;
| {
"pile_set_name": "Github"
} |
package org.qiyi.basecore.taskmanager.threadpool;
import android.os.Handler;
import org.qiyi.basecore.taskmanager.TM;
import org.qiyi.basecore.taskmanager.TaskWrapper;
import org.qiyi.basecore.taskmanager.other.TMLog;
public class PendingTaskQueue implements ITaskQueue {
private TaskBlockingQueue rejectedQueue = new TaskBlockingQueue();
private Handler workHandler;
public PendingTaskQueue(Handler handler) {
workHandler = handler;
}
@Override
public Runnable dequeue(int priority) {
return rejectedQueue.pollFirst();
}
@Override
public int size() {
return rejectedQueue.size();
}
@Override
public int getQueueState() {
int size = rejectedQueue.size();
if (size < 1) {
return IDLE;
} else if (size < 3) {
return AVERAGE;
} else if (size > 100) {
return HEAVY;
} else {
return BUSY;
}
}
@Override
public void offer(final TaskWrapper wrapper, final int taskPriority) {
rejectedQueue.addLast(wrapper, taskPriority);
workHandler.post(new Runnable() {
@Override
public void run() {
synchronized (PendingTaskQueue.this) {
PendingTaskQueue.this.notify();
}
}
});
}
@Override
public boolean removeTaskById(int taskId) {
return rejectedQueue.removeTaskById(taskId);
}
@Override
public boolean removeTaskByToken(Object token) {
return rejectedQueue.removeTaskByToken(token);
}
@Override
public void printTasks() {
rejectedQueue.printTasks();
}
}
| {
"pile_set_name": "Github"
} |
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-03-01 18:09+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: httplib2/__init__.py:358
#, python-format
msgid "Content purported to be compressed with %s but failed to decompress."
msgstr ""
#: httplib2/__init__.py:468
#, python-format
msgid "Unsupported value for qop: %s."
msgstr ""
#: httplib2/__init__.py:471 httplib2/__init__.py:532
#, python-format
msgid "Unsupported value for algorithm: %s."
msgstr ""
#: httplib2/__init__.py:529
msgid "The challenge doesn't contain a server nonce, or this one is empty."
msgstr ""
#: httplib2/__init__.py:535
#, python-format
msgid "Unsupported value for pw-algorithm: %s."
msgstr ""
#: httplib2/__init__.py:924
msgid "Redirected but the response is missing a Location: header."
msgstr ""
#: httplib2/__init__.py:949
msgid "Redirected more times than rediection_limit allows."
msgstr ""
#: view/500.html:74
msgid "Sorry."
msgstr "Lo siento."
#: view/500.html:75
msgid "Something is wrong with me."
msgstr "A veces tambien me pongo mal."
#: view/500.html:82 view/index-en.html:108 view/index.html:112
#: view/main.html:140
msgid "Terms"
msgstr "Condiciones de uso"
#: view/chatter_accounts.html:1 view/cybozulive_accounts.html:1
#: view/facebook_accounts.html:1 view/linkedin_accounts.html:1
#: view/twitter_accounts.html:1 view/yammer_accounts.html:1
#: view/youroom_accounts.html:1
msgid "The following accounts are registered."
msgstr "Estan registradas las siguientes cuentas."
#: view/chatter_accounts.html:1 view/chatter_add_column.html:1
#: view/cybozulive_accounts.html:1 view/cybozulive_add_column.html:1
#: view/facebook_accounts.html:1 view/facebook_add_column.html:1
#: view/linkedin_accounts.html:1 view/linkedin_add_column.html:1
#: view/twitter_accounts.html:1 view/twitter_add_column.html:1
#: view/yammer_accounts.html:1 view/yammer_add_column.html:1
#: view/youroom_accounts.html:1 view/youroom_add_column.html:1
msgid "Add Another Account"
msgstr "Añadir Otra Cuenta"
#: view/chatter_accounts.html:1 view/cybozulive_accounts.html:1
#: view/facebook_accounts.html:1 view/i18n_js.html:20
#: view/linkedin_accounts.html:1 view/main.html:216
#: view/twitter_accounts.html:1 view/yammer_accounts.html:1
#: view/youroom_accounts.html:1
msgid "Delete"
msgstr "Eliminar"
#: view/chatter_accounts.html:1 view/chatter_add_column.html:1
msgid "There is no account of Chatter."
msgstr "No hay ninguna cuenta de \"Chatter\"."
#: view/chatter_accounts.html:1 view/chatter_add_column.html:1
#: view/cybozulive_accounts.html:1 view/cybozulive_add_column.html:1
#: view/facebook_accounts.html:1 view/facebook_add_column.html:1
#: view/linkedin_accounts.html:1 view/twitter_accounts.html:1
#: view/twitter_add_column.html:1 view/yammer_accounts.html:1
#: view/yammer_add_column.html:1 view/youroom_accounts.html:1
#: view/youroom_add_column.html:1
msgid "Add Account"
msgstr "Añadir Cuenta"
#: view/chatter_add_column.html:1 view/cybozulive_add_column.html:1
#: view/facebook_add_column.html:1 view/linkedin_add_column.html:1
#: view/twitter_add_column.html:1 view/youroom_add_column.html:1
msgid "Please select an account."
msgstr "Elige Una Cuenta Por Favor"
#: view/chatter_add_column.html:1 view/cybozulive_add_column.html:1
#: view/facebook_add_column.html:1 view/googleplus_add_column.html:1
#: view/linkedin_add_column.html:1 view/twitter_add_column.html:1
#: view/yammer_add_column.html:1 view/youroom_add_column.html:1
msgid "Please select the type of timeline."
msgstr "Elige El Tipo de Mensage"
#: view/cybozulive_accounts.html:1 view/cybozulive_add_column.html:1
msgid "There is no account of Cybozu Live."
msgstr "No hay ninguna cuenta de \"Cybozu Live\"."
#: view/cybozulive_add_column.html:1 view/i18n_js.html:64
msgid "All Updates"
msgstr "Todas Las Actualizaciones"
#: view/cybozulive_add_column.html:1
msgid "My Schedule"
msgstr "Mi Calendario"
#: view/cybozulive_add_column.html:1
msgid "Group Events"
msgstr "Eventos de Grupo"
#: view/cybozulive_add_column.html:1
msgid "Messages"
msgstr "Mensages"
#: view/cybozulive_add_column.html:1
msgid "ToDo List"
msgstr "Lista ToDo"
#: view/cybozulive_add_column.html:1
msgid "Forum Cybozu"
msgstr "Foros"
#: view/cybozulive_add_column.html:1
msgid "Share Folder"
msgstr "Carpeta Compartida"
#: view/cybozulive_add_column.html:1
msgid "Join/Leave Group"
msgstr "Unirte/Salir del Grupo"
#: view/facebook_accounts.html:1 view/facebook_add_column.html:1
msgid "There is no account of Facebook."
msgstr "No hay ninguna cuenta de \"Facebook\"."
#: view/facebook_add_column.html:1 view/twitter_add_column.html:1
msgid "Feed"
msgstr ""
#: view/facebook_add_column.html:1
msgid "Groups"
msgstr "Grupos"
#: view/facebook_add_column.html:1
msgid "Your pages"
msgstr "Tus Paginas de Facebook"
#: view/facebook_add_column.html:1
msgid "Your favorite pages"
msgstr "Tus Paginas favoritas de Facebook"
#: view/facebook_add_column.html:1 view/googleplus_add_column.html:1
#: view/i18n_js.html:73 view/twitter_add_column.html:1
msgid "Search"
msgstr "Busqueda"
#: view/facebook_add_column.html:1
msgid "Friend list"
msgstr "Lista de amigos"
#: view/facebook_add_column.html:1
msgid "Your applications"
msgstr ""
#: view/facebook_add_column.html:1
msgid "Select a friend list."
msgstr ""
#: view/facebook_add_column.html:1
msgid "Select a group."
msgstr ""
#: view/facebook_add_column.html:1 view/googleplus_add_column.html:1
#: view/twitter_add_column.html:1
msgid "Enter a search term."
msgstr ""
#: view/facebook_add_column.html:1
msgid "Select a page."
msgstr ""
#: view/facebook_add_column.html:1
msgid "Select an app."
msgstr ""
#: view/i18n_js.html:8
msgid "Load More"
msgstr "Leer Mas"
#: view/i18n_js.html:9
msgid "Loading More..."
msgstr "Cargando"
#: view/i18n_js.html:10
msgid "You must re-authenticate to get these information. Please click here."
msgstr "Para contiuar necesitas reautorizar. Click aqui."
#: view/i18n_js.html:11
msgid "Failed to load timeline. Click to reload."
msgstr "Error de coneccion. Click para reintentar."
#: view/i18n_js.html:12
msgid "More"
msgstr "Mas"
#: view/i18n_js.html:13
msgid "Loading"
msgstr "Cargando"
#: view/i18n_js.html:14
msgid ""
"You cannot use desktop notifications. This feature is available in Google "
"Chrome only."
msgstr ""
"Crowy no puede activar la alerta al escritorio.Esta option solo es valida "
"para Google Chrome."
#: view/i18n_js.html:15
msgid ""
"Crowy don't notify you as the overall settings for the notification feature "
"is off. Would you like to enable the settings?"
msgstr ""
"Todas las alertas de escritorio estan desactivadas.Deseas que Crowy haga "
"aparecer alertas?"
#: view/i18n_js.html:16
msgid "Desktop notifications of \"$(name)\" successfully changed."
msgstr "Los cambios de alerta de \"$(name)\" han sido guardados."
#: view/i18n_js.html:17
msgid "Failed to change desktop notifications of \"$(name)\"."
msgstr "Crowy fallo al guardar los cambios de alerta de \"$(name)\" "
#: view/i18n_js.html:18
msgid "Are you sure you want to delete this column \"$(name)\"?"
msgstr "Estas seguro de eliminar la columna \"$(name)\"?"
#: view/i18n_js.html:19
msgid "Desktop notifications($(status))"
msgstr "Alertas al escritorio ($(status))"
#: view/i18n_js.html:21
msgid "Message posted."
msgstr "Mensage depositado."
#: view/i18n_js.html:22
msgid "Failed to post message."
msgstr "Fallo al depositar mensage"
#: view/i18n_js.html:23
msgid "Press Shift+Enter to post."
msgstr "\"Shift+Enter\" para depositar."
#: view/i18n_js.html:24
msgid "Close"
msgstr "Cerrar"
#: view/i18n_js.html:25 view/main.html:251
msgid "Send"
msgstr "Enviar"
#: view/i18n_js.html:26 view/main.html:252
msgid "Clear"
msgstr "Clear"
#: view/i18n_js.html:27
msgid "Advanced"
msgstr "Cambios avanzados"
#: view/i18n_js.html:28
msgid ""
"Are you sure you'd like to add automatically major timelines of this service?"
msgstr "Deseas que agrege las principales TimeLines?"
#: view/i18n_js.html:29
msgid "Delete Tab"
msgstr "Eliminar pestaña"
#: view/i18n_js.html:30
msgid "You cannot delete the last tab."
msgstr "Tienes que conservar por lomenos una pestaña"
#: view/i18n_js.html:31
msgid "Are you sure you want to delete this tab?"
msgstr "Es tas sequro de eliminar esta ?"
#: view/i18n_js.html:32
msgid "Cancel"
msgstr "Cancelar"
#: view/i18n_js.html:33 view/main.html:112 view/main.html.py:173
msgid "Add Column"
msgstr "Agregar nueva columna"
#: view/i18n_js.html:34
msgid "Message posted to \"$(name)\"."
msgstr "Mensage depositado a \"$(name)\""
#: view/i18n_js.html:35
msgid "Failed to post message to \"$(name)\"."
msgstr "Crowy fallo al depositar el mensage a \"$(name)\""
#: view/i18n_js.html:36
msgid "Please enter a new shortcut name."
msgstr ""
#: view/i18n_js.html:37
msgid "Shortcut \"$(name)\" successfully saved."
msgstr ""
#: view/i18n_js.html:38
msgid "Failed to save shortcut \"$(name)\"."
msgstr ""
#: view/i18n_js.html:39
msgid "Failed to shrink URL."
msgstr "Crowy fallo al encoger la URL."
#: view/i18n_js.html:40
msgid "Shortcut successfully renamed to \"$(name)\"."
msgstr ""
#: view/i18n_js.html:41
msgid "Failed to rename shortcut \"$(name)\"."
msgstr ""
#: view/i18n_js.html:42
msgid "Are you sure you want to delete this shortcut?"
msgstr ""
#: view/i18n_js.html:43
msgid "Shortcut \"$(name)\" successfully deleted."
msgstr ""
#: view/i18n_js.html:44
msgid "Failed to delete shortcut \"$(name)\"."
msgstr ""
#: view/i18n_js.html:45
msgid "Rename"
msgstr "Cambiar nombre de etiqueta"
#: view/i18n_js.html:46
msgid "Label Color"
msgstr "Color de etiqueta"
#: view/i18n_js.html:47
msgid "Color of the shortcut \"$(name)\" successfully changed."
msgstr ""
#: view/i18n_js.html:48
msgid "Failed to change the color of shortcut \"$(name)\"."
msgstr ""
#: view/i18n_js.html:49
msgid "Desktop notifications successfully changed."
msgstr "Los cambios de alertas al escritorio han sido guardados corectamente."
#: view/i18n_js.html:50
msgid "Failed to change desktop notifications."
msgstr "Crowy fallo al guardar los cambios de alertas al escritorio."
#: view/i18n_js.html:51
msgid ""
"<div>allows Crowy to display popup notifications on your desktop.<br/>If "
"notifications setting of a column is off, Crowy don't notify you.<br/>You "
"can set notification setting of a column in right top triangle of every "
"column.</div>"
msgstr ""
"<div>Activar y desactivar las alertas al escritorio.<br/>Si no estan "
"activadas las alertas al escritorio, no aparecera ninguna alerte visual.<br/"
">Los cambios de cada columna se pueden hacer desdel boton ▼ en la parte "
"superior-derecha de cada columna.</div>"
#: view/i18n_js.html:52
msgid ""
"Are you sure you want to delete account \"$(name)\"?\\nIf delete, all column "
"of this account will be deleted."
msgstr ""
"Estas seguro que quieres borar la cuenta $(name) de crowy?Todas las columnas "
"sobre esta cuenta desapareceran tambien."
#: view/i18n_js.html:53
msgid "This account successfully deleted. Crowy reload now."
msgstr "Crowy ha borado la cuenta correctamente.carganndo..."
#: view/i18n_js.html:54
msgid "Failed to delete this account."
msgstr "Crowy fallo al borrar la cuenta."
#: view/i18n_js.html:55 view/main.html:196
msgid "Show Conversation"
msgstr ""
#: view/i18n_js.html:56
msgid "More>>"
msgstr "Mas>>"
#: view/i18n_js.html:57
msgid "<<Close"
msgstr "Cerrar<<"
#: view/i18n_js.html:58
msgid "Retweet this to your followers?"
msgstr "Retwittear a tus seguidores?"
#: view/i18n_js.html:59
msgid "Message has been retweeted by $(account)."
msgstr "El mensage ha sido retwitteado."
#: view/i18n_js.html:60
msgid "Failed to retweet by $(account)."
msgstr "Crowy fallo al retwittear el mensage."
#: view/i18n_js.html:61
msgid "Message successfully favorited"
msgstr "Mensage ha sido agregado a favoritos."
#: view/i18n_js.html:62
msgid "Failed to favorite message."
msgstr "Crowy fallo al agregar el mensage a favoritos."
#: view/i18n_js.html:63
msgid "Failed to load comments."
msgstr "Crowy fallo al recivir comentos."
#: view/i18n_js.html:65
msgid "Message successfully liked."
msgstr "Mensage en \"Like\""
#: view/i18n_js.html:66
msgid "Failed to like message."
msgstr "Fallo al \"Like\""
#: view/i18n_js.html:67
msgid "Message successfully unliked."
msgstr "Mensage en \"Unlike\""
#: view/i18n_js.html:68
msgid "Failed to unlike message."
msgstr "Fallo al \"Unlike\""
#: view/i18n_js.html:69
msgid "People who like this"
msgstr ""
#: view/i18n_js.html:70
msgid "Anyone don't like this."
msgstr ""
#: view/i18n_js.html:71
msgid "Your Facebook Pages"
msgstr ""
#: view/i18n_js.html:72
msgid "Add"
msgstr ""
#: view/i18n_js.html:74
msgid "Retweeted by $(account)"
msgstr ""
#: view/i18n_js.html:75
msgid "Retweeted by $(account) and $(count) others"
msgstr ""
#: view/i18n_js.html:76
msgid "OK"
msgstr ""
#: view/i18n_js.html:77
msgid "$(service) returns error. Try again later."
msgstr ""
#: view/i18n_js.html:78
msgid "Cybozu Live"
msgstr ""
#: view/i18n_js.html:79
msgid "Press Ctrl+Enter to post."
msgstr "\"Ctrl+Enter\" para depositar."
#: view/i18n_js.html:80
msgid "Can\\'t upload image in $(services)."
msgstr ""
#: view/i18n_js.html:81
msgid "This tweet has been deleted successfully."
msgstr ""
#: view/i18n_js.html:82
msgid "Failed to delete this tweet"
msgstr ""
#: view/i18n_js.html:83
msgid "Are you sure you want to delete this tweet?\\n$(tweet)"
msgstr ""
#: view/i18n_js.html:84
msgid "Message successfully unfavorited"
msgstr ""
#: view/i18n_js.html:85
msgid "Failed to unfavorite message."
msgstr ""
#: view/i18n_js.html:86
msgid "Anyone don't retweet this."
msgstr ""
#: view/i18n_js.html:87
msgid "Color"
msgstr ""
#: view/i18n_js.html:88
msgid "Color of the column \"$(name)\" has been changed."
msgstr ""
#: view/i18n_js.html:89
msgid "Failed to change color of the column \"$(name)\"."
msgstr ""
#: view/i18n_js.html:90 view/main.html:204
msgid "Retweet"
msgstr ""
#: view/i18n_js.html:91
msgid "Follow"
msgstr ""
#: view/i18n_js.html:92
msgid "Unfollow"
msgstr ""
#: view/i18n_js.html:93 view/i18n_js.html.py:100
msgid "Following"
msgstr ""
#: view/i18n_js.html:94
msgid "Followers"
msgstr ""
#: view/i18n_js.html:95
msgid "Tweets"
msgstr ""
#: view/i18n_js.html:96
msgid "Favorites"
msgstr ""
#: view/i18n_js.html:97
msgid "Friendships"
msgstr ""
#: view/i18n_js.html:98
msgid "Friends"
msgstr ""
#: view/i18n_js.html:99
msgid "Fan"
msgstr ""
#: view/i18n_js.html:101
msgid "Your follow request has been sent."
msgstr ""
#: view/i18n_js.html:102 view/main.html:215
msgid "DM"
msgstr ""
#: view/i18n_js.html:103 view/main.html:197
msgid "Reply"
msgstr ""
#: view/i18n_js.html:104
msgid "You should connect to Twitter."
msgstr ""
#: view/i18n_js.html:105
msgid "Please select an account linked to the new column."
msgstr ""
#: view/i18n_js.html:106
msgid "Are you sure you want to logout from Google?"
msgstr ""
#: view/i18n_js.html:107
msgid "Only Crowy"
msgstr ""
#: view/i18n_js.html:108
msgid "Crowy and Google"
msgstr ""
#: view/i18n_js.html:109
msgid ""
"<a class=\"friend-name\"/> posted about <a class=\"this-product\">this "
"product</a>"
msgstr ""
#: view/i18n_js.html:110
msgid "d M"
msgstr "d M"
#: view/i18n_js.html:111
msgid "$(second)s"
msgstr "$(second)s"
#: view/i18n_js.html:112
msgid "$(minute)m"
msgstr "$(minute)m"
#: view/i18n_js.html:113
msgid "$(hour)h"
msgstr "$(hour)h"
#: view/index-en.html:108 view/index.html:112 view/main.html:140
msgid "en"
msgstr "en"
#: view/index-en.html:109 view/index.html:113 view/main.html:139
msgid "About Us"
msgstr ""
#: view/linkedin_accounts.html:1 view/linkedin_add_column.html:1
msgid "There is no account of LinkedIn."
msgstr "No hay ninguna cuenta de \"Linkedln\"."
#: view/main.html:87 view/main.html.py:146
msgid "Settings"
msgstr "Ajustes"
#: view/main.html:88
msgid "Logout"
msgstr "Cerrar sesión"
#: view/main.html:90
msgid "Help"
msgstr "Ayuda"
#: view/main.html:91
msgid "Blog"
msgstr "Blog"
#: view/main.html:100
msgid "Compose message"
msgstr "Nuevo mensage"
#: view/main.html:108
msgid "Add Tab"
msgstr "Agregar pestaña"
#: view/main.html:111
msgid "Refresh"
msgstr "Actualizar"
#: view/main.html:127
msgid ""
"<h2>This tab has no column.</h2><p>You can add a column in which a timeline "
"of various services displays.</p><button>Add Column</button>"
msgstr ""
#: view/main.html:138
msgid "Github"
msgstr ""
#: view/main.html:149
msgid "Services"
msgstr ""
#: view/main.html:150 view/settings_basic.html:4
msgid "Preferences"
msgstr ""
#: view/main.html:154
msgid ""
"<h3>Welcome to Crowy!</h3>At first you must add other service.<br>Please "
"click the tab which you connect with and click [Connect]."
msgstr ""
#: view/main.html:156
msgid "You can add connections with other services and remove them."
msgstr ""
#: view/main.html:166 view/main.html.py:185
msgid "Cybozu Live(Lab)"
msgstr ""
#: view/main.html:175
msgid "Please select the service which you want to add."
msgstr ""
#: view/main.html:194
msgid "Like"
msgstr ""
#: view/main.html:195
msgid "Unlike"
msgstr ""
#: view/main.html:196
msgid "Thread"
msgstr ""
#: view/main.html:198
msgid "Comment"
msgstr ""
#: view/main.html:200
msgid "RT"
msgstr ""
#: view/main.html:203
msgid "Classic RT"
msgstr ""
#: view/main.html:208
msgid "Favorite"
msgstr ""
#: view/main.html:209
msgid "Unfavorite"
msgstr ""
#: view/main.html:211
msgid "Others"
msgstr ""
#: view/main.html:214
msgid "Reply all"
msgstr ""
#: view/main.html:215
msgid "Direct Message"
msgstr ""
#: view/main.html:221
msgid "Multi post"
msgstr ""
#: view/main.html:228
msgid "To:"
msgstr ""
#: view/main.html:257
msgid "Add these addresses to shortcuts."
msgstr ""
#: view/rss_add_column.html:1
msgid "Paste a feed url."
msgstr ""
#: view/rss_add_column.html:1
msgid "Input a valid URL."
msgstr ""
#: view/settings_basic.html:6
msgid "Display Density:"
msgstr ""
#: view/settings_basic.html:8
msgid "Comfortable"
msgstr ""
#: view/settings_basic.html:9
msgid "Normal"
msgstr ""
#: view/settings_basic.html:10
msgid "Compact"
msgstr ""
#: view/settings_basic.html:14
msgid "Language:"
msgstr ""
#: view/settings_basic.html:21
msgid "Keyboard Shortcuts"
msgstr ""
#: view/settings_basic.html:23
msgid "Post:"
msgstr ""
#: view/settings_basic.html:30
msgid "Save Changes"
msgstr ""
#: view/settings_basic.html:45
msgid "Preferences successfully saved."
msgstr ""
#: view/settings_basic.html:49
msgid "Failed to save preferences."
msgstr ""
#: view/twitter_accounts.html:1 view/twitter_add_column.html:1
msgid "There is no account of Twitter."
msgstr ""
#: view/twitter_add_column.html:1
msgid "List"
msgstr ""
#: view/twitter_add_column.html:1
msgid "Select the type of feed."
msgstr ""
#: view/twitter_add_column.html:1
msgid "Select the list."
msgstr ""
#: view/yammer_accounts.html:1 view/yammer_add_column.html:1
msgid "There is no account of Yammer."
msgstr ""
#: view/yammer_add_column.html:1
msgid "Please select an network."
msgstr ""
#: view/yammer_authorize.html:30
msgid ""
"<h2>1. Get an access code from Yammer</h2><p>Login to Yammer and grant Crowy "
"access to your Yammer Account. After 4 digit access code is displayed, enter "
"the code into the text box of No.2.<br></p>"
msgstr ""
#: view/yammer_authorize.html:32
msgid "Get access code from Yammer"
msgstr ""
#: view/yammer_authorize.html:36
msgid ""
"<h2>2. Enter an access code.</h2><p>Enter the access code and click the "
"following button.</p>"
msgstr ""
#: view/yammer_authorize.html:40
msgid "Connect with Yammer"
msgstr ""
#: view/youroom_accounts.html:1 view/youroom_add_column.html:1
msgid "There is no account of youRoom."
msgstr ""
#~ msgid "Message successfully retweeted."
#~ msgstr "El mensage ha sido retwitteado."
#~ msgid "Failed to retweet message."
#~ msgstr "Crowy fallo al retwittear el mensage."
#~ msgid "View Conversation"
#~ msgstr "ver conversation"
#~ msgid "Forum"
#~ msgstr "Foros"
#~ msgid "lang"
#~ msgstr "Español"
#, fuzzy
#~ msgid "Please select the type of Google+."
#~ msgstr "Elige El Tipo de Mensage"
| {
"pile_set_name": "Github"
} |
---
title: "/QIntel-jcc-erratum"
description: "Describes the Microsoft C/C++ compiler (MSVC) /QIntel-jcc-erratum option."
ms.date: "01/07/2020"
f1_keywords: ["QIntel-jcc-erratum"]
helpviewer_keywords: ["/QIntel-jcc-erratum", "-QIntel-jcc-erratum"]
---
# /QIntel-jcc-erratum
::: moniker range="<=vs-2017"
The **/QIntel-jcc-erratum** option is available in Visual Studio 2019 version 16.5 and later.
::: moniker-end
::: moniker range=">=vs-2019"
Specifies that the compiler generates instructions to mitigate the performance impact caused by the Intel Jump Conditional Code (JCC) erratum microcode update in certain Intel processors.
## Syntax
> **/QIntel-jcc-erratum**
## Remarks
Under **/QIntel-jcc-erratum**, the compiler detects jump and macro-fused jump instructions that cross or end on a 32-byte boundary. It aligns these instructions to the boundary. This change mitigates the performance impact of microcode updates that prevent the JCC erratum in certain Intel processors. For more information about the erratum, see [Mitigations for Jump Conditional Code Erratum](https://www.intel.com/content/dam/support/us/en/documents/processors/mitigations-jump-conditional-code-erratum.pdf) on the Intel website.
The **/QIntel-jcc-erratum** option is available in Visual Studio 2019 version 16.5 and later. This option is only available in compilers that target x86 and x64. The option isn't available in compilers that target ARM processors.
The **/QIntel-jcc-erratum** option is off by default, and works only in optimized builds. This option can increase code size.
**/QIntel-jcc-erratum** is incompatible with [/clr](clr-common-language-runtime-compilation.md).
### To set this compiler option in the Visual Studio development environment
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
1. Select the **Configuration Properties** > **C/C++** > **Code Generation** property page.
1. Select a value for the **Enable Intel JCC Erratum Mitigation** property. Choose **OK** to apply the change.
### To set this compiler option programmatically
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.AdditionalOptions%2A>.
## See also
[/Q options (Low-level operations)](q-options-low-level-operations.md)\
[MSVC compiler options](compiler-options.md)\
[MSVC compiler command-line syntax](compiler-command-line-syntax.md)
::: moniker-end
| {
"pile_set_name": "Github"
} |
/*
CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
(function () {
// Shortcuts
var C = CryptoJS;
var C_lib = C.lib;
var Base = C_lib.Base;
var WordArray = C_lib.WordArray;
var C_algo = C.algo;
var SHA1 = C_algo.SHA1;
var HMAC = C_algo.HMAC;
/**
* Password-Based Key Derivation Function 2 algorithm.
*/
var PBKDF2 = C_algo.PBKDF2 = Base.extend({
/**
* Configuration options.
*
* @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
* @property {Hasher} hasher The hasher to use. Default: SHA1
* @property {number} iterations The number of iterations to perform. Default: 1
*/
cfg: Base.extend({
keySize: 128/32,
hasher: SHA1,
iterations: 1
}),
/**
* Initializes a newly created key derivation function.
*
* @param {Object} cfg (Optional) The configuration options to use for the derivation.
*
* @example
*
* var kdf = CryptoJS.algo.PBKDF2.create();
* var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
* var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
*/
init: function (cfg) {
this.cfg = this.cfg.extend(cfg);
},
/**
* Computes the Password-Based Key Derivation Function 2.
*
* @param {WordArray|string} password The password.
* @param {WordArray|string} salt A salt.
*
* @return {WordArray} The derived key.
*
* @example
*
* var key = kdf.compute(password, salt);
*/
compute: function (password, salt) {
// Shortcut
var cfg = this.cfg;
// Init HMAC
var hmac = HMAC.create(cfg.hasher, password);
// Initial values
var derivedKey = WordArray.create();
var blockIndex = WordArray.create([0x00000001]);
// Shortcuts
var derivedKeyWords = derivedKey.words;
var blockIndexWords = blockIndex.words;
var keySize = cfg.keySize;
var iterations = cfg.iterations;
// Generate key
while (derivedKeyWords.length < keySize) {
var block = hmac.update(salt).finalize(blockIndex);
hmac.reset();
// Shortcuts
var blockWords = block.words;
var blockWordsLength = blockWords.length;
// Iterations
var intermediate = block;
for (var i = 1; i < iterations; i++) {
intermediate = hmac.finalize(intermediate);
hmac.reset();
// Shortcut
var intermediateWords = intermediate.words;
// XOR intermediate with block
for (var j = 0; j < blockWordsLength; j++) {
blockWords[j] ^= intermediateWords[j];
}
}
derivedKey.concat(block);
blockIndexWords[0]++;
}
derivedKey.sigBytes = keySize * 4;
return derivedKey;
}
});
/**
* Computes the Password-Based Key Derivation Function 2.
*
* @param {WordArray|string} password The password.
* @param {WordArray|string} salt A salt.
* @param {Object} cfg (Optional) The configuration options to use for this computation.
*
* @return {WordArray} The derived key.
*
* @static
*
* @example
*
* var key = CryptoJS.PBKDF2(password, salt);
* var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
* var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
*/
C.PBKDF2 = function (password, salt, cfg) {
return PBKDF2.create(cfg).compute(password, salt);
};
}());
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2017, STMicroelectronics - All Rights Reserved
* Author(s): Vikas Manocha, <[email protected]> for STMicroelectronics.
*/
#include <common.h>
#include <spl.h>
static int spl_xip(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
#ifdef CONFIG_SPL_OS_BOOT
if (!spl_start_uboot()) {
spl_image->arg = (void *)CONFIG_SYS_FDT_BASE;
spl_image->name = "Linux";
spl_image->os = IH_OS_LINUX;
spl_image->load_addr = CONFIG_SYS_LOAD_ADDR;
spl_image->entry_point = CONFIG_SYS_LOAD_ADDR;
debug("spl: payload xipImage, load addr: 0x%lx\n",
spl_image->load_addr);
return 0;
}
#endif
return(spl_parse_image_header(spl_image, (const struct image_header *)
CONFIG_SYS_UBOOT_BASE));
}
SPL_LOAD_IMAGE_METHOD("XIP", 0, BOOT_DEVICE_XIP, spl_xip);
| {
"pile_set_name": "Github"
} |
/*****************************************************************************
*
* - H.264 encoder for mencoder using x264 -
*
* Copyright (C) 2004 LINUX4MEDIA GmbH
* Copyright (C) 2004 Ark Linux
*
* Written by Bernhard Rosenkraenzer <[email protected]>
*
* This file is part of MPlayer.
*
* MPlayer 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.
*
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*****************************************************************************/
#define _BSD_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <errno.h>
#include "config.h"
#include "mp_msg.h"
#include "mencoder.h"
#include "m_option.h"
#include "codec-cfg.h"
#include "stream/stream.h"
#include "libmpdemux/demuxer.h"
#include "libmpdemux/stheader.h"
#include "osdep/strsep.h"
#include "stream/stream.h"
#include "libmpdemux/muxer.h"
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
#include "ve.h"
#include "ve_x264.h"
#include <x264.h>
typedef struct h264_module_t {
muxer_stream_t *mux;
x264_t * x264;
x264_picture_t pic;
} h264_module_t;
static x264_param_t param;
static int parse_error = 0;
static int psp480p = 0;
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts);
static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in);
void x264enc_set_param(const m_option_t* opt, char* arg)
{
static int initialized = 0;
int slow_firstpass = 0;
char *preset = NULL, *tune = NULL, *profile = NULL;
char *p, *copy, *name;
if (!initialized) {
x264_param_default(¶m);
initialized = 1;
}
if (!arg) {
mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option x264encopts: no options provided\n");
parse_error = 1;
return;
} else if (!*arg)
/* Empty arguments, just doing initialization of default parameters. */
return;
/* Step 1: look for initial preset/tune. */
copy = p = strdup(arg);
while ((name = strsep(©, ":"))) {
char *value = strpbrk(name, "=:");
if (!value)
continue;
*value++ = 0;
if (!strcasecmp(name, "preset"))
preset = value;
else if (!strcasecmp(name, "tune"))
tune = value;
}
if (x264_param_default_preset(¶m, preset, tune) < 0) {
mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option x264encopts: Invalid preset or tune.\n");
parse_error = 1;
}
free(p);
/* Step 2: explicit user overrides */
while ((name = strsep(&arg, ":")) && *name) {
int ret = 0;
char *value = strpbrk(name, "=:");
if (value)
*value++ = 0;
if (!strcasecmp(name, "profile"))
profile = value;
else if (!strcasecmp(name, "turbo")) {
mp_msg(MSGT_CFGPARSER, MSGL_WARN, "Option x264encopts: turbo option is deprecated; "
"use slow_firstpass to disable turbo\n");
if (value && *value == '0')
slow_firstpass = 1;
} else if (!strcasecmp(name, "slow_firstpass"))
slow_firstpass = 1;
else if(!strcasecmp(name, "psp480p"))
psp480p = 1;
else if (strcasecmp(name, "preset") && strcasecmp(name, "tune")) {
ret = x264_param_parse(¶m, name, value);
if (ret == X264_PARAM_BAD_NAME)
mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option x264encopts: Unknown suboption %s\n", name);
if (ret == X264_PARAM_BAD_VALUE)
mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option x264encopts: Bad argument %s=%s\n",
name, value ? value : "(null)");
}
/* mark this option as done, so it's not reparsed if there's another -x264encopts */
*name = 0;
parse_error |= ret;
}
/* Step 3: Apply fast first pass (turbo) options. */
if (!slow_firstpass)
x264_param_apply_fastfirstpass(¶m);
/* Step 4: enforce profile */
if (profile && x264_param_apply_profile(¶m, profile) < 0)
parse_error = 1;
}
static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) {
h264_module_t *mod=(h264_module_t*)vf->priv;
if(parse_error)
return 0;
mod->mux->bih->biWidth = width;
mod->mux->bih->biHeight = height;
mod->mux->bih->biSizeImage = width * height * 3;
mod->mux->aspect = (float)d_width/d_height;
// make sure param is initialized
x264enc_set_param(NULL, "");
param.i_width = width;
param.i_height = height;
param.i_fps_num = mod->mux->h.dwRate;
param.i_fps_den = mod->mux->h.dwScale;
param.b_vfr_input = 0;
param.vui.i_sar_width = d_width*height;
param.vui.i_sar_height = d_height*width;
if(psp480p) {
param.vui.i_sar_width = 400;
param.vui.i_sar_height = 330;
}
x264_param_parse(¶m, "stats", passtmpfile);
switch(outfmt) {
case IMGFMT_I420:
param.i_csp = X264_CSP_I420;
break;
case IMGFMT_YV12:
param.i_csp = X264_CSP_YV12;
break;
default:
mp_msg(MSGT_MENCODER, MSGL_ERR, "Wrong colorspace.\n");
return 0;
}
mod->x264 = x264_encoder_open(¶m);
if(!mod->x264) {
mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_open failed.\n");
return 0;
}
if(!param.b_repeat_headers){
x264_nal_t *nal;
int extradata_size, nnal;
extradata_size = x264_encoder_headers(mod->x264, &nal, &nnal);
mod->mux->bih= realloc(mod->mux->bih, sizeof(*mod->mux->bih) + extradata_size);
memcpy(mod->mux->bih + 1, nal->p_payload, extradata_size);
mod->mux->bih->biSize= sizeof(*mod->mux->bih) + extradata_size;
}
if (param.i_bframe > 1 && param.i_bframe_pyramid)
mod->mux->decoder_delay = 2;
else
mod->mux->decoder_delay = param.i_bframe ? 1 : 0;
return 1;
}
static int control(struct vf_instance *vf, int request, void *data)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
switch(request){
case VFCTRL_FLUSH_FRAMES:
while (x264_encoder_delayed_frames(mod->x264) > 0)
encode_frame(vf, NULL);
return CONTROL_TRUE;
default:
return CONTROL_UNKNOWN;
}
}
static int query_format(struct vf_instance *vf, unsigned int fmt)
{
switch(fmt) {
case IMGFMT_I420:
return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
case IMGFMT_YV12:
case IMGFMT_422P:
case IMGFMT_444P:
case IMGFMT_YVYU:
case IMGFMT_RGB:
case IMGFMT_BGR:
case IMGFMT_BGR32:
/* These colorspaces are supported, but they'll just have
* to be converted to I420 internally */
return 0; /* VFCAP_CSP_SUPPORTED */
}
return 0;
}
static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
int i;
x264_picture_init(&mod->pic);
mod->pic.img.i_csp=param.i_csp;
mod->pic.img.i_plane=3;
for(i=0; i<4; i++) {
mod->pic.img.plane[i] = mpi->planes[i];
mod->pic.img.i_stride[i] = mpi->stride[i];
}
mod->pic.i_type = X264_TYPE_AUTO;
if (is_forced_key_frame(pts))
mod->pic.i_type = X264_TYPE_KEYFRAME;
return encode_frame(vf, &mod->pic) >= 0;
}
static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
x264_picture_t pic_out;
x264_nal_t *nal;
int i_nal;
int i_size;
i_size = x264_encoder_encode(mod->x264, &nal, &i_nal, pic_in, &pic_out);
if(i_size<0) {
mp_msg(MSGT_MENCODER, MSGL_ERR, "x264_encoder_encode failed\n");
return -1;
}
if(i_size>0) {
int keyframe = pic_out.b_keyframe;
memcpy(mod->mux->buffer, nal->p_payload, i_size);
muxer_write_chunk(mod->mux, i_size, keyframe?AVIIF_KEYFRAME:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
}
else
++mod->mux->encoder_delay;
return i_size;
}
static void uninit(struct vf_instance *vf)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
if (mod->x264)
x264_encoder_close(mod->x264);
}
static int vf_open(vf_instance_t *vf, char *args) {
h264_module_t *mod;
vf->config = config;
vf->default_caps = VFCAP_CONSTANT;
vf->control = control;
vf->query_format = query_format;
vf->put_image = put_image;
vf->uninit = uninit;
vf->priv = malloc(sizeof(h264_module_t));
mod=(h264_module_t*)vf->priv;
mod->mux = (muxer_stream_t*)args;
mod->mux->bih = calloc(1, sizeof(*mod->mux->bih));
mod->mux->bih->biSize = sizeof(*mod->mux->bih);
mod->mux->bih->biPlanes = 1;
mod->mux->bih->biBitCount = 24;
mod->mux->bih->biCompression = mmioFOURCC('h', '2', '6', '4');
return 1;
}
const vf_info_t ve_info_x264 = {
"H.264 encoder",
"x264",
"Bernhard Rosenkraenzer <[email protected]>",
"(C) 2004 LINUX4MEDIA GmbH; (C) 2004 Ark Linux",
vf_open
};
| {
"pile_set_name": "Github"
} |
StartChar: aacute
Encoding: 429 225 173
GlifName: aacute
Width: 1070
VWidth: 0
Flags: W
HStem: -16 134<365.543 663.873> 0 21G<780 930> 964 134<365.326 663.885> 1222 274<558 562>
VStem: 100 150<242.001 839.569> 404 323 780 150<0 117 241.242 840.758 967 1082>
LayerCount: 4
Back
Fore
Refer: 478 714 N 1 0 0 1 304 0 2
Refer: 489 97 N 1 0 0 1 0 0 3
Layer: 2
Layer: 3
EndChar
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2010, Lars-Peter Clausen <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/pm.h>
#include <asm/reboot.h>
#include <asm/mach-jz4740/base.h>
#include <asm/mach-jz4740/timer.h>
static void jz4740_halt(void)
{
while (1) {
__asm__(".set push;\n"
".set mips3;\n"
"wait;\n"
".set pop;\n"
);
}
}
#define JZ_REG_WDT_DATA 0x00
#define JZ_REG_WDT_COUNTER_ENABLE 0x04
#define JZ_REG_WDT_COUNTER 0x08
#define JZ_REG_WDT_CTRL 0x0c
static void jz4740_restart(char *command)
{
void __iomem *wdt_base = ioremap(JZ4740_WDT_BASE_ADDR, 0x0f);
jz4740_timer_enable_watchdog();
writeb(0, wdt_base + JZ_REG_WDT_COUNTER_ENABLE);
writew(0, wdt_base + JZ_REG_WDT_COUNTER);
writew(0, wdt_base + JZ_REG_WDT_DATA);
writew(BIT(2), wdt_base + JZ_REG_WDT_CTRL);
writeb(1, wdt_base + JZ_REG_WDT_COUNTER_ENABLE);
jz4740_halt();
}
#define JZ_REG_RTC_CTRL 0x00
#define JZ_REG_RTC_HIBERNATE 0x20
#define JZ_RTC_CTRL_WRDY BIT(7)
static void jz4740_power_off(void)
{
void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x24);
uint32_t ctrl;
do {
ctrl = readl(rtc_base + JZ_REG_RTC_CTRL);
} while (!(ctrl & JZ_RTC_CTRL_WRDY));
writel(1, rtc_base + JZ_REG_RTC_HIBERNATE);
jz4740_halt();
}
void jz4740_reset_init(void)
{
_machine_restart = jz4740_restart;
_machine_halt = jz4740_halt;
pm_power_off = jz4740_power_off;
}
| {
"pile_set_name": "Github"
} |
/**
* Implementation package for JSR-107 (javax.cache aka "JCache") based caches.
* Provides a {@link org.springframework.cache.CacheManager CacheManager}
* and {@link org.springframework.cache.Cache Cache} implementation for
* use in a Spring context, using a JSR-107 compliant cache provider.
*/
@NonNullApi
@NonNullFields
package org.springframework.cache.jcache;
import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;
| {
"pile_set_name": "Github"
} |
package com.medlinker.hybridsdk.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.webkit.WebView;
/**
* Created by vane on 16/6/7.
*/
public class HybridWebView extends WebView {
public HybridWebView(Context context) {
super(context);
}
public HybridWebView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public HybridWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
}
| {
"pile_set_name": "Github"
} |
95250e0630f4674e364770a30046737abadd13d8
| {
"pile_set_name": "Github"
} |
/* main.c
* Created by Mengyao Zhao on 06/23/11.
* Version 1.2.2
* Last revision by Mengyao Zhao on 2017-05-30.
*/
#include <stdlib.h>
#include <stdint.h>
#include <emmintrin.h>
#include <zlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <math.h>
#include <unistd.h>
#include "ssw.h"
#include "kseq.h"
#ifdef __GNUC__
#define LIKELY(x) __builtin_expect((x),1)
#define UNLIKELY(x) __builtin_expect((x),0)
#else
#define LIKELY(x) (x)
#define UNLIKELY(x) (x)
#endif
/*! @function
@abstract Round an integer to the next closest power-2 integer.
@param x integer to be rounded (in place)
@discussion x will be modified.
*/
#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
KSEQ_INIT(gzFile, gzread)
static void reverse_comple(const char* seq, char* rc) {
int32_t end = strlen(seq), start = 0;
static const int8_t rc_table[128] = {
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 84, 4, 71, 4, 4, 4, 67, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 65, 65, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 84, 4, 71, 4, 4, 4, 67, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 65, 65, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
};
rc[end] = '\0';
-- end;
while (LIKELY(start < end)) {
rc[start] = (char)rc_table[(int8_t)seq[end]];
rc[end] = (char)rc_table[(int8_t)seq[start]];
++ start;
-- end;
}
if (start == end) rc[start] = (char)rc_table[(int8_t)seq[start]];
}
static void ssw_write (s_align* a,
const kseq_t* ref_seq,
const kseq_t* read,
const char* read_seq, // strand == 0: original read; strand == 1: reverse complement read
const int8_t* ref_num,
const int8_t* read_num,
const int8_t* table,
int8_t strand, // 0: forward aligned ; 1: reverse complement aligned
int8_t sam) { // 0: Blast like output; 1: Sam format output
int32_t mismatch;
if (sam == 0) { // Blast like output
fprintf(stdout, "target_name: %s\nquery_name: %s\noptimal_alignment_score: %d\t", ref_seq->name.s, read->name.s, a->score1);
if (a->score2 > 0) fprintf(stdout, "suboptimal_alignment_score: %d\t", a->score2);
if (strand == 0) fprintf(stdout, "strand: +\t");
else fprintf(stdout, "strand: -\t");
if (a->ref_begin1 + 1) fprintf(stdout, "target_begin: %d\t", a->ref_begin1 + 1);
fprintf(stdout, "target_end: %d\t", a->ref_end1 + 1);
if (a->read_begin1 + 1) fprintf(stdout, "query_begin: %d\t", a->read_begin1 + 1);
fprintf(stdout, "query_end: %d\n\n", a->read_end1 + 1);
if (a->cigar) {
int32_t c = 0, left = 0, e = 0, qb = a->ref_begin1, pb = a->read_begin1;
uint32_t i;
while (e < a->cigarLen || left > 0) {
int32_t count = 0;
int32_t q = qb;
int32_t p = pb;
fprintf(stdout, "Target: %8d ", q + 1);
for (c = e; c < a->cigarLen; ++c) {
char letter = cigar_int_to_op(a->cigar[c]);
uint32_t length = cigar_int_to_len(a->cigar[c]);
uint32_t l = (count == 0 && left > 0) ? left: length;
for (i = 0; i < l; ++i) {
if (letter == 'I') fprintf(stdout, "-");
else {
fprintf(stdout, "%c", *(ref_seq->seq.s + q));
++ q;
}
++ count;
if (count == 60) goto step2;
}
}
step2:
fprintf(stdout, " %d\n ", q);
q = qb;
count = 0;
for (c = e; c < a->cigarLen; ++c) {
char letter = cigar_int_to_op(a->cigar[c]);
uint32_t length = cigar_int_to_len(a->cigar[c]);
uint32_t l = (count == 0 && left > 0) ? left: length;
for (i = 0; i < l; ++i){
if (letter == 'M') {
if (table[(int)*(ref_seq->seq.s + q)] == table[(int)*(read_seq + p)])fprintf(stdout, "|");
else fprintf(stdout, "*");
++q;
++p;
} else {
fprintf(stdout, " ");
if (letter == 'I') ++p;
else ++q;
}
++ count;
if (count == 60) {
qb = q;
goto step3;
}
}
}
step3:
p = pb;
fprintf(stdout, "\nQuery: %8d ", p + 1);
count = 0;
for (c = e; c < a->cigarLen; ++c) {
char letter = cigar_int_to_op(a->cigar[c]);
uint32_t length = cigar_int_to_len(a->cigar[c]);
uint32_t l = (count == 0 && left > 0) ? left: length;
for (i = 0; i < l; ++i) {
if (letter == 'D') fprintf(stdout, "-");
else {
fprintf(stdout, "%c", *(read_seq + p));
++p;
}
++ count;
if (count == 60) {
pb = p;
left = l - i - 1;
e = (left == 0) ? (c + 1) : c;
goto end;
}
}
}
e = c;
left = 0;
end:
fprintf(stdout, " %d\n\n", p);
}
}
}else { // Sam format output
fprintf(stdout, "%s\t", read->name.s);
if (a->score1 == 0) fprintf(stdout, "4\t*\t0\t255\t*\t*\t0\t0\t*\t*\n");
else {
int32_t c, p;
uint32_t mapq = -4.343 * log(1 - (double)abs(a->score1 - a->score2)/(double)a->score1);
mapq = (uint32_t) (mapq + 4.99);
mapq = mapq < 254 ? mapq : 254;
if (strand) fprintf(stdout, "16\t");
else fprintf(stdout, "0\t");
fprintf(stdout, "%s\t%d\t%d\t", ref_seq->name.s, a->ref_begin1 + 1, mapq);
mismatch = mark_mismatch(a->ref_begin1, a->read_begin1, a->read_end1, ref_num, read_num, read->seq.l, &a->cigar, &a->cigarLen);
for (c = 0; c < a->cigarLen; ++c) {
char letter = cigar_int_to_op(a->cigar[c]);
uint32_t length = cigar_int_to_len(a->cigar[c]);
fprintf(stdout, "%lu%c", (unsigned long)length, letter);
}
fprintf(stdout, "\t*\t0\t0\t");
fprintf(stdout, "%s", read_seq);
fprintf(stdout, "\t");
if (read->qual.s && strand) {
for (p = read->qual.l - 1; p >= 0; --p) fprintf(stdout, "%c", read->qual.s[p]);
}else if (read->qual.s) fprintf (stdout, "%s", read->qual.s);
else fprintf(stdout, "*");
fprintf(stdout, "\tAS:i:%d", a->score1);
fprintf(stdout,"\tNM:i:%d\t", mismatch);
if (a->score2 > 0) fprintf(stdout, "ZS:i:%d\n", a->score2);
else fprintf(stdout, "\n");
}
}
}
int main (int argc, char * const argv[]) {
clock_t start, end;
float cpu_time;
gzFile read_fp, ref_fp;
kseq_t *read_seq, *ref_seq;
int32_t l, m, k, match = 2, mismatch = 2, gap_open = 3, gap_extension = 1, path = 0, reverse = 0, n = 5, sam = 0, protein = 0, header = 0, s1 = 67108864, s2 = 128, filter = 0;
int8_t* mata = (int8_t*)calloc(25, sizeof(int8_t));
const int8_t* mat = mata;
char mat_name[16];
mat_name[0] = '\0';
int8_t* ref_num = (int8_t*)malloc(s1);
int8_t* num = (int8_t*)malloc(s2), *num_rc = 0;
char* read_rc = 0;
static const int8_t mat50[] = {
// A R N D C Q E G H I L K M F P S T W Y V B Z X *
5, -2, -1, -2, -1, -1, -1, 0, -2, -1, -2, -1, -1, -3, -1, 1, 0, -3, -2, 0, -2, -1, -1, -5, // A
-2, 7, -1, -2, -4, 1, 0, -3, 0, -4, -3, 3, -2, -3, -3, -1, -1, -3, -1, -3, -1, 0, -1, -5, // R
-1, -1, 7, 2, -2, 0, 0, 0, 1, -3, -4, 0, -2, -4, -2, 1, 0, -4, -2, -3, 5, 0, -1, -5, // N
-2, -2, 2, 8, -4, 0, 2, -1, -1, -4, -4, -1, -4, -5, -1, 0, -1, -5, -3, -4, 6, 1, -1, -5, // D
-1, -4, -2, -4, 13, -3, -3, -3, -3, -2, -2, -3, -2, -2, -4, -1, -1, -5, -3, -1, -3, -3, -1, -5, // C
-1, 1, 0, 0, -3, 7, 2, -2, 1, -3, -2, 2, 0, -4, -1, 0, -1, -1, -1, -3, 0, 4, -1, -5, // Q
-1, 0, 0, 2, -3, 2, 6, -3, 0, -4, -3, 1, -2, -3, -1, -1, -1, -3, -2, -3, 1, 5, -1, -5, // E
0, -3, 0, -1, -3, -2, -3, 8, -2, -4, -4, -2, -3, -4, -2, 0, -2, -3, -3, -4, -1, -2, -1, -5, // G
-2, 0, 1, -1, -3, 1, 0, -2, 10, -4, -3, 0, -1, -1, -2, -1, -2, -3, 2, -4, 0, 0, -1, -5, // H
-1, -4, -3, -4, -2, -3, -4, -4, -4, 5, 2, -3, 2, 0, -3, -3, -1, -3, -1, 4, -4, -3, -1, -5, // I
-2, -3, -4, -4, -2, -2, -3, -4, -3, 2, 5, -3, 3, 1, -4, -3, -1, -2, -1, 1, -4, -3, -1, -5, // L
-1, 3, 0, -1, -3, 2, 1, -2, 0, -3, -3, 6, -2, -4, -1, 0, -1, -3, -2, -3, 0, 1, -1, -5, // K
-1, -2, -2, -4, -2, 0, -2, -3, -1, 2, 3, -2, 7, 0, -3, -2, -1, -1, 0, 1, -3, -1, -1, -5, // M
-3, -3, -4, -5, -2, -4, -3, -4, -1, 0, 1, -4, 0, 8, -4, -3, -2, 1, 4, -1, -4, -4, -1, -5, // F
-1, -3, -2, -1, -4, -1, -1, -2, -2, -3, -4, -1, -3, -4, 10, -1, -1, -4, -3, -3, -2, -1, -1, -5, // P
1, -1, 1, 0, -1, 0, -1, 0, -1, -3, -3, 0, -2, -3, -1, 5, 2, -4, -2, -2, 0, 0, -1, -5, // S
0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 2, 5, -3, -2, 0, 0, -1, -1, -5, // T
-3, -3, -4, -5, -5, -1, -3, -3, -3, -3, -2, -3, -1, 1, -4, -4, -3, 15, 2, -3, -5, -2, -1, -5, // W
-2, -1, -2, -3, -3, -1, -2, -3, 2, -1, -1, -2, 0, 4, -3, -2, -2, 2, 8, -1, -3, -2, -1, -5, // Y
0, -3, -3, -4, -1, -3, -3, -4, -4, 4, 1, -3, 1, -1, -3, -2, 0, -3, -1, 5, -3, -3, -1, -5, // V
-2, -1, 5, 6, -3, 0, 1, -1, 0, -4, -4, 0, -3, -4, -2, 0, 0, -5, -3, -3, 6, 1, -1, -5, // B
-1, 0, 0, 1, -3, 4, 5, -2, 0, -3, -3, 1, -1, -4, -1, 0, -1, -2, -2, -3, 1, 5, -1, -5, // Z
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -5, // X
-5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, -5, 1 // *
};
/* This table is used to transform amino acid letters into numbers. */
int8_t aa_table[128] = {
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
23, 0, 20, 4, 3, 6, 13, 7, 8, 9, 23, 11, 10, 12, 2, 23,
14, 5, 1, 15, 16, 23, 19, 17, 22, 18, 21, 23, 23, 23, 23, 23,
23, 0, 20, 4, 3, 6, 13, 7, 8, 9, 23, 11, 10, 12, 2, 23,
14, 5, 1, 15, 16, 23, 19, 17, 22, 18, 21, 23, 23, 23, 23, 23
};
/* This table is used to transform nucleotide letters into numbers. */
int8_t nt_table[128] = {
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 0, 4, 1, 4, 4, 4, 2, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
};
int8_t* table = nt_table;
// Parse command line.
while ((l = getopt(argc, argv, "m:x:o:e:a:f:pcrsh")) >= 0) {
switch (l) {
case 'm': match = atoi(optarg); break;
case 'x': mismatch = atoi(optarg); break;
case 'o': gap_open = atoi(optarg); break;
case 'e': gap_extension = atoi(optarg); break;
case 'a': strcpy(mat_name, optarg); break;
case 'f': filter = atoi(optarg); break;
case 'p': protein = 1; break;
case 'c': path = 1; break;
case 'r': reverse = 1; break;
case 's': sam = 1; break;
case 'h': header = 1; break;
}
}
if (optind + 2 > argc) {
fprintf(stderr, "\n");
fprintf(stderr, "Usage: ssw_test [options] ... <target.fasta> <query.fasta>(or <query.fastq>)\n");
fprintf(stderr, "Options:\n");
fprintf(stderr, "\t-m N\tN is a positive integer for weight match in genome sequence alignment. [default: 2]\n");
fprintf(stderr, "\t-x N\tN is a positive integer. -N will be used as weight mismatch in genome sequence alignment. [default: 2]\n");
fprintf(stderr, "\t-o N\tN is a positive integer. -N will be used as the weight for the gap opening. [default: 3]\n");
fprintf(stderr, "\t-e N\tN is a positive integer. -N will be used as the weight for the gap extension. [default: 1]\n");
fprintf(stderr, "\t-p\tDo protein sequence alignment. Without this option, the ssw_test will do genome sequence alignment.\n");
fprintf(stderr, "\t-a FILE\tFILE is either the Blosum or Pam weight matrix. [default: Blosum50]\n");
fprintf(stderr, "\t-c\tReturn the alignment path.\n");
fprintf(stderr, "\t-f N\tN is a positive integer. Only output the alignments with the Smith-Waterman score >= N.\n");
fprintf(stderr, "\t-r\tThe best alignment will be picked between the original read alignment and the reverse complement read alignment.\n");
fprintf(stderr, "\t-s\tOutput in SAM format. [default: no header]\n");
fprintf(stderr, "\t-h\tIf -s is used, include header in SAM output.\n\n");
return 1;
}
// initialize scoring matrix for genome sequences
for (l = k = 0; LIKELY(l < 4); ++l) {
for (m = 0; LIKELY(m < 4); ++m) mata[k++] = l == m ? match : -mismatch; /* weight_match : -weight_mismatch */
mata[k++] = 0; // ambiguous base
}
for (m = 0; LIKELY(m < 5); ++m) mata[k++] = 0;
if (protein == 1 && (! strcmp(mat_name, "\0"))) {
n = 24;
table = aa_table;
mat = mat50;
} else if (strcmp(mat_name, "\0")) {
// Parse score matrix.
FILE *f_mat = fopen(mat_name, "r");
char line[128];
mata = (int8_t*)realloc(mata, 1024 * sizeof(int8_t));
k = 0;
m = 0;
while (fgets(line, 128, f_mat)) {
if (line[0] == '*' || (line[0] >= 'A' && line[0] <= 'Z')) {
if (line[0] >= 'A' && line[0] <= 'Z') aa_table[(int)line[0]] = aa_table[(int)line[0] + 32] = m;
char str[4], *s = str;
str[0] = '\0';
l = 1;
while (line[l]) {
if ((line[l] >= '0' && line[l] <= '9') || line[l] == '-') *s++ = line[l];
else if (str[0] != '\0') {
*s = '\0';
mata[k++] = (int8_t)atoi(str);
s = str;
str[0] = '\0';
}
++l;
}
if (str[0] != '\0') {
*s = '\0';
mata[k++] = (int8_t)atoi(str);
s = str;
str[0] = '\0';
}
++m;
}
}
if (k == 0) {
fprintf(stderr, "Problem of reading the weight matrix file.\n");
return 1;
}
fclose(f_mat);
n = m;
table = aa_table;
mat = mata;
}
read_fp = gzopen(argv[optind + 1], "r");
if (! read_fp) {
fprintf (stderr, "gzopen of '%s' failed.\n", argv[optind + 1]);
exit (EXIT_FAILURE);
}
read_seq = kseq_init(read_fp);
if (sam && header && path) {
fprintf(stdout, "@HD\tVN:1.4\tSO:queryname\n");
ref_fp = gzopen(argv[optind], "r");
ref_seq = kseq_init(ref_fp);
while ((l = kseq_read(ref_seq)) >= 0) fprintf(stdout, "@SQ\tSN:%s\tLN:%d\n", ref_seq->name.s, (int32_t)ref_seq->seq.l);
kseq_destroy(ref_seq);
gzclose(ref_fp);
} else if (sam && !path) {
fprintf(stderr, "SAM format output is only available together with option -c.\n");
sam = 0;
}
// alignment
if (reverse == 1 && n == 5) {
read_rc = (char*)malloc(s2);
num_rc = (int8_t*)malloc(s2);
}
start = clock();
while (kseq_read(read_seq) >= 0) {
s_profile* p, *p_rc = 0;
int32_t readLen = read_seq->seq.l;
int32_t maskLen = readLen / 2;
while (readLen >= s2) {
++s2;
kroundup32(s2);
num = (int8_t*)realloc(num, s2);
if (reverse == 1 && n == 5) {
read_rc = (char*)realloc(read_rc, s2);
num_rc = (int8_t*)realloc(num_rc, s2);
}
}
for (m = 0; m < readLen; ++m) num[m] = table[(int)read_seq->seq.s[m]];
p = ssw_init(num, readLen, mat, n, 2);
if (reverse == 1 && n == 5) {
reverse_comple(read_seq->seq.s, read_rc);
for (m = 0; m < readLen; ++m) num_rc[m] = table[(int)read_rc[m]];
p_rc = ssw_init(num_rc, readLen, mat, n, 2);
}else if (reverse == 1 && n == 24) {
fprintf (stderr, "Reverse complement alignment is not available for protein sequences. \n");
return 1;
}
ref_fp = gzopen(argv[optind], "r");
ref_seq = kseq_init(ref_fp);
while (kseq_read(ref_seq) >= 0) {
s_align* result, *result_rc = 0;
int32_t refLen = ref_seq->seq.l;
int8_t flag = 0;
while (refLen > s1) {
++s1;
kroundup32(s1);
ref_num = (int8_t*)realloc(ref_num, s1);
}
for (m = 0; m < refLen; ++m) ref_num[m] = table[(int)ref_seq->seq.s[m]];
if (path == 1) flag = 2;
result = ssw_align (p, ref_num, refLen, gap_open, gap_extension, flag, filter, 0, maskLen);
if (reverse == 1 && protein == 0)
result_rc = ssw_align(p_rc, ref_num, refLen, gap_open, gap_extension, flag, filter, 0, maskLen);
if (result_rc && result_rc->score1 > result->score1 && result_rc->score1 >= filter) {
if (sam) ssw_write (result_rc, ref_seq, read_seq, read_rc, ref_num, num_rc, table, 1, 1);
else ssw_write (result_rc, ref_seq, read_seq, read_rc, ref_num, num_rc, table, 1, 0);
}else if (result && result->score1 >= filter){
if (sam) ssw_write(result, ref_seq, read_seq, read_seq->seq.s, ref_num, num, table, 0, 1);
else ssw_write(result, ref_seq, read_seq, read_seq->seq.s, ref_num, num, table, 0, 0);
} else if (! result) return 1;
if (result_rc) align_destroy(result_rc);
align_destroy(result);
}
if(p_rc) init_destroy(p_rc);
init_destroy(p);
kseq_destroy(ref_seq);
gzclose(ref_fp);
}
end = clock();
cpu_time = ((float) (end - start)) / CLOCKS_PER_SEC;
fprintf(stderr, "CPU time: %f seconds\n", cpu_time);
if (num_rc) {
free(num_rc);
free(read_rc);
}
kseq_destroy(read_seq);
gzclose(read_fp);
free(num);
free(ref_num);
free(mata);
return 0;
}
| {
"pile_set_name": "Github"
} |
# Run chatty tests. Assert on CONT lines.
! go test chatty_test.go -v -bench . chatty_bench
# Sanity check that output occurs.
stdout -count=2 'this is sub-0'
stdout -count=2 'this is sub-1'
stdout -count=2 'this is sub-2'
stdout -count=1 'error from sub-0'
stdout -count=1 'error from sub-1'
stdout -count=1 'error from sub-2'
# Benchmarks should not print CONT.
! stdout CONT
-- chatty_test.go --
package chatty_bench
import (
"testing"
"fmt"
)
func BenchmarkChatty(b *testing.B) {
for i := 0; i < 3; i++ {
b.Run(fmt.Sprintf("sub-%d", i), func(b *testing.B) {
for j := 0; j < 2; j++ {
b.Logf("this is sub-%d", i)
}
b.Errorf("error from sub-%d", i)
})
}
} | {
"pile_set_name": "Github"
} |
<?php
/*
FusionPBX
Version: MPL 1.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 FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <[email protected]>
Portions created by the Initial Developer are Copyright (C) 2008-2019
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <[email protected]>
*/
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "xml_cdr_statistics_inc.php";
//check permissions
if (permission_exists('xml_cdr_statistics')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//additional includes
$document['title'] = $text['title-call-statistics'];
require_once "resources/header.php";
//search url
$search_url = '';
if (permission_exists('xml_cdr_search_advanced')) {
$search_url .= '&redirect=xml_cdr_statistics';
}
if(permission_exists('xml_cdr_all') && ($_GET['showall'] === 'true')){
$search_url .= '&showall=true';
}
if (strlen($_GET['direction']) > 0) {
$search_url .= '&direction='.urlencode($_GET['direction']);
}
if (strlen($_GET['leg']) > 0) {
$search_url .= '&leg='.urlencode($_GET['leg']);
}
if (strlen($_GET['caller_id_name']) > 0) {
$search_url .= '&caller_id_name='.urlencode($_GET['caller_id_name']);
}
if (strlen($_GET['caller_extension_uuid']) > 0) {
$search_url .= '&caller_extension_uuid='.urlencode($_GET['caller_extension_uuid']);
}
if (strlen($_GET['caller_id_number']) > 0) {
$search_url .= '&caller_id_number='.urlencode($_GET['caller_id_number']);
}
if (strlen($_GET['destination_number']) > 0) {
$search_url .= '&destination_number='.urlencode($_GET['destination_number']);
}
if (strlen($_GET['context']) > 0) {
$search_url .= '&context='.urlencode($_GET['context']);
}
if (strlen($_GET['start_stamp_begin']) > 0) {
$search_url .= '&start_stamp_begin='.urlencode($_GET['start_stamp_begin']);
}
if (strlen($_GET['start_stamp_end']) > 0) {
$search_url .= '&start_stamp_end='.urlencode($_GET['start_stamp_end']);
}
if (strlen($_GET['answer_stamp_begin']) > 0) {
$search_url .= '&answer_stamp_begin='.urlencode($_GET['answer_stamp_begin']);
}
if (strlen($_GET['answer_stamp_end']) > 0) {
$search_url .= '&answer_stamp_end='.urlencode($_GET['answer_stamp_end']);
}
if (strlen($_GET['end_stamp_begin']) > 0) {
$search_url .= '&end_stamp_begin='.urlencode($_GET['end_stamp_begin']);
}
if (strlen($_GET['end_stamp_end']) > 0) {
$search_url .= '&end_stamp_end='.urlencode($_GET['end_stamp_end']);
}
if (strlen($_GET['duration']) > 0) {
$search_url .= '&duration='.urlencode($_GET['duration']);
}
if (strlen($_GET['billsec']) > 0) {
$search_url .= '&billsec='.urlencode($_GET['billsec']);
}
if (strlen($_GET['hangup_cause']) > 0) {
$search_url .= '&hangup_cause='.urlencode($_GET['hangup_cause']);
}
if (strlen($_GET['uuid']) > 0) {
$search_url .= '&uuid='.urlencode($_GET['uuid']);
}
if (strlen($_GET['bleg_uuid']) > 0) {
$search_url .= '&bleg_uuid='.urlencode($_GET['bleg_uuid']);
}
if (strlen($_GET['accountcode']) > 0) {
$search_url .= '&accountcode='.urlencode($_GET['accountcode']);
}
if (strlen($_GET['read_codec']) > 0) {
$search_url .= '&read_codec='.urlencode($_GET['read_codec']);
}
if (strlen($_GET['write_codec']) > 0) {
$search_url .= '&write_codec='.urlencode($_GET['write_codec']);
}
if (strlen($_GET['remote_media_ip']) > 0) {
$search_url .= '&remote_media_ip='.urlencode($_GET['remote_media_ip']);
}
if (strlen($_GET['network_addr']) > 0) {
$search_url .= '&network_addr='.urlencode($_GET['network_addr']);
}
if (strlen($_GET['mos_comparison']) > 0) {
$search_url .= '&mos_comparison='.urlencode($_GET['mos_comparison']);
}
if (strlen($_GET['mos_score']) > 0) {
$search_url .= '&mos_score='.urlencode($_GET['mos_score']);
}
//show the content
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-call-statistics']."</b></div>\n";
echo " <div class='actions'>\n";
if (substr_count($_SERVER['HTTP_REFERER'], 'app/xml_cdr/xml_cdr.php') != 0) {
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'xml_cdr.php']);
}
if (permission_exists('xml_cdr_search_advanced')) {
echo button::create(['type'=>'button','label'=>$text['button-advanced_search'],'icon'=>'tools','link'=>'xml_cdr_search.php?type=advanced'.$search_url]);
}
if (permission_exists('xml_cdr_all') && $_GET['showall'] != 'true') {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'xml_cdr_statistics.php?showall=true'.$search_url]);
}
echo button::create(['type'=>'button','label'=>$text['button-extension_summary'],'icon'=>'list','link'=>'xml_cdr_extension_summary.php']);
echo button::create(['type'=>'button','label'=>$text['button-download_csv'],'icon'=>$_SESSION['theme']['button_icon_download'],'link'=>'xml_cdr_statistics_csv.php?type=csv'.$search_url]);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo $text['label-call-statistics-description']."\n";
echo "<br /><br />\n";
?>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/flot/excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/flot/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/flot/jquery.flot.time.js"></script>
<div align='center'>
<table>
<tr>
<td align='left' colspan='2'>
<div id="placeholder-legend" style="padding:2px;margin-bottom: 8px;border-radius: 3px 3px 3px 3px;border: 1px solid #E6E6E6;display: inline-block;margin: 0 auto;"></div>
</td>
</tr>
<tr>
<td align='left'>
<div id="placeholder" style="width:700px;height:180px;margin-right:25px;"></div>
</td>
<td align='left' valign='top'>
<p id="choices"></p>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
$(function () {
var datasets = {
"volume": {
label: "Volume",
data: <?php echo json_encode($graph['volume']); ?>
},
"minutes": {
label: "Minutes",
data: <?php echo json_encode($graph['minutes']); ?>
},
"call_per_min": {
label: "Calls Per Min",
data: <?php echo json_encode($graph['call_per_min']); ?>
},
"missed": {
label: "Missed",
data: <?php echo json_encode($graph['missed']); ?>
},
"asr": {
label: "ASR",
data: <?php echo json_encode($graph['asr']); ?>
},
"aloc": {
label: "ALOC",
data: <?php echo json_encode($graph['aloc']); ?>
},
};
// hard-code color indices to prevent them from shifting as
// countries are turned on/off
var i = 0;
$.each(datasets, function(key, val) {
val.color = i;
++i;
});
// insert checkboxes
var choiceContainer = $("#choices");
$.each(datasets, function(key, val) {
choiceContainer.append('<br /><span style="white-space: nowrap;"><input type="checkbox" name="' + key +
'" checked="checked" id="id' + key + '"> ' +
'<label for="id' + key + '">'
+ val.label + '</label></span>');
});
choiceContainer.find("input").on('click', plotAccordingToChoices);
function plotAccordingToChoices() {
var data = [];
choiceContainer.find("input:checked").each(function () {
var key = $(this).attr("name");
if (key && datasets[key])
data.push(datasets[key]);
});
if (data.length > 0)
$.plot($("#placeholder"), data, {
legend:{
show: true,
noColumns: 10,
container: $("#placeholder-legend"),
placement: 'outsideGrid',
},
yaxis: { min: 0 },
<?php
if ($hours <= 48) {
echo "xaxis: {mode: \"time\",timeformat: \"%d:%H\",minTickSize: [1, \"hour\"]}";
}
else if ($hours > 48 && $hours < 168) {
echo "xaxis: {mode: \"time\",timeformat: \"%m:%d\",minTickSize: [1, \"day\"]}";
}
else {
echo "xaxis: {mode: \"time\",timeformat: \"%m:%d\",minTickSize: [1, \"month\"]}";
}
?>
});
}
plotAccordingToChoices();
});
</script>
<?php
//show the results
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
echo " <th>".$text['table-hours']."</th>\n";
echo " <th>".$text['table-date']."</th>\n";
echo " <th class='no-wrap'>".$text['table-time']."</th>\n";
echo " <th>Volume</th>\n";
echo " <th>".$text['table-minutes']."</th>\n";
echo " <th>".$text['table-calls-per-minute']."</th>\n";
echo " <th class='center'>".$text['table-missed']."</th>\n";
echo " <th>ASR</th>\n";
echo " <th>ALOC</th>\n";
echo "</tr>\n";
$i = 0;
foreach ($stats as $row) {
echo "<tr class='list-row'>\n";
if ($i <= $hours) {
echo " <td>".($i+1)."</td>\n";
}
else if ($i == $hours+1) {
echo " <br /><br />\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>\n";
echo " <br /><br />\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr class='list-header'>\n";
echo " <th class='no-wrap'>".$text['table-days']."</th>\n";
echo " <th class='no-wrap'>".$text['table-date']."</th>\n";
echo " <th class='no-wrap'>".$text['table-time']."</th>\n";
echo " <th>Volume</th>\n";
echo " <th>".$text['table-minutes']."</th>\n";
echo " <th class='no-wrap'>".$text['table-calls-per-minute']."</th>\n";
echo " <th class='center'>".$text['table-missed']."</th>\n";
echo " <th>ASR</th>\n";
echo " <th>ALOC</th>\n";
echo "</tr>\n";
echo "<tr class='list-row'>\n";
}
if ($i > $hours) {
echo " <td>" . floor(escape($row['hours'])/24) . "</td>\n";
}
if ($i <= $hours) {
echo " <td>".date('j M', $row['start_epoch'])."</td>\n";
echo " <td>".date('H:i', $row['start_epoch'])." - ".date('H:i', $row['stop_epoch'])." </td>\n";
}
else {
echo " <td>".date('j M', $row['start_epoch'])." </td>\n";
echo " <td>".date('H:i', $row['start_epoch'])." - ".date('j M H:i', $row['stop_epoch'])." </td>\n";
}
echo " <td>".escape($row['volume'])." </td>\n";
echo " <td>".(round(escape($row['minutes']),2))." </td>\n";
echo " <td>".(round(escape($row['avg_min']),2))." / ".(round(escape($row['cpm_ans']),2))." </td>\n";
echo " <td class='center'><a href=\"xml_cdr.php?missed=true&direction=$direction&start_epoch=".escape($row['start_epoch'])."&stop_epoch=".escape($row['stop_epoch'])."\">".escape($row['missed'])."</a> </td>\n";
echo " <td>".(round(escape($row['asr']),2))." </td>\n";
echo " <td>".(round(escape($row['aloc']),2))." </td>\n";
echo "</tr >\n";
$i++;
}
echo "</table>\n";
echo "<br><br>";
//include the footer
require_once "resources/footer.php";
?> | {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0
/*
* Filesystem-level keyring for fscrypt
*
* Copyright 2019 Google LLC
*/
/*
* This file implements management of fscrypt master keys in the
* filesystem-level keyring, including the ioctls:
*
* - FS_IOC_ADD_ENCRYPTION_KEY
* - FS_IOC_REMOVE_ENCRYPTION_KEY
* - FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS
* - FS_IOC_GET_ENCRYPTION_KEY_STATUS
*
* See the "User API" section of Documentation/filesystems/fscrypt.rst for more
* information about these ioctls.
*/
#include <crypto/skcipher.h>
#include <linux/key-type.h>
#include <linux/random.h>
#include <linux/seq_file.h>
#include "fscrypt_private.h"
static void wipe_master_key_secret(struct fscrypt_master_key_secret *secret)
{
fscrypt_destroy_hkdf(&secret->hkdf);
memzero_explicit(secret, sizeof(*secret));
}
static void move_master_key_secret(struct fscrypt_master_key_secret *dst,
struct fscrypt_master_key_secret *src)
{
memcpy(dst, src, sizeof(*dst));
memzero_explicit(src, sizeof(*src));
}
static void free_master_key(struct fscrypt_master_key *mk)
{
size_t i;
wipe_master_key_secret(&mk->mk_secret);
for (i = 0; i <= __FSCRYPT_MODE_MAX; i++) {
crypto_free_skcipher(mk->mk_direct_keys[i]);
crypto_free_skcipher(mk->mk_iv_ino_lblk_64_keys[i]);
crypto_free_skcipher(mk->mk_iv_ino_lblk_32_keys[i]);
}
key_put(mk->mk_users);
kzfree(mk);
}
static inline bool valid_key_spec(const struct fscrypt_key_specifier *spec)
{
if (spec->__reserved)
return false;
return master_key_spec_len(spec) != 0;
}
static int fscrypt_key_instantiate(struct key *key,
struct key_preparsed_payload *prep)
{
key->payload.data[0] = (struct fscrypt_master_key *)prep->data;
return 0;
}
static void fscrypt_key_destroy(struct key *key)
{
free_master_key(key->payload.data[0]);
}
static void fscrypt_key_describe(const struct key *key, struct seq_file *m)
{
seq_puts(m, key->description);
if (key_is_positive(key)) {
const struct fscrypt_master_key *mk = key->payload.data[0];
if (!is_master_key_secret_present(&mk->mk_secret))
seq_puts(m, ": secret removed");
}
}
/*
* Type of key in ->s_master_keys. Each key of this type represents a master
* key which has been added to the filesystem. Its payload is a
* 'struct fscrypt_master_key'. The "." prefix in the key type name prevents
* users from adding keys of this type via the keyrings syscalls rather than via
* the intended method of FS_IOC_ADD_ENCRYPTION_KEY.
*/
static struct key_type key_type_fscrypt = {
.name = "._fscrypt",
.instantiate = fscrypt_key_instantiate,
.destroy = fscrypt_key_destroy,
.describe = fscrypt_key_describe,
};
static int fscrypt_user_key_instantiate(struct key *key,
struct key_preparsed_payload *prep)
{
/*
* We just charge FSCRYPT_MAX_KEY_SIZE bytes to the user's key quota for
* each key, regardless of the exact key size. The amount of memory
* actually used is greater than the size of the raw key anyway.
*/
return key_payload_reserve(key, FSCRYPT_MAX_KEY_SIZE);
}
static void fscrypt_user_key_describe(const struct key *key, struct seq_file *m)
{
seq_puts(m, key->description);
}
/*
* Type of key in ->mk_users. Each key of this type represents a particular
* user who has added a particular master key.
*
* Note that the name of this key type really should be something like
* ".fscrypt-user" instead of simply ".fscrypt". But the shorter name is chosen
* mainly for simplicity of presentation in /proc/keys when read by a non-root
* user. And it is expected to be rare that a key is actually added by multiple
* users, since users should keep their encryption keys confidential.
*/
static struct key_type key_type_fscrypt_user = {
.name = ".fscrypt",
.instantiate = fscrypt_user_key_instantiate,
.describe = fscrypt_user_key_describe,
};
/* Search ->s_master_keys or ->mk_users */
static struct key *search_fscrypt_keyring(struct key *keyring,
struct key_type *type,
const char *description)
{
/*
* We need to mark the keyring reference as "possessed" so that we
* acquire permission to search it, via the KEY_POS_SEARCH permission.
*/
key_ref_t keyref = make_key_ref(keyring, true /* possessed */);
keyref = keyring_search(keyref, type, description, false);
if (IS_ERR(keyref)) {
if (PTR_ERR(keyref) == -EAGAIN || /* not found */
PTR_ERR(keyref) == -EKEYREVOKED) /* recently invalidated */
keyref = ERR_PTR(-ENOKEY);
return ERR_CAST(keyref);
}
return key_ref_to_ptr(keyref);
}
#define FSCRYPT_FS_KEYRING_DESCRIPTION_SIZE \
(CONST_STRLEN("fscrypt-") + sizeof_field(struct super_block, s_id))
#define FSCRYPT_MK_DESCRIPTION_SIZE (2 * FSCRYPT_KEY_IDENTIFIER_SIZE + 1)
#define FSCRYPT_MK_USERS_DESCRIPTION_SIZE \
(CONST_STRLEN("fscrypt-") + 2 * FSCRYPT_KEY_IDENTIFIER_SIZE + \
CONST_STRLEN("-users") + 1)
#define FSCRYPT_MK_USER_DESCRIPTION_SIZE \
(2 * FSCRYPT_KEY_IDENTIFIER_SIZE + CONST_STRLEN(".uid.") + 10 + 1)
static void format_fs_keyring_description(
char description[FSCRYPT_FS_KEYRING_DESCRIPTION_SIZE],
const struct super_block *sb)
{
sprintf(description, "fscrypt-%s", sb->s_id);
}
static void format_mk_description(
char description[FSCRYPT_MK_DESCRIPTION_SIZE],
const struct fscrypt_key_specifier *mk_spec)
{
sprintf(description, "%*phN",
master_key_spec_len(mk_spec), (u8 *)&mk_spec->u);
}
static void format_mk_users_keyring_description(
char description[FSCRYPT_MK_USERS_DESCRIPTION_SIZE],
const u8 mk_identifier[FSCRYPT_KEY_IDENTIFIER_SIZE])
{
sprintf(description, "fscrypt-%*phN-users",
FSCRYPT_KEY_IDENTIFIER_SIZE, mk_identifier);
}
static void format_mk_user_description(
char description[FSCRYPT_MK_USER_DESCRIPTION_SIZE],
const u8 mk_identifier[FSCRYPT_KEY_IDENTIFIER_SIZE])
{
sprintf(description, "%*phN.uid.%u", FSCRYPT_KEY_IDENTIFIER_SIZE,
mk_identifier, __kuid_val(current_fsuid()));
}
/* Create ->s_master_keys if needed. Synchronized by fscrypt_add_key_mutex. */
static int allocate_filesystem_keyring(struct super_block *sb)
{
char description[FSCRYPT_FS_KEYRING_DESCRIPTION_SIZE];
struct key *keyring;
if (sb->s_master_keys)
return 0;
format_fs_keyring_description(description, sb);
keyring = keyring_alloc(description, GLOBAL_ROOT_UID, GLOBAL_ROOT_GID,
current_cred(), KEY_POS_SEARCH |
KEY_USR_SEARCH | KEY_USR_READ | KEY_USR_VIEW,
KEY_ALLOC_NOT_IN_QUOTA, NULL, NULL);
if (IS_ERR(keyring))
return PTR_ERR(keyring);
/* Pairs with READ_ONCE() in fscrypt_find_master_key() */
smp_store_release(&sb->s_master_keys, keyring);
return 0;
}
void fscrypt_sb_free(struct super_block *sb)
{
key_put(sb->s_master_keys);
sb->s_master_keys = NULL;
}
/*
* Find the specified master key in ->s_master_keys.
* Returns ERR_PTR(-ENOKEY) if not found.
*/
struct key *fscrypt_find_master_key(struct super_block *sb,
const struct fscrypt_key_specifier *mk_spec)
{
struct key *keyring;
char description[FSCRYPT_MK_DESCRIPTION_SIZE];
/* pairs with smp_store_release() in allocate_filesystem_keyring() */
keyring = READ_ONCE(sb->s_master_keys);
if (keyring == NULL)
return ERR_PTR(-ENOKEY); /* No keyring yet, so no keys yet. */
format_mk_description(description, mk_spec);
return search_fscrypt_keyring(keyring, &key_type_fscrypt, description);
}
static int allocate_master_key_users_keyring(struct fscrypt_master_key *mk)
{
char description[FSCRYPT_MK_USERS_DESCRIPTION_SIZE];
struct key *keyring;
format_mk_users_keyring_description(description,
mk->mk_spec.u.identifier);
keyring = keyring_alloc(description, GLOBAL_ROOT_UID, GLOBAL_ROOT_GID,
current_cred(), KEY_POS_SEARCH |
KEY_USR_SEARCH | KEY_USR_READ | KEY_USR_VIEW,
KEY_ALLOC_NOT_IN_QUOTA, NULL, NULL);
if (IS_ERR(keyring))
return PTR_ERR(keyring);
mk->mk_users = keyring;
return 0;
}
/*
* Find the current user's "key" in the master key's ->mk_users.
* Returns ERR_PTR(-ENOKEY) if not found.
*/
static struct key *find_master_key_user(struct fscrypt_master_key *mk)
{
char description[FSCRYPT_MK_USER_DESCRIPTION_SIZE];
format_mk_user_description(description, mk->mk_spec.u.identifier);
return search_fscrypt_keyring(mk->mk_users, &key_type_fscrypt_user,
description);
}
/*
* Give the current user a "key" in ->mk_users. This charges the user's quota
* and marks the master key as added by the current user, so that it cannot be
* removed by another user with the key. Either the master key's key->sem must
* be held for write, or the master key must be still undergoing initialization.
*/
static int add_master_key_user(struct fscrypt_master_key *mk)
{
char description[FSCRYPT_MK_USER_DESCRIPTION_SIZE];
struct key *mk_user;
int err;
format_mk_user_description(description, mk->mk_spec.u.identifier);
mk_user = key_alloc(&key_type_fscrypt_user, description,
current_fsuid(), current_gid(), current_cred(),
KEY_POS_SEARCH | KEY_USR_VIEW, 0, NULL);
if (IS_ERR(mk_user))
return PTR_ERR(mk_user);
err = key_instantiate_and_link(mk_user, NULL, 0, mk->mk_users, NULL);
key_put(mk_user);
return err;
}
/*
* Remove the current user's "key" from ->mk_users.
* The master key's key->sem must be held for write.
*
* Returns 0 if removed, -ENOKEY if not found, or another -errno code.
*/
static int remove_master_key_user(struct fscrypt_master_key *mk)
{
struct key *mk_user;
int err;
mk_user = find_master_key_user(mk);
if (IS_ERR(mk_user))
return PTR_ERR(mk_user);
err = key_unlink(mk->mk_users, mk_user);
key_put(mk_user);
return err;
}
/*
* Allocate a new fscrypt_master_key which contains the given secret, set it as
* the payload of a new 'struct key' of type fscrypt, and link the 'struct key'
* into the given keyring. Synchronized by fscrypt_add_key_mutex.
*/
static int add_new_master_key(struct fscrypt_master_key_secret *secret,
const struct fscrypt_key_specifier *mk_spec,
struct key *keyring)
{
struct fscrypt_master_key *mk;
char description[FSCRYPT_MK_DESCRIPTION_SIZE];
struct key *key;
int err;
mk = kzalloc(sizeof(*mk), GFP_KERNEL);
if (!mk)
return -ENOMEM;
mk->mk_spec = *mk_spec;
move_master_key_secret(&mk->mk_secret, secret);
init_rwsem(&mk->mk_secret_sem);
refcount_set(&mk->mk_refcount, 1); /* secret is present */
INIT_LIST_HEAD(&mk->mk_decrypted_inodes);
spin_lock_init(&mk->mk_decrypted_inodes_lock);
if (mk_spec->type == FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER) {
err = allocate_master_key_users_keyring(mk);
if (err)
goto out_free_mk;
err = add_master_key_user(mk);
if (err)
goto out_free_mk;
}
/*
* Note that we don't charge this key to anyone's quota, since when
* ->mk_users is in use those keys are charged instead, and otherwise
* (when ->mk_users isn't in use) only root can add these keys.
*/
format_mk_description(description, mk_spec);
key = key_alloc(&key_type_fscrypt, description,
GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, current_cred(),
KEY_POS_SEARCH | KEY_USR_SEARCH | KEY_USR_VIEW,
KEY_ALLOC_NOT_IN_QUOTA, NULL);
if (IS_ERR(key)) {
err = PTR_ERR(key);
goto out_free_mk;
}
err = key_instantiate_and_link(key, mk, sizeof(*mk), keyring, NULL);
key_put(key);
if (err)
goto out_free_mk;
return 0;
out_free_mk:
free_master_key(mk);
return err;
}
#define KEY_DEAD 1
static int add_existing_master_key(struct fscrypt_master_key *mk,
struct fscrypt_master_key_secret *secret)
{
struct key *mk_user;
bool rekey;
int err;
/*
* If the current user is already in ->mk_users, then there's nothing to
* do. (Not applicable for v1 policy keys, which have NULL ->mk_users.)
*/
if (mk->mk_users) {
mk_user = find_master_key_user(mk);
if (mk_user != ERR_PTR(-ENOKEY)) {
if (IS_ERR(mk_user))
return PTR_ERR(mk_user);
key_put(mk_user);
return 0;
}
}
/* If we'll be re-adding ->mk_secret, try to take the reference. */
rekey = !is_master_key_secret_present(&mk->mk_secret);
if (rekey && !refcount_inc_not_zero(&mk->mk_refcount))
return KEY_DEAD;
/* Add the current user to ->mk_users, if applicable. */
if (mk->mk_users) {
err = add_master_key_user(mk);
if (err) {
if (rekey && refcount_dec_and_test(&mk->mk_refcount))
return KEY_DEAD;
return err;
}
}
/* Re-add the secret if needed. */
if (rekey) {
down_write(&mk->mk_secret_sem);
move_master_key_secret(&mk->mk_secret, secret);
up_write(&mk->mk_secret_sem);
}
return 0;
}
static int do_add_master_key(struct super_block *sb,
struct fscrypt_master_key_secret *secret,
const struct fscrypt_key_specifier *mk_spec)
{
static DEFINE_MUTEX(fscrypt_add_key_mutex);
struct key *key;
int err;
mutex_lock(&fscrypt_add_key_mutex); /* serialize find + link */
retry:
key = fscrypt_find_master_key(sb, mk_spec);
if (IS_ERR(key)) {
err = PTR_ERR(key);
if (err != -ENOKEY)
goto out_unlock;
/* Didn't find the key in ->s_master_keys. Add it. */
err = allocate_filesystem_keyring(sb);
if (err)
goto out_unlock;
err = add_new_master_key(secret, mk_spec, sb->s_master_keys);
} else {
/*
* Found the key in ->s_master_keys. Re-add the secret if
* needed, and add the user to ->mk_users if needed.
*/
down_write(&key->sem);
err = add_existing_master_key(key->payload.data[0], secret);
up_write(&key->sem);
if (err == KEY_DEAD) {
/* Key being removed or needs to be removed */
key_invalidate(key);
key_put(key);
goto retry;
}
key_put(key);
}
out_unlock:
mutex_unlock(&fscrypt_add_key_mutex);
return err;
}
static int add_master_key(struct super_block *sb,
struct fscrypt_master_key_secret *secret,
struct fscrypt_key_specifier *key_spec)
{
int err;
if (key_spec->type == FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER) {
err = fscrypt_init_hkdf(&secret->hkdf, secret->raw,
secret->size);
if (err)
return err;
/*
* Now that the HKDF context is initialized, the raw key is no
* longer needed.
*/
memzero_explicit(secret->raw, secret->size);
/* Calculate the key identifier */
err = fscrypt_hkdf_expand(&secret->hkdf,
HKDF_CONTEXT_KEY_IDENTIFIER, NULL, 0,
key_spec->u.identifier,
FSCRYPT_KEY_IDENTIFIER_SIZE);
if (err)
return err;
}
return do_add_master_key(sb, secret, key_spec);
}
static int fscrypt_provisioning_key_preparse(struct key_preparsed_payload *prep)
{
const struct fscrypt_provisioning_key_payload *payload = prep->data;
if (prep->datalen < sizeof(*payload) + FSCRYPT_MIN_KEY_SIZE ||
prep->datalen > sizeof(*payload) + FSCRYPT_MAX_KEY_SIZE)
return -EINVAL;
if (payload->type != FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR &&
payload->type != FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER)
return -EINVAL;
if (payload->__reserved)
return -EINVAL;
prep->payload.data[0] = kmemdup(payload, prep->datalen, GFP_KERNEL);
if (!prep->payload.data[0])
return -ENOMEM;
prep->quotalen = prep->datalen;
return 0;
}
static void fscrypt_provisioning_key_free_preparse(
struct key_preparsed_payload *prep)
{
kzfree(prep->payload.data[0]);
}
static void fscrypt_provisioning_key_describe(const struct key *key,
struct seq_file *m)
{
seq_puts(m, key->description);
if (key_is_positive(key)) {
const struct fscrypt_provisioning_key_payload *payload =
key->payload.data[0];
seq_printf(m, ": %u [%u]", key->datalen, payload->type);
}
}
static void fscrypt_provisioning_key_destroy(struct key *key)
{
kzfree(key->payload.data[0]);
}
static struct key_type key_type_fscrypt_provisioning = {
.name = "fscrypt-provisioning",
.preparse = fscrypt_provisioning_key_preparse,
.free_preparse = fscrypt_provisioning_key_free_preparse,
.instantiate = generic_key_instantiate,
.describe = fscrypt_provisioning_key_describe,
.destroy = fscrypt_provisioning_key_destroy,
};
/*
* Retrieve the raw key from the Linux keyring key specified by 'key_id', and
* store it into 'secret'.
*
* The key must be of type "fscrypt-provisioning" and must have the field
* fscrypt_provisioning_key_payload::type set to 'type', indicating that it's
* only usable with fscrypt with the particular KDF version identified by
* 'type'. We don't use the "logon" key type because there's no way to
* completely restrict the use of such keys; they can be used by any kernel API
* that accepts "logon" keys and doesn't require a specific service prefix.
*
* The ability to specify the key via Linux keyring key is intended for cases
* where userspace needs to re-add keys after the filesystem is unmounted and
* re-mounted. Most users should just provide the raw key directly instead.
*/
static int get_keyring_key(u32 key_id, u32 type,
struct fscrypt_master_key_secret *secret)
{
key_ref_t ref;
struct key *key;
const struct fscrypt_provisioning_key_payload *payload;
int err;
ref = lookup_user_key(key_id, 0, KEY_NEED_SEARCH);
if (IS_ERR(ref))
return PTR_ERR(ref);
key = key_ref_to_ptr(ref);
if (key->type != &key_type_fscrypt_provisioning)
goto bad_key;
payload = key->payload.data[0];
/* Don't allow fscrypt v1 keys to be used as v2 keys and vice versa. */
if (payload->type != type)
goto bad_key;
secret->size = key->datalen - sizeof(*payload);
memcpy(secret->raw, payload->raw, secret->size);
err = 0;
goto out_put;
bad_key:
err = -EKEYREJECTED;
out_put:
key_ref_put(ref);
return err;
}
/*
* Add a master encryption key to the filesystem, causing all files which were
* encrypted with it to appear "unlocked" (decrypted) when accessed.
*
* When adding a key for use by v1 encryption policies, this ioctl is
* privileged, and userspace must provide the 'key_descriptor'.
*
* When adding a key for use by v2+ encryption policies, this ioctl is
* unprivileged. This is needed, in general, to allow non-root users to use
* encryption without encountering the visibility problems of process-subscribed
* keyrings and the inability to properly remove keys. This works by having
* each key identified by its cryptographically secure hash --- the
* 'key_identifier'. The cryptographic hash ensures that a malicious user
* cannot add the wrong key for a given identifier. Furthermore, each added key
* is charged to the appropriate user's quota for the keyrings service, which
* prevents a malicious user from adding too many keys. Finally, we forbid a
* user from removing a key while other users have added it too, which prevents
* a user who knows another user's key from causing a denial-of-service by
* removing it at an inopportune time. (We tolerate that a user who knows a key
* can prevent other users from removing it.)
*
* For more details, see the "FS_IOC_ADD_ENCRYPTION_KEY" section of
* Documentation/filesystems/fscrypt.rst.
*/
int fscrypt_ioctl_add_key(struct file *filp, void __user *_uarg)
{
struct super_block *sb = file_inode(filp)->i_sb;
struct fscrypt_add_key_arg __user *uarg = _uarg;
struct fscrypt_add_key_arg arg;
struct fscrypt_master_key_secret secret;
int err;
if (copy_from_user(&arg, uarg, sizeof(arg)))
return -EFAULT;
if (!valid_key_spec(&arg.key_spec))
return -EINVAL;
if (memchr_inv(arg.__reserved, 0, sizeof(arg.__reserved)))
return -EINVAL;
/*
* Only root can add keys that are identified by an arbitrary descriptor
* rather than by a cryptographic hash --- since otherwise a malicious
* user could add the wrong key.
*/
if (arg.key_spec.type == FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR &&
!capable(CAP_SYS_ADMIN))
return -EACCES;
memset(&secret, 0, sizeof(secret));
if (arg.key_id) {
if (arg.raw_size != 0)
return -EINVAL;
err = get_keyring_key(arg.key_id, arg.key_spec.type, &secret);
if (err)
goto out_wipe_secret;
} else {
if (arg.raw_size < FSCRYPT_MIN_KEY_SIZE ||
arg.raw_size > FSCRYPT_MAX_KEY_SIZE)
return -EINVAL;
secret.size = arg.raw_size;
err = -EFAULT;
if (copy_from_user(secret.raw, uarg->raw, secret.size))
goto out_wipe_secret;
}
err = add_master_key(sb, &secret, &arg.key_spec);
if (err)
goto out_wipe_secret;
/* Return the key identifier to userspace, if applicable */
err = -EFAULT;
if (arg.key_spec.type == FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER &&
copy_to_user(uarg->key_spec.u.identifier, arg.key_spec.u.identifier,
FSCRYPT_KEY_IDENTIFIER_SIZE))
goto out_wipe_secret;
err = 0;
out_wipe_secret:
wipe_master_key_secret(&secret);
return err;
}
EXPORT_SYMBOL_GPL(fscrypt_ioctl_add_key);
/*
* Add the key for '-o test_dummy_encryption' to the filesystem keyring.
*
* Use a per-boot random key to prevent people from misusing this option.
*/
int fscrypt_add_test_dummy_key(struct super_block *sb,
struct fscrypt_key_specifier *key_spec)
{
static u8 test_key[FSCRYPT_MAX_KEY_SIZE];
struct fscrypt_master_key_secret secret;
int err;
get_random_once(test_key, FSCRYPT_MAX_KEY_SIZE);
memset(&secret, 0, sizeof(secret));
secret.size = FSCRYPT_MAX_KEY_SIZE;
memcpy(secret.raw, test_key, FSCRYPT_MAX_KEY_SIZE);
err = add_master_key(sb, &secret, key_spec);
wipe_master_key_secret(&secret);
return err;
}
/*
* Verify that the current user has added a master key with the given identifier
* (returns -ENOKEY if not). This is needed to prevent a user from encrypting
* their files using some other user's key which they don't actually know.
* Cryptographically this isn't much of a problem, but the semantics of this
* would be a bit weird, so it's best to just forbid it.
*
* The system administrator (CAP_FOWNER) can override this, which should be
* enough for any use cases where encryption policies are being set using keys
* that were chosen ahead of time but aren't available at the moment.
*
* Note that the key may have already removed by the time this returns, but
* that's okay; we just care whether the key was there at some point.
*
* Return: 0 if the key is added, -ENOKEY if it isn't, or another -errno code
*/
int fscrypt_verify_key_added(struct super_block *sb,
const u8 identifier[FSCRYPT_KEY_IDENTIFIER_SIZE])
{
struct fscrypt_key_specifier mk_spec;
struct key *key, *mk_user;
struct fscrypt_master_key *mk;
int err;
mk_spec.type = FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER;
memcpy(mk_spec.u.identifier, identifier, FSCRYPT_KEY_IDENTIFIER_SIZE);
key = fscrypt_find_master_key(sb, &mk_spec);
if (IS_ERR(key)) {
err = PTR_ERR(key);
goto out;
}
mk = key->payload.data[0];
mk_user = find_master_key_user(mk);
if (IS_ERR(mk_user)) {
err = PTR_ERR(mk_user);
} else {
key_put(mk_user);
err = 0;
}
key_put(key);
out:
if (err == -ENOKEY && capable(CAP_FOWNER))
err = 0;
return err;
}
/*
* Try to evict the inode's dentries from the dentry cache. If the inode is a
* directory, then it can have at most one dentry; however, that dentry may be
* pinned by child dentries, so first try to evict the children too.
*/
static void shrink_dcache_inode(struct inode *inode)
{
struct dentry *dentry;
if (S_ISDIR(inode->i_mode)) {
dentry = d_find_any_alias(inode);
if (dentry) {
shrink_dcache_parent(dentry);
dput(dentry);
}
}
d_prune_aliases(inode);
}
static void evict_dentries_for_decrypted_inodes(struct fscrypt_master_key *mk)
{
struct fscrypt_info *ci;
struct inode *inode;
struct inode *toput_inode = NULL;
spin_lock(&mk->mk_decrypted_inodes_lock);
list_for_each_entry(ci, &mk->mk_decrypted_inodes, ci_master_key_link) {
inode = ci->ci_inode;
spin_lock(&inode->i_lock);
if (inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW)) {
spin_unlock(&inode->i_lock);
continue;
}
__iget(inode);
spin_unlock(&inode->i_lock);
spin_unlock(&mk->mk_decrypted_inodes_lock);
shrink_dcache_inode(inode);
iput(toput_inode);
toput_inode = inode;
spin_lock(&mk->mk_decrypted_inodes_lock);
}
spin_unlock(&mk->mk_decrypted_inodes_lock);
iput(toput_inode);
}
static int check_for_busy_inodes(struct super_block *sb,
struct fscrypt_master_key *mk)
{
struct list_head *pos;
size_t busy_count = 0;
unsigned long ino;
spin_lock(&mk->mk_decrypted_inodes_lock);
list_for_each(pos, &mk->mk_decrypted_inodes)
busy_count++;
if (busy_count == 0) {
spin_unlock(&mk->mk_decrypted_inodes_lock);
return 0;
}
{
/* select an example file to show for debugging purposes */
struct inode *inode =
list_first_entry(&mk->mk_decrypted_inodes,
struct fscrypt_info,
ci_master_key_link)->ci_inode;
ino = inode->i_ino;
}
spin_unlock(&mk->mk_decrypted_inodes_lock);
fscrypt_warn(NULL,
"%s: %zu inode(s) still busy after removing key with %s %*phN, including ino %lu",
sb->s_id, busy_count, master_key_spec_type(&mk->mk_spec),
master_key_spec_len(&mk->mk_spec), (u8 *)&mk->mk_spec.u,
ino);
return -EBUSY;
}
static int try_to_lock_encrypted_files(struct super_block *sb,
struct fscrypt_master_key *mk)
{
int err1;
int err2;
/*
* An inode can't be evicted while it is dirty or has dirty pages.
* Thus, we first have to clean the inodes in ->mk_decrypted_inodes.
*
* Just do it the easy way: call sync_filesystem(). It's overkill, but
* it works, and it's more important to minimize the amount of caches we
* drop than the amount of data we sync. Also, unprivileged users can
* already call sync_filesystem() via sys_syncfs() or sys_sync().
*/
down_read(&sb->s_umount);
err1 = sync_filesystem(sb);
up_read(&sb->s_umount);
/* If a sync error occurs, still try to evict as much as possible. */
/*
* Inodes are pinned by their dentries, so we have to evict their
* dentries. shrink_dcache_sb() would suffice, but would be overkill
* and inappropriate for use by unprivileged users. So instead go
* through the inodes' alias lists and try to evict each dentry.
*/
evict_dentries_for_decrypted_inodes(mk);
/*
* evict_dentries_for_decrypted_inodes() already iput() each inode in
* the list; any inodes for which that dropped the last reference will
* have been evicted due to fscrypt_drop_inode() detecting the key
* removal and telling the VFS to evict the inode. So to finish, we
* just need to check whether any inodes couldn't be evicted.
*/
err2 = check_for_busy_inodes(sb, mk);
return err1 ?: err2;
}
/*
* Try to remove an fscrypt master encryption key.
*
* FS_IOC_REMOVE_ENCRYPTION_KEY (all_users=false) removes the current user's
* claim to the key, then removes the key itself if no other users have claims.
* FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS (all_users=true) always removes the
* key itself.
*
* To "remove the key itself", first we wipe the actual master key secret, so
* that no more inodes can be unlocked with it. Then we try to evict all cached
* inodes that had been unlocked with the key.
*
* If all inodes were evicted, then we unlink the fscrypt_master_key from the
* keyring. Otherwise it remains in the keyring in the "incompletely removed"
* state (without the actual secret key) where it tracks the list of remaining
* inodes. Userspace can execute the ioctl again later to retry eviction, or
* alternatively can re-add the secret key again.
*
* For more details, see the "Removing keys" section of
* Documentation/filesystems/fscrypt.rst.
*/
static int do_remove_key(struct file *filp, void __user *_uarg, bool all_users)
{
struct super_block *sb = file_inode(filp)->i_sb;
struct fscrypt_remove_key_arg __user *uarg = _uarg;
struct fscrypt_remove_key_arg arg;
struct key *key;
struct fscrypt_master_key *mk;
u32 status_flags = 0;
int err;
bool dead;
if (copy_from_user(&arg, uarg, sizeof(arg)))
return -EFAULT;
if (!valid_key_spec(&arg.key_spec))
return -EINVAL;
if (memchr_inv(arg.__reserved, 0, sizeof(arg.__reserved)))
return -EINVAL;
/*
* Only root can add and remove keys that are identified by an arbitrary
* descriptor rather than by a cryptographic hash.
*/
if (arg.key_spec.type == FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR &&
!capable(CAP_SYS_ADMIN))
return -EACCES;
/* Find the key being removed. */
key = fscrypt_find_master_key(sb, &arg.key_spec);
if (IS_ERR(key))
return PTR_ERR(key);
mk = key->payload.data[0];
down_write(&key->sem);
/* If relevant, remove current user's (or all users) claim to the key */
if (mk->mk_users && mk->mk_users->keys.nr_leaves_on_tree != 0) {
if (all_users)
err = keyring_clear(mk->mk_users);
else
err = remove_master_key_user(mk);
if (err) {
up_write(&key->sem);
goto out_put_key;
}
if (mk->mk_users->keys.nr_leaves_on_tree != 0) {
/*
* Other users have still added the key too. We removed
* the current user's claim to the key, but we still
* can't remove the key itself.
*/
status_flags |=
FSCRYPT_KEY_REMOVAL_STATUS_FLAG_OTHER_USERS;
err = 0;
up_write(&key->sem);
goto out_put_key;
}
}
/* No user claims remaining. Go ahead and wipe the secret. */
dead = false;
if (is_master_key_secret_present(&mk->mk_secret)) {
down_write(&mk->mk_secret_sem);
wipe_master_key_secret(&mk->mk_secret);
dead = refcount_dec_and_test(&mk->mk_refcount);
up_write(&mk->mk_secret_sem);
}
up_write(&key->sem);
if (dead) {
/*
* No inodes reference the key, and we wiped the secret, so the
* key object is free to be removed from the keyring.
*/
key_invalidate(key);
err = 0;
} else {
/* Some inodes still reference this key; try to evict them. */
err = try_to_lock_encrypted_files(sb, mk);
if (err == -EBUSY) {
status_flags |=
FSCRYPT_KEY_REMOVAL_STATUS_FLAG_FILES_BUSY;
err = 0;
}
}
/*
* We return 0 if we successfully did something: removed a claim to the
* key, wiped the secret, or tried locking the files again. Users need
* to check the informational status flags if they care whether the key
* has been fully removed including all files locked.
*/
out_put_key:
key_put(key);
if (err == 0)
err = put_user(status_flags, &uarg->removal_status_flags);
return err;
}
int fscrypt_ioctl_remove_key(struct file *filp, void __user *uarg)
{
return do_remove_key(filp, uarg, false);
}
EXPORT_SYMBOL_GPL(fscrypt_ioctl_remove_key);
int fscrypt_ioctl_remove_key_all_users(struct file *filp, void __user *uarg)
{
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
return do_remove_key(filp, uarg, true);
}
EXPORT_SYMBOL_GPL(fscrypt_ioctl_remove_key_all_users);
/*
* Retrieve the status of an fscrypt master encryption key.
*
* We set ->status to indicate whether the key is absent, present, or
* incompletely removed. "Incompletely removed" means that the master key
* secret has been removed, but some files which had been unlocked with it are
* still in use. This field allows applications to easily determine the state
* of an encrypted directory without using a hack such as trying to open a
* regular file in it (which can confuse the "incompletely removed" state with
* absent or present).
*
* In addition, for v2 policy keys we allow applications to determine, via
* ->status_flags and ->user_count, whether the key has been added by the
* current user, by other users, or by both. Most applications should not need
* this, since ordinarily only one user should know a given key. However, if a
* secret key is shared by multiple users, applications may wish to add an
* already-present key to prevent other users from removing it. This ioctl can
* be used to check whether that really is the case before the work is done to
* add the key --- which might e.g. require prompting the user for a passphrase.
*
* For more details, see the "FS_IOC_GET_ENCRYPTION_KEY_STATUS" section of
* Documentation/filesystems/fscrypt.rst.
*/
int fscrypt_ioctl_get_key_status(struct file *filp, void __user *uarg)
{
struct super_block *sb = file_inode(filp)->i_sb;
struct fscrypt_get_key_status_arg arg;
struct key *key;
struct fscrypt_master_key *mk;
int err;
if (copy_from_user(&arg, uarg, sizeof(arg)))
return -EFAULT;
if (!valid_key_spec(&arg.key_spec))
return -EINVAL;
if (memchr_inv(arg.__reserved, 0, sizeof(arg.__reserved)))
return -EINVAL;
arg.status_flags = 0;
arg.user_count = 0;
memset(arg.__out_reserved, 0, sizeof(arg.__out_reserved));
key = fscrypt_find_master_key(sb, &arg.key_spec);
if (IS_ERR(key)) {
if (key != ERR_PTR(-ENOKEY))
return PTR_ERR(key);
arg.status = FSCRYPT_KEY_STATUS_ABSENT;
err = 0;
goto out;
}
mk = key->payload.data[0];
down_read(&key->sem);
if (!is_master_key_secret_present(&mk->mk_secret)) {
arg.status = FSCRYPT_KEY_STATUS_INCOMPLETELY_REMOVED;
err = 0;
goto out_release_key;
}
arg.status = FSCRYPT_KEY_STATUS_PRESENT;
if (mk->mk_users) {
struct key *mk_user;
arg.user_count = mk->mk_users->keys.nr_leaves_on_tree;
mk_user = find_master_key_user(mk);
if (!IS_ERR(mk_user)) {
arg.status_flags |=
FSCRYPT_KEY_STATUS_FLAG_ADDED_BY_SELF;
key_put(mk_user);
} else if (mk_user != ERR_PTR(-ENOKEY)) {
err = PTR_ERR(mk_user);
goto out_release_key;
}
}
err = 0;
out_release_key:
up_read(&key->sem);
key_put(key);
out:
if (!err && copy_to_user(uarg, &arg, sizeof(arg)))
err = -EFAULT;
return err;
}
EXPORT_SYMBOL_GPL(fscrypt_ioctl_get_key_status);
int __init fscrypt_init_keyring(void)
{
int err;
err = register_key_type(&key_type_fscrypt);
if (err)
return err;
err = register_key_type(&key_type_fscrypt_user);
if (err)
goto err_unregister_fscrypt;
err = register_key_type(&key_type_fscrypt_provisioning);
if (err)
goto err_unregister_fscrypt_user;
return 0;
err_unregister_fscrypt_user:
unregister_key_type(&key_type_fscrypt_user);
err_unregister_fscrypt:
unregister_key_type(&key_type_fscrypt);
return err;
}
| {
"pile_set_name": "Github"
} |
'use strict';
var expect = require('expect.js'),
KdbxUuid = require('../../lib/format/kdbx-uuid');
describe('KdbxUuid', function () {
it('creates uuid from 16 bytes ArrayBuffer', function () {
var uuid = new KdbxUuid(
new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]).buffer
);
expect(uuid.id).to.be('AQIDBAUGBwgJCgECAwQFBg==');
});
it('creates uuid from 16 bytes array', function () {
var uuid = new KdbxUuid(new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]));
expect(uuid.id).to.be('AQIDBAUGBwgJCgECAwQFBg==');
});
it('creates uuid base64 string', function () {
var uuid = new KdbxUuid('AQIDBAUGBwgJCgECAwQFBg==');
expect(uuid.id).to.be('AQIDBAUGBwgJCgECAwQFBg==');
});
it('creates undefined uuid from less than 16 bytes', function () {
var uuid = new KdbxUuid(new Uint16Array([123]).buffer);
expect(uuid.id).to.be(undefined);
});
it('creates undefined uuid from falsy', function () {
var uuid = new KdbxUuid(0);
expect(uuid.id).to.be(undefined);
});
it('returns uuid in toString method', function () {
var uuid = new KdbxUuid(
new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]).buffer
);
expect(uuid.toString()).to.be('AQIDBAUGBwgJCgECAwQFBg==');
});
it('returns uuid in valueOf method', function () {
var uuid = new KdbxUuid(
new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]).buffer
);
expect(uuid.valueOf()).to.be('AQIDBAUGBwgJCgECAwQFBg==');
});
it('allows to be used as hash key', function () {
var uuid1 = new KdbxUuid(
new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]).buffer
);
var uuid2 = new KdbxUuid(
new Uint8Array([2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]).buffer
);
var hashTable = {};
hashTable[uuid1] = 1;
hashTable[uuid2] = 2;
expect(hashTable[uuid1]).to.be(1);
expect(hashTable[uuid2]).to.be(2);
});
it('creates empty uuid from no arg', function () {
var uuid = new KdbxUuid();
expect(uuid.toString()).to.be('AAAAAAAAAAAAAAAAAAAAAA==');
expect(uuid.empty).to.be(true);
});
it('sets empty property for empty uuid', function () {
var uuid = new KdbxUuid(new Uint8Array(16).buffer);
expect(uuid.toString()).to.be('AAAAAAAAAAAAAAAAAAAAAA==');
expect(uuid.empty).to.be(true);
});
it('returns bytes in toBytes method', function () {
var bytes = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]);
var uuid = new KdbxUuid(bytes.buffer);
expect(uuid.toBytes()).to.be.eql(bytes);
});
it('returns bytes in bytes property', function () {
var bytes = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]);
var uuid = new KdbxUuid(bytes.buffer);
expect(uuid.bytes).to.be.eql(bytes);
});
it('returns bytes in toBytes method for empty value', function () {
var uuid = new KdbxUuid();
expect(uuid.toBytes()).to.be.eql([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
});
it('returns undefined in toBytes method for vad value', function () {
var bytes = new Uint8Array([1, 2, 3, 4, 5]);
var uuid = new KdbxUuid(bytes.buffer);
expect(uuid.toBytes()).to.be(undefined);
});
it('generates random uuid', function () {
var uuid = KdbxUuid.random();
expect(uuid).to.be.a(KdbxUuid);
expect(uuid.toString()).not.to.be('AAAAAAAAAAAAAAAAAAAAAA==');
});
it('checks equality', function () {
var uuid = new KdbxUuid(
new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6]).buffer
);
expect(uuid.equals('AQIDBAUGBwgJCgECAwQFBg==')).to.be(true);
expect(uuid.equals(new KdbxUuid('AQIDBAUGBwgJCgECAwQFBg=='))).to.be(true);
expect(uuid.equals(null)).to.be(false);
expect(uuid.equals(undefined)).to.be(false);
expect(uuid.equals('???')).to.be(false);
expect(uuid.equals(new KdbxUuid())).to.be(false);
});
});
| {
"pile_set_name": "Github"
} |

# 本项目为[http://ncase.me/trust/](http://ncase.me/trust/)的非官方简体中文版,地址为[http://sekai.co/trust/](http://sekai.co/trust/)
本作品 *信任的进化* (译名参考罗伯特·阿克塞尔罗德的《合作的进化》)属于公共领域,多亏了现有的知识共享许可和开源的资源,才能顺利地诞生!本项目用到的全部音乐、音效、以及代码列举如下:
**音乐:** "Bleu" by Komiku (CC Zero). [在 Free Music Archive 上下载他们的整张专辑](http://freemusicarchive.org/music/Komiku/Its_time_for_adventure_/)
**音效:**
* [Coin insert](https://freesound.org/people/bassmosphere/sounds/384700/) by bassmosphere (CC Zero)
* [Coin get!](https://freesound.org/people/plasterbrain/sounds/242857/) by plasterbrain (CC Zero)
* [Evil Laugh](https://freesound.org/people/JohnsonBrandEditing/sounds/173933/) by JohnsonBrandEditing (CC Zero)
* [Slot machine](https://freesound.org/people/lukaso/sounds/69689/) by lukaso (CC Sampling+)
* [Drumroll](https://freesound.org/people/adriann/sounds/191718/) by adriann (CC Zero)
* [click plink pop boop bonk](https://freesound.org/people/Owdeo/sounds/116653/) by Owdeo (CC BY-NC)
* [Swoosh](https://freesound.org/people/aglinder/sounds/264468/) by aglinder (CC Zero)
* [Squeaky Toy](https://freesound.org/people/survivalzombie/sounds/240015/) by survivalzombie (CC Zero)
* [Thump](https://freesound.org/people/Brokenphono/sounds/344149/) by Brokenphono (CC Zero)
* [Fart](https://freesound.org/people/DSISStudios/sounds/241000/) by DSISStudios (CC Zero)
**开源代码库:**
* [PIXI.js](http://www.pixijs.com/) 用于渲染图像
* [Howler.js](https://howlerjs.com/) 用于声音
* [Tween.js](http://www.createjs.com/tweenjs) 用于动画补间(感谢 V2EX 的 @geelaw 指正翻译)
* [Balloon.css](https://kazzkiq.github.io/balloon.css/) 用于弹窗显示工具小提示
* [Q](https://github.com/kriskowal/q/) 用于 promises
* [MinPubSub](https://github.com/daniellmb/MinPubSub) 用于发布和订阅
* [Pegasus](https://github.com/typicode/pegasus) 用于……我懒得不想写自己的 XHR
**字体:** [Futura Handwritten](http://www.dafont.com/futurahandwritten.font) by Bill Snyder
# How-To: Translate this thang!
**[IMPORTANT:
BEFORE YOU DECIDE TO MAKE A TRANSLATION, CHECK THE "ISSUES" TAB ABOVE,
TO SEE IF SOMEONE ELSE IS ALREADY WORKING ON IT.
If so, maybe you can collaborate!
And if no one else is, PLEASE CREATE A NEW ISSUE in this repo
so that others know you're working on it!]**
Translations done so far:
[Chinese (Simplified)](https://sekai.co/trust/),
[Chinese (Taiwan)](https://audreyt.github.io/trust-zh-TW/),
[Brazilian Portuguese](https://brunolemos.github.io/trust/),
[French](https://ayowel.github.io/trust/),
[Spain Spanish](https://ccamara.github.io/trust/),
[Russian](https://notdotteam.github.io/trust/),
[German](https://jkoelling.github.io/trust/),
[Italian](https://lvdt.github.io/trust/),
[Turkish](https://osaatcioglu.github.io/trust),
[Polish](https://sin.github.io/trust/),
[Vietnamese](https://nghiatt90.github.io/trust-vn/),
[Greek](https://lightspot21.github.io/trust/),
[Persian/Farsi](https://hamed.github.io/trust/),
[Hungarian](http://ncase.me/trust-hu/),
[Catalan](https://fbricart.github.io/trust/)
**Step 1)** Fork or download this repo
(if you're forking it, be sure to make sure *your* repo is on a branch called `gh-pages`, so that GitHub can automatically generate a webpage for it!)
**Step 2)** Translate the following files:
`index.html` -- The title & social sharing text (a few words)
`words.html` -- All the words for the interactive itself (~3,300 words)
(optional) `notes/index.html` -- The footnotes (~1,100 words)
(optional) `peeps/index.html` -- The full credits (a few words)
**Step 3)** Remember to test your translation! You can test things locally using [http-server](https://www.npmjs.com/package/http-server) or [MAMP](https://www.mamp.info/en/).
**Step 4)** Email me with a link to your forked repo / the translated files, at `N {{at}} NCASE {{dot}} ME` There may be a few things here and there we need to fix! (also, if you run into any issues, please email me as well! I may take a while to respond since I'm away the next couple weeks)
**Step 5)** Wait for me to stop being busy and/or lazy and actually link your translated version from the main English version
**Step 6)** Party! 🎉
# "许可协议"
[Creative Commons Zero](https://github.com/ncase/trust/blob/gh-pages/LICENSE): 本协议适用于对于公共领域的无私奉献,从根本上来说,您可以做任何事!欢迎署名,我不会对您追究任何法律责任。
| {
"pile_set_name": "Github"
} |
[
{
"date": "2017-01-01 00:00:00",
"start": "2017-01-01T05:00:00.000Z",
"end": "2017-01-02T05:00:00.000Z",
"name": "New Year's Day",
"type": "public",
"rule": "01-01 and if sunday then next monday if saturday then previous friday",
"_weekday": "Sun"
},
{
"date": "2017-01-02 00:00:00",
"start": "2017-01-02T05:00:00.000Z",
"end": "2017-01-03T05:00:00.000Z",
"name": "New Year's Day (substitute day)",
"type": "public",
"substitute": true,
"rule": "01-01 and if sunday then next monday if saturday then previous friday",
"_weekday": "Mon"
},
{
"date": "2017-01-16 00:00:00",
"start": "2017-01-16T05:00:00.000Z",
"end": "2017-01-17T05:00:00.000Z",
"name": "Martin Luther King Jr. Day",
"type": "public",
"rule": "3rd monday in January",
"_weekday": "Mon"
},
{
"date": "2017-01-19 00:00:00",
"start": "2017-01-19T05:00:00.000Z",
"end": "2017-01-20T05:00:00.000Z",
"name": "Robert E. Lee's Birthday",
"type": "public",
"rule": "01-19",
"_weekday": "Thu"
},
{
"date": "2017-02-14 00:00:00",
"start": "2017-02-14T05:00:00.000Z",
"end": "2017-02-15T05:00:00.000Z",
"name": "Valentine's Day",
"type": "observance",
"rule": "02-14",
"_weekday": "Tue"
},
{
"date": "2017-04-16 00:00:00",
"start": "2017-04-16T04:00:00.000Z",
"end": "2017-04-17T04:00:00.000Z",
"name": "Easter Sunday",
"type": "observance",
"rule": "easter",
"_weekday": "Sun"
},
{
"date": "2017-04-18 00:00:00",
"start": "2017-04-18T04:00:00.000Z",
"end": "2017-04-19T04:00:00.000Z",
"name": "Tax Day",
"type": "observance",
"rule": "04-15 if friday then next monday if saturday,sunday then next tuesday",
"_weekday": "Tue"
},
{
"date": "2017-04-24 00:00:00",
"start": "2017-04-24T04:00:00.000Z",
"end": "2017-04-25T04:00:00.000Z",
"name": "Confederate Memorial Day",
"type": "public",
"rule": "monday before 05-01",
"_weekday": "Mon"
},
{
"date": "2017-04-26 00:00:00",
"start": "2017-04-26T04:00:00.000Z",
"end": "2017-04-27T04:00:00.000Z",
"name": "Administrative Professionals Day",
"type": "observance",
"rule": "wednesday before 04-28",
"_weekday": "Wed"
},
{
"date": "2017-05-14 00:00:00",
"start": "2017-05-14T04:00:00.000Z",
"end": "2017-05-15T04:00:00.000Z",
"name": "Mother's Day",
"type": "observance",
"rule": "2nd sunday in May",
"_weekday": "Sun"
},
{
"date": "2017-05-29 00:00:00",
"start": "2017-05-29T04:00:00.000Z",
"end": "2017-05-30T04:00:00.000Z",
"name": "Memorial Day",
"type": "public",
"rule": "monday before 06-01",
"_weekday": "Mon"
},
{
"date": "2017-06-18 00:00:00",
"start": "2017-06-18T04:00:00.000Z",
"end": "2017-06-19T04:00:00.000Z",
"name": "Father's Day",
"type": "observance",
"rule": "3rd sunday in June",
"_weekday": "Sun"
},
{
"date": "2017-07-04 00:00:00",
"start": "2017-07-04T04:00:00.000Z",
"end": "2017-07-05T04:00:00.000Z",
"name": "Independence Day",
"type": "public",
"rule": "07-04 and if sunday then next monday if saturday then previous friday",
"_weekday": "Tue"
},
{
"date": "2017-09-04 00:00:00",
"start": "2017-09-04T04:00:00.000Z",
"end": "2017-09-05T04:00:00.000Z",
"name": "Labor Day",
"type": "public",
"rule": "monday in September",
"_weekday": "Mon"
},
{
"date": "2017-10-09 00:00:00",
"start": "2017-10-09T04:00:00.000Z",
"end": "2017-10-10T04:00:00.000Z",
"name": "Columbus Day",
"type": "public",
"rule": "2nd monday in October",
"_weekday": "Mon"
},
{
"date": "2017-10-31 18:00:00",
"start": "2017-10-31T22:00:00.000Z",
"end": "2017-11-01T04:00:00.000Z",
"name": "Halloween",
"type": "observance",
"rule": "10-31 18:00",
"_weekday": "Tue"
},
{
"date": "2017-11-10 00:00:00",
"start": "2017-11-10T05:00:00.000Z",
"end": "2017-11-11T05:00:00.000Z",
"name": "Veterans Day (substitute day)",
"type": "bank",
"note": "Federal Government offices are closed",
"substitute": true,
"rule": "substitutes 11-11 if sunday then next monday if saturday then previous friday",
"_weekday": "Fri"
},
{
"date": "2017-11-11 00:00:00",
"start": "2017-11-11T05:00:00.000Z",
"end": "2017-11-12T05:00:00.000Z",
"name": "Veterans Day",
"type": "public",
"rule": "11-11",
"_weekday": "Sat"
},
{
"date": "2017-11-23 00:00:00",
"start": "2017-11-23T05:00:00.000Z",
"end": "2017-11-24T05:00:00.000Z",
"name": "Thanksgiving Day",
"type": "public",
"rule": "4th thursday in November",
"_weekday": "Thu"
},
{
"date": "2017-11-24 00:00:00",
"start": "2017-11-24T05:00:00.000Z",
"end": "2017-11-25T05:00:00.000Z",
"name": "Day after Thanksgiving Day",
"type": "observance",
"rule": "friday after 4th thursday in November",
"_weekday": "Fri"
},
{
"date": "2017-12-24 00:00:00",
"start": "2017-12-24T05:00:00.000Z",
"end": "2017-12-25T05:00:00.000Z",
"name": "Washington's Birthday",
"type": "public",
"rule": "12-24",
"_weekday": "Sun"
},
{
"date": "2017-12-25 00:00:00",
"start": "2017-12-25T05:00:00.000Z",
"end": "2017-12-26T05:00:00.000Z",
"name": "Christmas Day",
"type": "public",
"rule": "12-25 and if sunday then next monday if saturday then previous friday",
"_weekday": "Mon"
},
{
"date": "2017-12-31 00:00:00",
"start": "2017-12-31T05:00:00.000Z",
"end": "2018-01-01T05:00:00.000Z",
"name": "New Year's Eve",
"type": "observance",
"rule": "12-31",
"_weekday": "Sun"
}
] | {
"pile_set_name": "Github"
} |
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::zoneToPoint
Description
A topoSetSource to select points based on pointZone.
SourceFiles
zoneToPoint.C
\*---------------------------------------------------------------------------*/
#ifndef zoneToPoint_H
#define zoneToPoint_H
#include "topoSetSource.H"
#include "wordRe.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class zoneToPoint Declaration
\*---------------------------------------------------------------------------*/
class zoneToPoint
:
public topoSetSource
{
// Private Data
//- Add usage string
static addToUsageTable usage_;
//- Name/regular expression of zone
wordRe zoneName_;
// Private Member Functions
void combine(topoSet& set, const bool add) const;
public:
//- Runtime type information
TypeName("zoneToPoint");
// Constructors
//- Construct from components
zoneToPoint
(
const polyMesh& mesh,
const word& zoneName
);
//- Construct from dictionary
zoneToPoint
(
const polyMesh& mesh,
const dictionary& dict
);
//- Construct from Istream
zoneToPoint
(
const polyMesh& mesh,
Istream&
);
//- Destructor
virtual ~zoneToPoint();
// Member Functions
virtual sourceType setType() const
{
return POINTSETSOURCE;
}
virtual void applyToSet
(
const topoSetSource::setAction action,
topoSet&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
| {
"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"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
CodeMirror.defineOption("placeholder", "", function(cm, val, old) {
var prev = old && old != CodeMirror.Init;
if (val && !prev) {
cm.on("blur", onBlur);
cm.on("change", onChange);
cm.on("swapDoc", onChange);
onChange(cm);
} else if (!val && prev) {
cm.off("blur", onBlur);
cm.off("change", onChange);
cm.off("swapDoc", onChange);
clearPlaceholder(cm);
var wrapper = cm.getWrapperElement();
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
}
if (val && !cm.hasFocus()) onBlur(cm);
});
function clearPlaceholder(cm) {
if (cm.state.placeholder) {
cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);
cm.state.placeholder = null;
}
}
function setPlaceholder(cm) {
clearPlaceholder(cm);
var elt = cm.state.placeholder = document.createElement("pre");
elt.style.cssText = "height: 0; overflow: visible";
elt.style.direction = cm.getOption("direction");
elt.className = "CodeMirror-placeholder";
var placeHolder = cm.getOption("placeholder")
if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)
elt.appendChild(placeHolder)
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
}
function onBlur(cm) {
if (isEmpty(cm)) setPlaceholder(cm);
}
function onChange(cm) {
var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : "");
if (empty) setPlaceholder(cm);
else clearPlaceholder(cm);
}
function isEmpty(cm) {
return (cm.lineCount() === 1) && (cm.getLine(0) === "");
}
});
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*******************************************************************************/
package org.apache.ofbiz.content.content;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilHttp;
import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilProperties;
import org.apache.ofbiz.entity.Delegator;
import org.apache.ofbiz.entity.GenericEntityException;
import org.apache.ofbiz.entity.GenericValue;
import org.apache.ofbiz.entity.transaction.GenericTransactionException;
import org.apache.ofbiz.entity.transaction.TransactionUtil;
import org.apache.ofbiz.entity.util.EntityListIterator;
import org.apache.ofbiz.entity.util.EntityQuery;
import org.apache.ofbiz.security.Security;
/**
* ContentEvents Class
*/
public class ContentEvents {
private static final String MODULE = ContentEvents.class.getName();
private static final String RESOURCE = "ContentErrorUiLabels";
/**
* Updates/adds keywords for all contents
* @param request HTTPRequest object for the current request
* @param response HTTPResponse object for the current request
* @return String specifying the exit status of this event
*/
public static String updateAllContentKeywords(HttpServletRequest request, HttpServletResponse response) {
Delegator delegator = (Delegator) request.getAttribute("delegator");
Security security = (Security) request.getAttribute("security");
String updateMode = "CREATE";
String errMsg = null;
String doAll = request.getParameter("doAll");
// check permissions before moving on...
if (!security.hasEntityPermission("CONTENTMGR", "_" + updateMode, request.getSession())) {
Map<String, String> messageMap = UtilMisc.toMap("updateMode", updateMode);
errMsg = UtilProperties.getMessage(RESOURCE, "contentevents.not_sufficient_permissions", messageMap, UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
int numConts = 0;
int errConts = 0;
boolean beganTx = false;
EntityQuery contentQuery = EntityQuery.use(delegator).from("Content");
try {
// begin the transaction
beganTx = TransactionUtil.begin(7200);
if (Debug.infoOn()) {
long count = contentQuery.queryCount();
Debug.logInfo("========== Found " + count + " contents to index ==========", MODULE);
}
GenericValue content;
try (EntityListIterator entityListIterator = contentQuery.queryIterator()) {
while ((content = entityListIterator.next()) != null) {
ContentKeywordIndex.indexKeywords(content, "Y".equals(doAll));
numConts++;
if (numConts % 500 == 0) {
Debug.logInfo("Keywords indexed for " + numConts + " so far", MODULE);
}
}
} catch (GenericEntityException e) {
errMsg = "[ContentEvents.updateAllContentKeywords] Could not create content-keyword (write error); message: " + e.getMessage();
Debug.logWarning(errMsg, MODULE);
errConts++;
request.setAttribute("_ERROR_MESSAGE_", errMsg);
}
} catch (GenericEntityException gee) {
Debug.logWarning(gee, gee.getMessage(), MODULE);
Map<String, String> messageMap = UtilMisc.toMap("gee", gee.toString());
errMsg = UtilProperties.getMessage(RESOURCE, "contentevents.error_getting_content_list", messageMap, UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
try {
TransactionUtil.rollback(beganTx, gee.getMessage(), gee);
} catch (GenericTransactionException e1) {
Debug.logError(e1, MODULE);
}
return "error";
}
// commit the transaction
try {
TransactionUtil.commit(beganTx);
} catch (GenericTransactionException e) {
Debug.logError(e, MODULE);
}
if (errConts == 0) {
Map<String, String> messageMap = UtilMisc.toMap("numConts", Integer.toString(numConts));
errMsg = UtilProperties.getMessage(RESOURCE, "contentevents.keyword_creation_complete_for_contents", messageMap,
UtilHttp.getLocale(request));
request.setAttribute("_EVENT_MESSAGE_", errMsg);
return "success";
} else {
Map<String, String> messageMap = UtilMisc.toMap("numConts", Integer.toString(numConts));
messageMap.put("errConts", Integer.toString(errConts));
errMsg = UtilProperties.getMessage(RESOURCE, "contentevents.keyword_creation_complete_for_contents_with_errors",
messageMap, UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
}
}
| {
"pile_set_name": "Github"
} |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://opensource.org/licenses/MIT
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.
""" # noqa
from django import forms
from common.forms import BaseComponentForm
from common.constants import API_TYPE_Q
from components.component import Component
from .toolkit import tools, configs
class GetCustomQueryDetail(Component):
"""
apiLabel {{ _("获取自定义API详情") }}
apiMethod GET
### {{ _("功能描述") }}
{{ _("获取自定义api详情") }}
### {{ _("请求参数") }}
{{ common_args_desc }}
#### {{ _("接口参数") }}
| {{ _("字段") }} | {{ _("类型") }} | {{ _("必选") }} | {{ _("描述") }} |
|-----------|------------|--------|------------|
| bk_supplier_account | string | {{ _("否") }} | {{ _("开发商账号") }} |
| bk_biz_id | int | {{ _("是") }} | {{ _("业务ID") }} |
| id | string | {{ _("是") }} | {{ _("主键ID") }} |
### {{ _("请求参数示例") }}
```python
{
"bk_app_code": "esb_test",
"bk_app_secret": "xxx",
"bk_token": "xxx",
"bk_supplier_account": "123456789",
"bk_biz_id": 1,
"id": "xxx"
}
```
### {{ _("返回结果示例") }}
```python
{
"result": true,
"code": 0,
"message": "",
"data": {
"bk_biz_id": 1,
"name": "api1",
"id": "bacfet4kd42325venmcg",
"info": "{\\"condition\\":[{\\"bk_obj_id\\":\\"biz\\",\\"condition\\":[{\\"field\\":\\"default\\",\\"operator\\":\\"$ne\\",\\"value\\":1}],\\"fields\\":[]},{\\"bk_obj_id\\":\\"set\\",\\"condition\\":[],\\"fields\\":[]},{\\"bk_obj_id\\":\\"module\\",\\"condition\\":[],\\"fields\\":[]},{\\"bk_obj_id\\":\\"host\\",\\"condition\\":[{\\"field\\":\\"bk_host_innerip\\",\\"operator\\":\\"$eq\\",\\"value\\":\\"127.0.0.1\\"}],\\"fields\\":[\\"bk_host_innerip\\",\\"bk_host_outerip\\",\\"bk_agent_status\\"]}]}",
"create_user": "admin",
"create_time": "2018-03-27T16:22:43.271+08:00",
"modify_user": "admin",
"last_time": "2018-03-27T16:29:26.428+08:00"
}
}
```
### {{ _("返回结果参数说明") }}
#### data
| {{ _("字段") }} | {{ _("类型") }} | {{ _("描述") }} |
|-----------|-----------|-----------|
| bk_biz_id | int | {{ _("业务ID") }} |
| create_time | string | {{ _("创建时间") }} |
| create_user | string | {{ _("创建者") }} |
| id | string | {{ _("自定义api主键ID") }} |
| info | string | {{ _("自定义api信息") }} |
| last_time | string | {{ _("更新时间") }} |
| modify_user | string | {{ _("修改者") }} |
| name | string | {{ _("自定义api命名") }} |
#### data.info
| {{ _("字段") }} | {{ _("类型") }} | {{ _("描述") }} |
|-----------|------------|--------|------------|
| bk_obj_id | string | {{ _("对象名,可以为biz,set,module,host,object") }} |
| fields | array | {{ _("查询输出字段") }} |
| condition | array | {{ _("查询条件") }} |
#### data.info.condition
| {{ _("字段") }} | {{ _("类型") }} | {{ _("描述") }} |
|-----------|------------|--------|------------|
| field | string | {{ _("对象的字段") }} |
| operator | string | {{ _("操作符, $eq为相等,$neq为不等,$in为属于,$nin为不属于") }} |
| value | string | {{ _("字段对应的值") }} |
""" # noqa
sys_name = configs.SYSTEM_NAME
api_type = API_TYPE_Q
host = configs.host
class Form(BaseComponentForm):
bk_biz_id = forms.IntegerField(label='business id', required=True)
id = forms.CharField(label='id', required=True)
def handle(self):
client = tools.CCClient(self)
self.response.payload = client.get(
host=self.host,
path='/api/v3/userapi/detail/{bk_biz_id}/{id}'.format(**self.form_data),
)
| {
"pile_set_name": "Github"
} |
#ifndef BOOST_METAPARSE_V1_ALWAYS_HPP
#define BOOST_METAPARSE_V1_ALWAYS_HPP
// Copyright Abel Sinkovics ([email protected]) 2009 - 2010.
// 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)
#include <boost/metaparse/v1/accept.hpp>
#include <boost/metaparse/v1/is_error.hpp>
#include <boost/metaparse/v1/get_remaining.hpp>
#include <boost/metaparse/v1/get_position.hpp>
#include <boost/mpl/eval_if.hpp>
namespace boost
{
namespace metaparse
{
namespace v1
{
template <class P, class Result>
struct always
{
private:
template <class Res>
struct apply_unchecked :
accept<
Result,
typename get_remaining<Res>::type,
typename get_position<Res>::type
>
{};
public:
typedef always type;
template <class S, class Pos>
struct apply :
boost::mpl::eval_if<
typename is_error<typename P::template apply<S, Pos> >::type,
typename P::template apply<S, Pos>,
apply_unchecked<typename P::template apply<S, Pos> >
>
{};
};
}
}
}
#endif
| {
"pile_set_name": "Github"
} |
// Auto-generated file. Do not edit!
// Template: src/f32-gemm/avx-broadcast.c.in
// Generator: tools/xngen
//
// Copyright 2019 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#include <assert.h>
#include <immintrin.h>
#include <xnnpack/gemm.h>
void xnn_f32_gemm_minmax_ukernel_1x16__avx_broadcast(
size_t mr,
size_t nc,
size_t kc,
const float*restrict a,
size_t a_stride,
const float*restrict w,
float*restrict c,
size_t cm_stride,
size_t cn_stride,
const union xnn_f32_minmax_params params[restrict XNN_MIN_ELEMENTS(1)])
{
assert(mr != 0);
assert(mr <= 1);
assert(nc != 0);
assert(kc != 0);
assert(kc % sizeof(float) == 0);
assert(a != NULL);
assert(w != NULL);
assert(c != NULL);
const float* a0 = a;
float* c0 = c;
do {
__m256 vacc0x01234567 = _mm256_load_ps(w + 0);
__m256 vacc0x89ABCDEF = _mm256_load_ps(w + 8);
w += 16;
size_t k = kc;
do {
const __m256 va0 = _mm256_broadcast_ss(a0);
a0 += 1;
const __m256 vb01234567 = _mm256_load_ps(w);
const __m256 vb89ABCDEF = _mm256_load_ps(w + 8);
w += 16;
vacc0x01234567 = _mm256_add_ps(vacc0x01234567, _mm256_mul_ps(va0, vb01234567));
vacc0x89ABCDEF = _mm256_add_ps(vacc0x89ABCDEF, _mm256_mul_ps(va0, vb89ABCDEF));
k -= sizeof(float);
} while (k != 0);
const __m256 vmax = _mm256_broadcast_ps((const __m128*) params->sse.max);
vacc0x01234567 = _mm256_min_ps(vacc0x01234567, vmax);
vacc0x89ABCDEF = _mm256_min_ps(vacc0x89ABCDEF, vmax);
const __m256 vmin = _mm256_broadcast_ps((const __m128*) params->sse.min);
vacc0x01234567 = _mm256_max_ps(vacc0x01234567, vmin);
vacc0x89ABCDEF = _mm256_max_ps(vacc0x89ABCDEF, vmin);
if XNN_LIKELY(nc >= 16) {
_mm256_storeu_ps(c0, vacc0x01234567);
_mm256_storeu_ps(c0 + 8, vacc0x89ABCDEF);
c0 = (float*) ((uintptr_t) c0 + cn_stride);
a0 = (const float*) ((uintptr_t) a0 - kc);
nc -= 16;
} else {
if (nc & 8) {
_mm256_storeu_ps(c0, vacc0x01234567);
vacc0x01234567 = vacc0x89ABCDEF;
c0 += 8;
}
__m128 vacc0x0123 = _mm256_castps256_ps128(vacc0x01234567);
if (nc & 4) {
_mm_storeu_ps(c0, vacc0x0123);
vacc0x0123 = _mm256_extractf128_ps(vacc0x01234567, 1);
c0 += 4;
}
if (nc & 2) {
_mm_storel_pi((__m64*) c0, vacc0x0123);
vacc0x0123 = _mm_movehl_ps(vacc0x0123, vacc0x0123);
c0 += 2;
}
if (nc & 1) {
_mm_store_ss(c0, vacc0x0123);
}
nc = 0;
}
} while (nc != 0);
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BB248BAC-6E1B-433C-A254-75140A273AB5}</ProjectGuid>
<RootNamespace>pmemobj</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<ItemGroup Condition="'$(SolutionName)'=='PMDK'">
<ProjectReference Include="..\..\..\libpmemobj\libpmemobj.vcxproj">
<Project>{1baa1617-93ae-4196-8a1a-bd492fb18aef}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\libpmem\libpmem.vcxproj">
<Project>{9e9e3d25-2139-4a5d-9200-18148ddead45}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ItemDefinitionGroup>
<Manifest>
<AdditionalManifestFiles>..\..\..\LongPath.manifest</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="..\..\Examples_$(Configuration).props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="..\..\Examples_$(Configuration).props" />
</ImportGroup>
<ItemDefinitionGroup>
<ClCompile>
<CompileAs>CompileAsCpp</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>libpmem.lib;libpmemobj.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mapcli.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="libmap.vcxproj">
<Project>{49a7cc5a-d5e7-4a07-917f-c6918b982be8}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project> | {
"pile_set_name": "Github"
} |
export const delay = (time) => new Promise((resolve) => setTimeout(() => resolve(), time));
| {
"pile_set_name": "Github"
} |
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// REQUIRES: c++experimental
// UNSUPPORTED: c++98, c++03
// <experimental/memory_resource>
// template <class T> class polymorphic_allocator;
// template <class T>
// bool operator!=(
// polymorphic_allocator<T> const &
// , polymorphic_allocator<T> const &) noexcept
#include <experimental/memory_resource>
#include <type_traits>
#include <cassert>
#include "test_memory_resource.hpp"
namespace ex = std::experimental::pmr;
int main(int, char**)
{
typedef ex::polymorphic_allocator<void> A1;
typedef ex::polymorphic_allocator<int> A2;
// check return types
{
A1 const a1;
A2 const a2;
static_assert(std::is_same<decltype(a1 != a2), bool>::value, "");
static_assert(noexcept(a1 != a2), "");
}
// not equal same type (different resource)
{
TestResource d1(1);
TestResource d2(2);
A1 const a1(&d1);
A1 const a2(&d2);
assert(a1 != a2);
assert(d1.checkIsEqualCalledEq(1));
assert(d2.checkIsEqualCalledEq(0));
d1.reset();
assert(a2 != a1);
assert(d1.checkIsEqualCalledEq(0));
assert(d2.checkIsEqualCalledEq(1));
}
// equal same type (same resource)
{
TestResource d1;
A1 const a1(&d1);
A1 const a2(&d1);
assert(!(a1 != a2));
assert(d1.checkIsEqualCalledEq(0));
assert(!(a2 != a1));
assert(d1.checkIsEqualCalledEq(0));
}
// equal same type
{
TestResource d1(1);
TestResource d2(1);
A1 const a1(&d1);
A1 const a2(&d2);
assert(!(a1 != a2));
assert(d1.checkIsEqualCalledEq(1));
assert(d2.checkIsEqualCalledEq(0));
d1.reset();
assert(!(a2 != a1));
assert(d1.checkIsEqualCalledEq(0));
assert(d2.checkIsEqualCalledEq(1));
}
// not equal different types
{
TestResource d1;
TestResource1 d2;
A1 const a1(&d1);
A2 const a2(&d2);
assert(a1 != a2);
assert(d1.checkIsEqualCalledEq(1));
assert(d2.checkIsEqualCalledEq(0));
d1.reset();
assert(a2 != a1);
assert(d1.checkIsEqualCalledEq(0));
assert(d2.checkIsEqualCalledEq(1));
}
return 0;
}
| {
"pile_set_name": "Github"
} |
{
"label": "Europe (EU27)",
"data": [[1999, 3.0], [2000, 3.9], [2001, 2.0], [2002, 1.2], [2003, 1.3], [2004, 2.5]]
}
| {
"pile_set_name": "Github"
} |
// PowerShell.org Tug DSC Pull Server
// Copyright (c) The DevOps Collective, Inc. All rights reserved.
// Licensed under the MIT license. See the LICENSE file in the project root for more information.
using System.ComponentModel.DataAnnotations;
namespace Tug.Model
{
public class CertificateInformation : Util.ExtDataIndexerBase
{
public CertificateInformation()
{ }
public CertificateInformation(CertificateInformation copyFrom)
{
this.FriendlyName = copyFrom.FriendlyName;
this.Issuer = copyFrom.Issuer;
this.NotAfter = copyFrom.NotAfter;
this.NotBefore = copyFrom.NotBefore;
this.Subject = copyFrom.Subject;
this.PublicKey = copyFrom.PublicKey;
this.Thumbprint = copyFrom.Thumbprint;
}
// NOTE: DO NOT CHANGE THE ORDER OF THESE PROPERTIES!!!
// Apparently the order of these properties is important
// to successfully fulfill the RegKey authz requirements
[Required]
public string FriendlyName
{ get; set; }
[Required]
public string Issuer
{ get; set; }
[Required]
public string NotAfter
{ get; set; }
[Required]
public string NotBefore
{ get; set; }
[Required]
public string Subject
{ get; set; }
[Required]
public string PublicKey
{ get; set; }
[Required]
public string Thumbprint
{ get; set; }
// This *MUST* be an int or RegisterDscAction will fail with a
// 401 Unauthorized error and eroneously report an invalid
// Registration Key -- as HOURS of debugging has proven!
[Required]
public int Version
{ get; set; }
}
}
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: d20022435cb54fb40abf547c823ed568
timeCreated: 1467964904
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
#ifndef UTILS_H_
#define UTILS_H_
int verify_hair(char *str, size_t size);
int verify_eye(char *str, size_t size);
int verify_suffix(char *str, size_t size);
int verify_state(char *str, size_t size);
int verify_education(char *str, size_t size);
int verify_month(char *str, size_t size);
int verify_day(char *str, size_t size);
int verify_year(char *str, size_t size);
int verify_height_feet(char *str, size_t size);
int verify_height_inches(char *str, size_t size);
int verify_weight(char *str, size_t size);
int verify_sex(char *str, size_t size);
int verify_yes_no(char *str, size_t size);
int verify_name(char *str, size_t size);
int verify_street(char *str, size_t size);
int verify_city(char *str, size_t size);
int verify_zip_code(char *str, size_t size);
int verify_gpa(char *str, size_t size);
int verify_email(char *str, size_t size);
int verify_phone(char *str, size_t size);
int verify_number(char *str, size_t size);
int verify_text(char *str, size_t size);
#endif /* UTILS_H_ */
| {
"pile_set_name": "Github"
} |
function l = lum(img)
%
% l = lum(img)
%
% This function calculates the luminance
%
%
% input:
% img: an RGB image
%
% output:
% l: luminance as XYZ color
%
% Copyright (C) 2011-13 Francesco Banterle
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
col = size(img, 3);
switch col
case 1
l = img;
case 3
l = 0.2126 * img(:,:,1) + 0.7152 * img(:,:,2) + 0.0722 * img(:,:,3);
otherwise
l = mean(img, 3);
disp('Mean of channels was computed; the input image is not an RGB or luminance image!');
end
end | {
"pile_set_name": "Github"
} |
// Ceres Solver - A fast non-linear least squares minimizer
// Copyright 2010, 2011, 2012 Google Inc. All rights reserved.
// http://code.google.com/p/ceres-solver/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of Google Inc. nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Author: [email protected] (Sameer Agarwal)
#include "ceres/minimizer.h"
#include "ceres/types.h"
#include "glog/logging.h"
namespace ceres {
namespace internal {
Minimizer::~Minimizer() {}
bool Minimizer::RunCallbacks(const Minimizer::Options& options,
const IterationSummary& iteration_summary,
Solver::Summary* summary) {
const bool is_not_silent = !options.is_silent;
CallbackReturnType status = SOLVER_CONTINUE;
int i = 0;
while (status == SOLVER_CONTINUE && i < options.callbacks.size()) {
status = (*options.callbacks[i])(iteration_summary);
++i;
}
switch (status) {
case SOLVER_CONTINUE:
return true;
case SOLVER_TERMINATE_SUCCESSFULLY:
summary->termination_type = USER_SUCCESS;
summary->message = "User callback returned SOLVER_TERMINATE_SUCCESSFULLY.";
VLOG_IF(1, is_not_silent) << "Terminating: " << summary->message;
return false;
case SOLVER_ABORT:
summary->termination_type = USER_FAILURE;
summary->message = "User callback returned SOLVER_ABORT.";
VLOG_IF(1, is_not_silent) << "Terminating: " << summary->message;
return false;
default:
LOG(FATAL) << "Unknown type of user callback status";
}
return false;
}
} // namespace internal
} // namespace ceres
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Copyright 2015 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
'use strict';
var Probe = require('../lib/probe.js');
var aspect = require('../lib/aspect.js');
var request = require('../lib/request.js');
var am = require('../');
var util = require('util');
function LeveldownProbe() {
Probe.call(this, 'leveldown');
}
util.inherits(LeveldownProbe, Probe);
function aspectLvldownMethod(dbTarget, methods, probe) {
aspect.before(dbTarget, methods, function(dbTarget, methodName, methodArgs, probeData) {
probe.metricsProbeStart(probeData, dbTarget, methodName, methodArgs);
probe.requestProbeStart(probeData, dbTarget, methodName, methodArgs);
if (aspect.findCallbackArg(methodArgs) != undefined) {
aspect.aroundCallback(methodArgs, probeData, function(dbTarget, args, probeData) {
// Call the transaction link with a name and the callback for strong trace
var callbackPosition = aspect.findCallbackArg(methodArgs);
if (typeof callbackPosition != 'undefined') {
aspect.strongTraceTransactionLink('leveldown: ', methodName, methodArgs[callbackPosition]);
}
probe.metricsProbeEnd(probeData, methodName, methodArgs);
probe.requestProbeEnd(probeData, methodName, methodArgs);
});
}
});
}
// Attaches probe to module
LeveldownProbe.prototype.attach = function(name, target) {
var that = this; // Referencing probe
var methods = ['put', 'get', 'del', 'batch']; // Monitored leveldown methods
if (name != 'leveldown') return target;
if (target.__ddProbeAttached__) return target;
// Wrapping the target in new function as leveldown returns constructor
var newTarget = function() {
var lvldownObj = target.apply(null, arguments);
lvldownObj._ddProbeAttached_ = true;
aspectLvldownMethod(lvldownObj, methods, that);
return lvldownObj;
};
return newTarget;
};
/*
* Lightweight metrics probe for leveldown queries
*
* These provide:
* time: time event started
* method: leveldown method being executed
* key: The key being used for a call to `get`, `put` or `del`
* value: The value being added to the LevelDB database using `put`
* opCount: The number of operations being performed by `batch`
* duration: The time taken for the LevelDB query to respond in ms
*
* Note: key, value and opCount are undefined for methods other than those * stated
*/
LeveldownProbe.prototype.metricsEnd = function(probeData, method, methodArgs) {
if (probeData && probeData.timer) {
probeData.timer.stop();
if (method == 'put') {
am.emit('leveldown', {
time: probeData.timer.startTimeMillis,
method: method,
key: methodArgs[0],
value: methodArgs[1],
duration: probeData.timer.timeDelta,
});
} else if (method == 'del' || method == 'get') {
am.emit('leveldown', {
time: probeData.timer.startTimeMillis,
method: method,
key: methodArgs[0],
duration: probeData.timer.timeDelta,
});
} else if (method == 'batch') {
am.emit('leveldown', {
time: probeData.timer.startTimeMillis,
method: method,
opCount: methodArgs[0].length,
duration: probeData.timer.timeDelta,
});
}
}
};
/*
* Heavyweight request probes for leveldown queries
*/
LeveldownProbe.prototype.requestStart = function(probeData, dbTarget, method, methodArgs) {
// FIXME(sam) req is used as a global to communicate with requestEnd, almost
// certainly a bug, what happens if two requests are started before the first
// ends? This is a bug, but it is being marked to be skipped by eslint
// temporarily until it is fixed. See:
// https://github.com/RuntimeTools/appmetrics/pull/274#discussion_r122651577
/* eslint-disable */
req = request.startRequest('leveldown', 'query');
req.setContext({ leveldown: methodArgs[0] });
/* eslint-enable */
};
LeveldownProbe.prototype.requestEnd = function(probeData, method, methodArgs) {
/* eslint-disable */
if (probeData && probeData.req) req.stop({ leveldown: methodArgs[0] });
/* eslint-enable */
};
module.exports = LeveldownProbe;
| {
"pile_set_name": "Github"
} |
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
namespace VsChromium.Features.ToolWindows.CodeSearch {
public class CodeSearchItemViewModelBase : TreeViewItemViewModel {
private readonly ICodeSearchController _controller;
public CodeSearchItemViewModelBase(
ICodeSearchController controller,
TreeViewItemViewModel parent,
bool lazyLoadChildren)
: base(controller.StandarImageSourceFactory, parent, lazyLoadChildren) {
_controller = controller;
}
public ICodeSearchController Controller { get { return _controller; } }
}
}
| {
"pile_set_name": "Github"
} |
#include <stdio.h>
char *a[] = {"one"};
const char b[] = {"two"};
int main(void) {
printf("%s %s\n", a[0], b);
}
| {
"pile_set_name": "Github"
} |
; RUN: llc < %s -mtriple=i686-pc-linux-gnu | FileCheck %s
; CHECK: .cfi_startproc
; CHECK: .cfi_def_cfa_offset 8
; CHECK: .cfi_def_cfa_offset 12
; CHECK: .cfi_def_cfa_offset 32
; CHECK: .cfi_offset %esi, -12
; CHECK: .cfi_offset %edi, -8
; CHECK: .cfi_endproc
%0 = type { i64, i64 }
declare fastcc %0 @ReturnBigStruct() nounwind readnone
define void @test(%0* %p) {
%1 = call fastcc %0 @ReturnBigStruct()
store %0 %1, %0* %p
ret void
}
| {
"pile_set_name": "Github"
} |
/**
* 1000ミリ秒未満のランダムなタイミングでレスポンスを擬似的にデータ取得する関数
* 指定した`path`にデータがあるなら`callback(null, レスポンス)`を呼ぶ
* データがない場合はNOT FOUNDとなり`callback(エラー)`を呼ぶ
*/
function dummyFetch(path, callback) {
setTimeout(() => {
// /success を含むパスにはリソースがあるという設定
if (path.startsWith("/success")) {
callback(null, { body: `Response body of ${path}` });
} else {
callback(new Error("NOT FOUND"));
}
}, 1000 * Math.random());
}
dummyFetch("/success/data", (error, response) => {
console.log(error, response);
});
dummyFetch("/failure/data", (error, response) => {
console.log(error, response);
});
// nest
dummyFetch("/success/data", (error, response) => {
console.log(error, response);
// nest
dummyFetch("/failure/data", (error, response) => {
console.log(error, response);
});
});
| {
"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>IBFramework Version</key>
<string>667</string>
<key>IBLastKnownRelativeProjectPath</key>
<string>../Sparkle.xcodeproj</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
<integer>6</integer>
</array>
<key>IBSystem Version</key>
<string>9D34</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
</plist>
| {
"pile_set_name": "Github"
} |
//
// AdaptivePresentationSecondViewController.swift
// UIScrollViewDemo
//
// Created by xiAo_Ju on 2018/11/14.
// Copyright © 2018 伯驹 黄. All rights reserved.
//
import UIKit
class AdaptivePresentationSecondViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let dismissButton = UIBarButtonItem(title: "dismiss", style: UIBarButtonItem.Style.plain, target: self, action: #selector(dismissAction))
navigationItem.leftBarButtonItem = dismissButton
view.backgroundColor = UIColor(hex: 0x7DD1F0)
}
@objc
func dismissAction() {
dismiss(animated: true, completion: nil)
}
override var transitioningDelegate: UIViewControllerTransitioningDelegate? {
didSet {
presentationController?.delegate = self
}
}
}
extension AdaptivePresentationSecondViewController: UIAdaptivePresentationControllerDelegate {
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return .fullScreen
}
func presentationController(_ controller: UIPresentationController, viewControllerForAdaptivePresentationStyle style: UIModalPresentationStyle) -> UIViewController? {
return UINavigationController(rootViewController: controller.presentedViewController)
}
}
| {
"pile_set_name": "Github"
} |
Flot 0.7
--------
API changes:
Multiple axes support. Code using dual axes should be changed from
using x2axis/y2axis in the options to using an array (although
backwards-compatibility hooks are in place). For instance,
{
xaxis: { ... }, x2axis: { ... },
yaxis: { ... }, y2axis: { ... }
}
becomes
{
xaxes: [ { ... }, { ... } ],
yaxes: [ { ... }, { ... } ]
}
Note that if you're just using one axis, continue to use the
xaxis/yaxis directly (it now sets the default settings for the
arrays). Plugins touching the axes must be ported to take the extra
axes into account, check the source to see some examples.
A related change is that the visibility of axes is now auto-detected.
So if you were relying on an axis to show up even without any data in
the chart, you now need to set the axis "show" option explicitly.
"tickColor" on the grid options is now deprecated in favour of a
corresponding option on the axes, so { grid: { tickColor: "#000" }}
becomes { xaxis: { tickColor: "#000"}, yaxis: { tickColor: "#000"} },
but if you just configure a base color Flot will now autogenerate a
tick color by adding transparency. Backwards-compatibility hooks are
in place.
Final note: now that IE 9 is coming out with canvas support, you may
want to adapt the excanvas include to skip loading it in IE 9 (the
examples have been adapted thanks to Ryley Breiddal). An alternative
to excanvas using Flash has also surfaced, if your graphs are slow in
IE, you may want to give it a spin:
http://code.google.com/p/flashcanvas/
Changes:
- Support for specifying a bottom for each point for line charts when
filling them, this means that an arbitrary bottom can be used
instead of just the x axis (based on patches patiently provided by
Roman V. Prikhodchenko).
- New fillbetween plugin that can compute a bottom for a series from
another series, useful for filling areas between lines (see new
example percentiles.html for a use case).
- More predictable handling of gaps for the stacking plugin, now all
undefined ranges are skipped.
- Stacking plugin can stack horizontal bar charts.
- Navigate plugin now redraws the plot while panning instead of only
after the fact (can be disabled by setting the pan.frameRate option
to null), raised by lastthemy (issue 235).
- Date formatter now accepts %0m and %0d to get a zero-padded month or
day (issue raised by Maximillian Dornseif).
- Revamped internals to support an unlimited number of axes, not just
dual (sponsored by Flight Data Services,
www.flightdataservices.com).
- New setting on axes, "tickLength", to control the size of ticks or
turn them off without turning off the labels.
- Axis labels are now put in container divs with classes, for instance
labels in the x axes can be reached via ".xAxis .tickLabel".
- Support for setting the color of an axis (sponsored by Flight Data
Services, www.flightdataservices.com).
- Tick color is now auto-generated as the base color with some
transparency (unless you override it).
- Support for aligning ticks in the axes with "alignTicksWithAxis" to
ensure that they appear next to each other rather than in between,
at the expense of possibly awkward tick steps (sponsored by Flight
Data Services, www.flightdataservices.com).
- Support for customizing the point type through a callback when
plotting points and new symbol plugin with some predefined point
types (sponsored by Utility Data Corporation).
- Resize plugin for automatically redrawing when the placeholder
changes size, e.g. on window resizes (sponsored by Novus Partners).
A resize() method has been added to plot object facilitate this.
- Support Infinity/-Infinity for plotting asymptotes by hacking it
into +/-Number.MAX_VALUE (reported by rabaea.mircea).
- Support for restricting navigate plugin to not pan/zoom an axis (based
on patch by kkaefer).
- Support for providing the drag cursor for the navigate plugin as an
option (based on patch by Kelly T. Moore).
- Options for controlling whether an axis is shown or not (suggestion
by Timo Tuominen) and whether to reserve space for it even if it
isn't shown.
- New attribute $.plot.version with the Flot version as a string.
- The version comment is now included in the minified jquery.flot.min.js.
- New options.grid.minBorderMargin for adjusting the minimum margin
provided around the border (based on patch by corani, issue 188).
- Refactor replot behaviour so Flot tries to reuse the existing
canvas, adding shutdown() methods to the plot (based on patch by
Ryley Breiddal, issue 269). This prevents a memory leak in Chrome
and hopefully makes replotting faster for those who are using $.plot
instead of .setData()/.draw(). Also update jQuery to 1.5.1 to
prevent IE leaks fixed in jQuery.
- New real-time line chart example.
- New hooks: drawSeries, shutdown
Bug fixes:
- Fixed problem with findNearbyItem and bars on top of each other
(reported by ragingchikn, issue 242).
- Fixed problem with ticks and the border (based on patch from
ultimatehustler69, issue 236).
- Fixed problem with plugins adding options to the series objects.
- Fixed a problem introduced in 0.6 with specifying a gradient with {
brightness: x, opacity: y }.
- Don't use $.browser.msie, check for getContext on the created canvas
element instead and try to use excanvas if it's not found (fixes IE
9 compatibility).
- highlight(s, index) was looking up the point in the original s.data
instead of in the computed datapoints array, which breaks with
plugins that modify the datapoints (such as the stacking plugin).
Issue 316 reported by curlypaul924.
- More robust handling of axis from data passed in from getData()
(problem reported by Morgan).
- Fixed problem with turning off bar outline (issue 253, fix by Jordi
Castells).
- Check the selection passed into setSelection in the selection
plugin, to guard against errors when synchronizing plots (fix by Lau
Bech Lauritzen).
- Fix bug in crosshair code with mouseout resetting the crosshair even
if it is locked (fix by Lau Bech Lauritzen and Banko Adam).
- Fix bug with points plotting using line width from lines rather than
points.
- Fix bug with passing non-array 0 data (for plugins that don't expect
arrays, patch by vpapp1).
- Fix errors in JSON in examples so they work with jQuery 1.4.2
(fix reported by honestbleeps, issue 357).
- Fix bug with tooltip in interacting.html, this makes the tooltip
much smoother (fix by bdkahn). Fix related bug inside highlighting
handler in Flot.
- Use closure trick to make inline colorhelpers plugin respect
jQuery.noConflict(true), renaming the global jQuery object (reported
by Nick Stielau).
- Listen for mouseleave events and fire a plothover event with empty
item when it occurs to drop highlights when the mouse leaves the
plot (reported by by outspirit).
- Fix bug with using aboveData with a background (reported by
amitayd).
- Fix possible excanvas leak (report and suggested fix by tom9729).
- Fix bug with backwards compatibility for shadowSize = 0 (report and
suggested fix by aspinak).
- Adapt examples to skip loading excanvas (fix by Ryley Breiddal).
- Fix bug that prevent a simple f(x) = -x transform from working
correctly (fix by Mike, issue 263).
- Fix bug in restoring cursor in navigate plugin (reported by Matteo
Gattanini, issue 395).
- Fix bug in picking items when transform/inverseTransform is in use
(reported by Ofri Raviv, and patches and analysis by Jan and Tom
Paton, issue 334 and 467).
- Fix problem with unaligned ticks and hover/click events caused by
padding on the placeholder by hardcoding the placeholder padding to
0 (reported by adityadineshsaxena, Matt Sommer, Daniel Atos and some
other people, issue 301).
- Update colorhelpers plugin to avoid dying when trying to parse an
invalid string (reported by cadavor, issue 483).
Flot 0.6
--------
API changes:
1. Selection support has been moved to a plugin. Thus if you're
passing selection: { mode: something }, you MUST include the file
jquery.flot.selection.js after jquery.flot.js. This reduces the size
of base Flot and makes it easier to customize the selection as well as
improving code clarity. The change is based on a patch from andershol.
2. In the global options specified in the $.plot command,
"lines", "points", "bars" and "shadowSize" have been moved to a
sub-object called "series", i.e.
$.plot(placeholder, data, { lines: { show: true }})
should be changed to
$.plot(placeholder, data, { series: { lines: { show: true }}})
All future series-specific options will go into this sub-object to
simplify plugin writing. Backward-compatibility code is in place, so
old code should not break.
3. "plothover" no longer provides the original data point, but instead
a normalized one, since there may be no corresponding original point.
4. Due to a bug in previous versions of jQuery, you now need at least
jQuery 1.2.6. But if you can, try jQuery 1.3.2 as it got some
improvements in event handling speed.
Changes:
- Added support for disabling interactivity for specific data series
(request from Ronald Schouten and Steve Upton).
- Flot now calls $() on the placeholder and optional legend container
passed in so you can specify DOM elements or CSS expressions to make
it easier to use Flot with libraries like Prototype or Mootools or
through raw JSON from Ajax responses.
- A new "plotselecting" event is now emitted while the user is making
a selection.
- The "plothover" event is now emitted immediately instead of at most
10 times per second, you'll have to put in a setTimeout yourself if
you're doing something really expensive on this event.
- The built-in date formatter can now be accessed as
$.plot.formatDate(...) (suggestion by Matt Manela) and even
replaced.
- Added "borderColor" option to the grid (patch from Amaury Chamayou
and patch from Mike R. Williamson).
- Added support for gradient backgrounds for the grid, take a look at
the "setting options" example (based on patch from Amaury Chamayou,
issue 90).
- Gradient bars (suggestion by stefpet).
- Added a "plotunselected" event which is triggered when the selection
is removed, see "selection" example (suggestion by Meda Ugo);
- The option legend.margin can now specify horizontal and vertical
margins independently (suggestion by someone who's annoyed).
- Data passed into Flot is now copied to a new canonical format to
enable further processing before it hits the drawing routines. As a
side-effect, this should make Flot more robust in the face of bad
data (and fixes issue 112).
- Step-wise charting: line charts have a new option "steps" that when
set to true connects the points with horizontal/vertical steps
instead of diagonal lines.
- The legend labelFormatter now passes the series in addition to just
the label (suggestion by Vincent Lemeltier).
- Horizontal bars (based on patch by Jason LeBrun).
- Support for partial bars by specifying a third coordinate, i.e. they
don't have to start from the axis. This can be used to make stacked
bars.
- New option to disable the (grid.show).
- Added pointOffset method for converting a point in data space to an
offset within the placeholder.
- Plugin system: register an init method in the $.flot.plugins array
to get started, see PLUGINS.txt for details on how to write plugins
(it's easy). There are also some extra methods to enable access to
internal state.
- Hooks: you can register functions that are called while Flot is
crunching the data and doing the plot. This can be used to modify
Flot without changing the source, useful for writing plugins. Some
hooks are defined, more are likely to come.
- Threshold plugin: you can set a threshold and a color, and the data
points below that threshold will then get the color. Useful for
marking data below 0, for instance.
- Stack plugin: you can specify a stack key for each series to have
them summed. This is useful for drawing additive/cumulative graphs
with bars and (currently unfilled) lines.
- Crosshairs plugin: trace the mouse position on the axes, enable with
crosshair: { mode: "x"} (see the new tracking example for a use).
- Image plugin: plot prerendered images.
- Navigation plugin for panning and zooming a plot.
- More configurable grid.
- Axis transformation support, useful for non-linear plots, e.g. log
axes and compressed time axes (like omitting weekends).
- Support for twelve-hour date formatting (patch by Forrest Aldridge).
- The color parsing code in Flot has been cleaned up and split out so
it's now available as a separate jQuery plugin. It's included inline
in the Flot source to make dependency managing easier. This also
makes it really easy to use the color helpers in Flot plugins.
Bug fixes:
- Fixed two corner-case bugs when drawing filled curves (report and
analysis by Joshua Varner).
- Fix auto-adjustment code when setting min to 0 for an axis where the
dataset is completely flat on that axis (report by chovy).
- Fixed a bug with passing in data from getData to setData when the
secondary axes are used (issue 65, reported by nperelman).
- Fixed so that it is possible to turn lines off when no other chart
type is shown (based on problem reported by Glenn Vanderburg), and
fixed so that setting lineWidth to 0 also hides the shadow (based on
problem reported by Sergio Nunes).
- Updated mousemove position expression to the latest from jQuery (bug
reported by meyuchas).
- Use CSS borders instead of background in legend (fix printing issue 25
and 45).
- Explicitly convert axis min/max to numbers.
- Fixed a bug with drawing marking lines with different colors
(reported by Khurram).
- Fixed a bug with returning y2 values in the selection event (fix
by exists, issue 75).
- Only set position relative on placeholder if it hasn't already a
position different from static (reported by kyberneticist, issue 95).
- Don't round markings to prevent sub-pixel problems (reported by Dan
Lipsitt).
- Make the grid border act similarly to a regular CSS border, i.e.
prevent it from overlapping the plot itself. This also fixes a
problem with anti-aliasing when the width is 1 pixel (reported by
Anthony Ettinger).
- Imported version 3 of excanvas and fixed two issues with the newer
version. Hopefully, this will make Flot work with IE8 (nudge by
Fabien Menager, further analysis by Booink, issue 133).
- Changed the shadow code for lines to hopefully look a bit better
with vertical lines.
- Round tick positions to avoid possible problems with fractions
(suggestion by Fred, issue 130).
- Made the heuristic for determining how many ticks to aim for a bit
smarter.
- Fix for uneven axis margins (report and patch by Paul Kienzle) and
snapping to ticks (concurrent report and patch by lifthrasiir).
- Fixed bug with slicing in findNearbyItems (patch by zollman).
- Make heuristic for x axis label widths more dynamic (patch by
rickinhethuis).
- Make sure points on top take precedence when finding nearby points
when hovering (reported by didroe, issue 224).
Flot 0.5
--------
Backwards API change summary: Timestamps are now in UTC. Also
"selected" event -> becomes "plotselected" with new data, the
parameters for setSelection are now different (but backwards
compatibility hooks are in place), coloredAreas becomes markings with
a new interface (but backwards compatibility hooks are in place).
Interactivity: added a new "plothover" event and this and the
"plotclick" event now returns the closest data item (based on patch by
/david, patch by Mark Byers for bar support). See the revamped
"interacting with the data" example for some hints on what you can do.
Highlighting: you can now highlight points and datapoints are
autohighlighted when you hover over them (if hovering is turned on).
Support for dual axis has been added (based on patch by someone who's
annoyed and /david). For each data series you can specify which axes
it belongs to, and there are two more axes, x2axis and y2axis, to
customize. This affects the "selected" event which has been renamed to
"plotselected" and spews out { xaxis: { from: -10, to: 20 } ... },
setSelection in which the parameters are on a new form (backwards
compatible hooks are in place so old code shouldn't break) and
markings (formerly coloredAreas).
Timestamps in time mode are now displayed according to
UTC instead of the time zone of the visitor. This affects the way the
timestamps should be input; you'll probably have to offset the
timestamps according to your local time zone. It also affects any
custom date handling code (which basically now should use the
equivalent UTC date mehods, e.g. .setUTCMonth() instead of
.setMonth().
Added support for specifying the size of tick labels (axis.labelWidth,
axis.labelHeight). Useful for specifying a max label size to keep
multiple plots aligned.
Markings, previously coloredAreas, are now specified as ranges on the
axes, like { xaxis: { from: 0, to: 10 }}. Furthermore with markings
you can now draw horizontal/vertical lines by setting from and to to
the same coordinate (idea from line support patch by by Ryan Funduk).
The "fill" option can now be a number that specifies the opacity of
the fill.
You can now specify a coordinate as null (like [2, null]) and Flot
will take the other coordinate into account when scaling the axes
(based on patch by joebno).
New option for bars "align". Set it to "center" to center the bars on
the value they represent.
setSelection now takes a second parameter which you can use to prevent
the method from firing the "plotselected" handler.
Using the "container" option in legend now overwrites the container
element instead of just appending to it (fixes infinite legend bug,
reported by several people, fix by Brad Dewey).
Fixed a bug in calculating spacing around the plot (reported by
timothytoe). Fixed a bug in finding max values for all-negative data
sets. Prevent the possibility of eternal looping in tick calculations.
Fixed a bug when borderWidth is set to 0 (reported by
Rob/sanchothefat). Fixed a bug with drawing bars extending below 0
(reported by James Hewitt, patch by Ryan Funduk). Fixed a
bug with line widths of bars (reported by MikeM). Fixed a bug with
'nw' and 'sw' legend positions. Improved the handling of axis
auto-scaling with bars. Fixed a bug with multi-line x-axis tick
labels (reported by Luca Ciano). IE-fix help by Savage Zhang.
Flot 0.4
--------
API changes: deprecated axis.noTicks in favor of just specifying the
number as axis.ticks. So "xaxis: { noTicks: 10 }" becomes
"xaxis: { ticks: 10 }"
Time series support. Specify axis.mode: "time", put in Javascript
timestamps as data, and Flot will automatically spit out sensible
ticks. Take a look at the two new examples. The format can be
customized with axis.timeformat and axis.monthNames, or if that fails
with axis.tickFormatter.
Support for colored background areas via grid.coloredAreas. Specify an
array of { x1, y1, x2, y2 } objects or a function that returns these
given { xmin, xmax, ymin, ymax }.
More members on the plot object (report by Chris Davies and others).
"getData" for inspecting the assigned settings on data series (e.g.
color) and "setData", "setupGrid" and "draw" for updating the contents
without a total replot.
The default number of ticks to aim for is now dependent on the size of
the plot in pixels. Support for customizing tick interval sizes
directly with axis.minTickSize and axis.tickSize.
Cleaned up the automatic axis scaling algorithm and fixed how it
interacts with ticks. Also fixed a couple of tick-related corner case
bugs (one reported by mainstreetmark, another reported by timothytoe).
The option axis.tickFormatter now takes a function with two
parameters, the second parameter is an optional object with
information about the axis. It has min, max, tickDecimals, tickSize.
Added support for segmented lines (based on patch from Michael
MacDonald) and for ignoring null and bad values (suggestion from Nick
Konidaris and joshwaihi).
Added support for changing the border width (joebno and safoo).
Label colors can be changed via CSS by selecting the tickLabel class.
Fixed a bug in handling single-item bar series (reported by Emil
Filipov). Fixed erratic behaviour when interacting with the plot
with IE 7 (reported by Lau Bech Lauritzen). Prevent IE/Safari text
selection when selecting stuff on the canvas.
Flot 0.3
--------
This is mostly a quick-fix release because jquery.js wasn't included
in the previous zip/tarball.
Support clicking on the plot. Turn it on with grid: { clickable: true },
then you get a "plotclick" event on the graph placeholder with the
position in units of the plot.
Fixed a bug in dealing with data where min = max, thanks to Michael
Messinides.
Include jquery.js in the zip/tarball.
Flot 0.2
--------
Added support for putting a background behind the default legend. The
default is the partly transparent background color. Added
backgroundColor and backgroundOpacity to the legend options to control
this.
The ticks options can now be a callback function that takes one
parameter, an object with the attributes min and max. The function
should return a ticks array.
Added labelFormatter option in legend, useful for turning the legend
labels into links.
Fixed a couple of bugs.
The API should now be fully documented.
Patch from Guy Fraser to make parts of the code smaller.
API changes: Moved labelMargin option to grid from x/yaxis.
Flot 0.1
--------
First public release.
| {
"pile_set_name": "Github"
} |
<html>
<head>
<title>NVIDIA(R) PhysX(R) SDK 3.4 API Reference: PxMeshGeometryFlag Struct Reference</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK HREF="NVIDIA.css" REL="stylesheet" TYPE="text/css">
</head>
<body bgcolor="#FFFFFF">
<div id="header">
<hr class="first">
<img alt="" src="images/PhysXlogo.png" align="middle"> <br>
<center>
<a class="qindex" href="main.html">Main Page</a>
<a class="qindex" href="hierarchy.html">Class Hierarchy</a>
<a class="qindex" href="annotated.html">Compound List</a>
<a class="qindex" href="functions.html">Compound Members</a>
</center>
<hr class="second">
</div>
<!-- Generated by Doxygen 1.5.8 -->
<div class="contents">
<h1>PxMeshGeometryFlag Struct Reference<br>
<small>
[<a class="el" href="group__geomutils.html">Geomutils</a>]</small>
</h1><!-- doxytag: class="PxMeshGeometryFlag" -->Flags controlling the simulated behavior of the triangle mesh geometry.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="PxTriangleMeshGeometry_8h-source.html">PxTriangleMeshGeometry.h</a>></code>
<p>
<p>
<a href="structPxMeshGeometryFlag-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="structPxMeshGeometryFlag.html#a4f762855200599fc014b0654f7ce2c9">Enum</a> { <a class="el" href="structPxMeshGeometryFlag.html#a4f762855200599fc014b0654f7ce2c9e50426f8f858ae161427c24276eb3014">eDOUBLE_SIDED</a> = (1<<1)
}</td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Flags controlling the simulated behavior of the triangle mesh geometry.
<p>
Used in <a class="el" href="group__geomutils.html#gb335a00d0493a23fed5423bc3ea9e463" title="collection of set bits defined in PxMeshGeometryFlag.">PxMeshGeometryFlags</a>. <hr><h2>Member Enumeration Documentation</h2>
<a class="anchor" name="a4f762855200599fc014b0654f7ce2c9"></a><!-- doxytag: member="PxMeshGeometryFlag::Enum" ref="a4f762855200599fc014b0654f7ce2c9" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">enum <a class="el" href="structPxMeshGeometryFlag.html#a4f762855200599fc014b0654f7ce2c9">PxMeshGeometryFlag::Enum</a> </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<dl compact><dt><b>Enumerator: </b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" name="a4f762855200599fc014b0654f7ce2c9e50426f8f858ae161427c24276eb3014"></a><!-- doxytag: member="eDOUBLE_SIDED" ref="a4f762855200599fc014b0654f7ce2c9e50426f8f858ae161427c24276eb3014" args="" -->eDOUBLE_SIDED</em> </td><td>
Meshes with this flag set are treated as double-sided. This flag is currently only used for raycasts and sweeps (it is ignored for overlap queries). For detailed specifications of this flag for meshes and heightfields please refer to the Geometry Query section of the user guide. </td></tr>
</table>
</dl>
</div>
</div><p>
<hr>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="PxTriangleMeshGeometry_8h-source.html">PxTriangleMeshGeometry.h</a></ul>
</div>
<hr style="width: 100%; height: 2px;"><br>
Copyright © 2008-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. <a href="http://www.nvidia.com ">www.nvidia.com</a>
</body>
</html>
| {
"pile_set_name": "Github"
} |
#pragma once
// restore GCC/clang diagnostic settings
#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
#if defined(__clang__)
#pragma GCC diagnostic pop
#endif
// clean up
#undef JSON_ASSERT
#undef JSON_INTERNAL_CATCH
#undef JSON_CATCH
#undef JSON_THROW
#undef JSON_TRY
#undef JSON_HAS_CPP_14
#undef JSON_HAS_CPP_17
#undef NLOHMANN_BASIC_JSON_TPL_DECLARATION
#undef NLOHMANN_BASIC_JSON_TPL
#undef JSON_EXPLICIT
#include <nlohmann/thirdparty/hedley/hedley_undef.hpp>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.limlee.hiframeanimation">
<application
android:name="org.limlee.hiframeanimationlib.HolderApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest> | {
"pile_set_name": "Github"
} |
package au.com.example.service.user;
import org.springframework.security.provisioning.UserDetailsManager;
public interface UserService extends UserDetailsManager {
}
| {
"pile_set_name": "Github"
} |
// mksyscall.pl syscall_linux.go syscall_linux_ppc64x.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// +build ppc64,linux
package unix
import (
"syscall"
"unsafe"
)
var _ syscall.Errno
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(oldpath)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(newpath)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_LINKAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0)
use(unsafe.Pointer(_p0))
use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mode), 0, 0)
use(unsafe.Pointer(_p0))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func readlinkat(dirfd int, path string, buf []byte) (n int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(buf) > 0 {
_p1 = unsafe.Pointer(&buf[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0)
use(unsafe.Pointer(_p0))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func symlinkat(oldpath string, newdirfd int, newpath string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(oldpath)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(newpath)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)))
use(unsafe.Pointer(_p0))
use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func unlinkat(dirfd int, path string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags))
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func utimes(path string, times *[2]Timeval) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func futimesat(dirfd int, path *byte, times *[2]Timeval) (err error) {
_, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(times)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getcwd(buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETCWD, uintptr(_p0), uintptr(len(buf)), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) {
r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0)
wpid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(arg)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_REBOOT, uintptr(magic1), uintptr(magic2), uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(source)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(target)
if err != nil {
return
}
var _p2 *byte
_p2, err = BytePtrFromString(fstype)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_MOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(flags), uintptr(unsafe.Pointer(data)), 0)
use(unsafe.Pointer(_p0))
use(unsafe.Pointer(_p1))
use(unsafe.Pointer(_p2))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Acct(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_ACCT, uintptr(unsafe.Pointer(_p0)), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Adjtimex(buf *Timex) (state int, err error) {
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
state = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chdir(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Chroot(path string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func ClockGettime(clockid int32, time *Timespec) (err error) {
_, _, e1 := Syscall(SYS_CLOCK_GETTIME, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Close(fd int) (err error) {
_, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup(oldfd int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup3(oldfd int, newfd int, flags int) (err error) {
_, _, e1 := Syscall(SYS_DUP3, uintptr(oldfd), uintptr(newfd), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollCreate(size int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollCreate1(flag int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE1, uintptr(flag), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) {
_, _, e1 := RawSyscall6(SYS_EPOLL_CTL, uintptr(epfd), uintptr(op), uintptr(fd), uintptr(unsafe.Pointer(event)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Exit(code int) {
Syscall(SYS_EXIT_GROUP, uintptr(code), 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fallocate(fd int, mode uint32, off int64, len int64) (err error) {
_, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(len), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchdir(fd int) (err error) {
_, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchmod(fd int, mode uint32) (err error) {
_, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func fcntl(fd int, cmd int, arg int) (val int, err error) {
r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg))
val = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fdatasync(fd int) (err error) {
_, _, e1 := Syscall(SYS_FDATASYNC, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Flock(fd int, how int) (err error) {
_, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fsync(fd int) (err error) {
_, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETDENTS64, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpgid(pid int) (pgid int, err error) {
r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0)
pgid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpid() (pid int) {
r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
pid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getppid() (ppid int) {
r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
ppid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpriority(which int, who int) (prio int, err error) {
r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0)
prio = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrusage(who int, rusage *Rusage) (err error) {
_, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettid() (tid int) {
r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0)
tid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getxattr(path string, attr string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(dest) > 0 {
_p2 = unsafe.Pointer(&dest[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
use(unsafe.Pointer(_p0))
use(unsafe.Pointer(_p1))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(pathname)
if err != nil {
return
}
r0, _, e1 := Syscall(SYS_INOTIFY_ADD_WATCH, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(mask))
use(unsafe.Pointer(_p0))
watchdesc = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func InotifyInit1(flags int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT1, uintptr(flags), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func InotifyRmWatch(fd int, watchdesc uint32) (success int, err error) {
r0, _, e1 := RawSyscall(SYS_INOTIFY_RM_WATCH, uintptr(fd), uintptr(watchdesc), 0)
success = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Kill(pid int, sig syscall.Signal) (err error) {
_, _, e1 := RawSyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Klogctl(typ int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Listxattr(path string, dest []byte) (sz int, err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 unsafe.Pointer
if len(dest) > 0 {
_p1 = unsafe.Pointer(&dest[0])
} else {
_p1 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
use(unsafe.Pointer(_p0))
sz = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode))
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Nanosleep(time *Timespec, leftover *Timespec) (err error) {
_, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func PivotRoot(newroot string, putold string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(newroot)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(putold)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_PIVOT_ROOT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
use(unsafe.Pointer(_p0))
use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func prlimit(pid int, resource int, old *Rlimit, newlimit *Rlimit) (err error) {
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(newlimit)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) {
_, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func read(fd int, p []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Removexattr(path string, attr string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
use(unsafe.Pointer(_p0))
use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(oldpath)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(newpath)
if err != nil {
return
}
_, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0)
use(unsafe.Pointer(_p0))
use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setdomainname(p []byte) (err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_SETDOMAINNAME, uintptr(_p0), uintptr(len(p)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Sethostname(p []byte) (err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_SETHOSTNAME, uintptr(_p0), uintptr(len(p)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setpgid(pid int, pgid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setsid() (pid int, err error) {
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
pid = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Settimeofday(tv *Timeval) (err error) {
_, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setns(fd int, nstype int) (err error) {
_, _, e1 := Syscall(SYS_SETNS, uintptr(fd), uintptr(nstype), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setpriority(which int, who int, prio int) (err error) {
_, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setxattr(path string, attr string, data []byte, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
var _p1 *byte
_p1, err = BytePtrFromString(attr)
if err != nil {
return
}
var _p2 unsafe.Pointer
if len(data) > 0 {
_p2 = unsafe.Pointer(&data[0])
} else {
_p2 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
use(unsafe.Pointer(_p0))
use(unsafe.Pointer(_p1))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Sync() {
Syscall(SYS_SYNC, 0, 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Sysinfo(info *Sysinfo_t) (err error) {
_, _, e1 := RawSyscall(SYS_SYSINFO, uintptr(unsafe.Pointer(info)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) {
r0, _, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0)
n = int64(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) {
_, _, e1 := RawSyscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Times(tms *Tms) (ticks uintptr, err error) {
r0, _, e1 := RawSyscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0)
ticks = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Umask(mask int) (oldmask int) {
r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0)
oldmask = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Uname(buf *Utsname) (err error) {
_, _, e1 := RawSyscall(SYS_UNAME, uintptr(unsafe.Pointer(buf)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unmount(target string, flags int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(target)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UMOUNT2, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Unshare(flags int) (err error) {
_, _, e1 := Syscall(SYS_UNSHARE, uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ustat(dev int, ubuf *Ustat_t) (err error) {
_, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func write(fd int, p []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func exitThread(code int) (err error) {
_, _, e1 := Syscall(SYS_EXIT, uintptr(code), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func readlen(fd int, p *byte, np int) (n int, err error) {
r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func writelen(fd int, p *byte, np int) (n int, err error) {
r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(p)), uintptr(np))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func munmap(addr uintptr, length uintptr) (err error) {
_, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Madvise(b []byte, advice int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(advice))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mprotect(b []byte, prot int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mlock(b []byte) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Munlock(b []byte) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Mlockall(flags int) (err error) {
_, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Munlockall() (err error) {
_, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
var _p0 unsafe.Pointer
if len(events) > 0 {
_p0 = unsafe.Pointer(&events[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Dup2(oldfd int, newfd int) (err error) {
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchown(fd int, uid int, gid int) (err error) {
_, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstat(fd int, stat *Stat_t) (err error) {
_, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fstatfs(fd int, buf *Statfs_t) (err error) {
_, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(buf)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ftruncate(fd int, length int64) (err error) {
_, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getegid() (egid int) {
r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
egid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Geteuid() (euid int) {
r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
euid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getgid() (gid int) {
r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
gid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_UGETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getuid() (uid int) {
r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
uid = int(r0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func InotifyInit() (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ioperm(from int, num int, on int) (err error) {
_, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Iopl(level int) (err error) {
_, _, e1 := Syscall(SYS_IOPL, uintptr(level), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lchown(path string, uid int, gid int) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid))
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Listen(s int, n int) (err error) {
_, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Lstat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pause() (err error) {
_, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pread(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Seek(fd int, offset int64, whence int) (off int64, err error) {
r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence))
off = int64(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0)
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0)
written = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setfsgid(gid int) (err error) {
_, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setfsuid(uid int) (err error) {
_, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setregid(rgid int, egid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setresgid(rgid int, egid int, sgid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setresuid(ruid int, euid int, suid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setrlimit(resource int, rlim *Rlimit) (err error) {
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Setreuid(ruid int, euid int) (err error) {
_, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Shutdown(fd int, how int) (err error) {
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {
r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
n = int64(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Stat(path string, stat *Stat_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Statfs(path string, buf *Statfs_t) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func SyncFileRange(fd int, off int64, n int64, flags int) (err error) {
_, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(off), uintptr(n), uintptr(flags), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Truncate(path string, length int64) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
_, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) {
_, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getgroups(n int, list *_Gid_t) (nn int, err error) {
r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
nn = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setgroups(n int, list *_Gid_t) (err error) {
_, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) {
_, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) {
_, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func socket(domain int, typ int, proto int) (fd int, err error) {
r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto))
fd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) {
_, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
_p0 = unsafe.Pointer(&p[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) {
r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset))
xaddr = uintptr(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettimeofday(tv *Timeval) (err error) {
_, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Time(t *Time_t) (tt Time_t, err error) {
r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0)
tt = Time_t(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Utime(path string, buf *Utimbuf) (err error) {
var _p0 *byte
_p0, err = BytePtrFromString(path)
if err != nil {
return
}
_, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0)
use(unsafe.Pointer(_p0))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func pipe(p *[2]_C_int) (err error) {
_, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func pipe2(p *[2]_C_int, flags int) (err error) {
_, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func poll(fds *PollFd, nfds int, timeout int) (n int, err error) {
r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
| {
"pile_set_name": "Github"
} |
/**
*
* WARNING! This file was autogenerated by:
* _ _ _ _ __ __
* | | | | | | |\ \ / /
* | | | | |_| | \ V /
* | | | | _ | / \
* | |_| | | | |/ /^\ \
* \___/\_| |_/\/ \/
*
* This file was autogenerated by UnrealHxGenerator using UHT definitions.
* It only includes UPROPERTYs and UFUNCTIONs. Do not modify it!
* In order to add more definitions, create or edit a type with the same name/package, but with an `_Extra` suffix
**/
package unreal;
@:glueCppIncludes("CoreUObject.h")
@:uextern @:uclass extern class UIntProperty extends unreal.UNumericProperty {
}
| {
"pile_set_name": "Github"
} |
/*
* /MathJax/jax/output/HTML-CSS/fonts/TeX/Main/Italic/Latin1Supplement.js
*
* Copyright (c) 2009-2015 The MathJax Consortium
*
* 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.
*/
MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS["MathJax_Main-italic"],{160:[0,0,250,0,0]});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/Main/Italic/Latin1Supplement.js");
| {
"pile_set_name": "Github"
} |
{
"name": {
"message": "Adguard AdBlocker"
},
"short_name": {
"message": "Adguard AdBlocker"
},
"description": {
"message": "Unmatched adblock extension against advertising and pop-ups. Blocks ads on Facebook, Youtube and all other websites."
}
} | {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.math.complex;
import java.text.NumberFormat;
import java.text.ParsePosition;
import java.util.Locale;
import org.junit.Test;
import org.junit.Assert;
import org.apache.commons.math.util.FastMath;
public abstract class ComplexFormatAbstractTest {
ComplexFormat complexFormat = null;
ComplexFormat complexFormatJ = null;
protected abstract Locale getLocale();
protected abstract char getDecimalCharacter();
protected ComplexFormatAbstractTest() {
complexFormat = ComplexFormat.getInstance(getLocale());
complexFormatJ = ComplexFormat.getInstance("j", getLocale());
}
@Test
public void testSimpleNoDecimals() {
Complex c = new Complex(1, 1);
String expected = "1 + 1i";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testSimpleWithDecimals() {
Complex c = new Complex(1.23, 1.43);
String expected = "1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter() + "43i";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testSimpleWithDecimalsTrunc() {
Complex c = new Complex(1.2323, 1.4343);
String expected = "1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter() + "43i";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testNegativeReal() {
Complex c = new Complex(-1.2323, 1.4343);
String expected = "-1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter() + "43i";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testNegativeImaginary() {
Complex c = new Complex(1.2323, -1.4343);
String expected = "1" + getDecimalCharacter() + "23 - 1" + getDecimalCharacter() + "43i";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testNegativeBoth() {
Complex c = new Complex(-1.2323, -1.4343);
String expected = "-1" + getDecimalCharacter() + "23 - 1" + getDecimalCharacter() + "43i";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testZeroReal() {
Complex c = new Complex(0.0, -1.4343);
String expected = "0 - 1" + getDecimalCharacter() + "43i";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testZeroImaginary() {
Complex c = new Complex(30.233, 0);
String expected = "30" + getDecimalCharacter() + "23";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testDifferentImaginaryChar() {
Complex c = new Complex(1, 1);
String expected = "1 + 1j";
String actual = complexFormatJ.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testDefaultFormatComplex() {
Locale defaultLocal = Locale.getDefault();
Locale.setDefault(getLocale());
Complex c = new Complex(232.222, -342.33);
String expected = "232" + getDecimalCharacter() + "22 - 342" + getDecimalCharacter() + "33i";
String actual = (new ComplexFormat()).format(c);
Assert.assertEquals(expected, actual);
Locale.setDefault(defaultLocal);
}
@Test
public void testNan() {
Complex c = new Complex(Double.NaN, Double.NaN);
String expected = "(NaN) + (NaN)i";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testPositiveInfinity() {
Complex c = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
String expected = "(Infinity) + (Infinity)i";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testNegativeInfinity() {
Complex c = new Complex(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
String expected = "(-Infinity) - (Infinity)i";
String actual = complexFormat.format(c);
Assert.assertEquals(expected, actual);
}
@Test
public void testParseSimpleNoDecimals() {
String source = "1 + 1i";
Complex expected = new Complex(1, 1);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testParseSimpleWithDecimals() {
String source = "1" + getDecimalCharacter() + "23 + 1" + getDecimalCharacter() + "43i";
Complex expected = new Complex(1.23, 1.43);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testParseSimpleWithDecimalsTrunc() {
String source = "1" + getDecimalCharacter() + "2323 + 1" + getDecimalCharacter() + "4343i";
Complex expected = new Complex(1.2323, 1.4343);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testParseNegativeReal() {
String source = "-1" + getDecimalCharacter() + "2323 + 1" + getDecimalCharacter() + "4343i";
Complex expected = new Complex(-1.2323, 1.4343);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testParseNegativeImaginary() {
String source = "1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter() + "4343i";
Complex expected = new Complex(1.2323, -1.4343);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testParseNegativeBoth() {
String source = "-1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter() + "4343i";
Complex expected = new Complex(-1.2323, -1.4343);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testParseZeroReal() {
String source = "0" + getDecimalCharacter() + "0 - 1" + getDecimalCharacter() + "4343i";
Complex expected = new Complex(0.0, -1.4343);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testParseZeroImaginary() {
String source = "-1" + getDecimalCharacter() + "2323";
Complex expected = new Complex(-1.2323, 0);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testParseDifferentImaginaryChar() {
String source = "-1" + getDecimalCharacter() + "2323 - 1" + getDecimalCharacter() + "4343j";
Complex expected = new Complex(-1.2323, -1.4343);
Complex actual = complexFormatJ.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testParseNan() {
String source = "(NaN) + (NaN)i";
Complex expected = new Complex(Double.NaN, Double.NaN);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testParsePositiveInfinity() {
String source = "(Infinity) + (Infinity)i";
Complex expected = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testPaseNegativeInfinity() {
String source = "(-Infinity) - (Infinity)i";
Complex expected = new Complex(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
Complex actual = complexFormat.parse(source);
Assert.assertEquals(expected, actual);
}
@Test
public void testConstructorSingleFormat() {
NumberFormat nf = NumberFormat.getInstance();
ComplexFormat cf = new ComplexFormat(nf);
Assert.assertNotNull(cf);
Assert.assertEquals(nf, cf.getRealFormat());
}
@Test
public void testGetImaginaryFormat() {
NumberFormat nf = NumberFormat.getInstance();
ComplexFormat cf = new ComplexFormat(nf);
Assert.assertSame(nf, cf.getImaginaryFormat());
}
@Test
public void testGetRealFormat() {
NumberFormat nf = NumberFormat.getInstance();
ComplexFormat cf = new ComplexFormat(nf);
Assert.assertSame(nf, cf.getRealFormat());
}
@Test
public void testFormatNumber() {
ComplexFormat cf = ComplexFormat.getInstance(getLocale());
Double pi = Double.valueOf(FastMath.PI);
String text = cf.format(pi);
Assert.assertEquals("3" + getDecimalCharacter() + "14", text);
}
@Test
public void testForgottenImaginaryCharacter() {
ParsePosition pos = new ParsePosition(0);
Assert.assertNull(new ComplexFormat().parse("1 + 1", pos));
Assert.assertEquals(5, pos.getErrorIndex());
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html> <!-- -*- html -*- -->
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<title>Two Planes Intersecting</title>
<link rel="shortcut icon" href="img/gatech.gif"/>
<link rel="stylesheet" href="css/demo.css?vers=2759ff">
<style>
</style>
</head>
<body>
<script src="js/demo.js?vers=77646a"></script>
<script type="text/javascript">
"use strict";
DomReady.ready(function() {
var lineColor, plane1Color, plane2Color;
plane1Color = new Color("violet");
plane2Color = new Color("green");
lineColor = new Color("red");
new Demo({
camera: {
position: [-1.3, 3, 1.5]
}
}, function() {
var clipCube, subspace1, subspace2, subspace3, view;
window.mathbox = this.mathbox;
view = this.view();
clipCube = this.clipCube(view, {
draw: true
});
subspace1 = this.subspace({
vectors: [[-1, 1, 0], [-1, 0, 1]],
live: false,
name: "plane1",
color: plane1Color
});
subspace1.draw(clipCube.clipped.transform({
position: [1, 0, 0]
}));
subspace2 = this.subspace({
vectors: [[1, 0, 1], [0, 1, 0]],
live: false,
name: "plane2",
color: plane2Color
});
subspace2.draw(clipCube.clipped);
subspace3 = this.subspace({
vectors: [[1, -2, 1]],
color: lineColor,
lineOpts: {
opacity: 1.0,
width: 4,
zIndex: 3
},
name: "line",
live: false
});
subspace3.draw(clipCube.clipped.transform({
position: [0, 1, 0]
}));
this.caption('<p><span id="eqn1-here"></span><br><span id="eqn2-here"></span></p>');
katex.render("\\color{" + (plane1Color.str()) + "}{x+y+z=1}", document.getElementById('eqn1-here'));
return katex.render("\\color{" + (plane2Color.str()) + "}{x \\phantom{+} \\phantom{y} - z = 0}", document.getElementById('eqn2-here'));
});
});
</script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
const webpack = require('webpack');
module.exports = () => {
return webpack.version[0] !== '4';
};
| {
"pile_set_name": "Github"
} |
<?php
/**
* UserController
* PHP version 5
*
* @category Class
* @package OpenAPI\Server\Controller
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
/**
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*
*/
/**
* NOTE: This class is auto generated by the openapi generator program.
* https://github.com/openapitools/openapi-generator
* Do not edit the class manually.
*/
namespace OpenAPI\Server\Controller;
use \Exception;
use JMS\Serializer\Exception\RuntimeException as SerializerRuntimeException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\Validator\Constraints as Assert;
use OpenAPI\Server\Api\UserApiInterface;
use OpenAPI\Server\Model\User;
/**
* UserController Class Doc Comment
*
* @category Class
* @package OpenAPI\Server\Controller
* @author OpenAPI Generator team
* @link https://github.com/openapitools/openapi-generator
*/
class UserController extends Controller
{
/**
* Operation createUser
*
* Create user
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function createUserAction(Request $request)
{
// Make sure that the client is providing something that we can consume
$consumes = ['application/json'];
$inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0];
if (!in_array($inputFormat, $consumes)) {
// We can't consume the content that the client is sending us
return new Response('', 415);
}
// Handle authentication
// Authentication 'auth_cookie' required
// Set key with prefix in cookies
$securityauth_cookie = $request->cookies->get('AUTH_KEY');
// Read out all input parameter values into variables
$user = $request->getContent();
// Use the default value if no value was provided
// Deserialize the input values that needs it
try {
$user = $this->deserialize($user, 'OpenAPI\Server\Model\User', $inputFormat);
} catch (SerializerRuntimeException $exception) {
return $this->createBadRequestResponse($exception->getMessage());
}
// Validate the input values
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\Type("OpenAPI\Server\Model\User");
$asserts[] = new Assert\Valid();
$response = $this->validate($user, $asserts);
if ($response instanceof Response) {
return $response;
}
try {
$handler = $this->getApiHandler();
// Set authentication method 'auth_cookie'
$handler->setauth_cookie($securityauth_cookie);
// Make the call to the business logic
$responseCode = 204;
$responseHeaders = [];
$result = $handler->createUser($user, $responseCode, $responseHeaders);
// Find default response message
$message = 'successful operation';
// Find a more specific message, if available
switch ($responseCode) {
case 0:
$message = 'successful operation';
break;
}
return new Response(
'',
$responseCode,
array_merge(
$responseHeaders,
[
'X-OpenAPI-Message' => $message
]
)
);
} catch (Exception $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}
/**
* Operation createUsersWithArrayInput
*
* Creates list of users with given input array
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function createUsersWithArrayInputAction(Request $request)
{
// Make sure that the client is providing something that we can consume
$consumes = ['application/json'];
$inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0];
if (!in_array($inputFormat, $consumes)) {
// We can't consume the content that the client is sending us
return new Response('', 415);
}
// Handle authentication
// Authentication 'auth_cookie' required
// Set key with prefix in cookies
$securityauth_cookie = $request->cookies->get('AUTH_KEY');
// Read out all input parameter values into variables
$user = $request->getContent();
// Use the default value if no value was provided
// Deserialize the input values that needs it
try {
$user = $this->deserialize($user, 'array<OpenAPI\Server\Model\User>', $inputFormat);
} catch (SerializerRuntimeException $exception) {
return $this->createBadRequestResponse($exception->getMessage());
}
// Validate the input values
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\All([
new Assert\Type("OpenAPI\Server\Model\User"),
new Assert\Valid(),
]);
$response = $this->validate($user, $asserts);
if ($response instanceof Response) {
return $response;
}
try {
$handler = $this->getApiHandler();
// Set authentication method 'auth_cookie'
$handler->setauth_cookie($securityauth_cookie);
// Make the call to the business logic
$responseCode = 204;
$responseHeaders = [];
$result = $handler->createUsersWithArrayInput($user, $responseCode, $responseHeaders);
// Find default response message
$message = 'successful operation';
// Find a more specific message, if available
switch ($responseCode) {
case 0:
$message = 'successful operation';
break;
}
return new Response(
'',
$responseCode,
array_merge(
$responseHeaders,
[
'X-OpenAPI-Message' => $message
]
)
);
} catch (Exception $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}
/**
* Operation createUsersWithListInput
*
* Creates list of users with given input array
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function createUsersWithListInputAction(Request $request)
{
// Make sure that the client is providing something that we can consume
$consumes = ['application/json'];
$inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0];
if (!in_array($inputFormat, $consumes)) {
// We can't consume the content that the client is sending us
return new Response('', 415);
}
// Handle authentication
// Authentication 'auth_cookie' required
// Set key with prefix in cookies
$securityauth_cookie = $request->cookies->get('AUTH_KEY');
// Read out all input parameter values into variables
$user = $request->getContent();
// Use the default value if no value was provided
// Deserialize the input values that needs it
try {
$user = $this->deserialize($user, 'array<OpenAPI\Server\Model\User>', $inputFormat);
} catch (SerializerRuntimeException $exception) {
return $this->createBadRequestResponse($exception->getMessage());
}
// Validate the input values
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\All([
new Assert\Type("OpenAPI\Server\Model\User"),
new Assert\Valid(),
]);
$response = $this->validate($user, $asserts);
if ($response instanceof Response) {
return $response;
}
try {
$handler = $this->getApiHandler();
// Set authentication method 'auth_cookie'
$handler->setauth_cookie($securityauth_cookie);
// Make the call to the business logic
$responseCode = 204;
$responseHeaders = [];
$result = $handler->createUsersWithListInput($user, $responseCode, $responseHeaders);
// Find default response message
$message = 'successful operation';
// Find a more specific message, if available
switch ($responseCode) {
case 0:
$message = 'successful operation';
break;
}
return new Response(
'',
$responseCode,
array_merge(
$responseHeaders,
[
'X-OpenAPI-Message' => $message
]
)
);
} catch (Exception $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}
/**
* Operation deleteUser
*
* Delete user
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function deleteUserAction(Request $request, $username)
{
// Handle authentication
// Authentication 'auth_cookie' required
// Set key with prefix in cookies
$securityauth_cookie = $request->cookies->get('AUTH_KEY');
// Read out all input parameter values into variables
// Use the default value if no value was provided
// Deserialize the input values that needs it
try {
$username = $this->deserialize($username, 'string', 'string');
} catch (SerializerRuntimeException $exception) {
return $this->createBadRequestResponse($exception->getMessage());
}
// Validate the input values
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\Type("string");
$response = $this->validate($username, $asserts);
if ($response instanceof Response) {
return $response;
}
try {
$handler = $this->getApiHandler();
// Set authentication method 'auth_cookie'
$handler->setauth_cookie($securityauth_cookie);
// Make the call to the business logic
$responseCode = 204;
$responseHeaders = [];
$result = $handler->deleteUser($username, $responseCode, $responseHeaders);
// Find default response message
$message = '';
// Find a more specific message, if available
switch ($responseCode) {
case 400:
$message = 'Invalid username supplied';
break;
case 404:
$message = 'User not found';
break;
}
return new Response(
'',
$responseCode,
array_merge(
$responseHeaders,
[
'X-OpenAPI-Message' => $message
]
)
);
} catch (Exception $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}
/**
* Operation getUserByName
*
* Get user by user name
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function getUserByNameAction(Request $request, $username)
{
// Figure out what data format to return to the client
$produces = ['application/xml', 'application/json'];
// Figure out what the client accepts
$clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*';
$responseFormat = $this->getOutputFormat($clientAccepts, $produces);
if ($responseFormat === null) {
return new Response('', 406);
}
// Handle authentication
// Read out all input parameter values into variables
// Use the default value if no value was provided
// Deserialize the input values that needs it
try {
$username = $this->deserialize($username, 'string', 'string');
} catch (SerializerRuntimeException $exception) {
return $this->createBadRequestResponse($exception->getMessage());
}
// Validate the input values
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\Type("string");
$response = $this->validate($username, $asserts);
if ($response instanceof Response) {
return $response;
}
try {
$handler = $this->getApiHandler();
// Make the call to the business logic
$responseCode = 200;
$responseHeaders = [];
$result = $handler->getUserByName($username, $responseCode, $responseHeaders);
// Find default response message
$message = 'successful operation';
// Find a more specific message, if available
switch ($responseCode) {
case 200:
$message = 'successful operation';
break;
case 400:
$message = 'Invalid username supplied';
break;
case 404:
$message = 'User not found';
break;
}
return new Response(
$result !== null ?$this->serialize($result, $responseFormat):'',
$responseCode,
array_merge(
$responseHeaders,
[
'Content-Type' => $responseFormat,
'X-OpenAPI-Message' => $message
]
)
);
} catch (Exception $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}
/**
* Operation loginUser
*
* Logs user into the system
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function loginUserAction(Request $request)
{
// Figure out what data format to return to the client
$produces = ['application/xml', 'application/json'];
// Figure out what the client accepts
$clientAccepts = $request->headers->has('Accept')?$request->headers->get('Accept'):'*/*';
$responseFormat = $this->getOutputFormat($clientAccepts, $produces);
if ($responseFormat === null) {
return new Response('', 406);
}
// Handle authentication
// Read out all input parameter values into variables
$username = $request->query->get('username');
$password = $request->query->get('password');
// Use the default value if no value was provided
// Deserialize the input values that needs it
try {
$username = $this->deserialize($username, 'string', 'string');
$password = $this->deserialize($password, 'string', 'string');
} catch (SerializerRuntimeException $exception) {
return $this->createBadRequestResponse($exception->getMessage());
}
// Validate the input values
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\Type("string");
$asserts[] = new Assert\Regex("/^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$/");
$response = $this->validate($username, $asserts);
if ($response instanceof Response) {
return $response;
}
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\Type("string");
$response = $this->validate($password, $asserts);
if ($response instanceof Response) {
return $response;
}
try {
$handler = $this->getApiHandler();
// Make the call to the business logic
$responseCode = 200;
$responseHeaders = [];
$result = $handler->loginUser($username, $password, $responseCode, $responseHeaders);
// Find default response message
$message = 'successful operation';
// Find a more specific message, if available
switch ($responseCode) {
case 200:
$message = 'successful operation';
break;
case 400:
$message = 'Invalid username/password supplied';
break;
}
return new Response(
$result !== null ?$this->serialize($result, $responseFormat):'',
$responseCode,
array_merge(
$responseHeaders,
[
'Content-Type' => $responseFormat,
'X-OpenAPI-Message' => $message
]
)
);
} catch (Exception $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}
/**
* Operation logoutUser
*
* Logs out current logged in user session
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function logoutUserAction(Request $request)
{
// Handle authentication
// Authentication 'auth_cookie' required
// Set key with prefix in cookies
$securityauth_cookie = $request->cookies->get('AUTH_KEY');
// Read out all input parameter values into variables
// Use the default value if no value was provided
// Validate the input values
try {
$handler = $this->getApiHandler();
// Set authentication method 'auth_cookie'
$handler->setauth_cookie($securityauth_cookie);
// Make the call to the business logic
$responseCode = 204;
$responseHeaders = [];
$result = $handler->logoutUser($responseCode, $responseHeaders);
// Find default response message
$message = 'successful operation';
// Find a more specific message, if available
switch ($responseCode) {
case 0:
$message = 'successful operation';
break;
}
return new Response(
'',
$responseCode,
array_merge(
$responseHeaders,
[
'X-OpenAPI-Message' => $message
]
)
);
} catch (Exception $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}
/**
* Operation updateUser
*
* Updated user
*
* @param Request $request The Symfony request to handle.
* @return Response The Symfony response.
*/
public function updateUserAction(Request $request, $username)
{
// Make sure that the client is providing something that we can consume
$consumes = ['application/json'];
$inputFormat = $request->headers->has('Content-Type')?$request->headers->get('Content-Type'):$consumes[0];
if (!in_array($inputFormat, $consumes)) {
// We can't consume the content that the client is sending us
return new Response('', 415);
}
// Handle authentication
// Authentication 'auth_cookie' required
// Set key with prefix in cookies
$securityauth_cookie = $request->cookies->get('AUTH_KEY');
// Read out all input parameter values into variables
$user = $request->getContent();
// Use the default value if no value was provided
// Deserialize the input values that needs it
try {
$username = $this->deserialize($username, 'string', 'string');
$user = $this->deserialize($user, 'OpenAPI\Server\Model\User', $inputFormat);
} catch (SerializerRuntimeException $exception) {
return $this->createBadRequestResponse($exception->getMessage());
}
// Validate the input values
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\Type("string");
$response = $this->validate($username, $asserts);
if ($response instanceof Response) {
return $response;
}
$asserts = [];
$asserts[] = new Assert\NotNull();
$asserts[] = new Assert\Type("OpenAPI\Server\Model\User");
$asserts[] = new Assert\Valid();
$response = $this->validate($user, $asserts);
if ($response instanceof Response) {
return $response;
}
try {
$handler = $this->getApiHandler();
// Set authentication method 'auth_cookie'
$handler->setauth_cookie($securityauth_cookie);
// Make the call to the business logic
$responseCode = 204;
$responseHeaders = [];
$result = $handler->updateUser($username, $user, $responseCode, $responseHeaders);
// Find default response message
$message = '';
// Find a more specific message, if available
switch ($responseCode) {
case 400:
$message = 'Invalid user supplied';
break;
case 404:
$message = 'User not found';
break;
}
return new Response(
'',
$responseCode,
array_merge(
$responseHeaders,
[
'X-OpenAPI-Message' => $message
]
)
);
} catch (Exception $fallthrough) {
return $this->createErrorResponse(new HttpException(500, 'An unsuspected error occurred.', $fallthrough));
}
}
/**
* Returns the handler for this API controller.
* @return UserApiInterface
*/
public function getApiHandler()
{
return $this->apiServer->getApiHandler('user');
}
}
| {
"pile_set_name": "Github"
} |
import test from 'ava'
import sinon from 'sinon'
import when from '../when'
test('when() merges correctly', t => {
const whenBlock = when(true, [entryPoint1(), entryPoint2()])
t.deepEqual(whenBlock(null, {})({}), {
entry: {
foo: './src/foo',
bar: './src/bar'
}
})
})
test('when() respects the condition', t => {
const whenBlock = when(false, [entryPoint1(), entryPoint2()])
const emptyConfig = { entry: {} }
t.deepEqual(whenBlock(null, {})(emptyConfig), emptyConfig)
})
test('when() block passes complete config to child blocks', t => {
const spyBlock1 = sinon.spy(() => prevConfig => ({
...prevConfig,
entry: {
...prevConfig.entry,
foo: 'foo'
}
}))
const spyBlock2 = sinon.spy(() => prevConfig => prevConfig)
const whenBlock = when(true, [spyBlock1, spyBlock2])
const createdConfig = whenBlock({}, {})({
entry: { baz: 'baz' }
})
t.is(spyBlock1.callCount, 1)
t.is(spyBlock2.callCount, 1)
t.deepEqual(createdConfig, {
entry: {
baz: 'baz',
foo: 'foo'
}
})
})
function entryPoint1() {
return () => prevConfig => ({
...prevConfig,
entry: {
...prevConfig.entry,
foo: './src/foo'
}
})
}
function entryPoint2() {
return () => prevConfig => ({
...prevConfig,
entry: {
...prevConfig.entry,
bar: './src/bar'
}
})
}
| {
"pile_set_name": "Github"
} |
import os
import requests
from xml.etree import ElementTree as ET
URL_BASE = 'http://lirc.sourceforge.net/remotes/'
def get_base():
'''
Returns a list of subpages for remotes
'''
r = requests.get(URL_BASE)
t = r.text
return [ x[:x.index('/"')] for x in t.split('<a href="') if '/"' in x]
def get_subpages(stub):
'''
Returns a dictionary of conf files (keys) found in the sub-menu along with images (values) if there are any
'''
ignore_chars = ['/', '?']
image_chars = ['.jpg', '.png']
confs = {}
images = []
subs = []
r = requests.get(URL_BASE)
t = r.text
# create a list of links from the sub page
subs_raw = [ x[:x.index('"')] for x in t.split('<a href="') if '"' in x ]
# remove the links with those specific characters
for sub in subs_raw:
for ig in ignore_chars:
if ig in sub:
break
else:
subs.append(sub)
# add the confs to the confs dict and push the images off to the images list
for sub in subs:
for img in image_chars:
if img in sub:
images.append(sub)
break
else:
confs[sub] = None
# cycle through the images and match them to the conf of the same name
for image in images:
cnf = image.replace('.png','').replace('.jpg')
if cnf in confs:
confs[cnf] = image
return confs
def download_file(stub, itm):
r = requests.get(URL_BASE + stub + '/' + itm)
with open("code3.zip", "wb") as f:
f.write(r.content)
return local_filename | {
"pile_set_name": "Github"
} |
'use strict';
angular.module("ngLocale", [], ["$provide", function($provide) {
var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
$provide.value("$locale", {
"DATETIME_FORMATS": {
"AMPMS": [
"AM",
"PM"
],
"DAY": [
"dimanche",
"lundi",
"mardi",
"mercredi",
"jeudi",
"vendredi",
"samedi"
],
"ERANAMES": [
"avant J\u00e9sus-Christ",
"apr\u00e8s J\u00e9sus-Christ"
],
"ERAS": [
"av. J.-C.",
"ap. J.-C."
],
"FIRSTDAYOFWEEK": 0,
"MONTH": [
"janvier",
"f\u00e9vrier",
"mars",
"avril",
"mai",
"juin",
"juillet",
"ao\u00fbt",
"septembre",
"octobre",
"novembre",
"d\u00e9cembre"
],
"SHORTDAY": [
"dim.",
"lun.",
"mar.",
"mer.",
"jeu.",
"ven.",
"sam."
],
"SHORTMONTH": [
"janv.",
"f\u00e9vr.",
"mars",
"avr.",
"mai",
"juin",
"juil.",
"ao\u00fbt",
"sept.",
"oct.",
"nov.",
"d\u00e9c."
],
"STANDALONEMONTH": [
"janvier",
"f\u00e9vrier",
"mars",
"avril",
"mai",
"juin",
"juillet",
"ao\u00fbt",
"septembre",
"octobre",
"novembre",
"d\u00e9cembre"
],
"WEEKENDRANGE": [
5,
6
],
"fullDate": "EEEE d MMMM y",
"longDate": "d MMMM y",
"medium": "d MMM y HH:mm:ss",
"mediumDate": "d MMM y",
"mediumTime": "HH:mm:ss",
"short": "dd/MM/y HH:mm",
"shortDate": "dd/MM/y",
"shortTime": "HH:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "CFA",
"DECIMAL_SEP": ",",
"GROUP_SEP": "\u00a0",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "-",
"negSuf": "\u00a0\u00a4",
"posPre": "",
"posSuf": "\u00a0\u00a4"
}
]
},
"id": "fr-tg",
"localeID": "fr_TG",
"pluralCat": function(n, opt_precision) { var i = n | 0; if (i == 0 || i == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]);
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
<title>Method List</title>
<base id="base_target" target="_parent" />
</head>
<body>
<div id="content">
<div class="fixed_header">
<h1 id="full_list_header">Method List</h1>
<div id="full_list_nav">
<span><a target="_self" href="class_list.html">
Classes
</a></span>
<span><a target="_self" href="method_list.html">
Methods
</a></span>
<span><a target="_self" href="file_list.html">
Files
</a></span>
</div>
<div id="search">Search: <input type="text" /></div>
</div>
<ul id="full_list" class="method">
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/State.html#==-instance_method" title="Ovto::State#== (method)">#==</a></span>
<small>Ovto::State</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto.html#Middleware-class_method" title="Ovto.Middleware (method)">Middleware</a></span>
<small>Ovto</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/State.html#[]-instance_method" title="Ovto::State#[] (method)">#[]</a></span>
<small>Ovto::State</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/WiredActionSet.html#[]-instance_method" title="Ovto::WiredActionSet#[] (method)">#[]</a></span>
<small>Ovto::WiredActionSet</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/WiredActions.html#_app-instance_method" title="Ovto::WiredActions#_app (method)">#_app</a></span>
<small>Ovto::WiredActions</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto.html#_do_fetch-class_method" title="Ovto._do_fetch (method)">_do_fetch</a></span>
<small>Ovto</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Base.html#_run_setup-class_method" title="Ovto::Middleware::Base._run_setup (method)">_run_setup</a></span>
<small>Ovto::Middleware::Base</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/App.html#_set_state-instance_method" title="Ovto::App#_set_state (method)">#_set_state</a></span>
<small>Ovto::App</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Actions.html#actions-instance_method" title="Ovto::Actions#actions (method)">#actions</a></span>
<small>Ovto::Actions</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Base.html#actions-instance_method" title="Ovto::Middleware::Base#actions (method)">#actions</a></span>
<small>Ovto::Middleware::Base</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/App.html#actions-instance_method" title="Ovto::App#actions (method)">#actions</a></span>
<small>Ovto::App</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/WiredActionSet.html#app-instance_method" title="Ovto::WiredActionSet#app (method)">#app</a></span>
<small>Ovto::WiredActionSet</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/WiredActionSet.html#app_wired_actions-instance_method" title="Ovto::WiredActionSet#app_wired_actions (method)">#app_wired_actions</a></span>
<small>Ovto::WiredActionSet</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="top-level-namespace.html#console-instance_method" title="#console (method)">#console</a></span>
<small>Top Level Namespace</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware.html#create_middleware_states_class-class_method" title="Ovto::Middleware.create_middleware_states_class (method)">create_middleware_states_class</a></span>
<small>Ovto::Middleware</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto.html#debug_trace-class_method" title="Ovto.debug_trace (method)">debug_trace</a></span>
<small>Ovto</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto.html#debug_trace=-class_method" title="Ovto.debug_trace= (method)">debug_trace=</a></span>
<small>Ovto</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto.html#debug_trace_log-class_method" title="Ovto.debug_trace_log (method)">debug_trace_log</a></span>
<small>Ovto</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware.html#dig_middleware_state-class_method" title="Ovto::Middleware.dig_middleware_state (method)">dig_middleware_state</a></span>
<small>Ovto::Middleware</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/PureComponent.html#do_render-instance_method" title="Ovto::PureComponent#do_render (method)">#do_render</a></span>
<small>Ovto::PureComponent</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/WiredActionSet.html#dummy-class_method" title="Ovto::WiredActionSet.dummy (method)">dummy</a></span>
<small>Ovto::WiredActionSet</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto.html#fetch-class_method" title="Ovto.fetch (method)">fetch</a></span>
<small>Ovto</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Component.html#hash_to_js_obj-class_method" title="Ovto::Component.hash_to_js_obj (method)">hash_to_js_obj</a></span>
<small>Ovto::Component</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/State.html#inherited-class_method" title="Ovto::State.inherited (method)">inherited</a></span>
<small>Ovto::State</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Component.html#initialize-instance_method" title="Ovto::Component#initialize (method)">#initialize</a></span>
<small>Ovto::Component</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/WiredActionSet.html#initialize-instance_method" title="Ovto::WiredActionSet#initialize (method)">#initialize</a></span>
<small>Ovto::WiredActionSet</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/State.html#initialize-instance_method" title="Ovto::State#initialize (method)">#initialize</a></span>
<small>Ovto::State</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/App.html#initialize-instance_method" title="Ovto::App#initialize (method)">#initialize</a></span>
<small>Ovto::App</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/PureComponent.html#initialize-instance_method" title="Ovto::PureComponent#initialize (method)">#initialize</a></span>
<small>Ovto::PureComponent</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/WiredActions.html#initialize-instance_method" title="Ovto::WiredActions#initialize (method)">#initialize</a></span>
<small>Ovto::WiredActions</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Actions.html#initialize-instance_method" title="Ovto::Middleware::Actions#initialize (method)">#initialize</a></span>
<small>Ovto::Middleware::Actions</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Base.html#initialize-instance_method" title="Ovto::Middleware::Base#initialize (method)">#initialize</a></span>
<small>Ovto::Middleware::Base</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Runtime.html#initialize-instance_method" title="Ovto::Runtime#initialize (method)">#initialize</a></span>
<small>Ovto::Runtime</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto.html#inspect-class_method" title="Ovto.inspect (method)">inspect</a></span>
<small>Ovto</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/State.html#inspect-instance_method" title="Ovto::State#inspect (method)">#inspect</a></span>
<small>Ovto::State</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/State.html#item-class_method" title="Ovto::State.item (method)">item</a></span>
<small>Ovto::State</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/State.html#item_specs-class_method" title="Ovto::State.item_specs (method)">item_specs</a></span>
<small>Ovto::State</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto.html#log_error-class_method" title="Ovto.log_error (method)">log_error</a></span>
<small>Ovto</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/App.html#main_component-instance_method" title="Ovto::App#main_component (method)">#main_component</a></span>
<small>Ovto::App</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/State.html#merge-instance_method" title="Ovto::State#merge (method)">#merge</a></span>
<small>Ovto::State</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/WiredActions.html#method_missing-instance_method" title="Ovto::WiredActions#method_missing (method)">#method_missing</a></span>
<small>Ovto::WiredActions</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Actions.html#middleware_name-instance_method" title="Ovto::Middleware::Actions#middleware_name (method)">#middleware_name</a></span>
<small>Ovto::Middleware::Actions</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Actions.html#middleware_name-instance_method" title="Ovto::Actions#middleware_name (method)">#middleware_name</a></span>
<small>Ovto::Actions</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/Component.html#middleware_name-class_method" title="Ovto::Component.middleware_name (method)">middleware_name</a></span>
<small>Ovto::Component</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Component.html#middleware_name-instance_method" title="Ovto::Middleware::Component#middleware_name (method)">#middleware_name</a></span>
<small>Ovto::Middleware::Component</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Component.html#middleware_name-class_method" title="Ovto::Middleware::Component.middleware_name (method)">middleware_name</a></span>
<small>Ovto::Middleware::Component</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/WiredActionSet.html#middleware_names-instance_method" title="Ovto::WiredActionSet#middleware_names (method)">#middleware_names</a></span>
<small>Ovto::WiredActionSet</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Actions.html#middleware_path-instance_method" title="Ovto::Middleware::Actions#middleware_path (method)">#middleware_path</a></span>
<small>Ovto::Middleware::Actions</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Actions.html#middleware_path-instance_method" title="Ovto::Actions#middleware_path (method)">#middleware_path</a></span>
<small>Ovto::Actions</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Base.html#middlewares-class_method" title="Ovto::Middleware::Base.middlewares (method)">middlewares</a></span>
<small>Ovto::Middleware::Base</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/App.html#middlewares-class_method" title="Ovto::App.middlewares (method)">middlewares</a></span>
<small>Ovto::App</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="MightyInspect.html#mighty_inspect-class_method" title="MightyInspect.mighty_inspect (method)">mighty_inspect</a></span>
<small>MightyInspect</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Array.html#mighty_inspect-instance_method" title="Array#mighty_inspect (method)">#mighty_inspect</a></span>
<small>Array</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Hash.html#mighty_inspect-instance_method" title="Hash#mighty_inspect (method)">#mighty_inspect</a></span>
<small>Hash</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Base.html#name-class_method" title="Ovto::Middleware::Base.name (method)">name</a></span>
<small>Ovto::Middleware::Base</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="MightyInspect.html#p-class_method" title="MightyInspect.p (method)">p</a></span>
<small>MightyInspect</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Component.html#render-instance_method" title="Ovto::Component#render (method)">#render</a></span>
<small>Ovto::Component</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/WiredActions.html#respond_to%3F-instance_method" title="Ovto::WiredActions#respond_to? (method)">#respond_to?</a></span>
<small>Ovto::WiredActions</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/App.html#run-instance_method" title="Ovto::App#run (method)">#run</a></span>
<small>Ovto::App</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/Runtime.html#run-instance_method" title="Ovto::Runtime#run (method)">#run</a></span>
<small>Ovto::Runtime</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/App.html#run-class_method" title="Ovto::App.run (method)">run</a></span>
<small>Ovto::App</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/Runtime.html#scheduleRender-instance_method" title="Ovto::Runtime#scheduleRender (method)">#scheduleRender</a></span>
<small>Ovto::Runtime</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto.html#send_args_with_state-class_method" title="Ovto.send_args_with_state (method)">send_args_with_state</a></span>
<small>Ovto</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/App.html#setup-instance_method" title="Ovto::App#setup (method)">#setup</a></span>
<small>Ovto::App</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Base.html#setup-instance_method" title="Ovto::Middleware::Base#setup (method)">#setup</a></span>
<small>Ovto::Middleware::Base</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/PureComponent.html#state-instance_method" title="Ovto::PureComponent#state (method)">#state</a></span>
<small>Ovto::PureComponent</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Component.html#state-instance_method" title="Ovto::Component#state (method)">#state</a></span>
<small>Ovto::Component</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Actions.html#state-instance_method" title="Ovto::Middleware::Actions#state (method)">#state</a></span>
<small>Ovto::Middleware::Actions</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Component.html#state-instance_method" title="Ovto::Middleware::Component#state (method)">#state</a></span>
<small>Ovto::Middleware::Component</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/App.html#state-instance_method" title="Ovto::App#state (method)">#state</a></span>
<small>Ovto::App</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Actions.html#state-instance_method" title="Ovto::Actions#state (method)">#state</a></span>
<small>Ovto::Actions</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/State.html#to_h-instance_method" title="Ovto::State#to_h (method)">#to_h</a></span>
<small>Ovto::State</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/Middleware/Base.html#use-class_method" title="Ovto::Middleware::Base.use (method)">use</a></span>
<small>Ovto::Middleware::Base</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Ovto/App.html#use-class_method" title="Ovto::App.use (method)">use</a></span>
<small>Ovto::App</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Ovto/State.html#values-instance_method" title="Ovto::State#values (method)">#values</a></span>
<small>Ovto::State</small>
</div>
</li>
</ul>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<?php
namespace plastic\tests\Persistence;
use Illuminate\Database\Eloquent\Model;
use Sleimanx2\Plastic\Connection;
use Sleimanx2\Plastic\Persistence\EloquentPersistence;
use Sleimanx2\Plastic\Searchable;
class EloquentPersistenceTest extends \PHPUnit_Framework_TestCase
{
/**
* @test
*/
public function it_saves_a_model_document_data()
{
$connection = \Mockery::mock(Connection::class);
$model = new PersistenceModelTest();
$model->exists = true;
$connection->shouldReceive('indexStatement')->once()->with([
'id' => null,
'type' => 'foo',
'index' => 'bar',
'body' => ['foo' => 'bar'],
]);
$persistence = new EloquentPersistence($connection);
$persistence->model($model);
$persistence->save();
}
/**
* @test
*/
public function it_throw_an_exception_if_trying_to_save_a_model_with_exits_false()
{
$connection = \Mockery::mock(Connection::class);
$model = new PersistenceModelTest();
$model->exists = false;
$this->setExpectedException('Exception');
$persistence = new EloquentPersistence($connection);
$persistence->model($model);
$persistence->save();
}
/**
* @test
*/
public function it_updates_a_model_document_data()
{
$connection = \Mockery::mock(Connection::class);
$model = new PersistenceModelTest();
$model->exists = true;
$connection->shouldReceive('updateStatement')->once()->with([
'id' => null,
'type' => 'foo',
'index' => 'bar',
'body' => ['doc' => ['foo' => 'bar']],
]);
$persistence = new EloquentPersistence($connection);
$persistence->model($model);
$persistence->update();
}
/**
* @test
*/
public function it_throw_an_exception_if_trying_to_update_a_model_with_exits_false()
{
$connection = \Mockery::mock(Connection::class);
$model = new PersistenceModelTest();
$model->exists = false;
$this->setExpectedException('Exception');
$persistence = new EloquentPersistence($connection);
$persistence->model($model);
$persistence->update();
}
/**
* @test
*/
public function it_deletes_a_model_document_data()
{
$connection = \Mockery::mock(Connection::class);
$model = new PersistenceModelTest();
$model->exists = true;
$connection->shouldReceive('existsStatement')->once()->with([
'id' => null,
'type' => 'foo',
'index' => 'bar',
])->andReturn(true);
$connection->shouldReceive('deleteStatement')->once()->with([
'id' => null,
'type' => 'foo',
'index' => 'bar',
]);
$persistence = new EloquentPersistence($connection);
$persistence->model($model);
$persistence->delete();
}
/**
* @test
*/
public function it_dosent_execute_a_delete_statement_if_model_document_not_indexed()
{
$connection = \Mockery::mock(Connection::class);
$model = new PersistenceModelTest();
$model->exists = true;
$connection->shouldReceive('existsStatement')->once()->with([
'id' => null,
'type' => 'foo',
'index' => 'bar',
])->andReturn(false);
$connection->shouldNotReceive('deleteStatement');
$persistence = new EloquentPersistence($connection);
$persistence->model($model);
$persistence->delete();
}
/**
* @test
*/
public function it_saves_models_data_in_bulk()
{
$connection = \Mockery::mock(Connection::class);
$connection->shouldReceive('getDefaultIndex')->once()->andReturn('plastic');
$model1 = new PersistenceModelTest();
$model2 = new PersistenceModelTest();
$collection = [$model1, $model2];
$connection->shouldReceive('bulkStatement')->once()->with([
'body' => [
[
'index' => [
'_id' => null,
'_type' => 'foo',
'_index' => 'bar',
],
],
['foo' => 'bar'],
[
'index' => [
'_id' => null,
'_type' => 'foo',
'_index' => 'bar',
],
],
['foo' => 'bar'],
],
]);
$persistence = new EloquentPersistence($connection);
$persistence->bulkSave($collection);
}
/**
* @test
*/
public function it_deletes_models_data_in_bulk()
{
$connection = \Mockery::mock(Connection::class);
$connection->shouldReceive('getDefaultIndex')->once()->andReturn('plastic');
$model1 = new PersistenceModelTest();
$model2 = new PersistenceModelTest();
$collection = [$model1, $model2];
$connection->shouldReceive('bulkStatement')->once()->with([
'body' => [
[
'delete' => [
'_id' => null,
'_type' => 'foo',
'_index' => 'bar',
],
],
[
'delete' => [
'_id' => null,
'_type' => 'foo',
'_index' => 'bar',
],
],
],
]);
$persistence = new EloquentPersistence($connection);
$persistence->bulkDelete($collection);
}
/**
* @test
*/
public function it_reindex_an_array_of_models_in_bulk()
{
$connection = \Mockery::mock(Connection::class);
$persistence = \Mockery::mock(EloquentPersistence::class, [$connection])->makePartial();
$persistence->shouldReceive('bulkDelete')->once();
$persistence->shouldReceive('bulkSave')->once();
$persistence->reindex([]);
}
}
class PersistenceModelTest extends Model
{
use Searchable;
public $documentType = 'foo';
public $documentIndex = 'bar';
public function buildDocument()
{
return [
'foo' => 'bar',
];
}
}
| {
"pile_set_name": "Github"
} |
/* Copyright (C) 2006-2008 CSIRO, Jean-Marc Valin, Xiph.Org Foundation
File: scal.c
Shaped comb-allpass filter for channel decorrelation
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. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*
The algorithm implemented here is described in:
* J.-M. Valin, Perceptually-Motivated Nonlinear Channel Decorrelation For
Stereo Acoustic Echo Cancellation, Accepted for Joint Workshop on
Handsfree Speech Communication and Microphone Arrays (HSCMA), 2008.
http://people.xiph.org/~jm/papers/valin_hscma2008.pdf
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "speex/speex_echo.h"
#include "vorbis_psy.h"
#include "arch.h"
#include "os_support.h"
#include "smallft.h"
#include <math.h>
#include <stdlib.h>
#define ALLPASS_ORDER 20
struct SpeexDecorrState_ {
int rate;
int channels;
int frame_size;
#ifdef VORBIS_PSYCHO
VorbisPsy *psy;
struct drft_lookup lookup;
float *wola_mem;
float *curve;
#endif
float *vorbis_win;
int seed;
float *y;
/* Per-channel stuff */
float *buff;
float (*ring)[ALLPASS_ORDER];
int *ringID;
int *order;
float *alpha;
};
EXPORT SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size)
{
int i, ch;
SpeexDecorrState *st = speex_alloc(sizeof(SpeexDecorrState));
st->rate = rate;
st->channels = channels;
st->frame_size = frame_size;
#ifdef VORBIS_PSYCHO
st->psy = vorbis_psy_init(rate, 2*frame_size);
spx_drft_init(&st->lookup, 2*frame_size);
st->wola_mem = speex_alloc(frame_size*sizeof(float));
st->curve = speex_alloc(frame_size*sizeof(float));
#endif
st->y = speex_alloc(frame_size*sizeof(float));
st->buff = speex_alloc(channels*2*frame_size*sizeof(float));
st->ringID = speex_alloc(channels*sizeof(int));
st->order = speex_alloc(channels*sizeof(int));
st->alpha = speex_alloc(channels*sizeof(float));
st->ring = speex_alloc(channels*ALLPASS_ORDER*sizeof(float));
/*FIXME: The +20 is there only as a kludge for ALL_PASS_OLA*/
st->vorbis_win = speex_alloc((2*frame_size+20)*sizeof(float));
for (i=0;i<2*frame_size;i++)
st->vorbis_win[i] = sin(.5*M_PI* sin(M_PI*i/(2*frame_size))*sin(M_PI*i/(2*frame_size)) );
st->seed = rand();
for (ch=0;ch<channels;ch++)
{
for (i=0;i<ALLPASS_ORDER;i++)
st->ring[ch][i] = 0;
st->ringID[ch] = 0;
st->alpha[ch] = 0;
st->order[ch] = 10;
}
return st;
}
static float uni_rand(int *seed)
{
const unsigned int jflone = 0x3f800000;
const unsigned int jflmsk = 0x007fffff;
union {int i; float f;} ran;
*seed = 1664525 * *seed + 1013904223;
ran.i = jflone | (jflmsk & *seed);
ran.f -= 1.5;
return 2*ran.f;
}
static unsigned int irand(int *seed)
{
*seed = 1664525 * *seed + 1013904223;
return ((unsigned int)*seed)>>16;
}
EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength)
{
int ch;
float amount;
if (strength<0)
strength = 0;
if (strength>100)
strength = 100;
amount = .01*strength;
for (ch=0;ch<st->channels;ch++)
{
int i;
int N=2*st->frame_size;
float beta, beta2;
float *x;
float max_alpha = 0;
float *buff;
float *ring;
int ringID;
int order;
float alpha;
buff = st->buff+ch*2*st->frame_size;
ring = st->ring[ch];
ringID = st->ringID[ch];
order = st->order[ch];
alpha = st->alpha[ch];
for (i=0;i<st->frame_size;i++)
buff[i] = buff[i+st->frame_size];
for (i=0;i<st->frame_size;i++)
buff[i+st->frame_size] = in[i*st->channels+ch];
x = buff+st->frame_size;
beta = 1.-.3*amount*amount;
if (amount>1)
beta = 1-sqrt(.4*amount);
else
beta = 1-0.63246*amount;
if (beta<0)
beta = 0;
beta2 = beta;
for (i=0;i<st->frame_size;i++)
{
st->y[i] = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[st->frame_size+i+order]
+ x[i-ALLPASS_ORDER]*st->vorbis_win[st->frame_size+i]
- alpha*(ring[ringID]
- beta*ring[ringID+1>=order?0:ringID+1]);
ring[ringID++]=st->y[i];
st->y[i] *= st->vorbis_win[st->frame_size+i];
if (ringID>=order)
ringID=0;
}
order = order+(irand(&st->seed)%3)-1;
if (order < 5)
order = 5;
if (order > 10)
order = 10;
/*order = 5+(irand(&st->seed)%6);*/
max_alpha = pow(.96+.04*(amount-1),order);
if (max_alpha > .98/(1.+beta2))
max_alpha = .98/(1.+beta2);
alpha = alpha + .4*uni_rand(&st->seed);
if (alpha > max_alpha)
alpha = max_alpha;
if (alpha < -max_alpha)
alpha = -max_alpha;
for (i=0;i<ALLPASS_ORDER;i++)
ring[i] = 0;
ringID = 0;
for (i=0;i<st->frame_size;i++)
{
float tmp = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[i+order]
+ x[i-ALLPASS_ORDER]*st->vorbis_win[i]
- alpha*(ring[ringID]
- beta*ring[ringID+1>=order?0:ringID+1]);
ring[ringID++]=tmp;
tmp *= st->vorbis_win[i];
if (ringID>=order)
ringID=0;
st->y[i] += tmp;
}
#ifdef VORBIS_PSYCHO
float frame[N];
float scale = 1./N;
for (i=0;i<2*st->frame_size;i++)
frame[i] = buff[i];
//float coef = .5*0.78130;
float coef = M_PI*0.075063 * 0.93763 * amount * .8 * 0.707;
compute_curve(st->psy, buff, st->curve);
for (i=1;i<st->frame_size;i++)
{
float x1,x2;
float gain;
do {
x1 = uni_rand(&st->seed);
x2 = uni_rand(&st->seed);
} while (x1*x1+x2*x2 > 1.);
gain = coef*sqrt(.1+st->curve[i]);
frame[2*i-1] = gain*x1;
frame[2*i] = gain*x2;
}
frame[0] = coef*uni_rand(&st->seed)*sqrt(.1+st->curve[0]);
frame[2*st->frame_size-1] = coef*uni_rand(&st->seed)*sqrt(.1+st->curve[st->frame_size-1]);
spx_drft_backward(&st->lookup,frame);
for (i=0;i<2*st->frame_size;i++)
frame[i] *= st->vorbis_win[i];
#endif
for (i=0;i<st->frame_size;i++)
{
#ifdef VORBIS_PSYCHO
float tmp = st->y[i] + frame[i] + st->wola_mem[i];
st->wola_mem[i] = frame[i+st->frame_size];
#else
float tmp = st->y[i];
#endif
if (tmp>32767)
tmp = 32767;
if (tmp < -32767)
tmp = -32767;
out[i*st->channels+ch] = tmp;
}
st->ringID[ch] = ringID;
st->order[ch] = order;
st->alpha[ch] = alpha;
}
}
EXPORT void speex_decorrelate_destroy(SpeexDecorrState *st)
{
#ifdef VORBIS_PSYCHO
vorbis_psy_destroy(st->psy);
speex_free(st->wola_mem);
speex_free(st->curve);
#endif
speex_free(st->buff);
speex_free(st->ring);
speex_free(st->ringID);
speex_free(st->alpha);
speex_free(st->vorbis_win);
speex_free(st->order);
speex_free(st->y);
speex_free(st);
}
| {
"pile_set_name": "Github"
} |
---
title: GC 配置
aliases: ['/docs-cn/dev/garbage-collection-configuration/','/docs-cn/dev/reference/garbage-collection/configuration/']
---
# GC 配置
TiDB 的 GC 相关的配置存储于 `mysql.tidb` 系统表中,可以通过 SQL 语句对这些参数进行查询和更改:
{{< copyable "sql" >}}
```sql
select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb where VARIABLE_NAME like "tikv_gc%";
```
```
+--------------------------+----------------------------------------------------------------------------------------------------+
| VARIABLE_NAME | VARIABLE_VALUE |
+--------------------------+----------------------------------------------------------------------------------------------------+
| tikv_gc_leader_uuid | 5afd54a0ea40005 |
| tikv_gc_leader_desc | host:tidb-cluster-tidb-0, pid:215, start at 2019-07-15 11:09:14.029668932 +0000 UTC m=+0.463731223 |
| tikv_gc_leader_lease | 20190715-12:12:14 +0000 |
| tikv_gc_enable | true |
| tikv_gc_run_interval | 10m0s |
| tikv_gc_life_time | 10m0s |
| tikv_gc_last_run_time | 20190715-12:09:14 +0000 |
| tikv_gc_safe_point | 20190715-11:59:14 +0000 |
| tikv_gc_auto_concurrency | true |
| tikv_gc_mode | distributed |
+--------------------------+----------------------------------------------------------------------------------------------------+
13 rows in set (0.00 sec)
```
例如,如果需要将 GC 调整为保留最近一天以内的数据,只需执行下列语句即可:
{{< copyable "sql" >}}
```sql
update mysql.tidb set VARIABLE_VALUE="24h" where VARIABLE_NAME="tikv_gc_life_time";
```
> **注意:**
>
> `mysql.tidb` 系统表中除了下文列出的 GC 的配置以外,还包含一些 TiDB 用于储存部分集群状态(包括 GC 状态)的记录。请勿手动更改这些记录。其中,与 GC 有关的记录如下:
>
> - `tikv_gc_leader_uuid`,`tikv_gc_leader_desc` 和 `tikv_gc_leader_lease` 用于记录 GC leader 的状态
> - `tikv_gc_last_run_time`:最近一次 GC 运行的时间(每轮 GC 开始时更新)
> - `tikv_gc_safe_point`:当前的 safe point (每轮 GC 开始时更新)
## `tikv_gc_enable`
- 控制是否启用 GC。
- 默认值:`true`
## `tikv_gc_run_interval`
- 指定 GC 运行时间间隔。Duration 类型,使用 Go 的 Duration 字符串格式,如 `"1h30m"`,`"15m"` 等。
- 默认值:`"10m0s"`
## `tikv_gc_life_time`
- 每次 GC 时,保留数据的时限。Duration 类型。每次 GC 时将以当前时间减去该配置的值作为 safe point。
- 默认值:`"10m0s"`
> **注意:**
>
> - 在数据更新频繁的场景下,如果将 `tikv_gc_life_time` 设置得比较大(如数天甚至数月),可能会有一些潜在的问题,如:
> - 磁盘空间占用较多。
> - 大量的历史版本会在一定程度上影响性能,尤其是范围查询(如 `select count(*) from t`)。
> - 如果存在运行时间很长、超过了 `tikv_gc_life_time` 的事务,那么在 GC 时,会保留自该事务的开始时间 (start_ts) 以来的数据,以允许该事务继续运行。例如,如果 `tikv_gc_life_time` 配置为 10 分钟,而某次 GC 时,集群中正在运行的事务中开始时间最早的一个事务已经运行了 15 分钟,那么本次 GC 便会保留最近 15 分钟的数据。
## `tikv_gc_mode`
指定 GC 模式。可选值如下:
- `"distributed"`(默认):分布式 GC 模式。在此模式下,[Do GC](/garbage-collection-overview.md#do-gc进行-gc-清理) 阶段由 TiDB 上的 GC leader 向 PD 发送 safe point,每个 TiKV 节点各自获取该 safe point 并对所有当前节点上作为 leader 的 Region 进行 GC。此模式于 TiDB 3.0 引入。
- `"central"`:集中 GC 模式。在此模式下,[Do GC](/garbage-collection-overview.md#do-gc进行-gc-清理) 阶段由 GC leader 向所有的 Region 发送 GC 请求。TiDB 2.1 及更早版本采用此 GC 模式。
## `tikv_gc_auto_concurrency`
控制是否由 TiDB 自动决定 GC concurrency,即同时进行 GC 的线程数。
当 `tikv_gc_mode` 设为 `"distributed"`,GC concurrency 将应用于 [Resolve Locks](/garbage-collection-overview.md#resolve-locks清理锁) 阶段。当 [`tikv_gc_mode`](#tikv_gc_mode) 设为 `"central"` 时,GC concurrency 将应用于 Resolve Locks 以及 [Do GC](/garbage-collection-overview.md#do-gc进行-gc-清理) 两个阶段。
- `true`(默认):自动以 TiKV 节点的个数作为 GC concurrency
- `false`:使用 [`tikv_gc_concurrency`](#tikv_gc_concurrency) 的值作为 GC 并发数
## `tikv_gc_concurrency`
- 手动设置 GC concurrency。要使用该参数,必须将 [`tikv_gc_auto_concurrency`](#tikv_gc_auto_concurrency) 设为 `false` 。
- 默认值:2
## `tikv_gc_scan_lock_mode`
> **警告:**
>
> Green GC 目前是实验性功能,不建议在生产环境中使用。
设定 GC 的 Resolve Locks 阶段中,扫描锁的方式,即是否开启 Green GC(实验性特性)。Resolve Locks 阶段需要扫描整个集群的锁。在不开启 Green GC 的情况下,TiDB 会以 Region 为单位进行扫描。Green GC 提供了“物理扫描”的功能,即每台 TiKV 节点分别绕过 Raft 层直接扫描数据。该功能可以有效缓解 [Hibernate Region](/tikv-configuration-file.md#raftstorehibernate-regions-实验特性) 功能开启时,GC 唤醒全部 Region 的现象,并一定程度上提升 Resolve Locks 阶段的执行速度。
- `"legacy"`(默认):使用旧的扫描方式,即关闭 Green GC。
- `"physical"`:使用物理扫描的方式,即开启 Green GC。
> **注意:**
>
> 该项配置是隐藏配置。首次开启需要执行:
>
> {{< copyable "sql" >}}
>
> ```sql
> insert into mysql.tidb values ('tikv_gc_scan_lock_mode', 'legacy', '');
> ```
## 关于 GC 流程的说明
从 TiDB 3.0 版本起,由于对分布式 GC 模式和并行 Resolve Locks 的支持,部分配置选项的作用发生了变化。可根据下表理解不同版本中这些配置的区别:
| 版本/配置 | Resolve Locks | Do GC |
|-------------------|---------------|----------------|
| 2.x | 串行 | 并行 |
| 3.0 <br/> `tikv_gc_mode = centered` <br/> `tikv_gc_auto_concurrency = false` | 并行 | 并行 |
| 3.0 <br/> `tikv_gc_mode = centered` <br/> `tikv_gc_auto_concurrency = true` | 自动并行 | 自动并行 |
| 3.0 <br/> `tikv_gc_mode = distributed` <br/> `tikv_gc_auto_concurrency = false` | 并行 | 分布式 |
| 3.0 <br/> `tikv_gc_mode = distributed` <br/> `tikv_gc_auto_concurrency = true` <br/> (默认配置) | 自动并行 | 分布式 |
表格内容说明:
- 串行:由 TiDB 逐个向 Region 发送请求。
- 并行:使用 `tikv_gc_concurrency` 选项所指定的线程数,并行地向每个 Region 发送请求。
- 自动并行:使用 TiKV 节点的个数作为线程数,并行地向每个 Region 发送请求。
- 分布式:无需 TiDB 通过对 TiKV 发送请求的方式来驱动,而是每台 TiKV 自行工作。
另外,如果 Green GC (实验特性)开启(即 [`tikv_gc_scan_lock_mode`](#tikv_gc_scan_lock_mode) 配置项设为 `"physical"`),Resolve Lock 的执行将不受上述并行配置的影响。
## 流控
TiKV 在 3.0.6 版本开始支持 GC 流控,可通过配置 `gc.max-write-bytes-per-sec` 限制 GC worker 每秒数据写入量,降低对正常请求的影响,`0` 为关闭该功能。该配置可通过 tikv-ctl 动态修改:
{{< copyable "shell-regular" >}}
```bash
tikv-ctl --host=ip:port modify-tikv-config -m server -n gc.max_write_bytes_per_sec -v 10MB
```
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.