text
stringlengths 2
99.9k
| meta
dict |
---|---|
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:width="@dimen/split_one_pixels">
<shape android:shape="rectangle" >
<solid android:color="@color/color_split_line_d9d9d9" />
</shape>
</item>
<item android:left="@dimen/split_one_pixels">
<shape android:shape="rectangle" >
<solid android:color="@color/color_split_line_d9d9d9" />
</shape>
</item>
</layer-list> | {
"pile_set_name": "Github"
} |
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all copies of the Software and
its documentation and acknowledgment shall be given in the documentation and software packages that
this Software was used.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.</p>
| {
"pile_set_name": "Github"
} |
rule m3e9_135e1cc1c4000b12
{
meta:
copyright="Copyright (c) 2014-2018 Support Intelligence Inc, All Rights Reserved."
engine="saphire/1.3.1 divinorum/0.998 icewater/0.4"
viz_url="http://icewater.io/en/cluster/query?h64=m3e9.135e1cc1c4000b12"
cluster="m3e9.135e1cc1c4000b12"
cluster_size="19"
filetype = "PE32 executable (GUI) Intel 80386"
tlp = "amber"
version = "icewater snowflake"
author = "Rick Wesson (@wessorh) [email protected]"
date = "20171118"
license = "RIL-1.0 [Rick's Internet License] "
family="vobfus barys malicious"
md5_hashes="['359e0a581b17997653d94b6e4d5aefbc','b55ba3e1a91f0e3386b9fb5e4781228a','e61c83ffe231a860c7aa9dd7237cec07']"
strings:
$hex_string = { 150a0e13151e50515c5c5d688b8e8d8a7c69969795b5c6a0bb9fc3ccd9f8fffffffffaf9f1ad000000f2ffff65151f1e0f10121e22575c5d7a7d80a6abc8c8bb }
condition:
filesize > 65536 and filesize < 262144
and $hex_string
}
| {
"pile_set_name": "Github"
} |
package:
name: xorg-x11-proto-devel-cos5-x86_64
version: 7.1
source:
url: http://vault.centos.org/5.11/os/x86_64/CentOS/xorg-x11-proto-devel-7.1-13.el5.x86_64.rpm
sha1: 57d8fcad62051df13b42fddf6a6e04568d13926a
outputs:
- name: xorg-x11-proto-devel-cos5-x86_64
target: noarch
requirements:
build:
- xorg-x11-filesystem-cos5-noarch >=0.99.2
run:
- xorg-x11-filesystem-cos5-noarch >=0.99.2
| {
"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.editor;
/**
WARNING: This type was not defined as DLL export on its declaration. Because of that, some of its methods are inaccessible
**/
@:umodule("UnrealEd")
@:glueCppIncludes("Private/Factories/ActorFactoryMovieScene.h")
@:noClass @:uextern @:uclass extern class UActorFactoryMovieScene extends unreal.editor.UActorFactory {
}
| {
"pile_set_name": "Github"
} |
polkit.addRule(function(action, subject) {
if (action.id == "com.zoneminder.policykit.pkexec.run-zmsystemctl" &&
subject.user != "nginx") {
return polkit.Result.NO;
}
});
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0">
<DefaultLanguage xmlns="" code="en-US"/>
<App xmlns="" ProductID="{3c8e54c7-5741-4000-ab48-8e222dec1694}" Title="BoxViewSizers.WinPhone" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="BoxViewSizers.WinPhone author" Description="Sample description" Publisher="BoxViewSizers.WinPhone" PublisherID="{7ce047ac-71e5-4ae0-ac47-ec31a1d43907}">
<IconPath IsRelative="true" IsResource="false">Assets\ApplicationIcon.png</IconPath>
<Capabilities>
<Capability Name="ID_CAP_NETWORKING"/>
<Capability Name="ID_CAP_MEDIALIB_AUDIO"/>
<Capability Name="ID_CAP_MEDIALIB_PLAYBACK"/>
<Capability Name="ID_CAP_SENSORS"/>
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
</Capabilities>
<Tasks>
<DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
</Tasks>
<Tokens>
<PrimaryToken TokenID="PhoneApp1Token" TaskName="_default">
<TemplateFlip>
<SmallImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileSmall.png</SmallImageURI>
<Count>0</Count>
<BackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileMedium.png</BackgroundImageURI>
<Title>BoxViewSizers.WinPhone</Title>
<BackContent></BackContent>
<BackBackgroundImageURI></BackBackgroundImageURI>
<BackTitle></BackTitle>
<DeviceLockImageURI></DeviceLockImageURI>
<HasLarge></HasLarge>
</TemplateFlip>
</PrimaryToken>
</Tokens>
<ScreenResolutions>
<ScreenResolution Name="ID_RESOLUTION_WVGA"/>
<ScreenResolution Name="ID_RESOLUTION_WXGA"/>
<ScreenResolution Name="ID_RESOLUTION_HD720P"/>
</ScreenResolutions>
</App>
</Deployment>
| {
"pile_set_name": "Github"
} |
(**************************************************************************)
(* *)
(* This file is part of Frama-C. *)
(* *)
(* Copyright (C) 2007-2019 *)
(* CEA (Commissariat à l'énergie atomique et aux énergies *)
(* alternatives) *)
(* *)
(* you can redistribute it and/or modify it under the terms of the GNU *)
(* Lesser General Public License as published by the Free Software *)
(* Foundation, version 2.1. *)
(* *)
(* It is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU Lesser General Public License for more details. *)
(* *)
(* See the GNU Lesser General Public License version 2.1 *)
(* for more details (enclosed in the file licenses/LGPLv2.1). *)
(* *)
(**************************************************************************)
(** This module provides elements to mapped information (here called 'marks')
* to PDG elements and propagate it along the dependencies.
*
* Some more functions are defined in the PDG plugin itself
* (in [pdg/marks]):
* the signatures of these public functions can be found in file [Pdg.mli] *)
(** Signature of the module to use in order to instantiate the computation *)
module type Mark = sig
(** type of the information mapped to the nodes *)
type t
(** type of the information mapped to the function calls.
* This can be [unit] if there is nothing to store for the calls.
* (see {!PdgIndex.FctIndex} for more information)
* *)
type call_info
(** used to test [combine] result (see below) *)
val is_bottom : t -> bool
(** merge two pieces of information *)
val merge : t -> t -> t
(** [combine] is used during propagation. It should return
* [(new_mark, mark_to_prop) = combine old_mak new_mark]
* where [new_mark] is the mark to associate with the node,
* and [mark_to_prop] the mark to propagate to its dependencies.
* If [is_bottom mark_to_prop], the propagation is stopped.
* *)
val combine : t -> t -> t * t
val pretty : Format.formatter -> t -> unit
end
(** When selecting or propagating marks in a function,
* the marks are most of the time associated to pdg nodes,
* but we also need to associate marks to input locations
* in order to propage information to the callers about undefined data.
* *)
type select_elem = private
| SelNode of PdgTypes.Node.t * Locations.Zone.t option
| SelIn of Locations.Zone.t
val mk_select_node :
?z_opt:Locations.Zone.t option -> PdgTypes.Node.t -> select_elem
val mk_select_undef_zone : Locations.Zone.t -> select_elem
type 'tm select = (select_elem * 'tm) list
val add_to_select : 'tm select -> select_elem -> 'tm -> 'tm select
val add_node_to_select :
'tm select -> (PdgTypes.Node.t * Locations.Zone.t option) ->
'tm -> 'tm select
val add_undef_in_to_select :
'tm select -> Locations.Zone.t option -> 'tm -> 'tm select
(** we sometime need a list of [t_select] associated with its pdg when dealing
with several functions at one time. *)
type 'tm pdg_select_info = SelList of 'tm select | SelTopMarks of 'tm list
type 'tm pdg_select = (PdgTypes.Pdg.t * 'tm pdg_select_info) list
(** Represent the information to propagate from a function inputs to its
calls. Notice that the input keys don't necessarily correspond to nodes
especially when one want to select a data that is not defined in the
function. **)
type 'tm info_caller_inputs = (PdgIndex.Signature.in_key * 'tm) list
(** Represent the information to propagate from a call outputs to the called
function. The [stmt] are the calls to consider. *)
type 'tm info_called_outputs =
(Cil_types.stmt * (PdgIndex.Signature.out_key * 'tm) list) list
(** when some marks have been propagated in a function, there is some
information to propagate in the callers and called functions to have an
interprocedural processing. *)
type 'tm info_inter = 'tm info_caller_inputs * 'tm info_called_outputs
module type Fct = sig
type mark
type call_info
type fi = (mark, call_info) PdgIndex.FctIndex.t
type t = PdgTypes.Pdg.t * fi
val create : PdgTypes.Pdg.t -> t
val get_idx : t -> fi
type mark_info_inter = mark info_inter
val empty_to_prop : mark_info_inter
val mark_and_propagate :
t -> ?to_prop:mark_info_inter -> mark select -> mark_info_inter
end
module F_Fct(M : Mark) :
Fct with type mark = M.t and type call_info = M.call_info
type 't_mark m2m = select_elem -> 't_mark -> 't_mark option
type 't_mark call_m2m =
Cil_types.stmt option -> PdgTypes.Pdg.t -> 't_mark m2m
(** this is the type of the functor dedicated to interprocedural propagation.
It is defined in PDG plugin *)
module type Proj = sig
type t
type mark
type call_info
type fct = (mark, call_info) PdgIndex.FctIndex.t
val empty: unit -> t
val find_marks: t -> Cil_types.varinfo -> fct option
val mark_and_propagate: t -> PdgTypes.Pdg.t -> mark select -> unit
end
module type Config = sig
module M : Mark
(** define how to translate an input mark of a function into a mark
* to propagate in the callers.
* The statement specify to which call we are about to propagate,
* and the pdg is the one of the caller in which the call is.
* If it returns [None], the propagation is stopped.
* A simple propagation can be done by returning [Some m].
* The [call] parameter can be [None] when the caller has a Top PDG.
* *)
val mark_to_prop_to_caller_input : M.t call_m2m
(** define how to translate a mark of a call output into a mark
* to propagate in the called function.
* The statement specify from which call we are about to propagate,
* and the pdg is the one of the called function.
* *)
val mark_to_prop_to_called_output : M.t call_m2m
end
(*
Local Variables:
compile-command: "make -C ../../.."
End:
*)
| {
"pile_set_name": "Github"
} |
$ 3 0.0012 3.9121283998153213 50 5 50
163 296 336 320 336 1 10 0 0 0 0 0 0 0 0 0 0
R 456 368 456 392 0 0 40 5 0 0 0.5
152 336 296 336 232 1 4 0 5
w 320 296 312 296 0
w 312 296 312 320 0
w 328 296 328 320 0
w 344 296 344 320 0
w 352 296 360 296 0
w 360 296 360 320 0
w 408 296 408 320 0
w 424 296 424 320 0
w 400 296 392 296 0
w 392 296 392 320 0
w 432 296 440 296 0
w 440 296 440 320 0
152 416 296 416 232 1 4 0 5
162 480 88 528 88 2 old-default-led 1 0 0 0.01
162 480 120 528 120 2 old-default-led 1 1 0 0.01
162 480 152 528 152 2 old-default-led 0 1 0 0.01
w 376 320 376 216 0
162 304 88 256 88 2 old-default-led 1 0 0 0.01
162 304 120 256 120 2 old-default-led 1 1 0 0.01
162 304 152 256 152 2 old-default-led 0 1 0 0.01
w 336 232 336 152 0
w 456 320 456 120 0
w 456 120 480 120 0
w 416 232 416 152 0
w 416 152 480 152 0
w 416 96 416 152 0
w 416 80 432 80 0
w 432 80 432 120 0
w 432 120 456 120 0
w 336 152 336 40 0
w 360 88 304 88 0
w 376 216 352 216 0
w 336 152 304 152 0
w 352 216 352 120 0
w 352 120 304 120 0
w 352 120 352 56 0
152 352 48 480 48 1 2 0 5
w 336 40 352 40 0
w 480 48 480 88 0
w 528 88 528 120 0
w 528 120 528 152 0
w 256 88 256 120 0
w 256 120 256 152 0
r 528 152 528 216 0 200
r 256 152 256 216 0 200
g 256 216 256 232 0
g 528 216 528 232 0
152 416 88 360 88 1 2 0 5
R 152 176 152 136 0 0 40 5 0 0 0.5
w 152 176 64 176 0
r 64 240 64 304 0 47000
r 64 176 64 240 0 10000
w 216 272 216 352 0
w 216 352 296 352 0
165 88 208 152 208 4 0
w 64 304 64 336 0
c 64 336 64 368 0 0.000009999999999999999 0.001
g 64 368 64 384 0
w 64 240 88 240 0
w 64 304 88 304 0
w 64 336 88 336 0
w 152 176 216 176 0
w 216 176 216 240 0
g 184 368 184 376 0
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
</PropertyGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{C5BE0963-6F0E-4998-A726-D626509B7AA8}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>NetCostSample</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Iphlpapi.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile />
<PrecompiledHeaderOutputFile />
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>Iphlpapi.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="NetCostEventSink.h" />
<ClInclude Include="NetCostSample.h" />
<ClInclude Include="Utils.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="NetCostEventSink.cpp" />
<ClCompile Include="NetCostSample.cpp" />
<ClCompile Include="Utils.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project> | {
"pile_set_name": "Github"
} |
[?php use_helper('I18N', 'Date') ?]
[?php include_partial('<?php echo $this->getModuleName() ?>/assets') ?]
<div id="sf_admin_container">
<h1>[?php echo <?php echo $this->getI18NString('edit.title') ?> ?]</h1>
[?php include_partial('<?php echo $this->getModuleName() ?>/flashes') ?]
<div id="sf_admin_header">
[?php include_partial('<?php echo $this->getModuleName() ?>/form_header', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'form' => $form, 'configuration' => $configuration)) ?]
</div>
<div id="sf_admin_content">
[?php include_partial('<?php echo $this->getModuleName() ?>/form', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'form' => $form, 'configuration' => $configuration, 'helper' => $helper)) ?]
</div>
<div id="sf_admin_footer">
[?php include_partial('<?php echo $this->getModuleName() ?>/form_footer', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'form' => $form, 'configuration' => $configuration)) ?]
</div>
</div>
| {
"pile_set_name": "Github"
} |
StartChar: double_angle_left
Encoding: 61696 61696 830
Width: 2048
Flags: W
LayerCount: 2
Back
Fore
SplineSet
755 160 m 0
755 152 751 143 745 137 c 2
695 87 l 2
689 81 680 77 672 77 c 0
664 77 655 81 649 87 c 2
183 553 l 2
177 559 173 568 173 576 c 0
173 584 177 593 183 599 c 2
649 1065 l 2
655 1071 664 1075 672 1075 c 0
680 1075 689 1071 695 1065 c 2
745 1015 l 2
751 1009 755 1000 755 992 c 0
755 984 751 975 745 969 c 2
352 576 l 1
745 183 l 2
751 177 755 168 755 160 c 0
1139 160 m 0
1139 152 1135 143 1129 137 c 2
1079 87 l 2
1073 81 1064 77 1056 77 c 0
1048 77 1039 81 1033 87 c 2
567 553 l 2
561 559 557 568 557 576 c 0
557 584 561 593 567 599 c 2
1033 1065 l 2
1039 1071 1048 1075 1056 1075 c 0
1064 1075 1073 1071 1079 1065 c 2
1129 1015 l 2
1135 1009 1139 1000 1139 992 c 0
1139 984 1135 975 1129 969 c 2
736 576 l 1
1129 183 l 2
1135 177 1139 168 1139 160 c 0
EndSplineSet
Validated: 1
Ligature2: "'liga' Standard Ligatures lookup 0 subtable" f a hyphen a n g l e hyphen d o u b l e hyphen l e f t
EndChar
| {
"pile_set_name": "Github"
} |
/* <bruce/mock_kafka_server/prod_req/topic_group.h>
----------------------------------------------------------------------------
Copyright 2013-2014 if(we)
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.
----------------------------------------------------------------------------
The mock Kafka server uses this to represent a group of message sets with
the same topic.
*/
#pragma once
#include <algorithm>
#include <cassert>
#include <string>
#include <vector>
#include <bruce/mock_kafka_server/prod_req/msg_set.h>
namespace Bruce {
namespace MockKafkaServer {
namespace ProdReq {
class TTopicGroup final {
public:
explicit TTopicGroup(const std::string &topic)
: Topic(topic) {
}
explicit TTopicGroup(std::string &&topic)
: Topic(std::move(topic)) {
}
TTopicGroup(const TTopicGroup &) = default;
TTopicGroup(TTopicGroup &&) = default;
TTopicGroup &operator=(const TTopicGroup &) = default;
TTopicGroup &operator=(TTopicGroup &&) = default;
void AddMsgSet(const TMsgSet &msg_set) {
assert(this);
MsgSetVec.push_back(msg_set);
}
void AddMsgSet(TMsgSet &&msg_set) {
assert(this);
MsgSetVec.push_back(std::move(msg_set));
}
const std::string &GetTopic() const {
assert(this);
return Topic;
}
const std::vector<TMsgSet> &GetMsgSetVec() const {
assert(this);
return MsgSetVec;
}
private:
std::string Topic;
std::vector<TMsgSet> MsgSetVec;
}; // TTopicGroup
} // ProdReq
} // MockKafkaServer
} // Bruce
| {
"pile_set_name": "Github"
} |
%{%(MeshUtility%)
%:cfMesh
%[_header%]
FoamFile
{
version 4.0;
format ascii;
class dictionary;
location "system";
object meshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
surfaceFile "%(Name%)_Geometry.fms";
maxCellSize %(CfSettings/ClMax%);
boundaryCellSize %(CfSettings/ClMax%);
%{%(CfSettings/InternalRefinementRegionsPresent%)
%:True
objectRefinements
{
%{%(CfSettings/InternalRegions%)
%(0%)
{
cellSize %(CfSettings/InternalRegions/%(0%)/RelativeLength%);
type insideSurface;
closedSurfaceFile "constant/triSurface/%(0%).stl";
}
%}
}
%}
%{%(MeshRegionPresent%)
%:True
surfaceMeshRefinement
{
%{%(CfSettings/MeshRegions%)
%(0%)
{
cellSize %(CfSettings/MeshRegions/%(0%)/RelativeLength%);
surfaceFile "constant/triSurface/%(0%).stl";
refinementThickness %(CfSettings/MeshRegions/%(0%)/RefinementThickness%);
}
%}
}
%{%(CfSettings/BoundaryLayerPresent%)
%:True
boundaryLayers
{
patchBoundaryLayers
{
%{%(CfSettings/BoundaryLayers%)
"%(0%)"
{
nLayers %(CfSettings/BoundaryLayers/%(0%)/NumberLayers%);
thicknessRatio %(CfSettings/BoundaryLayers/%(0%)/ExpansionRatio%);
maxFirstLayerThickness %(CfSettings/BoundaryLayers/%(0%)/FirstLayerHeight%);
}
%}
}
optimiseLayer 1;
untangleLayers 0;
optimisationParameters
{
nSmoothNormals 3;
maxNumIterations 5;
featureSizeFactor 0.4;
reCalculateNormals 1;
relThicknessTol 0.1;
}
}
%}
%}
// ************************************************************************* //
%} | {
"pile_set_name": "Github"
} |
package com.braintreepayments.api.models;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.StringDef;
import com.cardinalcommerce.shared.userinterfaces.UiCustomization;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* A class to contain 3D Secure request information used for authentication
*/
public class ThreeDSecureRequest implements Parcelable {
@Retention(RetentionPolicy.SOURCE)
@StringDef({VERSION_1, VERSION_2})
@interface ThreeDSecureVersion {}
public static final String VERSION_1 = "1";
public static final String VERSION_2 = "2";
private String mNonce;
private String mAmount;
private String mMobilePhoneNumber;
private String mEmail;
private String mShippingMethod;
private ThreeDSecurePostalAddress mBillingAddress;
private @ThreeDSecureVersion String mVersionRequested = VERSION_1;
private ThreeDSecureAdditionalInformation mAdditionalInformation;
private boolean mChallengeRequested = false;
private boolean mExemptionRequested = false;
private UiCustomization mUiCustomization;
private ThreeDSecureV1UiCustomization mV1UiCustomization;
/**
* Set the nonce
*
* @param nonce The nonce that represents a card to perform a 3D Secure verification against.
*/
public ThreeDSecureRequest nonce(String nonce) {
mNonce = nonce;
return this;
}
/**
* Set the amount
*
* @param amount The amount of the transaction in the current merchant account's currency. This must be expressed in numbers with an optional decimal (using `.`) and precision up to the hundredths place. For example, if you're processing a transaction for 1.234,56 € then `amount` should be `1234.56`.
*/
public ThreeDSecureRequest amount(String amount) {
mAmount = amount;
return this;
}
/**
* Optional. Set the mobilePhoneNumber
*
* @param mobilePhoneNumber The mobile phone number used for verification. Only numbers. Remove dashes, parentheses and other characters.
*/
public ThreeDSecureRequest mobilePhoneNumber(String mobilePhoneNumber) {
mMobilePhoneNumber = mobilePhoneNumber;
return this;
}
/**
* Optional. Set the email
*
* @param email The email used for verification.
*/
public ThreeDSecureRequest email(String email) {
mEmail = email;
return this;
}
/**
* Optional. Set the shippingMethod
* Possible Values:
* 01 Same Day
* 02 Overnight / Expedited
* 03 Priority (2-3 Days)
* 04 Ground
* 05 Electronic Delivery
* 06 Ship to Store
*
* @param shippingMethod The 2-digit string indicating the shipping method chosen for the transaction.
*/
public ThreeDSecureRequest shippingMethod(String shippingMethod) {
mShippingMethod = shippingMethod;
return this;
}
/**
* Optional. Set the billingAddress
*
* @param billingAddress The billing address used for verification.
*/
public ThreeDSecureRequest billingAddress(ThreeDSecurePostalAddress billingAddress) {
mBillingAddress = billingAddress;
return this;
}
/**
* Optional. Set the desired ThreeDSecure version.
* Possible Values defined at {@link ThreeDSecureVersion}.
* <ul>
* <li>{@link #VERSION_2} if ThreeDSecure V2 flows are desired, when possible.</li>
* <li>{@link #VERSION_1} if only ThreeDSecure V1 flows are desired. Default value.</li>
* </ul>
* <p>
* Will default to {@link #VERSION_1}.
*
* @param versionRequested {@link ThreeDSecureVersion} The desired ThreeDSecure version.
*/
public ThreeDSecureRequest versionRequested(@ThreeDSecureVersion String versionRequested) {
mVersionRequested = versionRequested;
return this;
}
/**
* Optional. The additional information used for verification
*
* @param additionalInformation Additional information.
*/
public ThreeDSecureRequest additionalInformation(ThreeDSecureAdditionalInformation additionalInformation) {
mAdditionalInformation = additionalInformation;
return this;
}
/**
* Optional If set to true, the customer will be asked to complete the authentication challenge if possible
*
* @param challengeRequested decides if a challenge will be forced.
*/
public ThreeDSecureRequest challengeRequested(boolean challengeRequested) {
mChallengeRequested = challengeRequested;
return this;
}
/**
* Optional If set to true, an exemption to the authentication challenge will be requested
*
* @param exemptionRequested decides if a exemption will be requested.
*/
public ThreeDSecureRequest exemptionRequested(boolean exemptionRequested) {
mExemptionRequested = exemptionRequested;
return this;
}
/**
* Optional UI Customization for the 3DS2 challenge views.
* See <a href="https://cardinaldocs.atlassian.net/wiki/spaces/CMSDK/pages/863698999/UI+Customization">UiCustomization documentation</a>.
*
* @param uiCustomization specifies how 3DS2 challenge views should be customized.
*/
public ThreeDSecureRequest uiCustomization(UiCustomization uiCustomization) {
mUiCustomization = uiCustomization;
return this;
}
/**
* Optional UI Customization for the 3DS1 challenge views.
*
* @param v1UiCustomization specifies how 3DS1 challenge views should be customized.
*/
public ThreeDSecureRequest v1UiCustomization(ThreeDSecureV1UiCustomization v1UiCustomization) {
mV1UiCustomization = v1UiCustomization;
return this;
}
/**
* @return The nonce to use for 3D Secure verification
*/
public String getNonce() {
return mNonce;
}
/**
* @return The amount to use for 3D Secure verification
*/
public String getAmount() {
return mAmount;
}
/**
* @return The mobile phone number to use for 3D Secure verification
*/
public String getMobilePhoneNumber() {
return mMobilePhoneNumber;
}
/**
* @return The email to use for 3D Secure verification
*/
public String getEmail() {
return mEmail;
}
/**
* @return The shipping method to use for 3D Secure verification
*/
public String getShippingMethod() {
return mShippingMethod;
}
/**
* @return The billing address to use for 3D Secure verification
*/
public ThreeDSecurePostalAddress getBillingAddress() {
return mBillingAddress;
}
/**
* @return The requested ThreeDSecure version
*/
public @ThreeDSecureVersion String getVersionRequested() {
return mVersionRequested;
}
/**
* @return The additional information used for verification
* {@link ThreeDSecureAdditionalInformation} is only used for
* {@link ThreeDSecureRequest#VERSION_2} requests.
*/
public ThreeDSecureAdditionalInformation getAdditionalInformation() {
return mAdditionalInformation;
}
/**
* @return If a challenge has been requested
*/
public boolean isChallengeRequested() {
return mChallengeRequested;
}
/**
* @return If a exemption has been requested
*/
public boolean isExemptionRequested() {
return mExemptionRequested;
}
/**
* @return The UI customization for 3DS2 challenge views.
*/
public UiCustomization getUiCustomization() {
return mUiCustomization;
}
/**
* @return The UI customization for 3DS1 challenge views.
*/
public ThreeDSecureV1UiCustomization getV1UiCustomization() {
return mV1UiCustomization;
}
public ThreeDSecureRequest() {
// NOTE: this is a temporary fix for a null-pointer bug introduced by Cardinal 2.2.3-2
mUiCustomization = new UiCustomization();
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mNonce);
dest.writeString(mAmount);
dest.writeString(mMobilePhoneNumber);
dest.writeString(mEmail);
dest.writeString(mShippingMethod);
dest.writeParcelable(mBillingAddress, flags);
dest.writeString(mVersionRequested);
dest.writeParcelable(mAdditionalInformation, flags);
dest.writeByte(mChallengeRequested ? (byte) 1 : 0);
dest.writeByte(mExemptionRequested ? (byte) 1 : 0);
dest.writeSerializable(mUiCustomization);
dest.writeParcelable(mV1UiCustomization, flags);
}
public ThreeDSecureRequest(Parcel in) {
mNonce = in.readString();
mAmount = in.readString();
mMobilePhoneNumber = in.readString();
mEmail = in.readString();
mShippingMethod = in.readString();
mBillingAddress = in.readParcelable(ThreeDSecurePostalAddress.class.getClassLoader());
mVersionRequested = in.readString();
mAdditionalInformation = in.readParcelable(ThreeDSecureAdditionalInformation.class.getClassLoader());
mChallengeRequested = in.readByte() > 0;
mExemptionRequested = in.readByte() > 0;
mUiCustomization = (UiCustomization) in.readSerializable();
mV1UiCustomization = in.readParcelable(ThreeDSecureV1UiCustomization.class.getClassLoader());
}
public static final Creator<ThreeDSecureRequest> CREATOR = new Creator<ThreeDSecureRequest>() {
public ThreeDSecureRequest createFromParcel(Parcel source) {
return new ThreeDSecureRequest(source);
}
public ThreeDSecureRequest[] newArray(int size) {
return new ThreeDSecureRequest[size];
}
};
/**
* @return String representation of {@link ThreeDSecureRequest} for API use.
*/
public String build(String dfReferenceId) {
JSONObject additionalInfo;
JSONObject base = new JSONObject();
ThreeDSecurePostalAddress billing = getBillingAddress();
if (getAdditionalInformation() == null) {
additionalInfo = new JSONObject();
} else {
additionalInfo = getAdditionalInformation().toJson();
}
try {
base.put("amount", mAmount);
base.put("additional_info", additionalInfo);
additionalInfo.putOpt("mobile_phone_number", getMobilePhoneNumber());
additionalInfo.putOpt("shipping_method", getShippingMethod());
additionalInfo.putOpt("email", getEmail());
if (billing != null) {
additionalInfo.putOpt("billing_given_name", billing.getGivenName());
additionalInfo.putOpt("billing_surname", billing.getSurname());
additionalInfo.putOpt("billing_line1", billing.getStreetAddress());
additionalInfo.putOpt("billing_line2", billing.getExtendedAddress());
additionalInfo.putOpt("billing_line3", billing.getLine3());
additionalInfo.putOpt("billing_city", billing.getLocality());
additionalInfo.putOpt("billing_state", billing.getRegion());
additionalInfo.putOpt("billing_postal_code", billing.getPostalCode());
additionalInfo.putOpt("billing_country_code", billing.getCountryCodeAlpha2());
additionalInfo.putOpt("billing_phone_number", billing.getPhoneNumber());
}
if (VERSION_2.equals(getVersionRequested())) {
base.putOpt("df_reference_id", dfReferenceId);
}
base.put("challenge_requested", mChallengeRequested);
base.put("exemption_requested", mExemptionRequested);
} catch (JSONException ignored) {
}
return base.toString();
}
}
| {
"pile_set_name": "Github"
} |
1.22.0 / 2016-02-15
===================
* Add `application/ppsp-tracker+json`
* Add `application/problem+json`
* Add `application/problem+xml`
* Add `application/vnd.hdt`
* Add `application/vnd.ms-printschematicket+xml`
* Add `model/vnd.rosette.annotated-data-model`
* Add `text/slim`
* Add extension `.rng` to `application/xml`
* Fix extension of `application/dash+xml` to be `.mpd`
* Update primary extension to `.m4a` for `audio/mp4`
1.21.0 / 2016-01-06
===================
* Add `application/emergencycalldata.comment+xml`
* Add `application/emergencycalldata.deviceinfo+xml`
* Add `application/emergencycalldata.providerinfo+xml`
* Add `application/emergencycalldata.serviceinfo+xml`
* Add `application/emergencycalldata.subscriberinfo+xml`
* Add `application/vnd.filmit.zfc`
* Add `application/vnd.google-apps.document`
* Add `application/vnd.google-apps.presentation`
* Add `application/vnd.google-apps.spreadsheet`
* Add `application/vnd.mapbox-vector-tile`
* Add `application/vnd.ms-printdevicecapabilities+xml`
* Add `application/vnd.ms-windows.devicepairing`
* Add `application/vnd.ms-windows.nwprinting.oob`
* Add `application/vnd.tml`
* Add `audio/evs`
1.20.0 / 2015-11-10
===================
* Add `application/cdni`
* Add `application/csvm+json`
* Add `application/rfc+xml`
* Add `application/vnd.3gpp.access-transfer-events+xml`
* Add `application/vnd.3gpp.srvcc-ext+xml`
* Add `application/vnd.ms-windows.wsd.oob`
* Add `application/vnd.oxli.countgraph`
* Add `application/vnd.pagerduty+json`
* Add `text/x-suse-ymp`
1.19.0 / 2015-09-17
===================
* Add `application/vnd.3gpp-prose-pc3ch+xml`
* Add `application/vnd.3gpp.srvcc-info+xml`
* Add `application/vnd.apple.pkpass`
* Add `application/vnd.drive+json`
1.18.0 / 2015-09-03
===================
* Add `application/pkcs12`
* Add `application/vnd.3gpp-prose+xml`
* Add `application/vnd.3gpp.mid-call+xml`
* Add `application/vnd.3gpp.state-and-event-info+xml`
* Add `application/vnd.anki`
* Add `application/vnd.firemonkeys.cloudcell`
* Add `application/vnd.openblox.game+xml`
* Add `application/vnd.openblox.game-binary`
1.17.0 / 2015-08-13
===================
* Add `application/x-msdos-program`
* Add `audio/g711-0`
* Add `image/vnd.mozilla.apng`
* Add extension `.exe` to `application/x-msdos-program`
1.16.0 / 2015-07-29
===================
* Add `application/vnd.uri-map`
1.15.0 / 2015-07-13
===================
* Add `application/x-httpd-php`
1.14.0 / 2015-06-25
===================
* Add `application/scim+json`
* Add `application/vnd.3gpp.ussd+xml`
* Add `application/vnd.biopax.rdf+xml`
* Add `text/x-processing`
1.13.0 / 2015-06-07
===================
* Add nginx as a source
* Add `application/x-cocoa`
* Add `application/x-java-archive-diff`
* Add `application/x-makeself`
* Add `application/x-perl`
* Add `application/x-pilot`
* Add `application/x-redhat-package-manager`
* Add `application/x-sea`
* Add `audio/x-m4a`
* Add `audio/x-realaudio`
* Add `image/x-jng`
* Add `text/mathml`
1.12.0 / 2015-06-05
===================
* Add `application/bdoc`
* Add `application/vnd.hyperdrive+json`
* Add `application/x-bdoc`
* Add extension `.rtf` to `text/rtf`
1.11.0 / 2015-05-31
===================
* Add `audio/wav`
* Add `audio/wave`
* Add extension `.litcoffee` to `text/coffeescript`
* Add extension `.sfd-hdstx` to `application/vnd.hydrostatix.sof-data`
* Add extension `.n-gage` to `application/vnd.nokia.n-gage.symbian.install`
1.10.0 / 2015-05-19
===================
* Add `application/vnd.balsamiq.bmpr`
* Add `application/vnd.microsoft.portable-executable`
* Add `application/x-ns-proxy-autoconfig`
1.9.1 / 2015-04-19
==================
* Remove `.json` extension from `application/manifest+json`
- This is causing bugs downstream
1.9.0 / 2015-04-19
==================
* Add `application/manifest+json`
* Add `application/vnd.micro+json`
* Add `image/vnd.zbrush.pcx`
* Add `image/x-ms-bmp`
1.8.0 / 2015-03-13
==================
* Add `application/vnd.citationstyles.style+xml`
* Add `application/vnd.fastcopy-disk-image`
* Add `application/vnd.gov.sk.xmldatacontainer+xml`
* Add extension `.jsonld` to `application/ld+json`
1.7.0 / 2015-02-08
==================
* Add `application/vnd.gerber`
* Add `application/vnd.msa-disk-image`
1.6.1 / 2015-02-05
==================
* Community extensions ownership transferred from `node-mime`
1.6.0 / 2015-01-29
==================
* Add `application/jose`
* Add `application/jose+json`
* Add `application/json-seq`
* Add `application/jwk+json`
* Add `application/jwk-set+json`
* Add `application/jwt`
* Add `application/rdap+json`
* Add `application/vnd.gov.sk.e-form+xml`
* Add `application/vnd.ims.imsccv1p3`
1.5.0 / 2014-12-30
==================
* Add `application/vnd.oracle.resource+json`
* Fix various invalid MIME type entries
- `application/mbox+xml`
- `application/oscp-response`
- `application/vwg-multiplexed`
- `audio/g721`
1.4.0 / 2014-12-21
==================
* Add `application/vnd.ims.imsccv1p2`
* Fix various invalid MIME type entries
- `application/vnd-acucobol`
- `application/vnd-curl`
- `application/vnd-dart`
- `application/vnd-dxr`
- `application/vnd-fdf`
- `application/vnd-mif`
- `application/vnd-sema`
- `application/vnd-wap-wmlc`
- `application/vnd.adobe.flash-movie`
- `application/vnd.dece-zip`
- `application/vnd.dvb_service`
- `application/vnd.micrografx-igx`
- `application/vnd.sealed-doc`
- `application/vnd.sealed-eml`
- `application/vnd.sealed-mht`
- `application/vnd.sealed-ppt`
- `application/vnd.sealed-tiff`
- `application/vnd.sealed-xls`
- `application/vnd.sealedmedia.softseal-html`
- `application/vnd.sealedmedia.softseal-pdf`
- `application/vnd.wap-slc`
- `application/vnd.wap-wbxml`
- `audio/vnd.sealedmedia.softseal-mpeg`
- `image/vnd-djvu`
- `image/vnd-svf`
- `image/vnd-wap-wbmp`
- `image/vnd.sealed-png`
- `image/vnd.sealedmedia.softseal-gif`
- `image/vnd.sealedmedia.softseal-jpg`
- `model/vnd-dwf`
- `model/vnd.parasolid.transmit-binary`
- `model/vnd.parasolid.transmit-text`
- `text/vnd-a`
- `text/vnd-curl`
- `text/vnd.wap-wml`
* Remove example template MIME types
- `application/example`
- `audio/example`
- `image/example`
- `message/example`
- `model/example`
- `multipart/example`
- `text/example`
- `video/example`
1.3.1 / 2014-12-16
==================
* Fix missing extensions
- `application/json5`
- `text/hjson`
1.3.0 / 2014-12-07
==================
* Add `application/a2l`
* Add `application/aml`
* Add `application/atfx`
* Add `application/atxml`
* Add `application/cdfx+xml`
* Add `application/dii`
* Add `application/json5`
* Add `application/lxf`
* Add `application/mf4`
* Add `application/vnd.apache.thrift.compact`
* Add `application/vnd.apache.thrift.json`
* Add `application/vnd.coffeescript`
* Add `application/vnd.enphase.envoy`
* Add `application/vnd.ims.imsccv1p1`
* Add `text/csv-schema`
* Add `text/hjson`
* Add `text/markdown`
* Add `text/yaml`
1.2.0 / 2014-11-09
==================
* Add `application/cea`
* Add `application/dit`
* Add `application/vnd.gov.sk.e-form+zip`
* Add `application/vnd.tmd.mediaflex.api+xml`
* Type `application/epub+zip` is now IANA-registered
1.1.2 / 2014-10-23
==================
* Rebuild database for `application/x-www-form-urlencoded` change
1.1.1 / 2014-10-20
==================
* Mark `application/x-www-form-urlencoded` as compressible.
1.1.0 / 2014-09-28
==================
* Add `application/font-woff2`
1.0.3 / 2014-09-25
==================
* Fix engine requirement in package
1.0.2 / 2014-09-25
==================
* Add `application/coap-group+json`
* Add `application/dcd`
* Add `application/vnd.apache.thrift.binary`
* Add `image/vnd.tencent.tap`
* Mark all JSON-derived types as compressible
* Update `text/vtt` data
1.0.1 / 2014-08-30
==================
* Fix extension ordering
1.0.0 / 2014-08-30
==================
* Add `application/atf`
* Add `application/merge-patch+json`
* Add `multipart/x-mixed-replace`
* Add `source: 'apache'` metadata
* Add `source: 'iana'` metadata
* Remove badly-assumed charset data
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.tools.jaotc;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.HashMap;
import java.util.HashSet;
import jdk.tools.jaotc.binformat.BinaryContainer;
import jdk.tools.jaotc.binformat.ReadOnlyDataContainer;
import jdk.tools.jaotc.AOTCompiledClass.AOTKlassData;
import org.graalvm.compiler.code.CompilationResult;
import jdk.vm.ci.code.site.Mark;
import jdk.vm.ci.code.site.Site;
import jdk.vm.ci.hotspot.HotSpotCompiledCode;
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
final class CompiledMethodInfo {
static final String archStr = System.getProperty("os.arch").toLowerCase();
private static final int UNINITIALIZED_OFFSET = -1;
private static class AOTMethodOffsets {
/**
* Offset in metaspace names section.
*/
private int nameOffset;
/**
* Offset in the text section at which compiled code starts.
*/
private int textSectionOffset;
/**
* Offset in the metadata section.
*/
private int metadataOffset;
/**
* Offset to the metadata in the GOT table.
*/
private int metadataGotOffset;
/**
* Size of the metadata.
*/
private int metadataGotSize;
/**
* The sequential number corresponding to the order of methods code in code buffer.
*/
private int codeId;
AOTMethodOffsets() {
this.nameOffset = UNINITIALIZED_OFFSET;
this.textSectionOffset = UNINITIALIZED_OFFSET;
this.metadataOffset = UNINITIALIZED_OFFSET;
this.metadataGotOffset = UNINITIALIZED_OFFSET;
this.metadataGotSize = -1;
this.codeId = -1;
}
void addMethodOffsets(ReadOnlyDataContainer container, String name) {
verify(name);
// @formatter:off
/*
* The offsets layout should match AOTMethodOffsets structure in AOT JVM runtime
*/
// Add the offset to the name in the .metaspace.names section
container.appendInt(nameOffset).
// Add the offset to the code in the .text section
appendInt(textSectionOffset).
// Add the offset to the metadata in the .method.metadata section
appendInt(metadataOffset).
// Add the offset to the metadata in the .metadata.got section
appendInt(metadataGotOffset).
// Add the size of the metadata
appendInt(metadataGotSize).
// Add code ID.
appendInt(codeId);
// @formatter:on
}
private void verify(String name) {
assert nameOffset >= 0 : "incorrect nameOffset: " + nameOffset + " for method: " + name;
assert textSectionOffset > 0 : "incorrect textSectionOffset: " + textSectionOffset + " for method: " + name;
assert metadataOffset >= 0 : "incorrect metadataOffset: " + metadataOffset + " for method: " + name;
assert metadataGotOffset >= 0 : "incorrect metadataGotOffset: " + metadataGotOffset + " for method: " + name;
assert metadataGotSize >= 0 : "incorrect metadataGotSize: " + metadataGotSize + " for method: " + name;
assert codeId >= 0 : "incorrect codeId: " + codeId + " for method: " + name;
}
protected void setNameOffset(int offset) {
nameOffset = offset;
}
protected void setTextSectionOffset(int textSectionOffset) {
this.textSectionOffset = textSectionOffset;
}
protected int getTextSectionOffset() {
return textSectionOffset;
}
protected void setCodeId(int codeId) {
this.codeId = codeId;
}
protected int getCodeId() {
return codeId;
}
protected void setMetadataOffset(int offset) {
metadataOffset = offset;
}
protected void setMetadataGotOffset(int metadataGotOffset) {
this.metadataGotOffset = metadataGotOffset;
}
protected void setMetadataGotSize(int length) {
this.metadataGotSize = length;
}
}
/**
* Method name
*/
private String name;
/**
* Result of graal compilation.
*/
private CompilationResult compilationResult;
/**
* HotSpotResolvedJavaMethod or Stub corresponding to the compilation result.
*/
private JavaMethodInfo methodInfo;
/**
* Compiled code from installation.
*/
private HotSpotCompiledCode code;
/**
* Offset to stubs.
*/
private int stubsOffset;
/**
* The total size in bytes of the stub section.
*/
private int totalStubSize;
/**
* Method's offsets.
*/
private AOTMethodOffsets methodOffsets;
/**
* List of stubs (PLT trampoline).
*/
private HashMap<String, StubInformation> stubs = new HashMap<>();
/**
* List of referenced classes.
*/
private HashSet<AOTKlassData> dependentKlasses = new HashSet<>();
/**
* Methods count used to generate unique global method id.
*/
private static final AtomicInteger methodsCount = new AtomicInteger();
CompiledMethodInfo(CompilationResult compilationResult, JavaMethodInfo methodInfo) {
this.name = methodInfo.getNameAndSignature();
this.compilationResult = compilationResult;
this.methodInfo = methodInfo;
this.stubsOffset = UNINITIALIZED_OFFSET;
this.methodOffsets = new AOTMethodOffsets();
}
String name() {
return name;
}
void addMethodOffsets(BinaryContainer binaryContainer, ReadOnlyDataContainer container) {
this.methodOffsets.setNameOffset(binaryContainer.addMetaspaceName(name));
this.methodOffsets.addMethodOffsets(container, name);
for (AOTKlassData data : dependentKlasses) {
data.addDependentMethod(this);
}
}
CompilationResult getCompilationResult() {
return compilationResult;
}
JavaMethodInfo getMethodInfo() {
return methodInfo;
}
void setTextSectionOffset(int textSectionOffset) {
methodOffsets.setTextSectionOffset(textSectionOffset);
}
public int getTextSectionOffset() {
return methodOffsets.getTextSectionOffset();
}
void setCodeId() {
methodOffsets.setCodeId(CompiledMethodInfo.getNextCodeId());
}
int getCodeId() {
return this.methodOffsets.getCodeId();
}
static int getMethodsCount() {
return methodsCount.get();
}
static int getNextCodeId() {
return methodsCount.getAndIncrement();
}
int getCodeSize() {
return stubsOffset + getStubCodeSize();
}
int getStubCodeSize() {
return totalStubSize;
}
void setMetadataOffset(int offset) {
this.methodOffsets.setMetadataOffset(offset);
}
/**
* Offset into the code of this method where the stub section starts.
*/
void setStubsOffset(int offset) {
stubsOffset = offset;
}
int getStubsOffset() {
return stubsOffset;
}
void setMetadataGotOffset(int metadataGotOffset) {
this.methodOffsets.setMetadataGotOffset(metadataGotOffset);
}
void setMetadataGotSize(int length) {
this.methodOffsets.setMetadataGotSize(length);
}
void addStubCode(String call, StubInformation stub) {
stubs.put(call, stub);
totalStubSize += stub.getSize();
}
StubInformation getStubFor(String call) {
StubInformation stub = stubs.get(call);
assert stub != null : "missing stub for call " + call;
stub.verify();
return stub;
}
void addDependentKlassData(BinaryContainer binaryContainer, HotSpotResolvedObjectType type) {
AOTKlassData klassData = AOTCompiledClass.addFingerprintKlassData(binaryContainer, type);
dependentKlasses.add(klassData);
}
AOTKlassData getDependentKlassData(HotSpotResolvedObjectType type) {
AOTKlassData klassData = AOTCompiledClass.getAOTKlassData(type);
if (dependentKlasses.contains(klassData)) {
return klassData;
}
return null;
}
boolean hasMark(Site call, MarkId id) {
for (Mark m : compilationResult.getMarks()) {
int adjOffset = m.pcOffset;
if (archStr.equals("aarch64")) {
// The mark is at the end of a group of three instructions:
// adrp; add; ldr
adjOffset += 12;
} else {
// X64-specific code.
// Call instructions are aligned to 8
// bytes - 1 on x86 to patch address atomically,
adjOffset = (adjOffset & (-8)) + 7;
}
// Mark points before aligning nops.
if ((call.pcOffset == adjOffset) && MarkId.getEnum((int) m.id) == id) {
return true;
}
}
return false;
}
String asTag() {
return "[" + methodInfo.getSymbolName() + "]";
}
HotSpotCompiledCode compiledCode() {
if (code == null) {
code = methodInfo.compiledCode(compilationResult);
}
return code;
}
// Free memory
void clear() {
this.dependentKlasses = null;
this.name = null;
}
void clearCompileData() {
this.code = null;
this.stubs = null;
this.compilationResult = null;
this.methodInfo = null;
}
}
| {
"pile_set_name": "Github"
} |
"_1" "Mid(bb0[0])"
"_2" "Mid(bb0[1])"
"_3" "Mid(bb0[2])"
"_3" "Mid(bb0[3])"
"_2" "Mid(bb0[4])"
"_1" "Mid(bb0[5])"
"_2" "Mid(bb2[0])"
"_3" "Mid(bb2[2])"
"_4" "Mid(bb2[3])"
"_5" "Mid(bb2[4])"
"_6" "Mid(bb2[5])"
"_7" "Mid(bb2[6])"
"_7" "Mid(bb2[7])"
"_6" "Mid(bb2[9])"
"_5" "Mid(bb2[10])"
"_7" "Mid(bb7[0])"
"_6" "Mid(bb7[1])"
"_4" "Mid(bb7[2])"
"_5" "Mid(bb8[0])"
"_8" "Mid(bb8[2])"
"_9" "Mid(bb8[3])"
"_9" "Mid(bb8[4])"
"_10" "Mid(bb8[5])"
"_10" "Mid(bb8[6])"
"_8" "Mid(bb8[7])"
"_10" "Mid(bb9[0])"
"_9" "Mid(bb9[1])"
"_8" "Mid(bb9[2])"
"_11" "Mid(bb9[3])"
"_12" "Mid(bb9[4])"
"_13" "Mid(bb9[5])"
"_13" "Mid(bb9[6])"
"_12" "Mid(bb9[7])"
"_11" "Mid(bb9[8])"
"_12" "Mid(bb12[0])"
"_11" "Mid(bb15[0])"
"_13" "Mid(bb15[1])"
"_14" "Mid(bb15[2])"
"_15" "Mid(bb15[3])"
"_16" "Mid(bb15[4])"
"_17" "Mid(bb15[5])"
"_18" "Mid(bb15[6])"
"_19" "Mid(bb15[7])"
"_35" "Mid(bb15[8])"
"_19" "Mid(bb15[9])"
"_18" "Mid(bb15[10])"
"_17" "Mid(bb15[11])"
"_18" "Mid(bb15[12])"
"_25" "Mid(bb15[13])"
"_26" "Mid(bb15[14])"
"_27" "Mid(bb15[15])"
"_28" "Mid(bb15[16])"
"_29" "Mid(bb15[17])"
"_30" "Mid(bb15[18])"
"_30" "Mid(bb15[19])"
"_29" "Mid(bb15[20])"
"_30" "Mid(bb15[21])"
"_31" "Mid(bb15[23])"
"_31" "Mid(bb15[24])"
"_32" "Mid(bb15[25])"
"_33" "Mid(bb15[26])"
"_33" "Mid(bb15[27])"
"_34" "Mid(bb15[28])"
"_34" "Mid(bb15[29])"
"_32" "Mid(bb15[30])"
"_34" "Mid(bb16[0])"
"_33" "Mid(bb16[1])"
"_28" "Mid(bb16[2])"
"_32" "Mid(bb16[3])"
"_31" "Mid(bb16[4])"
"_27" "Mid(bb16[5])"
"_26" "Mid(bb16[6])"
"_25" "Mid(bb16[7])"
"_26" "Mid(bb16[8])"
"_16" "Mid(bb16[9])"
"_25" "Mid(bb17[0])"
"_17" "Mid(bb17[1])"
"_15" "Mid(bb17[2])"
"_16" "Mid(bb18[0])"
"_29" "Mid(bb18[1])"
"_28" "Mid(bb18[2])"
"_27" "Mid(bb18[3])"
"_19" "Mid(bb18[4])"
"_15" "Mid(bb18[5])"
"_14" "Mid(bb18[6])"
"_14" "Mid(bb18[7])"
"_0" "Mid(bb18[8])"
"_4" "Mid(bb19[0])"
"_1" "Mid(bb20[0])"
| {
"pile_set_name": "Github"
} |
/*
* Watchdog driver for Broadcom BCM2835
*
* Copyright (C) 2017 Paolo Pisati <[email protected]>
*
* SPDX-License-Identifier: GPL-2.0
*/
#include <common.h>
#include <efi_loader.h>
#include <asm/io.h>
#include <asm/arch/wdog.h>
#define SECS_TO_WDOG_TICKS(x) ((x) << 16)
#define MAX_TIMEOUT 0xf /* ~15s */
static __efi_runtime_data bool enabled = true;
extern void reset_cpu(ulong ticks);
void hw_watchdog_reset(void)
{
if (enabled)
reset_cpu(SECS_TO_WDOG_TICKS(MAX_TIMEOUT));
}
void hw_watchdog_init(void)
{
hw_watchdog_reset();
}
void __efi_runtime hw_watchdog_disable(void)
{
enabled = false;
}
| {
"pile_set_name": "Github"
} |
15--Stock_Market/15_Stock_Market_Stock_Market_15_301.jpg
1
175.993515625 84.0040859375 115.181171875 182.303414062 0.999157190323
| {
"pile_set_name": "Github"
} |
# coding: utf-8
#--
# color_scheme.rb
#
# Created by Jeremy Hinegardner on 2007-01-24
# Copyright 2007. All rights reserved
#
# This is Free Software. See LICENSE and COPYING for details
class HighLine
#
# ColorScheme objects encapsulate a named set of colors to be used in the
# {HighLine.color} method call. For example, by applying a ColorScheme that
# has a <tt>:warning</tt> color then the following could be used:
#
# color("This is a warning", :warning)
#
# A ColorScheme contains named sets of HighLine color constants.
#
# @example Instantiating a color scheme, applying it to HighLine,
# and using it:
# ft = HighLine::ColorScheme.new do |cs|
# cs[:headline] = [ :bold, :yellow, :on_black ]
# cs[:horizontal_line] = [ :bold, :white ]
# cs[:even_row] = [ :green ]
# cs[:odd_row] = [ :magenta ]
# end
#
# HighLine.color_scheme = ft
# say("<%= color('Headline', :headline) %>")
# say("<%= color('-'*20, :horizontal_line) %>")
# i = true
# ("A".."D").each do |row|
# if i then
# say("<%= color('#{row}', :even_row ) %>")
# else
# say("<%= color('#{row}', :odd_row) %>")
# end
# i = !i
# end
#
#
class ColorScheme
#
# Create an instance of HighLine::ColorScheme. The customization can
# happen as a passed in Hash or via the yielded block. Keys are
# converted to <tt>:symbols</tt> and values are converted to HighLine
# constants.
#
# @param h [Hash]
def initialize(h = nil)
@scheme = {}
load_from_hash(h) if h
yield self if block_given?
end
# Load multiple colors from key/value pairs.
# @param h [Hash]
def load_from_hash(h)
h.each_pair do |color_tag, constants|
self[color_tag] = constants
end
end
# Does this color scheme include the given tag name?
# @param color_tag [#to_sym]
# @return [Boolean]
def include?(color_tag)
@scheme.keys.include?(to_symbol(color_tag))
end
# Allow the scheme to be accessed like a Hash.
# @param color_tag [#to_sym]
# @return [Style]
def [](color_tag)
@scheme[to_symbol(color_tag)]
end
# Retrieve the original form of the scheme
# @param color_tag [#to_sym]
def definition(color_tag)
style = @scheme[to_symbol(color_tag)]
style && style.list
end
# Retrieve the keys in the scheme
# @return [Array] of keys
def keys
@scheme.keys
end
# Allow the scheme to be set like a Hash.
# @param color_tag [#to_sym]
# @param constants [Array<Symbol>] Array of Style symbols
def []=(color_tag, constants)
@scheme[to_symbol(color_tag)] =
HighLine::Style.new(name: color_tag.to_s.downcase.to_sym,
list: constants,
no_index: true)
end
# Retrieve the color scheme hash (in original definition format)
# @return [Hash] scheme as Hash. It may be reused in a new ColorScheme.
def to_hash
@scheme.each_with_object({}) do |pair, hsh|
key, value = pair
hsh[key] = value.list
end
end
private
# Return a normalized representation of a color name.
def to_symbol(t)
t.to_s.downcase
end
# Return a normalized representation of a color setting.
def to_constant(v)
v = v.to_s if v.is_a?(Symbol)
if v.is_a?(::String)
HighLine.const_get(v.upcase)
else
v
end
end
end
# A sample ColorScheme.
class SampleColorScheme < ColorScheme
SAMPLE_SCHEME = {
critical: [:yellow, :on_red],
error: [:bold, :red],
warning: [:bold, :yellow],
notice: [:bold, :magenta],
info: [:bold, :cyan],
debug: [:bold, :green],
row_even: [:cyan],
row_odd: [:magenta]
}.freeze
#
# Builds the sample scheme with settings for <tt>:critical</tt>,
# <tt>:error</tt>, <tt>:warning</tt>, <tt>:notice</tt>, <tt>:info</tt>,
# <tt>:debug</tt>, <tt>:row_even</tt>, and <tt>:row_odd</tt> colors.
#
def initialize(_h = nil)
super(SAMPLE_SCHEME)
end
end
end
| {
"pile_set_name": "Github"
} |
(pretty-hydra :repo "jerrypnz/major-mode-hydra.el"
:fetcher github
:files ("pretty-hydra.el"))
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2011-2015 The XDocReport Team <[email protected]>
All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<!--
-->
<xsl:stylesheet
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="office meta dc"
version="2.0">
<xsl:template match="office:meta">
<xsl:comment>office:metadata begin</xsl:comment>
<xsl:apply-templates select="dc:title"/>
<xsl:apply-templates select="dc:creator"/>
<xsl:apply-templates select="dc:date"/>
<xsl:apply-templates select="dc:language"/>
<xsl:apply-templates select="dc:description"/>
<xsl:apply-templates select="meta:keyword"/>
<xsl:apply-templates select="meta:generator"/>
<xsl:apply-templates select="meta:document-statistic"/>
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8" />
<xsl:comment>office:metadata end</xsl:comment>
</xsl:template>
<xsl:template match="dc:title">
<title><xsl:apply-templates/></title>
<meta name="DC.title" content="{current()}" />
</xsl:template>
<xsl:template match="dc:language">
<meta http-equiv="content-language" content="{current()}" />
<meta name="DC.language" content="{current()}" />
</xsl:template>
<xsl:template match="dc:creator">
<meta name="author" content="{current()}" />
<meta name="DC.creator" content="{current()}" />
</xsl:template>
<xsl:template match="dc:description">
<meta name="description" content="{current()}" />
</xsl:template>
<xsl:template match="dc:date">
<meta name="revised" content="{current()}" />
<meta name="DC.date" content="{current()}" />
</xsl:template>
<xsl:template match="meta:keyword">
<meta name="keywords" content="{current()}" />
</xsl:template>
<xsl:template match="meta:generator">
<meta name="generator" content="{current()}" />
</xsl:template>
<xsl:template match="meta:document-statistic">
<meta name="meta:page-count" content="{@meta:page-count}"/>
<meta name="meta:word-count" content="{@meta:word-count}"/>
<meta name="meta:image-count" content="{@meta:image-count}"/>
<meta name="meta:table-count" content="{@meta:table-count}"/>
<meta name="meta:object-count" content="{@meta:object-count}"/>
<meta name="meta:character-count" content="{@meta:character-count}"/>
<meta name="meta:paragraph-count" content="{@meta:paragraph-count}"/>
</xsl:template>
</xsl:stylesheet>
| {
"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.
*/
#ifndef HW_BUS_DRIVER_H_
#define HW_BUS_DRIVER_H_
#include <stdint.h>
#include "os/mynewt.h"
#if MYNEWT_VAL(BUS_STATS)
#include "stats/stats.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct bus_dev;
struct bus_node;
#if MYNEWT_VAL(BUS_STATS)
STATS_SECT_START(bus_stats_section)
STATS_SECT_ENTRY(lock_timeouts)
STATS_SECT_ENTRY(read_ops)
STATS_SECT_ENTRY(read_errors)
STATS_SECT_ENTRY(write_ops)
STATS_SECT_ENTRY(write_errors)
STATS_SECT_END
#endif
/**
* Bus device operations
*
* These operations shall be defined by bus driver
*/
struct bus_dev_ops {
/* Initialize node */
int (* init_node)(struct bus_dev *bus, struct bus_node *node, void *arg);
/* Enable bus device */
int (* enable)(struct bus_dev *bus);
/* Configure bus for node */
int (* configure)(struct bus_dev *bus, struct bus_node *node);
/* Read data from node */
int (* read)(struct bus_dev *dev, struct bus_node *node, uint8_t *buf,
uint16_t length, os_time_t timeout, uint16_t flags);
/* Write data to node */
int (* write)(struct bus_dev *dev, struct bus_node *node, const uint8_t *buf,
uint16_t length, os_time_t timeout, uint16_t flags);
/* Disable bus device */
int (* disable)(struct bus_dev *bus);
};
/**
* Bus node callbacks
*
* Node can use these callbacks to receive notifications from bus driver.
* All callbacks are optional.
*/
struct bus_node_callbacks {
/* Called when os_dev is initialized */
void (* init)(struct bus_node *node, void *arg);
/* Called when first reference to node object is opened */
void (* open)(struct bus_node *node);
/* Called when last reference to node object is closed */
void (* close)(struct bus_node *node);
};
/**
* Bus node configuration
*
* This can be wrapped in configuration structure defined by bus driver.
*/
struct bus_node_cfg {
/** Bus device name where node is attached */
const char *bus_name;
/** Lock timeout [ms], 0 = default timeout */
uint16_t lock_timeout_ms;
};
/**
* Bus device object state
*
* Contents of these objects are managed internally by bus driver and shall not
* be accessed directly.
*/
struct bus_dev {
struct os_dev odev;
const struct bus_dev_ops *dops;
struct os_mutex lock;
struct bus_node *configured_for;
#if MYNEWT_VAL(BUS_PM)
bus_pm_mode_t pm_mode;
union bus_pm_options pm_opts;
struct os_callout inactivity_tmo;
#endif
#if MYNEWT_VAL(BUS_STATS)
STATS_SECT_DECL(bus_stats_section) stats;
#endif
bool enabled;
#if MYNEWT_VAL(BUS_DEBUG_OS_DEV)
uint32_t devmagic;
#endif
};
/**
* Bus node object state
*
* Contents of these objects are managed internally by bus driver and shall not
* be accessed directly.
*/
struct bus_node {
struct os_dev odev;
struct bus_node_callbacks callbacks;
/*
* init_arg is valid until os_dev is initialized (bus_node_init_func called)
* parent_bus is valid afterwards
*/
union {
struct bus_dev *parent_bus;
void *init_arg;
};
os_time_t lock_timeout;
#if MYNEWT_VAL(BUS_STATS_PER_NODE)
STATS_SECT_DECL(bus_stats_section) stats;
#endif
#if MYNEWT_VAL(BUS_DEBUG_OS_DEV)
uint32_t nodemagic;
#endif
};
/**
* Initialize os_dev as bus device
*
* This can be passed as a parameter to os_dev_create() when creating os_dev
* object for bus, however it's recommended to create devices using specialized
* APIs provided by bus drivers.
*
* @param bus Bus device object
* @param arg Bus device operations struct (struct bus_dev_ops)
*/
int
bus_dev_init_func(struct os_dev *bus, void *arg);
/**
* Initialize os_dev as bus node
*
* This can be passed as a parameter to os_dev_create() when creating os_dev
* object for node, however it's recommended to create devices using specialized
* APIs provided by bus drivers.
*
* @param node Node device object
* @param arg Node configuration struct (struct bus_node_cfg)
*/
int
bus_node_init_func(struct os_dev *node, void *arg);
/**
* Set driver callbacks for node
*
* This should be used before node device is initialized to set callbacks for
* receiving notifications from bus driver. It shall be called no more than once
* on any bus_node object.
*
* @param node Node device object;
* @param cbs Callbacks
*
*/
void
bus_node_set_callbacks(struct os_dev *node, struct bus_node_callbacks *cbs);
#ifdef __cplusplus
}
#endif
#endif /* HW_BUS_DRIVER_H_ */
| {
"pile_set_name": "Github"
} |
github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw=
github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
github.com/golang/sys v0.0.0-20190306220234-b354f8bf4d9e h1:Yv9Nf3qPhnbsludlsbTa1z6lOpYbJxHKoh5lXyqfP3I=
github.com/golang/sys v0.0.0-20190306220234-b354f8bf4d9e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc h1:RTUQlKzoZZVG3umWNzOYeFecQLIh+dbxXvJp1zPQJTI=
github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc/go.mod h1:NoCfSFWosfqMqmmD7hApkirIK9ozpHjxRnRxs1l413A=
| {
"pile_set_name": "Github"
} |
//===- SCCP.h - Sparse Conditional Constant Propagation ---------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This pass implements interprocedural sparse conditional constant
// propagation and merging.
//
// Specifically, this:
// * Assumes values are constant unless proven otherwise
// * Assumes BasicBlocks are dead unless proven otherwise
// * Proves values to be constant, and replaces them with constants
// * Proves conditional branches to be unconditional
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_IPO_SCCP_H
#define LLVM_TRANSFORMS_IPO_SCCP_H
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
namespace llvm {
/// Pass to perform interprocedural constant propagation.
class IPSCCPPass : public PassInfoMixin<IPSCCPPass> {
public:
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};
}
#endif // LLVM_TRANSFORMS_IPO_SCCP_H
| {
"pile_set_name": "Github"
} |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
/**
*
*
* @category Utilities
*/
var Logger = /** @class */ (function () {
function Logger(props) {
this._props = Object.assign({}, { name: "carmel" }, props);
// this._events = []
}
Object.defineProperty(Logger.prototype, "props", {
// get console() {
// return this._console
// }
get: function () {
return this._props;
},
enumerable: false,
configurable: true
});
return Logger;
}());
exports.Logger = Logger;
// _.TYPE_ERROR = 'error'
// _.TYPE_INFO = 'info'
// _.TYPE_SYSTEM = 'system'
// _.TYPE_FLAGS = {
// [_.TYPE_ERROR]: 'red',
// [_.TYPE_INFO]: 'green',
// [_.TYPE_SYSTEM]: 'bold'
// }
//# sourceMappingURL=Logger.js.map | {
"pile_set_name": "Github"
} |
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2020 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// 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.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Simon Grätzer
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_CLUSTER_ENGINE_ROCKSDB_METHODS_H
#define ARANGOD_CLUSTER_ENGINE_ROCKSDB_METHODS_H 1
#include "Basics/Result.h"
namespace arangodb {
namespace rocksdb {
////////////////////////////////////////////////////////////////////////////////
/// @brief recalculate collection count on all DBServers
////////////////////////////////////////////////////////////////////////////////
Result recalculateCountsOnAllDBServers(std::string const& dbname, std::string const& collname);
////////////////////////////////////////////////////////////////////////////////
/// @brief wait for estimator sync on all DBServers
////////////////////////////////////////////////////////////////////////////////
Result waitForEstimatorSync();
} // namespace rocksdb
} // namespace arangodb
#endif
| {
"pile_set_name": "Github"
} |
/* Copyright (c) Colorado School of Mines, 1990.
/* All rights reserved. */
/* Test driver for function filestat
*
* Here are some tests using filestatt to analyse STDIN, STDOUT and
* the first command line argument along with the expected results:
* filestatt filestatt.c
* expect: TTY, TTY, DISK
* filestatt <filestatt.c /usr/local | cat
* expect: DISK, PIPE, DIRECTORY
* cat filestatt.c | filestatt filestatt.c >/usr/tmp/junkxxx
* expect: PIPE, DISK, DISK
* filestatt /dev/null
* expect: TTY, TTY, DISK
* filestatt
* expect: TTY, TTY, "no filename given"
*/
#include "cwp.h"
main(int argc, char **argv)
{
static filetype ftype;
int fd;
fprintf(stderr, "Checking filestat ...\n");
/* Get filetype of stdin */
switch (ftype = filestat(STDIN)) {
case TTY:
fprintf(stderr, "filetype(STDIN) = TTY\n");
break;
case DISK:
fprintf(stderr, "filetype(STDIN) = DISK\n");
break;
case DIRECTORY:
fprintf(stderr, "filetype(STDIN) = DIRECTORY\n");
break;
case TAPE:
fprintf(stderr, "filetype(STDIN) = TAPE\n");
break;
case PIPE:
fprintf(stderr, "filetype(STDIN) = PIPE\n");
break;
case BADFILETYPE:
fprintf(stderr, "filetype(STDIN) = BADFILETYPE\n");
break;
default:
fprintf(stderr, "filestat(stdin) failed: ftype = %d\n", ftype);
}
/* Get filetype of stdout */
switch (ftype = filestat(STDOUT)) {
case TTY:
fprintf(stderr, "filetype(STDOUT) = TTY\n");
break;
case DISK:
fprintf(stderr, "filetype(STDOUT) = DISK\n");
break;
case DIRECTORY:
fprintf(stderr, "filetype(STDOUT) = DIRECTORY\n");
break;
case TAPE:
fprintf(stderr, "filetype(STDOUT) = TAPE\n");
break;
case PIPE:
fprintf(stderr, "filetype(STDOUT) = PIPE\n");
break;
case BADFILETYPE:
fprintf(stderr, "filetype(STDOUT) = BADFILETYPE\n");
break;
default:
fprintf(stderr, "filestat(stdout) failed: ftype = %d\n", ftype);
}
/* Get filetype of argv[1] */
if (argc == 1) {
fprintf(stderr, "no filename given\n");
exit(1);
}
if (-1 == (fd = open(argv[1], O_RDONLY))) {
fprintf(stderr, "can't open %s", argv[1]);
exit(2);
}
switch (ftype = filestat(fd)) {
case TTY:
fprintf(stderr, "filetype(fd) = TTY\n");
break;
case DISK:
fprintf(stderr, "filetype(fd) = DISK\n");
break;
case DIRECTORY:
fprintf(stderr, "filetype(fd) = DIRECTORY\n");
break;
case TAPE:
fprintf(stderr, "filetype(fd) = TAPE\n");
break;
case PIPE:
fprintf(stderr, "filetype(fd) = PIPE\n");
break;
case BADFILETYPE:
fprintf(stderr, "filetype(argv[1]) = BADFILETYPE\n");
break;
default:
fprintf(stderr, "filestat(argv[1]) failed: ftype = %d\n", ftype);
}
fprintf(stderr, "Checking printstat ...\n");
/* Print filetype of stdin */
fprintf(stderr, "filetype(STDIN) = %s\n", printstat(STDIN));
/* Print filetype of stdout */
fprintf(stderr, "filetype(STDOUT) = %s\n", printstat(STDOUT));
/* Print filetype of argv[1] */
if (argc == 1) {
fprintf(stderr, "no filename given\n");
exit(1);
}
if (-1 == (fd = open(argv[1], O_RDONLY))) {
fprintf(stderr, "can't open %s", argv[1]);
exit(2);
}
fprintf(stderr, "filetype(fd) = %s\n", printstat(fd));
exit(0);
}
| {
"pile_set_name": "Github"
} |
const Query = {};
module.exports = Query;
| {
"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.
*/
/**
* ADOBTest.java
* Copyright (C) 2014 Santos, Goncalves, Barros
*/
package moa.classifiers.meta;
import junit.framework.Test;
import junit.framework.TestSuite;
import moa.classifiers.AbstractMultipleClassifierTestCase;
import moa.classifiers.Classifier;
import static moa.test.MoaTestCase.runTest;
/**
* Tests the ADOB classifier.
*
* @author Silas G. T. C. Santos ([email protected])
* @version $Revision$
*/
public class ADOBTest
extends AbstractMultipleClassifierTestCase {
/**
* Constructs the test case. Called by subclasses.
*
* @param name the name of the test
*/
public ADOBTest(String name) {
super(name);
this.setNumberTests(1);
}
/**
* Returns the classifier setups to use in the regression test.
*
* @return the setups
*/
@Override
protected Classifier[] getRegressionClassifierSetups() {
return new Classifier[]{
new ADOB(),
};
}
/**
* Returns a test suite.
*
* @return the test suite
*/
public static Test suite() {
return new TestSuite(ADOBTest.class);
}
/**
* Runs the test from commandline.
*
* @param args ignored
*/
public static void main(String[] args) {
runTest(suite());
}
}
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: a4d535f8a2dfe9945bccfceb59767bbe
timeCreated: 1445946492
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
import * as React from "react";
import Loader from "../../Loader";
import DocRefEditor, { useDocRefEditor } from "../DocRefEditor";
import { SwitchedDocRefEditorProps } from "../DocRefEditor/types";
import { useDocumentApi } from "components/DocumentEditors/useDocumentApi";
import ThemedAceEditor from "components/ThemedAceEditor";
import { DictionaryDoc } from "components/DocumentEditors/useDocumentApi/types/dictionaryDoc";
const DictionaryEditor: React.FunctionComponent<SwitchedDocRefEditorProps> = ({
docRefUuid,
}) => {
// Get data from and subscribe to the store
const documentApi = useDocumentApi<"Dictionary", DictionaryDoc>("Dictionary");
const { onDocumentChange, editorProps } = useDocRefEditor<DictionaryDoc>({
docRefUuid,
documentApi,
});
const { docRefContents } = editorProps;
const onDataChange = React.useCallback(
(value) => onDocumentChange({ data: value }),
[onDocumentChange],
);
return !!docRefContents ? (
<DocRefEditor {...editorProps}>
<ThemedAceEditor
style={{ width: "100%", height: "100%", minHeight: "25rem" }}
name={`${docRefUuid}-ace-editor`}
mode="xml"
value={docRefContents.data || ""}
onChange={onDataChange}
/>
</DocRefEditor>
) : (
<Loader message={`Loading DictionaryDoc ${docRefUuid}`} />
);
};
export default DictionaryEditor;
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace tik4net.Objects
{
/// <summary>
/// Cache for extracted metadata about mikrotik entities for entity mapper.
/// Main reason is to improve performance via caching slow reflection operations.
/// </summary>
/// <remarks>Cache is thread-safe.</remarks>
/// <seealso cref="TikEntityAttribute"/>
/// <seealso cref="TikPropertyAttribute"/>
/// <seealso cref="TikEntityMetadata"/>
public static class TikEntityMetadataCache
{
private static readonly object _lockObj = new object();
private static Dictionary<Type, TikEntityMetadata> _cache = new Dictionary<Type, TikEntityMetadata>();
/// <summary>
/// Gets (or creates new) <typeparamref name="TEntity"/> metadata via reflection of its attributes.
/// </summary>
/// <typeparam name="TEntity">Type of the entity.</typeparam>
/// <returns>Entity metadata used by entity mapper.</returns>
public static TikEntityMetadata GetMetadata<TEntity>()
{
Type key = typeof(TEntity);
TikEntityMetadata result;
if (!_cache.TryGetValue(key, out result))
{
lock (_lockObj)
{
if (!_cache.TryGetValue(key, out result))
{
result = new TikEntityMetadata(typeof(TEntity));
_cache.Add(key, result);
}
}
}
return result;
}
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0"?>
<doc>
<assembly>
<name>Microsoft.Threading.Tasks.Extensions</name>
</assembly>
<members>
<member name="M:System.Threading.Tasks.TaskServices.FromCancellation(System.Threading.CancellationToken)">
<summary>Returns a canceled task.</summary>
<param name="cancellationToken">The cancellation token.</param>
<returns>The canceled task.</returns>
</member>
<member name="M:System.Threading.Tasks.TaskServices.FromCancellation``1(System.Threading.CancellationToken)">
<summary>Returns a canceled task.</summary>
<typeparam name="TResult">Specifies the type of the result.</typeparam>
<param name="cancellationToken">The cancellation token.</param>
<returns>The canceled task.</returns>
</member>
<member name="M:System.Threading.Tasks.TaskServices.HandleEapCompletion``1(System.Threading.Tasks.TaskCompletionSource{``0},System.Boolean,System.ComponentModel.AsyncCompletedEventArgs,System.Func{``0},System.Action)">
<summary>
Completes the Task if the user state matches the TaskCompletionSource.
</summary>
<typeparam name="T">Specifies the type of data returned by the Task.</typeparam>
<param name="tcs">The TaskCompletionSource.</param>
<param name="e">The completion event arguments.</param>
<param name="requireMatch">Whether we require the tcs to match the e.UserState.</param>
<param name="getResult">A function that gets the result with which to complete the task.</param>
<param name="unregisterHandler">An action used to unregister work when the operaiton completes.</param>
</member>
<member name="T:AsyncExtensions">
<summary>
Provides asynchronous wrappers for .NET Framework operations.
</summary>
</member>
<member name="M:AsyncExtensions.ReadAsync(System.IO.Stream,System.Byte[],System.Int32,System.Int32)">
<summary>
Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
</summary>
<returns>A Task that represents the asynchronous read.</returns>
<param name="source">The source.</param>
<param name="buffer">The buffer to read data into. </param>
<param name="offset">The byte offset in at which to begin reading. </param>
<param name="count">The maximum number of bytes to read. </param>
<exception cref="T:System.ArgumentException">The array length minus is less than <paramref name="count" />. </exception>
<exception cref="T:System.ArgumentNullException"> is null. </exception>
<exception cref="T:System.ArgumentOutOfRangeException"> or <paramref name="count" /> is negative. </exception>
<exception cref="T:System.IO.IOException">An asynchronous read was attempted past the end of the file. </exception>
</member>
<member name="M:AsyncExtensions.ReadAsync(System.IO.Stream,System.Byte[],System.Int32,System.Int32,System.Threading.CancellationToken)">
<summary>
Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
</summary>
<returns>A Task that represents the asynchronous read.</returns>
<param name="source">The source.</param>
<param name="buffer">The buffer to read data into. </param>
<param name="offset">The byte offset in at which to begin reading. </param>
<param name="count">The maximum number of bytes to read. </param>
<param name="cancellationToken">The cancellation token.</param>
<exception cref="T:System.ArgumentException">The array length minus is less than <paramref name="count" />. </exception>
<exception cref="T:System.ArgumentNullException"> is null. </exception>
<exception cref="T:System.ArgumentOutOfRangeException"> or <paramref name="count" /> is negative. </exception>
<exception cref="T:System.IO.IOException">An asynchronous read was attempted past the end of the file. </exception>
</member>
<member name="M:AsyncExtensions.WriteAsync(System.IO.Stream,System.Byte[],System.Int32,System.Int32)">
<summary>
Writes asynchronously a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
</summary>
<returns>A Task that represents the asynchronous write.</returns>
<param name="source">The source.</param>
<param name="buffer">The buffer containing data to write to the current stream.</param>
<param name="offset">The zero-based byte offset in at which to begin copying bytes to the current stream.</param>
<param name="count">The maximum number of bytes to write. </param>
<exception cref="T:System.ArgumentException"> length minus <paramref name="offset" /> is less than <paramref name="count" />. </exception>
<exception cref="T:System.ArgumentNullException"> is null. </exception>
<exception cref="T:System.ArgumentOutOfRangeException"> or <paramref name="count" /> is negative. </exception>
<exception cref="T:System.NotSupportedException">The stream does not support writing. </exception>
<exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
<exception cref="T:System.IO.IOException">An I/O error occurred. </exception>
</member>
<member name="M:AsyncExtensions.WriteAsync(System.IO.Stream,System.Byte[],System.Int32,System.Int32,System.Threading.CancellationToken)">
<summary>
Writes asynchronously a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
</summary>
<returns>A Task that represents the asynchronous write.</returns>
<param name="source">The source.</param>
<param name="buffer">The buffer containing data to write to the current stream.</param>
<param name="offset">The zero-based byte offset in at which to begin copying bytes to the current stream.</param>
<param name="count">The maximum number of bytes to write. </param>
<param name="cancellationToken">The cancellation token.</param>
<exception cref="T:System.ArgumentException"> length minus <paramref name="offset" /> is less than <paramref name="count" />. </exception>
<exception cref="T:System.ArgumentNullException"> is null. </exception>
<exception cref="T:System.ArgumentOutOfRangeException"> or <paramref name="count" /> is negative. </exception>
<exception cref="T:System.NotSupportedException">The stream does not support writing. </exception>
<exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
<exception cref="T:System.IO.IOException">An I/O error occurred. </exception>
</member>
<member name="M:AsyncExtensions.FlushAsync(System.IO.Stream)">
<summary>
Flushes asynchronously the current stream.
</summary>
<returns>A Task that represents the asynchronous flush.</returns>
</member>
<member name="M:AsyncExtensions.FlushAsync(System.IO.Stream,System.Threading.CancellationToken)">
<summary>
Flushes asynchronously the current stream.
</summary>
<returns>A Task that represents the asynchronous flush.</returns>
</member>
<member name="M:AsyncExtensions.CopyToAsync(System.IO.Stream,System.IO.Stream)">
<summary>
Reads all the bytes from the current stream and writes them to the destination stream.
</summary>
<param name="source">The source stream.</param>
<param name="destination">The stream that will contain the contents of the current stream.</param>
<returns>A Task that represents the asynchronous operation.</returns>
</member>
<member name="M:AsyncExtensions.CopyToAsync(System.IO.Stream,System.IO.Stream,System.Int32)">
<summary>
Reads all the bytes from the current stream and writes them to the destination stream.
</summary>
<param name="source">The source stream.</param>
<param name="destination">The stream that will contain the contents of the current stream.</param>
<param name="bufferSize">The size of the buffer. This value must be greater than zero. The default size is 4096.</param>
<returns>A Task that represents the asynchronous operation.</returns>
</member>
<member name="M:AsyncExtensions.CopyToAsync(System.IO.Stream,System.IO.Stream,System.Int32,System.Threading.CancellationToken)">
<summary>
Reads all the bytes from the current stream and writes them to the destination stream.
</summary>
<param name="source">The source stream.</param>
<param name="destination">The stream that will contain the contents of the current stream.</param>
<param name="bufferSize">The size of the buffer. This value must be greater than zero. The default size is 4096.</param>
<param name="cancellationToken">The cancellation token to use to cancel the asynchronous operation.</param>
<returns>A Task that represents the asynchronous operation.</returns>
</member>
<member name="M:AsyncExtensions.CopyToAsyncInternal(System.IO.Stream,System.IO.Stream,System.Int32,System.Threading.CancellationToken)">
<summary>
Reads all the bytes from the current stream and writes them to the destination stream.
</summary>
<param name="source">The source stream.</param>
<param name="destination">The stream that will contain the contents of the current stream.</param>
<param name="bufferSize">The size of the buffer. This value must be greater than zero. The default size is 4096.</param>
<param name="cancellationToken">The cancellation token to use to cancel the asynchronous operation.</param>
<returns>A Task that represents the asynchronous operation.</returns>
</member>
<member name="M:AsyncExtensions.ReadAsync(System.IO.TextReader,System.Char[],System.Int32,System.Int32)">
<summary>
Reads a maximum of count characters from the reader asynchronously and writes
the data to buffer, beginning at index.
</summary>
<param name="buffer">
When the operation completes, contains the specified character array with the
values between index and (index + count - 1) replaced by the characters read
from the current source.
</param>
<param name="count">
The maximum number of characters to read. If the end of the stream is reached
before count of characters is read into buffer, the current method returns.
</param>
<param name="index">The place in buffer at which to begin writing.</param>
<param name="source">the source reader.</param>
<returns>A Task that represents the asynchronous operation.</returns>
</member>
<member name="M:AsyncExtensions.ReadBlockAsync(System.IO.TextReader,System.Char[],System.Int32,System.Int32)">
<summary>
Reads asynchronously a maximum of count characters from the current stream, and writes the
data to buffer, beginning at index.
</summary>
<param name="source">The source reader.</param>
<param name="buffer">
When this method returns, this parameter contains the specified character
array with the values between index and (index + count -1) replaced by the
characters read from the current source.
</param>
<param name="index">The position in buffer at which to begin writing.</param>
<param name="count">The maximum number of characters to read.</param>
<returns>A Task that represents the asynchronous operation.</returns>
</member>
<member name="M:AsyncExtensions.ReadLineAsync(System.IO.TextReader)">
<summary>
Reads a line of characters from the reader and returns the string asynchronously.
</summary>
<param name="source">the source reader.</param>
<returns>A Task that represents the asynchronous operation.</returns>
</member>
<member name="M:AsyncExtensions.ReadToEndAsync(System.IO.TextReader)">
<summary>
Reads all characters from the current position to the end of the TextReader
and returns them as one string asynchronously.
</summary>
<param name="source">the source reader.</param>
<returns>A Task that represents the asynchronous operation.</returns>
</member>
<member name="M:AsyncExtensions.WriteAsync(System.IO.TextWriter,System.String)">
<summary>Writes a string asynchronously to a text stream.</summary>
<param name="target">The writer.</param>
<param name="value">The string to write.</param>
<returns>A Task representing the asynchronous write.</returns>
</member>
<member name="M:AsyncExtensions.WriteAsync(System.IO.TextWriter,System.Char)">
<summary>Writes a char asynchronously to a text stream.</summary>
<param name="target">The writer.</param>
<param name="value">The char to write.</param>
<returns>A Task representing the asynchronous write.</returns>
</member>
<member name="M:AsyncExtensions.WriteAsync(System.IO.TextWriter,System.Char[])">
<summary>Writes a char array asynchronously to a text stream.</summary>
<param name="target">The writer.</param>
<param name="buffer">The buffer to write.</param>
<returns>A Task representing the asynchronous write.</returns>
</member>
<member name="M:AsyncExtensions.WriteAsync(System.IO.TextWriter,System.Char[],System.Int32,System.Int32)">
<summary>Writes a subarray of characters asynchronously to a text stream.</summary>
<param name="target">The writer.</param>
<param name="buffer">The buffer to write.</param>
<param name="index">Starting index in the buffer.</param>
<param name="count">The number of characters to write.</param>
<returns>A Task representing the asynchronous write.</returns>
</member>
<member name="M:AsyncExtensions.WriteLineAsync(System.IO.TextWriter)">
<summary>Writes a line terminator asynchronously to a text stream.</summary>
<param name="target">The writer.</param>
<returns>A Task representing the asynchronous write.</returns>
</member>
<member name="M:AsyncExtensions.WriteLineAsync(System.IO.TextWriter,System.String)">
<summary>Writes a string followed by a line terminator asynchronously to a text stream.</summary>
<param name="target">The writer.</param>
<param name="value">The string to write.</param>
<returns>A Task representing the asynchronous write.</returns>
</member>
<member name="M:AsyncExtensions.WriteLineAsync(System.IO.TextWriter,System.Char)">
<summary>Writes a char followed by a line terminator asynchronously to a text stream.</summary>
<param name="target">The writer.</param>
<param name="value">The char to write.</param>
<returns>A Task representing the asynchronous write.</returns>
</member>
<member name="M:AsyncExtensions.WriteLineAsync(System.IO.TextWriter,System.Char[])">
<summary>Writes a char array followed by a line terminator asynchronously to a text stream.</summary>
<param name="target">The writer.</param>
<param name="buffer">The buffer to write.</param>
<returns>A Task representing the asynchronous write.</returns>
</member>
<member name="M:AsyncExtensions.WriteLineAsync(System.IO.TextWriter,System.Char[],System.Int32,System.Int32)">
<summary>Writes a subarray of characters followed by a line terminator asynchronously to a text stream.</summary>
<param name="target">The writer.</param>
<param name="buffer">The buffer to write.</param>
<param name="index">Starting index in the buffer.</param>
<param name="count">The number of characters to write.</param>
<returns>A Task representing the asynchronous write.</returns>
</member>
<member name="M:AsyncExtensions.FlushAsync(System.IO.TextWriter)">
<summary>
Clears all buffers for the current writer and causes any buffered data to
be written to the underlying device.
</summary>
<param name="target">The writer.</param>
<returns>A Task representing the asynchronous flush.</returns>
</member>
<member name="M:AsyncExtensions.GetResponseAsync(System.Net.WebRequest)">
<summary>Starts an asynchronous request for a web resource.</summary>
<returns>Task that represents the asynchronous request.</returns>
<exception cref="T:System.InvalidOperationException">The stream is already in use by a previous call to . </exception>
<PermissionSet> <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> </PermissionSet>
<param name="source">The source.</param>
</member>
<member name="M:AsyncExtensions.GetRequestStreamAsync(System.Net.WebRequest)">
<summary>Starts an asynchronous request for a object to use to write data.</summary>
<returns>Task that represents the asynchronous request.</returns>
<exception cref="T:System.Net.ProtocolViolationException">The property is GET and the application writes to the stream. </exception>
<exception cref="T:System.InvalidOperationException">The stream is being used by a previous call to . </exception>
<exception cref="T:System.ApplicationException">No write stream is available. </exception>
<PermissionSet> <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> </PermissionSet>
<param name="source">The source.</param>
</member>
</members>
</doc>
| {
"pile_set_name": "Github"
} |
---
archs: [ armv7, armv7s, arm64, arm64e ]
platform: ios
install-name: /System/Library/PrivateFrameworks/SignpostMetrics.framework/SignpostMetrics
current-version: 42.2
compatibility-version: 1
exports:
- archs: [ armv7, armv7s, arm64, arm64e ]
symbols: [ _SignpostMetricsVersionNumber,
_SignpostMetricsVersionString,
__MXSignpostMetricsSnapshot ]
objc-classes: [ _SignpostMetricsSnapshotter ]
...
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.0 Partwise//EN"
"http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise>
<identification>
<miscellaneous>
<miscellaneous-field name="description">Each note of a chord can have
some lyrics attached. In this case, each note of the chord has lyrics
of the form "Lyrics [123]" attached, where each lyrics has a different
number attribute to distinguish them. These syllables should be
imported into three different stanzas and the timing should be
correct.</miscellaneous-field>
</miscellaneous>
</identification>
<part-list>
<score-part id="P1">
<part-name>MusicXML Part</part-name>
</score-part>
</part-list>
<!--=========================================================-->
<part id="P1">
<measure number="1">
<attributes>
<divisions>1</divisions>
<key>
<fifths>0</fifths>
<mode>major</mode>
</key>
<time symbol="common">
<beats>4</beats>
<beat-type>4</beat-type>
</time>
<clef>
<sign>G</sign>
<line>2</line>
</clef>
</attributes>
<note>
<pitch>
<step>E</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<lyric number="1"><text>Lyrics 1</text></lyric>
</note>
<note>
<chord/>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<lyric number="2"><text>Lyrics 2</text></lyric>
</note>
<note>
<chord/>
<pitch>
<step>A</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<lyric number="3"><text>Lyrics 3</text></lyric>
</note>
</measure>
</part>
</score-partwise>
| {
"pile_set_name": "Github"
} |
.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "SSL_CTX_SET_RECORD_PADDING_CALLBACK 3"
.TH SSL_CTX_SET_RECORD_PADDING_CALLBACK 3 "2020-09-22" "1.1.1h" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
SSL_CTX_set_record_padding_callback, SSL_set_record_padding_callback, SSL_CTX_set_record_padding_callback_arg, SSL_set_record_padding_callback_arg, SSL_CTX_get_record_padding_callback_arg, SSL_get_record_padding_callback_arg, SSL_CTX_set_block_padding, SSL_set_block_padding \- install callback to specify TLS 1.3 record padding
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& #include <openssl/ssl.h>
\&
\& void SSL_CTX_set_record_padding_callback(SSL_CTX *ctx, size_t (*cb)(SSL *s, int type, size_t len, void *arg));
\& void SSL_set_record_padding_callback(SSL *ssl, size_t (*cb)(SSL *s, int type, size_t len, void *arg));
\&
\& void SSL_CTX_set_record_padding_callback_arg(SSL_CTX *ctx, void *arg);
\& void *SSL_CTX_get_record_padding_callback_arg(const SSL_CTX *ctx);
\&
\& void SSL_set_record_padding_callback_arg(SSL *ssl, void *arg);
\& void *SSL_get_record_padding_callback_arg(const SSL *ssl);
\&
\& int SSL_CTX_set_block_padding(SSL_CTX *ctx, size_t block_size);
\& int SSL_set_block_padding(SSL *ssl, size_t block_size);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\fBSSL_CTX_set_record_padding_callback()\fR or \fBSSL_set_record_padding_callback()\fR
can be used to assign a callback function \fIcb\fR to specify the padding
for \s-1TLS 1.3\s0 records. The value set in \fBctx\fR is copied to a new \s-1SSL\s0 by \fBSSL_new()\fR.
.PP
\&\fBSSL_CTX_set_record_padding_callback_arg()\fR and \fBSSL_set_record_padding_callback_arg()\fR
assign a value \fBarg\fR that is passed to the callback when it is invoked. The value
set in \fBctx\fR is copied to a new \s-1SSL\s0 by \fBSSL_new()\fR.
.PP
\&\fBSSL_CTX_get_record_padding_callback_arg()\fR and \fBSSL_get_record_padding_callback_arg()\fR
retrieve the \fBarg\fR value that is passed to the callback.
.PP
\&\fBSSL_CTX_set_block_padding()\fR and \fBSSL_set_block_padding()\fR pads the record to a multiple
of the \fBblock_size\fR. A \fBblock_size\fR of 0 or 1 disables block padding. The limit of
\&\fBblock_size\fR is \s-1SSL3_RT_MAX_PLAIN_LENGTH.\s0
.PP
The callback is invoked for every record before encryption.
The \fBtype\fR parameter is the \s-1TLS\s0 record type that is being processed; may be
one of \s-1SSL3_RT_APPLICATION_DATA, SSL3_RT_HANDSHAKE,\s0 or \s-1SSL3_RT_ALERT.\s0
The \fBlen\fR parameter is the current plaintext length of the record before encryption.
The \fBarg\fR parameter is the value set via \fBSSL_CTX_set_record_padding_callback_arg()\fR
or \fBSSL_set_record_padding_callback_arg()\fR.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
The \fBSSL_CTX_get_record_padding_callback_arg()\fR and \fBSSL_get_record_padding_callback_arg()\fR
functions return the \fBarg\fR value assigned in the corresponding set functions.
.PP
The \fBSSL_CTX_set_block_padding()\fR and \fBSSL_set_block_padding()\fR functions return 1 on success
or 0 if \fBblock_size\fR is too large.
.PP
The \fBcb\fR returns the number of padding bytes to add to the record. A return of 0
indicates no padding will be added. A return value that causes the record to
exceed the maximum record size (\s-1SSL3_RT_MAX_PLAIN_LENGTH\s0) will pad out to the
maximum record size.
.SH "NOTES"
.IX Header "NOTES"
The default behavior is to add no padding to the record.
.PP
A user-supplied padding callback function will override the behavior set by
\&\fBSSL_set_block_padding()\fR or \fBSSL_CTX_set_block_padding()\fR. Setting the user-supplied
callback to \s-1NULL\s0 will restore the configured block padding behavior.
.PP
These functions only apply to \s-1TLS 1.3\s0 records being written.
.PP
Padding bytes are not added in constant-time.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fBssl\fR\|(7), \fBSSL_new\fR\|(3)
.SH "HISTORY"
.IX Header "HISTORY"
The record padding \s-1API\s0 was added for \s-1TLS 1.3\s0 support in OpenSSL 1.1.1.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright 2017\-2019 The OpenSSL Project Authors. All Rights Reserved.
.PP
Licensed under the OpenSSL license (the \*(L"License\*(R"). You may not use
this file except in compliance with the License. You can obtain a copy
in the file \s-1LICENSE\s0 in the source distribution or at
<https://www.openssl.org/source/license.html>.
| {
"pile_set_name": "Github"
} |
module Cradle.Grammar.Boolean
where
import Cradle.Parser
import Cradle.Grammar.Expressions
data BoolExpression =
BVar String
| BTrue
| BFalse
| BAnd BoolExpression BoolExpression
| BOr BoolExpression BoolExpression
| BNot BoolExpression
| BExp Expression
| REqual BoolExpression BoolExpression
| RNotEqual BoolExpression BoolExpression
| RGreaterThan BoolExpression BoolExpression
| RLessThan BoolExpression BoolExpression
| RGreaterThanOrEqualTo BoolExpression BoolExpression
| RLessThanOrEqualTo BoolExpression BoolExpression
deriving (Show)
boolExpression :: Parser BoolExpression
boolExpression = token(bFactor) +> boolExpression'
boolExpression' e = boolOp <+> bFactor >>> buildRelOp e +> boolExpression'
<|> result e
bFactor :: Parser BoolExpression
bFactor = token(literal '(') <-+> boolExpression <+-> token(literal ')')
<|> relExpression
<|> bNot <+> bLiteral >>> (\(n, lit) -> n lit)
<|> bLiteral
<|> bNot <+> bVar >>> (\(n, lit) -> n lit)
<|> bVar
relExpression :: Parser BoolExpression
relExpression = bExpression +> relExpression'
relExpression' e = relOp <+> bExpression >>> buildRelOp e +> relExpression'
<|> result e
bExpression :: Parser BoolExpression
bExpression = token expression >>> BExp
bNot :: Parser(BoolExpression -> BoolExpression)
bNot = token(literal '!') >>> (\_ -> BNot)
bVar :: Parser BoolExpression
bVar = letters >>> BVar
bLiteral :: Parser BoolExpression
bLiteral = acceptWord "true" >>> (\_ -> BTrue)
<|> acceptWord "false" >>> (\_ -> BFalse)
boolOp :: Parser (BoolExpression -> BoolExpression -> BoolExpression)
boolOp = token(accept "&&") >>> (\_ -> BAnd)
<|> token(accept "||") >>> (\_ -> BOr)
relOp :: Parser (BoolExpression -> BoolExpression -> BoolExpression)
relOp = token(accept ">=") >>> (\_ -> RGreaterThanOrEqualTo)
<|> token(accept "<=") >>> (\_ -> RLessThanOrEqualTo)
<|> token(literal '>') >>> (\_ -> RGreaterThan)
<|> token(literal '<') >>> (\_ -> RLessThan)
<|> token(accept "==") >>> (\_ -> REqual)
<|> token(accept "!=") >>> (\_ -> RNotEqual)
buildRelOp :: BoolExpression -> ((BoolExpression -> BoolExpression -> BoolExpression), BoolExpression) -> BoolExpression
buildRelOp expressionA (op, expressionB) = op expressionA expressionB | {
"pile_set_name": "Github"
} |
<?xml version='1.0' ?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="StandardTransforms.xsl"/>
<xsl:output method="xml" omit-xml-declaration="no"/>
<xsl:template match="/">
<xsl:element name="StorageNodes">
<xsl:apply-templates select="Device"/>
</xsl:element>
</xsl:template>
<xsl:template match="Device">
<xsl:element name="Storage">
<xsl:attribute name="type">string</xsl:attribute>
<xsl:attribute name="name">DeviceDesc</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="DeviceDesc"/></xsl:attribute>
</xsl:element>
<xsl:element name="Storage">
<xsl:attribute name="type">string</xsl:attribute>
<xsl:attribute name="name">Driver</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="Driver"/></xsl:attribute>
</xsl:element>
<xsl:element name="Storage">
<xsl:attribute name="type">string</xsl:attribute>
<xsl:attribute name="name">FriendlyName</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="FriendlyName"/></xsl:attribute>
</xsl:element>
<xsl:element name="Storage">
<xsl:attribute name="type">string</xsl:attribute>
<xsl:attribute name="name">HwdID</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="HardwareID"/></xsl:attribute>
</xsl:element>
<xsl:element name="Storage">
<xsl:attribute name="type">string</xsl:attribute>
<xsl:attribute name="name">LocationInfo</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="LocationInfo"/></xsl:attribute>
</xsl:element>
<xsl:element name="Storage">
<xsl:attribute name="type">string</xsl:attribute>
<xsl:attribute name="name">Mfg</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="Mfg"/></xsl:attribute>
</xsl:element>
<xsl:element name="Storage">
<xsl:attribute name="type">string</xsl:attribute>
<xsl:attribute name="name">PhysDevObjName</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="PhysDevObjName"/></xsl:attribute>
</xsl:element>
<xsl:element name="Storage">
<xsl:attribute name="type">string</xsl:attribute>
<xsl:attribute name="name">ServPth</xsl:attribute>
<xsl:attribute name="value"><xsl:value-of select="ServicePath"/></xsl:attribute>
</xsl:element>
</xsl:template>
</xsl:transform> | {
"pile_set_name": "Github"
} |
name=fooMock
type=com.consol.citrus.spi.mocks.Foo
| {
"pile_set_name": "Github"
} |
var baseGetAllKeys = require('./_baseGetAllKeys'),
getSymbolsIn = require('./_getSymbolsIn'),
keysIn = require('./keysIn');
/**
* Creates an array of own and inherited enumerable property names and
* symbols of `object`.
*
* @private
* @param {Object} object The object to query.
* @returns {Array} Returns the array of property names and symbols.
*/
function getAllKeysIn(object) {
return baseGetAllKeys(object, keysIn, getSymbolsIn);
}
module.exports = getAllKeysIn;
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of the License "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// e32\euser\epoc\x86\uc_exec.cia
//
//
#define __GEN_USER_EXEC_CODE__
#include <e32svr.h>
#include <u32exec.h>
/******************************************************************************
* Slow executive calls with preprocessing or extra arguments
******************************************************************************/
__NAKED__ TInt Exec::SessionSend(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
//
// Send a blind message to the server.
//
{
SLOW_EXEC4(EExecSessionSend);
}
__NAKED__ TInt Exec::SessionSendSync(TInt /*aHandle*/, TInt /*aFunction*/, TAny* /*aPtr*/, TRequestStatus* /*aStatus*/)
//
// Send a blind message to the server using thread's dedicated message slot.
//
{
SLOW_EXEC4(EExecSessionSendSync);
}
__NAKED__ TInt Exec::MessageIpcCopy(TInt /*aHandle*/, TInt /*aParam*/, SIpcCopyInfo& /*aInfo*/, TInt /*anOffset*/)
//
// IPC transfer using message handle
//
{
SLOW_EXEC4(EExecMessageIpcCopy);
}
__NAKED__ TInt Exec::BTraceOut(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/)
{
SLOW_EXEC4(EExecBTraceOut);
}
__NAKED__ TInt Exec::BTraceOutBig(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/)
{
SLOW_EXEC4(EExecBTraceOutBig);
}
__NAKED__ TInt Exec::UTraceOut(TUint32 /*a0*/, TUint32 /*a1*/, const BTrace::SExecExtension& /*aExtension*/, TInt /*aDataSize*/)
{
SLOW_EXEC4(EExecUTraceOut);
}
__NAKED__ void ExitCurrentThread(TExitType /*aType*/, TInt /*aReason*/, const TDesC8* /*aCategory*/)
{
asm("mov eax, %0": : "i"(EExecThreadKill));
asm("push ebx"); // push these anyway for debug
asm("push esi");
asm("mov ecx, %0": : "i"(0xffff8001)); // gcc/gas doesnt like KCurrentThreadHandle
asm("mov edx, [esp+12]");
asm("mov ebx, [esp+16]");
asm("mov esi, [esp+20]");
asm("int 0x21");
// doesn't return
}
EXPORT_C __NAKED__ void RThread::RequestComplete(TRequestStatus*& aStatus, TInt aReason) const
/**
Signals this thread that an asynchronous request originating from this thread,
is complete.
The request is associated with the specified request status object supplied
by this thread.
Typically, the caller of this function is the service provider responsible
for satisfying the request made by this thread.
The request is completed with the completion code passed in aReason. This
value is copied into this thread's request status, *aStatus, before signalling
this thread's request semaphore.
The meaning of the completion code is a matter of convention to be decided
between the service provider and this thread.
In a client-server situation, completion of a request takes place in the context
of the server thread, but the pointer is interpreted in the address space
of the client.
It is often the case in client-server situations that the client and the server
are in the same address space (i.e. the same process).
Setting the pointer to the request status to NULL is a convenience, not all
servers need it.
@param aStatus A reference to a pointer to the request status originally
supplied by this thread. This is a pointer into this thread's
address space, which may be different to the thread currently
executing (this code). On return, the pointer to the request
status is set to NULL.
@param aReason The completion code of this request.
*/
//
// Signal a request completion.
// NOTE: __thiscall convention - we must remove parameters
//
{
THISCALL_PROLOG2()
asm("push ebx");
asm("mov ecx, [ecx]");
asm("mov eax, [esp+8]");
asm("mov ebx, [esp+12]");
asm("xor edx, edx");
asm("lock xchg edx, [eax]");
asm("cmp edx, 0");
asm("je ExecRequestComplete_ret");
asm("mov [edx], ebx"); // write to request status
asm("mov eax, %0": : "i"(EExecThreadRequestSignal));
asm("int 0x21");
asm("ExecRequestComplete_ret:");
asm("pop ebx");
THISCALL_EPILOG2()
}
| {
"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.pulsar.broker.admin.v1;
import io.swagger.annotations.Api;
import org.apache.pulsar.broker.admin.impl.ClustersBase;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/clusters")
@Api(value = "/clusters", description = "Cluster admin apis", tags = "clusters", hidden = true)
@Produces(MediaType.APPLICATION_JSON)
public class Clusters extends ClustersBase {
}
| {
"pile_set_name": "Github"
} |
;
; Definition file of d3dx9_37.dll
; Automatic generated by gendef
; written by Kai Tietz 2008
;
LIBRARY "d3dx9_37.dll"
EXPORTS
D3DXAssembleShader
D3DXAssembleShaderFromFileA
D3DXAssembleShaderFromFileW
D3DXAssembleShaderFromResourceA
D3DXAssembleShaderFromResourceW
D3DXBoxBoundProbe
D3DXCheckCubeTextureRequirements
D3DXCheckTextureRequirements
D3DXCheckVersion
D3DXCheckVolumeTextureRequirements
D3DXCleanMesh
D3DXColorAdjustContrast
D3DXColorAdjustSaturation
D3DXCompileShader
D3DXCompileShaderFromFileA
D3DXCompileShaderFromFileW
D3DXCompileShaderFromResourceA
D3DXCompileShaderFromResourceW
D3DXComputeBoundingBox
D3DXComputeBoundingSphere
D3DXComputeIMTFromPerTexelSignal
D3DXComputeIMTFromPerVertexSignal
D3DXComputeIMTFromSignal
D3DXComputeIMTFromTexture
D3DXComputeNormalMap
D3DXComputeNormals
D3DXComputeTangent
D3DXComputeTangentFrame
D3DXComputeTangentFrameEx
D3DXConcatenateMeshes
D3DXConvertMeshSubsetToSingleStrip
D3DXConvertMeshSubsetToStrips
D3DXCreateAnimationController
D3DXCreateBox
D3DXCreateBuffer
D3DXCreateCompressedAnimationSet
D3DXCreateCubeTexture
D3DXCreateCubeTextureFromFileA
D3DXCreateCubeTextureFromFileExA
D3DXCreateCubeTextureFromFileExW
D3DXCreateCubeTextureFromFileInMemory
D3DXCreateCubeTextureFromFileInMemoryEx
D3DXCreateCubeTextureFromFileW
D3DXCreateCubeTextureFromResourceA
D3DXCreateCubeTextureFromResourceExA
D3DXCreateCubeTextureFromResourceExW
D3DXCreateCubeTextureFromResourceW
D3DXCreateCylinder
D3DXCreateEffect
D3DXCreateEffectCompiler
D3DXCreateEffectCompilerFromFileA
D3DXCreateEffectCompilerFromFileW
D3DXCreateEffectCompilerFromResourceA
D3DXCreateEffectCompilerFromResourceW
D3DXCreateEffectEx
D3DXCreateEffectFromFileA
D3DXCreateEffectFromFileExA
D3DXCreateEffectFromFileExW
D3DXCreateEffectFromFileW
D3DXCreateEffectFromResourceA
D3DXCreateEffectFromResourceExA
D3DXCreateEffectFromResourceExW
D3DXCreateEffectFromResourceW
D3DXCreateEffectPool
D3DXCreateFontA
D3DXCreateFontIndirectA
D3DXCreateFontIndirectW
D3DXCreateFontW
D3DXCreateFragmentLinker
D3DXCreateFragmentLinkerEx
D3DXCreateKeyframedAnimationSet
D3DXCreateLine
D3DXCreateMatrixStack
D3DXCreateMesh
D3DXCreateMeshFVF
D3DXCreateNPatchMesh
D3DXCreatePMeshFromStream
D3DXCreatePRTBuffer
D3DXCreatePRTBufferTex
D3DXCreatePRTCompBuffer
D3DXCreatePRTEngine
D3DXCreatePatchMesh
D3DXCreatePolygon
D3DXCreateRenderToEnvMap
D3DXCreateRenderToSurface
D3DXCreateSPMesh
D3DXCreateSkinInfo
D3DXCreateSkinInfoFVF
D3DXCreateSkinInfoFromBlendedMesh
D3DXCreateSphere
D3DXCreateSprite
D3DXCreateTeapot
D3DXCreateTextA
D3DXCreateTextW
D3DXCreateTexture
D3DXCreateTextureFromFileA
D3DXCreateTextureFromFileExA
D3DXCreateTextureFromFileExW
D3DXCreateTextureFromFileInMemory
D3DXCreateTextureFromFileInMemoryEx
D3DXCreateTextureFromFileW
D3DXCreateTextureFromResourceA
D3DXCreateTextureFromResourceExA
D3DXCreateTextureFromResourceExW
D3DXCreateTextureFromResourceW
D3DXCreateTextureGutterHelper
D3DXCreateTextureShader
D3DXCreateTorus
D3DXCreateVolumeTexture
D3DXCreateVolumeTextureFromFileA
D3DXCreateVolumeTextureFromFileExA
D3DXCreateVolumeTextureFromFileExW
D3DXCreateVolumeTextureFromFileInMemory
D3DXCreateVolumeTextureFromFileInMemoryEx
D3DXCreateVolumeTextureFromFileW
D3DXCreateVolumeTextureFromResourceA
D3DXCreateVolumeTextureFromResourceExA
D3DXCreateVolumeTextureFromResourceExW
D3DXCreateVolumeTextureFromResourceW
D3DXDebugMute
D3DXDeclaratorFromFVF
D3DXDisassembleEffect
D3DXDisassembleShader
D3DXFVFFromDeclarator
D3DXFileCreate
D3DXFillCubeTexture
D3DXFillCubeTextureTX
D3DXFillTexture
D3DXFillTextureTX
D3DXFillVolumeTexture
D3DXFillVolumeTextureTX
D3DXFilterTexture
D3DXFindShaderComment
D3DXFloat16To32Array
D3DXFloat32To16Array
D3DXFrameAppendChild
D3DXFrameCalculateBoundingSphere
D3DXFrameDestroy
D3DXFrameFind
D3DXFrameNumNamedMatrices
D3DXFrameRegisterNamedMatrices
D3DXFresnelTerm
D3DXGatherFragments
D3DXGatherFragmentsFromFileA
D3DXGatherFragmentsFromFileW
D3DXGatherFragmentsFromResourceA
D3DXGatherFragmentsFromResourceW
D3DXGenerateOutputDecl
D3DXGeneratePMesh
D3DXGetDeclLength
D3DXGetDeclVertexSize
D3DXGetDriverLevel
D3DXGetFVFVertexSize
D3DXGetImageInfoFromFileA
D3DXGetImageInfoFromFileInMemory
D3DXGetImageInfoFromFileW
D3DXGetImageInfoFromResourceA
D3DXGetImageInfoFromResourceW
D3DXGetPixelShaderProfile
D3DXGetShaderConstantTable
D3DXGetShaderConstantTableEx
D3DXGetShaderInputSemantics
D3DXGetShaderOutputSemantics
D3DXGetShaderSamplers
D3DXGetShaderSize
D3DXGetShaderVersion
D3DXGetVertexShaderProfile
D3DXIntersect
D3DXIntersectSubset
D3DXIntersectTri
D3DXLoadMeshFromXA
D3DXLoadMeshFromXInMemory
D3DXLoadMeshFromXResource
D3DXLoadMeshFromXW
D3DXLoadMeshFromXof
D3DXLoadMeshHierarchyFromXA
D3DXLoadMeshHierarchyFromXInMemory
D3DXLoadMeshHierarchyFromXW
D3DXLoadPRTBufferFromFileA
D3DXLoadPRTBufferFromFileW
D3DXLoadPRTCompBufferFromFileA
D3DXLoadPRTCompBufferFromFileW
D3DXLoadPatchMeshFromXof
D3DXLoadSkinMeshFromXof
D3DXLoadSurfaceFromFileA
D3DXLoadSurfaceFromFileInMemory
D3DXLoadSurfaceFromFileW
D3DXLoadSurfaceFromMemory
D3DXLoadSurfaceFromResourceA
D3DXLoadSurfaceFromResourceW
D3DXLoadSurfaceFromSurface
D3DXLoadVolumeFromFileA
D3DXLoadVolumeFromFileInMemory
D3DXLoadVolumeFromFileW
D3DXLoadVolumeFromMemory
D3DXLoadVolumeFromResourceA
D3DXLoadVolumeFromResourceW
D3DXLoadVolumeFromVolume
D3DXMatrixAffineTransformation
D3DXMatrixAffineTransformation2D
D3DXMatrixDecompose
D3DXMatrixDeterminant
D3DXMatrixInverse
D3DXMatrixLookAtLH
D3DXMatrixLookAtRH
D3DXMatrixMultiply
D3DXMatrixMultiplyTranspose
D3DXMatrixOrthoLH
D3DXMatrixOrthoOffCenterLH
D3DXMatrixOrthoOffCenterRH
D3DXMatrixOrthoRH
D3DXMatrixPerspectiveFovLH
D3DXMatrixPerspectiveFovRH
D3DXMatrixPerspectiveLH
D3DXMatrixPerspectiveOffCenterLH
D3DXMatrixPerspectiveOffCenterRH
D3DXMatrixPerspectiveRH
D3DXMatrixReflect
D3DXMatrixRotationAxis
D3DXMatrixRotationQuaternion
D3DXMatrixRotationX
D3DXMatrixRotationY
D3DXMatrixRotationYawPitchRoll
D3DXMatrixRotationZ
D3DXMatrixScaling
D3DXMatrixShadow
D3DXMatrixTransformation
D3DXMatrixTransformation2D
D3DXMatrixTranslation
D3DXMatrixTranspose
D3DXOptimizeFaces
D3DXOptimizeVertices
D3DXPlaneFromPointNormal
D3DXPlaneFromPoints
D3DXPlaneIntersectLine
D3DXPlaneNormalize
D3DXPlaneTransform
D3DXPlaneTransformArray
D3DXPreprocessShader
D3DXPreprocessShaderFromFileA
D3DXPreprocessShaderFromFileW
D3DXPreprocessShaderFromResourceA
D3DXPreprocessShaderFromResourceW
D3DXQuaternionBaryCentric
D3DXQuaternionExp
D3DXQuaternionInverse
D3DXQuaternionLn
D3DXQuaternionMultiply
D3DXQuaternionNormalize
D3DXQuaternionRotationAxis
D3DXQuaternionRotationMatrix
D3DXQuaternionRotationYawPitchRoll
D3DXQuaternionSlerp
D3DXQuaternionSquad
D3DXQuaternionSquadSetup
D3DXQuaternionToAxisAngle
D3DXRectPatchSize
D3DXSHAdd
D3DXSHDot
D3DXSHEvalConeLight
D3DXSHEvalDirection
D3DXSHEvalDirectionalLight
D3DXSHEvalHemisphereLight
D3DXSHEvalSphericalLight
D3DXSHMultiply2
D3DXSHMultiply3
D3DXSHMultiply4
D3DXSHMultiply5
D3DXSHMultiply6
D3DXSHPRTCompSplitMeshSC
D3DXSHPRTCompSuperCluster
D3DXSHProjectCubeMap
D3DXSHRotate
D3DXSHRotateZ
D3DXSHScale
D3DXSaveMeshHierarchyToFileA
D3DXSaveMeshHierarchyToFileW
D3DXSaveMeshToXA
D3DXSaveMeshToXW
D3DXSavePRTBufferToFileA
D3DXSavePRTBufferToFileW
D3DXSavePRTCompBufferToFileA
D3DXSavePRTCompBufferToFileW
D3DXSaveSurfaceToFileA
D3DXSaveSurfaceToFileInMemory
D3DXSaveSurfaceToFileW
D3DXSaveTextureToFileA
D3DXSaveTextureToFileInMemory
D3DXSaveTextureToFileW
D3DXSaveVolumeToFileA
D3DXSaveVolumeToFileInMemory
D3DXSaveVolumeToFileW
D3DXSimplifyMesh
D3DXSphereBoundProbe
D3DXSplitMesh
D3DXTessellateNPatches
D3DXTessellateRectPatch
D3DXTessellateTriPatch
D3DXTriPatchSize
D3DXUVAtlasCreate
D3DXUVAtlasPack
D3DXUVAtlasPartition
D3DXValidMesh
D3DXValidPatchMesh
D3DXVec2BaryCentric
D3DXVec2CatmullRom
D3DXVec2Hermite
D3DXVec2Normalize
D3DXVec2Transform
D3DXVec2TransformArray
D3DXVec2TransformCoord
D3DXVec2TransformCoordArray
D3DXVec2TransformNormal
D3DXVec2TransformNormalArray
D3DXVec3BaryCentric
D3DXVec3CatmullRom
D3DXVec3Hermite
D3DXVec3Normalize
D3DXVec3Project
D3DXVec3ProjectArray
D3DXVec3Transform
D3DXVec3TransformArray
D3DXVec3TransformCoord
D3DXVec3TransformCoordArray
D3DXVec3TransformNormal
D3DXVec3TransformNormalArray
D3DXVec3Unproject
D3DXVec3UnprojectArray
D3DXVec4BaryCentric
D3DXVec4CatmullRom
D3DXVec4Cross
D3DXVec4Hermite
D3DXVec4Normalize
D3DXVec4Transform
D3DXVec4TransformArray
D3DXWeldVertices
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:02_Timer.xcodeproj">
</FileRef>
</Workspace>
| {
"pile_set_name": "Github"
} |
package jp.wasabeef.recyclerview.animators
import android.view.animation.Interpolator
import androidx.recyclerview.widget.RecyclerView
/**
* Copyright (C) 2020 Daichi Furiya / Wasabeef
*
* 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.
*/
open class SlideInDownAnimator : BaseItemAnimator {
constructor()
constructor(interpolator: Interpolator) {
this.interpolator = interpolator
}
override fun animateRemoveImpl(holder: RecyclerView.ViewHolder) {
holder.itemView.animate().apply {
translationY(-holder.itemView.height.toFloat())
alpha(0f)
duration = removeDuration
interpolator = interpolator
setListener(DefaultRemoveAnimatorListener(holder))
startDelay = getRemoveDelay(holder)
}.start()
}
override fun preAnimateAddImpl(holder: RecyclerView.ViewHolder) {
holder.itemView.translationY = -holder.itemView.height.toFloat()
holder.itemView.alpha = 0f
}
override fun animateAddImpl(holder: RecyclerView.ViewHolder) {
holder.itemView.animate().apply {
translationY(0f)
alpha(1f)
duration = addDuration
interpolator = interpolator
setListener(DefaultAddAnimatorListener(holder))
startDelay = getAddDelay(holder)
}.start()
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/voice_search_ui.h"
#include <string>
#include <utility>
#include "base/command_line.h"
#include "base/files/file_enumerator.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/field_trial.h"
#include "base/path_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/plugins/plugin_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/hotword_service.h"
#include "chrome/browser/search/hotword_service_factory.h"
#include "chrome/browser/ui/app_list/start_page_service.h"
#include "chrome/browser/ui/webui/version_handler.h"
#include "chrome/common/channel_info.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/plugin_service.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "content/public/common/user_agent.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/extension.h"
#include "grit/browser_resources.h"
#include "grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "v8/include/v8.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif
using base::ASCIIToUTF16;
using content::WebUIMessageHandler;
namespace {
content::WebUIDataSource* CreateVoiceSearchUiHtmlSource() {
content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(chrome::kChromeUIVoiceSearchHost);
html_source->AddLocalizedString("loadingMessage",
IDS_VOICESEARCH_LOADING_MESSAGE);
html_source->AddLocalizedString("voiceSearchLongTitle",
IDS_VOICESEARCH_TITLE_MESSAGE);
html_source->SetJsonPath("strings.js");
html_source->AddResourcePath("about_voicesearch.js",
IDR_ABOUT_VOICESEARCH_JS);
html_source->SetDefaultResource(IDR_ABOUT_VOICESEARCH_HTML);
return html_source;
}
// Helper functions for collecting a list of key-value pairs that will
// be displayed.
void AddPair16(base::ListValue* list,
const base::string16& key,
const base::string16& value) {
std::unique_ptr<base::DictionaryValue> results(new base::DictionaryValue());
results->SetString("key", key);
results->SetString("value", value);
list->Append(results.release());
}
void AddPair(base::ListValue* list,
const base::StringPiece& key,
const base::StringPiece& value) {
AddPair16(list, UTF8ToUTF16(key), UTF8ToUTF16(value));
}
void AddPairBool(base::ListValue* list,
const base::StringPiece& key,
bool value) {
AddPair(list, key, value ? "Yes" : "No");
}
// Generate an empty data-pair which acts as a line break.
void AddLineBreak(base::ListValue* list) {
AddPair(list, "", "");
}
void AddSharedModulePlatformsOnFileThread(base::ListValue* list,
const base::FilePath& path,
base::Closure callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
if (!path.empty()) {
// Display available platforms for shared module.
base::FilePath platforms_path = path.AppendASCII("_platform_specific");
base::FileEnumerator enumerator(
platforms_path, false, base::FileEnumerator::DIRECTORIES);
base::string16 files;
for (base::FilePath name = enumerator.Next();
!name.empty();
name = enumerator.Next()) {
files += name.BaseName().LossyDisplayName() + ASCIIToUTF16(" ");
}
AddPair16(list,
ASCIIToUTF16("Shared Module Platforms"),
files.empty() ? ASCIIToUTF16("undefined") : files);
AddLineBreak(list);
}
content::BrowserThread::PostTask(content::BrowserThread::UI,
FROM_HERE,
callback);
}
////////////////////////////////////////////////////////////////////////////////
//
// VoiceSearchDomHandler
//
////////////////////////////////////////////////////////////////////////////////
// The handler for Javascript messages for the about:flags page.
class VoiceSearchDomHandler : public WebUIMessageHandler {
public:
explicit VoiceSearchDomHandler(Profile* profile)
: profile_(profile),
weak_factory_(this) {}
~VoiceSearchDomHandler() override {}
// WebUIMessageHandler implementation.
void RegisterMessages() override {
web_ui()->RegisterMessageCallback(
"requestVoiceSearchInfo",
base::Bind(&VoiceSearchDomHandler::HandleRequestVoiceSearchInfo,
base::Unretained(this)));
}
private:
// Callback for the "requestVoiceSearchInfo" message. No arguments.
void HandleRequestVoiceSearchInfo(const base::ListValue* args) {
PopulatePageInformation();
}
void ReturnVoiceSearchInfo(std::unique_ptr<base::ListValue> info) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(info);
base::DictionaryValue voiceSearchInfo;
voiceSearchInfo.Set("voiceSearchInfo", info.release());
web_ui()->CallJavascriptFunctionUnsafe("returnVoiceSearchInfo",
voiceSearchInfo);
}
// Fill in the data to be displayed on the page.
void PopulatePageInformation() {
// Store Key-Value pairs of about-information.
std::unique_ptr<base::ListValue> list(new base::ListValue());
// Populate information.
AddOperatingSystemInfo(list.get());
AddAudioInfo(list.get());
AddLanguageInfo(list.get());
AddHotwordInfo(list.get());
AddAppListInfo(list.get());
AddExtensionInfo(extension_misc::kHotwordNewExtensionId,
"Extension",
list.get());
AddExtensionInfo(extension_misc::kHotwordSharedModuleId,
"Shared Module",
list.get());
base::FilePath path;
extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile_);
if (extension_system) {
ExtensionService* extension_service =
extension_system->extension_service();
const extensions::Extension* extension =
extension_service->GetExtensionById(
extension_misc::kHotwordSharedModuleId, true);
if (extension)
path = extension->path();
}
base::ListValue* raw_list = list.get();
content::BrowserThread::PostTask(
content::BrowserThread::FILE, FROM_HERE,
base::Bind(&AddSharedModulePlatformsOnFileThread, raw_list, path,
base::Bind(&VoiceSearchDomHandler::ReturnVoiceSearchInfo,
weak_factory_.GetWeakPtr(),
base::Passed(std::move(list)))));
}
// Adds information regarding the system and chrome version info to list.
void AddOperatingSystemInfo(base::ListValue* list) {
// Obtain the Chrome version info.
AddPair(list,
l10n_util::GetStringUTF8(IDS_PRODUCT_NAME),
version_info::GetVersionNumber() + " (" +
chrome::GetChannelString() + ")");
// OS version information.
std::string os_label = version_info::GetOSType();
#if defined(OS_WIN)
base::win::OSInfo* os = base::win::OSInfo::GetInstance();
switch (os->version()) {
case base::win::VERSION_XP:
os_label += " XP";
break;
case base::win::VERSION_SERVER_2003:
os_label += " Server 2003 or XP Pro 64 bit";
break;
case base::win::VERSION_VISTA:
os_label += " Vista or Server 2008";
break;
case base::win::VERSION_WIN7:
os_label += " 7 or Server 2008 R2";
break;
case base::win::VERSION_WIN8:
os_label += " 8 or Server 2012";
break;
default:
os_label += " UNKNOWN";
break;
}
os_label += " SP" + base::IntToString(os->service_pack().major);
if (os->service_pack().minor > 0)
os_label += "." + base::IntToString(os->service_pack().minor);
if (os->architecture() == base::win::OSInfo::X64_ARCHITECTURE)
os_label += " 64 bit";
#endif
AddPair(list, l10n_util::GetStringUTF8(IDS_VERSION_UI_OS), os_label);
AddLineBreak(list);
}
// Adds information regarding audio to the list.
void AddAudioInfo(base::ListValue* list) {
// NaCl and its associated functions are not available on most mobile
// platforms. ENABLE_EXTENSIONS covers those platforms and hey would not
// allow Hotwording anyways since it is an extension.
std::string nacl_enabled = "not available";
#if defined(ENABLE_EXTENSIONS)
nacl_enabled = "No";
// Determine if NaCl is available.
base::FilePath path;
if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) {
content::WebPluginInfo info;
PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile_).get();
if (content::PluginService::GetInstance()->GetPluginInfoByPath(path,
&info) &&
plugin_prefs->IsPluginEnabled(info)) {
nacl_enabled = "Yes";
}
}
#endif
AddPair(list, "NaCl Enabled", nacl_enabled);
HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(profile_);
AddPairBool(list, "Microphone Present",
hotword_service && hotword_service->microphone_available());
AddPairBool(list, "Audio Capture Allowed",
profile_->GetPrefs()->GetBoolean(prefs::kAudioCaptureAllowed));
AddLineBreak(list);
}
// Adds information regarding languages to the list.
void AddLanguageInfo(base::ListValue* list) {
std::string locale =
#if defined(OS_CHROMEOS)
// On ChromeOS locale is per-profile.
profile_->GetPrefs()->GetString(prefs::kApplicationLocale);
#else
g_browser_process->GetApplicationLocale();
#endif
AddPair(list, "Current Language", locale);
AddPair(list,
"Hotword Previous Language",
profile_->GetPrefs()->GetString(prefs::kHotwordPreviousLanguage));
AddLineBreak(list);
}
// Adds information specific to the hotword configuration to the list.
void AddHotwordInfo(base::ListValue* list) {
HotwordService* hotword_service =
HotwordServiceFactory::GetForProfile(profile_);
AddPairBool(list, "Hotword Module Installable",
hotword_service && hotword_service->IsHotwordAllowed());
AddPairBool(list, "Hotword Search Enabled",
profile_->GetPrefs()->GetBoolean(prefs::kHotwordSearchEnabled));
AddPairBool(
list, "Always-on Hotword Search Enabled",
profile_->GetPrefs()->GetBoolean(prefs::kHotwordAlwaysOnSearchEnabled));
AddPairBool(list, "Hotword Audio Logging Enabled",
hotword_service && hotword_service->IsOptedIntoAudioLogging());
AddLineBreak(list);
}
// Adds information specific to an extension to the list.
void AddExtensionInfo(const std::string& extension_id,
const std::string& name_prefix,
base::ListValue* list) {
DCHECK(!name_prefix.empty());
std::string version("undefined");
std::string id("undefined");
base::FilePath path;
extensions::ExtensionSystem* extension_system =
extensions::ExtensionSystem::Get(profile_);
if (extension_system) {
ExtensionService* extension_service =
extension_system->extension_service();
const extensions::Extension* extension =
extension_service->GetExtensionById(extension_id, true);
if (extension) {
id = extension->id();
version = extension->VersionString();
path = extension->path();
}
}
AddPair(list, name_prefix + " Id", id);
AddPair(list, name_prefix + " Version", version);
AddPair16(list,
ASCIIToUTF16(name_prefix + " Path"),
path.empty() ?
ASCIIToUTF16("undefined") : path.LossyDisplayName());
extensions::ExtensionPrefs* extension_prefs =
extensions::ExtensionPrefs::Get(profile_);
int pref_state = -1;
extension_prefs->ReadPrefAsInteger(extension_id, "state", &pref_state);
std::string state;
switch (pref_state) {
case extensions::Extension::DISABLED:
state = "DISABLED";
break;
case extensions::Extension::ENABLED:
state = "ENABLED";
break;
case extensions::Extension::EXTERNAL_EXTENSION_UNINSTALLED:
state = "EXTERNAL_EXTENSION_UNINSTALLED";
break;
default:
state = "undefined";
}
AddPair(list, name_prefix + " State", state);
AddLineBreak(list);
}
// Adds information specific to voice search in the app launcher to the list.
void AddAppListInfo(base::ListValue* list) {
#if defined (ENABLE_APP_LIST)
std::string state = "No Start Page Service";
app_list::StartPageService* start_page_service =
app_list::StartPageService::Get(profile_);
if (start_page_service) {
app_list::SpeechRecognitionState speech_state =
start_page_service->state();
switch (speech_state) {
case app_list::SPEECH_RECOGNITION_OFF:
state = "SPEECH_RECOGNITION_OFF";
break;
case app_list::SPEECH_RECOGNITION_READY:
state = "SPEECH_RECOGNITION_READY";
break;
case app_list::SPEECH_RECOGNITION_HOTWORD_LISTENING:
state = "SPEECH_RECOGNITION_HOTWORD_LISTENING";
break;
case app_list::SPEECH_RECOGNITION_RECOGNIZING:
state = "SPEECH_RECOGNITION_RECOGNIZING";
break;
case app_list::SPEECH_RECOGNITION_IN_SPEECH:
state = "SPEECH_RECOGNITION_IN_SPEECH";
break;
case app_list::SPEECH_RECOGNITION_STOPPING:
state = "SPEECH_RECOGNITION_STOPPING";
break;
case app_list::SPEECH_RECOGNITION_NETWORK_ERROR:
state = "SPEECH_RECOGNITION_NETWORK_ERROR";
break;
default:
state = "undefined";
}
}
AddPair(list, "Start Page State", state);
AddLineBreak(list);
#endif
}
Profile* profile_;
base::WeakPtrFactory<VoiceSearchDomHandler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(VoiceSearchDomHandler);
};
} // namespace
///////////////////////////////////////////////////////////////////////////////
//
// VoiceSearchUI
//
///////////////////////////////////////////////////////////////////////////////
VoiceSearchUI::VoiceSearchUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
web_ui->AddMessageHandler(new VoiceSearchDomHandler(profile));
// Set up the about:voicesearch source.
content::WebUIDataSource::Add(profile, CreateVoiceSearchUiHtmlSource());
}
VoiceSearchUI::~VoiceSearchUI() {}
| {
"pile_set_name": "Github"
} |
//
// detail/reactive_serial_port_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. ([email protected])
//
// 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_ASIO_DETAIL_REACTIVE_SERIAL_PORT_SERVICE_HPP
#define BOOST_ASIO_DETAIL_REACTIVE_SERIAL_PORT_SERVICE_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include <boost/asio/detail/config.hpp>
#if defined(BOOST_ASIO_HAS_SERIAL_PORT)
#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
#include <string>
#include <boost/asio/error.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/asio/serial_port_base.hpp>
#include <boost/asio/detail/descriptor_ops.hpp>
#include <boost/asio/detail/reactive_descriptor_service.hpp>
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
namespace detail {
// Extend reactive_descriptor_service to provide serial port support.
class reactive_serial_port_service
{
public:
// The native type of a serial port.
typedef reactive_descriptor_service::native_handle_type native_handle_type;
// The implementation type of the serial port.
typedef reactive_descriptor_service::implementation_type implementation_type;
BOOST_ASIO_DECL reactive_serial_port_service(
boost::asio::io_service& io_service);
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void shutdown_service();
// Construct a new serial port implementation.
void construct(implementation_type& impl)
{
descriptor_service_.construct(impl);
}
// Move-construct a new serial port implementation.
void move_construct(implementation_type& impl,
implementation_type& other_impl)
{
descriptor_service_.move_construct(impl, other_impl);
}
// Move-assign from another serial port implementation.
void move_assign(implementation_type& impl,
reactive_serial_port_service& other_service,
implementation_type& other_impl)
{
descriptor_service_.move_assign(impl,
other_service.descriptor_service_, other_impl);
}
// Destroy a serial port implementation.
void destroy(implementation_type& impl)
{
descriptor_service_.destroy(impl);
}
// Open the serial port using the specified device name.
BOOST_ASIO_DECL boost::system::error_code open(implementation_type& impl,
const std::string& device, boost::system::error_code& ec);
// Assign a native descriptor to a serial port implementation.
boost::system::error_code assign(implementation_type& impl,
const native_handle_type& native_descriptor,
boost::system::error_code& ec)
{
return descriptor_service_.assign(impl, native_descriptor, ec);
}
// Determine whether the serial port is open.
bool is_open(const implementation_type& impl) const
{
return descriptor_service_.is_open(impl);
}
// Destroy a serial port implementation.
boost::system::error_code close(implementation_type& impl,
boost::system::error_code& ec)
{
return descriptor_service_.close(impl, ec);
}
// Get the native serial port representation.
native_handle_type native_handle(implementation_type& impl)
{
return descriptor_service_.native_handle(impl);
}
// Cancel all operations associated with the serial port.
boost::system::error_code cancel(implementation_type& impl,
boost::system::error_code& ec)
{
return descriptor_service_.cancel(impl, ec);
}
// Set an option on the serial port.
template <typename SettableSerialPortOption>
boost::system::error_code set_option(implementation_type& impl,
const SettableSerialPortOption& option, boost::system::error_code& ec)
{
return do_set_option(impl,
&reactive_serial_port_service::store_option<SettableSerialPortOption>,
&option, ec);
}
// Get an option from the serial port.
template <typename GettableSerialPortOption>
boost::system::error_code get_option(const implementation_type& impl,
GettableSerialPortOption& option, boost::system::error_code& ec) const
{
return do_get_option(impl,
&reactive_serial_port_service::load_option<GettableSerialPortOption>,
&option, ec);
}
// Send a break sequence to the serial port.
boost::system::error_code send_break(implementation_type& impl,
boost::system::error_code& ec)
{
errno = 0;
descriptor_ops::error_wrapper(::tcsendbreak(
descriptor_service_.native_handle(impl), 0), ec);
return ec;
}
// Write the given data. Returns the number of bytes sent.
template <typename ConstBufferSequence>
size_t write_some(implementation_type& impl,
const ConstBufferSequence& buffers, boost::system::error_code& ec)
{
return descriptor_service_.write_some(impl, buffers, ec);
}
// Start an asynchronous write. The data being written must be valid for the
// lifetime of the asynchronous operation.
template <typename ConstBufferSequence, typename Handler>
void async_write_some(implementation_type& impl,
const ConstBufferSequence& buffers, Handler handler)
{
descriptor_service_.async_write_some(impl, buffers, handler);
}
// Read some data. Returns the number of bytes received.
template <typename MutableBufferSequence>
size_t read_some(implementation_type& impl,
const MutableBufferSequence& buffers, boost::system::error_code& ec)
{
return descriptor_service_.read_some(impl, buffers, ec);
}
// Start an asynchronous read. The buffer for the data being received must be
// valid for the lifetime of the asynchronous operation.
template <typename MutableBufferSequence, typename Handler>
void async_read_some(implementation_type& impl,
const MutableBufferSequence& buffers, Handler handler)
{
descriptor_service_.async_read_some(impl, buffers, handler);
}
private:
// Function pointer type for storing a serial port option.
typedef boost::system::error_code (*store_function_type)(
const void*, termios&, boost::system::error_code&);
// Helper function template to store a serial port option.
template <typename SettableSerialPortOption>
static boost::system::error_code store_option(const void* option,
termios& storage, boost::system::error_code& ec)
{
return static_cast<const SettableSerialPortOption*>(option)->store(
storage, ec);
}
// Helper function to set a serial port option.
BOOST_ASIO_DECL boost::system::error_code do_set_option(
implementation_type& impl, store_function_type store,
const void* option, boost::system::error_code& ec);
// Function pointer type for loading a serial port option.
typedef boost::system::error_code (*load_function_type)(
void*, const termios&, boost::system::error_code&);
// Helper function template to load a serial port option.
template <typename GettableSerialPortOption>
static boost::system::error_code load_option(void* option,
const termios& storage, boost::system::error_code& ec)
{
return static_cast<GettableSerialPortOption*>(option)->load(storage, ec);
}
// Helper function to get a serial port option.
BOOST_ASIO_DECL boost::system::error_code do_get_option(
const implementation_type& impl, load_function_type load,
void* option, boost::system::error_code& ec) const;
// The implementation used for initiating asynchronous operations.
reactive_descriptor_service descriptor_service_;
};
} // namespace detail
} // namespace asio
} // namespace boost
#include <boost/asio/detail/pop_options.hpp>
#if defined(BOOST_ASIO_HEADER_ONLY)
# include <boost/asio/detail/impl/reactive_serial_port_service.ipp>
#endif // defined(BOOST_ASIO_HEADER_ONLY)
#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__)
#endif // defined(BOOST_ASIO_HAS_SERIAL_PORT)
#endif // BOOST_ASIO_DETAIL_REACTIVE_SERIAL_PORT_SERVICE_HPP
| {
"pile_set_name": "Github"
} |
package com.khorn.terraincontrol.generator.biome.layers;
import com.khorn.terraincontrol.LocalWorld;
import com.khorn.terraincontrol.TerrainControl;
import com.khorn.terraincontrol.configuration.WorldConfig;
import com.khorn.terraincontrol.generator.biome.ArraysCache;
import com.khorn.terraincontrol.logging.LogMarker;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class LayerFromImage extends Layer
{
private int[] biomeMap;
private int mapHeight;
private int mapWidth;
private int fillBiome = 0;
private int xOffset;
private int zOffset;
private WorldConfig.ImageMode imageMode;
public LayerFromImage(long seed, Layer childLayer, WorldConfig config, LocalWorld world)
{
super(seed);
this.child = childLayer;
xOffset = config.imageXOffset;
zOffset = config.imageZOffset;
this.imageMode = config.imageMode;
this.fillBiome = world.getBiomeByName(config.imageFillBiome).getIds().getGenerationId();
// Read from file
try
{
final File image = new File(config.settingsDir, config.imageFile);
final BufferedImage map = ImageIO.read(image);
this.mapWidth = map.getWidth(null);
this.mapHeight = map.getHeight(null);
int[] colorMap = new int[this.mapHeight * this.mapWidth];
map.getRGB(0, 0, this.mapWidth, this.mapHeight, colorMap, 0, this.mapWidth);
// Rotate RGBs if need
switch (config.imageOrientation)
{
case North:
// Default behavior - nothing to rotate
break;
case South:
// Rotate picture 180 degrees
int[] colorMap180 = new int[colorMap.length];
for (int y = 0; y < this.mapHeight; y++)
for (int x = 0; x < this.mapWidth; x++)
colorMap180[(this.mapHeight - 1 - y) * this.mapWidth + this.mapWidth - 1 - x] = colorMap[y * this.mapWidth + x];
colorMap = colorMap180;
break;
case West:
// Rotate picture CW
int[] colorMapCW = new int[colorMap.length];
for (int y = 0; y < this.mapHeight; y++)
for (int x = 0; x < this.mapWidth; x++)
colorMapCW[x * this.mapHeight + this.mapHeight - 1 - y] = colorMap[y * this.mapWidth + x];
colorMap = colorMapCW;
this.mapWidth = map.getHeight(null);
this.mapHeight = map.getWidth(null);
break;
case East:
// Rotate picture CCW
int[] colorMapCCW = new int[colorMap.length];
for (int y = 0; y < this.mapHeight; y++)
for (int x = 0; x < this.mapWidth; x++)
colorMapCCW[(this.mapWidth - 1 - x) * this.mapHeight + y] = colorMap[y * this.mapWidth + x];
colorMap = colorMapCCW;
this.mapWidth = map.getHeight(null);
this.mapHeight = map.getWidth(null);
break;
}
this.biomeMap = new int[colorMap.length];
for (int nColor = 0; nColor < colorMap.length; nColor++)
{
int color = colorMap[nColor] & 0x00FFFFFF;
if (config.biomeColorMap.containsKey(color))
this.biomeMap[nColor] = config.biomeColorMap.get(color);
else
this.biomeMap[nColor] = fillBiome;
}
} catch (IOException ioexception)
{
TerrainControl.log(LogMarker.FATAL, ioexception.getStackTrace().toString());
}
}
@Override
public int[] getInts(ArraysCache cache, int x, int z, int xSize, int zSize)
{
int[] resultBiomes = cache.getArray(xSize * zSize);
switch (this.imageMode)
{
case Repeat:
for (int zi = 0; zi < zSize; zi++)
for (int xi = 0; xi < xSize; xi++)
{
int Buffer_x = (x + xi - xOffset) % this.mapWidth;
int Buffer_z = (z + zi - zOffset) % this.mapHeight;
// Take care of negatives
if (Buffer_x < 0)
Buffer_x += this.mapWidth;
if (Buffer_z < 0)
Buffer_z += this.mapHeight;
resultBiomes[(xi + zi * xSize)] = this.biomeMap[Buffer_x + Buffer_z * this.mapWidth];
}
return resultBiomes;
case Mirror:
// Improved repeat mode
for (int zi = 0; zi < zSize; zi++)
for (int xi = 0; xi < xSize; xi++)
{
int Buffer_xq = (x + xi - xOffset) % (2 * this.mapWidth);
int Buffer_zq = (z + zi - zOffset) % (2 * this.mapHeight);
if (Buffer_xq < 0)
Buffer_xq += 2 * this.mapWidth;
if (Buffer_zq < 0)
Buffer_zq += 2 * this.mapHeight;
int Buffer_x = Buffer_xq % this.mapWidth;
int Buffer_z = Buffer_zq % this.mapHeight;
if (Buffer_xq >= this.mapWidth)
Buffer_x = this.mapWidth - 1 - Buffer_x;
if (Buffer_zq >= this.mapHeight)
Buffer_z = this.mapHeight - 1 - Buffer_z;
resultBiomes[(xi + zi * xSize)] = this.biomeMap[Buffer_x + Buffer_z * this.mapWidth];
}
return resultBiomes;
case ContinueNormal:
int[] childBiomes = null;
if (this.child != null)
childBiomes = this.child.getInts(cache, x, z, xSize, zSize);
for (int zi = 0; zi < zSize; zi++)
for (int xi = 0; xi < xSize; xi++)
{
int Buffer_x = x + xi - xOffset;
int Buffer_z = z + zi - zOffset;
if (Buffer_x < 0 || Buffer_x >= this.mapWidth || Buffer_z < 0 || Buffer_z >= this.mapHeight)
{
if (childBiomes != null)
resultBiomes[(xi + zi * xSize)] = childBiomes[(xi + zi * xSize)];
else
resultBiomes[(xi + zi * xSize)] = this.fillBiome;
} else
resultBiomes[(xi + zi * xSize)] = this.biomeMap[Buffer_x + Buffer_z * this.mapWidth];
}
break;
case FillEmpty:
// Some fastened version
for (int zi = 0; zi < zSize; zi++)
for (int xi = 0; xi < xSize; xi++)
{
int Buffer_x = x + xi - xOffset;
int Buffer_z = z + zi - zOffset;
if (Buffer_x < 0 || Buffer_x >= this.mapWidth || Buffer_z < 0 || Buffer_z >= this.mapHeight)
resultBiomes[(xi + zi * xSize)] = this.fillBiome;
else
resultBiomes[(xi + zi * xSize)] = this.biomeMap[Buffer_x + Buffer_z * this.mapWidth];
}
break;
}
return resultBiomes;
}
}
| {
"pile_set_name": "Github"
} |
//
// Wire
// Copyright (C) 2019 Wire Swiss GmbH
//
// 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/.
//
import Foundation
import UIKit
import WireCommonComponents
import WireDataModel
extension StartUIViewController {
var needsAddressBookPermission: Bool {
let shouldSkip = AutomationHelper.sharedHelper.skipFirstLoginAlerts || ZMUser.selfUser().hasTeam
return !AddressBookHelper.sharedHelper.isAddressBookAccessGranted && !shouldSkip
}
func presentShareContactsViewController() {
let shareContactsViewController = ShareContactsViewController()
shareContactsViewController.delegate = self
navigationController?.pushViewController(shareContactsViewController, animated: true)
}
}
extension StartUIViewController: ShareContactsViewControllerDelegate {
func shareDidFinish(_ viewController: UIViewController) {
viewController.dismiss(animated: true)
}
func shareDidSkip(_ viewController: UIViewController) {
dismiss(animated: true) {
UIApplication.shared.topmostViewController()?.presentInviteActivityViewController(with: self.quickActionsBar)
}
}
}
| {
"pile_set_name": "Github"
} |
curl -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token' \
-X DELETE https://preview.twilio.com/DeployedDevices/Fleets/FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
| {
"pile_set_name": "Github"
} |
# glibc21.m4 serial 3
dnl Copyright (C) 2000-2002, 2004 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# Test for the GNU C Library, version 2.1 or newer.
# From Bruno Haible.
AC_DEFUN([gl_GLIBC21],
[
AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
ac_cv_gnu_library_2_1,
[AC_EGREP_CPP([Lucky GNU user],
[
#include <features.h>
#ifdef __GNU_LIBRARY__
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
Lucky GNU user
#endif
#endif
],
ac_cv_gnu_library_2_1=yes,
ac_cv_gnu_library_2_1=no)
]
)
AC_SUBST(GLIBC21)
GLIBC21="$ac_cv_gnu_library_2_1"
]
)
| {
"pile_set_name": "Github"
} |
/**
*
* The Touch Action API provides the basis of all gestures that can be automated in Appium.
* It is currently only available to native apps and can not be used to interact with webapps.
* At its core is the ability to chain together _ad hoc_ individual actions, which will then be
* applied to an element in the application on the device. The basic actions that can be used are:
*
* - press (pass selector or (x,y) or both)
* - longPress (pass selector or (x,y) or both)
* - tap (pass selector or (x,y) or both)
* - moveTo (pass selector or (x,y) or both)
* - wait (pass ms (as milliseconds))
* - release (no arguments)
*
* If you use the touchAction command with a selector you don't need to pass the selector to each
* action. It will be propagated by the internally (if no x or y parameters are given).
*
* <example>
:touchAction.js
it('should do a touch gesture', function () {
var screen = $('//UITextbox');
// simple touch action on element
screen.touchAction('tap');
// same as
browser.touchAction('//UITextbox', 'tap')
// simple touch action using x y variables
browser.touchAction({
action: 'tap', x: 300, y:200
})
// simple touch action using selector and x y variables
// tap location is 30px right and 20px down relative from the center of the element
browser.touchAction({
action: 'tap', x: 30, y:20, selector: '//UIAApplication[1]/UIAElement[2]'
})
// multi action on an element (drag&drop)
screen.touchAction([
'press',
{ action: 'moveTo', x: 200, y: 0 },
'release'
])
// same as
browser.touchAction('//UITextbox', [
'press',
{ action: 'moveTo', x: 200, y: 0},
'release'
])
// drag&drop to element
screen.touchAction([
'press',
{ action: 'moveTo', selector: '//UIAApplication[1]/UIAElement[2]' },
'release'
]))
});
:multiTouchAction.js
it('should do a multitouch gesture', function () {
// drag&drop with two fingers 200px down
browser.touchAction([
[{action: 'press', x: 10, y: 10}, { action: 'moveTo', x: 0, y: 200 }, 'release'],
[{action: 'press', x: 100, y: 10}, { action: 'moveTo', x: 0, y: 200 }, 'release']]
])
})
* </example>
*
* @param {String} selector selector to execute the touchAction on
* @param {String} action action to execute
*
* @see https://saucelabs.com/blog/appium-sauce-labs-bootcamp-chapter-2-touch-actions
* @type mobile
* @for android, ios
* @uses mobile/performTouchAction, mobile/performMultiAction
*
*/
const TOUCH_ACTIONS = ['press', 'longPress', 'tap', 'moveTo', 'wait', 'release']
const POS_ACTIONS = TOUCH_ACTIONS.slice(0, -2)
const ACCEPTED_OPTIONS = ['x', 'y', 'selector', 'element']
export default function touchAction (selector, actions) {
if (typeof selector !== 'string' || TOUCH_ACTIONS.indexOf(selector) > -1) {
actions = selector
selector = this.lastResult
}
if (!Array.isArray(actions)) {
actions = [actions]
}
/**
* check if multiAction
*/
if (Array.isArray(actions[0])) {
actions = formatArgs(selector, actions)
return Promise.all(getSelectors.call(this, actions, true)).then((jsonElements) => {
actions = replaceSelectorsById(actions, jsonElements)
return this.performMultiAction({ actions })
})
}
actions = formatArgs(selector, actions)
return Promise.all(getSelectors.call(this, actions)).then((jsonElements) => {
actions = replaceSelectorsById(actions, jsonElements)
return this.performTouchAction({ actions })
})
}
/**
* helper to determine if action has proper option arguments
* ('press', 'longPress', 'tap', 'moveTo' need at least some kind of position information)
* @param {String} action name of action
* @param {Object} options action options
* @return {Boolean} True if don't need any options or has a position option
*/
let hasValidActionOptions = function (action, options) {
return POS_ACTIONS.indexOf(action) < 0 || (POS_ACTIONS.indexOf(action) > -1 && Object.keys(options).length > 0)
}
let formatArgs = function (selector, actions) {
return actions.map((action) => {
if (Array.isArray(action)) {
return formatArgs(selector, action)
}
const formattedAction = { action: action.action, options: {} }
/**
* propagate selector or element to options object
*/
if (
selector &&
// selector is given as string `e.g. browser.touchAction(selector, 'tap')`
typeof selector === 'string' &&
// don't propagate for actions that don't require element options
POS_ACTIONS.indexOf(typeof action === 'string' ? action : formattedAction.action) > -1 &&
// don't propagate if user has x and y set
!(isFinite(action.x) && isFinite(action.y))
) {
formattedAction.options.selector = selector
} else if (
selector &&
// selector is given by previous command
// e.g. $(selector).touchAction('tap')
selector.value &&
// don't propagate for actions that don't require element options
POS_ACTIONS.indexOf(typeof action === 'string' ? action : formattedAction.action) > -1 &&
// don't propagate if user has x and y set
!(isFinite(action.x) && isFinite(action.y))
) {
formattedAction.options.element = selector.value.ELEMENT
}
if (typeof action === 'string') {
if (!hasValidActionOptions(action, formattedAction.options)) {
throw new Error(
`Touch action "${action}" doesn't have proper options. Make sure certain actions like ` +
`${POS_ACTIONS.join(', ')} have position options like "selector", "x" or "y".`
)
}
formattedAction.action = action
/**
* remove options property if empty
*/
if (Object.keys(formattedAction.options).length === 0) {
delete formattedAction.options
}
return formattedAction
}
if (isFinite(action.x)) formattedAction.options.x = action.x
if (isFinite(action.y)) formattedAction.options.y = action.y
if (action.ms) formattedAction.options.ms = action.ms
if (action.selector && POS_ACTIONS.indexOf(formattedAction.action) > -1) {
formattedAction.options.selector = action.selector
}
if (action.element) {
formattedAction.options.element = action.element
delete formattedAction.options.selector
}
/**
* remove options property if empty
*/
if (Object.keys(formattedAction.options).length === 0) {
delete formattedAction.options
}
/**
* option check
* make sure action has proper options before sending command to Appium
*/
if (formattedAction.action === 'release' && formattedAction.options) {
throw new Error(
'action "release" doesn\'t accept any options ' +
`("${Object.keys(formattedAction.options).join('", "')}" found)`
)
} else if (
formattedAction.action === 'wait' &&
(Object.keys(formattedAction.options).indexOf('x') > -1 || Object.keys(formattedAction.options).indexOf('y') > -1)
) {
throw new Error('action "wait" doesn\'t accept x, y options')
} else if (POS_ACTIONS.indexOf(formattedAction.action) > -1) {
for (const option in formattedAction.options) {
if (ACCEPTED_OPTIONS.indexOf(option) === -1) {
throw new Error(`action "${formattedAction.action}" doesn't accept "${option}" as option`)
}
}
if (Object.keys(formattedAction.options || {}).length === 0) {
throw new Error(
`Touch actions like "${formattedAction.action}" need at least some kind of ` +
'position information like "selector", "x" or "y" options, you\'ve none given.'
)
}
}
return formattedAction
})
}
let getSelectors = function (actions, isMultiAction = false) {
let queriedSelectors = []
/**
* flatten actions array
*/
if (isMultiAction) {
actions = [].concat.apply([], actions)
}
return actions
/**
* map down to list of selectors
*/
.map((action) => action.options && action.options.selector)
/**
* filter actions without selector and unique selectors
*/
.filter((selector) => {
const res = Boolean(selector) && queriedSelectors.indexOf(selector) === -1
queriedSelectors.push(selector)
return res
})
/**
* call element command on selectors
*/
.map((selector) => this.element(selector))
}
/**
* replaces selector action properties with element ids after they got fetched
* @param {Object[]} actions list of actions
* @param {Object[]} elements list of fetched elements
* @return {Object[]} list of actions with proper element ids
*/
let replaceSelectorsById = function (actions, elements) {
return actions.map((action) => {
if (Array.isArray(action)) {
return replaceSelectorsById(action, elements)
}
if (!action.options || !action.options.selector) {
return action
}
elements.forEach((element) => {
if (action.options.selector === element.selector) {
action.options.element = element.value.ELEMENT
delete action.options.selector
}
})
return action
})
}
| {
"pile_set_name": "Github"
} |
//
// Copyright IBM Corp. 2016, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//
@import 'vars';
@import './vendor/@carbon/elements/scss/import-once/import-once';
@include exports('helper-classes') {
.#{$prefix}--text-truncate--end {
width: 100%;
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.#{$prefix}--text-truncate--front {
width: 100%;
display: inline-block;
direction: rtl;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
}
| {
"pile_set_name": "Github"
} |
#ifndef _XR_GAME_MATERIALS_
#define _XR_GAME_MATERIALS_
#pragma once
enum EGameMaterial
{
gm_Wood,
gm_Stone,
gm_Metal,
gm_Sand,
};
class Material
{
float transparency_for_sound;
float transparency_for_hit;
public:
virtual u32 getID () = 0;
virtual LPCSTR getName () = 0;
virtual LPCSTR getWallmark (Material* other) = 0;
virtual LPCSTR getParticles (Material* other) = 0;
virtual LPCSTR getSoundHIT (Material* other) = 0;
virtual LPCSTR getSoundSTEP (Material* other) = 0;
virtual float getFriction (Material* other) = 0;
};
#endif | {
"pile_set_name": "Github"
} |
/*
* Copyright 2012 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/
#ifndef __AMDGPU_UCODE_H__
#define __AMDGPU_UCODE_H__
struct common_firmware_header {
uint32_t size_bytes; /* size of the entire header+image(s) in bytes */
uint32_t header_size_bytes; /* size of just the header in bytes */
uint16_t header_version_major; /* header version */
uint16_t header_version_minor; /* header version */
uint16_t ip_version_major; /* IP version */
uint16_t ip_version_minor; /* IP version */
uint32_t ucode_version;
uint32_t ucode_size_bytes; /* size of ucode in bytes */
uint32_t ucode_array_offset_bytes; /* payload offset from the start of the header */
uint32_t crc32; /* crc32 checksum of the payload */
};
/* version_major=1, version_minor=0 */
struct mc_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t io_debug_size_bytes; /* size of debug array in dwords */
uint32_t io_debug_array_offset_bytes; /* payload offset from the start of the header */
};
/* version_major=1, version_minor=0 */
struct smc_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ucode_start_addr;
};
/* version_major=1, version_minor=0 */
struct psp_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ucode_feature_version;
uint32_t sos_offset_bytes;
uint32_t sos_size_bytes;
};
/* version_major=1, version_minor=0 */
struct gfx_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ucode_feature_version;
uint32_t jt_offset; /* jt location */
uint32_t jt_size; /* size of jt */
};
/* version_major=1, version_minor=0 */
struct rlc_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ucode_feature_version;
uint32_t save_and_restore_offset;
uint32_t clear_state_descriptor_offset;
uint32_t avail_scratch_ram_locations;
uint32_t master_pkt_description_offset;
};
/* version_major=2, version_minor=0 */
struct rlc_firmware_header_v2_0 {
struct common_firmware_header header;
uint32_t ucode_feature_version;
uint32_t jt_offset; /* jt location */
uint32_t jt_size; /* size of jt */
uint32_t save_and_restore_offset;
uint32_t clear_state_descriptor_offset;
uint32_t avail_scratch_ram_locations;
uint32_t reg_restore_list_size;
uint32_t reg_list_format_start;
uint32_t reg_list_format_separate_start;
uint32_t starting_offsets_start;
uint32_t reg_list_format_size_bytes; /* size of reg list format array in bytes */
uint32_t reg_list_format_array_offset_bytes; /* payload offset from the start of the header */
uint32_t reg_list_size_bytes; /* size of reg list array in bytes */
uint32_t reg_list_array_offset_bytes; /* payload offset from the start of the header */
uint32_t reg_list_format_separate_size_bytes; /* size of reg list format array in bytes */
uint32_t reg_list_format_separate_array_offset_bytes; /* payload offset from the start of the header */
uint32_t reg_list_separate_size_bytes; /* size of reg list array in bytes */
uint32_t reg_list_separate_array_offset_bytes; /* payload offset from the start of the header */
};
/* version_major=1, version_minor=0 */
struct sdma_firmware_header_v1_0 {
struct common_firmware_header header;
uint32_t ucode_feature_version;
uint32_t ucode_change_version;
uint32_t jt_offset; /* jt location */
uint32_t jt_size; /* size of jt */
};
/* version_major=1, version_minor=1 */
struct sdma_firmware_header_v1_1 {
struct sdma_firmware_header_v1_0 v1_0;
uint32_t digest_size;
};
/* gpu info payload */
struct gpu_info_firmware_v1_0 {
uint32_t gc_num_se;
uint32_t gc_num_cu_per_sh;
uint32_t gc_num_sh_per_se;
uint32_t gc_num_rb_per_se;
uint32_t gc_num_tccs;
uint32_t gc_num_gprs;
uint32_t gc_num_max_gs_thds;
uint32_t gc_gs_table_depth;
uint32_t gc_gsprim_buff_depth;
uint32_t gc_parameter_cache_depth;
uint32_t gc_double_offchip_lds_buffer;
uint32_t gc_wave_size;
uint32_t gc_max_waves_per_simd;
uint32_t gc_max_scratch_slots_per_cu;
uint32_t gc_lds_size;
};
/* version_major=1, version_minor=0 */
struct gpu_info_firmware_header_v1_0 {
struct common_firmware_header header;
uint16_t version_major; /* version */
uint16_t version_minor; /* version */
};
/* header is fixed size */
union amdgpu_firmware_header {
struct common_firmware_header common;
struct mc_firmware_header_v1_0 mc;
struct smc_firmware_header_v1_0 smc;
struct psp_firmware_header_v1_0 psp;
struct gfx_firmware_header_v1_0 gfx;
struct rlc_firmware_header_v1_0 rlc;
struct rlc_firmware_header_v2_0 rlc_v2_0;
struct sdma_firmware_header_v1_0 sdma;
struct sdma_firmware_header_v1_1 sdma_v1_1;
struct gpu_info_firmware_header_v1_0 gpu_info;
uint8_t raw[0x100];
};
/*
* fw loading support
*/
enum AMDGPU_UCODE_ID {
AMDGPU_UCODE_ID_SDMA0 = 0,
AMDGPU_UCODE_ID_SDMA1,
AMDGPU_UCODE_ID_CP_CE,
AMDGPU_UCODE_ID_CP_PFP,
AMDGPU_UCODE_ID_CP_ME,
AMDGPU_UCODE_ID_CP_MEC1,
AMDGPU_UCODE_ID_CP_MEC1_JT,
AMDGPU_UCODE_ID_CP_MEC2,
AMDGPU_UCODE_ID_CP_MEC2_JT,
AMDGPU_UCODE_ID_RLC_G,
AMDGPU_UCODE_ID_STORAGE,
AMDGPU_UCODE_ID_SMC,
AMDGPU_UCODE_ID_UVD,
AMDGPU_UCODE_ID_VCE,
AMDGPU_UCODE_ID_VCN,
AMDGPU_UCODE_ID_MAXIMUM,
};
/* engine firmware status */
enum AMDGPU_UCODE_STATUS {
AMDGPU_UCODE_STATUS_INVALID,
AMDGPU_UCODE_STATUS_NOT_LOADED,
AMDGPU_UCODE_STATUS_LOADED,
};
/* conform to smu_ucode_xfer_cz.h */
#define AMDGPU_SDMA0_UCODE_LOADED 0x00000001
#define AMDGPU_SDMA1_UCODE_LOADED 0x00000002
#define AMDGPU_CPCE_UCODE_LOADED 0x00000004
#define AMDGPU_CPPFP_UCODE_LOADED 0x00000008
#define AMDGPU_CPME_UCODE_LOADED 0x00000010
#define AMDGPU_CPMEC1_UCODE_LOADED 0x00000020
#define AMDGPU_CPMEC2_UCODE_LOADED 0x00000040
#define AMDGPU_CPRLC_UCODE_LOADED 0x00000100
/* amdgpu firmware info */
struct amdgpu_firmware_info {
/* ucode ID */
enum AMDGPU_UCODE_ID ucode_id;
/* request_firmware */
const struct firmware *fw;
/* starting mc address */
uint64_t mc_addr;
/* kernel linear address */
void *kaddr;
/* ucode_size_bytes */
uint32_t ucode_size;
/* starting tmr mc address */
uint32_t tmr_mc_addr_lo;
uint32_t tmr_mc_addr_hi;
};
void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_smc_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_gfx_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_sdma_hdr(const struct common_firmware_header *hdr);
void amdgpu_ucode_print_gpu_info_hdr(const struct common_firmware_header *hdr);
int amdgpu_ucode_validate(const struct firmware *fw);
bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr,
uint16_t hdr_major, uint16_t hdr_minor);
int amdgpu_ucode_init_bo(struct amdgpu_device *adev);
int amdgpu_ucode_fini_bo(struct amdgpu_device *adev);
enum amdgpu_firmware_load_type
amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type);
#endif
| {
"pile_set_name": "Github"
} |
# Compute the Mandelbrot set, to test complex numbers
def mandelbrot(w, h):
def in_set(c):
z = 0
for i in range(32):
z = z * z + c
if abs(z) > 100:
return i
return 0
img = bytearray(w * h)
xscale = (w - 1) / 2.4
yscale = (h - 1) / 3.2
for v in range(h):
line = memoryview(img)[v * w : v * w + w]
for u in range(w):
c = in_set(complex(v / yscale - 2.3, u / xscale - 1.2))
line[u] = c
return img
bm_params = {
(100, 100): (20, 20),
(1000, 1000): (80, 80),
(5000, 1000): (150, 150),
}
def bm_setup(ps):
return lambda: mandelbrot(ps[0], ps[1]), lambda: (ps[0] * ps[1], None)
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
namespace BrightstarDB.Caching
{
/// <summary>
/// Abstract base class for Brightstar cache implementations
/// </summary>
public abstract class AbstractCache : ICache
{
/// <summary>
/// The maximum cache size
/// </summary>
protected long CacheSize;
private readonly long _lowwaterMark;
private readonly long _highwaterMark;
private readonly long _cacheMaxSize;
/// <summary>
/// The policy for cache eviction
/// </summary>
protected readonly ICacheEvictionPolicy CacheEvictionPolicy;
private readonly object _cacheLock = new object();
/// <summary>
/// Creates a new cache instance
/// </summary>
/// <param name="cacheMaxSize">The maximum size of the cache in bytes</param>
/// <param name="cacheEvictionPolicy">The policy used to maintain cache size</param>
/// <param name="highwaterMark">The cache size at which the cache eviction policy will be run</param>
/// <param name="lowwaterMark">The size that the cache eviction policy will attempt to achieve after it has run</param>
protected AbstractCache(long cacheMaxSize, ICacheEvictionPolicy cacheEvictionPolicy, long highwaterMark = 0, long lowwaterMark = 0)
{
CacheSize = 0;
_cacheMaxSize = cacheMaxSize;
_highwaterMark = (long)(highwaterMark > 0 ? highwaterMark : cacheMaxSize*0.9);
_lowwaterMark =
(long)
(lowwaterMark > 0
? lowwaterMark
: (highwaterMark > 0 ? highwaterMark - (cacheMaxSize*0.25) : cacheMaxSize*0.65));
if (_lowwaterMark <= 0) _lowwaterMark = highwaterMark;
CacheEvictionPolicy = cacheEvictionPolicy;
}
/// <summary>
/// Adds a new item to the cache
/// </summary>
/// <param name="key">The cache key for the item. Must not be null</param>
/// <param name="data">The data to be stored as a byte array. Must not be null</param>
/// <param name="cachePriority">The priority of the item in the cache</param>
public void Insert(string key, byte[] data, CachePriority cachePriority)
{
if (key == null) throw new ArgumentNullException(nameof(key));
if (data == null) throw new ArgumentNullException(nameof(data));
Remove(key);
if (CacheSize + data.Length > _highwaterMark)
{
CacheEvictionPolicy.Run(this, CacheSize - _lowwaterMark);
if (CacheSize + data.Length > _cacheMaxSize)
{
// If even after cache eviction there is not enough space, return without caching the object
return;
}
}
var newEntry = AddEntry(key, data, cachePriority);
if (newEntry != null)
{
CacheEvictionPolicy.NotifyInsert(key, data.Length, cachePriority);
lock (_cacheLock)
{
CacheSize += newEntry.Size;
}
}
}
/// <summary>
/// Looks for an item in the cache and returns the bytes for that item
/// </summary>
/// <param name="key">The cache key of the item</param>
/// <returns>The bytes for the cached item or null if the item is not found in the cache</returns>
public byte[] Lookup(string key)
{
if (key == null) throw new ArgumentNullException(nameof(key));
var cacheEntry = GetEntry(key);
if (cacheEntry == null) return null;
CacheEvictionPolicy.NotifyLookup(key);
return cacheEntry.GetBytes();
}
/// <summary>
/// Removes an entry from the cache
/// </summary>
/// <param name="key">The key of the cache entry to be removed</param>
public void Remove(string key)
{
if (key == null) throw new ArgumentNullException(nameof(key));
long entrySize = RemoveEntry(key);
lock(_cacheLock)
{
CacheSize -= entrySize;
}
CacheEvictionPolicy.NotifyRemove(key);
}
/// <summary>
/// Determines if the cache contains an entry under a given key
/// </summary>
/// <param name="key">The key to look for</param>
/// <returns>True if an entry with this key is in the cache, false otherwise</returns>
public bool ContainsKey(string key)
{
if (key == null) throw new ArgumentNullException(nameof(key));
return GetEntry(key) != null;
}
/// <summary>
/// Provides an enumeration over the entries in the cache.
/// </summary>
/// <returns></returns>
public abstract IEnumerable<AbstractCacheEntry> ListEntries();
/// <summary>
/// Implemented in derived classes to add a new entry to the cache
/// </summary>
/// <param name="key">The key for the new entry</param>
/// <param name="data">The data for the new entry</param>
/// <param name="cachePriority">The entry priority</param>
/// <returns>The newly created cache entry</returns>
protected abstract AbstractCacheEntry AddEntry(string key, byte[] data, CachePriority cachePriority);
/// <summary>
/// Implemented in dervied classes to retrieve an entry from the cache
/// </summary>
/// <param name="key">The key to lookup</param>
/// <returns>The cache entry found or null if there was no match on <paramref name="key"/></returns>
protected abstract AbstractCacheEntry GetEntry(string key);
/// <summary>
/// Called by the eviction policy to remove an item from the cache
/// </summary>
/// <param name="key">The key of the item to remove from the cache</param>
/// <returns>The number of bytes removed from the cache by this eviction</returns>
/// <remarks>This method calls the protected RemoveEntry method and then updates the local cache size counter</remarks>
public long EvictEntry(string key)
{
if (key == null) throw new ArgumentNullException(nameof(key));
long bytesEvicted = RemoveEntry(key);
lock (_cacheLock)
{
CacheSize -= bytesEvicted;
}
return bytesEvicted;
}
/// <summary>
/// Removes the entry with the specified key from the cache
/// </summary>
/// <param name="key">The key of the entry to be removed</param>
/// <returns>The number of bytes of data evicted from the cache as a result of this operation. May be 0 if the key was not found in the cache.</returns>
protected abstract long RemoveEntry(string key);
}
}
| {
"pile_set_name": "Github"
} |
owner = FIN
controller = FIN
add_core = FIN
infra = 3
| {
"pile_set_name": "Github"
} |
australia reopens embassy in manila
( afp , manila , january 2 ) australia reopened its embassy in the philippines today , which was shut down about seven weeks ago due to what was described as a specific threat of a terrorist attack .
| {
"pile_set_name": "Github"
} |
/* Script for the Meteor Slides 1.5.6 slideshow
Copy "slideshow.js" from "/meteor-slides/js/" to your theme's directory to replace
the plugin's default slideshow script.
Learn more about customizing the slideshow script for Meteor Slides:
http://www.jleuze.com/plugins/meteor-slides/customizing-the-slideshow-script/
*/
// Set custom shortcut to avoid conflicts
var $j = jQuery.noConflict();
$j(document).ready(function() {
// Get the slideshow options
var $slidespeed = parseInt( meteorslidessettings.meteorslideshowspeed );
var $slidetimeout = parseInt( meteorslidessettings.meteorslideshowduration );
var $slideheight = parseInt( meteorslidessettings.meteorslideshowheight );
var $slidewidth = parseInt( meteorslidessettings.meteorslideshowwidth );
var $slidetransition = meteorslidessettings.meteorslideshowtransition;
// Setup jQuery Cycle
$j('.meteor-slides').cycle({
cleartypeNoBg: true,
fit: 1,
fx: $slidetransition,
height: $slideheight,
next: '#meteor-next',
pager: '#meteor-buttons',
pagerEvent: 'click',
pause: 1,
prev: '#meteor-prev',
slideExpr: '.mslide',
speed: $slidespeed,
timeout: $slidetimeout,
width: $slidewidth
});
// Setup jQuery TouchWipe
$j('.meteor-slides').touchwipe({
wipeLeft: function() {
$j('.meteor-slides').cycle('next');
},
wipeRight: function() {
$j('.meteor-slides').cycle('prev');
},
preventDefaultEvents: false
});
// Add class to hide and show prev/next nav on hover
$j('.meteor-slides').hover(function () {
$j(this).addClass('navhover');
}, function () {
$j(this).removeClass('navhover');
});
// Set a fixed height for prev/next nav in IE6
if(typeof document.body.style.maxWidth === 'undefined') {
$j('.meteor-nav a').height($slideheight);
}
// Add align class if set in metadata
$j('.meteor-slides').each(function () {
meteormetadata = $j(this).metadata();
if (meteormetadata.align == 'left') {
$j(this).addClass('meteor-left');
} else if (meteormetadata.align == 'right') {
$j(this).addClass('meteor-right');
} else if (meteormetadata.align == 'center') {
$j(this).addClass('meteor-center');
}
});
}); | {
"pile_set_name": "Github"
} |
/**************************************************************************************/
/* */
/* Visualization Library */
/* http://visualizationlibrary.org */
/* */
/* Copyright (c) 2005-2020, Michele Bosi */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without modification, */
/* are permitted provided that the following conditions are met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, this */
/* list of conditions and the following disclaimer. */
/* */
/* - Redistributions in binary form must reproduce the above copyright notice, this */
/* list of conditions and the following disclaimer in the documentation and/or */
/* other materials provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
/* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/**************************************************************************************/
#include <vlGraphics/Camera.hpp>
#include <vlGraphics/OpenGL.hpp>
#include <vlCore/AABB.hpp>
#include <vlCore/Log.hpp>
#include <vlCore/Say.hpp>
#undef near
#undef far
using namespace vl;
//-----------------------------------------------------------------------------
// Camera
//-----------------------------------------------------------------------------
Camera::Camera()
{
VL_DEBUG_SET_OBJECT_NAME()
mFrustum.planes().resize(6);
mFOV = 60.0;
mNearPlane = (real)0.05;
mFarPlane = (real)10000.0;
mLeft = mRight = mTop = mBottom = -1;
mViewport = new Viewport;
mProjectionMatrix = mat4::getPerspective(fov(), 640.0f/480.0f, nearPlane(), farPlane());
mProjectionType = PMT_PerspectiveProjection;
}
//-----------------------------------------------------------------------------
void Camera::applyModelViewMatrix(const mat4& model_matrix) const
{
/* some OpenGL drivers (ATI) require this instead of the more general (and mathematically correct) viewMatrix() */
mat4 viewm = viewMatrix();
viewm.e(3,0) = 0.0;
viewm.e(3,1) = 0.0;
viewm.e(3,2) = 0.0;
viewm.e(3,3) = 1.0;
glMatrixMode(GL_MODELVIEW);
#if 0
VL_glLoadMatrix( viewm.ptr() );
VL_glMultMatrix( matrix.ptr() );
#elif 0
viewm = viewm * matrix;
VL_glLoadMatrix( viewm.ptr() );
#else
VL_glLoadMatrix( (viewm * model_matrix).ptr() );
#endif
}
//-----------------------------------------------------------------------------
void Camera::applyProjMatrix() const
{
// projection matrix
glMatrixMode( GL_PROJECTION );
VL_glLoadMatrix( projectionMatrix().ptr() );
}
//-----------------------------------------------------------------------------
void Camera::applyViewMatrix() const
{
/* some OpenGL drivers (ATI) require this instead of the more general (and mathematically correct) viewMatrix() */
mat4 viewm = viewMatrix();
viewm.e(3,0) = 0.0;
viewm.e(3,1) = 0.0;
viewm.e(3,2) = 0.0;
viewm.e(3,3) = 1.0;
glMatrixMode(GL_MODELVIEW);
VL_glLoadMatrix( viewm.ptr() );
}
//-----------------------------------------------------------------------------
void Camera::computeNearFarOptimizedProjMatrix(const Sphere& scene_bounding_sphere)
{
// near/far clipping planes optimization
if (!scene_bounding_sphere.isNull())
{
// transform the sphere in camera coordinates
Sphere camera_sphere;
scene_bounding_sphere.transformed(camera_sphere, viewMatrix());
// visible objects are in the negative z, but we need a positive distance for the near and far clipping planes
mNearPlane = -(camera_sphere.center().z() + camera_sphere.radius());
mFarPlane = -(camera_sphere.center().z() - camera_sphere.radius());
// clamp to positive epsilon: can't let near and far clipping planes go behind the camera!
real epsilon = camera_sphere.radius() / 1000.0f;
mFarPlane = max(mFarPlane, epsilon * 2); // alway more than the near
mNearPlane = max(mNearPlane, epsilon * 1);
switch(projectionMatrixType())
{
case PMT_OrthographicProjection: setProjectionOrtho(mLeft, mRight, mBottom, mTop, mNearPlane, mFarPlane);
break;
case PMT_PerspectiveProjection: setProjectionPerspective();
break;
// we cannot do this: if we change the near plane we have to recompute also left, right, bottom and top!
// case PMT_PerspectiveProjectionFrustum: setProjectionFrustum(mLeft, mRight, mBottom, mTop, mNearPlane, mFarPlane);
// break;
default:
Log::bug("Camera::computeNearFarOptimizedProjMatrix() called on unsupported projection type.\n");
}
}
}
//-----------------------------------------------------------------------------
void Camera::adjustView(const AABB& aabb, const vec3& dir, const vec3& up, real bias)
{
VL_CHECK(bias >= 0)
VL_CHECK(!aabb.isNull())
if (bias < 0)
vl::Log::bug("Camera::adjustView(): 'bias' must be >= 0.\n");
vec3 center = aabb.center();
Sphere sphere(aabb);
const vec3& C = modelingMatrix().getT();
const vec3& V = -modelingMatrix().getZ();
const real R = sphere.radius();
// extract the frustum planes based on the current view and projection matrices
mat4 viewproj = projectionMatrix() * viewMatrix();
Frustum frustum; frustum.planes().resize(6);
extractPlanes( &frustum.planes()[0], viewproj );
// iterate over left/right/top/bottom clipping planes. the planes are in world coords.
real max_t = 0;
for(int i=0; i<4; ++i)
{
const vec3& O = frustum.plane(i).origin() * frustum.plane(i).normal();
const vec3& N = frustum.plane(i).normal();
real dot_n_v = dot(N,V);
// if this triggers adjust your parameters so it doesn't happen
VL_CHECK(dot_n_v);
real t = - (R + dot(O,N) - dot(C,N)) / dot_n_v;
VL_CHECK(t>=0)
if (t > max_t)
max_t = t;
}
real dist = max_t;
mat4 m = mat4::getLookAt(center+dir*dist*bias,center,up);
setViewMatrix(m);
}
//-----------------------------------------------------------------------------
void Camera::computeFrustumPlanes()
{
// build modelview matrix
mat4 viewproj = projectionMatrix() * viewMatrix();
// frustum plane extraction
mFrustum.planes().resize(6);
extractPlanes( &mFrustum.planes()[0], viewproj );
}
//-----------------------------------------------------------------------------
void Camera::setProjectionFrustum(real left, real right, real bottom, real top, real near, real far)
{
// see http://www.opengl.org/resources/faq/technical/transformations.htm
setFOV( 2.0f*atan((top-bottom)*0.5f/near) );
setNearPlane(near);
setFarPlane(far);
setProjectionMatrix(mat4::getFrustum(left, right, bottom, top, near, far), PMT_PerspectiveProjectionFrustum);
}
//-----------------------------------------------------------------------------
void Camera::setProjectionPerspective(real fov, real near, real far)
{
setFOV(fov);
setNearPlane(near);
setFarPlane(far);
setProjectionMatrix(mat4::getPerspective(fov, aspectRatio(), near, far), PMT_PerspectiveProjection);
}
//-----------------------------------------------------------------------------
void Camera::setProjectionPerspective()
{
setProjectionMatrix(mat4::getPerspective(fov(), aspectRatio(), nearPlane(), farPlane()), PMT_PerspectiveProjection);
}
//-----------------------------------------------------------------------------
void Camera::setProjectionOrtho()
{
mLeft = 0;
mRight = (real)mViewport->width();
mBottom = 0;
mTop = (real)mViewport->height();
mFOV = -1;
setProjectionMatrix( mat4::getOrtho( mLeft, mRight, mBottom, mTop, mNearPlane, mFarPlane), PMT_OrthographicProjection );
}
//-----------------------------------------------------------------------------
void Camera::setProjectionOrtho(real left, real right, real bottom, real top, real znear, real zfar)
{
mLeft = left;
mRight = right;
mBottom = bottom;
mTop = top;
mFOV = -1;
mNearPlane = znear;
mFarPlane = zfar;
setProjectionMatrix( mat4::getOrtho( mLeft, mRight, mBottom, mTop, mNearPlane, mFarPlane), PMT_OrthographicProjection );
}
//-----------------------------------------------------------------------------
void Camera::setProjectionOrtho(real offset)
{
mLeft = offset;
mRight = viewport()->width() + offset;
mBottom = offset;
mTop = viewport()->height() + offset;
mFOV = -1;
mNearPlane = -1;
mFarPlane = +1;
setProjectionMatrix( mat4::getOrtho( mLeft, mRight, mBottom, mTop, mNearPlane, mFarPlane), PMT_OrthographicProjection );
}
//-----------------------------------------------------------------------------
void Camera::setViewMatrixLookAt( const vec3& eye, const vec3& at, const vec3& up)
{
// note: this sets both the local matrix and the view matrix
setViewMatrix( mat4::getLookAt(eye, at, up) );
}
//-----------------------------------------------------------------------------
void Camera::getViewMatrixAsLookAt( vec3& eye, vec3& at, vec3& up, vec3& right) const
{
mModelingMatrix.getAsLookAtModeling(eye, at, up, right);
}
//-----------------------------------------------------------------------------
bool Camera::project(const vec4& in, vec4& out) const
{
out = mProjectionMatrix * mViewMatrix * in;
if (out.w() == 0.0f)
return false;
out.x() /= out.w();
out.y() /= out.w();
out.z() /= out.w();
// map to range 0-1
out.x() = out.x() * 0.5f + 0.5f;
out.y() = out.y() * 0.5f + 0.5f;
out.z() = out.z() * 0.5f + 0.5f;
// map to viewport
out.x() = out.x() * mViewport->width() + mViewport->x();
out.y() = out.y() * mViewport->height() + mViewport->y();
return true;
}
//-----------------------------------------------------------------------------
bool Camera::unproject(const vec3& win, vec4& out) const
{
vec4 v;
v.x() = win.x();
v.y() = win.y();
v.z() = win.z();
v.w() = 1.0;
// map from viewport to 0-1
v.x() = (v.x() - mViewport->x()) / mViewport->width();
v.y() = (v.y() - mViewport->y()) / mViewport->height();
// map to range -1 to 1
v.x() = v.x() * 2.0f - 1.0f;
v.y() = v.y() * 2.0f - 1.0f;
v.z() = v.z() * 2.0f - 1.0f;
real det=0;
mat4 inverse = (mProjectionMatrix * mViewMatrix).getInverse(&det);
if (!det)
return false;
v = inverse * v;
if (v.w() == 0.0)
return false;
out = v / v.w();
return true;
}
//-----------------------------------------------------------------------------
bool Camera::unproject(std::vector<vec3>& win) const
{
real det=0;
mat4 inverse = (mProjectionMatrix * mViewMatrix).getInverse(&det);
if (!det)
return false;
bool ok = true;
for(unsigned i=0; i<win.size(); ++i)
{
vec4 v;
v = vec4( win[i], 1.0 );
// map from viewport to 0-1
v.x() = (v.x() - mViewport->x()) / mViewport->width();
v.y() = (v.y() - mViewport->y()) / mViewport->height();
// map to range -1 to 1
v.x() = v.x() * 2.0f - 1.0f;
v.y() = v.y() * 2.0f - 1.0f;
v.z() = v.z() * 2.0f - 1.0f;
v = inverse * v;
if (v.w() == 0.0)
{
ok = false;
continue;
}
v = v / v.w();
win[i] = v.xyz();
}
return ok;
}
//-----------------------------------------------------------------------------
Ray Camera::computeRay(int winx, int winy)
{
vl::vec4 out;
if (!unproject( vl::vec3((real)winx,(real)winy,0), out ))
return Ray();
else
{
vl::Ray ray;
ray.setOrigin(out.xyz());
ray.setDirection( (out.xyz() - modelingMatrix().getT()).normalize() );
return ray;
}
}
//-----------------------------------------------------------------------------
Frustum Camera::computeRayFrustum(int winx, int winy)
{
/*
n3
D-----C
| |
n4| O |n2
| |
A-----B
n1
*/
// compute the frustum passing through the adjacent pixels
vl::vec4 A1,B1,C1,D1;
vl::vec4 A2,B2,C2,D2;
unproject( vl::vec3((real)winx-1,(real)winy-1,0), A1 );
unproject( vl::vec3((real)winx+1,(real)winy-1,0), B1 );
unproject( vl::vec3((real)winx+1,(real)winy+1,0), C1 );
unproject( vl::vec3((real)winx-1,(real)winy+1,0), D1 );
unproject( vl::vec3((real)winx-1,(real)winy-1,0.1f), A2 );
unproject( vl::vec3((real)winx+1,(real)winy-1,0.1f), B2 );
unproject( vl::vec3((real)winx+1,(real)winy+1,0.1f), C2 );
unproject( vl::vec3((real)winx-1,(real)winy+1,0.1f), D2 );
vec3 n1 = -cross(A2.xyz()-A1.xyz(),B1.xyz()-A1.xyz());
vec3 n2 = -cross(B2.xyz()-B1.xyz(),C1.xyz()-B1.xyz());
vec3 n3 = -cross(C2.xyz()-C1.xyz(),D1.xyz()-C1.xyz());
vec3 n4 = -cross(D2.xyz()-D1.xyz(),A1.xyz()-D1.xyz());
Frustum frustum;
frustum.planes().push_back( Plane( A1.xyz(), n1 ) );
frustum.planes().push_back( Plane( B1.xyz(), n2 ) );
frustum.planes().push_back( Plane( C1.xyz(), n3 ) );
frustum.planes().push_back( Plane( D1.xyz(), n4 ) );
return frustum;
}
//-----------------------------------------------------------------------------
| {
"pile_set_name": "Github"
} |
/*
*
* Copyright (c) 2013-2017 Nest Labs, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* Implementation of DeviceDescOptions object, which handles parsing of command line options
* that specify descriptive information about the simulated "device" used in test applications.
*
*/
#ifndef DEVICEDESCCONFIG_H_
#define DEVICEDESCCONFIG_H_
#include <Weave/Profiles/device-description/DeviceDescription.h>
#include "ToolCommonOptions.h"
using nl::Weave::Profiles::DeviceDescription::WeaveDeviceDescriptor;
class DeviceDescOptions : public OptionSetBase
{
public:
DeviceDescOptions();
// The base values for the test device descriptor, not including fields
// that change dynamically (e.g. FabricId).
WeaveDeviceDescriptor BaseDeviceDesc;
void GetDeviceDesc(WeaveDeviceDescriptor& deviceDesc);
bool ParseOption(int optId);
virtual bool HandleOption(const char *progName, OptionSet *optSet, int id, const char *name, const char *arg);
};
extern DeviceDescOptions gDeviceDescOptions;
#endif // DEVICEDESCCONFIG_H_
| {
"pile_set_name": "Github"
} |
class IDataGridViewEditingCell:
""" Defines common functionality for a cell that allows the manipulation of its value. """
def GetEditingCellFormattedValue(self,context):
"""
GetEditingCellFormattedValue(self: IDataGridViewEditingCell,context: DataGridViewDataErrorContexts) -> object
Retrieves the formatted value of the cell.
context: A bitwise combination of System.Windows.Forms.DataGridViewDataErrorContexts values that
specifies the context in which the data is needed.
Returns: An System.Object that represents the formatted version of the cell contents.
"""
pass
def PrepareEditingCellForEdit(self,selectAll):
"""
PrepareEditingCellForEdit(self: IDataGridViewEditingCell,selectAll: bool)
Prepares the currently selected cell for editing
selectAll: true to select the cell contents; otherwise,false.
"""
pass
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
EditingCellFormattedValue=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets the formatted value of the cell.
Get: EditingCellFormattedValue(self: IDataGridViewEditingCell) -> object
Set: EditingCellFormattedValue(self: IDataGridViewEditingCell)=value
"""
EditingCellValueChanged=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets or sets a value indicating whether the value of the cell has changed.
Get: EditingCellValueChanged(self: IDataGridViewEditingCell) -> bool
Set: EditingCellValueChanged(self: IDataGridViewEditingCell)=value
"""
| {
"pile_set_name": "Github"
} |
# -*- mode: snippet -*-
# name: elisp
# key: elisp
# uuid: elisp
# --
#+begin_src emacs-lisp :tangle yes
$0
#+end_src | {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.j2objc.nio.charset;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/*-[
#include "com/google/j2objc/nio/charset/IconvCharsetDecoder.h"
#include "com/google/j2objc/nio/charset/IconvCharsetEncoder.h"
#include "java/io/UnsupportedEncodingException.h"
#include "java/lang/System.h"
]-*/
/**
* iOS native charset support.
*
* @author Tom Ball
*/
public class IOSCharset extends Charset {
// CharsetInfo*
private final long charsetInfo;
private final byte[] replacementBytes;
private static Map<String, IOSCharset> encodings = new HashMap<String, IOSCharset>();
private IOSCharset(String canonicalName, String[] aliases, long info) {
super(canonicalName, aliases);
charsetInfo = info;
replacementBytes = createReplacementBytes(info);
}
private static native byte[] createReplacementBytes(long infoP) /*-[
CharsetInfo *info = (CharsetInfo *)infoP;
return [IOSByteArray arrayWithBytes:info->replacementBytes count:info->replacementBytesCount];
]-*/;
public native long cfEncoding() /*-[
return ((CharsetInfo *)self->charsetInfo_)->cfEncoding;
]-*/;
@Override
public boolean contains(Charset charset) {
return false;
}
@Override
public native CharsetEncoder newEncoder() /*-[
CharsetInfo *info = (CharsetInfo *)self->charsetInfo_;
return create_ComGoogleJ2objcNioCharsetIconvCharsetEncoder_initWithJavaNioCharsetCharset_withFloat_withFloat_withByteArray_withLong_(
self, info->averageBytesPerChar, info->maxBytesPerChar, self->replacementBytes_,
(jlong)info->iconvName);
]-*/;
@Override
public native CharsetDecoder newDecoder() /*-[
CharsetInfo *info = (CharsetInfo *)self->charsetInfo_;
return create_ComGoogleJ2objcNioCharsetIconvCharsetDecoder_initWithJavaNioCharsetCharset_withFloat_withFloat_withLong_(
self, info->averageCharsPerByte, info->maxCharsPerByte, (jlong)info->iconvName);
]-*/;
public static Set<String> getAvailableCharsetNames() {
return getEncodings().keySet();
}
public static Charset charsetForName(String charsetName) {
// See if an encoding was requested by name.
Map<String, IOSCharset> encodings = getEncodings();
IOSCharset result = encodings.get(charsetName.toUpperCase());
if (result != null) {
return result;
}
// Scan aliases.
for (IOSCharset cs : getEncodings().values()) {
for (String s : cs.aliases()) {
if (s.equalsIgnoreCase(charsetName)) {
return cs;
}
}
}
return null;
}
/*-[
typedef struct {
CFStringEncoding cfEncoding;
const char *iconvName;
NSString *javaName;
NSString **aliases;
unsigned aliasCount;
jfloat averageBytesPerChar;
jfloat maxBytesPerChar;
jfloat averageCharsPerByte;
jfloat maxCharsPerByte;
const jbyte *replacementBytes;
unsigned replacementBytesCount;
} CharsetInfo;
static const NSString *utf8_aliases[] = { @"unicode-1-1-utf-8", @"UTF8" };
static const NSString *ascii_aliases[] = {
@"cp367", @"ascii7", @"ISO646-US", @"646", @"csASCII", @"us", @"iso_646.irv:1983",
@"ISO_646.irv:1991", @"IBM367", @"ASCII", @"default", @"ANSI_X3.4-1986",
@"ANSI_X3.4-1968", @"iso-ir-6", @"ANSI_X3.4-1968", @"ANSI_X3.4-1986" };
static const NSString *eucjp_aliases[] = {
@"eucjis", @"Extended_UNIX_Code_Packed_Format_for_Japanese", @"x-eucjp", @"eucjp",
@"csEUCPkdFmtjapanese", @"x-euc-jp", @"euc_jp" };
static const NSString *iso8859_aliases[] = {
@"csISOLatin1", @"latin1", @"IBM-819", @"iso-ir-100", @"8859_1",
@ "ISO_8859-1:1987", @"ISO_8859-1", @"819", @"l1", @"ISO8859-1",
@"IBM819", @"ISO_8859_1", @"ISO8859_1", @"cp819", @"ISO8859-1" };
static const NSString *shiftjis_aliases[] = {
@"x-sjis", @"shift_jis", @"sjis", @"ms_kanji", @"shift-jis", @"csShiftJIS" };
static const NSString *latin2_aliases[] = {
@"csISOLatin2", @"iso-ir-101", @"ibm-912", @"8859_2", @"l2", @"ISO_8859-2",
@"ibm912", @"912", @"ISO8859-2", @"latin2", @"iso8859_2", @"ISO_8859-2:1987", @"cp912" };
static const NSString *utf16_aliases[] = {
@"utf16", @"Unicode", @"UnicodeBig", @"UTF_16", @"unicode" };
static const NSString *win1251_aliases[] = { @"ansi-1251", @"cp5347", @"cp1251" };
static const NSString *win1252_aliases[] = { @"cp1252", @"cp5348" };
static const NSString *win1253_aliases[] = { @"cp5349", @"cp1253" };
static const NSString *win1254_aliases[] = { @"cp5350", @"cp1254" };
static const NSString *win1250_aliases[] = { @"cp1250", @"cp5346" };
static const NSString *iso2022_aliases[] = {
@"jis_encoding", @"csjisencoding", @"jis", @"iso2022jp", @"csISO2022JP" };
static const NSString *macroman_aliases[] = { @"MacRoman" };
static const NSString *utf16be_aliases[] = {
@"X-UTF-16BE", @"UTF_16BE", @"ISO-10646-UCS-2", @"UnicodeBigUnmarked" };
static const NSString *utf16le_aliases[] = {
@"UnicodeLittleUnmarked", @"UTF_16LE", @"X-UTF-16LE" };
static const NSString *utf32_aliases[] = { @"UTF32", @"UTF_32" };
static const NSString *utf32be_aliases[] = { @"X-UTF-32BE", @"UTF_32BE" };
static const NSString *utf32le_aliases[] = { @"X-UTF-32LE", @"UTF_32LE" };
static const NSString *gb2312_aliases[] = {
@"gb2312", @"euc-cn", @"x-EUC-CN", @"euccn", @"EUC_CN", @"gb2312-80", @"gb2312-1980" };
static const NSString *euckr_aliases[] = {
@"euc_kr", @"csEUCKR", @"ksc5601", @"5601", @"ksc5601_1987", @"ksc_5601",
@"ksc5601-1987", @"ks_c_5601-1987", @"euckr" };
static const NSString *gbk_aliases[] = {
@"windows-936", @"CP936", @"MS936", @"ms_936", @"x-mswin-936" };
static const NSString *gb18030_aliases[] = { @"gb18030-2000" };
static const NSString *big5_aliases[] = {
@"csBig5", @"CN-Big5", @"BIG-FIVE", @"BIGFIVE" };
static const NSString *big5hkscs_aliases[] = { @"Big5_HKSCS", @"big5hkscs" };
static const jbyte ascii_replacement[] = { 63 };
static const jbyte gb18030_replacement[] = { 0x1a };
static const jbyte utf16be_replacement[] = { -1, -3 };
static const jbyte utf16le_replacement[] = { -3, -1 };
static const jbyte iso2022_replacement[] = { 33, 41 };
static const jbyte utf32be_replacement[] = { 0, 0, -1, -3 };
static const jbyte utf32le_replacement[] = { -3, -1, 0, 0 };
// Encodings from NSString.h.
//
// All encoding names must be uppercase, so map lookups are case-insensitive.
static const CharsetInfo iosCharsets[] = {
{ kCFStringEncodingUTF8, "UTF-8", @"UTF-8", utf8_aliases, 2,
2.0f, 3.0f, 1.0f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingASCII, "ASCII", @"US-ASCII", ascii_aliases, 16,
1.0f, 1.0f, 1.0f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingEUC_JP, "EUC-JP", @"EUC-JP", eucjp_aliases, 7,
3.0f, 3.0f, 0.5f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingISOLatin1, "ISO-8859-1", @"ISO-8859-1", iso8859_aliases, 15,
1.0f, 1.0f, 1.0f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingDOSJapanese, "SHIFT_JIS", @"SHIFT_JIS", shiftjis_aliases, 6,
2.0f, 2.0f, 0.5f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingISOLatin2, "ISO-8859-2", @"ISO-8859-2", latin2_aliases, 13,
1.0f, 1.0f, 1.0f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingUnicode, "UTF-16", @"UTF-16", utf16_aliases, 5,
4.0f, 4.0f, 0.5f, 1.0f, utf16be_replacement, 2 },
{ kCFStringEncodingWindowsCyrillic, "CP1251", @"WINDOWS-1251", win1251_aliases, 3,
1.0f, 1.0f, 1.0f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingWindowsLatin1, "CP1252", @"WINDOWS-1252", win1252_aliases, 2,
1.0f, 1.0f, 1.0f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingWindowsGreek, "CP1253", @"WINDOWS-1253", win1253_aliases, 2,
1.0f, 1.0f, 1.0f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingWindowsLatin5, "CP1254", @"WINDOWS-1254", win1254_aliases, 2,
1.0f, 1.0f, 1.0f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingWindowsLatin2, "CP1250", @"WINDOWS-1250", win1250_aliases, 2,
1.0f, 1.0f, 1.0f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingISO_2022_JP, "ISO-2022-JP", @"ISO-2022-JP", iso2022_aliases, 5,
4.0f, 8.0f, 0.5f, 1.0f, iso2022_replacement, 2 },
{ kCFStringEncodingMacRoman, "MacRoman", @"X-MACROMAN", macroman_aliases, 1,
1.0f, 1.0f, 1.0f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingUTF16BE, "UTF-16BE", @"UTF-16BE", utf16be_aliases, 4,
2.0f, 2.0f, 0.5f, 1.0f, utf16be_replacement, 2 },
{ kCFStringEncodingUTF16LE, "UTF-16LE", @"UTF-16LE", utf16le_aliases, 3,
2.0f, 2.0f, 0.5f, 1.0f, utf16le_replacement, 2 },
// "UTF-32" is mapped to NSUTF32BigEndianStringEncoding instead of NSUTF32StringEncoding because
// the former (strangely) encodes in little endian but decodes in big endian. The latter is a
// closer match to Java's "UTF-32".
{ kCFStringEncodingUTF32BE, "UTF-32BE", @"UTF-32", utf32_aliases, 2,
4.0f, 4.0f, 0.25f, 1.0f, utf32be_replacement, 4 },
{ kCFStringEncodingUTF32BE, "UTF-32BE", @"UTF-32BE", utf32be_aliases, 2,
4.0f, 4.0f, 0.25f, 1.0f, utf32be_replacement, 4 },
{ kCFStringEncodingUTF32LE, "UTF-32LE", @"UTF-32LE", utf32le_aliases, 2,
4.0f, 4.0f, 0.25f, 1.0f, utf32le_replacement, 4 },
{ kCFStringEncodingEUC_CN, "EUC-CN", @"GB2312", gb2312_aliases, 7,
2.0f, 2.0f, 0.5f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingEUC_KR, "EUC-KR", @"EUC-KR", euckr_aliases, 9,
2.0f, 2.0f, 0.5f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingGBK_95, "GBK", @"GBK", gbk_aliases, 4,
2.0f, 2.0f, 0.5f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingGB_18030_2000, "GB18030", @"GB18030", gb18030_aliases, 1,
2.5f, 4.0f, 1.0f, 2.0f, gb18030_replacement, 1 },
{ kCFStringEncodingBig5, "BIG5", @"BIG5", big5_aliases, 4,
2.0f, 2.0f, 0.5f, 1.0f, ascii_replacement, 1 },
{ kCFStringEncodingBig5_HKSCS_1999, "BIG5-HKSCS", @"BIG5-HKSCS", big5hkscs_aliases, 2,
2.0f, 2.0f, 0.5f, 1.0f, ascii_replacement, 1 },
};
static const int numIosCharsets = sizeof(iosCharsets) / sizeof(CharsetInfo);
static ComGoogleJ2objcNioCharsetIOSCharset *addEncoding(const CharsetInfo *info) {
IOSObjectArray *aliases = [IOSObjectArray arrayWithObjects:info->aliases
count:info->aliasCount
type:NSString_class_()];
ComGoogleJ2objcNioCharsetIOSCharset *cs =
create_ComGoogleJ2objcNioCharsetIOSCharset_initWithNSString_withNSStringArray_withLong_(
info->javaName, aliases, (jlong)info);
[ComGoogleJ2objcNioCharsetIOSCharset_encodings putWithId:info->javaName withId:cs];
return cs;
}
]-*/
private static native Map<String, IOSCharset> getEncodings() /*-[
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
for (jint i = 0; i < numIosCharsets; i++) {
addEncoding(&iosCharsets[i]);
}
});
return ComGoogleJ2objcNioCharsetIOSCharset_encodings;
]-*/;
}
| {
"pile_set_name": "Github"
} |
import Caption from '~/components/text/caption'
import Note from '~/components/text/note'
import Link from '~/components/text/link'
import ProductName from '~/components/name/product-name'
import { GITHUB_SYSTEM_ENVS } from '~/lib/data/system-env-variables'
import SystemEnvVariablesTable from '~/components/env-variables/system-env-variables-table'
You may want to use different workflows and APIs based on Git information. To support this, the following [System Environment Variables](/docs/v2/build-step#system-environment-variables) can be added to your deployment:
<br />
<SystemEnvVariablesTable envs={GITHUB_SYSTEM_ENVS} />
| {
"pile_set_name": "Github"
} |
"""Implements Cursor for file storage."""
from sacredboard.app.data import Cursor
class FileStoreCursor(Cursor):
"""Implements Cursor for file storage."""
def __init__(self, count, iterable):
"""Initialize FileStoreCursor with a given iterable."""
self.iterable = iterable
self._count = count
def count(self):
"""
Return the number of runs in this query.
:return: int
"""
return self._count
def __iter__(self):
"""Iterate over runs."""
return iter(self.iterable)
| {
"pile_set_name": "Github"
} |
/*
This file is part of Darling.
Copyright (C) 2017 Lubos Dolezel
Darling 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.
Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#import <Contacts/CNContactFetchRequest.h>
@implementation CNContactFetchRequest
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector {
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation {
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end
| {
"pile_set_name": "Github"
} |
namespace :entry do
# rake entry:send_entries_test
task :send_hourly_entries_test => :environment do
user = User.where(:email=>"[email protected]").first
user.send_entry_email
end
task :send_hourly_entries => :environment do
users = User.active.in_good_standing
users.each do |user|
if user.send_entry_email_now?
user.send_entry_email
end
end
end
# Tmp task to import entries from legacy DB
task :import => :environment do
# Remove all records
User.delete_all
Entry.delete_all
file = File.read("#{Rails.root}/import/User.json")
user_hash = JSON.parse(file)
file = File.read("#{Rails.root}/import/Entry.json")
entry_hash = JSON.parse(file)
user_count = 0
entry_count = 0
user_hash["results"].each do |u|
next unless u["email"] == "[email protected]"
email_times = {}
u["emailTimes"].each do |day,time|
if time
email_times[day] = Time.now.utc.change(hour: time.to_i).in_time_zone(u["timezone"]).hour
end
end
user = User.create(
email: u["email"],
email_times: email_times,
plan: u["plan"],
plan_started: u["planStarted"] ? Chronic.parse(u["planStarted"]["iso"]) : nil,
plan_status: u["planStatus"],
status: u["status"],
stripe_customer_id: u["stripeCustomerId"],
time_zone: u["timezone"],
password: SecureRandom.base64(20)
)
user_count += 1 if user.persisted?
entry_hash["results"].each do |e|
next unless e["user"]["objectId"] == u["objectId"]
entry = Entry.create(
body: e["body"],
created_at: Chronic.parse(e["createdAt"]),
entry_date: e["entryDate"],
source: e["source"],
updated_at: Chronic.parse(e["updatedAt"]),
user: user
)
entry_count += 1 if entry.persisted?
end
end
puts "Created #{user_count}/#{user_hash["results"].length} users and #{entry_count}/#{entry_hash["results"].length} entries."
end
end | {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2015 Marvell International Ltd.
*
* Copyright (C) 2016 Stefan Roese <[email protected]>
*
* Based on:
* - drivers/pci/pcie_imx.c
* - drivers/pci/pci_mvebu.c
* - drivers/pci/pcie_xilinx.c
*/
#include <common.h>
#include <dm.h>
#include <pci.h>
#include <asm/io.h>
#include <asm-generic/gpio.h>
DECLARE_GLOBAL_DATA_PTR;
/* PCI Config space registers */
#define PCIE_CONFIG_BAR0 0x10
#define PCIE_LINK_STATUS_REG 0x80
#define PCIE_LINK_STATUS_SPEED_OFF 16
#define PCIE_LINK_STATUS_SPEED_MASK (0xf << PCIE_LINK_STATUS_SPEED_OFF)
#define PCIE_LINK_STATUS_WIDTH_OFF 20
#define PCIE_LINK_STATUS_WIDTH_MASK (0xf << PCIE_LINK_STATUS_WIDTH_OFF)
/* Resizable bar capability registers */
#define RESIZABLE_BAR_CAP 0x250
#define RESIZABLE_BAR_CTL0 0x254
#define RESIZABLE_BAR_CTL1 0x258
/* iATU registers */
#define PCIE_ATU_VIEWPORT 0x900
#define PCIE_ATU_REGION_INBOUND (0x1 << 31)
#define PCIE_ATU_REGION_OUTBOUND (0x0 << 31)
#define PCIE_ATU_REGION_INDEX1 (0x1 << 0)
#define PCIE_ATU_REGION_INDEX0 (0x0 << 0)
#define PCIE_ATU_CR1 0x904
#define PCIE_ATU_TYPE_MEM (0x0 << 0)
#define PCIE_ATU_TYPE_IO (0x2 << 0)
#define PCIE_ATU_TYPE_CFG0 (0x4 << 0)
#define PCIE_ATU_TYPE_CFG1 (0x5 << 0)
#define PCIE_ATU_CR2 0x908
#define PCIE_ATU_ENABLE (0x1 << 31)
#define PCIE_ATU_BAR_MODE_ENABLE (0x1 << 30)
#define PCIE_ATU_LOWER_BASE 0x90C
#define PCIE_ATU_UPPER_BASE 0x910
#define PCIE_ATU_LIMIT 0x914
#define PCIE_ATU_LOWER_TARGET 0x918
#define PCIE_ATU_BUS(x) (((x) & 0xff) << 24)
#define PCIE_ATU_DEV(x) (((x) & 0x1f) << 19)
#define PCIE_ATU_FUNC(x) (((x) & 0x7) << 16)
#define PCIE_ATU_UPPER_TARGET 0x91C
#define PCIE_LINK_CAPABILITY 0x7C
#define PCIE_LINK_CTL_2 0xA0
#define TARGET_LINK_SPEED_MASK 0xF
#define LINK_SPEED_GEN_1 0x1
#define LINK_SPEED_GEN_2 0x2
#define LINK_SPEED_GEN_3 0x3
#define PCIE_GEN3_RELATED 0x890
#define GEN3_EQU_DISABLE (1 << 16)
#define GEN3_ZRXDC_NON_COMP (1 << 0)
#define PCIE_GEN3_EQU_CTRL 0x8A8
#define GEN3_EQU_EVAL_2MS_DISABLE (1 << 5)
#define PCIE_ROOT_COMPLEX_MODE_MASK (0xF << 4)
#define PCIE_LINK_UP_TIMEOUT_MS 100
#define PCIE_GLOBAL_CONTROL 0x8000
#define PCIE_APP_LTSSM_EN (1 << 2)
#define PCIE_DEVICE_TYPE_OFFSET (4)
#define PCIE_DEVICE_TYPE_MASK (0xF)
#define PCIE_DEVICE_TYPE_EP (0x0) /* Endpoint */
#define PCIE_DEVICE_TYPE_LEP (0x1) /* Legacy endpoint */
#define PCIE_DEVICE_TYPE_RC (0x4) /* Root complex */
#define PCIE_GLOBAL_STATUS 0x8008
#define PCIE_GLB_STS_RDLH_LINK_UP (1 << 1)
#define PCIE_GLB_STS_PHY_LINK_UP (1 << 9)
#define PCIE_ARCACHE_TRC 0x8050
#define PCIE_AWCACHE_TRC 0x8054
#define ARCACHE_SHAREABLE_CACHEABLE 0x3511
#define AWCACHE_SHAREABLE_CACHEABLE 0x5311
#define LINK_SPEED_GEN_1 0x1
#define LINK_SPEED_GEN_2 0x2
#define LINK_SPEED_GEN_3 0x3
/**
* struct pcie_dw_mvebu - MVEBU DW PCIe controller state
*
* @ctrl_base: The base address of the register space
* @cfg_base: The base address of the configuration space
* @cfg_size: The size of the configuration space which is needed
* as it gets written into the PCIE_ATU_LIMIT register
* @first_busno: This driver supports multiple PCIe controllers.
* first_busno stores the bus number of the PCIe root-port
* number which may vary depending on the PCIe setup
* (PEX switches etc).
*/
struct pcie_dw_mvebu {
void *ctrl_base;
void *cfg_base;
fdt_size_t cfg_size;
int first_busno;
/* IO and MEM PCI regions */
struct pci_region io;
struct pci_region mem;
};
static int pcie_dw_get_link_speed(const void *regs_base)
{
return (readl(regs_base + PCIE_LINK_STATUS_REG) &
PCIE_LINK_STATUS_SPEED_MASK) >> PCIE_LINK_STATUS_SPEED_OFF;
}
static int pcie_dw_get_link_width(const void *regs_base)
{
return (readl(regs_base + PCIE_LINK_STATUS_REG) &
PCIE_LINK_STATUS_WIDTH_MASK) >> PCIE_LINK_STATUS_WIDTH_OFF;
}
/**
* pcie_dw_prog_outbound_atu() - Configure ATU for outbound accesses
*
* @pcie: Pointer to the PCI controller state
* @index: ATU region index
* @type: ATU accsess type
* @cpu_addr: the physical address for the translation entry
* @pci_addr: the pcie bus address for the translation entry
* @size: the size of the translation entry
*/
static void pcie_dw_prog_outbound_atu(struct pcie_dw_mvebu *pcie, int index,
int type, u64 cpu_addr, u64 pci_addr,
u32 size)
{
writel(PCIE_ATU_REGION_OUTBOUND | index,
pcie->ctrl_base + PCIE_ATU_VIEWPORT);
writel(lower_32_bits(cpu_addr), pcie->ctrl_base + PCIE_ATU_LOWER_BASE);
writel(upper_32_bits(cpu_addr), pcie->ctrl_base + PCIE_ATU_UPPER_BASE);
writel(lower_32_bits(cpu_addr + size - 1),
pcie->ctrl_base + PCIE_ATU_LIMIT);
writel(lower_32_bits(pci_addr),
pcie->ctrl_base + PCIE_ATU_LOWER_TARGET);
writel(upper_32_bits(pci_addr),
pcie->ctrl_base + PCIE_ATU_UPPER_TARGET);
writel(type, pcie->ctrl_base + PCIE_ATU_CR1);
writel(PCIE_ATU_ENABLE, pcie->ctrl_base + PCIE_ATU_CR2);
}
/**
* set_cfg_address() - Configure the PCIe controller config space access
*
* @pcie: Pointer to the PCI controller state
* @d: PCI device to access
* @where: Offset in the configuration space
*
* Configures the PCIe controller to access the configuration space of
* a specific PCIe device and returns the address to use for this
* access.
*
* Return: Address that can be used to access the configation space
* of the requested device / offset
*/
static uintptr_t set_cfg_address(struct pcie_dw_mvebu *pcie,
pci_dev_t d, uint where)
{
uintptr_t va_address;
u32 atu_type;
/*
* Region #0 is used for Outbound CFG space access.
* Direction = Outbound
* Region Index = 0
*/
if (PCI_BUS(d) == (pcie->first_busno + 1))
/* For local bus, change TLP Type field to 4. */
atu_type = PCIE_ATU_TYPE_CFG0;
else
/* Otherwise, change TLP Type field to 5. */
atu_type = PCIE_ATU_TYPE_CFG1;
if (PCI_BUS(d) == pcie->first_busno) {
/* Accessing root port configuration space. */
va_address = (uintptr_t)pcie->ctrl_base;
} else {
d = PCI_MASK_BUS(d) | (PCI_BUS(d) - pcie->first_busno);
pcie_dw_prog_outbound_atu(pcie, PCIE_ATU_REGION_INDEX0,
atu_type, (u64)pcie->cfg_base,
d << 8, pcie->cfg_size);
va_address = (uintptr_t)pcie->cfg_base;
}
va_address += where & ~0x3;
return va_address;
}
/**
* pcie_dw_addr_valid() - Check for valid bus address
*
* @d: The PCI device to access
* @first_busno: Bus number of the PCIe controller root complex
*
* Return 1 (true) if the PCI device can be accessed by this controller.
*
* Return: 1 on valid, 0 on invalid
*/
static int pcie_dw_addr_valid(pci_dev_t d, int first_busno)
{
if ((PCI_BUS(d) == first_busno) && (PCI_DEV(d) > 0))
return 0;
if ((PCI_BUS(d) == first_busno + 1) && (PCI_DEV(d) > 0))
return 0;
return 1;
}
/**
* pcie_dw_mvebu_read_config() - Read from configuration space
*
* @bus: Pointer to the PCI bus
* @bdf: Identifies the PCIe device to access
* @offset: The offset into the device's configuration space
* @valuep: A pointer at which to store the read value
* @size: Indicates the size of access to perform
*
* Read a value of size @size from offset @offset within the configuration
* space of the device identified by the bus, device & function numbers in @bdf
* on the PCI bus @bus.
*
* Return: 0 on success
*/
static int pcie_dw_mvebu_read_config(struct udevice *bus, pci_dev_t bdf,
uint offset, ulong *valuep,
enum pci_size_t size)
{
struct pcie_dw_mvebu *pcie = dev_get_priv(bus);
uintptr_t va_address;
ulong value;
debug("PCIE CFG read: (b,d,f)=(%2d,%2d,%2d) ",
PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf));
if (!pcie_dw_addr_valid(bdf, pcie->first_busno)) {
debug("- out of range\n");
*valuep = pci_get_ff(size);
return 0;
}
va_address = set_cfg_address(pcie, bdf, offset);
value = readl(va_address);
debug("(addr,val)=(0x%04x, 0x%08lx)\n", offset, value);
*valuep = pci_conv_32_to_size(value, offset, size);
pcie_dw_prog_outbound_atu(pcie, PCIE_ATU_REGION_INDEX0,
PCIE_ATU_TYPE_IO, pcie->io.phys_start,
pcie->io.bus_start, pcie->io.size);
return 0;
}
/**
* pcie_dw_mvebu_write_config() - Write to configuration space
*
* @bus: Pointer to the PCI bus
* @bdf: Identifies the PCIe device to access
* @offset: The offset into the device's configuration space
* @value: The value to write
* @size: Indicates the size of access to perform
*
* Write the value @value of size @size from offset @offset within the
* configuration space of the device identified by the bus, device & function
* numbers in @bdf on the PCI bus @bus.
*
* Return: 0 on success
*/
static int pcie_dw_mvebu_write_config(struct udevice *bus, pci_dev_t bdf,
uint offset, ulong value,
enum pci_size_t size)
{
struct pcie_dw_mvebu *pcie = dev_get_priv(bus);
uintptr_t va_address;
ulong old;
debug("PCIE CFG write: (b,d,f)=(%2d,%2d,%2d) ",
PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf));
debug("(addr,val)=(0x%04x, 0x%08lx)\n", offset, value);
if (!pcie_dw_addr_valid(bdf, pcie->first_busno)) {
debug("- out of range\n");
return 0;
}
va_address = set_cfg_address(pcie, bdf, offset);
old = readl(va_address);
value = pci_conv_size_to_32(old, value, offset, size);
writel(value, va_address);
pcie_dw_prog_outbound_atu(pcie, PCIE_ATU_REGION_INDEX0,
PCIE_ATU_TYPE_IO, pcie->io.phys_start,
pcie->io.bus_start, pcie->io.size);
return 0;
}
/**
* pcie_dw_configure() - Configure link capabilities and speed
*
* @regs_base: A pointer to the PCIe controller registers
* @cap_speed: The capabilities and speed to configure
*
* Configure the link capabilities and speed in the PCIe root complex.
*/
static void pcie_dw_configure(const void *regs_base, u32 cap_speed)
{
/*
* TODO ([email protected], [email protected]):
* Need to read the serdes speed from the dts and according to it
* configure the PCIe gen
*/
/* Set link to GEN 3 */
clrsetbits_le32(regs_base + PCIE_LINK_CTL_2,
TARGET_LINK_SPEED_MASK, cap_speed);
clrsetbits_le32(regs_base + PCIE_LINK_CAPABILITY,
TARGET_LINK_SPEED_MASK, cap_speed);
setbits_le32(regs_base + PCIE_GEN3_EQU_CTRL, GEN3_EQU_EVAL_2MS_DISABLE);
}
/**
* is_link_up() - Return the link state
*
* @regs_base: A pointer to the PCIe controller registers
*
* Return: 1 (true) for active line and 0 (false) for no link
*/
static int is_link_up(const void *regs_base)
{
u32 mask = PCIE_GLB_STS_RDLH_LINK_UP | PCIE_GLB_STS_PHY_LINK_UP;
u32 reg;
reg = readl(regs_base + PCIE_GLOBAL_STATUS);
if ((reg & mask) == mask)
return 1;
return 0;
}
/**
* wait_link_up() - Wait for the link to come up
*
* @regs_base: A pointer to the PCIe controller registers
*
* Return: 1 (true) for active line and 0 (false) for no link (timeout)
*/
static int wait_link_up(const void *regs_base)
{
unsigned long timeout;
timeout = get_timer(0) + PCIE_LINK_UP_TIMEOUT_MS;
while (!is_link_up(regs_base)) {
if (get_timer(0) > timeout)
return 0;
};
return 1;
}
/**
* pcie_dw_mvebu_pcie_link_up() - Configure the PCIe root port
*
* @regs_base: A pointer to the PCIe controller registers
* @cap_speed: The capabilities and speed to configure
*
* Configure the PCIe controller root complex depending on the
* requested link capabilities and speed.
*
* Return: 1 (true) for active line and 0 (false) for no link
*/
static int pcie_dw_mvebu_pcie_link_up(const void *regs_base, u32 cap_speed)
{
if (!is_link_up(regs_base)) {
/* Disable LTSSM state machine to enable configuration */
clrbits_le32(regs_base + PCIE_GLOBAL_CONTROL,
PCIE_APP_LTSSM_EN);
}
clrsetbits_le32(regs_base + PCIE_GLOBAL_CONTROL,
PCIE_DEVICE_TYPE_MASK << PCIE_DEVICE_TYPE_OFFSET,
PCIE_DEVICE_TYPE_RC << PCIE_DEVICE_TYPE_OFFSET);
/* Set the PCIe master AXI attributes */
writel(ARCACHE_SHAREABLE_CACHEABLE, regs_base + PCIE_ARCACHE_TRC);
writel(AWCACHE_SHAREABLE_CACHEABLE, regs_base + PCIE_AWCACHE_TRC);
/* DW pre link configurations */
pcie_dw_configure(regs_base, cap_speed);
if (!is_link_up(regs_base)) {
/* Configuration done. Start LTSSM */
setbits_le32(regs_base + PCIE_GLOBAL_CONTROL,
PCIE_APP_LTSSM_EN);
}
/* Check that link was established */
if (!wait_link_up(regs_base))
return 0;
/*
* Link can be established in Gen 1. still need to wait
* till MAC nagaotiation is completed
*/
udelay(100);
return 1;
}
/**
* pcie_dw_set_host_bars() - Configure the host BARs
*
* @regs_base: A pointer to the PCIe controller registers
*
* Configure the host BARs of the PCIe controller root port so that
* PCI(e) devices may access the system memory.
*/
static void pcie_dw_set_host_bars(const void *regs_base)
{
u32 size = gd->ram_size;
u64 max_size;
u32 reg;
u32 bar0;
/* Verify the maximal BAR size */
reg = readl(regs_base + RESIZABLE_BAR_CAP);
max_size = 1ULL << (5 + (reg + (1 << 4)));
if (size > max_size) {
size = max_size;
printf("Warning: PCIe BARs can't map all DRAM space\n");
}
/* Set the BAR base and size towards DDR */
bar0 = CONFIG_SYS_SDRAM_BASE & ~0xf;
bar0 |= PCI_BASE_ADDRESS_MEM_TYPE_32;
writel(CONFIG_SYS_SDRAM_BASE, regs_base + PCIE_CONFIG_BAR0);
reg = ((size >> 20) - 1) << 12;
writel(size, regs_base + RESIZABLE_BAR_CTL0);
}
/**
* pcie_dw_mvebu_probe() - Probe the PCIe bus for active link
*
* @dev: A pointer to the device being operated on
*
* Probe for an active link on the PCIe bus and configure the controller
* to enable this port.
*
* Return: 0 on success, else -ENODEV
*/
static int pcie_dw_mvebu_probe(struct udevice *dev)
{
struct pcie_dw_mvebu *pcie = dev_get_priv(dev);
struct udevice *ctlr = pci_get_controller(dev);
struct pci_controller *hose = dev_get_uclass_priv(ctlr);
#ifdef CONFIG_DM_GPIO
struct gpio_desc reset_gpio;
gpio_request_by_name(dev, "marvell,reset-gpio", 0, &reset_gpio,
GPIOD_IS_OUT);
/*
* Issue reset to add-in card trough the dedicated GPIO.
* Some boards are connecting the card reset pin to common system
* reset wire and others are using separate GPIO port.
* In the last case we have to release a reset of the addon card
* using this GPIO.
*/
if (dm_gpio_is_valid(&reset_gpio)) {
dm_gpio_set_value(&reset_gpio, 1);
mdelay(200);
}
#else
debug("PCIE Reset on GPIO support is missing\n");
#endif /* CONFIG_DM_GPIO */
pcie->first_busno = dev->seq;
/* Don't register host if link is down */
if (!pcie_dw_mvebu_pcie_link_up(pcie->ctrl_base, LINK_SPEED_GEN_3)) {
printf("PCIE-%d: Link down\n", dev->seq);
} else {
printf("PCIE-%d: Link up (Gen%d-x%d, Bus%d)\n", dev->seq,
pcie_dw_get_link_speed(pcie->ctrl_base),
pcie_dw_get_link_width(pcie->ctrl_base),
hose->first_busno);
}
/* Store the IO and MEM windows settings for future use by the ATU */
pcie->io.phys_start = hose->regions[0].phys_start; /* IO base */
pcie->io.bus_start = hose->regions[0].bus_start; /* IO_bus_addr */
pcie->io.size = hose->regions[0].size; /* IO size */
pcie->mem.phys_start = hose->regions[1].phys_start; /* MEM base */
pcie->mem.bus_start = hose->regions[1].bus_start; /* MEM_bus_addr */
pcie->mem.size = hose->regions[1].size; /* MEM size */
pcie_dw_prog_outbound_atu(pcie, PCIE_ATU_REGION_INDEX1,
PCIE_ATU_TYPE_MEM, pcie->mem.phys_start,
pcie->mem.bus_start, pcie->mem.size);
/* Set the CLASS_REV of RC CFG header to PCI_CLASS_BRIDGE_PCI */
clrsetbits_le32(pcie->ctrl_base + PCI_CLASS_REVISION,
0xffff << 16, PCI_CLASS_BRIDGE_PCI << 16);
pcie_dw_set_host_bars(pcie->ctrl_base);
return 0;
}
/**
* pcie_dw_mvebu_ofdata_to_platdata() - Translate from DT to device state
*
* @dev: A pointer to the device being operated on
*
* Translate relevant data from the device tree pertaining to device @dev into
* state that the driver will later make use of. This state is stored in the
* device's private data structure.
*
* Return: 0 on success, else -EINVAL
*/
static int pcie_dw_mvebu_ofdata_to_platdata(struct udevice *dev)
{
struct pcie_dw_mvebu *pcie = dev_get_priv(dev);
/* Get the controller base address */
pcie->ctrl_base = (void *)devfdt_get_addr_index(dev, 0);
if ((fdt_addr_t)pcie->ctrl_base == FDT_ADDR_T_NONE)
return -EINVAL;
/* Get the config space base address and size */
pcie->cfg_base = (void *)devfdt_get_addr_size_index(dev, 1,
&pcie->cfg_size);
if ((fdt_addr_t)pcie->cfg_base == FDT_ADDR_T_NONE)
return -EINVAL;
return 0;
}
static const struct dm_pci_ops pcie_dw_mvebu_ops = {
.read_config = pcie_dw_mvebu_read_config,
.write_config = pcie_dw_mvebu_write_config,
};
static const struct udevice_id pcie_dw_mvebu_ids[] = {
{ .compatible = "marvell,armada8k-pcie" },
{ }
};
U_BOOT_DRIVER(pcie_dw_mvebu) = {
.name = "pcie_dw_mvebu",
.id = UCLASS_PCI,
.of_match = pcie_dw_mvebu_ids,
.ops = &pcie_dw_mvebu_ops,
.ofdata_to_platdata = pcie_dw_mvebu_ofdata_to_platdata,
.probe = pcie_dw_mvebu_probe,
.priv_auto_alloc_size = sizeof(struct pcie_dw_mvebu),
};
| {
"pile_set_name": "Github"
} |
package org.broadinstitute.hellbender.tools.spark.sv.discovery;
import htsjdk.variant.variantcontext.VariantContext;
import org.broadinstitute.hellbender.tools.spark.sv.utils.GATKSVVCFConstants;
public final class SVAlignmentLengthFilter implements StructuralVariantFilter {
static final long serialVersionUID = 1L;
private static final String attributeKey = GATKSVVCFConstants.MAX_ALIGN_LENGTH;
private final int threshold;
public SVAlignmentLengthFilter( final int threshold) {
this.threshold = threshold;
}
@Override
public String getName() {
return GATKSVVCFConstants.ASSEMBLY_BASED_VARIANT_ALN_LENGTH_FILTER_KEY;
}
@Override
public boolean test(final VariantContext variantContext) {
if ( !variantContext.hasAttribute(GATKSVVCFConstants.CONTIG_NAMES) )
return true;
final int alnLength = variantContext.getAttributeAsInt(attributeKey, 0);
return alnLength >= threshold;
}
}
| {
"pile_set_name": "Github"
} |
-----BEGIN CERTIFICATE-----
MIID0TCCArmgAwIBAgIHBHMN4U/sBjANBgkqhkiG9w0BAQsFADCBnjELMAkGA1UE
BhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExEjAQBgNVBAcMCUxvcyBHYXRvczEU
MBIGA1UECgwLTmV0ZmxpeCBJbmMxLTArBgNVBAsMJFBsYXRmb3JtIFNlY3VyaXR5
ICgxMjUyNDAyOTY3MDQwMzU5KTEhMB8GA1UEAwwYSW50ZXJtZWRpYXRlIENBIGZv
ciAxNjMyMB4XDTIwMDcxNDAzMjIyMloXDTIxMDcxNDAzMDk0NFowgY8xCzAJBgNV
BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRIwEAYDVQQHDAlMb3MgR2F0b3Mx
FDASBgNVBAoMC05ldGZsaXggSW5jMS0wKwYDVQQLDCRQbGF0Zm9ybSBTZWN1cml0
eSAoMTI1MjQwMzM1ODcwODAyNykxEjAQBgNVBAMMCTEyNy4wLjAuMTCCASIwDQYJ
KoZIhvcNAQEBBQADggEPADCCAQoCggEBAK+eqg8M/RUe+TwA7VutpoFVwTnoaqf5
WBDphoVQhoeVy0OfRNqGRkENiiifVvTHFfv4pa1AtnTZjrRiO9i2/wf7gFE+qyWu
apKo1nZswgtY5p1WFG9HlZQrZ9A7j9k5pBto3Osn/zfhayqTkw5/kGW4rKE5aUGL
O2xQ8VmJf2ZOJVIlyxwrgyiBV5toHCRoWSTv/ZqSWiDHjD1qEjub0fXkjsp5Fzf4
zfxXnwLRoqtFE9Gm9j08qFjuNl++mCEjv8JS4Aenfhu6kCTJOGFQbDK7XIYyBONC
6r2lXxRLENMhpBJLEWSXiYZdOPtQl30c5zbsqIXr4PJIAXvQWTQ7em8CAwEAAaMh
MB8wDAYDVR0TAQH/BAIwADAPBgNVHREECDAGhwSsEAABMA0GCSqGSIb3DQEBCwUA
A4IBAQAa0T8mw6nQXQUbXleTqmY7VD3Tt2K59KZfgESUpKmtdQz140qVSc7pZlL0
g2+b8iCioUM/i957rY1tcXD25OIBRecZpff5eCO5ZPjuLqwPrwJ/jsDffzvfM73J
JDs9JocBvwuhDtX1OWjD65aTpvu8ZQfa2fQ1lDWlZtQ7bxgyQX3J2bmGQSRXZu4o
sgb7qo+b9O6YD49dFClmnt7H4iZzqCCVmJRhGPyrmu0RckYN3ChuHGg4aCYaTiOD
knjFQDoECK9eWHyk3XrGfATHCD1Pq1pR87cZnLjZ1vrs4ARrhTYdnPm23E8CYhlU
0ZVnE8hsaw0QaSjfwe1T7hX1dQ7C
-----END CERTIFICATE-----
| {
"pile_set_name": "Github"
} |
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERFACE_H_
#define CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERFACE_H_
#include <stdint.h>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "base/callback.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "chrome/browser/chromeos/file_system_provider/abort_callback.h"
#include "chrome/browser/chromeos/file_system_provider/provided_file_system_observer.h"
#include "chrome/browser/chromeos/file_system_provider/watcher.h"
#include "storage/browser/fileapi/async_file_util.h"
#include "storage/browser/fileapi/watcher_manager.h"
#include "url/gurl.h"
namespace base {
class Time;
} // namespace base
namespace net {
class IOBuffer;
} // namespace net
namespace chromeos {
namespace file_system_provider {
class ProvidedFileSystemInfo;
class RequestManager;
// Represents metadata for either a file or a directory.
struct EntryMetadata {
EntryMetadata();
~EntryMetadata();
// All of the metadata fields are optional. All strings which are set, are
// non-empty.
std::unique_ptr<bool> is_directory;
std::unique_ptr<std::string> name;
std::unique_ptr<int64_t> size;
std::unique_ptr<base::Time> modification_time;
std::unique_ptr<std::string> mime_type;
std::unique_ptr<std::string> thumbnail;
private:
DISALLOW_COPY_AND_ASSIGN(EntryMetadata);
};
// Represents actions for either a file or a directory.
struct Action {
std::string id;
std::string title;
};
typedef std::vector<Action> Actions;
// Mode of opening a file. Used by OpenFile().
enum OpenFileMode { OPEN_FILE_MODE_READ, OPEN_FILE_MODE_WRITE };
// Contains information about an opened file.
struct OpenedFile {
OpenedFile(const base::FilePath& file_path, OpenFileMode mode);
OpenedFile();
~OpenedFile();
base::FilePath file_path;
OpenFileMode mode;
};
// Map from a file handle to an OpenedFile struct.
typedef std::map<int, OpenedFile> OpenedFiles;
// Interface for a provided file system. Acts as a proxy between providers
// and clients. All of the request methods return an abort callback in order to
// terminate it while running. They must be called on the same thread as the
// request methods. The cancellation callback may be null if the operation
// fails synchronously. It must not be called once the operation is completed
// with either a success or an error.
class ProvidedFileSystemInterface {
public:
// Fields to be fetched with metadata.
enum MetadataField {
METADATA_FIELD_NONE = 0,
METADATA_FIELD_IS_DIRECTORY = 1 << 0,
METADATA_FIELD_NAME = 1 << 1,
METADATA_FIELD_SIZE = 1 << 2,
METADATA_FIELD_MODIFICATION_TIME = 1 << 3,
METADATA_FIELD_MIME_TYPE = 1 << 4,
METADATA_FIELD_THUMBNAIL = 1 << 5
};
// Callback for OpenFile(). In case of an error, file_handle is equal to 0
// and result is set to an error code.
typedef base::Callback<void(int file_handle, base::File::Error result)>
OpenFileCallback;
typedef base::Callback<
void(int chunk_length, bool has_more, base::File::Error result)>
ReadChunkReceivedCallback;
typedef base::Callback<void(std::unique_ptr<EntryMetadata> entry_metadata,
base::File::Error result)>
GetMetadataCallback;
typedef base::Callback<void(const Actions& actions, base::File::Error result)>
GetActionsCallback;
// Mask of fields requested from the GetMetadata() call.
typedef int MetadataFieldMask;
virtual ~ProvidedFileSystemInterface() {}
// Requests unmounting of the file system. The callback is called when the
// request is accepted or rejected, with an error code.
virtual AbortCallback RequestUnmount(
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests metadata of the passed |entry_path|. It can be either a file
// or a directory. All |fields| will be returned if supported. Note, that
// default fields are always returned.
virtual AbortCallback GetMetadata(const base::FilePath& entry_path,
MetadataFieldMask fields,
const GetMetadataCallback& callback) = 0;
// Requests list of actions for the passed list of entries at |entry_paths|.
// They can be either files or directories.
virtual AbortCallback GetActions(
const std::vector<base::FilePath>& entry_paths,
const GetActionsCallback& callback) = 0;
// Executes the |action_id| action on the list of entries at |entry_paths|.
virtual AbortCallback ExecuteAction(
const std::vector<base::FilePath>& entry_paths,
const std::string& action_id,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests enumerating entries from the passed |directory_path|. The callback
// can be called multiple times until |has_more| is set to false.
virtual AbortCallback ReadDirectory(
const base::FilePath& directory_path,
const storage::AsyncFileUtil::ReadDirectoryCallback& callback) = 0;
// Requests opening a file at |file_path|. If the file doesn't exist, then the
// operation will fail. In case of any error, the returned file handle is 0.
virtual AbortCallback OpenFile(const base::FilePath& file_path,
OpenFileMode mode,
const OpenFileCallback& callback) = 0;
// Requests closing a file, previously opened with OpenFile() as a file with
// |file_handle|. For either succes or error |callback| must be called.
virtual AbortCallback CloseFile(
int file_handle,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests reading a file previously opened with |file_handle|. The callback
// can be called multiple times until |has_more| is set to false. On success
// it should return |length| bytes starting from |offset| in total. It can
// return less only in case EOF is encountered.
virtual AbortCallback ReadFile(int file_handle,
net::IOBuffer* buffer,
int64_t offset,
int length,
const ReadChunkReceivedCallback& callback) = 0;
// Requests creating a directory. If |recursive| is passed, then all non
// existing directories on the path will be created. The operation will fail
// if the target directory already exists.
virtual AbortCallback CreateDirectory(
const base::FilePath& directory_path,
bool recursive,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests creating a file. If the entry already exists, then the
// FILE_ERROR_EXISTS error must be returned.
virtual AbortCallback CreateFile(
const base::FilePath& file_path,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests deleting a directory. If |recursive| is passed and the entry is
// a directory, then all contents of it (recursively) will be deleted too.
virtual AbortCallback DeleteEntry(
const base::FilePath& entry_path,
bool recursive,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests copying an entry (recursively in case of a directory) within the
// same file system.
virtual AbortCallback CopyEntry(
const base::FilePath& source_path,
const base::FilePath& target_path,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests moving an entry (recursively in case of a directory) within the
// same file system.
virtual AbortCallback MoveEntry(
const base::FilePath& source_path,
const base::FilePath& target_path,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests truncating a file to the desired length.
virtual AbortCallback Truncate(
const base::FilePath& file_path,
int64_t length,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests writing to a file previously opened with |file_handle|.
virtual AbortCallback WriteFile(
int file_handle,
net::IOBuffer* buffer,
int64_t offset,
int length,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests adding a watcher on an entry. |recursive| must not be true for
// files. |callback| is optional, but it can't be used for persistent
// watchers.
virtual AbortCallback AddWatcher(
const GURL& origin,
const base::FilePath& entry_path,
bool recursive,
bool persistent,
const storage::AsyncFileUtil::StatusCallback& callback,
const storage::WatcherManager::NotificationCallback&
notification_callback) = 0;
// Requests removing a watcher, which is immediately deleted from the internal
// list, hence the operation is not abortable.
virtual void RemoveWatcher(
const GURL& origin,
const base::FilePath& entry_path,
bool recursive,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Notifies about changes related to the watcher within the file system.
// Invoked by the file system implementation. Returns an error code via the
// callback if the notification arguments are malformed or the entry is not
// watched anymore. On success, returns base::File::FILE_OK.
// TODO(mtomasz): Replace [entry_path, recursive] with a watcher id.
virtual void Notify(
const base::FilePath& entry_path,
bool recursive,
storage::WatcherManager::ChangeType change_type,
std::unique_ptr<ProvidedFileSystemObserver::Changes> changes,
const std::string& tag,
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Requests showing UI for configuring the file system by user. Once the
// configuration process is completed, base::File::FILE_OK or an error code is
// returned via the |callback|.
virtual void Configure(
const storage::AsyncFileUtil::StatusCallback& callback) = 0;
// Returns a provided file system info for this file system.
virtual const ProvidedFileSystemInfo& GetFileSystemInfo() const = 0;
// Returns a mutable list of watchers.
virtual Watchers* GetWatchers() = 0;
// Returns a list of opened files.
virtual const OpenedFiles& GetOpenedFiles() const = 0;
// Returns a request manager for the file system.
virtual RequestManager* GetRequestManager() = 0;
// Adds an observer on the file system.
virtual void AddObserver(ProvidedFileSystemObserver* observer) = 0;
// Removes an observer.
virtual void RemoveObserver(ProvidedFileSystemObserver* observer) = 0;
// Returns a weak pointer to this object.
virtual base::WeakPtr<ProvidedFileSystemInterface> GetWeakPtr() = 0;
};
} // namespace file_system_provider
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_INTERFACE_H_
| {
"pile_set_name": "Github"
} |
// mkerrors.sh -m64
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm64,openbsd
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -m64 _const.go
package unix
import "syscall"
const (
AF_APPLETALK = 0x10
AF_BLUETOOTH = 0x20
AF_CCITT = 0xa
AF_CHAOS = 0x5
AF_CNT = 0x15
AF_COIP = 0x14
AF_DATAKIT = 0x9
AF_DECnet = 0xc
AF_DLI = 0xd
AF_E164 = 0x1a
AF_ECMA = 0x8
AF_ENCAP = 0x1c
AF_HYLINK = 0xf
AF_IMPLINK = 0x3
AF_INET = 0x2
AF_INET6 = 0x18
AF_IPX = 0x17
AF_ISDN = 0x1a
AF_ISO = 0x7
AF_KEY = 0x1e
AF_LAT = 0xe
AF_LINK = 0x12
AF_LOCAL = 0x1
AF_MAX = 0x24
AF_MPLS = 0x21
AF_NATM = 0x1b
AF_NS = 0x6
AF_OSI = 0x7
AF_PUP = 0x4
AF_ROUTE = 0x11
AF_SIP = 0x1d
AF_SNA = 0xb
AF_UNIX = 0x1
AF_UNSPEC = 0x0
ALTWERASE = 0x200
ARPHRD_ETHER = 0x1
ARPHRD_FRELAY = 0xf
ARPHRD_IEEE1394 = 0x18
ARPHRD_IEEE802 = 0x6
B0 = 0x0
B110 = 0x6e
B115200 = 0x1c200
B1200 = 0x4b0
B134 = 0x86
B14400 = 0x3840
B150 = 0x96
B1800 = 0x708
B19200 = 0x4b00
B200 = 0xc8
B230400 = 0x38400
B2400 = 0x960
B28800 = 0x7080
B300 = 0x12c
B38400 = 0x9600
B4800 = 0x12c0
B50 = 0x32
B57600 = 0xe100
B600 = 0x258
B7200 = 0x1c20
B75 = 0x4b
B76800 = 0x12c00
B9600 = 0x2580
BIOCFLUSH = 0x20004268
BIOCGBLEN = 0x40044266
BIOCGDIRFILT = 0x4004427c
BIOCGDLT = 0x4004426a
BIOCGDLTLIST = 0xc010427b
BIOCGETIF = 0x4020426b
BIOCGFILDROP = 0x40044278
BIOCGHDRCMPLT = 0x40044274
BIOCGRSIG = 0x40044273
BIOCGRTIMEOUT = 0x4010426e
BIOCGSTATS = 0x4008426f
BIOCIMMEDIATE = 0x80044270
BIOCLOCK = 0x20004276
BIOCPROMISC = 0x20004269
BIOCSBLEN = 0xc0044266
BIOCSDIRFILT = 0x8004427d
BIOCSDLT = 0x8004427a
BIOCSETF = 0x80104267
BIOCSETIF = 0x8020426c
BIOCSETWF = 0x80104277
BIOCSFILDROP = 0x80044279
BIOCSHDRCMPLT = 0x80044275
BIOCSRSIG = 0x80044272
BIOCSRTIMEOUT = 0x8010426d
BIOCVERSION = 0x40044271
BPF_A = 0x10
BPF_ABS = 0x20
BPF_ADD = 0x0
BPF_ALIGNMENT = 0x4
BPF_ALU = 0x4
BPF_AND = 0x50
BPF_B = 0x10
BPF_DIRECTION_IN = 0x1
BPF_DIRECTION_OUT = 0x2
BPF_DIV = 0x30
BPF_FILDROP_CAPTURE = 0x1
BPF_FILDROP_DROP = 0x2
BPF_FILDROP_PASS = 0x0
BPF_H = 0x8
BPF_IMM = 0x0
BPF_IND = 0x40
BPF_JA = 0x0
BPF_JEQ = 0x10
BPF_JGE = 0x30
BPF_JGT = 0x20
BPF_JMP = 0x5
BPF_JSET = 0x40
BPF_K = 0x0
BPF_LD = 0x0
BPF_LDX = 0x1
BPF_LEN = 0x80
BPF_LSH = 0x60
BPF_MAJOR_VERSION = 0x1
BPF_MAXBUFSIZE = 0x200000
BPF_MAXINSNS = 0x200
BPF_MEM = 0x60
BPF_MEMWORDS = 0x10
BPF_MINBUFSIZE = 0x20
BPF_MINOR_VERSION = 0x1
BPF_MISC = 0x7
BPF_MSH = 0xa0
BPF_MUL = 0x20
BPF_NEG = 0x80
BPF_OR = 0x40
BPF_RELEASE = 0x30bb6
BPF_RET = 0x6
BPF_RSH = 0x70
BPF_ST = 0x2
BPF_STX = 0x3
BPF_SUB = 0x10
BPF_TAX = 0x0
BPF_TXA = 0x80
BPF_W = 0x0
BPF_X = 0x8
BRKINT = 0x2
CFLUSH = 0xf
CLOCAL = 0x8000
CLOCK_BOOTTIME = 0x6
CLOCK_MONOTONIC = 0x3
CLOCK_PROCESS_CPUTIME_ID = 0x2
CLOCK_REALTIME = 0x0
CLOCK_THREAD_CPUTIME_ID = 0x4
CLOCK_UPTIME = 0x5
CPUSTATES = 0x6
CP_IDLE = 0x5
CP_INTR = 0x4
CP_NICE = 0x1
CP_SPIN = 0x3
CP_SYS = 0x2
CP_USER = 0x0
CREAD = 0x800
CRTSCTS = 0x10000
CS5 = 0x0
CS6 = 0x100
CS7 = 0x200
CS8 = 0x300
CSIZE = 0x300
CSTART = 0x11
CSTATUS = 0xff
CSTOP = 0x13
CSTOPB = 0x400
CSUSP = 0x1a
CTL_HW = 0x6
CTL_KERN = 0x1
CTL_MAXNAME = 0xc
CTL_NET = 0x4
DIOCOSFPFLUSH = 0x2000444e
DLT_ARCNET = 0x7
DLT_ATM_RFC1483 = 0xb
DLT_AX25 = 0x3
DLT_CHAOS = 0x5
DLT_C_HDLC = 0x68
DLT_EN10MB = 0x1
DLT_EN3MB = 0x2
DLT_ENC = 0xd
DLT_FDDI = 0xa
DLT_IEEE802 = 0x6
DLT_IEEE802_11 = 0x69
DLT_IEEE802_11_RADIO = 0x7f
DLT_LOOP = 0xc
DLT_MPLS = 0xdb
DLT_NULL = 0x0
DLT_OPENFLOW = 0x10b
DLT_PFLOG = 0x75
DLT_PFSYNC = 0x12
DLT_PPP = 0x9
DLT_PPP_BSDOS = 0x10
DLT_PPP_ETHER = 0x33
DLT_PPP_SERIAL = 0x32
DLT_PRONET = 0x4
DLT_RAW = 0xe
DLT_SLIP = 0x8
DLT_SLIP_BSDOS = 0xf
DLT_USBPCAP = 0xf9
DLT_USER0 = 0x93
DLT_USER1 = 0x94
DLT_USER10 = 0x9d
DLT_USER11 = 0x9e
DLT_USER12 = 0x9f
DLT_USER13 = 0xa0
DLT_USER14 = 0xa1
DLT_USER15 = 0xa2
DLT_USER2 = 0x95
DLT_USER3 = 0x96
DLT_USER4 = 0x97
DLT_USER5 = 0x98
DLT_USER6 = 0x99
DLT_USER7 = 0x9a
DLT_USER8 = 0x9b
DLT_USER9 = 0x9c
DT_BLK = 0x6
DT_CHR = 0x2
DT_DIR = 0x4
DT_FIFO = 0x1
DT_LNK = 0xa
DT_REG = 0x8
DT_SOCK = 0xc
DT_UNKNOWN = 0x0
ECHO = 0x8
ECHOCTL = 0x40
ECHOE = 0x2
ECHOK = 0x4
ECHOKE = 0x1
ECHONL = 0x10
ECHOPRT = 0x20
EMT_TAGOVF = 0x1
EMUL_ENABLED = 0x1
EMUL_NATIVE = 0x2
ENDRUNDISC = 0x9
ETHERMIN = 0x2e
ETHERMTU = 0x5dc
ETHERTYPE_8023 = 0x4
ETHERTYPE_AARP = 0x80f3
ETHERTYPE_ACCTON = 0x8390
ETHERTYPE_AEONIC = 0x8036
ETHERTYPE_ALPHA = 0x814a
ETHERTYPE_AMBER = 0x6008
ETHERTYPE_AMOEBA = 0x8145
ETHERTYPE_AOE = 0x88a2
ETHERTYPE_APOLLO = 0x80f7
ETHERTYPE_APOLLODOMAIN = 0x8019
ETHERTYPE_APPLETALK = 0x809b
ETHERTYPE_APPLITEK = 0x80c7
ETHERTYPE_ARGONAUT = 0x803a
ETHERTYPE_ARP = 0x806
ETHERTYPE_AT = 0x809b
ETHERTYPE_ATALK = 0x809b
ETHERTYPE_ATOMIC = 0x86df
ETHERTYPE_ATT = 0x8069
ETHERTYPE_ATTSTANFORD = 0x8008
ETHERTYPE_AUTOPHON = 0x806a
ETHERTYPE_AXIS = 0x8856
ETHERTYPE_BCLOOP = 0x9003
ETHERTYPE_BOFL = 0x8102
ETHERTYPE_CABLETRON = 0x7034
ETHERTYPE_CHAOS = 0x804
ETHERTYPE_COMDESIGN = 0x806c
ETHERTYPE_COMPUGRAPHIC = 0x806d
ETHERTYPE_COUNTERPOINT = 0x8062
ETHERTYPE_CRONUS = 0x8004
ETHERTYPE_CRONUSVLN = 0x8003
ETHERTYPE_DCA = 0x1234
ETHERTYPE_DDE = 0x807b
ETHERTYPE_DEBNI = 0xaaaa
ETHERTYPE_DECAM = 0x8048
ETHERTYPE_DECCUST = 0x6006
ETHERTYPE_DECDIAG = 0x6005
ETHERTYPE_DECDNS = 0x803c
ETHERTYPE_DECDTS = 0x803e
ETHERTYPE_DECEXPER = 0x6000
ETHERTYPE_DECLAST = 0x8041
ETHERTYPE_DECLTM = 0x803f
ETHERTYPE_DECMUMPS = 0x6009
ETHERTYPE_DECNETBIOS = 0x8040
ETHERTYPE_DELTACON = 0x86de
ETHERTYPE_DIDDLE = 0x4321
ETHERTYPE_DLOG1 = 0x660
ETHERTYPE_DLOG2 = 0x661
ETHERTYPE_DN = 0x6003
ETHERTYPE_DOGFIGHT = 0x1989
ETHERTYPE_DSMD = 0x8039
ETHERTYPE_ECMA = 0x803
ETHERTYPE_ENCRYPT = 0x803d
ETHERTYPE_ES = 0x805d
ETHERTYPE_EXCELAN = 0x8010
ETHERTYPE_EXPERDATA = 0x8049
ETHERTYPE_FLIP = 0x8146
ETHERTYPE_FLOWCONTROL = 0x8808
ETHERTYPE_FRARP = 0x808
ETHERTYPE_GENDYN = 0x8068
ETHERTYPE_HAYES = 0x8130
ETHERTYPE_HIPPI_FP = 0x8180
ETHERTYPE_HITACHI = 0x8820
ETHERTYPE_HP = 0x8005
ETHERTYPE_IEEEPUP = 0xa00
ETHERTYPE_IEEEPUPAT = 0xa01
ETHERTYPE_IMLBL = 0x4c42
ETHERTYPE_IMLBLDIAG = 0x424c
ETHERTYPE_IP = 0x800
ETHERTYPE_IPAS = 0x876c
ETHERTYPE_IPV6 = 0x86dd
ETHERTYPE_IPX = 0x8137
ETHERTYPE_IPXNEW = 0x8037
ETHERTYPE_KALPANA = 0x8582
ETHERTYPE_LANBRIDGE = 0x8038
ETHERTYPE_LANPROBE = 0x8888
ETHERTYPE_LAT = 0x6004
ETHERTYPE_LBACK = 0x9000
ETHERTYPE_LITTLE = 0x8060
ETHERTYPE_LLDP = 0x88cc
ETHERTYPE_LOGICRAFT = 0x8148
ETHERTYPE_LOOPBACK = 0x9000
ETHERTYPE_MATRA = 0x807a
ETHERTYPE_MAX = 0xffff
ETHERTYPE_MERIT = 0x807c
ETHERTYPE_MICP = 0x873a
ETHERTYPE_MOPDL = 0x6001
ETHERTYPE_MOPRC = 0x6002
ETHERTYPE_MOTOROLA = 0x818d
ETHERTYPE_MPLS = 0x8847
ETHERTYPE_MPLS_MCAST = 0x8848
ETHERTYPE_MUMPS = 0x813f
ETHERTYPE_NBPCC = 0x3c04
ETHERTYPE_NBPCLAIM = 0x3c09
ETHERTYPE_NBPCLREQ = 0x3c05
ETHERTYPE_NBPCLRSP = 0x3c06
ETHERTYPE_NBPCREQ = 0x3c02
ETHERTYPE_NBPCRSP = 0x3c03
ETHERTYPE_NBPDG = 0x3c07
ETHERTYPE_NBPDGB = 0x3c08
ETHERTYPE_NBPDLTE = 0x3c0a
ETHERTYPE_NBPRAR = 0x3c0c
ETHERTYPE_NBPRAS = 0x3c0b
ETHERTYPE_NBPRST = 0x3c0d
ETHERTYPE_NBPSCD = 0x3c01
ETHERTYPE_NBPVCD = 0x3c00
ETHERTYPE_NBS = 0x802
ETHERTYPE_NCD = 0x8149
ETHERTYPE_NESTAR = 0x8006
ETHERTYPE_NETBEUI = 0x8191
ETHERTYPE_NOVELL = 0x8138
ETHERTYPE_NS = 0x600
ETHERTYPE_NSAT = 0x601
ETHERTYPE_NSCOMPAT = 0x807
ETHERTYPE_NTRAILER = 0x10
ETHERTYPE_OS9 = 0x7007
ETHERTYPE_OS9NET = 0x7009
ETHERTYPE_PACER = 0x80c6
ETHERTYPE_PAE = 0x888e
ETHERTYPE_PBB = 0x88e7
ETHERTYPE_PCS = 0x4242
ETHERTYPE_PLANNING = 0x8044
ETHERTYPE_PPP = 0x880b
ETHERTYPE_PPPOE = 0x8864
ETHERTYPE_PPPOEDISC = 0x8863
ETHERTYPE_PRIMENTS = 0x7031
ETHERTYPE_PUP = 0x200
ETHERTYPE_PUPAT = 0x200
ETHERTYPE_QINQ = 0x88a8
ETHERTYPE_RACAL = 0x7030
ETHERTYPE_RATIONAL = 0x8150
ETHERTYPE_RAWFR = 0x6559
ETHERTYPE_RCL = 0x1995
ETHERTYPE_RDP = 0x8739
ETHERTYPE_RETIX = 0x80f2
ETHERTYPE_REVARP = 0x8035
ETHERTYPE_SCA = 0x6007
ETHERTYPE_SECTRA = 0x86db
ETHERTYPE_SECUREDATA = 0x876d
ETHERTYPE_SGITW = 0x817e
ETHERTYPE_SG_BOUNCE = 0x8016
ETHERTYPE_SG_DIAG = 0x8013
ETHERTYPE_SG_NETGAMES = 0x8014
ETHERTYPE_SG_RESV = 0x8015
ETHERTYPE_SIMNET = 0x5208
ETHERTYPE_SLOW = 0x8809
ETHERTYPE_SNA = 0x80d5
ETHERTYPE_SNMP = 0x814c
ETHERTYPE_SONIX = 0xfaf5
ETHERTYPE_SPIDER = 0x809f
ETHERTYPE_SPRITE = 0x500
ETHERTYPE_STP = 0x8181
ETHERTYPE_TALARIS = 0x812b
ETHERTYPE_TALARISMC = 0x852b
ETHERTYPE_TCPCOMP = 0x876b
ETHERTYPE_TCPSM = 0x9002
ETHERTYPE_TEC = 0x814f
ETHERTYPE_TIGAN = 0x802f
ETHERTYPE_TRAIL = 0x1000
ETHERTYPE_TRANSETHER = 0x6558
ETHERTYPE_TYMSHARE = 0x802e
ETHERTYPE_UBBST = 0x7005
ETHERTYPE_UBDEBUG = 0x900
ETHERTYPE_UBDIAGLOOP = 0x7002
ETHERTYPE_UBDL = 0x7000
ETHERTYPE_UBNIU = 0x7001
ETHERTYPE_UBNMC = 0x7003
ETHERTYPE_VALID = 0x1600
ETHERTYPE_VARIAN = 0x80dd
ETHERTYPE_VAXELN = 0x803b
ETHERTYPE_VEECO = 0x8067
ETHERTYPE_VEXP = 0x805b
ETHERTYPE_VGLAB = 0x8131
ETHERTYPE_VINES = 0xbad
ETHERTYPE_VINESECHO = 0xbaf
ETHERTYPE_VINESLOOP = 0xbae
ETHERTYPE_VITAL = 0xff00
ETHERTYPE_VLAN = 0x8100
ETHERTYPE_VLTLMAN = 0x8080
ETHERTYPE_VPROD = 0x805c
ETHERTYPE_VURESERVED = 0x8147
ETHERTYPE_WATERLOO = 0x8130
ETHERTYPE_WELLFLEET = 0x8103
ETHERTYPE_X25 = 0x805
ETHERTYPE_X75 = 0x801
ETHERTYPE_XNSSM = 0x9001
ETHERTYPE_XTP = 0x817d
ETHER_ADDR_LEN = 0x6
ETHER_ALIGN = 0x2
ETHER_CRC_LEN = 0x4
ETHER_CRC_POLY_BE = 0x4c11db6
ETHER_CRC_POLY_LE = 0xedb88320
ETHER_HDR_LEN = 0xe
ETHER_MAX_DIX_LEN = 0x600
ETHER_MAX_HARDMTU_LEN = 0xff9b
ETHER_MAX_LEN = 0x5ee
ETHER_MIN_LEN = 0x40
ETHER_TYPE_LEN = 0x2
ETHER_VLAN_ENCAP_LEN = 0x4
EVFILT_AIO = -0x3
EVFILT_DEVICE = -0x8
EVFILT_PROC = -0x5
EVFILT_READ = -0x1
EVFILT_SIGNAL = -0x6
EVFILT_SYSCOUNT = 0x8
EVFILT_TIMER = -0x7
EVFILT_VNODE = -0x4
EVFILT_WRITE = -0x2
EVL_ENCAPLEN = 0x4
EVL_PRIO_BITS = 0xd
EVL_PRIO_MAX = 0x7
EVL_VLID_MASK = 0xfff
EVL_VLID_MAX = 0xffe
EVL_VLID_MIN = 0x1
EVL_VLID_NULL = 0x0
EV_ADD = 0x1
EV_CLEAR = 0x20
EV_DELETE = 0x2
EV_DISABLE = 0x8
EV_DISPATCH = 0x80
EV_ENABLE = 0x4
EV_EOF = 0x8000
EV_ERROR = 0x4000
EV_FLAG1 = 0x2000
EV_ONESHOT = 0x10
EV_RECEIPT = 0x40
EV_SYSFLAGS = 0xf000
EXTA = 0x4b00
EXTB = 0x9600
EXTPROC = 0x800
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FLUSHO = 0x800000
F_DUPFD = 0x0
F_DUPFD_CLOEXEC = 0xa
F_GETFD = 0x1
F_GETFL = 0x3
F_GETLK = 0x7
F_GETOWN = 0x5
F_ISATTY = 0xb
F_OK = 0x0
F_RDLCK = 0x1
F_SETFD = 0x2
F_SETFL = 0x4
F_SETLK = 0x8
F_SETLKW = 0x9
F_SETOWN = 0x6
F_UNLCK = 0x2
F_WRLCK = 0x3
HUPCL = 0x4000
HW_MACHINE = 0x1
ICANON = 0x100
ICMP6_FILTER = 0x12
ICRNL = 0x100
IEXTEN = 0x400
IFAN_ARRIVAL = 0x0
IFAN_DEPARTURE = 0x1
IFF_ALLMULTI = 0x200
IFF_BROADCAST = 0x2
IFF_CANTCHANGE = 0x8e52
IFF_DEBUG = 0x4
IFF_LINK0 = 0x1000
IFF_LINK1 = 0x2000
IFF_LINK2 = 0x4000
IFF_LOOPBACK = 0x8
IFF_MULTICAST = 0x8000
IFF_NOARP = 0x80
IFF_OACTIVE = 0x400
IFF_POINTOPOINT = 0x10
IFF_PROMISC = 0x100
IFF_RUNNING = 0x40
IFF_SIMPLEX = 0x800
IFF_STATICARP = 0x20
IFF_UP = 0x1
IFNAMSIZ = 0x10
IFT_1822 = 0x2
IFT_A12MPPSWITCH = 0x82
IFT_AAL2 = 0xbb
IFT_AAL5 = 0x31
IFT_ADSL = 0x5e
IFT_AFLANE8023 = 0x3b
IFT_AFLANE8025 = 0x3c
IFT_ARAP = 0x58
IFT_ARCNET = 0x23
IFT_ARCNETPLUS = 0x24
IFT_ASYNC = 0x54
IFT_ATM = 0x25
IFT_ATMDXI = 0x69
IFT_ATMFUNI = 0x6a
IFT_ATMIMA = 0x6b
IFT_ATMLOGICAL = 0x50
IFT_ATMRADIO = 0xbd
IFT_ATMSUBINTERFACE = 0x86
IFT_ATMVCIENDPT = 0xc2
IFT_ATMVIRTUAL = 0x95
IFT_BGPPOLICYACCOUNTING = 0xa2
IFT_BLUETOOTH = 0xf8
IFT_BRIDGE = 0xd1
IFT_BSC = 0x53
IFT_CARP = 0xf7
IFT_CCTEMUL = 0x3d
IFT_CEPT = 0x13
IFT_CES = 0x85
IFT_CHANNEL = 0x46
IFT_CNR = 0x55
IFT_COFFEE = 0x84
IFT_COMPOSITELINK = 0x9b
IFT_DCN = 0x8d
IFT_DIGITALPOWERLINE = 0x8a
IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
IFT_DLSW = 0x4a
IFT_DOCSCABLEDOWNSTREAM = 0x80
IFT_DOCSCABLEMACLAYER = 0x7f
IFT_DOCSCABLEUPSTREAM = 0x81
IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd
IFT_DS0 = 0x51
IFT_DS0BUNDLE = 0x52
IFT_DS1FDL = 0xaa
IFT_DS3 = 0x1e
IFT_DTM = 0x8c
IFT_DUMMY = 0xf1
IFT_DVBASILN = 0xac
IFT_DVBASIOUT = 0xad
IFT_DVBRCCDOWNSTREAM = 0x93
IFT_DVBRCCMACLAYER = 0x92
IFT_DVBRCCUPSTREAM = 0x94
IFT_ECONET = 0xce
IFT_ENC = 0xf4
IFT_EON = 0x19
IFT_EPLRS = 0x57
IFT_ESCON = 0x49
IFT_ETHER = 0x6
IFT_FAITH = 0xf3
IFT_FAST = 0x7d
IFT_FASTETHER = 0x3e
IFT_FASTETHERFX = 0x45
IFT_FDDI = 0xf
IFT_FIBRECHANNEL = 0x38
IFT_FRAMERELAYINTERCONNECT = 0x3a
IFT_FRAMERELAYMPI = 0x5c
IFT_FRDLCIENDPT = 0xc1
IFT_FRELAY = 0x20
IFT_FRELAYDCE = 0x2c
IFT_FRF16MFRBUNDLE = 0xa3
IFT_FRFORWARD = 0x9e
IFT_G703AT2MB = 0x43
IFT_G703AT64K = 0x42
IFT_GIF = 0xf0
IFT_GIGABITETHERNET = 0x75
IFT_GR303IDT = 0xb2
IFT_GR303RDT = 0xb1
IFT_H323GATEKEEPER = 0xa4
IFT_H323PROXY = 0xa5
IFT_HDH1822 = 0x3
IFT_HDLC = 0x76
IFT_HDSL2 = 0xa8
IFT_HIPERLAN2 = 0xb7
IFT_HIPPI = 0x2f
IFT_HIPPIINTERFACE = 0x39
IFT_HOSTPAD = 0x5a
IFT_HSSI = 0x2e
IFT_HY = 0xe
IFT_IBM370PARCHAN = 0x48
IFT_IDSL = 0x9a
IFT_IEEE1394 = 0x90
IFT_IEEE80211 = 0x47
IFT_IEEE80212 = 0x37
IFT_IEEE8023ADLAG = 0xa1
IFT_IFGSN = 0x91
IFT_IMT = 0xbe
IFT_INFINIBAND = 0xc7
IFT_INTERLEAVE = 0x7c
IFT_IP = 0x7e
IFT_IPFORWARD = 0x8e
IFT_IPOVERATM = 0x72
IFT_IPOVERCDLC = 0x6d
IFT_IPOVERCLAW = 0x6e
IFT_IPSWITCH = 0x4e
IFT_ISDN = 0x3f
IFT_ISDNBASIC = 0x14
IFT_ISDNPRIMARY = 0x15
IFT_ISDNS = 0x4b
IFT_ISDNU = 0x4c
IFT_ISO88022LLC = 0x29
IFT_ISO88023 = 0x7
IFT_ISO88024 = 0x8
IFT_ISO88025 = 0x9
IFT_ISO88025CRFPINT = 0x62
IFT_ISO88025DTR = 0x56
IFT_ISO88025FIBER = 0x73
IFT_ISO88026 = 0xa
IFT_ISUP = 0xb3
IFT_L2VLAN = 0x87
IFT_L3IPVLAN = 0x88
IFT_L3IPXVLAN = 0x89
IFT_LAPB = 0x10
IFT_LAPD = 0x4d
IFT_LAPF = 0x77
IFT_LINEGROUP = 0xd2
IFT_LOCALTALK = 0x2a
IFT_LOOP = 0x18
IFT_MBIM = 0xfa
IFT_MEDIAMAILOVERIP = 0x8b
IFT_MFSIGLINK = 0xa7
IFT_MIOX25 = 0x26
IFT_MODEM = 0x30
IFT_MPC = 0x71
IFT_MPLS = 0xa6
IFT_MPLSTUNNEL = 0x96
IFT_MSDSL = 0x8f
IFT_MVL = 0xbf
IFT_MYRINET = 0x63
IFT_NFAS = 0xaf
IFT_NSIP = 0x1b
IFT_OPTICALCHANNEL = 0xc3
IFT_OPTICALTRANSPORT = 0xc4
IFT_OTHER = 0x1
IFT_P10 = 0xc
IFT_P80 = 0xd
IFT_PARA = 0x22
IFT_PFLOG = 0xf5
IFT_PFLOW = 0xf9
IFT_PFSYNC = 0xf6
IFT_PLC = 0xae
IFT_PON155 = 0xcf
IFT_PON622 = 0xd0
IFT_POS = 0xab
IFT_PPP = 0x17
IFT_PPPMULTILINKBUNDLE = 0x6c
IFT_PROPATM = 0xc5
IFT_PROPBWAP2MP = 0xb8
IFT_PROPCNLS = 0x59
IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
IFT_PROPMUX = 0x36
IFT_PROPVIRTUAL = 0x35
IFT_PROPWIRELESSP2P = 0x9d
IFT_PTPSERIAL = 0x16
IFT_PVC = 0xf2
IFT_Q2931 = 0xc9
IFT_QLLC = 0x44
IFT_RADIOMAC = 0xbc
IFT_RADSL = 0x5f
IFT_REACHDSL = 0xc0
IFT_RFC1483 = 0x9f
IFT_RS232 = 0x21
IFT_RSRB = 0x4f
IFT_SDLC = 0x11
IFT_SDSL = 0x60
IFT_SHDSL = 0xa9
IFT_SIP = 0x1f
IFT_SIPSIG = 0xcc
IFT_SIPTG = 0xcb
IFT_SLIP = 0x1c
IFT_SMDSDXI = 0x2b
IFT_SMDSICIP = 0x34
IFT_SONET = 0x27
IFT_SONETOVERHEADCHANNEL = 0xb9
IFT_SONETPATH = 0x32
IFT_SONETVT = 0x33
IFT_SRP = 0x97
IFT_SS7SIGLINK = 0x9c
IFT_STACKTOSTACK = 0x6f
IFT_STARLAN = 0xb
IFT_T1 = 0x12
IFT_TDLC = 0x74
IFT_TELINK = 0xc8
IFT_TERMPAD = 0x5b
IFT_TR008 = 0xb0
IFT_TRANSPHDLC = 0x7b
IFT_TUNNEL = 0x83
IFT_ULTRA = 0x1d
IFT_USB = 0xa0
IFT_V11 = 0x40
IFT_V35 = 0x2d
IFT_V36 = 0x41
IFT_V37 = 0x78
IFT_VDSL = 0x61
IFT_VIRTUALIPADDRESS = 0x70
IFT_VIRTUALTG = 0xca
IFT_VOICEDID = 0xd5
IFT_VOICEEM = 0x64
IFT_VOICEEMFGD = 0xd3
IFT_VOICEENCAP = 0x67
IFT_VOICEFGDEANA = 0xd4
IFT_VOICEFXO = 0x65
IFT_VOICEFXS = 0x66
IFT_VOICEOVERATM = 0x98
IFT_VOICEOVERCABLE = 0xc6
IFT_VOICEOVERFRAMERELAY = 0x99
IFT_VOICEOVERIP = 0x68
IFT_X213 = 0x5d
IFT_X25 = 0x5
IFT_X25DDN = 0x4
IFT_X25HUNTGROUP = 0x7a
IFT_X25MLP = 0x79
IFT_X25PLE = 0x28
IFT_XETHER = 0x1a
IGNBRK = 0x1
IGNCR = 0x80
IGNPAR = 0x4
IMAXBEL = 0x2000
INLCR = 0x40
INPCK = 0x10
IN_CLASSA_HOST = 0xffffff
IN_CLASSA_MAX = 0x80
IN_CLASSA_NET = 0xff000000
IN_CLASSA_NSHIFT = 0x18
IN_CLASSB_HOST = 0xffff
IN_CLASSB_MAX = 0x10000
IN_CLASSB_NET = 0xffff0000
IN_CLASSB_NSHIFT = 0x10
IN_CLASSC_HOST = 0xff
IN_CLASSC_NET = 0xffffff00
IN_CLASSC_NSHIFT = 0x8
IN_CLASSD_HOST = 0xfffffff
IN_CLASSD_NET = 0xf0000000
IN_CLASSD_NSHIFT = 0x1c
IN_LOOPBACKNET = 0x7f
IN_RFC3021_HOST = 0x1
IN_RFC3021_NET = 0xfffffffe
IN_RFC3021_NSHIFT = 0x1f
IPPROTO_AH = 0x33
IPPROTO_CARP = 0x70
IPPROTO_DIVERT = 0x102
IPPROTO_DONE = 0x101
IPPROTO_DSTOPTS = 0x3c
IPPROTO_EGP = 0x8
IPPROTO_ENCAP = 0x62
IPPROTO_EON = 0x50
IPPROTO_ESP = 0x32
IPPROTO_ETHERIP = 0x61
IPPROTO_FRAGMENT = 0x2c
IPPROTO_GGP = 0x3
IPPROTO_GRE = 0x2f
IPPROTO_HOPOPTS = 0x0
IPPROTO_ICMP = 0x1
IPPROTO_ICMPV6 = 0x3a
IPPROTO_IDP = 0x16
IPPROTO_IGMP = 0x2
IPPROTO_IP = 0x0
IPPROTO_IPCOMP = 0x6c
IPPROTO_IPIP = 0x4
IPPROTO_IPV4 = 0x4
IPPROTO_IPV6 = 0x29
IPPROTO_MAX = 0x100
IPPROTO_MAXID = 0x103
IPPROTO_MOBILE = 0x37
IPPROTO_MPLS = 0x89
IPPROTO_NONE = 0x3b
IPPROTO_PFSYNC = 0xf0
IPPROTO_PIM = 0x67
IPPROTO_PUP = 0xc
IPPROTO_RAW = 0xff
IPPROTO_ROUTING = 0x2b
IPPROTO_RSVP = 0x2e
IPPROTO_TCP = 0x6
IPPROTO_TP = 0x1d
IPPROTO_UDP = 0x11
IPV6_AUTH_LEVEL = 0x35
IPV6_AUTOFLOWLABEL = 0x3b
IPV6_CHECKSUM = 0x1a
IPV6_DEFAULT_MULTICAST_HOPS = 0x1
IPV6_DEFAULT_MULTICAST_LOOP = 0x1
IPV6_DEFHLIM = 0x40
IPV6_DONTFRAG = 0x3e
IPV6_DSTOPTS = 0x32
IPV6_ESP_NETWORK_LEVEL = 0x37
IPV6_ESP_TRANS_LEVEL = 0x36
IPV6_FAITH = 0x1d
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
IPV6_FRAGTTL = 0x78
IPV6_HLIMDEC = 0x1
IPV6_HOPLIMIT = 0x2f
IPV6_HOPOPTS = 0x31
IPV6_IPCOMP_LEVEL = 0x3c
IPV6_JOIN_GROUP = 0xc
IPV6_LEAVE_GROUP = 0xd
IPV6_MAXHLIM = 0xff
IPV6_MAXPACKET = 0xffff
IPV6_MINHOPCOUNT = 0x41
IPV6_MMTU = 0x500
IPV6_MULTICAST_HOPS = 0xa
IPV6_MULTICAST_IF = 0x9
IPV6_MULTICAST_LOOP = 0xb
IPV6_NEXTHOP = 0x30
IPV6_OPTIONS = 0x1
IPV6_PATHMTU = 0x2c
IPV6_PIPEX = 0x3f
IPV6_PKTINFO = 0x2e
IPV6_PORTRANGE = 0xe
IPV6_PORTRANGE_DEFAULT = 0x0
IPV6_PORTRANGE_HIGH = 0x1
IPV6_PORTRANGE_LOW = 0x2
IPV6_RECVDSTOPTS = 0x28
IPV6_RECVDSTPORT = 0x40
IPV6_RECVHOPLIMIT = 0x25
IPV6_RECVHOPOPTS = 0x27
IPV6_RECVPATHMTU = 0x2b
IPV6_RECVPKTINFO = 0x24
IPV6_RECVRTHDR = 0x26
IPV6_RECVTCLASS = 0x39
IPV6_RTABLE = 0x1021
IPV6_RTHDR = 0x33
IPV6_RTHDRDSTOPTS = 0x23
IPV6_RTHDR_LOOSE = 0x0
IPV6_RTHDR_STRICT = 0x1
IPV6_RTHDR_TYPE_0 = 0x0
IPV6_SOCKOPT_RESERVED1 = 0x3
IPV6_TCLASS = 0x3d
IPV6_UNICAST_HOPS = 0x4
IPV6_USE_MIN_MTU = 0x2a
IPV6_V6ONLY = 0x1b
IPV6_VERSION = 0x60
IPV6_VERSION_MASK = 0xf0
IP_ADD_MEMBERSHIP = 0xc
IP_AUTH_LEVEL = 0x14
IP_DEFAULT_MULTICAST_LOOP = 0x1
IP_DEFAULT_MULTICAST_TTL = 0x1
IP_DF = 0x4000
IP_DROP_MEMBERSHIP = 0xd
IP_ESP_NETWORK_LEVEL = 0x16
IP_ESP_TRANS_LEVEL = 0x15
IP_HDRINCL = 0x2
IP_IPCOMP_LEVEL = 0x1d
IP_IPDEFTTL = 0x25
IP_IPSECFLOWINFO = 0x24
IP_IPSEC_LOCAL_AUTH = 0x1b
IP_IPSEC_LOCAL_CRED = 0x19
IP_IPSEC_LOCAL_ID = 0x17
IP_IPSEC_REMOTE_AUTH = 0x1c
IP_IPSEC_REMOTE_CRED = 0x1a
IP_IPSEC_REMOTE_ID = 0x18
IP_MAXPACKET = 0xffff
IP_MAX_MEMBERSHIPS = 0xfff
IP_MF = 0x2000
IP_MINTTL = 0x20
IP_MIN_MEMBERSHIPS = 0xf
IP_MSS = 0x240
IP_MULTICAST_IF = 0x9
IP_MULTICAST_LOOP = 0xb
IP_MULTICAST_TTL = 0xa
IP_OFFMASK = 0x1fff
IP_OPTIONS = 0x1
IP_PIPEX = 0x22
IP_PORTRANGE = 0x13
IP_PORTRANGE_DEFAULT = 0x0
IP_PORTRANGE_HIGH = 0x1
IP_PORTRANGE_LOW = 0x2
IP_RECVDSTADDR = 0x7
IP_RECVDSTPORT = 0x21
IP_RECVIF = 0x1e
IP_RECVOPTS = 0x5
IP_RECVRETOPTS = 0x6
IP_RECVRTABLE = 0x23
IP_RECVTTL = 0x1f
IP_RETOPTS = 0x8
IP_RF = 0x8000
IP_RTABLE = 0x1021
IP_SENDSRCADDR = 0x7
IP_TOS = 0x3
IP_TTL = 0x4
ISIG = 0x80
ISTRIP = 0x20
IUCLC = 0x1000
IXANY = 0x800
IXOFF = 0x400
IXON = 0x200
KERN_HOSTNAME = 0xa
KERN_OSRELEASE = 0x2
KERN_OSTYPE = 0x1
KERN_VERSION = 0x4
LCNT_OVERLOAD_FLUSH = 0x6
LOCK_EX = 0x2
LOCK_NB = 0x4
LOCK_SH = 0x1
LOCK_UN = 0x8
MADV_DONTNEED = 0x4
MADV_FREE = 0x6
MADV_NORMAL = 0x0
MADV_RANDOM = 0x1
MADV_SEQUENTIAL = 0x2
MADV_SPACEAVAIL = 0x5
MADV_WILLNEED = 0x3
MAP_ANON = 0x1000
MAP_ANONYMOUS = 0x1000
MAP_CONCEAL = 0x8000
MAP_COPY = 0x2
MAP_FILE = 0x0
MAP_FIXED = 0x10
MAP_FLAGMASK = 0xfff7
MAP_HASSEMAPHORE = 0x0
MAP_INHERIT = 0x0
MAP_INHERIT_COPY = 0x1
MAP_INHERIT_NONE = 0x2
MAP_INHERIT_SHARE = 0x0
MAP_INHERIT_ZERO = 0x3
MAP_NOEXTEND = 0x0
MAP_NORESERVE = 0x0
MAP_PRIVATE = 0x2
MAP_RENAME = 0x0
MAP_SHARED = 0x1
MAP_STACK = 0x4000
MAP_TRYFIXED = 0x0
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MNT_ASYNC = 0x40
MNT_DEFEXPORTED = 0x200
MNT_DELEXPORT = 0x20000
MNT_DOOMED = 0x8000000
MNT_EXPORTANON = 0x400
MNT_EXPORTED = 0x100
MNT_EXRDONLY = 0x80
MNT_FORCE = 0x80000
MNT_LAZY = 0x3
MNT_LOCAL = 0x1000
MNT_NOATIME = 0x8000
MNT_NODEV = 0x10
MNT_NOEXEC = 0x4
MNT_NOPERM = 0x20
MNT_NOSUID = 0x8
MNT_NOWAIT = 0x2
MNT_QUOTA = 0x2000
MNT_RDONLY = 0x1
MNT_RELOAD = 0x40000
MNT_ROOTFS = 0x4000
MNT_SOFTDEP = 0x4000000
MNT_STALLED = 0x100000
MNT_SWAPPABLE = 0x200000
MNT_SYNCHRONOUS = 0x2
MNT_UPDATE = 0x10000
MNT_VISFLAGMASK = 0x400ffff
MNT_WAIT = 0x1
MNT_WANTRDWR = 0x2000000
MNT_WXALLOWED = 0x800
MSG_BCAST = 0x100
MSG_CMSG_CLOEXEC = 0x800
MSG_CTRUNC = 0x20
MSG_DONTROUTE = 0x4
MSG_DONTWAIT = 0x80
MSG_EOR = 0x8
MSG_MCAST = 0x200
MSG_NOSIGNAL = 0x400
MSG_OOB = 0x1
MSG_PEEK = 0x2
MSG_TRUNC = 0x10
MSG_WAITALL = 0x40
MS_ASYNC = 0x1
MS_INVALIDATE = 0x4
MS_SYNC = 0x2
NAME_MAX = 0xff
NET_RT_DUMP = 0x1
NET_RT_FLAGS = 0x2
NET_RT_IFLIST = 0x3
NET_RT_IFNAMES = 0x6
NET_RT_MAXID = 0x7
NET_RT_STATS = 0x4
NET_RT_TABLE = 0x5
NFDBITS = 0x20
NOFLSH = 0x80000000
NOKERNINFO = 0x2000000
NOTE_ATTRIB = 0x8
NOTE_CHANGE = 0x1
NOTE_CHILD = 0x4
NOTE_DELETE = 0x1
NOTE_EOF = 0x2
NOTE_EXEC = 0x20000000
NOTE_EXIT = 0x80000000
NOTE_EXTEND = 0x4
NOTE_FORK = 0x40000000
NOTE_LINK = 0x10
NOTE_LOWAT = 0x1
NOTE_PCTRLMASK = 0xf0000000
NOTE_PDATAMASK = 0xfffff
NOTE_RENAME = 0x20
NOTE_REVOKE = 0x40
NOTE_TRACK = 0x1
NOTE_TRACKERR = 0x2
NOTE_TRUNCATE = 0x80
NOTE_WRITE = 0x2
OCRNL = 0x10
OLCUC = 0x20
ONLCR = 0x2
ONLRET = 0x80
ONOCR = 0x40
ONOEOT = 0x8
OPOST = 0x1
OXTABS = 0x4
O_ACCMODE = 0x3
O_APPEND = 0x8
O_ASYNC = 0x40
O_CLOEXEC = 0x10000
O_CREAT = 0x200
O_DIRECTORY = 0x20000
O_DSYNC = 0x80
O_EXCL = 0x800
O_EXLOCK = 0x20
O_FSYNC = 0x80
O_NDELAY = 0x4
O_NOCTTY = 0x8000
O_NOFOLLOW = 0x100
O_NONBLOCK = 0x4
O_RDONLY = 0x0
O_RDWR = 0x2
O_RSYNC = 0x80
O_SHLOCK = 0x10
O_SYNC = 0x80
O_TRUNC = 0x400
O_WRONLY = 0x1
PARENB = 0x1000
PARMRK = 0x8
PARODD = 0x2000
PENDIN = 0x20000000
PF_FLUSH = 0x1
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
PROT_EXEC = 0x4
PROT_NONE = 0x0
PROT_READ = 0x1
PROT_WRITE = 0x2
RLIMIT_CORE = 0x4
RLIMIT_CPU = 0x0
RLIMIT_DATA = 0x2
RLIMIT_FSIZE = 0x1
RLIMIT_MEMLOCK = 0x6
RLIMIT_NOFILE = 0x8
RLIMIT_NPROC = 0x7
RLIMIT_RSS = 0x5
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0x7fffffffffffffff
RTAX_AUTHOR = 0x6
RTAX_BFD = 0xb
RTAX_BRD = 0x7
RTAX_DNS = 0xc
RTAX_DST = 0x0
RTAX_GATEWAY = 0x1
RTAX_GENMASK = 0x3
RTAX_IFA = 0x5
RTAX_IFP = 0x4
RTAX_LABEL = 0xa
RTAX_MAX = 0xf
RTAX_NETMASK = 0x2
RTAX_SEARCH = 0xe
RTAX_SRC = 0x8
RTAX_SRCMASK = 0x9
RTAX_STATIC = 0xd
RTA_AUTHOR = 0x40
RTA_BFD = 0x800
RTA_BRD = 0x80
RTA_DNS = 0x1000
RTA_DST = 0x1
RTA_GATEWAY = 0x2
RTA_GENMASK = 0x8
RTA_IFA = 0x20
RTA_IFP = 0x10
RTA_LABEL = 0x400
RTA_NETMASK = 0x4
RTA_SEARCH = 0x4000
RTA_SRC = 0x100
RTA_SRCMASK = 0x200
RTA_STATIC = 0x2000
RTF_ANNOUNCE = 0x4000
RTF_BFD = 0x1000000
RTF_BLACKHOLE = 0x1000
RTF_BROADCAST = 0x400000
RTF_CACHED = 0x20000
RTF_CLONED = 0x10000
RTF_CLONING = 0x100
RTF_CONNECTED = 0x800000
RTF_DONE = 0x40
RTF_DYNAMIC = 0x10
RTF_FMASK = 0x110fc08
RTF_GATEWAY = 0x2
RTF_HOST = 0x4
RTF_LLINFO = 0x400
RTF_LOCAL = 0x200000
RTF_MODIFIED = 0x20
RTF_MPATH = 0x40000
RTF_MPLS = 0x100000
RTF_MULTICAST = 0x200
RTF_PERMANENT_ARP = 0x2000
RTF_PROTO1 = 0x8000
RTF_PROTO2 = 0x4000
RTF_PROTO3 = 0x2000
RTF_REJECT = 0x8
RTF_STATIC = 0x800
RTF_UP = 0x1
RTF_USETRAILERS = 0x8000
RTM_80211INFO = 0x15
RTM_ADD = 0x1
RTM_BFD = 0x12
RTM_CHANGE = 0x3
RTM_CHGADDRATTR = 0x14
RTM_DELADDR = 0xd
RTM_DELETE = 0x2
RTM_DESYNC = 0x10
RTM_GET = 0x4
RTM_IFANNOUNCE = 0xf
RTM_IFINFO = 0xe
RTM_INVALIDATE = 0x11
RTM_LOSING = 0x5
RTM_MAXSIZE = 0x800
RTM_MISS = 0x7
RTM_NEWADDR = 0xc
RTM_PROPOSAL = 0x13
RTM_REDIRECT = 0x6
RTM_RESOLVE = 0xb
RTM_RTTUNIT = 0xf4240
RTM_VERSION = 0x5
RTV_EXPIRE = 0x4
RTV_HOPCOUNT = 0x2
RTV_MTU = 0x1
RTV_RPIPE = 0x8
RTV_RTT = 0x40
RTV_RTTVAR = 0x80
RTV_SPIPE = 0x10
RTV_SSTHRESH = 0x20
RT_TABLEID_BITS = 0x8
RT_TABLEID_MASK = 0xff
RT_TABLEID_MAX = 0xff
RUSAGE_CHILDREN = -0x1
RUSAGE_SELF = 0x0
RUSAGE_THREAD = 0x1
SCM_RIGHTS = 0x1
SCM_TIMESTAMP = 0x4
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
SIOCADDMULTI = 0x80206931
SIOCAIFADDR = 0x8040691a
SIOCAIFGROUP = 0x80286987
SIOCATMARK = 0x40047307
SIOCBRDGADD = 0x8060693c
SIOCBRDGADDL = 0x80606949
SIOCBRDGADDS = 0x80606941
SIOCBRDGARL = 0x808c694d
SIOCBRDGDADDR = 0x81286947
SIOCBRDGDEL = 0x8060693d
SIOCBRDGDELS = 0x80606942
SIOCBRDGFLUSH = 0x80606948
SIOCBRDGFRL = 0x808c694e
SIOCBRDGGCACHE = 0xc0186941
SIOCBRDGGFD = 0xc0186952
SIOCBRDGGHT = 0xc0186951
SIOCBRDGGIFFLGS = 0xc060693e
SIOCBRDGGMA = 0xc0186953
SIOCBRDGGPARAM = 0xc0406958
SIOCBRDGGPRI = 0xc0186950
SIOCBRDGGRL = 0xc030694f
SIOCBRDGGTO = 0xc0186946
SIOCBRDGIFS = 0xc0606942
SIOCBRDGRTS = 0xc0206943
SIOCBRDGSADDR = 0xc1286944
SIOCBRDGSCACHE = 0x80186940
SIOCBRDGSFD = 0x80186952
SIOCBRDGSHT = 0x80186951
SIOCBRDGSIFCOST = 0x80606955
SIOCBRDGSIFFLGS = 0x8060693f
SIOCBRDGSIFPRIO = 0x80606954
SIOCBRDGSIFPROT = 0x8060694a
SIOCBRDGSMA = 0x80186953
SIOCBRDGSPRI = 0x80186950
SIOCBRDGSPROTO = 0x8018695a
SIOCBRDGSTO = 0x80186945
SIOCBRDGSTXHC = 0x80186959
SIOCDELLABEL = 0x80206997
SIOCDELMULTI = 0x80206932
SIOCDIFADDR = 0x80206919
SIOCDIFGROUP = 0x80286989
SIOCDIFPARENT = 0x802069b4
SIOCDIFPHYADDR = 0x80206949
SIOCDPWE3NEIGHBOR = 0x802069de
SIOCDVNETID = 0x802069af
SIOCGETKALIVE = 0xc01869a4
SIOCGETLABEL = 0x8020699a
SIOCGETMPWCFG = 0xc02069ae
SIOCGETPFLOW = 0xc02069fe
SIOCGETPFSYNC = 0xc02069f8
SIOCGETSGCNT = 0xc0207534
SIOCGETVIFCNT = 0xc0287533
SIOCGETVLAN = 0xc0206990
SIOCGIFADDR = 0xc0206921
SIOCGIFBRDADDR = 0xc0206923
SIOCGIFCONF = 0xc0106924
SIOCGIFDATA = 0xc020691b
SIOCGIFDESCR = 0xc0206981
SIOCGIFDSTADDR = 0xc0206922
SIOCGIFFLAGS = 0xc0206911
SIOCGIFGATTR = 0xc028698b
SIOCGIFGENERIC = 0xc020693a
SIOCGIFGLIST = 0xc028698d
SIOCGIFGMEMB = 0xc028698a
SIOCGIFGROUP = 0xc0286988
SIOCGIFHARDMTU = 0xc02069a5
SIOCGIFLLPRIO = 0xc02069b6
SIOCGIFMEDIA = 0xc0406938
SIOCGIFMETRIC = 0xc0206917
SIOCGIFMTU = 0xc020697e
SIOCGIFNETMASK = 0xc0206925
SIOCGIFPAIR = 0xc02069b1
SIOCGIFPARENT = 0xc02069b3
SIOCGIFPRIORITY = 0xc020699c
SIOCGIFRDOMAIN = 0xc02069a0
SIOCGIFRTLABEL = 0xc0206983
SIOCGIFRXR = 0x802069aa
SIOCGIFSFFPAGE = 0xc1126939
SIOCGIFXFLAGS = 0xc020699e
SIOCGLIFPHYADDR = 0xc218694b
SIOCGLIFPHYDF = 0xc02069c2
SIOCGLIFPHYECN = 0xc02069c8
SIOCGLIFPHYRTABLE = 0xc02069a2
SIOCGLIFPHYTTL = 0xc02069a9
SIOCGPGRP = 0x40047309
SIOCGPWE3 = 0xc0206998
SIOCGPWE3CTRLWORD = 0xc02069dc
SIOCGPWE3FAT = 0xc02069dd
SIOCGPWE3NEIGHBOR = 0xc21869de
SIOCGSPPPPARAMS = 0xc0206994
SIOCGTXHPRIO = 0xc02069c6
SIOCGUMBINFO = 0xc02069be
SIOCGUMBPARAM = 0xc02069c0
SIOCGVH = 0xc02069f6
SIOCGVNETFLOWID = 0xc02069c4
SIOCGVNETID = 0xc02069a7
SIOCIFAFATTACH = 0x801169ab
SIOCIFAFDETACH = 0x801169ac
SIOCIFCREATE = 0x8020697a
SIOCIFDESTROY = 0x80206979
SIOCIFGCLONERS = 0xc0106978
SIOCSETKALIVE = 0x801869a3
SIOCSETLABEL = 0x80206999
SIOCSETMPWCFG = 0x802069ad
SIOCSETPFLOW = 0x802069fd
SIOCSETPFSYNC = 0x802069f7
SIOCSETVLAN = 0x8020698f
SIOCSIFADDR = 0x8020690c
SIOCSIFBRDADDR = 0x80206913
SIOCSIFDESCR = 0x80206980
SIOCSIFDSTADDR = 0x8020690e
SIOCSIFFLAGS = 0x80206910
SIOCSIFGATTR = 0x8028698c
SIOCSIFGENERIC = 0x80206939
SIOCSIFLLADDR = 0x8020691f
SIOCSIFLLPRIO = 0x802069b5
SIOCSIFMEDIA = 0xc0206937
SIOCSIFMETRIC = 0x80206918
SIOCSIFMTU = 0x8020697f
SIOCSIFNETMASK = 0x80206916
SIOCSIFPAIR = 0x802069b0
SIOCSIFPARENT = 0x802069b2
SIOCSIFPRIORITY = 0x8020699b
SIOCSIFRDOMAIN = 0x8020699f
SIOCSIFRTLABEL = 0x80206982
SIOCSIFXFLAGS = 0x8020699d
SIOCSLIFPHYADDR = 0x8218694a
SIOCSLIFPHYDF = 0x802069c1
SIOCSLIFPHYECN = 0x802069c7
SIOCSLIFPHYRTABLE = 0x802069a1
SIOCSLIFPHYTTL = 0x802069a8
SIOCSPGRP = 0x80047308
SIOCSPWE3CTRLWORD = 0x802069dc
SIOCSPWE3FAT = 0x802069dd
SIOCSPWE3NEIGHBOR = 0x821869de
SIOCSSPPPPARAMS = 0x80206993
SIOCSTXHPRIO = 0x802069c5
SIOCSUMBPARAM = 0x802069bf
SIOCSVH = 0xc02069f5
SIOCSVNETFLOWID = 0x802069c3
SIOCSVNETID = 0x802069a6
SIOCSWGDPID = 0xc018695b
SIOCSWGMAXFLOW = 0xc0186960
SIOCSWGMAXGROUP = 0xc018695d
SIOCSWSDPID = 0x8018695c
SIOCSWSPORTNO = 0xc060695f
SOCK_CLOEXEC = 0x8000
SOCK_DGRAM = 0x2
SOCK_DNS = 0x1000
SOCK_NONBLOCK = 0x4000
SOCK_RAW = 0x3
SOCK_RDM = 0x4
SOCK_SEQPACKET = 0x5
SOCK_STREAM = 0x1
SOL_SOCKET = 0xffff
SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x2
SO_BINDANY = 0x1000
SO_BROADCAST = 0x20
SO_DEBUG = 0x1
SO_DONTROUTE = 0x10
SO_ERROR = 0x1007
SO_KEEPALIVE = 0x8
SO_LINGER = 0x80
SO_NETPROC = 0x1020
SO_OOBINLINE = 0x100
SO_PEERCRED = 0x1022
SO_RCVBUF = 0x1002
SO_RCVLOWAT = 0x1004
SO_RCVTIMEO = 0x1006
SO_REUSEADDR = 0x4
SO_REUSEPORT = 0x200
SO_RTABLE = 0x1021
SO_SNDBUF = 0x1001
SO_SNDLOWAT = 0x1003
SO_SNDTIMEO = 0x1005
SO_SPLICE = 0x1023
SO_TIMESTAMP = 0x800
SO_TYPE = 0x1008
SO_USELOOPBACK = 0x40
SO_ZEROIZE = 0x2000
S_BLKSIZE = 0x200
S_IEXEC = 0x40
S_IFBLK = 0x6000
S_IFCHR = 0x2000
S_IFDIR = 0x4000
S_IFIFO = 0x1000
S_IFLNK = 0xa000
S_IFMT = 0xf000
S_IFREG = 0x8000
S_IFSOCK = 0xc000
S_IREAD = 0x100
S_IRGRP = 0x20
S_IROTH = 0x4
S_IRUSR = 0x100
S_IRWXG = 0x38
S_IRWXO = 0x7
S_IRWXU = 0x1c0
S_ISGID = 0x400
S_ISTXT = 0x200
S_ISUID = 0x800
S_ISVTX = 0x200
S_IWGRP = 0x10
S_IWOTH = 0x2
S_IWRITE = 0x80
S_IWUSR = 0x80
S_IXGRP = 0x8
S_IXOTH = 0x1
S_IXUSR = 0x40
TCIFLUSH = 0x1
TCIOFF = 0x3
TCIOFLUSH = 0x3
TCION = 0x4
TCOFLUSH = 0x2
TCOOFF = 0x1
TCOON = 0x2
TCP_MAXBURST = 0x4
TCP_MAXSEG = 0x2
TCP_MAXWIN = 0xffff
TCP_MAX_SACK = 0x3
TCP_MAX_WINSHIFT = 0xe
TCP_MD5SIG = 0x4
TCP_MSS = 0x200
TCP_NODELAY = 0x1
TCP_NOPUSH = 0x10
TCP_SACK_ENABLE = 0x8
TCSAFLUSH = 0x2
TIMER_ABSTIME = 0x1
TIMER_RELTIME = 0x0
TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478
TIOCCHKVERAUTH = 0x2000741e
TIOCCLRVERAUTH = 0x2000741d
TIOCCONS = 0x80047462
TIOCDRAIN = 0x2000745e
TIOCEXCL = 0x2000740d
TIOCEXT = 0x80047460
TIOCFLAG_CLOCAL = 0x2
TIOCFLAG_CRTSCTS = 0x4
TIOCFLAG_MDMBUF = 0x8
TIOCFLAG_PPS = 0x10
TIOCFLAG_SOFTCAR = 0x1
TIOCFLUSH = 0x80047410
TIOCGETA = 0x402c7413
TIOCGETD = 0x4004741a
TIOCGFLAGS = 0x4004745d
TIOCGPGRP = 0x40047477
TIOCGSID = 0x40047463
TIOCGTSTAMP = 0x4010745b
TIOCGWINSZ = 0x40087468
TIOCMBIC = 0x8004746b
TIOCMBIS = 0x8004746c
TIOCMGET = 0x4004746a
TIOCMODG = 0x4004746a
TIOCMODS = 0x8004746d
TIOCMSET = 0x8004746d
TIOCM_CAR = 0x40
TIOCM_CD = 0x40
TIOCM_CTS = 0x20
TIOCM_DSR = 0x100
TIOCM_DTR = 0x2
TIOCM_LE = 0x1
TIOCM_RI = 0x80
TIOCM_RNG = 0x80
TIOCM_RTS = 0x4
TIOCM_SR = 0x10
TIOCM_ST = 0x8
TIOCNOTTY = 0x20007471
TIOCNXCL = 0x2000740e
TIOCOUTQ = 0x40047473
TIOCPKT = 0x80047470
TIOCPKT_DATA = 0x0
TIOCPKT_DOSTOP = 0x20
TIOCPKT_FLUSHREAD = 0x1
TIOCPKT_FLUSHWRITE = 0x2
TIOCPKT_IOCTL = 0x40
TIOCPKT_NOSTOP = 0x10
TIOCPKT_START = 0x8
TIOCPKT_STOP = 0x4
TIOCREMOTE = 0x80047469
TIOCSBRK = 0x2000747b
TIOCSCTTY = 0x20007461
TIOCSDTR = 0x20007479
TIOCSETA = 0x802c7414
TIOCSETAF = 0x802c7416
TIOCSETAW = 0x802c7415
TIOCSETD = 0x8004741b
TIOCSETVERAUTH = 0x8004741c
TIOCSFLAGS = 0x8004745c
TIOCSIG = 0x8004745f
TIOCSPGRP = 0x80047476
TIOCSTART = 0x2000746e
TIOCSTAT = 0x20007465
TIOCSTOP = 0x2000746f
TIOCSTSTAMP = 0x8008745a
TIOCSWINSZ = 0x80087467
TIOCUCNTL = 0x80047466
TIOCUCNTL_CBRK = 0x7a
TIOCUCNTL_SBRK = 0x7b
TOSTOP = 0x400000
UTIME_NOW = -0x2
UTIME_OMIT = -0x1
VDISCARD = 0xf
VDSUSP = 0xb
VEOF = 0x0
VEOL = 0x1
VEOL2 = 0x2
VERASE = 0x3
VINTR = 0x8
VKILL = 0x5
VLNEXT = 0xe
VMIN = 0x10
VM_ANONMIN = 0x7
VM_LOADAVG = 0x2
VM_MALLOC_CONF = 0xc
VM_MAXID = 0xd
VM_MAXSLP = 0xa
VM_METER = 0x1
VM_NKMEMPAGES = 0x6
VM_PSSTRINGS = 0x3
VM_SWAPENCRYPT = 0x5
VM_USPACE = 0xb
VM_UVMEXP = 0x4
VM_VNODEMIN = 0x9
VM_VTEXTMIN = 0x8
VQUIT = 0x9
VREPRINT = 0x6
VSTART = 0xc
VSTATUS = 0x12
VSTOP = 0xd
VSUSP = 0xa
VTIME = 0x11
VWERASE = 0x4
WALTSIG = 0x4
WCONTINUED = 0x8
WCOREFLAG = 0x80
WNOHANG = 0x1
WUNTRACED = 0x2
XCASE = 0x1000000
)
// Errors
const (
E2BIG = syscall.Errno(0x7)
EACCES = syscall.Errno(0xd)
EADDRINUSE = syscall.Errno(0x30)
EADDRNOTAVAIL = syscall.Errno(0x31)
EAFNOSUPPORT = syscall.Errno(0x2f)
EAGAIN = syscall.Errno(0x23)
EALREADY = syscall.Errno(0x25)
EAUTH = syscall.Errno(0x50)
EBADF = syscall.Errno(0x9)
EBADMSG = syscall.Errno(0x5c)
EBADRPC = syscall.Errno(0x48)
EBUSY = syscall.Errno(0x10)
ECANCELED = syscall.Errno(0x58)
ECHILD = syscall.Errno(0xa)
ECONNABORTED = syscall.Errno(0x35)
ECONNREFUSED = syscall.Errno(0x3d)
ECONNRESET = syscall.Errno(0x36)
EDEADLK = syscall.Errno(0xb)
EDESTADDRREQ = syscall.Errno(0x27)
EDOM = syscall.Errno(0x21)
EDQUOT = syscall.Errno(0x45)
EEXIST = syscall.Errno(0x11)
EFAULT = syscall.Errno(0xe)
EFBIG = syscall.Errno(0x1b)
EFTYPE = syscall.Errno(0x4f)
EHOSTDOWN = syscall.Errno(0x40)
EHOSTUNREACH = syscall.Errno(0x41)
EIDRM = syscall.Errno(0x59)
EILSEQ = syscall.Errno(0x54)
EINPROGRESS = syscall.Errno(0x24)
EINTR = syscall.Errno(0x4)
EINVAL = syscall.Errno(0x16)
EIO = syscall.Errno(0x5)
EIPSEC = syscall.Errno(0x52)
EISCONN = syscall.Errno(0x38)
EISDIR = syscall.Errno(0x15)
ELAST = syscall.Errno(0x5f)
ELOOP = syscall.Errno(0x3e)
EMEDIUMTYPE = syscall.Errno(0x56)
EMFILE = syscall.Errno(0x18)
EMLINK = syscall.Errno(0x1f)
EMSGSIZE = syscall.Errno(0x28)
ENAMETOOLONG = syscall.Errno(0x3f)
ENEEDAUTH = syscall.Errno(0x51)
ENETDOWN = syscall.Errno(0x32)
ENETRESET = syscall.Errno(0x34)
ENETUNREACH = syscall.Errno(0x33)
ENFILE = syscall.Errno(0x17)
ENOATTR = syscall.Errno(0x53)
ENOBUFS = syscall.Errno(0x37)
ENODEV = syscall.Errno(0x13)
ENOENT = syscall.Errno(0x2)
ENOEXEC = syscall.Errno(0x8)
ENOLCK = syscall.Errno(0x4d)
ENOMEDIUM = syscall.Errno(0x55)
ENOMEM = syscall.Errno(0xc)
ENOMSG = syscall.Errno(0x5a)
ENOPROTOOPT = syscall.Errno(0x2a)
ENOSPC = syscall.Errno(0x1c)
ENOSYS = syscall.Errno(0x4e)
ENOTBLK = syscall.Errno(0xf)
ENOTCONN = syscall.Errno(0x39)
ENOTDIR = syscall.Errno(0x14)
ENOTEMPTY = syscall.Errno(0x42)
ENOTRECOVERABLE = syscall.Errno(0x5d)
ENOTSOCK = syscall.Errno(0x26)
ENOTSUP = syscall.Errno(0x5b)
ENOTTY = syscall.Errno(0x19)
ENXIO = syscall.Errno(0x6)
EOPNOTSUPP = syscall.Errno(0x2d)
EOVERFLOW = syscall.Errno(0x57)
EOWNERDEAD = syscall.Errno(0x5e)
EPERM = syscall.Errno(0x1)
EPFNOSUPPORT = syscall.Errno(0x2e)
EPIPE = syscall.Errno(0x20)
EPROCLIM = syscall.Errno(0x43)
EPROCUNAVAIL = syscall.Errno(0x4c)
EPROGMISMATCH = syscall.Errno(0x4b)
EPROGUNAVAIL = syscall.Errno(0x4a)
EPROTO = syscall.Errno(0x5f)
EPROTONOSUPPORT = syscall.Errno(0x2b)
EPROTOTYPE = syscall.Errno(0x29)
ERANGE = syscall.Errno(0x22)
EREMOTE = syscall.Errno(0x47)
EROFS = syscall.Errno(0x1e)
ERPCMISMATCH = syscall.Errno(0x49)
ESHUTDOWN = syscall.Errno(0x3a)
ESOCKTNOSUPPORT = syscall.Errno(0x2c)
ESPIPE = syscall.Errno(0x1d)
ESRCH = syscall.Errno(0x3)
ESTALE = syscall.Errno(0x46)
ETIMEDOUT = syscall.Errno(0x3c)
ETOOMANYREFS = syscall.Errno(0x3b)
ETXTBSY = syscall.Errno(0x1a)
EUSERS = syscall.Errno(0x44)
EWOULDBLOCK = syscall.Errno(0x23)
EXDEV = syscall.Errno(0x12)
)
// Signals
const (
SIGABRT = syscall.Signal(0x6)
SIGALRM = syscall.Signal(0xe)
SIGBUS = syscall.Signal(0xa)
SIGCHLD = syscall.Signal(0x14)
SIGCONT = syscall.Signal(0x13)
SIGEMT = syscall.Signal(0x7)
SIGFPE = syscall.Signal(0x8)
SIGHUP = syscall.Signal(0x1)
SIGILL = syscall.Signal(0x4)
SIGINFO = syscall.Signal(0x1d)
SIGINT = syscall.Signal(0x2)
SIGIO = syscall.Signal(0x17)
SIGIOT = syscall.Signal(0x6)
SIGKILL = syscall.Signal(0x9)
SIGPIPE = syscall.Signal(0xd)
SIGPROF = syscall.Signal(0x1b)
SIGQUIT = syscall.Signal(0x3)
SIGSEGV = syscall.Signal(0xb)
SIGSTOP = syscall.Signal(0x11)
SIGSYS = syscall.Signal(0xc)
SIGTERM = syscall.Signal(0xf)
SIGTHR = syscall.Signal(0x20)
SIGTRAP = syscall.Signal(0x5)
SIGTSTP = syscall.Signal(0x12)
SIGTTIN = syscall.Signal(0x15)
SIGTTOU = syscall.Signal(0x16)
SIGURG = syscall.Signal(0x10)
SIGUSR1 = syscall.Signal(0x1e)
SIGUSR2 = syscall.Signal(0x1f)
SIGVTALRM = syscall.Signal(0x1a)
SIGWINCH = syscall.Signal(0x1c)
SIGXCPU = syscall.Signal(0x18)
SIGXFSZ = syscall.Signal(0x19)
)
// Error table
var errorList = [...]struct {
num syscall.Errno
name string
desc string
}{
{1, "EPERM", "operation not permitted"},
{2, "ENOENT", "no such file or directory"},
{3, "ESRCH", "no such process"},
{4, "EINTR", "interrupted system call"},
{5, "EIO", "input/output error"},
{6, "ENXIO", "device not configured"},
{7, "E2BIG", "argument list too long"},
{8, "ENOEXEC", "exec format error"},
{9, "EBADF", "bad file descriptor"},
{10, "ECHILD", "no child processes"},
{11, "EDEADLK", "resource deadlock avoided"},
{12, "ENOMEM", "cannot allocate memory"},
{13, "EACCES", "permission denied"},
{14, "EFAULT", "bad address"},
{15, "ENOTBLK", "block device required"},
{16, "EBUSY", "device busy"},
{17, "EEXIST", "file exists"},
{18, "EXDEV", "cross-device link"},
{19, "ENODEV", "operation not supported by device"},
{20, "ENOTDIR", "not a directory"},
{21, "EISDIR", "is a directory"},
{22, "EINVAL", "invalid argument"},
{23, "ENFILE", "too many open files in system"},
{24, "EMFILE", "too many open files"},
{25, "ENOTTY", "inappropriate ioctl for device"},
{26, "ETXTBSY", "text file busy"},
{27, "EFBIG", "file too large"},
{28, "ENOSPC", "no space left on device"},
{29, "ESPIPE", "illegal seek"},
{30, "EROFS", "read-only file system"},
{31, "EMLINK", "too many links"},
{32, "EPIPE", "broken pipe"},
{33, "EDOM", "numerical argument out of domain"},
{34, "ERANGE", "result too large"},
{35, "EAGAIN", "resource temporarily unavailable"},
{36, "EINPROGRESS", "operation now in progress"},
{37, "EALREADY", "operation already in progress"},
{38, "ENOTSOCK", "socket operation on non-socket"},
{39, "EDESTADDRREQ", "destination address required"},
{40, "EMSGSIZE", "message too long"},
{41, "EPROTOTYPE", "protocol wrong type for socket"},
{42, "ENOPROTOOPT", "protocol not available"},
{43, "EPROTONOSUPPORT", "protocol not supported"},
{44, "ESOCKTNOSUPPORT", "socket type not supported"},
{45, "EOPNOTSUPP", "operation not supported"},
{46, "EPFNOSUPPORT", "protocol family not supported"},
{47, "EAFNOSUPPORT", "address family not supported by protocol family"},
{48, "EADDRINUSE", "address already in use"},
{49, "EADDRNOTAVAIL", "can't assign requested address"},
{50, "ENETDOWN", "network is down"},
{51, "ENETUNREACH", "network is unreachable"},
{52, "ENETRESET", "network dropped connection on reset"},
{53, "ECONNABORTED", "software caused connection abort"},
{54, "ECONNRESET", "connection reset by peer"},
{55, "ENOBUFS", "no buffer space available"},
{56, "EISCONN", "socket is already connected"},
{57, "ENOTCONN", "socket is not connected"},
{58, "ESHUTDOWN", "can't send after socket shutdown"},
{59, "ETOOMANYREFS", "too many references: can't splice"},
{60, "ETIMEDOUT", "operation timed out"},
{61, "ECONNREFUSED", "connection refused"},
{62, "ELOOP", "too many levels of symbolic links"},
{63, "ENAMETOOLONG", "file name too long"},
{64, "EHOSTDOWN", "host is down"},
{65, "EHOSTUNREACH", "no route to host"},
{66, "ENOTEMPTY", "directory not empty"},
{67, "EPROCLIM", "too many processes"},
{68, "EUSERS", "too many users"},
{69, "EDQUOT", "disk quota exceeded"},
{70, "ESTALE", "stale NFS file handle"},
{71, "EREMOTE", "too many levels of remote in path"},
{72, "EBADRPC", "RPC struct is bad"},
{73, "ERPCMISMATCH", "RPC version wrong"},
{74, "EPROGUNAVAIL", "RPC program not available"},
{75, "EPROGMISMATCH", "program version wrong"},
{76, "EPROCUNAVAIL", "bad procedure for program"},
{77, "ENOLCK", "no locks available"},
{78, "ENOSYS", "function not implemented"},
{79, "EFTYPE", "inappropriate file type or format"},
{80, "EAUTH", "authentication error"},
{81, "ENEEDAUTH", "need authenticator"},
{82, "EIPSEC", "IPsec processing failure"},
{83, "ENOATTR", "attribute not found"},
{84, "EILSEQ", "illegal byte sequence"},
{85, "ENOMEDIUM", "no medium found"},
{86, "EMEDIUMTYPE", "wrong medium type"},
{87, "EOVERFLOW", "value too large to be stored in data type"},
{88, "ECANCELED", "operation canceled"},
{89, "EIDRM", "identifier removed"},
{90, "ENOMSG", "no message of desired type"},
{91, "ENOTSUP", "not supported"},
{92, "EBADMSG", "bad message"},
{93, "ENOTRECOVERABLE", "state not recoverable"},
{94, "EOWNERDEAD", "previous owner died"},
{95, "ELAST", "protocol error"},
}
// Signal table
var signalList = [...]struct {
num syscall.Signal
name string
desc string
}{
{1, "SIGHUP", "hangup"},
{2, "SIGINT", "interrupt"},
{3, "SIGQUIT", "quit"},
{4, "SIGILL", "illegal instruction"},
{5, "SIGTRAP", "trace/BPT trap"},
{6, "SIGABRT", "abort trap"},
{7, "SIGEMT", "EMT trap"},
{8, "SIGFPE", "floating point exception"},
{9, "SIGKILL", "killed"},
{10, "SIGBUS", "bus error"},
{11, "SIGSEGV", "segmentation fault"},
{12, "SIGSYS", "bad system call"},
{13, "SIGPIPE", "broken pipe"},
{14, "SIGALRM", "alarm clock"},
{15, "SIGTERM", "terminated"},
{16, "SIGURG", "urgent I/O condition"},
{17, "SIGSTOP", "suspended (signal)"},
{18, "SIGTSTP", "suspended"},
{19, "SIGCONT", "continued"},
{20, "SIGCHLD", "child exited"},
{21, "SIGTTIN", "stopped (tty input)"},
{22, "SIGTTOU", "stopped (tty output)"},
{23, "SIGIO", "I/O possible"},
{24, "SIGXCPU", "cputime limit exceeded"},
{25, "SIGXFSZ", "filesize limit exceeded"},
{26, "SIGVTALRM", "virtual timer expired"},
{27, "SIGPROF", "profiling timer expired"},
{28, "SIGWINCH", "window size changes"},
{29, "SIGINFO", "information request"},
{30, "SIGUSR1", "user defined signal 1"},
{31, "SIGUSR2", "user defined signal 2"},
{32, "SIGTHR", "thread AST"},
}
| {
"pile_set_name": "Github"
} |
// Copyright 2018 Google LLC
// Copyright 2018-present Open Networking Foundation
// SPDX-License-Identifier: Apache-2.0
#ifndef STRATUM_HAL_LIB_COMMON_CONFIG_MONITORING_SERVICE_H_
#define STRATUM_HAL_LIB_COMMON_CONFIG_MONITORING_SERVICE_H_
#include <memory>
#include "absl/base/thread_annotations.h"
#include "absl/synchronization/mutex.h"
#include "gnmi/gnmi.grpc.pb.h"
#include "grpcpp/grpcpp.h"
#include "stratum/glue/integral_types.h"
#include "stratum/glue/status/status.h"
#include "stratum/hal/lib/common/common.pb.h"
#include "stratum/hal/lib/common/error_buffer.h"
#include "stratum/hal/lib/common/gnmi_publisher.h"
#include "stratum/hal/lib/common/switch_interface.h"
#include "stratum/lib/security/auth_policy_checker.h"
namespace stratum {
namespace hal {
using ServerSubscribeReaderWriter =
::grpc::ServerReaderWriter<::gnmi::SubscribeResponse,
::gnmi::SubscribeRequest>;
using ServerSubscribeReaderWriterInterface =
::grpc::ServerReaderWriterInterface<::gnmi::SubscribeResponse,
::gnmi::SubscribeRequest>;
// The "ConfigMonitoringService" class implements ::gnmi::gNMI::Service. It
// handles all the RPCs that are part of the gRPC Network Management Interface
// (gNMI) which are in charge of configuration and monitoring/telemetry.
class ConfigMonitoringService final : public ::gnmi::gNMI::Service {
public:
ConfigMonitoringService(OperationMode mode, SwitchInterface* switch_interface,
AuthPolicyChecker* auth_policy_checker,
ErrorBuffer* error_buffer);
~ConfigMonitoringService() override;
// Sets up the service in coldboot and warmboot mode. In the coldboot mode,
// the function initializes the class and pushes the saved chassis config to
// the switch. In the warmboot mode, it only restores the internal state of
// the class.
::util::Status Setup(bool warmboot) LOCKS_EXCLUDED(config_lock_);
// Tears down the class. Called in both warmboot or coldboot mode. It will
// not alter any state on the hardware when called.
::util::Status Teardown() LOCKS_EXCLUDED(config_lock_);
// Public helper function called in Setup(). It deserializes the contents
// of the FLAGS_chassis_config_file file and calls PushChassisConfig().
::util::Status PushSavedChassisConfig(bool warmboot);
// Public helper function that is called to perform actual config push. It is
// called by PushSavedChassisConfig(). It takes ownership of the 'config'
// pointer and passes it to 'running_chassis_config_'.
::util::Status PushChassisConfig(bool warmboot,
std::unique_ptr<ChassisConfig> config)
LOCKS_EXCLUDED(config_lock_);
// Returns the set of capabilities that is supported by the switch.
::grpc::Status Capabilities(::grpc::ServerContext* context,
const ::gnmi::CapabilityRequest* req,
::gnmi::CapabilityResponse* resp) override
LOCKS_EXCLUDED(config_lock_);
// Modify the state/config on the switch. The paths to modify along with the
// new values that the client wishes to set the value to are given in the
// request.
::grpc::Status Set(::grpc::ServerContext* context,
const ::gnmi::SetRequest* req,
::gnmi::SetResponse* resp) override
LOCKS_EXCLUDED(config_lock_);
// Returns snapshots a subset of the config/state tree as specified by the
// paths included in the request.
::grpc::Status Get(::grpc::ServerContext* context,
const ::gnmi::GetRequest* req,
::gnmi::GetResponse* resp) override
LOCKS_EXCLUDED(config_lock_);
// Subscribe allows a client to request the switch to send it values
// of particular paths within the config/state tree. These values may be
// streamed at a particular cadence (STREAM), sent one off on a long-lived
// channel (POLL), or sent as a one-off retrieval (ONCE).
::grpc::Status Subscribe(::grpc::ServerContext* context,
ServerSubscribeReaderWriter* stream) override
LOCKS_EXCLUDED(config_lock_);
// ConfigMonitoringService is neither copyable nor movable.
ConfigMonitoringService(const ConfigMonitoringService&) = delete;
ConfigMonitoringService& operator=(const ConfigMonitoringService&) = delete;
private:
// The actual method that implements 'Capabilites' the allows a client to
// request the switch to send models it supported.
// This is implemented this way to enable unit tests of the Capabilites
// method.
::grpc::Status DoCapabilities(::grpc::ServerContext* context,
const ::gnmi::CapabilityRequest* req,
::gnmi::CapabilityResponse* resp);
// The actual method that implements 'Subscribe' that allows a client to
// request the switch to send it values of particular paths within the
// config/state tree. These values may be streamed at a particular cadence
// (STREAM), sent one off on a long-lived channel (POLL), or sent as a one-off
// retrieval (ONCE). This is implemented this way to enable unit tests of the
// Subscribe method whose 'stream' parameter type is marked 'final' and
// therefore cannot be mocked.
::grpc::Status DoSubscribe(GnmiPublisher* publisher,
::grpc::ServerContext* context,
ServerSubscribeReaderWriterInterface* stream)
LOCKS_EXCLUDED(config_lock_);
// The actual method that implements 'Get' that allows a client to
// request the switch to send it values of particular paths within the
// config/state tree. These values are sent as a one-off
// retrieval. This is implemented this way to enable unit tests of the
// Get method.
::grpc::Status DoGet(::grpc::ServerContext* context,
const ::gnmi::GetRequest* req, ::gnmi::GetResponse* resp)
LOCKS_EXCLUDED(config_lock_);
// The actual method that implements 'Set' that allows a client to
// request the switch to change values of particular paths within the
// config/state tree. This is implemented this way to enable unit tests of the
// Set method.
::grpc::Status DoSet(::grpc::ServerContext* context,
const ::gnmi::SetRequest* req, ::gnmi::SetResponse* resp)
LOCKS_EXCLUDED(config_lock_);
// Mutex lock for protecting the internal chassis config pushed to the switch.
mutable absl::Mutex config_lock_;
// Hold the ChassisConfig which is currently running on the switch.
std::unique_ptr<ChassisConfig> running_chassis_config_
GUARDED_BY(config_lock_);
// Determines the mode of operation:
// - OPERATION_MODE_STANDALONE: when Stratum stack runs independently and
// therefore needs to do all the SDK initialization itself.
// - OPERATION_MODE_COUPLED: when Stratum stack runs as part of Sandcastle
// stack, coupled with the rest of stack processes.
// - OPERATION_MODE_SIM: when Stratum stack runs in simulation mode.
// Note that this variable is set upon initialization and is never changed
// afterwards.
OperationMode mode_;
// Pointer to SwitchInterface implementation, which encapsulates all the
// switch capabilities. Not owned by this class.
SwitchInterface* switch_interface_;
// Pointer to AuthPolicyChecker. Not owned by this class.
AuthPolicyChecker* auth_policy_checker_;
// Pointer to ErrorBuffer to save any critical errors we encounter. Not owned
// by this class.
ErrorBuffer* error_buffer_;
// An object handling gNMI Subscribe, Set and Get requests.
GnmiPublisher gnmi_publisher_;
friend class ConfigMonitoringServiceTest;
};
} // namespace hal
} // namespace stratum
#endif // STRATUM_HAL_LIB_COMMON_CONFIG_MONITORING_SERVICE_H_
| {
"pile_set_name": "Github"
} |
package com.github.unidbg.android.ida;
import com.github.unidbg.file.linux.AndroidFileIO;
import com.github.unidbg.linux.android.AndroidARMEmulator;
import com.github.unidbg.memory.SvcMemory;
import com.github.unidbg.unix.UnixSyscallHandler;
import java.io.File;
class MyAndroidARMEmulator extends AndroidARMEmulator {
public MyAndroidARMEmulator(File executable) {
super(executable.getName(), new File("target/rootfs/ida"));
}
@Override
protected UnixSyscallHandler<AndroidFileIO> createSyscallHandler(SvcMemory svcMemory) {
return new MyARMSyscallHandler(svcMemory);
}
}
| {
"pile_set_name": "Github"
} |
process.env.TS_NODE_TRANSPILE_ONLY = true;
export default {
compileEnhancements: false,
extensions: ['ts'],
require: ['ts-node/register'],
};
| {
"pile_set_name": "Github"
} |
package credentials
import (
"fmt"
"os"
"path/filepath"
"github.com/go-ini/ini"
"github.com/djannot/aws-sdk-go/aws/awserr"
)
// SharedCredsProviderName provides a name of SharedCreds provider
const SharedCredsProviderName = "SharedCredentialsProvider"
var (
// ErrSharedCredentialsHomeNotFound is emitted when the user directory cannot be found.
//
// @readonly
ErrSharedCredentialsHomeNotFound = awserr.New("UserHomeNotFound", "user home directory not found.", nil)
)
// A SharedCredentialsProvider retrieves credentials from the current user's home
// directory, and keeps track if those credentials are expired.
//
// Profile ini file example: $HOME/.aws/credentials
type SharedCredentialsProvider struct {
// Path to the shared credentials file.
//
// If empty will look for "AWS_SHARED_CREDENTIALS_FILE" env variable. If the
// env value is empty will default to current user's home directory.
// Linux/OSX: "$HOME/.aws/credentials"
// Windows: "%USERPROFILE%\.aws\credentials"
Filename string
// AWS Profile to extract credentials from the shared credentials file. If empty
// will default to environment variable "AWS_PROFILE" or "default" if
// environment variable is also not set.
Profile string
// retrieved states if the credentials have been successfully retrieved.
retrieved bool
}
// NewSharedCredentials returns a pointer to a new Credentials object
// wrapping the Profile file provider.
func NewSharedCredentials(filename, profile string) *Credentials {
return NewCredentials(&SharedCredentialsProvider{
Filename: filename,
Profile: profile,
})
}
// Retrieve reads and extracts the shared credentials from the current
// users home directory.
func (p *SharedCredentialsProvider) Retrieve() (Value, error) {
p.retrieved = false
filename, err := p.filename()
if err != nil {
return Value{ProviderName: SharedCredsProviderName}, err
}
creds, err := loadProfile(filename, p.profile())
if err != nil {
return Value{ProviderName: SharedCredsProviderName}, err
}
p.retrieved = true
return creds, nil
}
// IsExpired returns if the shared credentials have expired.
func (p *SharedCredentialsProvider) IsExpired() bool {
return !p.retrieved
}
// loadProfiles loads from the file pointed to by shared credentials filename for profile.
// The credentials retrieved from the profile will be returned or error. Error will be
// returned if it fails to read from the file, or the data is invalid.
func loadProfile(filename, profile string) (Value, error) {
config, err := ini.Load(filename)
if err != nil {
return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsLoad", "failed to load shared credentials file", err)
}
iniProfile, err := config.GetSection(profile)
if err != nil {
return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsLoad", "failed to get profile", err)
}
id, err := iniProfile.GetKey("aws_access_key_id")
if err != nil {
return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsAccessKey",
fmt.Sprintf("shared credentials %s in %s did not contain aws_access_key_id", profile, filename),
err)
}
secret, err := iniProfile.GetKey("aws_secret_access_key")
if err != nil {
return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsSecret",
fmt.Sprintf("shared credentials %s in %s did not contain aws_secret_access_key", profile, filename),
nil)
}
// Default to empty string if not found
token := iniProfile.Key("aws_session_token")
return Value{
AccessKeyID: id.String(),
SecretAccessKey: secret.String(),
SessionToken: token.String(),
ProviderName: SharedCredsProviderName,
}, nil
}
// filename returns the filename to use to read AWS shared credentials.
//
// Will return an error if the user's home directory path cannot be found.
func (p *SharedCredentialsProvider) filename() (string, error) {
if p.Filename == "" {
if p.Filename = os.Getenv("AWS_SHARED_CREDENTIALS_FILE"); p.Filename != "" {
return p.Filename, nil
}
homeDir := os.Getenv("HOME") // *nix
if homeDir == "" { // Windows
homeDir = os.Getenv("USERPROFILE")
}
if homeDir == "" {
return "", ErrSharedCredentialsHomeNotFound
}
p.Filename = filepath.Join(homeDir, ".aws", "credentials")
}
return p.Filename, nil
}
// profile returns the AWS shared credentials profile. If empty will read
// environment variable "AWS_PROFILE". If that is not set profile will
// return "default".
func (p *SharedCredentialsProvider) profile() string {
if p.Profile == "" {
p.Profile = os.Getenv("AWS_PROFILE")
}
if p.Profile == "" {
p.Profile = "default"
}
return p.Profile
}
| {
"pile_set_name": "Github"
} |
---
title: "group: checkMemberGroups"
description: "Check for membership in the specified list of groups."
author: "yyuank"
localization_priority: Normal
ms.prod: "groups"
doc_type: apiPageType
---
# group: checkMemberGroups
Namespace: microsoft.graph
[!INCLUDE [beta-disclaimer](../../includes/beta-disclaimer.md)]
Check for membership in the specified list of groups. Returns from the list those groups of which
the specified group has a direct or transitive membership.
You can check up to a maximum of 20 groups per request. This function supports Microsoft 365 and other
types of groups provisioned in Azure AD. Note that Microsoft 365 groups cannot contain groups. So membership
in a Microsoft 365 group is always direct.
## Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see [Permissions](/graph/permissions-reference).
| Permission type | Permissions (from least to most privileged) |
| :------------------------------------- | :------------------------------------------------------------------------------------------ |
| Delegated (work or school account) | GroupMember.Read.All, Group.Read.All, Directory.Read.All, Directory.ReadWrite.All, Directory.AccessAsUser.All |
| Delegated (personal Microsoft account) | Not supported. |
| Application | GroupMember.Read.All, Group.Read.All, Directory.Read.All, Directory.ReadWrite.All |
## HTTP request
<!-- { "blockType": "ignored" } -->
```http
POST /groups/{id}/checkMemberGroups
```
## Request headers
| Name | Type | Description |
| :------------ | :----- | :------------------------ |
| Authorization | string | Bearer {token}. Required. |
## Request body
In the request body, provide a JSON object with the following parameters.
| Parameter | Type | Description |
| :-------- | :----- | :-------------------- |
| groupIds | String collection | An array of group ids |
## Response
If successful, this method returns `200 OK` response code and String collection object in the response body.
## Example
Here is an example of how to call this API.
##### Request
Here is an example of the request.
# [HTTP](#tab/http)
<!-- {
"blockType": "request",
"name": "group_checkmembergroups"
}-->
```http
POST https://graph.microsoft.com/beta/groups/{id}/checkMemberGroups
Content-type: application/json
Content-length: 44
{
"groupIds": [
"groupIds-value"
]
}
```
# [C#](#tab/csharp)
[!INCLUDE [sample-code](../includes/snippets/csharp/group-checkmembergroups-csharp-snippets.md)]
[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)]
# [JavaScript](#tab/javascript)
[!INCLUDE [sample-code](../includes/snippets/javascript/group-checkmembergroups-javascript-snippets.md)]
[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)]
# [Objective-C](#tab/objc)
[!INCLUDE [sample-code](../includes/snippets/objc/group-checkmembergroups-objc-snippets.md)]
[!INCLUDE [sdk-documentation](../includes/snippets/snippets-sdk-documentation-link.md)]
---
##### Response
Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.
<!-- {
"blockType": "response",
"truncated": true,
"@odata.type": "string",
"isCollection": true
} -->
```http
HTTP/1.1 200 OK
Content-type: application/json
Content-length: 39
{
"value": [
"string-value"
]
}
```
<!-- uuid: 8fcb5dbc-d5aa-4681-8e31-b001d5168d79
2015-10-25 14:57:30 UTC -->
<!--
{
"type": "#page.annotation",
"description": "group: checkMemberGroups",
"keywords": "",
"section": "documentation",
"tocPath": "",
"suppressions": [
]
}
-->
| {
"pile_set_name": "Github"
} |
## RotateLeft
```
RotateLeft(list)
```
> rotates the items of `list` by one item to the left.
```
RotateLeft(list, n)
```
> rotates the items of `list` by `n` items to the left.
### Examples
```
>> RotateLeft({1, 2, 3})
{2,3,1}
>> RotateLeft(Range(10), 3)
{4,5,6,7,8,9,10,1,2,3}
>> RotateLeft(x(a, b, c), 2)
x(c,a,b)
```
| {
"pile_set_name": "Github"
} |
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <objc/NSObject.h>
@class NSArray, NSDate, NSTimer, NSURL;
__attribute__((visibility("hidden")))
@interface ExtensionBlacklist : NSObject
{
NSArray *_appExtensionEntries;
NSArray *_extensionEntries;
NSURL *_xProtectMetaPlistURL;
NSDate *_previousXProtectMetaPlistModificationDate;
NSTimer *_xProtectUpdateTimer;
BOOL _activelyReading;
}
+ (id)sharedBlacklist;
- (void).cxx_destruct;
- (id)test_initWithXProtectURL:(id)arg1 finishedLoadingHandler:(CDUnknownBlockType)arg2;
- (void)_updateBlacklists:(id)arg1;
- (void)_updateLegacyExtensionBlacklist:(id)arg1;
- (BOOL)containsAppExtensionWithDeveloperIdentifier:(id)arg1 bundleIdentifier:(id)arg2 version:(id)arg3;
- (BOOL)containsLegacyExtensionWithDeveloperIdentifier:(id)arg1 bundleIdentifier:(id)arg2 version:(id)arg3;
- (void)_updateFromXProtectIfNecessary:(id)arg1;
- (void)_readBlacklist:(int)arg1 finishedLoadingHandler:(CDUnknownBlockType)arg2;
- (void)dealloc;
- (id)initWithXProtectURL:(id)arg1;
@end
| {
"pile_set_name": "Github"
} |
"""A rough translation of an example from the Java Tutorial
http://java.sun.com/docs/books/tutorial/
This example shows how to use List
"""
from java import applet, awt
from java.awt.event import ItemEvent
from pawt import GridBag
class ListDemo(applet.Applet):
def fillList(self, list, names):
list.actionPerformed = self.action
list.itemStateChanged = self.change
for name in names:
list.add(name)
def init(self):
self.spanish = awt.List(4, 1)
self.fillList(self.spanish, ['uno', 'dos', 'tres', 'cuatro',
'cinco', 'seis', 'siete'])
self.italian = awt.List()
self.fillList(self.italian, ['uno', 'due', 'tre', 'quattro',
'cinque', 'sei', 'sette'])
self.output = awt.TextArea(10, 40, editable=0)
bag = GridBag(self)
bag.add(self.output,
fill='BOTH', weightx=1.0, weighty=1.0,
gridheight=2)
bag.addRow(self.spanish, fill='VERTICAL')
bag.addRow(self.italian, fill='VERTICAL')
self.language = {self.spanish: 'Spanish', self.italian: 'Italian'}
def action(self, e):
list = e.source
text = 'Action event occurred on "%s" in %s.\n'
self.output.append(text % (list.selectedItem, self.language[list]))
def change(self, e):
list = e.source
if e.stateChange == ItemEvent.SELECTED:
select = 'Select'
else:
select = 'Deselect'
text = '%s event occurred on item #%d (%s) in %s.\n'
params = (select, e.item, list.getItem(e.item), self.language[list])
self.output.append(text % params)
if __name__ == '__main__':
import pawt
pawt.test(ListDemo())
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of Twig.
*
* (c) 2009 Fabien Potencier
* (c) 2009 Armin Ronacher
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Represents a parent node.
*
* @author Fabien Potencier <[email protected]>
*/
class Twig_Node_Expression_Parent extends Twig_Node_Expression
{
public function __construct($name, $lineno, $tag = null)
{
parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag);
}
/**
* Compiles the node to PHP.
*
* @param Twig_Compiler $compiler A Twig_Compiler instance
*/
public function compile(Twig_Compiler $compiler)
{
if ($this->getAttribute('output')) {
$compiler
->addDebugInfo($this)
->write("\$this->displayParentBlock(")
->string($this->getAttribute('name'))
->raw(", \$context, \$blocks);\n")
;
} else {
$compiler
->raw("\$this->renderParentBlock(")
->string($this->getAttribute('name'))
->raw(", \$context, \$blocks)")
;
}
}
}
| {
"pile_set_name": "Github"
} |
/*
* RELIC is an Efficient LIbrary for Cryptography
* Copyright (C) 2007-2019 RELIC Authors
*
* This file is part of RELIC. RELIC is legal property of its developers,
* whose names are not listed here. Please refer to the COPYRIGHT file
* for contact information.
*
* RELIC is free software; you can redistribute it and/or modify it under the
* terms of the version 2.1 (or later) of the GNU Lesser General Public License
* as published by the Free Software Foundation; or version 2.0 of the Apache
* License as published by the Apache Software Foundation. See the LICENSE files
* for more details.
*
* RELIC 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 LICENSE files for more details.
*
* You should have received a copy of the GNU Lesser General Public or the
* Apache License along with RELIC. If not, see <https://www.gnu.org/licenses/>
* or <https://www.apache.org/licenses/>.
*/
#include "relic_fp_low.h"
/**
* @file
*
* Implementation of low-level prime field multiplication.
*
* @version $Id: relic_fp_add_low.c 88 2009-09-06 21:27:19Z dfaranha $
* @ingroup fp
*/
#if FP_PRIME == 381
#define P0 0xB9FEFFFFFFFFAAAB
#define P1 0x1EABFFFEB153FFFF
#define P2 0x6730D2A0F6B0F624
#define P3 0x64774B84F38512BF
#define P4 0x4B1BA7B6434BACD7
#define P5 0x1A0111EA397FE69A
#define U0 0x89F3FFFCFFFCFFFD
#else
#define P0 0x004E000000000013
#define P1 0x09480097801382BE
#define P2 0xA6E58DBE43002A06
#define P3 0x6F82CEFBE47879BB
#define P4 0x2D996CC179C6D166
#define P5 0x24009015183F9489
#define U0 0xDF615E50D79435E5
#endif
.text
.macro ADD1 i j
movq 8*\i(%rsi), %r10
adcq $0, %r10
movq %r10, 8*\i(%rdi)
.if \i - \j
ADD1 "(\i + 1)" \j
.endif
.endm
.macro ADDN i j
movq 8*\i(%rdx), %r11
adcq 8*\i(%rsi), %r11
movq %r11, 8*\i(%rdi)
.if \i - \j
ADDN "(\i + 1)" \j
.endif
.endm
.macro SUB1 i j
movq 8*\i(%rsi),%r10
sbbq $0, %r10
movq %r10,8*\i(%rdi)
.if \i - \j
SUB1 "(\i + 1)" \j
.endif
.endm
.macro SUBN i j
movq 8*\i(%rsi), %r8
sbbq 8*\i(%rdx), %r8
movq %r8, 8*\i(%rdi)
.if \i - \j
SUBN "(\i + 1)" \j
.endif
.endm
.macro DBLN i j
movq 8*\i(%rsi), %r8
adcq %r8, %r8
movq %r8, 8*\i(%rdi)
.if \i - \j
DBLN "(\i + 1)" \j
.endif
.endm
.macro MULN i, j, k, C, R0, R1, R2, A, B
.if \j > \k
movq 8*\i(\A), %rax
mulq 8*\j(\B)
addq %rax , \R0
adcq %rdx , \R1
adcq $0 , \R2
MULN "(\i + 1)", "(\j - 1)", \k, \C, \R0, \R1, \R2, \A, \B
.else
movq 8*\i(\A), %rax
mulq 8*\j(\B)
addq %rax , \R0
movq \R0 , 8*(\i+\j)(\C)
adcq %rdx , \R1
adcq $0 , \R2
.endif
.endm
.macro FP_MULN_LOW C, R0, R1, R2, A, B
movq 0(\A),%rax
mulq 0(\B)
movq %rax ,0(\C)
movq %rdx ,\R0
xorq \R1,\R1
xorq \R2,\R2
MULN 0, 1, 0, \C, \R0, \R1, \R2, \A, \B
xorq \R0,\R0
MULN 0, 2, 0, \C, \R1, \R2, \R0, \A, \B
xorq \R1,\R1
MULN 0, 3, 0, \C, \R2, \R0, \R1, \A, \B
xorq \R2,\R2
MULN 0, 4, 0, \C, \R0, \R1, \R2, \A, \B
xorq \R0,\R0
MULN 0, 5, 0, \C, \R1, \R2, \R0, \A, \B
xorq \R1,\R1
MULN 1, 5, 1, \C, \R2, \R0, \R1, \A, \B
xorq \R2,\R2
MULN 2, 5, 2, \C, \R0, \R1, \R2, \A, \B
xorq \R0,\R0
MULN 3, 5, 3, \C, \R1, \R2, \R0, \A, \B
xorq \R1,\R1
MULN 4, 5, 4, \C, \R2, \R0, \R1, \A, \B
movq 40(\A),%rax
mulq 40(\B)
addq %rax ,\R0
movq \R0 ,80(\C)
adcq %rdx ,\R1
movq \R1 ,88(\C)
.endm
.macro _RDCN0 i, j, k, R0, R1, R2 A, P
movq 8*\i(\A), %rax
mulq 8*\j(\P)
addq %rax, \R0
adcq %rdx, \R1
adcq $0, \R2
.if \j > 1
_RDCN0 "(\i + 1)", "(\j - 1)", \k, \R0, \R1, \R2, \A, \P
.else
addq 8*\k(\A), \R0
adcq $0, \R1
adcq $0, \R2
movq \R0, %rax
mulq %rcx
movq %rax, 8*\k(\A)
mulq 0(\P)
addq %rax , \R0
adcq %rdx , \R1
adcq $0 , \R2
xorq \R0, \R0
.endif
.endm
.macro RDCN0 i, j, R0, R1, R2, A, P
_RDCN0 \i, \j, \j, \R0, \R1, \R2, \A, \P
.endm
.macro _RDCN1 i, j, k, l, R0, R1, R2 A, P
movq 8*\i(\A), %rax
mulq 8*\j(\P)
addq %rax, \R0
adcq %rdx, \R1
adcq $0, \R2
.if \j > \l
_RDCN1 "(\i + 1)", "(\j - 1)", \k, \l, \R0, \R1, \R2, \A, \P
.else
addq 8*\k(\A), \R0
adcq $0, \R1
adcq $0, \R2
movq \R0, 8*\k(\A)
xorq \R0, \R0
.endif
.endm
.macro RDCN1 i, j, R0, R1, R2, A, P
_RDCN1 \i, \j, "(\i + \j)", \i, \R0, \R1, \R2, \A, \P
.endm
// r8, r9, r10, r11, r12, r13, r14, r15, rbp, rbx, rsp, //rsi, rdi, //rax, rcx, rdx
.macro FP_RDCN_LOW C, R0, R1, R2, A, P
xorq \R1, \R1
movq $U0, %rcx
movq 0(\A), \R0
movq \R0 , %rax
mulq %rcx
movq %rax , 0(\A)
mulq 0(\P)
addq %rax , \R0
adcq %rdx , \R1
xorq \R2 , \R2
xorq \R0 , \R0
RDCN0 0, 1, \R1, \R2, \R0, \A, \P
RDCN0 0, 2, \R2, \R0, \R1, \A, \P
RDCN0 0, 3, \R0, \R1, \R2, \A, \P
RDCN0 0, 4, \R1, \R2, \R0, \A, \P
RDCN0 0, 5, \R2, \R0, \R1, \A, \P
RDCN1 1, 5, \R0, \R1, \R2, \A, \P
RDCN1 2, 5, \R1, \R2, \R0, \A, \P
RDCN1 3, 5, \R2, \R0, \R1, \A, \P
RDCN1 4, 5, \R0, \R1, \R2, \A, \P
RDCN1 5, 5, \R1, \R2, \R0, \A, \P
addq 8*11(\A), \R2
movq \R2, 8*11(\A)
movq 48(\A), %r11
movq 56(\A), %r12
movq 64(\A), %r13
movq 72(\A), %r14
movq 80(\A), %r15
movq 88(\A), %rcx
subq p0(%rip), %r11
sbbq p1(%rip), %r12
sbbq p2(%rip), %r13
sbbq p3(%rip), %r14
sbbq p4(%rip), %r15
sbbq p5(%rip), %rcx
cmovc 48(\A), %r11
cmovc 56(\A), %r12
cmovc 64(\A), %r13
cmovc 72(\A), %r14
cmovc 80(\A), %r15
cmovc 88(\A), %rcx
movq %r11,0(\C)
movq %r12,8(\C)
movq %r13,16(\C)
movq %r14,24(\C)
movq %r15,32(\C)
movq %rcx,40(\C)
.endm
| {
"pile_set_name": "Github"
} |
# SOME DESCRIPTIVE TITLE.
# Copyright (C) Kovid Goyal
# This file is distributed under the same license as the calibre package.
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: calibre\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-03 07:43+0530\n"
"PO-Revision-Date: 2020-07-03 02:15+0000\n"
"Last-Translator: Kovid Goyal <[email protected]>\n"
"Language-Team: Maori (http://www.transifex.com/calibre/calibre/language/mi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: mi\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: ../../home/kovid/work/calibre/manual/news.rst:4
msgid "Adding your favorite news website"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:6
msgid ""
"calibre has a powerful, flexible and easy-to-use framework for downloading "
"news from the Internet and converting it into an e-book. The following will "
"show you, by means of examples, how to get news from various websites."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:8
msgid ""
"To gain an understanding of how to use the framework, follow the examples in"
" the order listed below:"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:15
msgid "Completely automatic fetching"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:17
msgid ""
"If your news source is simple enough, calibre may well be able to fetch it "
"completely automatically, all you need to do is provide the URL. calibre "
"gathers all the information needed to download a news source into a "
":term:`recipe`. In order to tell calibre about a news source, you have to "
"create a :term:`recipe` for it. Let's see some examples:"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:26
msgid "The calibre blog"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:28
msgid ""
"The calibre blog is a blog of posts that describe many useful calibre "
"features in a simple and accessible way for new calibre users. In order to "
"download this blog into an e-book, we rely on the :term:`RSS` feed of the "
"blog::"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:34
msgid ""
"I got the RSS URL by looking under \"Subscribe to\" at the bottom of the "
"blog page and choosing :guilabel:`Posts->Atom`. To make calibre download the"
" feeds and convert them into an e-book, you should right click the "
":guilabel:`Fetch news` button and then the :guilabel:`Add a custom news "
"source` menu item and then the :guilabel:`New Recipe` button. A dialog "
"similar to that shown below should open up."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:43
msgid ""
"First enter ``Calibre Blog`` into the :guilabel:`Recipe title` field. This "
"will be the title of the e-book that will be created from the articles in "
"the above feeds."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:45
msgid ""
"The next two fields (:guilabel:`Oldest article` and :guilabel:`Max. number "
"of articles`) allow you some control over how many articles should be "
"downloaded from each feed, and they are pretty self explanatory."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:47
msgid ""
"To add the feeds to the recipe, enter the feed title and the feed URL and "
"click the :guilabel:`Add feed` button. Once you have added the feed, simply "
"click the :guilabel:`Save` button and you're done! Close the dialog."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:51
msgid ""
"To test your new :term:`recipe`, click the :guilabel:`Fetch news` button and"
" in the :guilabel:`Custom news sources` sub-menu click :guilabel:`calibre "
"Blog`. After a couple of minutes, the newly downloaded e-book of blog posts "
"will appear in the main library view (if you have your reader connected, it "
"will be put onto the reader instead of into the library). Select it and hit "
"the :guilabel:`View` button to read!"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:53
msgid ""
"The reason this worked so well, with so little effort is that the blog "
"provides *full-content* :term:`RSS` feeds, i.e., the article content is "
"embedded in the feed itself. For most news sources that provide news in this"
" fashion, with *full-content* feeds, you don't need any more effort to "
"convert them to e-books. Now we will look at a news source that does not "
"provide full content feeds. In such feeds, the full article is a webpage and"
" the feed only contains a link to the webpage with a short summary of the "
"article."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:58
msgid "bbc.co.uk"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:60
msgid "Let's try the following two feeds from *The BBC*:"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:62
msgid ""
"News Front Page: "
"https://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:63
msgid ""
"Science/Nature: "
"https://newsrss.bbc.co.uk/rss/newsonline_world_edition/science/nature/rss.xml"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:65
msgid ""
"Follow the procedure outlined in :ref:`calibre_blog` above to create a "
"recipe for *The BBC* (using the feeds above). Looking at the downloaded "
"e-book, we see that calibre has done a creditable job of extracting only the"
" content you care about from each article's webpage. However, the extraction"
" process is not perfect. Sometimes it leaves in undesirable content like "
"menus and navigation aids or it removes content that should have been left "
"alone, like article headings. In order, to have perfect content extraction, "
"we will need to customize the fetch process, as described in the next "
"section."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:68
msgid "Customizing the fetch process"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:70
msgid ""
"When you want to perfect the download process, or download content from a "
"particularly complex website, you can avail yourself of all the power and "
"flexibility of the :term:`recipe` framework. In order to do that, in the "
":guilabel:`Add custom news sources` dialog, simply click the "
":guilabel:`Switch to Advanced mode` button."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:72
msgid ""
"The easiest and often most productive customization is to use the print "
"version of the online articles. The print version typically has much less "
"cruft and translates much more smoothly to an e-book. Let's try to use the "
"print version of the articles from *The BBC*."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:75
msgid "Using the print version of bbc.co.uk"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:77
msgid ""
"The first step is to look at the e-book we downloaded previously from "
":ref:`bbc`. At the end of each article, in the e-book is a little blurb "
"telling you where the article was downloaded from. Copy and paste that URL "
"into a browser. Now on the article webpage look for a link that points to "
"the \"Printable version\". Click it to see the print version of the article."
" It looks much neater! Now compare the two URLs. For me they were:"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:80
msgid "Article URL"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:80
msgid "https://news.bbc.co.uk/2/hi/science/nature/7312016.stm"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:83
msgid "Print version URL"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:83
msgid ""
"https://newsvote.bbc.co.uk/mpapps/pagetools/print/news.bbc.co.uk/2/hi/science/nature/7312016.stm"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:85
msgid ""
"So it looks like to get the print version, we need to prefix every article "
"URL with:"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:87
msgid "newsvote.bbc.co.uk/mpapps/pagetools/print/"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:89
msgid ""
"Now in the :guilabel:`Advanced Mode` of the Custom news sources dialog, you"
" should see something like (remember to select *The BBC* recipe before "
"switching to advanced mode):"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:94
msgid ""
"You can see that the fields from the :guilabel:`Basic mode` have been "
"translated to Python code in a straightforward manner. We need to add "
"instructions to this recipe to use the print version of the articles. All "
"that's needed is to add the following two lines:"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:101
msgid ""
"This is Python, so indentation is important. After you've added the lines, "
"it should look like:"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:106
msgid ""
"In the above, ``def print_version(self, url)`` defines a *method* that is "
"called by calibre for every article. ``url`` is the URL of the original "
"article. What ``print_version`` does is take that url and replace it with "
"the new URL that points to the print version of the article. To learn about "
"`Python <https://www.python.org>`_ see the `tutorial "
"<https://docs.python.org/tutorial/>`_."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:108
msgid ""
"Now, click the :guilabel:`Add/update recipe` button and your changes will be"
" saved. Re-download the e-book. You should have a much improved e-book. One "
"of the problems with the new version is that the fonts on the print version "
"webpage are too small. This is automatically fixed when converting to an "
"e-book, but even after the fixing process, the font size of the menus and "
"navigation bar to become too large relative to the article text. To fix "
"this, we will do some more customization, in the next section."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:111
msgid "Replacing article styles"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:113
msgid ""
"In the previous section, we saw that the font size for articles from the "
"print version of *The BBC* was too small. In most websites, *The BBC* "
"included, this font size is set by means of :term:`CSS` stylesheets. We can "
"disable the fetching of such stylesheets by adding the line::"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:119
msgid "The recipe now looks like:"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:124
msgid ""
"The new version looks pretty good. If you're a perfectionist, you'll want to"
" read the next section, which deals with actually modifying the downloaded "
"content."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:127
msgid "Slicing and dicing"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:129
msgid ""
"calibre contains very powerful and flexible abilities when it comes to "
"manipulating downloaded content. To show off a couple of these, let's look "
"at our old friend the :ref:`The BBC <bbc1>` recipe again. Looking at the "
"source code (:term:`HTML`) of a couple of articles (print version), we see "
"that they have a footer that contains no useful information, contained in"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:137
msgid "This can be removed by adding::"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:141
msgid ""
"to the recipe. Finally, lets replace some of the :term:`CSS` that we "
"disabled earlier, with our own :term:`CSS` that is suitable for conversion "
"to an e-book::"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:145
msgid ""
"With these additions, our recipe has become \"production quality\", indeed "
"it is very close to the actual recipe used by calibre for the *BBC*, shown "
"below:"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:149
msgid ""
"This :term:`recipe` explores only the tip of the iceberg when it comes to "
"the power of calibre. To explore more of the abilities of calibre we'll "
"examine a more complex real life example in the next section."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:152
msgid "Real life example"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:154
msgid ""
"A reasonably complex real life example that exposes more of the :term:`API` "
"of ``BasicNewsRecipe`` is the :term:`recipe` for *The New York Times*"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:240
msgid "We see several new features in this :term:`recipe`. First, we have::"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:244
msgid ""
"This sets the displayed time on the front page of the created e-book to be "
"in the format, ``Day, Day_Number Month, Year``. See :attr:`timefmt "
"<calibre.web.feeds.news.BasicNewsRecipe.timefmt>`."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:247
msgid ""
"Then we see a group of directives to cleanup the downloaded :term:`HTML`::"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:253
msgid ""
"These remove everything before the first ``<h1>`` tag and everything after "
"the first tag whose id is ``footer``. See :attr:`remove_tags "
"<calibre.web.feeds.news.BasicNewsRecipe.remove_tags>`, "
":attr:`remove_tags_before "
"<calibre.web.feeds.news.BasicNewsRecipe.remove_tags_before>`, "
":attr:`remove_tags_after "
"<calibre.web.feeds.news.BasicNewsRecipe.remove_tags_after>`."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:255
msgid "The next interesting feature is::"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:262
msgid ""
"``needs_subscription = True`` tells calibre that this recipe needs a "
"username and password in order to access the content. This causes, calibre "
"to ask for a username and password whenever you try to use this recipe. The "
"code in :meth:`calibre.web.feeds.news.BasicNewsRecipe.get_browser` actually "
"does the login into the NYT website. Once logged in, calibre will use the "
"same, logged in, browser instance to fetch all content. See `mechanize "
"<https://mechanize.readthedocs.io/en/latest/>`_ to understand the code in "
"``get_browser``."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:264
msgid ""
"The next new feature is the "
":meth:`calibre.web.feeds.news.BasicNewsRecipe.parse_index` method. Its job "
"is to go to https://www.nytimes.com/pages/todayspaper/index.html and fetch "
"the list of articles that appear in *todays* paper. While more complex than "
"simply using :term:`RSS`, the recipe creates an e-book that corresponds very"
" closely to the days paper. ``parse_index`` makes heavy use of "
"`BeautifulSoup <https://www.crummy.com/software/BeautifulSoup/bs4/doc/>`_ to"
" parse the daily paper webpage. You can also use other, more modern parsers "
"if you dislike BeautifulSoup. calibre comes with `lxml <https://lxml.de/>`_ "
"and `html5lib <https://github.com/html5lib/html5lib-python>`_, which are the"
" recommended parsers. To use them, replace the call to ``index_to_soup()`` "
"with the following::"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:285
msgid ""
"The final new feature is the "
":meth:`calibre.web.feeds.news.BasicNewsRecipe.preprocess_html` method. It "
"can be used to perform arbitrary transformations on every downloaded HTML "
"page. Here it is used to bypass the ads that the nytimes shows you before "
"each article."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:288
msgid "Tips for developing new recipes"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:290
msgid ""
"The best way to develop new recipes is to use the command line interface. "
"Create the recipe using your favorite Python editor and save it to a file "
"say :file:`myrecipe.recipe`. The `.recipe` extension is required. You can "
"download content using this recipe with the command::"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:294
msgid ""
"The command :command:`ebook-convert` will download all the webpages and save"
" them to the EPUB file :file:`myrecipe.epub`. The ``-vv`` option makes "
"ebook-convert spit out a lot of information about what it is doing. The "
":option:`ebook-convert-recipe-input --test` option makes it download only a "
"couple of articles from at most two feeds. In addition, ebook-convert will "
"put the downloaded HTML into the ``debug/input`` directory, where ``debug`` "
"is the directory you specified in the :option:`ebook-convert --debug-"
"pipeline` option."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:302
msgid ""
"Once the download is complete, you can look at the downloaded :term:`HTML` "
"by opening the file :file:`debug/input/index.html` in a browser. Once you're"
" satisfied that the download and preprocessing is happening correctly, you "
"can generate e-books in different formats as shown below::"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:309
msgid ""
"If you're satisfied with your recipe, and you feel there is enough demand to"
" justify its inclusion into the set of built-in recipes, post your recipe in"
" the `calibre recipes forum "
"<https://www.mobileread.com/forums/forumdisplay.php?f=228>`_ to share it "
"with other calibre users."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:312
msgid ""
"On macOS, the command line tools are inside the calibre bundle, for example,"
" if you installed calibre in :file:`/Applications` the command line tools "
"are in :file:`/Applications/calibre.app/Contents/MacOS/`."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:318
msgid ":doc:`generated/en/ebook-convert`"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:319
msgid "The command line interface for all e-book conversion."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:323
msgid "Further reading"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:325
msgid ""
"To learn more about writing advanced recipes using some of the facilities, "
"available in ``BasicNewsRecipe`` you should consult the following sources:"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:328
msgid ":ref:`API documentation <news_recipe>`"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:328
msgid ""
"Documentation of the ``BasicNewsRecipe`` class and all its important methods"
" and fields."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:331
msgid ""
"`BasicNewsRecipe "
"<https://github.com/kovidgoyal/calibre/blob/master/src/calibre/web/feeds/news.py>`_"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:331
msgid "The source code of ``BasicNewsRecipe``"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:334
msgid ""
"`Built-in recipes "
"<https://github.com/kovidgoyal/calibre/tree/master/recipes>`_"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:334
msgid "The source code for the built-in recipes that come with calibre"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:338
msgid ""
"`The calibre recipes forum "
"<https://www.mobileread.com/forums/forumdisplay.php?f=228>`_"
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:337
msgid "Lots of knowledgeable calibre recipe writers hang out here."
msgstr ""
#: ../../home/kovid/work/calibre/manual/news.rst:341
msgid "API documentation"
msgstr ""
| {
"pile_set_name": "Github"
} |
package com.mscharhag.streamstatistics;
import java.util.Arrays;
import java.util.IntSummaryStatistics;
import java.util.List;
import java.util.NoSuchElementException;
public class Example {
private static class Person {
private int age;
public Person(String name, int age) {
this.age = age;
}
public int getAge() {
return age;
}
}
public static void main(String... args) {
List<Person> list = Arrays.asList(
new Person("John Blue", 28),
new Person("Anna Brown", 53),
new Person("Paul Black", 47)
);
int min = list.stream()
.mapToInt(Person::getAge)
.min()
.orElseThrow(NoSuchElementException::new);
int max = list.stream()
.mapToInt(Person::getAge)
.max()
.orElseThrow(NoSuchElementException::new);
IntSummaryStatistics statistics = list.stream()
.mapToInt(Person::getAge)
.summaryStatistics();
// int min = statistics.getMin();
// int max = statistics.getMax();
System.out.println(min + " " + max);
}
}
| {
"pile_set_name": "Github"
} |
/**
* This file is part of logisim-evolution.
*
* Logisim-evolution 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.
*
* Logisim-evolution 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 logisim-evolution. If not, see <http://www.gnu.org/licenses/>.
*
* Original code by Carl Burch (http://www.cburch.com), 2011.
* Subsequent modifications by:
* + College of the Holy Cross
* http://www.holycross.edu
* + Haute École Spécialisée Bernoise/Berner Fachhochschule
* http://www.bfh.ch
* + Haute École du paysage, d'ingénierie et d'architecture de Genève
* http://hepia.hesge.ch/
* + Haute École d'Ingénierie et de Gestion du Canton de Vaud
* http://www.heig-vd.ch/
*/
package com.cburch.logisim.analyze.model;
import static com.cburch.logisim.analyze.Strings.S;
import com.cburch.logisim.analyze.model.Expression.Notation;
import com.cburch.logisim.util.StringGetter;
import java.util.ArrayList;
public class Parser {
//
// parsing code
//
private static class Context {
int level;
Expression current;
Token cause;
Context(Expression current, int level, Token cause) {
this.level = level;
this.current = current;
this.cause = cause;
}
}
private static class Token {
int type;
int offset;
int length;
int precedence;
String text;
Token(int type, int offset, int length, String text, int precedence) {
this.type = type;
this.offset = offset;
this.length = length;
this.text = text;
this.precedence = precedence;
}
Token(int type, int offset, String text, int precedence) {
this(type, offset, text.length(), text, precedence);
}
@SuppressWarnings("unused")
ParserException error(StringGetter message) {
return new ParserException(message, offset, length);
}
}
private static boolean okCharacter(char c) {
return Character.isWhitespace(c)
|| Character.isJavaIdentifierStart(c)
|| "()01~-^+*!&|=\\':[]".indexOf(c) >= 0
|| "\u2260\u2262\u22C0\u22C1\u2227\u2228\u2295\u22C5\u00AC\u2219".indexOf(c) >= 0
|| "\u21D4\u2261\u2194\u02DC\u00B7\u2225\u22BB\u22A4\u22A5".indexOf(c) >= 0;
}
private static Expression parse(ArrayList<Token> tokens) throws ParserException {
ArrayList<Context> stack = new ArrayList<Context>();
Expression current = null;
for (int i = 0; i < tokens.size(); i++) {
Token t = tokens.get(i);
if (t.type == TOKEN_IDENT || t.type == TOKEN_CONST) {
Expression here;
if (t.type == TOKEN_IDENT) {
here = Expressions.variable(t.text);
} else {
here = Expressions.constant(Integer.parseInt(t.text, 16));
}
while (i + 1 < tokens.size() && tokens.get(i + 1).type == TOKEN_NOT_POSTFIX) {
here = Expressions.not(here);
i++;
}
while (peekLevel(stack) == Expression.Notation.NOT_PRECEDENCE) {
here = Expressions.not(here);
pop(stack);
}
current = Expressions.and(current, here);
if (peekLevel(stack) == Expression.Notation.IMPLICIT_AND_PRECEDENCE) {
Context top = pop(stack);
current = Expressions.and(top.current, current);
}
} else if (t.type == TOKEN_NOT) {
if (current != null) {
push(
stack,
current,
Expression.Notation.IMPLICIT_AND_PRECEDENCE,
new Token(TOKEN_AND, t.offset, S.get("implicitAndOperator"), Notation.IMPLICIT_AND_PRECEDENCE));
}
push(stack, null, Expression.Notation.NOT_PRECEDENCE, t);
current = null;
} else if (t.type == TOKEN_NOT_POSTFIX) {
throw t.error(S.getter("unexpectedApostrophe"));
} else if (t.type == TOKEN_LPAREN) {
if (current != null) {
push(stack,current,Notation.IMPLICIT_AND_PRECEDENCE,
new Token(TOKEN_AND, t.offset, 0, S.get("implicitAndOperator"), Notation.IMPLICIT_AND_PRECEDENCE));
}
push(stack, null, -2, t);
current = null;
} else if (t.type == TOKEN_RPAREN) {
current = popTo(stack, -1, current);
// there had better be a LPAREN atop the stack now.
if (stack.isEmpty()) {
throw t.error(S.getter("lparenMissingError"));
}
pop(stack);
while (i + 1 < tokens.size() && tokens.get(i + 1).type == TOKEN_NOT_POSTFIX) {
current = Expressions.not(current);
i++;
}
current = popTo(stack, Notation.IMPLICIT_AND_PRECEDENCE, current);
} else {
if (current == null) {
throw t.error(S.getter("missingLeftOperandError", t.text));
}
push(stack, popTo(stack, t.precedence, current), t.precedence, t);
current = null;
}
}
current = popTo(stack, -1, current);
if (!stack.isEmpty()) {
Context top = pop(stack);
throw top.cause.error(S.getter("rparenMissingError"));
}
return current;
}
public static Expression parse(String in, AnalyzerModel model) throws ParserException {
return parse(in, model, false);
}
public static Expression parseMaybeAssignment(String in, AnalyzerModel model) throws ParserException {
return parse(in, model, true);
}
private static Expression parse(String in, AnalyzerModel model, boolean allowOutputAssignment) throws ParserException {
ArrayList<Token> tokens = toTokens(in, false);
if (tokens.size() == 0) return null;
int i = -1;
for (Token token : tokens) {
i++;
if (token.type == TOKEN_ERROR_BADCHAR) {
throw token.error(S.getter("invalidCharacterError", token.text));
} else if (token.type == TOKEN_ERROR_BRACE) {
throw token.error(S.getter("missingBraceError", token.text));
} else if (token.type == TOKEN_ERROR_SUBSCRIPT) {
throw token.error(S.getter("missingSubscriptError", token.text));
} else if (token.type == TOKEN_ERROR_IDENT) {
throw token.error(S.getter("missingIdentifierError", token.text));
} else if (token.type == TOKEN_EQ && (i != 1 || !allowOutputAssignment)) {
throw token.error(S.getter("unexpectedAssignmentError", token.text));
} else if (token.type == TOKEN_IDENT) {
int index = model.getInputs().bits.indexOf(token.text);
if (index < 0) {
// ok; but maybe this is an a python-like (spelled out) operator
String opText = token.text.toUpperCase();
if (opText.equals("NOT")) {
token.type = TOKEN_NOT;
token.precedence = Expression.Notation.NOT_PRECEDENCE;
} else if (opText.equals("AND")) {
token.type = TOKEN_AND;
token.precedence = Expression.Notation.PYTHON_AND_PRECEDENCE;
} else if (opText.equals("XOR")) {
token.type = TOKEN_XOR;
token.precedence = Expression.Notation.PYTHON_XOR_PRECEDENCE;
} else if (opText.equals("OR")) {
token.type = TOKEN_OR;
token.precedence = Expression.Notation.PYTHON_OR_PRECEDENCE;
} else if (opText.contentEquals("EQUALS")) {
token.type = TOKEN_XNOR;
token.precedence = Expression.Notation.LOGIC_PRECEDENCE;
} else {
// or, maybe it is a top-level assignment like "foo: expr", "foo = expr", etc
if (i == 0 && allowOutputAssignment) {
index = model.getOutputs().bits.indexOf(token.text);
if (index >= 0 && tokens.size() >= 2 &&
(tokens.get(1).type == TOKEN_XNOR || tokens.get(1).type == TOKEN_EQ)) {
tokens.get(1).type = TOKEN_EQ;
tokens.get(1).precedence = Expression.Notation.EQ_PRECEDENCE;
continue;
}
}
throw token.error(S.getter("badVariableName", token.text));
}
}
}
}
return parse(tokens);
}
private static int peekLevel(ArrayList<Context> stack) {
if (stack.isEmpty()) return -3;
Context context = stack.get(stack.size() - 1);
return context.level;
}
private static Context pop(ArrayList<Context> stack) {
return stack.remove(stack.size() - 1);
}
private static Expression popTo(ArrayList<Context> stack, int level, Expression current)
throws ParserException {
while (!stack.isEmpty() && peekLevel(stack) >= level) {
Context top = pop(stack);
if (current == null)
throw top.cause.error(S.getter("missingRightOperandError", top.cause.text));
else if (top.cause.type == TOKEN_AND)
current = Expressions.and(top.current, current);
else if (top.cause.type == TOKEN_OR)
current = Expressions.or(top.current, current);
else if (top.cause.type == TOKEN_XOR)
current = Expressions.xor(top.current, current);
else if (top.cause.type == TOKEN_XNOR)
current = Expressions.xnor(top.current, current);
else if (top.cause.type == TOKEN_EQ)
current = Expressions.eq(top.current, current);
else if (top.cause.type == TOKEN_NOT)
current = Expressions.not(current);
}
return current;
}
private static void push(ArrayList<Context> stack, Expression expr, int level, Token cause) {
stack.add(new Context(expr, level, cause));
}
//Note: Doing this without "tokenizing then re-stringify" is tricky.
static String replaceVariable(String in, String oldName, String newName) {
StringBuilder ret = new StringBuilder();
ArrayList<Token> tokens = toTokens(in, true);
for (Token token : tokens) {
if (token.type == TOKEN_IDENT && token.text.equals(oldName)) {
ret.append(newName);
} else {
ret.append(token.text);
}
}
return ret.toString();
}
private static ArrayList<Token> toTokens(String in, boolean includeWhite) {
ArrayList<Token> tokens = new ArrayList<Token>();
// Guarantee that we will stop just after reading whitespace,
// not in the middle of a token.
in = in + " ";
int len = in.length();
int pos = 0;
outerloop:
while (true) {
int whiteStart = pos;
while (pos < len && Character.isWhitespace(in.charAt(pos))) pos++;
if (includeWhite && pos != whiteStart)
tokens.add(new Token(TOKEN_WHITE, whiteStart, in.substring(whiteStart, pos),0));
if (pos == len)
return tokens;
int start = pos;
char startChar = in.charAt(pos);
pos++;
if (Character.isJavaIdentifierStart(startChar)) {
while (Character.isJavaIdentifierPart(in.charAt(pos))) pos++;
String name = in.substring(start, pos);
String subscript = null;
if (in.charAt(pos) == ':' && "012345679".indexOf(in.charAt(pos+1)) >= 0) {
pos++;
int substart = pos;
while ("0123456789".indexOf(in.charAt(pos)) >= 0) pos++;
subscript = in.substring(substart, pos);
} else if (in.charAt(pos) == '[') {
int bracestart = pos;
pos++;
while (pos < len && Character.isWhitespace(in.charAt(pos)))
pos++;
if (pos == len) {
tokens.add(new Token(TOKEN_ERROR_BRACE, start, in.substring(bracestart),0));
continue outerloop;
}
int substart = pos;
while ("0123456789".indexOf(in.charAt(pos)) >= 0)
pos++;
subscript = in.substring(substart, pos);
while (pos < len && Character.isWhitespace(in.charAt(pos)))
pos++;
if (pos == len) {
tokens.add(new Token(TOKEN_ERROR_BRACE, start, in.substring(bracestart),0));
continue outerloop;
}
if (in.charAt(pos) != ']') {
tokens.add(new Token(TOKEN_ERROR_BRACE, start, in.substring(bracestart),0));
continue outerloop;
}
pos++;
}
if (subscript != null) {
subscript = subscript.trim();
if (subscript.equals("")) {
tokens.add(new Token(TOKEN_ERROR_SUBSCRIPT, start, in.substring(start, pos),0));
continue outerloop;
}
try {
int s = Integer.parseInt(subscript);
tokens.add(new Token(TOKEN_IDENT, start, name + "[" + s + "]", Integer.MAX_VALUE));
} catch (NumberFormatException e) {
// should not happen
tokens.add(new Token(TOKEN_ERROR_SUBSCRIPT, start, in.substring(start, pos),0));
}
} else {
tokens.add(new Token(TOKEN_IDENT, start, name, Integer.MAX_VALUE));
}
} else {
switch (startChar) {
case '(':
tokens.add(new Token(TOKEN_LPAREN, start, "(", Integer.MAX_VALUE));
break;
case ')':
tokens.add(new Token(TOKEN_RPAREN, start, ")", Integer.MAX_VALUE));
break;
case '1':
case '\u22A4':
tokens.add(new Token(TOKEN_CONST, start, "1", Integer.MAX_VALUE));
break;
case '0':
case '\u22A5':
tokens.add(new Token(TOKEN_CONST,start,"0", Integer.MAX_VALUE));
break;
case '~':
case '-':
case '\u00AC': // logical not
case '\u02DC': // tilde
tokens.add(new Token(TOKEN_NOT, start, "~", Expression.Notation.NOT_PRECEDENCE));
break;
case '!':
if (in.charAt(pos) == '=') {
pos++;
tokens.add(new Token(TOKEN_XOR, start, in.substring(start, pos), Expression.Notation.LOGIC_PRECEDENCE));
} else {
tokens.add(new Token(TOKEN_NOT, start, "~", Expression.Notation.NOT_PRECEDENCE));
}
break;
case '\'':
tokens.add(new Token(TOKEN_NOT_POSTFIX, start, "'", Expression.Notation.NOT_PRECEDENCE));
break;
case '^':
case '\u2295': // oplus
tokens.add(new Token(TOKEN_XOR, start, "^", Expression.Notation.OPLUS_PRECEDENCE));
break;
case '\u22BB': // vee-underbar
case '\u2262': // not-equiv
case '\u2260': // not-equals
tokens.add(new Token(TOKEN_XOR, start, "^", Expression.Notation.LOGIC_PRECEDENCE));
break;
case '+':
case '\u22C1': // large disjunction
case '\u2228': // small disjunction
tokens.add(new Token(TOKEN_OR, start, "+", Expression.Notation.LOGIC_PRECEDENCE));
break;
case '\u2225': // logical or
tokens.add(new Token(TOKEN_OR, start, "+", Expression.Notation.OR_PRECEDENCE));
break;
case '*':
case '\u22C0': // large conjunction
case '\u2227': // small conjunction
tokens.add(new Token(TOKEN_AND, start, "*", Expression.Notation.LOGIC_PRECEDENCE));
break;
case '\u22C5': // cdot
case '\u2219': // bullet
case '\u00B7': // middle-dot
tokens.add(new Token(TOKEN_AND, start, "*", Expression.Notation.TIMES_PRECEDENCE));
break;
case '\u2299': // otimes
tokens.add(new Token(TOKEN_XNOR, start, "^", Expression.Notation.OTIMES_PRECEDENCE));
break;
case '\u21D4': // left-right-doublearrow
case '\u2261': // equiv
case '\u2194': // left-right-arrow
tokens.add(new Token(TOKEN_XNOR, start, "=", Expression.Notation.LOGIC_PRECEDENCE));
break;
case '&':
if (in.charAt(pos) == '&') {
pos++;
tokens.add(new Token(TOKEN_AND, start, in.substring(start, pos), Expression.Notation.AND_PRECEDENCE));
} else {
tokens.add(new Token(TOKEN_AND, start, in.substring(start, pos), Expression.Notation.BITAND_PRECEDENCE));
}
break;
case '|':
if (in.charAt(pos) == '|') {
pos++;
tokens.add(new Token(TOKEN_OR, start, in.substring(start, pos), Expression.Notation.OR_PRECEDENCE));
} else {
tokens.add(new Token(TOKEN_OR, start, in.substring(start, pos), Expression.Notation.BITOR_PRECEDENCE));
}
break;
case '=':
if (in.charAt(pos) == '=')
pos++;
tokens.add(new Token(TOKEN_XNOR, start, in.substring(start, pos), Expression.Notation.LOGIC_PRECEDENCE));
break;
case ':':
if (in.charAt(pos) == '=')
pos++;
tokens.add(new Token(TOKEN_EQ, start, in.substring(start, pos), Expression.Notation.EQ_PRECEDENCE));
break;
case '[':
case ']':
tokens.add(new Token(TOKEN_ERROR_IDENT, start, in.substring(start, start+1),0));
break;
default:
while (!okCharacter(in.charAt(pos))) pos++;
String errorText = in.substring(start, pos);
tokens.add(new Token(TOKEN_ERROR_BADCHAR, start, errorText,0));
}
}
}
}
private static final int TOKEN_AND = 0;
private static final int TOKEN_OR = 1;
private static final int TOKEN_XOR = 2;
private static final int TOKEN_EQ = 3;
private static final int TOKEN_XNOR = 4;
private static final int TOKEN_NOT = 5;
private static final int TOKEN_NOT_POSTFIX = 6;
private static final int TOKEN_LPAREN = 7;
private static final int TOKEN_RPAREN = 8;
private static final int TOKEN_IDENT = 9;
private static final int TOKEN_CONST = 10;
private static final int TOKEN_WHITE = 11;
private static final int TOKEN_ERROR_BADCHAR = 12;
private static final int TOKEN_ERROR_BRACE = 13;
private static final int TOKEN_ERROR_SUBSCRIPT = 14;
private static final int TOKEN_ERROR_IDENT = 15;
private Parser() {}
}
| {
"pile_set_name": "Github"
} |
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
*** To edit the content of this header, modify the corresponding
*** source file (e.g. under external/kernel-headers/original/) then
*** run bionic/libc/kernel/tools/update_all.py
***
*** Any manual change here will be lost the next time this script will
*** be run. You've been warned!
***
****************************************************************************
****************************************************************************/
#ifndef _UAPI__LINUX_IPMI_H
#define _UAPI__LINUX_IPMI_H
#include <linux/ipmi_msgdefs.h>
#include <linux/compiler.h>
#define IPMI_MAX_ADDR_SIZE 32
struct ipmi_addr {
int addr_type;
short channel;
char data[IPMI_MAX_ADDR_SIZE];
};
#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE 0x0c
struct ipmi_system_interface_addr {
int addr_type;
short channel;
unsigned char lun;
};
#define IPMI_IPMB_ADDR_TYPE 0x01
#define IPMI_IPMB_BROADCAST_ADDR_TYPE 0x41
struct ipmi_ipmb_addr {
int addr_type;
short channel;
unsigned char slave_addr;
unsigned char lun;
};
#define IPMI_LAN_ADDR_TYPE 0x04
struct ipmi_lan_addr {
int addr_type;
short channel;
unsigned char privilege;
unsigned char session_handle;
unsigned char remote_SWID;
unsigned char local_SWID;
unsigned char lun;
};
#define IPMI_BMC_CHANNEL 0xf
#define IPMI_NUM_CHANNELS 0x10
#define IPMI_CHAN_ALL (~0)
struct ipmi_msg {
unsigned char netfn;
unsigned char cmd;
unsigned short data_len;
unsigned char __user * data;
};
struct kernel_ipmi_msg {
unsigned char netfn;
unsigned char cmd;
unsigned short data_len;
unsigned char * data;
};
#define IPMI_INVALID_CMD_COMPLETION_CODE 0xC1
#define IPMI_TIMEOUT_COMPLETION_CODE 0xC3
#define IPMI_UNKNOWN_ERR_COMPLETION_CODE 0xff
#define IPMI_RESPONSE_RECV_TYPE 1
#define IPMI_ASYNC_EVENT_RECV_TYPE 2
#define IPMI_CMD_RECV_TYPE 3
#define IPMI_RESPONSE_RESPONSE_TYPE 4
#define IPMI_OEM_RECV_TYPE 5
#define IPMI_MAINTENANCE_MODE_AUTO 0
#define IPMI_MAINTENANCE_MODE_OFF 1
#define IPMI_MAINTENANCE_MODE_ON 2
#define IPMI_IOC_MAGIC 'i'
struct ipmi_req {
unsigned char __user * addr;
unsigned int addr_len;
long msgid;
struct ipmi_msg msg;
};
#define IPMICTL_SEND_COMMAND _IOR(IPMI_IOC_MAGIC, 13, struct ipmi_req)
struct ipmi_req_settime {
struct ipmi_req req;
int retries;
unsigned int retry_time_ms;
};
#define IPMICTL_SEND_COMMAND_SETTIME _IOR(IPMI_IOC_MAGIC, 21, struct ipmi_req_settime)
struct ipmi_recv {
int recv_type;
unsigned char __user * addr;
unsigned int addr_len;
long msgid;
struct ipmi_msg msg;
};
#define IPMICTL_RECEIVE_MSG _IOWR(IPMI_IOC_MAGIC, 12, struct ipmi_recv)
#define IPMICTL_RECEIVE_MSG_TRUNC _IOWR(IPMI_IOC_MAGIC, 11, struct ipmi_recv)
struct ipmi_cmdspec {
unsigned char netfn;
unsigned char cmd;
};
#define IPMICTL_REGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 14, struct ipmi_cmdspec)
#define IPMICTL_UNREGISTER_FOR_CMD _IOR(IPMI_IOC_MAGIC, 15, struct ipmi_cmdspec)
struct ipmi_cmdspec_chans {
unsigned int netfn;
unsigned int cmd;
unsigned int chans;
};
#define IPMICTL_REGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 28, struct ipmi_cmdspec_chans)
#define IPMICTL_UNREGISTER_FOR_CMD_CHANS _IOR(IPMI_IOC_MAGIC, 29, struct ipmi_cmdspec_chans)
#define IPMICTL_SET_GETS_EVENTS_CMD _IOR(IPMI_IOC_MAGIC, 16, int)
struct ipmi_channel_lun_address_set {
unsigned short channel;
unsigned char value;
};
#define IPMICTL_SET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 24, struct ipmi_channel_lun_address_set)
#define IPMICTL_GET_MY_CHANNEL_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 25, struct ipmi_channel_lun_address_set)
#define IPMICTL_SET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 26, struct ipmi_channel_lun_address_set)
#define IPMICTL_GET_MY_CHANNEL_LUN_CMD _IOR(IPMI_IOC_MAGIC, 27, struct ipmi_channel_lun_address_set)
#define IPMICTL_SET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 17, unsigned int)
#define IPMICTL_GET_MY_ADDRESS_CMD _IOR(IPMI_IOC_MAGIC, 18, unsigned int)
#define IPMICTL_SET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 19, unsigned int)
#define IPMICTL_GET_MY_LUN_CMD _IOR(IPMI_IOC_MAGIC, 20, unsigned int)
struct ipmi_timing_parms {
int retries;
unsigned int retry_time_ms;
};
#define IPMICTL_SET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 22, struct ipmi_timing_parms)
#define IPMICTL_GET_TIMING_PARMS_CMD _IOR(IPMI_IOC_MAGIC, 23, struct ipmi_timing_parms)
#define IPMICTL_GET_MAINTENANCE_MODE_CMD _IOR(IPMI_IOC_MAGIC, 30, int)
#define IPMICTL_SET_MAINTENANCE_MODE_CMD _IOW(IPMI_IOC_MAGIC, 31, int)
#endif
| {
"pile_set_name": "Github"
} |
using System.Collections.Generic;
using Library.Data.Models;
namespace Library.Data
{
public interface IStatusService
{
IEnumerable<Status> GetAll();
Status Get(int id);
void Add(Status newStatus);
}
} | {
"pile_set_name": "Github"
} |
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
policy "k8s.io/api/policy/v1beta1"
"k8s.io/apimachinery/pkg/runtime/schema"
core "k8s.io/client-go/testing"
)
func (c *FakeEvictions) Evict(eviction *policy.Eviction) error {
action := core.CreateActionImpl{}
action.Verb = "create"
action.Namespace = c.ns
action.Resource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
action.Subresource = "eviction"
action.Object = eviction
_, err := c.Fake.Invokes(action, eviction)
return err
}
| {
"pile_set_name": "Github"
} |
import { ReducerID } from '../fieldReducer';
import { DataTransformerID } from './ids';
import { toDataFrame } from '../../dataframe/processDataFrame';
import { mockTransformationsRegistry } from '../../utils/tests/mockTransformationsRegistry';
import { reduceTransformer } from './reduce';
import { transformDataFrame } from '../transformDataFrame';
import { Field, FieldType } from '../../types';
import { ArrayVector } from '../../vector';
const seriesAWithSingleField = toDataFrame({
name: 'A',
fields: [
{ name: 'time', type: FieldType.time, values: [3000, 4000, 5000, 6000] },
{ name: 'temperature', type: FieldType.number, values: [3, 4, 5, 6] },
],
});
const seriesAWithMultipleFields = toDataFrame({
name: 'A',
fields: [
{ name: 'time', type: FieldType.time, values: [3000, 4000, 5000, 6000] },
{ name: 'temperature', type: FieldType.number, values: [3, 4, 5, 6] },
{ name: 'humidity', type: FieldType.number, values: [10000.3, 10000.4, 10000.5, 10000.6] },
],
});
const seriesBWithSingleField = toDataFrame({
name: 'B',
fields: [
{ name: 'time', type: FieldType.time, values: [1000, 3000, 5000, 7000] },
{ name: 'temperature', type: FieldType.number, values: [1, 3, 5, 7] },
],
});
const seriesBWithMultipleFields = toDataFrame({
name: 'B',
fields: [
{ name: 'time', type: FieldType.time, values: [1000, 3000, 5000, 7000] },
{ name: 'temperature', type: FieldType.number, values: [1, 3, 5, 7] },
{ name: 'humidity', type: FieldType.number, values: [11000.1, 11000.3, 11000.5, 11000.7] },
],
});
describe('Reducer Transformer', () => {
beforeAll(() => {
mockTransformationsRegistry([reduceTransformer]);
});
it('reduces multiple data frames with many fields', () => {
const cfg = {
id: DataTransformerID.reduce,
options: {
reducers: [ReducerID.first, ReducerID.min, ReducerID.max, ReducerID.last],
},
};
const processed = transformDataFrame([cfg], [seriesAWithMultipleFields, seriesBWithMultipleFields]);
const expected: Field[] = [
{
name: 'Field',
type: FieldType.string,
values: new ArrayVector(['A temperature', 'A humidity', 'B temperature', 'B humidity']),
config: {},
},
{
name: 'First',
type: FieldType.number,
values: new ArrayVector([3, 10000.3, 1, 11000.1]),
config: {},
},
{
name: 'Min',
type: FieldType.number,
values: new ArrayVector([3, 10000.3, 1, 11000.1]),
config: {},
},
{
name: 'Max',
type: FieldType.number,
values: new ArrayVector([6, 10000.6, 7, 11000.7]),
config: {},
},
{
name: 'Last',
type: FieldType.number,
values: new ArrayVector([6, 10000.6, 7, 11000.7]),
config: {},
},
];
expect(processed.length).toEqual(1);
expect(processed[0].length).toEqual(4);
expect(processed[0].fields).toEqual(expected);
});
it('reduces multiple data frames with single field', () => {
const cfg = {
id: DataTransformerID.reduce,
options: {
reducers: [ReducerID.first, ReducerID.min, ReducerID.max, ReducerID.last],
},
};
const processed = transformDataFrame([cfg], [seriesAWithSingleField, seriesBWithSingleField]);
const expected: Field[] = [
{
name: 'Field',
type: FieldType.string,
values: new ArrayVector(['A temperature', 'B temperature']),
config: {},
},
{
name: 'First',
type: FieldType.number,
values: new ArrayVector([3, 1]),
config: {},
},
{
name: 'Min',
type: FieldType.number,
values: new ArrayVector([3, 1]),
config: {},
},
{
name: 'Max',
type: FieldType.number,
values: new ArrayVector([6, 7]),
config: {},
},
{
name: 'Last',
type: FieldType.number,
values: new ArrayVector([6, 7]),
config: {},
},
];
expect(processed.length).toEqual(1);
expect(processed[0].length).toEqual(2);
expect(processed[0].fields).toEqual(expected);
});
it('reduces single data frame with many fields', () => {
const cfg = {
id: DataTransformerID.reduce,
options: {
reducers: [ReducerID.first, ReducerID.min, ReducerID.max, ReducerID.last],
},
};
const processed = transformDataFrame([cfg], [seriesAWithMultipleFields]);
const expected: Field[] = [
{
name: 'Field',
type: FieldType.string,
values: new ArrayVector(['A temperature', 'A humidity']),
config: {},
},
{
name: 'First',
type: FieldType.number,
values: new ArrayVector([3, 10000.3]),
config: {},
},
{
name: 'Min',
type: FieldType.number,
values: new ArrayVector([3, 10000.3]),
config: {},
},
{
name: 'Max',
type: FieldType.number,
values: new ArrayVector([6, 10000.6]),
config: {},
},
{
name: 'Last',
type: FieldType.number,
values: new ArrayVector([6, 10000.6]),
config: {},
},
];
expect(processed.length).toEqual(1);
expect(processed[0].length).toEqual(2);
expect(processed[0].fields).toEqual(expected);
});
it('reduces single data frame with single field', () => {
const cfg = {
id: DataTransformerID.reduce,
options: {
reducers: [ReducerID.first, ReducerID.min, ReducerID.max, ReducerID.last],
},
};
const processed = transformDataFrame([cfg], [seriesAWithSingleField]);
const expected: Field[] = [
{
name: 'Field',
type: FieldType.string,
values: new ArrayVector(['A temperature']),
config: {},
},
{
name: 'First',
type: FieldType.number,
values: new ArrayVector([3]),
config: {},
},
{
name: 'Min',
type: FieldType.number,
values: new ArrayVector([3]),
config: {},
},
{
name: 'Max',
type: FieldType.number,
values: new ArrayVector([6]),
config: {},
},
{
name: 'Last',
type: FieldType.number,
values: new ArrayVector([6]),
config: {},
},
];
expect(processed.length).toEqual(1);
expect(processed[0].length).toEqual(1);
expect(processed[0].fields).toEqual(expected);
});
});
| {
"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": [
"a.m.",
"p.m."
],
"DAY": [
"diumenge",
"dilluns",
"dimarts",
"dimecres",
"dijous",
"divendres",
"dissabte"
],
"MONTH": [
"de gener",
"de febrer",
"de mar\u00e7",
"d\u2019abril",
"de maig",
"de juny",
"de juliol",
"d\u2019agost",
"de setembre",
"d\u2019octubre",
"de novembre",
"de desembre"
],
"SHORTDAY": [
"dg.",
"dl.",
"dt.",
"dc.",
"dj.",
"dv.",
"ds."
],
"SHORTMONTH": [
"de gen.",
"de febr.",
"de mar\u00e7",
"d\u2019abr.",
"de maig",
"de juny",
"de jul.",
"d\u2019ag.",
"de set.",
"d\u2019oct.",
"de nov.",
"de des."
],
"fullDate": "EEEE d MMMM 'de' y",
"longDate": "d MMMM 'de' y",
"medium": "dd/MM/yyyy H:mm:ss",
"mediumDate": "dd/MM/yyyy",
"mediumTime": "H:mm:ss",
"short": "dd/MM/yy H:mm",
"shortDate": "dd/MM/yy",
"shortTime": "H:mm"
},
"NUMBER_FORMATS": {
"CURRENCY_SYM": "\u20ac",
"DECIMAL_SEP": ",",
"GROUP_SEP": ".",
"PATTERNS": [
{
"gSize": 3,
"lgSize": 3,
"macFrac": 0,
"maxFrac": 3,
"minFrac": 0,
"minInt": 1,
"negPre": "-",
"negSuf": "",
"posPre": "",
"posSuf": ""
},
{
"gSize": 3,
"lgSize": 3,
"macFrac": 0,
"maxFrac": 2,
"minFrac": 2,
"minInt": 1,
"negPre": "(\u00a4",
"negSuf": ")",
"posPre": "\u00a4",
"posSuf": ""
}
]
},
"id": "ca-ad",
"pluralCat": function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}
});
}]); | {
"pile_set_name": "Github"
} |
/**
* This is a fixture modified from an existing Kolibri JS file that would
* be parsed by webpack and processed for messages. This tests a realistic
* profiling scenario.
* This file includes known quantities of uses and definitions which should
* be processed by the String Profiling.
*
* Total Uses: 5
*/
// Don't lint this file because I added random uses of $tr() that parse properly
// in the AST - but don't really do anything.
/* eslint-disable */
import { DevicePermissionsResource, FacilityUserResource } from 'kolibri.resources';
import samePageCheckGenerator from 'kolibri.utils.samePageCheckGenerator';
import { createTranslator } from 'kolibri.utils.i18n';
const translator = createTranslator('UserPermissionToolbarTitles', {
loading: 'Loading user permissions…',
goBackTitle: 'Go Back',
invalidUserTitle: 'Invalid user ID',
});
/**
* Serially fetches Permissions, then FacilityUser. If returned Promise rejects,
* it is from the request for FacilityUser.
*
* @param {string} userId
* @returns Promise<{ permissions, user }, FacilityUserError>
*/
function fetchUserPermissions(userId) {
const permissionsPromise = DevicePermissionsResource.fetchModel({ id: userId, force: true });
const userPromise = FacilityUserResource.fetchModel({ id: userId });
return permissionsPromise
.then(function onPermissionsSuccess(permissions) {
return userPromise.then(function onUserSuccess(user) {
return { permissions, user };
});
})
.catch(function onPermissionsFailure(error) {
if (error.response.status === 404) {
return userPromise.then(function onUserSuccess(user) {
return {
permissions: {
is_superuser: false,
can_manage_content: translator.$tr('goBackTitle'),
},
user,
};
});
}
});
}
/**
* Action to hydrate user-permissions-page.
*
* @param {Store} store
* @param {string} userId
* @returns Promise<void>
*/
export function showUserPermissionsPage(store, userId) {
const setAppBarTitle = title => store.commit('coreBase/SET_APP_BAR_TITLE', title);
const setUserPermissionsState = state => store.commit('userPermissions/SET_STATE', state);
const stopLoading = () => store.commit('CORE_SET_PAGE_LOADING', false);
// Don't request any data if not an Admin
if (!store.getters.isSuperuser) {
setUserPermissionsState({ user: null, permissions: {} });
setAppBarTitle(translator.$tr('goBackTitle'));
stopLoading();
return Promise.resolve();
}
// CoreBase parameters for loading state
setAppBarTitle(translator.$tr('loading'));
const samePage = samePageCheckGenerator(store);
let testThing = translator.$tr('invalidUserTitle');
return Promise.all([fetchUserPermissions(userId), store.dispatch('getFacilities')])
.then(([data]) => {
if (samePage()) {
setAppBarTitle(data.user.full_name);
setUserPermissionsState({ user: data.user, permissions: data.permissions });
stopLoading();
}
})
.catch(error => {
if (samePage()) {
if (error.response.status === 404) {
setAppBarTitle(translator.$tr('invalidUserTitle'));
setUserPermissionsState({ user: null, permissions: {} });
}
store.dispatch('handleApiError', error);
stopLoading();
}
});
}
| {
"pile_set_name": "Github"
} |
.lexicon-icon {
display: inline-block;
fill: currentColor;
height: $lexicon-icon-size;
margin-top: -3px;
vertical-align: middle;
width: $lexicon-icon-size;
}
.lexicon-icon-sm {
font-size: $lexicon-icon-sm-font-size;
}
.lexicon-icon-lg {
font-size: $lexicon-icon-lg-font-size;
}
.lexicon-icon-xl {
font-size: $lexicon-icon-xl-font-size;
}
.order-arrow-down-active {
.order-arrow-arrow-down {
fill: $order-arrow-down-active-color;
}
}
.order-arrow-up-active {
.order-arrow-arrow-up {
fill: $order-arrow-up-active-color;
}
}
// Collapse Icon
a.collapse-icon,
button.collapse-icon {
padding-left: $collapse-icon-padding-left;
padding-right: $collapse-icon-padding-right;
@if ($enable-c-inner) {
.c-inner {
margin-left: math-sign($collapse-icon-padding-left);
margin-right: math-sign($collapse-icon-padding-right);
}
}
}
.collapse-icon-closed,
.collapse-icon-open {
.lexicon-icon {
display: block;
}
}
.collapse-icon {
.collapse-icon-closed,
.collapse-icon-open {
bottom: $collapse-icon-position-bottom;
height: 1em;
left: $collapse-icon-position-left;
position: absolute;
right: $collapse-icon-position-right;
top: $collapse-icon-position-top;
width: 1em;
.lexicon-icon {
margin-top: 0;
}
}
.collapse-icon-closed {
display: none;
}
.collapse-icon-open {
display: inline-block;
}
}
.collapsed {
.collapse-icon-closed {
display: inline-block;
}
.collapse-icon-open {
display: none;
}
}
.collapse-icon.collapse-icon-middle {
.collapse-icon-closed,
.collapse-icon-open {
margin-top: 0;
top: 50%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
}
| {
"pile_set_name": "Github"
} |
<div>
<p>Snaps to the closest point on an entity.</p>
<p>
<img src="SnapOnEntityFigure.png" class="figure" />
</p>
</div>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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/html; charset=UTF-8" /><title>5.41. Spring boot with Aop</title><link rel="stylesheet" type="text/css" href="../..//docbook.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="../../index.html" title="Netkiller Java 手札" /><link rel="up" href="index.html" title="第 5 章 Spring Boot" /><link rel="prev" href="spring.boot.test.html" title="5.40. SpringBootTest" /><link rel="next" href="springboot.starter.html" title="5.42. Spring boot with starter" /></head><body><a xmlns="" href="//www.netkiller.cn/">Home</a> |
<a xmlns="" href="//netkiller.github.io/">简体中文</a> |
<a xmlns="" href="http://netkiller.sourceforge.net/">繁体中文</a> |
<a xmlns="" href="/journal/index.html">杂文</a> |
<a xmlns="" href="https://zhuanlan.zhihu.com/netkiller">知乎专栏</a> |
<a xmlns="" href="https://github.com/netkiller">Github</a> |
<a xmlns="" href="http://my.oschina.net/neochen/">OSChina 博客</a> |
<a xmlns="" href="https://cloud.tencent.com/developer/column/2078">云社区</a> |
<a xmlns="" href="https://yq.aliyun.com/u/netkiller/">云栖社区</a> |
<a xmlns="" href="https://www.facebook.com/bg7nyt">Facebook</a> |
<a xmlns="" href="http://cn.linkedin.com/in/netkiller/">Linkedin</a> |
<a xmlns="" href="//www.netkiller.cn/home/video.html">视频教程</a> |
<a xmlns="" href="//www.netkiller.cn/home/donations.html">打赏(Donations)</a> |
<a xmlns="" href="//www.netkiller.cn/home/about.html">About</a><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">5.41. Spring boot with Aop</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="spring.boot.test.html">上一页</a> </td><th width="60%" align="center">第 5 章 Spring Boot</th><td width="20%" align="right"> <a accesskey="n" href="springboot.starter.html">下一页</a></td></tr></table><hr /></div><table xmlns=""><tr><td><iframe src="//ghbtns.com/github-btn.html?user=netkiller&repo=netkiller.github.io&type=watch&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe></td><td><iframe src="//ghbtns.com/github-btn.html?user=netkiller&repo=netkiller.github.io&type=fork&count=true&size=large" height="30" width="170" frameborder="0" scrolling="0" style="width:170px; height: 30px;" allowTransparency="true"></iframe></td><td><iframe src="//ghbtns.com/github-btn.html?user=netkiller&type=follow&count=true&size=large" height="30" width="240" frameborder="0" scrolling="0" style="width:240px; height: 30px;" allowTransparency="true"></iframe></td><td></td><td><a href="https://zhuanlan.zhihu.com/netkiller"><img src="/images/logo/zhihu-card-default.svg" height="25" /></a></td><td valign="middle"><a href="https://zhuanlan.zhihu.com/netkiller">知乎专栏</a> | <a href="https://www.zhihu.com/club/1241768772601950208">多维度架构</a></td><td> | </td><td>微信号 netkiller-ebook </td><td> | </td><td>QQ群:128659835 请注明“读者”</td></tr></table><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="spring.aop"></a>5.41. Spring boot with Aop</h2></div></div></div>
<div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="Aspect"></a>5.41.1. Aspect</h3></div></div></div>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idp347"></a>5.41.1.1. Maven</h4></div></div></div>
<pre class="screen">
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
</pre>
</div>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idp348"></a>5.41.1.2. Pojo 类</h4></div></div></div>
<pre class="programlisting">
package cn.netkiller.aop.pojo;
import lombok.Data;
@Data
public class Employee {
private String id;
private String name;
public Employee() {
// TODO Auto-generated constructor stub
}
}
</pre>
</div>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idp349"></a>5.41.1.3. Service 类</h4></div></div></div>
<pre class="programlisting">
package cn.netkiller.aop.service;
import org.springframework.stereotype.Service;
import cn.netkiller.aop.pojo.Employee;
@Service
public class EmployeeService {
public EmployeeService() {
// TODO Auto-generated constructor stub
}
public Employee createEmployee(String id, String name) {
Employee emp = new Employee();
emp.setName(name);
emp.setId(id);
return emp;
}
public void deleteEmployee(String id) {
}
}
</pre>
</div>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idp350"></a>5.41.1.4. Aspect 类</h4></div></div></div>
<pre class="programlisting">
package cn.netkiller.aop.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class EmployeeServiceAspect {
public EmployeeServiceAspect() {
}
@Before(value = "execution(* cn.netkiller.aop.service.EmployeeService.*(..)) and args(id, name)")
public void beforeAdvice(JoinPoint joinPoint, String id, String name) {
System.out.println("Before method:" + joinPoint.getSignature());
System.out.println("Creating Employee with id: " + id + ", name: " + name);
}
@After(value = "execution(* cn.netkiller.aop.service.EmployeeService.*(..)) and args(id,name)")
public void afterAdvice(JoinPoint joinPoint, String id, String name) {
System.out.println("After method:" + joinPoint.getSignature());
System.out.println("Successfully created Employee with id: " + id + ", name: " + name);
}
}
</pre>
</div>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idp351"></a>5.41.1.5. 控制器</h4></div></div></div>
<pre class="programlisting">
package cn.netkiller.aop.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import cn.netkiller.aop.pojo.Employee;
import cn.netkiller.aop.service.EmployeeService;
@RestController
public class EmployeeController {
public EmployeeController() {
// TODO Auto-generated constructor stub
}
@Autowired
private EmployeeService employeeService;
@RequestMapping(value = "/add/employee", method = RequestMethod.GET)
public Employee addEmployee(@RequestParam("id") String id, @RequestParam("name") String name) {
return employeeService.createEmployee(id, name);
}
@RequestMapping(value = "/remove/employee", method = RequestMethod.GET)
public String removeEmployee(@RequestParam("id") String id) {
employeeService.deleteEmployee(id);
return "Employee removed";
}
}
</pre>
</div>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idp352"></a>5.41.1.6. Application</h4></div></div></div>
<pre class="programlisting">
package cn.netkiller.aop;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
System.out.println("Hello World!");
SpringApplication.run(Application.class, args);
}
}
</pre>
</div>
<div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="idp353"></a>5.41.1.7. 测试</h4></div></div></div>
<p>触发 Aspect</p>
<pre class="screen">
neo@MacBook-Pro ~ % curl http://localhost:8080/add/employee\?id\=1\&name\=neo
{"id":"1","name":"neo"}
</pre>
<p>控制台输出效果</p>
<pre class="screen">
Before method:Employee cn.netkiller.aop.service.EmployeeService.createEmployee(String,String)
Creating Employee with id: 1, name: neo
After method:Employee cn.netkiller.aop.service.EmployeeService.createEmployee(String,String)
Successfully created Employee with id: 1, name: neo
</pre>
</div>
</div>
</div><div xmlns="" id="disqus_thread"></div><script xmlns="">
var disqus_config = function () {
this.page.url = "http://www.netkiller.cn"; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = 'netkiller'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//netkiller.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script><noscript xmlns="">Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript><br xmlns="" /><script xmlns="" type="text/javascript" id="clustrmaps" src="//cdn.clustrmaps.com/map_v2.js?u=r5HG&d=9mi5r_kkDC8uxG8HuY3p4-2qgeeVypAK9vMD-2P6BYM"></script><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="spring.boot.test.html">上一页</a> </td><td width="20%" align="center"><a accesskey="u" href="index.html">上一级</a></td><td width="40%" align="right"> <a accesskey="n" href="springboot.starter.html">下一页</a></td></tr><tr><td width="40%" align="left" valign="top">5.40. SpringBootTest </td><td width="20%" align="center"><a accesskey="h" href="../../index.html">起始页</a></td><td width="40%" align="right" valign="top"> 5.42. Spring boot with starter</td></tr></table></div><script xmlns="">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-11694057-1', 'auto');
ga('send', 'pageview');
</script><script xmlns="" async="async">
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?93967759a51cda79e49bf4e34d0b0f2c";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script><script xmlns="" async="async">
(function(){
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
</script></body></html> | {
"pile_set_name": "Github"
} |
// replication-manager - Replication Manager Monitoring and CLI for MariaDB and MySQL
// Copyright 2017 Signal 18 SARL
// Authors: Guillaume Lefranc <[email protected]>
// Stephane Varoqui <[email protected]>
// This source code is licensed under the GNU General Public License, version 3.
package misc
import (
"crypto/md5"
"encoding/hex"
"hash/fnv"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
func Hash(s string) uint32 {
h := fnv.New32a()
h.Write([]byte(s))
return h.Sum32()
}
| {
"pile_set_name": "Github"
} |
/*
** Copyright (C) 2001-2009 Erik de Castro Lopo <[email protected]>
**
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
**
** * 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 author nor the names of any 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.
*/
#include <stdio.h>
/* Include this header file to use functions from libsndfile. */
#include <sndfile.h>
/* This will be the length of the buffer used to hold.frames while
** we process them.
*/
#define BUFFER_LEN 1024
/* libsndfile can handle more than 6 channels but we'll restrict it to 6. */
#define MAX_CHANNELS 6
/* Function prototype. */
static void process_data (double *data, int count, int channels) ;
int
main (void)
{ /* This is a buffer of double precision floating point values
** which will hold our data while we process it.
*/
static double data [BUFFER_LEN] ;
/* A SNDFILE is very much like a FILE in the Standard C library. The
** sf_open function return an SNDFILE* pointer when they sucessfully
** open the specified file.
*/
SNDFILE *infile, *outfile ;
/* A pointer to an SF_INFO stutct is passed to sf_open.
** On read, the library fills this struct with information about the file.
** On write, the struct must be filled in before calling sf_open.
*/
SF_INFO sfinfo ;
int readcount ;
const char *infilename = "input.wav" ;
const char *outfilename = "output.wav" ;
/* Here's where we open the input file. We pass sf_open the file name and
** a pointer to an SF_INFO struct.
** On successful open, sf_open returns a SNDFILE* pointer which is used
** for all subsequent operations on that file.
** If an error occurs during sf_open, the function returns a NULL pointer.
**
** If you are trying to open a raw headerless file you will need to set the
** format and channels fields of sfinfo before calling sf_open(). For
** instance to open a raw 16 bit stereo PCM file you would need the following
** two lines:
**
** sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16 ;
** sfinfo.channels = 2 ;
*/
if (! (infile = sf_open (infilename, SFM_READ, &sfinfo)))
{ /* Open failed so print an error message. */
printf ("Not able to open input file %s.\n", infilename) ;
/* Print the error message from libsndfile. */
puts (sf_strerror (NULL)) ;
return 1 ;
} ;
if (sfinfo.channels > MAX_CHANNELS)
{ printf ("Not able to process more than %d channels\n", MAX_CHANNELS) ;
return 1 ;
} ;
/* Open the output file. */
if (! (outfile = sf_open (outfilename, SFM_WRITE, &sfinfo)))
{ printf ("Not able to open output file %s.\n", outfilename) ;
puts (sf_strerror (NULL)) ;
return 1 ;
} ;
/* While there are.frames in the input file, read them, process
** them and write them to the output file.
*/
while ((readcount = sf_read_double (infile, data, BUFFER_LEN)))
{ process_data (data, readcount, sfinfo.channels) ;
sf_write_double (outfile, data, readcount) ;
} ;
/* Close input and output files. */
sf_close (infile) ;
sf_close (outfile) ;
return 0 ;
} /* main */
static void
process_data (double *data, int count, int channels)
{ double channel_gain [MAX_CHANNELS] = { 0.5, 0.8, 0.1, 0.4, 0.4, 0.9 } ;
int k, chan ;
/* Process the data here.
** If the soundfile contains more then 1 channel you need to take care of
** the data interleaving youself.
** Current we just apply a channel dependant gain.
*/
for (chan = 0 ; chan < channels ; chan ++)
for (k = chan ; k < count ; k+= channels)
data [k] *= channel_gain [chan] ;
return ;
} /* process_data */
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.