text
stringlengths
2
99.9k
meta
dict
/* *********************************************************************** * * project: org.matsim.* * * * *********************************************************************** * * * * copyright : (C) 2010 by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * * *********************************************************************** * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ package org.matsim.core.mobsim.qsim.pt; import org.matsim.vehicles.Vehicle; public class ComplexTransitStopHandlerFactory implements TransitStopHandlerFactory { @Override public TransitStopHandler createTransitStopHandler(Vehicle vehicle) { return new ComplexTransitStopHandler(vehicle); } }
{ "pile_set_name": "Github" }
keystore( name = "debug", properties = "debug.keystore.properties", store = "debug.keystore", visibility = [ "PUBLIC", ], )
{ "pile_set_name": "Github" }
#pragma once #include "AI/Monsters/ai_monster_squad.h" #include "AI/Monsters/ai_monster_squad_manager.h" #define TEMPLATE_SPECIALIZATION template <\ typename _Object\ > #define CStateMonsterAttackRunAbstract CStateMonsterAttackRun<_Object> TEMPLATE_SPECIALIZATION void CStateMonsterAttackRunAbstract::initialize() { inherited::initialize(); object->path().prepare_builder (); } TEMPLATE_SPECIALIZATION void CStateMonsterAttackRunAbstract::execute() { // установка параметров функциональных блоков object->set_action (ACT_RUN); object->anim().accel_activate (eAT_Aggressive); object->anim().accel_set_braking (false); object->path().set_target_point (object->EnemyMan.get_enemy_position(), object->EnemyMan.get_enemy_vertex()); object->path().set_rebuild_time (object->get_attack_rebuild_time()); object->path().set_use_covers (); object->path().set_cover_params (0.1f, 30.f, 1.f, 30.f); object->path().set_try_min_time (false); object->set_state_sound (MonsterSound::eMonsterSoundAggressive); object->path().extrapolate_path (true); // обработать squad инфо object->path().set_use_dest_orient (false); CMonsterSquad *squad = monster_squad().get_squad(object); if (squad && squad->SquadActive()) { // Получить команду SSquadCommand command; squad->GetCommand(object, command); if (command.type == SC_ATTACK) { object->path().set_use_dest_orient (true); object->path().set_dest_direction (command.direction); } } } TEMPLATE_SPECIALIZATION void CStateMonsterAttackRunAbstract::finalize() { inherited::finalize (); object->path().extrapolate_path (false); } TEMPLATE_SPECIALIZATION void CStateMonsterAttackRunAbstract::critical_finalize() { inherited::critical_finalize (); object->path().extrapolate_path (false); } TEMPLATE_SPECIALIZATION bool CStateMonsterAttackRunAbstract::check_completion() { float m_fDistMin = object->MeleeChecker.get_min_distance (); float dist = object->MeleeChecker.distance_to_enemy (object->EnemyMan.get_enemy()); if (dist < m_fDistMin) return true; return false; } TEMPLATE_SPECIALIZATION bool CStateMonsterAttackRunAbstract::check_start_conditions() { float m_fDistMax = object->MeleeChecker.get_max_distance (); float dist = object->MeleeChecker.distance_to_enemy (object->EnemyMan.get_enemy()); if (dist > m_fDistMax) return true; return false; }
{ "pile_set_name": "Github" }
PortSystem 1.0 name rootsh version 1.5.3 categories shells maintainers {toby @tobypeterson} description logging wrapper for shells long_description \ Rootsh is a wrapper for shells which logs all echoed \ keystrokes and terminal output to a file and/or to \ syslog. Its main purpose is the auditing of users \ who need a shell with root privileges. They start \ rootsh through the sudo mechanism. homepage http://rootsh.sourceforge.net/ platforms darwin license GPL-3 master_sites sourceforge checksums md5 af62e6140338c9b2e8e8f6e828fda1ac \ sha1 fa0049002b853a3d18b567dd60e4e714f9db2222 \ rmd160 1e5083c37a89b7c00606b4ca7367b90bc4ad58cb patchfiles patch-Makefile.in \ patch-configure \ patch-src__Makefile.in \ patch-src__rootsh.c configure.args --mandir=${prefix}/share/man
{ "pile_set_name": "Github" }
/* ============================================================ * QupZilla - WebKit based browser * Copyright (C) 2014 David Rosca <[email protected]> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ============================================================ */ #include "adblockrule.h" #include "adblocksubscription.h" #include <QtTest/QtTest> class AdBlockParseRule : public QObject { Q_OBJECT private slots: void parseEasyList(); }; void AdBlockParseRule::parseEasyList() { QBENCHMARK { AdBlockSubscription* subscription = new AdBlockSubscription("EasyList", this); subscription->setFilePath("../files/easylist.txt"); subscription->loadSubscription(QStringList()); } } QTEST_MAIN(AdBlockParseRule) #include "adblockparserule.moc"
{ "pile_set_name": "Github" }
/* Copyright 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. */ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: k8s.io/kubernetes/vendor/k8s.io/api/storage/v1/generated.proto /* Package v1 is a generated protocol buffer package. It is generated from these files: k8s.io/kubernetes/vendor/k8s.io/api/storage/v1/generated.proto It has these top-level messages: StorageClass StorageClassList VolumeAttachment VolumeAttachmentList VolumeAttachmentSource VolumeAttachmentSpec VolumeAttachmentStatus VolumeError */ package v1 import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" import k8s_io_api_core_v1 "k8s.io/api/core/v1" import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" import strings "strings" import reflect "reflect" import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package func (m *StorageClass) Reset() { *m = StorageClass{} } func (*StorageClass) ProtoMessage() {} func (*StorageClass) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{0} } func (m *StorageClassList) Reset() { *m = StorageClassList{} } func (*StorageClassList) ProtoMessage() {} func (*StorageClassList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{1} } func (m *VolumeAttachment) Reset() { *m = VolumeAttachment{} } func (*VolumeAttachment) ProtoMessage() {} func (*VolumeAttachment) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{2} } func (m *VolumeAttachmentList) Reset() { *m = VolumeAttachmentList{} } func (*VolumeAttachmentList) ProtoMessage() {} func (*VolumeAttachmentList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{3} } func (m *VolumeAttachmentSource) Reset() { *m = VolumeAttachmentSource{} } func (*VolumeAttachmentSource) ProtoMessage() {} func (*VolumeAttachmentSource) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{4} } func (m *VolumeAttachmentSpec) Reset() { *m = VolumeAttachmentSpec{} } func (*VolumeAttachmentSpec) ProtoMessage() {} func (*VolumeAttachmentSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{5} } func (m *VolumeAttachmentStatus) Reset() { *m = VolumeAttachmentStatus{} } func (*VolumeAttachmentStatus) ProtoMessage() {} func (*VolumeAttachmentStatus) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{6} } func (m *VolumeError) Reset() { *m = VolumeError{} } func (*VolumeError) ProtoMessage() {} func (*VolumeError) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{7} } func init() { proto.RegisterType((*StorageClass)(nil), "k8s.io.api.storage.v1.StorageClass") proto.RegisterType((*StorageClassList)(nil), "k8s.io.api.storage.v1.StorageClassList") proto.RegisterType((*VolumeAttachment)(nil), "k8s.io.api.storage.v1.VolumeAttachment") proto.RegisterType((*VolumeAttachmentList)(nil), "k8s.io.api.storage.v1.VolumeAttachmentList") proto.RegisterType((*VolumeAttachmentSource)(nil), "k8s.io.api.storage.v1.VolumeAttachmentSource") proto.RegisterType((*VolumeAttachmentSpec)(nil), "k8s.io.api.storage.v1.VolumeAttachmentSpec") proto.RegisterType((*VolumeAttachmentStatus)(nil), "k8s.io.api.storage.v1.VolumeAttachmentStatus") proto.RegisterType((*VolumeError)(nil), "k8s.io.api.storage.v1.VolumeError") } func (m *StorageClass) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) if err != nil { return nil, err } return dAtA[:n], nil } func (m *StorageClass) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(m.ObjectMeta.Size())) n1, err := m.ObjectMeta.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n1 dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(len(m.Provisioner))) i += copy(dAtA[i:], m.Provisioner) if len(m.Parameters) > 0 { keysForParameters := make([]string, 0, len(m.Parameters)) for k := range m.Parameters { keysForParameters = append(keysForParameters, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForParameters) for _, k := range keysForParameters { dAtA[i] = 0x1a i++ v := m.Parameters[string(k)] mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) i = encodeVarintGenerated(dAtA, i, uint64(mapSize)) dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(len(k))) i += copy(dAtA[i:], k) dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(len(v))) i += copy(dAtA[i:], v) } } if m.ReclaimPolicy != nil { dAtA[i] = 0x22 i++ i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ReclaimPolicy))) i += copy(dAtA[i:], *m.ReclaimPolicy) } if len(m.MountOptions) > 0 { for _, s := range m.MountOptions { dAtA[i] = 0x2a i++ l = len(s) for l >= 1<<7 { dAtA[i] = uint8(uint64(l)&0x7f | 0x80) l >>= 7 i++ } dAtA[i] = uint8(l) i++ i += copy(dAtA[i:], s) } } if m.AllowVolumeExpansion != nil { dAtA[i] = 0x30 i++ if *m.AllowVolumeExpansion { dAtA[i] = 1 } else { dAtA[i] = 0 } i++ } if m.VolumeBindingMode != nil { dAtA[i] = 0x3a i++ i = encodeVarintGenerated(dAtA, i, uint64(len(*m.VolumeBindingMode))) i += copy(dAtA[i:], *m.VolumeBindingMode) } if len(m.AllowedTopologies) > 0 { for _, msg := range m.AllowedTopologies { dAtA[i] = 0x42 i++ i = encodeVarintGenerated(dAtA, i, uint64(msg.Size())) n, err := msg.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n } } return i, nil } func (m *StorageClassList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) if err != nil { return nil, err } return dAtA[:n], nil } func (m *StorageClassList) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(m.ListMeta.Size())) n2, err := m.ListMeta.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n2 if len(m.Items) > 0 { for _, msg := range m.Items { dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(msg.Size())) n, err := msg.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n } } return i, nil } func (m *VolumeAttachment) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) if err != nil { return nil, err } return dAtA[:n], nil } func (m *VolumeAttachment) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(m.ObjectMeta.Size())) n3, err := m.ObjectMeta.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n3 dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(m.Spec.Size())) n4, err := m.Spec.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n4 dAtA[i] = 0x1a i++ i = encodeVarintGenerated(dAtA, i, uint64(m.Status.Size())) n5, err := m.Status.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n5 return i, nil } func (m *VolumeAttachmentList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) if err != nil { return nil, err } return dAtA[:n], nil } func (m *VolumeAttachmentList) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(m.ListMeta.Size())) n6, err := m.ListMeta.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n6 if len(m.Items) > 0 { for _, msg := range m.Items { dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(msg.Size())) n, err := msg.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n } } return i, nil } func (m *VolumeAttachmentSource) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) if err != nil { return nil, err } return dAtA[:n], nil } func (m *VolumeAttachmentSource) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l if m.PersistentVolumeName != nil { dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PersistentVolumeName))) i += copy(dAtA[i:], *m.PersistentVolumeName) } return i, nil } func (m *VolumeAttachmentSpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) if err != nil { return nil, err } return dAtA[:n], nil } func (m *VolumeAttachmentSpec) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(len(m.Attacher))) i += copy(dAtA[i:], m.Attacher) dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(m.Source.Size())) n7, err := m.Source.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n7 dAtA[i] = 0x1a i++ i = encodeVarintGenerated(dAtA, i, uint64(len(m.NodeName))) i += copy(dAtA[i:], m.NodeName) return i, nil } func (m *VolumeAttachmentStatus) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) if err != nil { return nil, err } return dAtA[:n], nil } func (m *VolumeAttachmentStatus) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l dAtA[i] = 0x8 i++ if m.Attached { dAtA[i] = 1 } else { dAtA[i] = 0 } i++ if len(m.AttachmentMetadata) > 0 { keysForAttachmentMetadata := make([]string, 0, len(m.AttachmentMetadata)) for k := range m.AttachmentMetadata { keysForAttachmentMetadata = append(keysForAttachmentMetadata, string(k)) } github_com_gogo_protobuf_sortkeys.Strings(keysForAttachmentMetadata) for _, k := range keysForAttachmentMetadata { dAtA[i] = 0x12 i++ v := m.AttachmentMetadata[string(k)] mapSize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) i = encodeVarintGenerated(dAtA, i, uint64(mapSize)) dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(len(k))) i += copy(dAtA[i:], k) dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(len(v))) i += copy(dAtA[i:], v) } } if m.AttachError != nil { dAtA[i] = 0x1a i++ i = encodeVarintGenerated(dAtA, i, uint64(m.AttachError.Size())) n8, err := m.AttachError.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n8 } if m.DetachError != nil { dAtA[i] = 0x22 i++ i = encodeVarintGenerated(dAtA, i, uint64(m.DetachError.Size())) n9, err := m.DetachError.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n9 } return i, nil } func (m *VolumeError) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalTo(dAtA) if err != nil { return nil, err } return dAtA[:n], nil } func (m *VolumeError) MarshalTo(dAtA []byte) (int, error) { var i int _ = i var l int _ = l dAtA[i] = 0xa i++ i = encodeVarintGenerated(dAtA, i, uint64(m.Time.Size())) n10, err := m.Time.MarshalTo(dAtA[i:]) if err != nil { return 0, err } i += n10 dAtA[i] = 0x12 i++ i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) i += copy(dAtA[i:], m.Message) return i, nil } func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) return offset + 1 } func (m *StorageClass) Size() (n int) { var l int _ = l l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) l = len(m.Provisioner) n += 1 + l + sovGenerated(uint64(l)) if len(m.Parameters) > 0 { for k, v := range m.Parameters { _ = k _ = v mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } if m.ReclaimPolicy != nil { l = len(*m.ReclaimPolicy) n += 1 + l + sovGenerated(uint64(l)) } if len(m.MountOptions) > 0 { for _, s := range m.MountOptions { l = len(s) n += 1 + l + sovGenerated(uint64(l)) } } if m.AllowVolumeExpansion != nil { n += 2 } if m.VolumeBindingMode != nil { l = len(*m.VolumeBindingMode) n += 1 + l + sovGenerated(uint64(l)) } if len(m.AllowedTopologies) > 0 { for _, e := range m.AllowedTopologies { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func (m *StorageClassList) Size() (n int) { var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func (m *VolumeAttachment) Size() (n int) { var l int _ = l l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Spec.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Status.Size() n += 1 + l + sovGenerated(uint64(l)) return n } func (m *VolumeAttachmentList) Size() (n int) { var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func (m *VolumeAttachmentSource) Size() (n int) { var l int _ = l if m.PersistentVolumeName != nil { l = len(*m.PersistentVolumeName) n += 1 + l + sovGenerated(uint64(l)) } return n } func (m *VolumeAttachmentSpec) Size() (n int) { var l int _ = l l = len(m.Attacher) n += 1 + l + sovGenerated(uint64(l)) l = m.Source.Size() n += 1 + l + sovGenerated(uint64(l)) l = len(m.NodeName) n += 1 + l + sovGenerated(uint64(l)) return n } func (m *VolumeAttachmentStatus) Size() (n int) { var l int _ = l n += 2 if len(m.AttachmentMetadata) > 0 { for k, v := range m.AttachmentMetadata { _ = k _ = v mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } if m.AttachError != nil { l = m.AttachError.Size() n += 1 + l + sovGenerated(uint64(l)) } if m.DetachError != nil { l = m.DetachError.Size() n += 1 + l + sovGenerated(uint64(l)) } return n } func (m *VolumeError) Size() (n int) { var l int _ = l l = m.Time.Size() n += 1 + l + sovGenerated(uint64(l)) l = len(m.Message) n += 1 + l + sovGenerated(uint64(l)) return n } func sovGenerated(x uint64) (n int) { for { n++ x >>= 7 if x == 0 { break } } return n } func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (this *StorageClass) String() string { if this == nil { return "nil" } keysForParameters := make([]string, 0, len(this.Parameters)) for k := range this.Parameters { keysForParameters = append(keysForParameters, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForParameters) mapStringForParameters := "map[string]string{" for _, k := range keysForParameters { mapStringForParameters += fmt.Sprintf("%v: %v,", k, this.Parameters[k]) } mapStringForParameters += "}" s := strings.Join([]string{`&StorageClass{`, `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, `Provisioner:` + fmt.Sprintf("%v", this.Provisioner) + `,`, `Parameters:` + mapStringForParameters + `,`, `ReclaimPolicy:` + valueToStringGenerated(this.ReclaimPolicy) + `,`, `MountOptions:` + fmt.Sprintf("%v", this.MountOptions) + `,`, `AllowVolumeExpansion:` + valueToStringGenerated(this.AllowVolumeExpansion) + `,`, `VolumeBindingMode:` + valueToStringGenerated(this.VolumeBindingMode) + `,`, `AllowedTopologies:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.AllowedTopologies), "TopologySelectorTerm", "k8s_io_api_core_v1.TopologySelectorTerm", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } func (this *StorageClassList) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&StorageClassList{`, `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "StorageClass", "StorageClass", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } func (this *VolumeAttachment) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&VolumeAttachment{`, `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "VolumeAttachmentSpec", "VolumeAttachmentSpec", 1), `&`, ``, 1) + `,`, `Status:` + strings.Replace(strings.Replace(this.Status.String(), "VolumeAttachmentStatus", "VolumeAttachmentStatus", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } func (this *VolumeAttachmentList) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&VolumeAttachmentList{`, `ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ListMeta", 1), `&`, ``, 1) + `,`, `Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "VolumeAttachment", "VolumeAttachment", 1), `&`, ``, 1) + `,`, `}`, }, "") return s } func (this *VolumeAttachmentSource) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&VolumeAttachmentSource{`, `PersistentVolumeName:` + valueToStringGenerated(this.PersistentVolumeName) + `,`, `}`, }, "") return s } func (this *VolumeAttachmentSpec) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&VolumeAttachmentSpec{`, `Attacher:` + fmt.Sprintf("%v", this.Attacher) + `,`, `Source:` + strings.Replace(strings.Replace(this.Source.String(), "VolumeAttachmentSource", "VolumeAttachmentSource", 1), `&`, ``, 1) + `,`, `NodeName:` + fmt.Sprintf("%v", this.NodeName) + `,`, `}`, }, "") return s } func (this *VolumeAttachmentStatus) String() string { if this == nil { return "nil" } keysForAttachmentMetadata := make([]string, 0, len(this.AttachmentMetadata)) for k := range this.AttachmentMetadata { keysForAttachmentMetadata = append(keysForAttachmentMetadata, k) } github_com_gogo_protobuf_sortkeys.Strings(keysForAttachmentMetadata) mapStringForAttachmentMetadata := "map[string]string{" for _, k := range keysForAttachmentMetadata { mapStringForAttachmentMetadata += fmt.Sprintf("%v: %v,", k, this.AttachmentMetadata[k]) } mapStringForAttachmentMetadata += "}" s := strings.Join([]string{`&VolumeAttachmentStatus{`, `Attached:` + fmt.Sprintf("%v", this.Attached) + `,`, `AttachmentMetadata:` + mapStringForAttachmentMetadata + `,`, `AttachError:` + strings.Replace(fmt.Sprintf("%v", this.AttachError), "VolumeError", "VolumeError", 1) + `,`, `DetachError:` + strings.Replace(fmt.Sprintf("%v", this.DetachError), "VolumeError", "VolumeError", 1) + `,`, `}`, }, "") return s } func (this *VolumeError) String() string { if this == nil { return "nil" } s := strings.Join([]string{`&VolumeError{`, `Time:` + strings.Replace(strings.Replace(this.Time.String(), "Time", "k8s_io_apimachinery_pkg_apis_meta_v1.Time", 1), `&`, ``, 1) + `,`, `Message:` + fmt.Sprintf("%v", this.Message) + `,`, `}`, }, "") return s } func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { return "nil" } pv := reflect.Indirect(rv).Interface() return fmt.Sprintf("*%v", pv) } func (m *StorageClass) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: StorageClass: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: StorageClass: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Provisioner", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.Provisioner = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Parameters", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Parameters == nil { m.Parameters = make(map[string]string) } var mapkey string var mapvalue string for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthGenerated } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var stringLenmapvalue uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapvalue |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLenmapvalue := int(stringLenmapvalue) if intStringLenmapvalue < 0 { return ErrInvalidLengthGenerated } postStringIndexmapvalue := iNdEx + intStringLenmapvalue if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.Parameters[mapkey] = mapvalue iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ReclaimPolicy", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := k8s_io_api_core_v1.PersistentVolumeReclaimPolicy(dAtA[iNdEx:postIndex]) m.ReclaimPolicy = &s iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MountOptions", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.MountOptions = append(m.MountOptions, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field AllowVolumeExpansion", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } b := bool(v != 0) m.AllowVolumeExpansion = &b case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VolumeBindingMode", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := VolumeBindingMode(dAtA[iNdEx:postIndex]) m.VolumeBindingMode = &s iNdEx = postIndex case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AllowedTopologies", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.AllowedTopologies = append(m.AllowedTopologies, k8s_io_api_core_v1.TopologySelectorTerm{}) if err := m.AllowedTopologies[len(m.AllowedTopologies)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *StorageClassList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: StorageClassList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: StorageClassList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, StorageClass{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *VolumeAttachment) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: VolumeAttachment: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: VolumeAttachment: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *VolumeAttachmentList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: VolumeAttachmentList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: VolumeAttachmentList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, VolumeAttachment{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *VolumeAttachmentSource) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: VolumeAttachmentSource: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: VolumeAttachmentSource: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PersistentVolumeName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } s := string(dAtA[iNdEx:postIndex]) m.PersistentVolumeName = &s iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *VolumeAttachmentSpec) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: VolumeAttachmentSpec: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: VolumeAttachmentSpec: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Attacher", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.Attacher = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Source.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.NodeName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *VolumeAttachmentStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: VolumeAttachmentStatus: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: VolumeAttachmentStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Attached", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } m.Attached = bool(v != 0) case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AttachmentMetadata", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.AttachmentMetadata == nil { m.AttachmentMetadata = make(map[string]string) } var mapkey string var mapvalue string for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) if fieldNum == 1 { var stringLenmapkey uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapkey |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLenmapkey := int(stringLenmapkey) if intStringLenmapkey < 0 { return ErrInvalidLengthGenerated } postStringIndexmapkey := iNdEx + intStringLenmapkey if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) iNdEx = postStringIndexmapkey } else if fieldNum == 2 { var stringLenmapvalue uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLenmapvalue |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLenmapvalue := int(stringLenmapvalue) if intStringLenmapvalue < 0 { return ErrInvalidLengthGenerated } postStringIndexmapvalue := iNdEx + intStringLenmapvalue if postStringIndexmapvalue > l { return io.ErrUnexpectedEOF } mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) iNdEx = postStringIndexmapvalue } else { iNdEx = entryPreIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > postIndex { return io.ErrUnexpectedEOF } iNdEx += skippy } } m.AttachmentMetadata[mapkey] = mapvalue iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AttachError", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.AttachError == nil { m.AttachError = &VolumeError{} } if err := m.AttachError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DetachError", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.DetachError == nil { m.DetachError = &VolumeError{} } if err := m.DetachError.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *VolumeError) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: VolumeError: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: VolumeError: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Time", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Time.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.Message = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipGenerated(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if dAtA[iNdEx-1] < 0x80 { break } } return iNdEx, nil case 1: iNdEx += 8 return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } iNdEx += length if length < 0 { return 0, ErrInvalidLengthGenerated } return iNdEx, nil case 3: for { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := dAtA[iNdEx] iNdEx++ innerWire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } innerWireType := int(innerWire & 0x7) if innerWireType == 4 { break } next, err := skipGenerated(dAtA[start:]) if err != nil { return 0, err } iNdEx = start + next } return iNdEx, nil case 4: return iNdEx, nil case 5: iNdEx += 4 return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } } panic("unreachable") } var ( ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") ) func init() { proto.RegisterFile("k8s.io/kubernetes/vendor/k8s.io/api/storage/v1/generated.proto", fileDescriptorGenerated) } var fileDescriptorGenerated = []byte{ // 984 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0x3d, 0x6f, 0x23, 0x45, 0x18, 0xce, 0xc6, 0xf9, 0x70, 0xc6, 0x09, 0x97, 0x0c, 0x01, 0x8c, 0x0b, 0x3b, 0x32, 0x05, 0xe6, 0xe0, 0x76, 0x2f, 0xe1, 0x40, 0x27, 0x24, 0x90, 0xbc, 0x60, 0x09, 0xa4, 0xf8, 0x2e, 0x9a, 0x84, 0x13, 0x42, 0x14, 0x4c, 0x76, 0xdf, 0xdb, 0x2c, 0xf6, 0xee, 0x2c, 0x33, 0x63, 0x43, 0x3a, 0x2a, 0x3a, 0x24, 0x68, 0xf9, 0x29, 0x94, 0x54, 0xa1, 0xbb, 0xf2, 0x2a, 0x8b, 0x2c, 0x35, 0x7f, 0x20, 0x15, 0x9a, 0xd9, 0x89, 0xbd, 0xb1, 0xd7, 0x9c, 0xd3, 0x5c, 0xe7, 0xf7, 0xe3, 0x79, 0xde, 0xef, 0x59, 0xa3, 0x4f, 0x7a, 0x0f, 0x85, 0x1d, 0x32, 0xa7, 0x37, 0x38, 0x05, 0x1e, 0x83, 0x04, 0xe1, 0x0c, 0x21, 0xf6, 0x19, 0x77, 0x8c, 0x81, 0x26, 0xa1, 0x23, 0x24, 0xe3, 0x34, 0x00, 0x67, 0xb8, 0xef, 0x04, 0x10, 0x03, 0xa7, 0x12, 0x7c, 0x3b, 0xe1, 0x4c, 0x32, 0xfc, 0x5a, 0xe6, 0x66, 0xd3, 0x24, 0xb4, 0x8d, 0x9b, 0x3d, 0xdc, 0xaf, 0xdd, 0x0b, 0x42, 0x79, 0x36, 0x38, 0xb5, 0x3d, 0x16, 0x39, 0x01, 0x0b, 0x98, 0xa3, 0xbd, 0x4f, 0x07, 0x4f, 0xb5, 0xa4, 0x05, 0xfd, 0x2b, 0x63, 0xa9, 0x35, 0x73, 0xc1, 0x3c, 0xc6, 0x8b, 0x22, 0xd5, 0x1e, 0x4c, 0x7c, 0x22, 0xea, 0x9d, 0x85, 0x31, 0xf0, 0x73, 0x27, 0xe9, 0x05, 0x4a, 0x21, 0x9c, 0x08, 0x24, 0x2d, 0x42, 0x39, 0xf3, 0x50, 0x7c, 0x10, 0xcb, 0x30, 0x82, 0x19, 0xc0, 0x87, 0x2f, 0x02, 0x08, 0xef, 0x0c, 0x22, 0x3a, 0x8d, 0x6b, 0xfe, 0xb2, 0x86, 0x36, 0x8f, 0xb3, 0x06, 0x7c, 0xda, 0xa7, 0x42, 0xe0, 0x6f, 0x51, 0x59, 0x25, 0xe5, 0x53, 0x49, 0xab, 0xd6, 0x9e, 0xd5, 0xaa, 0x1c, 0xdc, 0xb7, 0x27, 0xcd, 0x1a, 0x73, 0xdb, 0x49, 0x2f, 0x50, 0x0a, 0x61, 0x2b, 0x6f, 0x7b, 0xb8, 0x6f, 0x3f, 0x3e, 0xfd, 0x0e, 0x3c, 0xd9, 0x05, 0x49, 0x5d, 0x7c, 0x31, 0x6a, 0x2c, 0xa5, 0xa3, 0x06, 0x9a, 0xe8, 0xc8, 0x98, 0x15, 0x7f, 0x80, 0x2a, 0x09, 0x67, 0xc3, 0x50, 0x84, 0x2c, 0x06, 0x5e, 0x5d, 0xde, 0xb3, 0x5a, 0x1b, 0xee, 0xab, 0x06, 0x52, 0x39, 0x9a, 0x98, 0x48, 0xde, 0x0f, 0x07, 0x08, 0x25, 0x94, 0xd3, 0x08, 0x24, 0x70, 0x51, 0x2d, 0xed, 0x95, 0x5a, 0x95, 0x83, 0xf7, 0xed, 0xc2, 0x39, 0xda, 0xf9, 0x8a, 0xec, 0xa3, 0x31, 0xaa, 0x13, 0x4b, 0x7e, 0x3e, 0xc9, 0x6e, 0x62, 0x20, 0x39, 0x6a, 0xdc, 0x43, 0x5b, 0x1c, 0xbc, 0x3e, 0x0d, 0xa3, 0x23, 0xd6, 0x0f, 0xbd, 0xf3, 0xea, 0x8a, 0xce, 0xb0, 0x93, 0x8e, 0x1a, 0x5b, 0x24, 0x6f, 0xb8, 0x1a, 0x35, 0xee, 0xcf, 0x6e, 0x80, 0x7d, 0x04, 0x5c, 0x84, 0x42, 0x42, 0x2c, 0x9f, 0xb0, 0xfe, 0x20, 0x82, 0x1b, 0x18, 0x72, 0x93, 0x1b, 0x3f, 0x40, 0x9b, 0x11, 0x1b, 0xc4, 0xf2, 0x71, 0x22, 0x43, 0x16, 0x8b, 0xea, 0xea, 0x5e, 0xa9, 0xb5, 0xe1, 0x6e, 0xa7, 0xa3, 0xc6, 0x66, 0x37, 0xa7, 0x27, 0x37, 0xbc, 0xf0, 0x21, 0xda, 0xa5, 0xfd, 0x3e, 0xfb, 0x21, 0x0b, 0xd0, 0xf9, 0x31, 0xa1, 0xb1, 0xea, 0x52, 0x75, 0x6d, 0xcf, 0x6a, 0x95, 0xdd, 0x6a, 0x3a, 0x6a, 0xec, 0xb6, 0x0b, 0xec, 0xa4, 0x10, 0x85, 0xbf, 0x42, 0x3b, 0x43, 0xad, 0x72, 0xc3, 0xd8, 0x0f, 0xe3, 0xa0, 0xcb, 0x7c, 0xa8, 0xae, 0xeb, 0xa2, 0xef, 0xa6, 0xa3, 0xc6, 0xce, 0x93, 0x69, 0xe3, 0x55, 0x91, 0x92, 0xcc, 0x92, 0xe0, 0xef, 0xd1, 0x8e, 0x8e, 0x08, 0xfe, 0x09, 0x4b, 0x58, 0x9f, 0x05, 0x21, 0x88, 0x6a, 0x59, 0x8f, 0xae, 0x95, 0x1f, 0x9d, 0x6a, 0x9d, 0x9a, 0x9b, 0xf1, 0x3a, 0x3f, 0x86, 0x3e, 0x78, 0x92, 0xf1, 0x13, 0xe0, 0x91, 0xfb, 0xa6, 0x99, 0xd7, 0x4e, 0x7b, 0x9a, 0x8a, 0xcc, 0xb2, 0xd7, 0x3e, 0x46, 0x77, 0xa6, 0x06, 0x8e, 0xb7, 0x51, 0xa9, 0x07, 0xe7, 0x7a, 0x9b, 0x37, 0x88, 0xfa, 0x89, 0x77, 0xd1, 0xea, 0x90, 0xf6, 0x07, 0x90, 0x2d, 0x1f, 0xc9, 0x84, 0x8f, 0x96, 0x1f, 0x5a, 0xcd, 0x3f, 0x2c, 0xb4, 0x9d, 0xdf, 0x9e, 0xc3, 0x50, 0x48, 0xfc, 0xcd, 0xcc, 0x4d, 0xd8, 0x8b, 0xdd, 0x84, 0x42, 0xeb, 0x8b, 0xd8, 0x36, 0x35, 0x94, 0xaf, 0x35, 0xb9, 0x7b, 0xf8, 0x1c, 0xad, 0x86, 0x12, 0x22, 0x51, 0x5d, 0xd6, 0x8d, 0x79, 0x6b, 0x81, 0x9d, 0x76, 0xb7, 0x0c, 0xdf, 0xea, 0x17, 0x0a, 0x49, 0x32, 0x82, 0xe6, 0xef, 0xcb, 0x68, 0x3b, 0x9b, 0x4b, 0x5b, 0x4a, 0xea, 0x9d, 0x45, 0x10, 0xcb, 0x97, 0x70, 0xd0, 0x5d, 0xb4, 0x22, 0x12, 0xf0, 0x74, 0x33, 0x2b, 0x07, 0xef, 0xce, 0xc9, 0x7f, 0x3a, 0xb1, 0xe3, 0x04, 0x3c, 0x77, 0xd3, 0x10, 0xaf, 0x28, 0x89, 0x68, 0x1a, 0xfc, 0x25, 0x5a, 0x13, 0x92, 0xca, 0x81, 0x3a, 0x72, 0x45, 0x78, 0x6f, 0x51, 0x42, 0x0d, 0x72, 0x5f, 0x31, 0x94, 0x6b, 0x99, 0x4c, 0x0c, 0x59, 0xf3, 0x4f, 0x0b, 0xed, 0x4e, 0x43, 0x5e, 0xc2, 0x74, 0x0f, 0x6f, 0x4e, 0xf7, 0xed, 0x05, 0x8b, 0x99, 0x33, 0xe1, 0xa7, 0xe8, 0xf5, 0x99, 0xb2, 0xd9, 0x80, 0x7b, 0xa0, 0x9e, 0x84, 0x64, 0xea, 0xe1, 0x79, 0x44, 0x23, 0xc8, 0xb6, 0x3e, 0x7b, 0x12, 0x8e, 0x0a, 0xec, 0xa4, 0x10, 0xd5, 0xfc, 0xab, 0xa0, 0x59, 0x6a, 0x44, 0xf8, 0x3d, 0x54, 0xa6, 0x5a, 0x03, 0xdc, 0x50, 0x8f, 0x8b, 0x6f, 0x1b, 0x3d, 0x19, 0x7b, 0xe8, 0x51, 0xea, 0xf4, 0xcc, 0x6e, 0x2c, 0x3c, 0x4a, 0x0d, 0xca, 0x8d, 0x52, 0xcb, 0xc4, 0x90, 0xa9, 0x24, 0x62, 0xe6, 0x67, 0xf5, 0x95, 0x6e, 0x26, 0xf1, 0xc8, 0xe8, 0xc9, 0xd8, 0xa3, 0xf9, 0x6f, 0xa9, 0xa0, 0x69, 0x7a, 0x27, 0x72, 0xd5, 0xf8, 0xba, 0x9a, 0xf2, 0x4c, 0x35, 0xfe, 0xb8, 0x1a, 0x1f, 0xff, 0x66, 0x21, 0x4c, 0xc7, 0x14, 0xdd, 0xeb, 0x9d, 0xc9, 0x06, 0xdb, 0xb9, 0xd5, 0x96, 0xda, 0xed, 0x19, 0x9e, 0xec, 0xe3, 0x54, 0x33, 0xf1, 0xf1, 0xac, 0x03, 0x29, 0x08, 0x8e, 0x7d, 0x54, 0xc9, 0xb4, 0x1d, 0xce, 0x19, 0x37, 0x17, 0xd3, 0xfc, 0xdf, 0x5c, 0xb4, 0xa7, 0x5b, 0x57, 0x1f, 0xdb, 0xf6, 0x04, 0x7a, 0x35, 0x6a, 0x54, 0x72, 0x76, 0x92, 0xa7, 0x55, 0x51, 0x7c, 0x98, 0x44, 0x59, 0xb9, 0x5d, 0x94, 0xcf, 0x60, 0x7e, 0x94, 0x1c, 0x6d, 0xad, 0x83, 0xde, 0x98, 0xd3, 0x96, 0x5b, 0x3d, 0xe1, 0x3f, 0x5b, 0x28, 0x1f, 0x03, 0x1f, 0xa2, 0x15, 0xf5, 0x0f, 0xc8, 0xdc, 0xf6, 0xdd, 0xc5, 0x6e, 0xfb, 0x24, 0x8c, 0x60, 0xf2, 0x3a, 0x29, 0x89, 0x68, 0x16, 0xfc, 0x0e, 0x5a, 0x8f, 0x40, 0x08, 0x1a, 0x98, 0xc8, 0xee, 0x1d, 0xe3, 0xb4, 0xde, 0xcd, 0xd4, 0xe4, 0xda, 0xee, 0xb6, 0x2e, 0x2e, 0xeb, 0x4b, 0xcf, 0x2e, 0xeb, 0x4b, 0xcf, 0x2f, 0xeb, 0x4b, 0x3f, 0xa5, 0x75, 0xeb, 0x22, 0xad, 0x5b, 0xcf, 0xd2, 0xba, 0xf5, 0x3c, 0xad, 0x5b, 0x7f, 0xa7, 0x75, 0xeb, 0xd7, 0x7f, 0xea, 0x4b, 0x5f, 0x2f, 0x0f, 0xf7, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x85, 0x2a, 0x88, 0xc0, 0xcf, 0x0a, 0x00, 0x00, }
{ "pile_set_name": "Github" }
'use strict'; var Promise = require('./core.js'); module.exports = Promise; Promise.prototype['finally'] = function (f) { return this.then(function (value) { return Promise.resolve(f()).then(function () { return value; }); }, function (err) { return Promise.resolve(f()).then(function () { throw err; }); }); };
{ "pile_set_name": "Github" }
using PetaPoco; using System; using System.Collections.Generic; using System.Linq; using Xms.Core.Data; using Xms.Data; using Xms.DataMapping.Abstractions; using Xms.DataMapping.Domain; using Xms.Infrastructure; using Xms.Infrastructure.Utility; using Xms.Localization.Abstractions; using Xms.Schema.Extensions; using Xms.Sdk.Abstractions.Query; namespace Xms.Sdk.Data { /// <summary> /// 字段值更新 /// </summary> public class FieldValueUpdater : IFieldValueUpdater { private readonly DataRepositoryBase<dynamic> _repository; private readonly ILocalizedTextProvider _loc; public FieldValueUpdater(ILocalizedTextProvider localizedTextProvider , IDbContext dbContext) { _loc = localizedTextProvider; _repository = new DataRepositoryBase<dynamic>(dbContext); } public bool UpdateControlMap(EntityMap entityMap, IEnumerable<AttributeMap> attributeMaps, Guid sourceRecordId, Schema.Domain.Attribute refAttribute, IEnumerable<Schema.Domain.Attribute> sourceAttributeMeta, IEnumerable<Schema.Domain.Attribute> targetAttributeMeta, bool onDelete = false) { Sql s = Sql.Builder.Append("UPDATE [" + entityMap.SourceEnttiyName + "] SET "); foreach (var ca in attributeMaps) { //查找所有目标单据,钩稽字段的总和 s.Append(string.Format("[{0}]=(SELECT SUM([{1}]) AS SumValue FROM [{2}] WHERE [{3}] = '{4}')" , ca.RemainAttributeName, ca.TargetAttributeName, entityMap.TargetEnttiyName, refAttribute.Name, sourceRecordId)); s.Append(string.Format(",[{0}]=(CASE WHEN ([{1}]-(SELECT SUM([{2}]) AS SumValue FROM [{3}] WHERE [{4}] = '{5}'))<=0 THEN 1 ELSE 0 END)" , ca.ClosedAttributeName, ca.SourceAttributeName, ca.TargetAttributeName, entityMap.TargetEnttiyName, refAttribute.Name, sourceRecordId)); if (!onDelete && entityMap.MapType == MapType.ForceControl) { var data = _repository.ExecuteQuery(string.Format("SELECT 1 FROM [{0}] a LEFT JOIN (SELECT SUM([{1}]) AS SumValue,[{3}] FROM [{2}] WHERE [{3}] = '{4}' GROUP BY [{3}]) b ON a.{0}id=b.[{3}] WHERE a.{0}id='{4}' AND b.SumValue>a.[{5}]" , entityMap.SourceEnttiyName, ca.TargetAttributeName, entityMap.TargetEnttiyName, refAttribute.Name, sourceRecordId, ca.SourceAttributeName)); if (data.NotEmpty()) { var attr = sourceAttributeMeta.First(n => n.AttributeId.Equals(ca.SourceAttributeId)); var attr2 = targetAttributeMeta.First(n => n.AttributeId.Equals(ca.TargetAttributeId)); _repository.RollBackTransaction(); throw new XmsException(string.Format("'{0}' " + _loc["entitymap_greaterthan_error"] + " '{1}'", attr2.LocalizedName, attr.LocalizedName)); } } } s.Append(" WHERE " + entityMap.SourceEnttiyName + "id='" + sourceRecordId + "'"); _repository.Execute(s); return true; } public bool UpdateSummaryValue(Schema.Domain.Entity entityMetadata, Entity data, Schema.Domain.Attribute summaryField, Schema.Domain.RelationShip relationShipMetadata, AttributeAggregateExpression aggExp) { var sql = string.Format("UPDATE {0} SET {1}=(SELECT {6}({2}) FROM {3} WITH(NOLOCK) WHERE {4}='{5}') WHERE {4} = '{5}'" , summaryField.EntityName, summaryField.Name, aggExp.Field, aggExp.EntityName , relationShipMetadata.ReferencedAttributeName, data[relationShipMetadata.ReferencingAttributeName].ToString() , aggExp.Aggregate); _repository.Execute(sql, null); return true; } public bool UpdateFormulaValue(string entityName, IEnumerable<Schema.Domain.Attribute> attributes, Guid recordId) { var sql = string.Format("UPDATE [{0}] SET ", entityName); var sets = new List<string>(); foreach (var attr in attributes) { if (attr.FormulaExpression.IsNotEmpty()) { sets.Add(string.Format("[{0}]={1}", attr.Name, attr.FormulaExpression)); } } if (sets.NotEmpty()) { sql += string.Join(",", sets); sql += string.Format(" WHERE [{0}]=@0", attributes.First(x => x.TypeIsPrimaryKey()).Name.IfEmpty($"{entityName}id")); _repository.Execute(sql, recordId); } return true; } } }
{ "pile_set_name": "Github" }
POST /vspx/custom_format.vspx HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.11 [en] Host: duple:8440 Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 Accept-Language: en;q=1.0,ru;q=0.9 Accept-Charset: windows-1252, utf-8, utf-16, iso-8859-1;q=0.6, *;q=0.1 Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0 Referer: http://duple:8440/vspx/custom_format.vspx Connection: Keep-Alive, TE TE: deflate, gzip, chunked, identity, trailers Content-type: application/x-www-form-urlencoded Content-length: 365 page__vspx_custom__format_vspx_view_state=wbwGtR5wYWdlX192c3B4X2N1c3RvbV9fZm9ybWF0X3ZzcHjBvAS1CGVtcGxveWVltQZGdWxs%0D%0AZXK1BXJlYWxttQC1CWRhdGFfc2V0McG8B7UlwbwCwbwDvQAAKGO1BU1FUkVQvALBvAO9AAAo%0D%0AY7UFTUVSRVC8ArUBzLwKzLwBvAG8ALUSZGF0YV9zZXQxX2FkZF9mb3JtwbwBtQA%3D&sid=&realm=&data_set1_add_field_0=&data_set1_add_field_2=&data_set1_add_field_3=&data_set1_next=Next
{ "pile_set_name": "Github" }
// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++11 struct S { virtual ~S(); void g() throw (auto(*)()->int); // Note, this is not permitted: conversion-declarator cannot have a trailing return type. // FIXME: don't issue the second diagnostic for this. operator auto(*)()->int(); // expected-error{{'auto' not allowed here}} expected-error {{C++ requires a type specifier}} }; typedef auto Fun(int a) -> decltype(a + a); typedef auto (*PFun)(int a) -> decltype(a + a); void g(auto (*f)() -> int) { try { } catch (auto (&f)() -> int) { } catch (auto (*const f[10])() -> int) { } } namespace std { class type_info; } template<typename T> struct U {}; void j() { (void)typeid(auto(*)()->void); (void)sizeof(auto(*)()->void); (void)__alignof(auto(*)()->void); U<auto(*)()->void> v; int n; (void)static_cast<auto(*)()->void>(&j); auto p = reinterpret_cast<auto(*)()->int>(&j); (void)const_cast<auto(**)()->int>(&p); (void)(auto(*)()->void)(&j); } template <auto (*f)() -> void = &j> class C { }; struct F : auto(*)()->int {}; // expected-error{{expected class name}} template<typename T = auto(*)()->int> struct G { }; int g(); auto (*h)() -> auto = &g; // expected-error{{'auto' not allowed in function return type}} auto (*i)() = &g; // ok; auto deduced as int. auto (*k)() -> int = i; // ok; no deduction.
{ "pile_set_name": "Github" }
using System.Collections.Generic; namespace HotChocolate.Data.Sorting { public static class SortVisitorContextExtensions { public static void ReportError<T> (this ISortVisitorContext<T> context, IError error) => context.Errors.Add(error); public static T GetInstance<T>( this ISortVisitorContext<T> context) => context.Instance.Peek(); public static void PushInstance<T>( this ISortVisitorContext<T> context, T nextExpression) => context.Instance.Push(nextExpression); public static T PopInstance<T>(this ISortVisitorContext<T> context) => context.Instance.Pop(); } }
{ "pile_set_name": "Github" }
#!/bin/bash set -e set -o pipefail STARTUP_PATH=$(pwd) TMP_DIR_NAME=$(basename $0) USAGE_MESSAGE="USAGE: $0 <CLUSTER_NAMESPACE> <SQL_MASTER_ENDPOINT> <KNOX_ENDPOINT> [--install-extra-samples] [SQL_MASTER_PORT] [KNOX_PORT] To use basic authentication please set AZDATA_USERNAME and AZDATA_PASSWORD environment variables. To use integrated authentication provide the DNS names for the endpoints. Port can be specified separately if using non-default values." ERROR_MESSAGE="Bootstrap of the sample database failed. Output and error files are in directory [/tmp/$TMP_DIR_NAME]." # Print usage if mandatory parameters are missing : "${1:?$USAGE_MESSAGE}" : "${2:?$USAGE_MESSAGE}" : "${3:?$USAGE_MESSAGE}" : "${DEBUG=}" # Save the input parameters CLUSTER_NAMESPACE=$1 SQL_MASTER_ENDPOINT=$2 KNOX_ENDPOINT=$3 AW_WWI_SAMPLES=$4 SQL_MASTER_PORT=$5 KNOX_PORT=$6 # Skip if extra samples doesn't need to be installed AW_WWI_SAMPLES=${AW_WWI_SAMPLES:=no} # Use default ports if not specified SQL_MASTER_PORT=${SQL_MASTER_PORT:=31433} KNOX_PORT=${KNOX_PORT:=30443} SQL_MASTER_INSTANCE=$SQL_MASTER_ENDPOINT,$SQL_MASTER_PORT KNOX_ENDPOINT=$KNOX_ENDPOINT:$KNOX_PORT # Set username/password variables export SQLCMDSERVER=$SQL_MASTER_INSTANCE export SQLCMDUSER=$AZDATA_USERNAME export SQLCMDPASSWORD=$AZDATA_PASSWORD KNOX_PASSWORD=$AZDATA_PASSWORD if [ -z SQLCMDUSER ] then BCP_CREDENTIALS="-T" else BCP_CREDENTIALS="-U$SQLCMDUSER -P$SQLCMDPASSWORD" fi for util in sqlcmd bcp kubectl curl do echo Verifying $util is in path & which $util 1>/dev/null 2>/dev/null || (echo Unable to locate $util && exit 1) done # Copy the backup file, restore the database, create necessary objects and data file pushd "/tmp" > /dev/null $DEBUG mkdir -p "$TMP_DIR_NAME" $DEBUG cd "$TMP_DIR_NAME" if [ ! -f tpcxbb_1gb.bak ] then echo Downloading sample database backup file... $DEBUG curl -G "https://sqlchoice.blob.core.windows.net/sqlchoice/static/tpcxbb_1gb.bak" -o tpcxbb_1gb.bak fi read -r MASTER_POD_NAME HADR_ENABLED <<<$(sqlcmd -I -b -h-1 -W -Q "SET NOCOUNT ON; SELECT @@SERVERNAME, SERVERPROPERTY('IsHadrEnabled');") if [ -z $MASTER_POD_NAME ] then echo $ERROR_MESSAGE exit 1 fi echo Copying sales database backup file... $DEBUG kubectl cp tpcxbb_1gb.bak $CLUSTER_NAMESPACE/$MASTER_POD_NAME:var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1) if [ "$AW_WWI_SAMPLES" == "--install-extra-samples" ] then for file in AdventureWorks2016_EXT.bak AdventureWorksDW2016_EXT.bak do if [ ! -f $file ] then echo Downloading $file sample database backup file... $DEBUG curl -L -G "https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/$file" -o $file fi echo Copying $file database backup file to SQL Master instance... $DEBUG kubectl cp $file $CLUSTER_NAMESPACE/$MASTER_POD_NAME:var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1) done for file in WideWorldImporters-Full.bak WideWorldImportersDW-Full.bak do if [ ! -f $file ] then echo Downloading $file sample database backup file... $DEBUG curl -L -G "https://github.com/Microsoft/sql-server-samples/releases/download/wide-world-importers-v1.0/$file" -o $file fi echo Copying $file database backup file to SQL Master instance... $DEBUG kubectl cp $file $CLUSTER_NAMESPACE/$MASTER_POD_NAME:var/opt/mssql/data -c mssql-server || (echo $ERROR_MESSAGE && exit 1) done fi # If HADR is enabled then port-forward 1533 temporarily to connect to the primary directly # Default timeout for port-forward is 5 minutes so start command in background & it will terminate automatically if [ "$HADR_ENABLED" == "1" ] then $DEBUG kubectl port-forward pods/$MASTER_POD_NAME 1533:1533 -n $CLUSTER_NAMESPACE & PROC_ID=$! SQLCMDSERVER=127.0.0.1,1533 fi echo Configuring sample database... $DEBUG sqlcmd -I -b -i "$STARTUP_PATH/bootstrap-sample-db.sql" -o "bootstrap.out" || (echo $ERROR_MESSAGE && kill -9 $PROC_ID > /dev/null && exit 2) # remove files copied into the pod: echo "Removing database backup file(s)..." $DEBUG kubectl exec $MASTER_POD_NAME -n $CLUSTER_NAMESPACE -c mssql-server -i -t -- bash -c "rm -rvf /var/opt/mssql/data/tpcxbb_1gb.bak" if [ "$AW_WWI_SAMPLES" == "--install-extra-samples" ] then for file in AdventureWorks2016_EXT.bak AdventureWorksDW2016_EXT.bak do $DEBUG kubectl exec $MASTER_POD_NAME -n $CLUSTER_NAMESPACE -c mssql-server -i -t -- bash -c "rm -rvf /var/opt/mssql/data/$file" done for file in WideWorldImporters-Full.bak WideWorldImportersDW-Full.bak do $DEBUG kubectl exec $MASTER_POD_NAME -n $CLUSTER_NAMESPACE -c mssql-server -i -t -- bash -c "rm -rvf /var/opt/mssql/data/$file" done fi for table in web_clickstreams inventory customer do echo Exporting $table data... if [ $table == web_clickstreams ] then DELIMITER=, else DELIMITER="|" fi # WSL ex: "/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/130/Tools/Binn/bcp.exe" if [ ! -f $table.csv ] then $DEBUG bcp sales.dbo.$table out "$table.csv" -S $SQLCMDSERVER $BCP_CREDENTIALS -c -t"$DELIMITER" -e "$table.err" > "$table.out" || (echo $ERROR_MESSAGE && kill -9 $PROC_ID > /dev/null && exit 3) fi done if [ ! -f product_reviews.csv ] then echo Exporting product_reviews data... $DEBUG bcp "select pr_review_sk, replace(replace(pr_review_content, ',', ';'), char(34), '') as pr_review_content from sales.dbo.product_reviews" queryout "product_reviews.csv" -S $SQLCMDSERVER $BCP_CREDENTIALS -c -t, -e "product_reviews.err" > "$table.out" || (echo $ERROR_MESSAGE && kill -9 $PROC_ID > /dev/null && exit 3) fi if [[ $PROC_ID ]] then kill -9 $PROC_ID > /dev/null fi # Copy the data file to HDFS echo Uploading web_clickstreams data to HDFS... if [[ $KNOX_PASSWORD ]] then $DEBUG curl -s -S -L -k -u root:$KNOX_PASSWORD -X PUT "https://$KNOX_ENDPOINT/gateway/default/webhdfs/v1/clickstream_data?op=MKDIRS" 1>/dev/null || (echo $ERROR_MESSAGE && exit 4) $DEBUG curl -s -S -L -k -u root:$KNOX_PASSWORD -X PUT "https://$KNOX_ENDPOINT/gateway/default/webhdfs/v1/clickstream_data/web_clickstreams.csv?op=create&overwrite=true" -H 'Content-Type: application/octet-stream' -T "web_clickstreams.csv" 1>/dev/null || (echo $ERROR_MESSAGE && exit 5) else $DEBUG curl -s -S -L -k -u : --negotiate -X PUT "https://$KNOX_ENDPOINT/gateway/default/webhdfs/v1/clickstream_data?op=MKDIRS" 1>/dev/null || (echo $ERROR_MESSAGE && exit 4) $DEBUG curl -s -S -L -k -u : --negotiate -X PUT "https://$KNOX_ENDPOINT/gateway/default/webhdfs/v1/clickstream_data/web_clickstreams.csv?op=create&overwrite=true" -H 'Content-Type: application/octet-stream' -T "web_clickstreams.csv" 1>/dev/null || (echo $ERROR_MESSAGE && exit 5) fi #$DEBUG rm -f web_clickstreams.* echo Uploading product_reviews data to HDFS... if [[ $KNOX_PASSWORD ]] then $DEBUG curl -s -S -L -k -u root:$KNOX_PASSWORD -X PUT "https://$KNOX_ENDPOINT/gateway/default/webhdfs/v1/product_review_data?op=MKDIRS" 1>/dev/null || (echo $ERROR_MESSAGE && exit 6) $DEBUG curl -s -S -L -k -u root:$KNOX_PASSWORD -X PUT "https://$KNOX_ENDPOINT/gateway/default/webhdfs/v1/product_review_data/product_reviews.csv?op=create&overwrite=true" -H "Content-Type: application/octet-stream" -T "product_reviews.csv" 1>/dev/null || (echo $ERROR_MESSAGE && exit 7) else $DEBUG curl -s -S -L -k -u : --negotiate -X PUT "https://$KNOX_ENDPOINT/gateway/default/webhdfs/v1/product_review_data?op=MKDIRS" 1>/dev/null || (echo $ERROR_MESSAGE && exit 6) $DEBUG curl -s -S -L -k -u : --negotiate -X PUT "https://$KNOX_ENDPOINT/gateway/default/webhdfs/v1/product_review_data/product_reviews.csv?op=create&overwrite=true" -H "Content-Type: application/octet-stream" -T "product_reviews.csv" 1>/dev/null || (echo $ERROR_MESSAGE && exit 7) fi #$DEBUG rm -f product_reviews.* echo Bootstrap of the sample database completed successfully. echo Data files for Oracle setup are located at [/tmp/$TMP_DIR_NAME]. # $DEBUG rm -f *.out *.err *.csv popd exit 0
{ "pile_set_name": "Github" }
SUBROUTINE eomccsdtq_y3_11_2_2(d_a,k_a_offset,d_b,k_b_offset,d_c,k &_c_offset) C $Id$ C This is a Fortran77 program generated by Tensor Contraction Engine v.1.0 C Copyright (c) Battelle & Pacific Northwest National Laboratory (2002) C i2 ( h4 h11 h13 h16 )_vt + = 2 * Sum ( p7 ) * t ( p7 h16 )_t * i3 ( h4 h11 h13 p7 )_v IMPLICIT NONE #include "global.fh" #include "mafdecls.fh" #include "sym.fh" #include "errquit.fh" #include "tce.fh" INTEGER d_a INTEGER k_a_offset INTEGER d_b INTEGER k_b_offset INTEGER d_c INTEGER k_c_offset INTEGER NXTASK INTEGER next INTEGER nprocs INTEGER count INTEGER h4b INTEGER h11b INTEGER h16b INTEGER h13b INTEGER dimc INTEGER l_c_sort INTEGER k_c_sort INTEGER p7b INTEGER p7b_1 INTEGER h16b_1 INTEGER h4b_2 INTEGER h11b_2 INTEGER h13b_2 INTEGER p7b_2 INTEGER dim_common INTEGER dima_sort INTEGER dima INTEGER dimb_sort INTEGER dimb INTEGER l_a_sort INTEGER k_a_sort INTEGER l_a INTEGER k_a INTEGER l_b_sort INTEGER k_b_sort INTEGER l_b INTEGER k_b INTEGER l_c INTEGER k_c EXTERNAL NXTASK nprocs = GA_NNODES() count = 0 next = NXTASK(nprocs,1) DO h4b = 1,noab DO h11b = 1,noab DO h16b = 1,noab DO h13b = 1,noab IF (next.eq.count) THEN IF ((.not.restricted).or.(int_mb(k_spin+h4b-1)+int_mb(k_spin+h11b- &1)+int_mb(k_spin+h13b-1)+int_mb(k_spin+h16b-1).ne.8)) THEN IF (int_mb(k_spin+h4b-1)+int_mb(k_spin+h11b-1) .eq. int_mb(k_spin+ &h13b-1)+int_mb(k_spin+h16b-1)) THEN IF (ieor(int_mb(k_sym+h4b-1),ieor(int_mb(k_sym+h11b-1),ieor(int_mb &(k_sym+h13b-1),int_mb(k_sym+h16b-1)))) .eq. ieor(irrep_v,irrep_t)) & THEN dimc = int_mb(k_range+h4b-1) * int_mb(k_range+h11b-1) * int_mb(k_r &ange+h13b-1) * int_mb(k_range+h16b-1) IF (.not.MA_PUSH_GET(mt_dbl,dimc,'noname',l_c_sort,k_c_sort)) CALL & ERRQUIT('eomccsdtq_y3_11_2_2',0,MA_ERR) CALL DFILL(dimc,0.0d0,dbl_mb(k_c_sort),1) DO p7b = noab+1,noab+nvab IF (int_mb(k_spin+p7b-1) .eq. int_mb(k_spin+h16b-1)) THEN IF (ieor(int_mb(k_sym+p7b-1),int_mb(k_sym+h16b-1)) .eq. irrep_t) T &HEN CALL TCE_RESTRICTED_2(p7b,h16b,p7b_1,h16b_1) CALL TCE_RESTRICTED_4(h4b,h11b,h13b,p7b,h4b_2,h11b_2,h13b_2,p7b_2) dim_common = int_mb(k_range+p7b-1) dima_sort = int_mb(k_range+h16b-1) dima = dim_common * dima_sort dimb_sort = int_mb(k_range+h4b-1) * int_mb(k_range+h11b-1) * int_m &b(k_range+h13b-1) dimb = dim_common * dimb_sort IF ((dima .gt. 0) .and. (dimb .gt. 0)) THEN IF (.not.MA_PUSH_GET(mt_dbl,dima,'noname',l_a_sort,k_a_sort)) CALL & ERRQUIT('eomccsdtq_y3_11_2_2',1,MA_ERR) IF (.not.MA_PUSH_GET(mt_dbl,dima,'noname',l_a,k_a)) CALL ERRQUIT(' &eomccsdtq_y3_11_2_2',2,MA_ERR) CALL GET_HASH_BLOCK(d_a,dbl_mb(k_a),dima,int_mb(k_a_offset),(h16b_ &1 - 1 + noab * (p7b_1 - noab - 1))) CALL TCE_SORT_2(dbl_mb(k_a),dbl_mb(k_a_sort),int_mb(k_range+p7b-1) &,int_mb(k_range+h16b-1),2,1,1.0d0) IF (.not.MA_POP_STACK(l_a)) CALL ERRQUIT('eomccsdtq_y3_11_2_2',3,M &A_ERR) IF (.not.MA_PUSH_GET(mt_dbl,dimb,'noname',l_b_sort,k_b_sort)) CALL & ERRQUIT('eomccsdtq_y3_11_2_2',4,MA_ERR) IF (.not.MA_PUSH_GET(mt_dbl,dimb,'noname',l_b,k_b)) CALL ERRQUIT(' &eomccsdtq_y3_11_2_2',5,MA_ERR) IF ((h13b .le. p7b)) THEN CALL GET_HASH_BLOCK(d_b,dbl_mb(k_b),dimb,int_mb(k_b_offset),(p7b_2 & - noab - 1 + nvab * (h13b_2 - 1 + noab * (h11b_2 - 1 + noab * (h4 &b_2 - 1))))) CALL TCE_SORT_4(dbl_mb(k_b),dbl_mb(k_b_sort),int_mb(k_range+h4b-1) &,int_mb(k_range+h11b-1),int_mb(k_range+h13b-1),int_mb(k_range+p7b- &1),3,2,1,4,1.0d0) END IF IF (.not.MA_POP_STACK(l_b)) CALL ERRQUIT('eomccsdtq_y3_11_2_2',6,M &A_ERR) CALL DGEMM('T','N',dima_sort,dimb_sort,dim_common,1.0d0,dbl_mb(k_a &_sort),dim_common,dbl_mb(k_b_sort),dim_common,1.0d0,dbl_mb(k_c_sor &t),dima_sort) IF (.not.MA_POP_STACK(l_b_sort)) CALL ERRQUIT('eomccsdtq_y3_11_2_2 &',7,MA_ERR) IF (.not.MA_POP_STACK(l_a_sort)) CALL ERRQUIT('eomccsdtq_y3_11_2_2 &',8,MA_ERR) END IF END IF END IF END DO IF (.not.MA_PUSH_GET(mt_dbl,dimc,'noname',l_c,k_c)) CALL ERRQUIT(' &eomccsdtq_y3_11_2_2',9,MA_ERR) IF ((h13b .le. h16b)) THEN CALL TCE_SORT_4(dbl_mb(k_c_sort),dbl_mb(k_c),int_mb(k_range+h13b-1 &),int_mb(k_range+h11b-1),int_mb(k_range+h4b-1),int_mb(k_range+h16b &-1),3,2,1,4,1.0d0) CALL ADD_HASH_BLOCK(d_c,dbl_mb(k_c),dimc,int_mb(k_c_offset),(h16b &- 1 + noab * (h13b - 1 + noab * (h11b - 1 + noab * (h4b - 1))))) END IF IF ((h16b .le. h13b)) THEN CALL TCE_SORT_4(dbl_mb(k_c_sort),dbl_mb(k_c),int_mb(k_range+h13b-1 &),int_mb(k_range+h11b-1),int_mb(k_range+h4b-1),int_mb(k_range+h16b &-1),3,2,4,1,-1.0d0) CALL ADD_HASH_BLOCK(d_c,dbl_mb(k_c),dimc,int_mb(k_c_offset),(h13b &- 1 + noab * (h16b - 1 + noab * (h11b - 1 + noab * (h4b - 1))))) END IF IF (.not.MA_POP_STACK(l_c)) CALL ERRQUIT('eomccsdtq_y3_11_2_2',10, &MA_ERR) IF (.not.MA_POP_STACK(l_c_sort)) CALL ERRQUIT('eomccsdtq_y3_11_2_2 &',11,MA_ERR) END IF END IF END IF next = NXTASK(nprocs,1) END IF count = count + 1 END DO END DO END DO END DO next = NXTASK(-nprocs,1) call GA_SYNC() RETURN END
{ "pile_set_name": "Github" }
// Copyright (c) 2017 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "source/opt/propagator.h" namespace spvtools { namespace opt { void SSAPropagator::AddControlEdge(const Edge& edge) { BasicBlock* dest_bb = edge.dest; // Refuse to add the exit block to the work list. if (dest_bb == ctx_->cfg()->pseudo_exit_block()) { return; } // Try to mark the edge executable. If it was already in the set of // executable edges, do nothing. if (!MarkEdgeExecutable(edge)) { return; } // If the edge had not already been marked executable, add the destination // basic block to the work list. blocks_.push(dest_bb); } void SSAPropagator::AddSSAEdges(Instruction* instr) { // Ignore instructions that produce no result. if (instr->result_id() == 0) { return; } get_def_use_mgr()->ForEachUser( instr->result_id(), [this](Instruction* use_instr) { // If the basic block for |use_instr| has not been simulated yet, do // nothing. The instruction |use_instr| will be simulated next time the // block is scheduled. if (!BlockHasBeenSimulated(ctx_->get_instr_block(use_instr))) { return; } if (ShouldSimulateAgain(use_instr)) { ssa_edge_uses_.push(use_instr); } }); } bool SSAPropagator::IsPhiArgExecutable(Instruction* phi, uint32_t i) const { BasicBlock* phi_bb = ctx_->get_instr_block(phi); uint32_t in_label_id = phi->GetSingleWordOperand(i + 1); Instruction* in_label_instr = get_def_use_mgr()->GetDef(in_label_id); BasicBlock* in_bb = ctx_->get_instr_block(in_label_instr); return IsEdgeExecutable(Edge(in_bb, phi_bb)); } bool SSAPropagator::SetStatus(Instruction* inst, PropStatus status) { bool has_old_status = false; PropStatus old_status = kVarying; if (HasStatus(inst)) { has_old_status = true; old_status = Status(inst); } assert((!has_old_status || old_status <= status) && "Invalid lattice transition"); bool status_changed = !has_old_status || (old_status != status); if (status_changed) statuses_[inst] = status; return status_changed; } bool SSAPropagator::Simulate(Instruction* instr) { bool changed = false; // Don't bother visiting instructions that should not be simulated again. if (!ShouldSimulateAgain(instr)) { return changed; } BasicBlock* dest_bb = nullptr; PropStatus status = visit_fn_(instr, &dest_bb); bool status_changed = SetStatus(instr, status); if (status == kVarying) { // The statement produces a varying result, add it to the list of statements // not to simulate anymore and add its SSA def-use edges for simulation. DontSimulateAgain(instr); if (status_changed) { AddSSAEdges(instr); } // If |instr| is a block terminator, add all the control edges out of its // block. if (instr->IsBlockTerminator()) { BasicBlock* block = ctx_->get_instr_block(instr); for (const auto& e : bb_succs_.at(block)) { AddControlEdge(e); } } return false; } else if (status == kInteresting) { // Add the SSA edges coming out of this instruction if the propagation // status has changed. if (status_changed) { AddSSAEdges(instr); } // If there are multiple outgoing control flow edges and we know which one // will be taken, add the destination block to the CFG work list. if (dest_bb) { AddControlEdge(Edge(ctx_->get_instr_block(instr), dest_bb)); } changed = true; } // At this point, we are dealing with instructions that are in status // kInteresting or kNotInteresting. To decide whether this instruction should // be simulated again, we examine its operands. If at least one operand O is // defined at an instruction D that should be simulated again, then the output // of D might affect |instr|, so we should simulate |instr| again. bool has_operands_to_simulate = false; if (instr->opcode() == SpvOpPhi) { // For Phi instructions, an operand causes the Phi to be simulated again if // the operand comes from an edge that has not yet been traversed or if its // definition should be simulated again. for (uint32_t i = 2; i < instr->NumOperands(); i += 2) { // Phi arguments come in pairs. Index 'i' contains the // variable id, index 'i + 1' is the originating block id. assert(i % 2 == 0 && i < instr->NumOperands() - 1 && "malformed Phi arguments"); uint32_t arg_id = instr->GetSingleWordOperand(i); Instruction* arg_def_instr = get_def_use_mgr()->GetDef(arg_id); if (!IsPhiArgExecutable(instr, i) || ShouldSimulateAgain(arg_def_instr)) { has_operands_to_simulate = true; break; } } } else { // For regular instructions, check if the defining instruction of each // operand needs to be simulated again. If so, then this instruction should // also be simulated again. has_operands_to_simulate = !instr->WhileEachInId([this](const uint32_t* use) { Instruction* def_instr = get_def_use_mgr()->GetDef(*use); if (ShouldSimulateAgain(def_instr)) { return false; } return true; }); } if (!has_operands_to_simulate) { DontSimulateAgain(instr); } return changed; } bool SSAPropagator::Simulate(BasicBlock* block) { if (block == ctx_->cfg()->pseudo_exit_block()) { return false; } // Always simulate Phi instructions, even if we have simulated this block // before. We do this because Phi instructions receive their inputs from // incoming edges. When those edges are marked executable, the corresponding // operand can be simulated. bool changed = false; block->ForEachPhiInst( [&changed, this](Instruction* instr) { changed |= Simulate(instr); }); // If this is the first time this block is being simulated, simulate every // statement in it. if (!BlockHasBeenSimulated(block)) { block->ForEachInst([this, &changed](Instruction* instr) { if (instr->opcode() != SpvOpPhi) { changed |= Simulate(instr); } }); MarkBlockSimulated(block); // If this block has exactly one successor, mark the edge to its successor // as executable. if (bb_succs_.at(block).size() == 1) { AddControlEdge(bb_succs_.at(block).at(0)); } } return changed; } void SSAPropagator::Initialize(Function* fn) { // Compute predecessor and successor blocks for every block in |fn|'s CFG. // TODO(dnovillo): Move this to CFG and always build them. Alternately, // move it to IRContext and build CFG preds/succs on-demand. bb_succs_[ctx_->cfg()->pseudo_entry_block()].push_back( Edge(ctx_->cfg()->pseudo_entry_block(), fn->entry().get())); for (auto& block : *fn) { const auto& const_block = block; const_block.ForEachSuccessorLabel([this, &block](const uint32_t label_id) { BasicBlock* succ_bb = ctx_->get_instr_block(get_def_use_mgr()->GetDef(label_id)); bb_succs_[&block].push_back(Edge(&block, succ_bb)); bb_preds_[succ_bb].push_back(Edge(succ_bb, &block)); }); if (block.IsReturnOrAbort()) { bb_succs_[&block].push_back( Edge(&block, ctx_->cfg()->pseudo_exit_block())); bb_preds_[ctx_->cfg()->pseudo_exit_block()].push_back( Edge(ctx_->cfg()->pseudo_exit_block(), &block)); } } // Add the edges out of the entry block to seed the propagator. const auto& entry_succs = bb_succs_[ctx_->cfg()->pseudo_entry_block()]; for (const auto& e : entry_succs) { AddControlEdge(e); } } bool SSAPropagator::Run(Function* fn) { Initialize(fn); bool changed = false; while (!blocks_.empty() || !ssa_edge_uses_.empty()) { // Simulate all blocks first. Simulating blocks will add SSA edges to // follow after all the blocks have been simulated. if (!blocks_.empty()) { auto block = blocks_.front(); changed |= Simulate(block); blocks_.pop(); continue; } // Simulate edges from the SSA queue. if (!ssa_edge_uses_.empty()) { Instruction* instr = ssa_edge_uses_.front(); changed |= Simulate(instr); ssa_edge_uses_.pop(); } } #ifndef NDEBUG // Verify all visited values have settled. No value that has been simulated // should end on not interesting. fn->ForEachInst([this](Instruction* inst) { assert( (!HasStatus(inst) || Status(inst) != SSAPropagator::kNotInteresting) && "Unsettled value"); }); #endif return changed; } std::ostream& operator<<(std::ostream& str, const SSAPropagator::PropStatus& status) { switch (status) { case SSAPropagator::kVarying: str << "Varying"; break; case SSAPropagator::kInteresting: str << "Interesting"; break; default: str << "Not interesting"; break; } return str; } } // namespace opt } // namespace spvtools
{ "pile_set_name": "Github" }
# Mustache Mustache files are compiled with Twitter's wonderful [hogan.js](https://github.com/twitter/hogan.js). This is a fantastic compiler that easily supports client-side templates and has very straightforward options and good compile speed. The options you can pass can be [found here](https://github.com/twitter/hogan.js#compilation-options) and exactly mirror hogan's docs, other than `asString`, which is not necessary as this is covered by accord's adapter API. It should be noted that when running a compile or client compile, hogan returns an object rather than a function like some of the other compilers. To render the template, you need to call `render`, as can be seen in the [simple example here](https://github.com/twitter/hogan.js#basics). Hogan also has an interesting way of handling partials -- rather than being able to use `{{> partial }}` to point to a filename, you have to pass the partial content to the template when it is rendered. To pass partials, just add a special key to your options object called `partials`, which contains an object with keys as partial names and values as partial contents (mustache logic-enabled). For example: ```js accord.render("{{> title }}", { partials: { title: 'hello world!'} }) ``` ## Supported Methods - render - compile - compileClient - clientHelpers
{ "pile_set_name": "Github" }
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member using System; using System.Threading; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; namespace Cysharp.Threading.Tasks { public static partial class UnityAsyncExtensions { public static AsyncUnityEventHandler GetAsyncEventHandler(this UnityEvent unityEvent, CancellationToken cancellationToken) { return new AsyncUnityEventHandler(unityEvent, cancellationToken, false); } public static UniTask OnInvokeAsync(this UnityEvent unityEvent, CancellationToken cancellationToken) { return new AsyncUnityEventHandler(unityEvent, cancellationToken, true).OnInvokeAsync(); } public static IUniTaskAsyncEnumerable<AsyncUnit> OnInvokeAsAsyncEnumerable(this UnityEvent unityEvent, CancellationToken cancellationToken) { return new UnityEventHandlerAsyncEnumerable(unityEvent, cancellationToken); } public static AsyncUnityEventHandler<T> GetAsyncEventHandler<T>(this UnityEvent<T> unityEvent, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<T>(unityEvent, cancellationToken, false); } public static UniTask<T> OnInvokeAsync<T>(this UnityEvent<T> unityEvent, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<T>(unityEvent, cancellationToken, true).OnInvokeAsync(); } public static IUniTaskAsyncEnumerable<T> OnInvokeAsAsyncEnumerable<T>(this UnityEvent<T> unityEvent, CancellationToken cancellationToken) { return new UnityEventHandlerAsyncEnumerable<T>(unityEvent, cancellationToken); } public static IAsyncClickEventHandler GetAsyncClickEventHandler(this Button button) { return new AsyncUnityEventHandler(button.onClick, button.GetCancellationTokenOnDestroy(), false); } public static IAsyncClickEventHandler GetAsyncClickEventHandler(this Button button, CancellationToken cancellationToken) { return new AsyncUnityEventHandler(button.onClick, cancellationToken, false); } public static UniTask OnClickAsync(this Button button) { return new AsyncUnityEventHandler(button.onClick, button.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); } public static UniTask OnClickAsync(this Button button, CancellationToken cancellationToken) { return new AsyncUnityEventHandler(button.onClick, cancellationToken, true).OnInvokeAsync(); } public static IUniTaskAsyncEnumerable<AsyncUnit> OnClickAsAsyncEnumerable(this Button button) { return new UnityEventHandlerAsyncEnumerable(button.onClick, button.GetCancellationTokenOnDestroy()); } public static IUniTaskAsyncEnumerable<AsyncUnit> OnClickAsAsyncEnumerable(this Button button, CancellationToken cancellationToken) { return new UnityEventHandlerAsyncEnumerable(button.onClick, cancellationToken); } public static IAsyncValueChangedEventHandler<bool> GetAsyncValueChangedEventHandler(this Toggle toggle) { return new AsyncUnityEventHandler<bool>(toggle.onValueChanged, toggle.GetCancellationTokenOnDestroy(), false); } public static IAsyncValueChangedEventHandler<bool> GetAsyncValueChangedEventHandler(this Toggle toggle, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<bool>(toggle.onValueChanged, cancellationToken, false); } public static UniTask<bool> OnValueChangedAsync(this Toggle toggle) { return new AsyncUnityEventHandler<bool>(toggle.onValueChanged, toggle.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); } public static UniTask<bool> OnValueChangedAsync(this Toggle toggle, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<bool>(toggle.onValueChanged, cancellationToken, true).OnInvokeAsync(); } public static IUniTaskAsyncEnumerable<bool> OnValueChangedAsAsyncEnumerable(this Toggle toggle) { return new UnityEventHandlerAsyncEnumerable<bool>(toggle.onValueChanged, toggle.GetCancellationTokenOnDestroy()); } public static IUniTaskAsyncEnumerable<bool> OnValueChangedAsAsyncEnumerable(this Toggle toggle, CancellationToken cancellationToken) { return new UnityEventHandlerAsyncEnumerable<bool>(toggle.onValueChanged, cancellationToken); } public static IAsyncValueChangedEventHandler<float> GetAsyncValueChangedEventHandler(this Scrollbar scrollbar) { return new AsyncUnityEventHandler<float>(scrollbar.onValueChanged, scrollbar.GetCancellationTokenOnDestroy(), false); } public static IAsyncValueChangedEventHandler<float> GetAsyncValueChangedEventHandler(this Scrollbar scrollbar, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<float>(scrollbar.onValueChanged, cancellationToken, false); } public static UniTask<float> OnValueChangedAsync(this Scrollbar scrollbar) { return new AsyncUnityEventHandler<float>(scrollbar.onValueChanged, scrollbar.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); } public static UniTask<float> OnValueChangedAsync(this Scrollbar scrollbar, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<float>(scrollbar.onValueChanged, cancellationToken, true).OnInvokeAsync(); } public static IUniTaskAsyncEnumerable<float> OnValueChangedAsAsyncEnumerable(this Scrollbar scrollbar) { return new UnityEventHandlerAsyncEnumerable<float>(scrollbar.onValueChanged, scrollbar.GetCancellationTokenOnDestroy()); } public static IUniTaskAsyncEnumerable<float> OnValueChangedAsAsyncEnumerable(this Scrollbar scrollbar, CancellationToken cancellationToken) { return new UnityEventHandlerAsyncEnumerable<float>(scrollbar.onValueChanged, cancellationToken); } public static IAsyncValueChangedEventHandler<Vector2> GetAsyncValueChangedEventHandler(this ScrollRect scrollRect) { return new AsyncUnityEventHandler<Vector2>(scrollRect.onValueChanged, scrollRect.GetCancellationTokenOnDestroy(), false); } public static IAsyncValueChangedEventHandler<Vector2> GetAsyncValueChangedEventHandler(this ScrollRect scrollRect, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<Vector2>(scrollRect.onValueChanged, cancellationToken, false); } public static UniTask<Vector2> OnValueChangedAsync(this ScrollRect scrollRect) { return new AsyncUnityEventHandler<Vector2>(scrollRect.onValueChanged, scrollRect.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); } public static UniTask<Vector2> OnValueChangedAsync(this ScrollRect scrollRect, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<Vector2>(scrollRect.onValueChanged, cancellationToken, true).OnInvokeAsync(); } public static IUniTaskAsyncEnumerable<Vector2> OnValueChangedAsAsyncEnumerable(this ScrollRect scrollRect) { return new UnityEventHandlerAsyncEnumerable<Vector2>(scrollRect.onValueChanged, scrollRect.GetCancellationTokenOnDestroy()); } public static IUniTaskAsyncEnumerable<Vector2> OnValueChangedAsAsyncEnumerable(this ScrollRect scrollRect, CancellationToken cancellationToken) { return new UnityEventHandlerAsyncEnumerable<Vector2>(scrollRect.onValueChanged, cancellationToken); } public static IAsyncValueChangedEventHandler<float> GetAsyncValueChangedEventHandler(this Slider slider) { return new AsyncUnityEventHandler<float>(slider.onValueChanged, slider.GetCancellationTokenOnDestroy(), false); } public static IAsyncValueChangedEventHandler<float> GetAsyncValueChangedEventHandler(this Slider slider, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<float>(slider.onValueChanged, cancellationToken, false); } public static UniTask<float> OnValueChangedAsync(this Slider slider) { return new AsyncUnityEventHandler<float>(slider.onValueChanged, slider.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); } public static UniTask<float> OnValueChangedAsync(this Slider slider, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<float>(slider.onValueChanged, cancellationToken, true).OnInvokeAsync(); } public static IUniTaskAsyncEnumerable<float> OnValueChangedAsAsyncEnumerable(this Slider slider) { return new UnityEventHandlerAsyncEnumerable<float>(slider.onValueChanged, slider.GetCancellationTokenOnDestroy()); } public static IUniTaskAsyncEnumerable<float> OnValueChangedAsAsyncEnumerable(this Slider slider, CancellationToken cancellationToken) { return new UnityEventHandlerAsyncEnumerable<float>(slider.onValueChanged, cancellationToken); } public static IAsyncEndEditEventHandler<string> GetAsyncEndEditEventHandler(this InputField inputField) { return new AsyncUnityEventHandler<string>(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy(), false); } public static IAsyncEndEditEventHandler<string> GetAsyncEndEditEventHandler(this InputField inputField, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<string>(inputField.onEndEdit, cancellationToken, false); } public static UniTask<string> OnEndEditAsync(this InputField inputField) { return new AsyncUnityEventHandler<string>(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); } public static UniTask<string> OnEndEditAsync(this InputField inputField, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<string>(inputField.onEndEdit, cancellationToken, true).OnInvokeAsync(); } public static IUniTaskAsyncEnumerable<string> OnEndEditAsAsyncEnumerable(this InputField inputField) { return new UnityEventHandlerAsyncEnumerable<string>(inputField.onEndEdit, inputField.GetCancellationTokenOnDestroy()); } public static IUniTaskAsyncEnumerable<string> OnEndEditAsAsyncEnumerable(this InputField inputField, CancellationToken cancellationToken) { return new UnityEventHandlerAsyncEnumerable<string>(inputField.onEndEdit, cancellationToken); } public static IAsyncValueChangedEventHandler<string> GetAsyncValueChangedEventHandler(this InputField inputField) { return new AsyncUnityEventHandler<string>(inputField.onValueChanged, inputField.GetCancellationTokenOnDestroy(), false); } public static IAsyncValueChangedEventHandler<string> GetAsyncValueChangedEventHandler(this InputField inputField, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<string>(inputField.onValueChanged, cancellationToken, false); } public static UniTask<string> OnValueChangedAsync(this InputField inputField) { return new AsyncUnityEventHandler<string>(inputField.onValueChanged, inputField.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); } public static UniTask<string> OnValueChangedAsync(this InputField inputField, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<string>(inputField.onValueChanged, cancellationToken, true).OnInvokeAsync(); } public static IUniTaskAsyncEnumerable<string> OnValueChangedAsAsyncEnumerable(this InputField inputField) { return new UnityEventHandlerAsyncEnumerable<string>(inputField.onValueChanged, inputField.GetCancellationTokenOnDestroy()); } public static IUniTaskAsyncEnumerable<string> OnValueChangedAsAsyncEnumerable(this InputField inputField, CancellationToken cancellationToken) { return new UnityEventHandlerAsyncEnumerable<string>(inputField.onValueChanged, cancellationToken); } public static IAsyncValueChangedEventHandler<int> GetAsyncValueChangedEventHandler(this Dropdown dropdown) { return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy(), false); } public static IAsyncValueChangedEventHandler<int> GetAsyncValueChangedEventHandler(this Dropdown dropdown, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, cancellationToken, false); } public static UniTask<int> OnValueChangedAsync(this Dropdown dropdown) { return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy(), true).OnInvokeAsync(); } public static UniTask<int> OnValueChangedAsync(this Dropdown dropdown, CancellationToken cancellationToken) { return new AsyncUnityEventHandler<int>(dropdown.onValueChanged, cancellationToken, true).OnInvokeAsync(); } public static IUniTaskAsyncEnumerable<int> OnValueChangedAsAsyncEnumerable(this Dropdown dropdown) { return new UnityEventHandlerAsyncEnumerable<int>(dropdown.onValueChanged, dropdown.GetCancellationTokenOnDestroy()); } public static IUniTaskAsyncEnumerable<int> OnValueChangedAsAsyncEnumerable(this Dropdown dropdown, CancellationToken cancellationToken) { return new UnityEventHandlerAsyncEnumerable<int>(dropdown.onValueChanged, cancellationToken); } } public interface IAsyncClickEventHandler : IDisposable { UniTask OnClickAsync(); } public interface IAsyncValueChangedEventHandler<T> : IDisposable { UniTask<T> OnValueChangedAsync(); } public interface IAsyncEndEditEventHandler<T> : IDisposable { UniTask<T> OnEndEditAsync(); } // for TMP_PRO public interface IAsyncEndTextSelectionEventHandler<T> : IDisposable { UniTask<T> OnEndTextSelectionAsync(); } public interface IAsyncTextSelectionEventHandler<T> : IDisposable { UniTask<T> OnTextSelectionAsync(); } public interface IAsyncDeselectEventHandler<T> : IDisposable { UniTask<T> OnDeselectAsync(); } public interface IAsyncSelectEventHandler<T> : IDisposable { UniTask<T> OnSelectAsync(); } public interface IAsyncSubmitEventHandler<T> : IDisposable { UniTask<T> OnSubmitAsync(); } internal class TextSelectionEventConverter : UnityEvent<(string, int, int)>, IDisposable { readonly UnityEvent<string, int, int> innerEvent; readonly UnityAction<string, int, int> invokeDelegate; public TextSelectionEventConverter(UnityEvent<string, int, int> unityEvent) { this.innerEvent = unityEvent; this.invokeDelegate = InvokeCore; innerEvent.AddListener(invokeDelegate); } void InvokeCore(string item1, int item2, int item3) { innerEvent.Invoke(item1, item2, item3); } public void Dispose() { innerEvent.RemoveListener(invokeDelegate); } } public class AsyncUnityEventHandler : IUniTaskSource, IDisposable, IAsyncClickEventHandler { static Action<object> cancellationCallback = CancellationCallback; readonly UnityAction action; readonly UnityEvent unityEvent; CancellationToken cancellationToken; CancellationTokenRegistration registration; bool isDisposed; bool callOnce; UniTaskCompletionSourceCore<AsyncUnit> core; public AsyncUnityEventHandler(UnityEvent unityEvent, CancellationToken cancellationToken, bool callOnce) { if (cancellationToken.IsCancellationRequested) { isDisposed = true; return; } this.action = Invoke; this.unityEvent = unityEvent; this.cancellationToken = cancellationToken; this.callOnce = callOnce; unityEvent.AddListener(action); if (cancellationToken.CanBeCanceled) { registration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, this); } TaskTracker.TrackActiveTask(this, 3); } public UniTask OnInvokeAsync() { core.Reset(); return new UniTask(this, core.Version); } void Invoke() { core.TrySetResult(AsyncUnit.Default); } static void CancellationCallback(object state) { var self = (AsyncUnityEventHandler)state; self.Dispose(); } public void Dispose() { if (!isDisposed) { isDisposed = true; TaskTracker.RemoveTracking(this); registration.Dispose(); if (unityEvent != null) { unityEvent.RemoveListener(action); } core.TrySetCanceled(cancellationToken); } } UniTask IAsyncClickEventHandler.OnClickAsync() { return OnInvokeAsync(); } void IUniTaskSource.GetResult(short token) { try { core.GetResult(token); } finally { if (callOnce) { Dispose(); } } } UniTaskStatus IUniTaskSource.GetStatus(short token) { return core.GetStatus(token); } UniTaskStatus IUniTaskSource.UnsafeGetStatus() { return core.UnsafeGetStatus(); } void IUniTaskSource.OnCompleted(Action<object> continuation, object state, short token) { core.OnCompleted(continuation, state, token); } } public class AsyncUnityEventHandler<T> : IUniTaskSource<T>, IDisposable, IAsyncValueChangedEventHandler<T>, IAsyncEndEditEventHandler<T> , IAsyncEndTextSelectionEventHandler<T>, IAsyncTextSelectionEventHandler<T>, IAsyncDeselectEventHandler<T>, IAsyncSelectEventHandler<T>, IAsyncSubmitEventHandler<T> { static Action<object> cancellationCallback = CancellationCallback; readonly UnityAction<T> action; readonly UnityEvent<T> unityEvent; CancellationToken cancellationToken; CancellationTokenRegistration registration; bool isDisposed; bool callOnce; UniTaskCompletionSourceCore<T> core; public AsyncUnityEventHandler(UnityEvent<T> unityEvent, CancellationToken cancellationToken, bool callOnce) { if (cancellationToken.IsCancellationRequested) { isDisposed = true; return; } this.action = Invoke; this.unityEvent = unityEvent; this.cancellationToken = cancellationToken; this.callOnce = callOnce; unityEvent.AddListener(action); if (cancellationToken.CanBeCanceled) { registration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallback, this); } TaskTracker.TrackActiveTask(this, 3); } public UniTask<T> OnInvokeAsync() { core.Reset(); return new UniTask<T>(this, core.Version); } void Invoke(T result) { core.TrySetResult(result); } static void CancellationCallback(object state) { var self = (AsyncUnityEventHandler<T>)state; self.Dispose(); } public void Dispose() { if (!isDisposed) { isDisposed = true; TaskTracker.RemoveTracking(this); registration.Dispose(); if (unityEvent != null) { // Dispose inner delegate for TextSelectionEventConverter if (unityEvent is IDisposable disp) { disp.Dispose(); } unityEvent.RemoveListener(action); } core.TrySetCanceled(); } } UniTask<T> IAsyncValueChangedEventHandler<T>.OnValueChangedAsync() { return OnInvokeAsync(); } UniTask<T> IAsyncEndEditEventHandler<T>.OnEndEditAsync() { return OnInvokeAsync(); } UniTask<T> IAsyncEndTextSelectionEventHandler<T>.OnEndTextSelectionAsync() { return OnInvokeAsync(); } UniTask<T> IAsyncTextSelectionEventHandler<T>.OnTextSelectionAsync() { return OnInvokeAsync(); } UniTask<T> IAsyncDeselectEventHandler<T>.OnDeselectAsync() { return OnInvokeAsync(); } UniTask<T> IAsyncSelectEventHandler<T>.OnSelectAsync() { return OnInvokeAsync(); } UniTask<T> IAsyncSubmitEventHandler<T>.OnSubmitAsync() { return OnInvokeAsync(); } T IUniTaskSource<T>.GetResult(short token) { try { return core.GetResult(token); } finally { if (callOnce) { Dispose(); } } } void IUniTaskSource.GetResult(short token) { ((IUniTaskSource<T>)this).GetResult(token); } UniTaskStatus IUniTaskSource.GetStatus(short token) { return core.GetStatus(token); } UniTaskStatus IUniTaskSource.UnsafeGetStatus() { return core.UnsafeGetStatus(); } void IUniTaskSource.OnCompleted(Action<object> continuation, object state, short token) { core.OnCompleted(continuation, state, token); } } public class UnityEventHandlerAsyncEnumerable : IUniTaskAsyncEnumerable<AsyncUnit> { readonly UnityEvent unityEvent; readonly CancellationToken cancellationToken1; public UnityEventHandlerAsyncEnumerable(UnityEvent unityEvent, CancellationToken cancellationToken) { this.unityEvent = unityEvent; this.cancellationToken1 = cancellationToken; } public IUniTaskAsyncEnumerator<AsyncUnit> GetAsyncEnumerator(CancellationToken cancellationToken = default) { if (this.cancellationToken1 == cancellationToken) { return new UnityEventHandlerAsyncEnumerator(unityEvent, this.cancellationToken1, CancellationToken.None); } else { return new UnityEventHandlerAsyncEnumerator(unityEvent, this.cancellationToken1, cancellationToken); } } class UnityEventHandlerAsyncEnumerator : MoveNextSource, IUniTaskAsyncEnumerator<AsyncUnit> { static readonly Action<object> cancel1 = OnCanceled1; static readonly Action<object> cancel2 = OnCanceled2; readonly UnityEvent unityEvent; CancellationToken cancellationToken1; CancellationToken cancellationToken2; UnityAction unityAction; CancellationTokenRegistration registration1; CancellationTokenRegistration registration2; bool isDisposed; public UnityEventHandlerAsyncEnumerator(UnityEvent unityEvent, CancellationToken cancellationToken1, CancellationToken cancellationToken2) { this.unityEvent = unityEvent; this.cancellationToken1 = cancellationToken1; this.cancellationToken2 = cancellationToken2; } public AsyncUnit Current => default; public UniTask<bool> MoveNextAsync() { cancellationToken1.ThrowIfCancellationRequested(); cancellationToken2.ThrowIfCancellationRequested(); completionSource.Reset(); if (unityAction == null) { unityAction = Invoke; TaskTracker.TrackActiveTask(this, 3); unityEvent.AddListener(unityAction); if (cancellationToken1.CanBeCanceled) { registration1 = cancellationToken1.RegisterWithoutCaptureExecutionContext(cancel1, this); } if (cancellationToken2.CanBeCanceled) { registration2 = cancellationToken1.RegisterWithoutCaptureExecutionContext(cancel2, this); } } return new UniTask<bool>(this, completionSource.Version); } void Invoke() { completionSource.TrySetResult(true); } static void OnCanceled1(object state) { var self = (UnityEventHandlerAsyncEnumerator)state; self.DisposeAsync().Forget(); } static void OnCanceled2(object state) { var self = (UnityEventHandlerAsyncEnumerator)state; self.DisposeAsync().Forget(); } public UniTask DisposeAsync() { if (!isDisposed) { isDisposed = true; TaskTracker.RemoveTracking(this); registration1.Dispose(); registration2.Dispose(); unityEvent.RemoveListener(unityAction); } return default; } } } public class UnityEventHandlerAsyncEnumerable<T> : IUniTaskAsyncEnumerable<T> { readonly UnityEvent<T> unityEvent; readonly CancellationToken cancellationToken1; public UnityEventHandlerAsyncEnumerable(UnityEvent<T> unityEvent, CancellationToken cancellationToken) { this.unityEvent = unityEvent; this.cancellationToken1 = cancellationToken; } public IUniTaskAsyncEnumerator<T> GetAsyncEnumerator(CancellationToken cancellationToken = default) { if (this.cancellationToken1 == cancellationToken) { return new UnityEventHandlerAsyncEnumerator(unityEvent, this.cancellationToken1, CancellationToken.None); } else { return new UnityEventHandlerAsyncEnumerator(unityEvent, this.cancellationToken1, cancellationToken); } } class UnityEventHandlerAsyncEnumerator : MoveNextSource, IUniTaskAsyncEnumerator<T> { static readonly Action<object> cancel1 = OnCanceled1; static readonly Action<object> cancel2 = OnCanceled2; readonly UnityEvent<T> unityEvent; CancellationToken cancellationToken1; CancellationToken cancellationToken2; UnityAction<T> unityAction; CancellationTokenRegistration registration1; CancellationTokenRegistration registration2; bool isDisposed; public UnityEventHandlerAsyncEnumerator(UnityEvent<T> unityEvent, CancellationToken cancellationToken1, CancellationToken cancellationToken2) { this.unityEvent = unityEvent; this.cancellationToken1 = cancellationToken1; this.cancellationToken2 = cancellationToken2; } public T Current { get; private set; } public UniTask<bool> MoveNextAsync() { cancellationToken1.ThrowIfCancellationRequested(); cancellationToken2.ThrowIfCancellationRequested(); completionSource.Reset(); if (unityAction == null) { unityAction = Invoke; TaskTracker.TrackActiveTask(this, 3); unityEvent.AddListener(unityAction); if (cancellationToken1.CanBeCanceled) { registration1 = cancellationToken1.RegisterWithoutCaptureExecutionContext(cancel1, this); } if (cancellationToken2.CanBeCanceled) { registration2 = cancellationToken1.RegisterWithoutCaptureExecutionContext(cancel2, this); } } return new UniTask<bool>(this, completionSource.Version); } void Invoke(T value) { Current = value; completionSource.TrySetResult(true); } static void OnCanceled1(object state) { var self = (UnityEventHandlerAsyncEnumerator)state; self.DisposeAsync().Forget(); } static void OnCanceled2(object state) { var self = (UnityEventHandlerAsyncEnumerator)state; self.DisposeAsync().Forget(); } public UniTask DisposeAsync() { if (!isDisposed) { isDisposed = true; TaskTracker.RemoveTracking(this); registration1.Dispose(); registration2.Dispose(); if (unityEvent is IDisposable disp) { disp.Dispose(); } unityEvent.RemoveListener(unityAction); } return default; } } } }
{ "pile_set_name": "Github" }
<?php /** * Hoa * * * @license * * New BSD License * * Copyright © 2007-2017, Hoa community. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the Hoa nor the names of its contributors may be * used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND 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. */ namespace Hoa\Ruler\Test\Unit\Model\Bag; use Hoa\Ruler as LUT; use Hoa\Ruler\Model\Bag\Scalar as SUT; use Hoa\Test; /** * Class \Hoa\Ruler\Test\Unit\Model\Bag\Scalar. * * Test suite of the scalar bag class. * * @copyright Copyright © 2007-2017 Hoa community * @license New BSD License */ class Scalar extends Test\Unit\Suite { public function case_is_a_bag() { $this ->when($result = new SUT('foobar')) ->then ->object($result) ->isInstanceOf(LUT\Model\Bag::class); } public function case_constructor() { $this ->given($scalar = 'foobar') ->when($result = new SUT($scalar)) ->then ->string($result->getValue()) ->isEqualTo($scalar); } }
{ "pile_set_name": "Github" }
# Ballerina Implementation Home Page URL: [ballerina/websub](https://ballerina.io/learn/api-docs/ballerina/websub.html) Source code repo URL(s) (optional): https://github.com/ballerina-lang/ballerina * [x] 100% open source implementation Programming Language(s): Ballerina Developer(s): [Ballerina](https://ballerina.io/) Answers are: * [x] Confirmed via websub.rocks (for applicable results) * [ ] All results are self-reported ## Subscription * [x] 100: Supports subscriptions with `hub.mode`, `hub.topic` and `hub.callback` * [x] 101: Supports subscriptions with `hub.mode`, `hub.topic`, `hub.callback` and `hub.secret` * Self-reported with JSON content * [x] 102: Ignores unrecognized parameters in the subscription request * [x] 103: Allows subscribers to re-request active subscriptions before they expire * [x] 104: Supports unsubscription requests * [x] 1xx: Sends a properly formatted verification request for subscribing and unsubscribing * [x] Allows subscribers to request a specific lease duration * If not, then describe the default lease duration issued, or other specifics here (1xx denotes that you can can use any of the 100-104 tests to confirm this feature) ## Distribution * [x] 100: Sends a notification with a matching content-type of the topic URL * publisher defines content to deliver * [x] 100: Sends a notification with the full contents of the topic * [x] 101: Sends a notification with a valid signature * Please select the signature method(s) that the hub uses to sign requests * [x] sha1 * [x] sha256 * [ ] sha384 * [ ] sha512 * [ ] Sends only a diff of the topic URL for Atom or RSS feeds
{ "pile_set_name": "Github" }
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 // // Register slice conforming to Comportibility guide. module prim_subreg_ext #( parameter int unsigned DW = 32 ) ( input re, input we, input [DW-1:0] wd, input [DW-1:0] d, // output to HW and Reg Read output logic qe, output logic qre, output logic [DW-1:0] q, output logic [DW-1:0] qs ); assign qs = d; assign q = wd; assign qe = we; assign qre = re; endmodule
{ "pile_set_name": "Github" }
/***************************************************************************/ /* */ /* cf2hints.h */ /* */ /* Adobe's code for handling CFF hints (body). */ /* */ /* Copyright 2007-2013 Adobe Systems Incorporated. */ /* */ /* This software, and all works of authorship, whether in source or */ /* object code form as indicated by the copyright notice(s) included */ /* herein (collectively, the "Work") is made available, and may only be */ /* used, modified, and distributed under the FreeType Project License, */ /* LICENSE.TXT. Additionally, subject to the terms and conditions of the */ /* FreeType Project License, each contributor to the Work hereby grants */ /* to any individual or legal entity exercising permissions granted by */ /* the FreeType Project License and this section (hereafter, "You" or */ /* "Your") a perpetual, worldwide, non-exclusive, no-charge, */ /* royalty-free, irrevocable (except as stated in this section) patent */ /* license to make, have made, use, offer to sell, sell, import, and */ /* otherwise transfer the Work, where such license applies only to those */ /* patent claims licensable by such contributor that are necessarily */ /* infringed by their contribution(s) alone or by combination of their */ /* contribution(s) with the Work to which such contribution(s) was */ /* submitted. If You institute patent litigation against any entity */ /* (including a cross-claim or counterclaim in a lawsuit) alleging that */ /* the Work or a contribution incorporated within the Work constitutes */ /* direct or contributory patent infringement, then any patent licenses */ /* granted to You under this License for that Work shall terminate as of */ /* the date such litigation is filed. */ /* */ /* By using, modifying, or distributing the Work you indicate that you */ /* have read and understood the terms and conditions of the */ /* FreeType Project License as well as those provided in this section, */ /* and you accept them fully. */ /* */ /***************************************************************************/ #ifndef CF2HINTS_H_ #define CF2HINTS_H_ FT_BEGIN_HEADER enum { CF2_MAX_HINTS = 96 /* maximum # of hints */ }; /* * A HintMask object stores a bit mask that specifies which hints in the * charstring are active at a given time. Hints in CFF must be declared * at the start, before any drawing operators, with horizontal hints * preceding vertical hints. The HintMask is ordered the same way, with * horizontal hints immediately followed by vertical hints. Clients are * responsible for knowing how many of each type are present. * * The maximum total number of hints is 96, as specified by the CFF * specification. * * A HintMask is built 0 or more times while interpreting a charstring, by * the HintMask operator. There is only one HintMask, but it is built or * rebuilt each time there is a hint substitution (HintMask operator) in * the charstring. A default HintMask with all bits set is built if there * has been no HintMask operator prior to the first drawing operator. * */ typedef struct CF2_HintMaskRec_ { FT_Error* error; FT_Bool isValid; FT_Bool isNew; size_t bitCount; size_t byteCount; FT_Byte mask[( CF2_MAX_HINTS + 7 ) / 8]; } CF2_HintMaskRec, *CF2_HintMask; typedef struct CF2_StemHintRec_ { FT_Bool used; /* DS positions are valid */ CF2_Fixed min; /* original character space value */ CF2_Fixed max; CF2_Fixed minDS; /* DS position after first use */ CF2_Fixed maxDS; } CF2_StemHintRec, *CF2_StemHint; /* * A HintMap object stores a piecewise linear function for mapping * y-coordinates from character space to device space, providing * appropriate pixel alignment to stem edges. * * The map is implemented as an array of `CF2_Hint' elements, each * representing an edge. When edges are paired, as from stem hints, the * bottom edge must immediately precede the top edge in the array. * Element character space AND device space positions must both increase * monotonically in the array. `CF2_Hint' elements are also used as * parameters to `cf2_blues_capture'. * * The `cf2_hintmap_build' method must be called before any drawing * operation (beginning with a Move operator) and at each hint * substitution (HintMask operator). * * The `cf2_hintmap_map' method is called to transform y-coordinates at * each drawing operation (move, line, curve). * */ /* TODO: make this a CF2_ArrStack and add a deep copy method */ enum { CF2_MAX_HINT_EDGES = CF2_MAX_HINTS * 2 }; typedef struct CF2_HintMapRec_ { CF2_Font font; /* initial map based on blue zones */ struct CF2_HintMapRec_* initialHintMap; /* working storage for 2nd pass adjustHints */ CF2_ArrStack hintMoves; FT_Bool isValid; FT_Bool hinted; CF2_Fixed scale; CF2_UInt count; /* start search from this index */ CF2_UInt lastIndex; CF2_HintRec edge[CF2_MAX_HINT_EDGES]; /* 192 */ } CF2_HintMapRec, *CF2_HintMap; FT_LOCAL( FT_Bool ) cf2_hint_isValid( const CF2_Hint hint ); FT_LOCAL( FT_Bool ) cf2_hint_isTop( const CF2_Hint hint ); FT_LOCAL( FT_Bool ) cf2_hint_isBottom( const CF2_Hint hint ); FT_LOCAL( void ) cf2_hint_lock( CF2_Hint hint ); FT_LOCAL( void ) cf2_hintmap_init( CF2_HintMap hintmap, CF2_Font font, CF2_HintMap initialMap, CF2_ArrStack hintMoves, CF2_Fixed scale ); FT_LOCAL( void ) cf2_hintmap_build( CF2_HintMap hintmap, CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOrigin, FT_Bool initialMap ); /* * GlyphPath is a wrapper for drawing operations that scales the * coordinates according to the render matrix and HintMap. It also tracks * open paths to control ClosePath and to insert MoveTo for broken fonts. * */ typedef struct CF2_GlyphPathRec_ { /* TODO: gather some of these into a hinting context */ CF2_Font font; /* font instance */ CF2_OutlineCallbacks callbacks; /* outline consumer */ CF2_HintMapRec hintMap; /* current hint map */ CF2_HintMapRec firstHintMap; /* saved copy */ CF2_HintMapRec initialHintMap; /* based on all captured hints */ CF2_ArrStackRec hintMoves; /* list of hint moves for 2nd pass */ CF2_Fixed scaleX; /* matrix a */ CF2_Fixed scaleC; /* matrix c */ CF2_Fixed scaleY; /* matrix d */ FT_Vector fractionalTranslation; /* including deviceXScale */ #if 0 CF2_Fixed hShift; /* character space horizontal shift */ /* (for fauxing) */ #endif FT_Bool pathIsOpen; /* true after MoveTo */ FT_Bool pathIsClosing; /* true when synthesizing closepath line */ FT_Bool darken; /* true if stem darkening */ FT_Bool moveIsPending; /* true between MoveTo and offset MoveTo */ /* references used to call `cf2_hintmap_build', if necessary */ CF2_ArrStack hStemHintArray; CF2_ArrStack vStemHintArray; CF2_HintMask hintMask; /* ptr to the current mask */ CF2_Fixed hintOriginY; /* copy of current origin */ const CF2_BluesRec* blues; CF2_Fixed xOffset; /* character space offsets */ CF2_Fixed yOffset; /* character space miter limit threshold */ CF2_Fixed miterLimit; /* vertical/horizontal snap distance in character space */ CF2_Fixed snapThreshold; FT_Vector offsetStart0; /* first and second points of first */ FT_Vector offsetStart1; /* element with offset applied */ /* current point, character space, before offset */ FT_Vector currentCS; /* current point, device space */ FT_Vector currentDS; /* start point of subpath, character space */ FT_Vector start; /* the following members constitute the `queue' of one element */ FT_Bool elemIsQueued; CF2_Int prevElemOp; FT_Vector prevElemP0; FT_Vector prevElemP1; FT_Vector prevElemP2; FT_Vector prevElemP3; } CF2_GlyphPathRec, *CF2_GlyphPath; FT_LOCAL( void ) cf2_glyphpath_init( CF2_GlyphPath glyphpath, CF2_Font font, CF2_OutlineCallbacks callbacks, CF2_Fixed scaleY, /* CF2_Fixed hShift, */ CF2_ArrStack hStemHintArray, CF2_ArrStack vStemHintArray, CF2_HintMask hintMask, CF2_Fixed hintOrigin, const CF2_Blues blues, const FT_Vector* fractionalTranslation ); FT_LOCAL( void ) cf2_glyphpath_finalize( CF2_GlyphPath glyphpath ); FT_LOCAL( void ) cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y ); FT_LOCAL( void ) cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath, CF2_Fixed x, CF2_Fixed y ); FT_LOCAL( void ) cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath, CF2_Fixed x1, CF2_Fixed y1, CF2_Fixed x2, CF2_Fixed y2, CF2_Fixed x3, CF2_Fixed y3 ); FT_LOCAL( void ) cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath ); FT_END_HEADER #endif /* CF2HINTS_H_ */ /* END */
{ "pile_set_name": "Github" }
# Lista de Cursos Gratuitos em Polonês Lista criada em 27-07-2019. Entre no grupo do Telegram para receber avisos sobre as atualizações das listas. No grupo serão compartilhados cupons de desconto disponibilizados por alguns instrutores da Udemy. Entre no grupo agora mesmo: [Grupo no Telegram](http://bit.ly/2UvKbVX) ## Design - [ 1 - Oszukana kaligrafia - jak ladnie pisac od zaraz.](https://www.udemy.com/oszukana-kaligrafia/?deal_code=UDEAFFBS719&ranMID=39197&ranEAID=LtOw5vJl/HM&ranSiteID=LtOw5vJl_HM-KQDd10zG3Lh23R2uu1J3CQ&LSNPUBID=LtOw5vJl/HM) Entre no grupo do Telegram para receber avisos sobre as atualizações das listas. No grupo serão compartilhados cupons de desconto disponibilizados por alguns instrutores da Udemy. Entre no grupo agora mesmo: [Grupo no Telegram](http://bit.ly/2UvKbVX) **Bons estudos!**
{ "pile_set_name": "Github" }
{ "pile_set_name": "Github" }
/* * Copyright 2019 Web3 Labs Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.web3j.abi; import java.math.BigInteger; import org.junit.jupiter.api.Test; import org.web3j.abi.datatypes.Address; import org.web3j.abi.datatypes.Bool; import org.web3j.abi.datatypes.Bytes; import org.web3j.abi.datatypes.DynamicArray; import org.web3j.abi.datatypes.DynamicBytes; import org.web3j.abi.datatypes.Int; import org.web3j.abi.datatypes.StaticArray; import org.web3j.abi.datatypes.Type; import org.web3j.abi.datatypes.Uint; import org.web3j.abi.datatypes.Utf8String; import org.web3j.abi.datatypes.generated.Bytes1; import org.web3j.abi.datatypes.generated.Bytes4; import org.web3j.abi.datatypes.generated.Bytes6; import org.web3j.abi.datatypes.generated.Int104; import org.web3j.abi.datatypes.generated.Int112; import org.web3j.abi.datatypes.generated.Int120; import org.web3j.abi.datatypes.generated.Int128; import org.web3j.abi.datatypes.generated.Int136; import org.web3j.abi.datatypes.generated.Int144; import org.web3j.abi.datatypes.generated.Int152; import org.web3j.abi.datatypes.generated.Int16; import org.web3j.abi.datatypes.generated.Int160; import org.web3j.abi.datatypes.generated.Int168; import org.web3j.abi.datatypes.generated.Int176; import org.web3j.abi.datatypes.generated.Int184; import org.web3j.abi.datatypes.generated.Int192; import org.web3j.abi.datatypes.generated.Int200; import org.web3j.abi.datatypes.generated.Int208; import org.web3j.abi.datatypes.generated.Int216; import org.web3j.abi.datatypes.generated.Int224; import org.web3j.abi.datatypes.generated.Int232; import org.web3j.abi.datatypes.generated.Int24; import org.web3j.abi.datatypes.generated.Int240; import org.web3j.abi.datatypes.generated.Int248; import org.web3j.abi.datatypes.generated.Int256; import org.web3j.abi.datatypes.generated.Int32; import org.web3j.abi.datatypes.generated.Int40; import org.web3j.abi.datatypes.generated.Int48; import org.web3j.abi.datatypes.generated.Int56; import org.web3j.abi.datatypes.generated.Int64; import org.web3j.abi.datatypes.generated.Int72; import org.web3j.abi.datatypes.generated.Int8; import org.web3j.abi.datatypes.generated.Int80; import org.web3j.abi.datatypes.generated.Int88; import org.web3j.abi.datatypes.generated.Int96; import org.web3j.abi.datatypes.generated.StaticArray2; import org.web3j.abi.datatypes.generated.StaticArray3; import org.web3j.abi.datatypes.generated.Uint104; import org.web3j.abi.datatypes.generated.Uint112; import org.web3j.abi.datatypes.generated.Uint120; import org.web3j.abi.datatypes.generated.Uint128; import org.web3j.abi.datatypes.generated.Uint136; import org.web3j.abi.datatypes.generated.Uint144; import org.web3j.abi.datatypes.generated.Uint152; import org.web3j.abi.datatypes.generated.Uint16; import org.web3j.abi.datatypes.generated.Uint160; import org.web3j.abi.datatypes.generated.Uint168; import org.web3j.abi.datatypes.generated.Uint176; import org.web3j.abi.datatypes.generated.Uint184; import org.web3j.abi.datatypes.generated.Uint192; import org.web3j.abi.datatypes.generated.Uint200; import org.web3j.abi.datatypes.generated.Uint208; import org.web3j.abi.datatypes.generated.Uint216; import org.web3j.abi.datatypes.generated.Uint224; import org.web3j.abi.datatypes.generated.Uint232; import org.web3j.abi.datatypes.generated.Uint24; import org.web3j.abi.datatypes.generated.Uint240; import org.web3j.abi.datatypes.generated.Uint248; import org.web3j.abi.datatypes.generated.Uint256; import org.web3j.abi.datatypes.generated.Uint32; import org.web3j.abi.datatypes.generated.Uint40; import org.web3j.abi.datatypes.generated.Uint48; import org.web3j.abi.datatypes.generated.Uint56; import org.web3j.abi.datatypes.generated.Uint64; import org.web3j.abi.datatypes.generated.Uint72; import org.web3j.abi.datatypes.generated.Uint8; import org.web3j.abi.datatypes.generated.Uint80; import org.web3j.abi.datatypes.generated.Uint88; import org.web3j.abi.datatypes.generated.Uint96; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; public class TypeDecoderTest { @Test public void testBoolDecode() throws Exception { assertEquals( TypeDecoder.decodeBool( "0000000000000000000000000000000000000000000000000000000000000000", 0), (new Bool(false))); assertEquals( TypeDecoder.decodeBool( "0000000000000000000000000000000000000000000000000000000000000001", 0), (new Bool(true))); assertEquals(TypeDecoder.instantiateType("bool", true), (new Bool(true))); assertEquals(TypeDecoder.instantiateType("bool", 1), (new Bool(true))); assertEquals(TypeDecoder.instantiateType("bool", false), (new Bool(false))); assertEquals(TypeDecoder.instantiateType("bool", 0), (new Bool(false))); } @Test public void testBoolDecodeGivenOffset() { // Decode second parameter as Bool assertEquals( TypeDecoder.decode( "0000000000000000000000000000000000000000000000007fffffffffffffff" + "0000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000007fffffffffffffff", 64, Bool.class), (new Bool(false))); assertEquals( TypeDecoder.decode( "0000000000000000000000000000000000000000000000007fffffffffffffff" + "0000000000000000000000000000000000000000000000000000000000000001" + "0000000000000000000000000000000000000000000000007fffffffffffffff", 64, Bool.class), (new Bool(true))); } @Test public void testUintDecode() throws Exception { assertEquals(TypeDecoder.instantiateType("uint", 123), (new Uint(BigInteger.valueOf(123)))); assertEquals( TypeDecoder.instantiateType("uint", 1.0e20), (new Uint(BigInteger.TEN.pow(20)))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint8.class), new Uint8(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000000000000000000000000000000000ff", Uint8.class), new Uint8(BigInteger.valueOf(255))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint16.class), new Uint16(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000000000000000000000000000000000ffff", Uint16.class), new Uint16(BigInteger.valueOf(65535))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint24.class), new Uint24(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000ffffff", Uint24.class), new Uint24(BigInteger.valueOf(16777215))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint32.class), new Uint32(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000000000000000000000000000ffffffff", Uint32.class), new Uint32(BigInteger.valueOf(4294967295L))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint40.class), new Uint40(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000000000000000000000000000ffffffffff", Uint40.class), new Uint40(BigInteger.valueOf(1099511627775L))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint48.class), new Uint48(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000ffffffffffff", Uint48.class), new Uint48(BigInteger.valueOf(281474976710655L))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint56.class), new Uint56(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000000000000000000000ffffffffffffff", Uint56.class), new Uint56(BigInteger.valueOf(72057594037927935L))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint64.class), (new Uint64(BigInteger.ZERO))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000007fffffffffffffff", Uint64.class), (new Uint64(BigInteger.valueOf(Long.MAX_VALUE)))); assertEquals( TypeDecoder.decodeNumeric( "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Uint64.class), (new Uint64(new BigInteger("0ffffffffffffffff", 16)))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint72.class), new Uint72(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000ffffffffffffffffff", Uint72.class), new Uint72(new BigInteger("4722366482869645213695"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint80.class), new Uint80(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000000000000000ffffffffffffffffffff", Uint80.class), new Uint80(new BigInteger("1208925819614629174706175"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint88.class), new Uint88(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000000000000000ffffffffffffffffffffff", Uint88.class), new Uint88(new BigInteger("309485009821345068724781055"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint96.class), new Uint96(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000ffffffffffffffffffffffff", Uint96.class), new Uint96(new BigInteger("79228162514264337593543950335"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint104.class), new Uint104(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000000000ffffffffffffffffffffffffff", Uint104.class), new Uint104(new BigInteger("20282409603651670423947251286015"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint112.class), new Uint112(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000000000ffffffffffffffffffffffffffff", Uint112.class), new Uint112(new BigInteger("5192296858534827628530496329220095"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint120.class), new Uint120(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000ffffffffffffffffffffffffffffff", Uint120.class), new Uint120(new BigInteger("1329227995784915872903807060280344575"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint128.class), new Uint128(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000ffffffffffffffffffffffffffffffff", Uint128.class), new Uint128(new BigInteger("340282366920938463463374607431768211455"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint136.class), new Uint136(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000ffffffffffffffffffffffffffffffffff", Uint136.class), new Uint136(new BigInteger("87112285931760246646623899502532662132735"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint144.class), new Uint144(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000ffffffffffffffffffffffffffffffffffff", Uint144.class), new Uint144(new BigInteger("22300745198530623141535718272648361505980415"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint152.class), new Uint152(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000ffffffffffffffffffffffffffffffffffffff", Uint152.class), new Uint152(new BigInteger("5708990770823839524233143877797980545530986495"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint160.class), new Uint160(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000ffffffffffffffffffffffffffffffffffffffff", Uint160.class), new Uint160(new BigInteger("1461501637330902918203684832716283019655932542975"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint168.class), new Uint168(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000ffffffffffffffffffffffffffffffffffffffffff", Uint168.class), new Uint168(new BigInteger("374144419156711147060143317175368453031918731001855"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint176.class), new Uint176(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000ffffffffffffffffffffffffffffffffffffffffffff", Uint176.class), new Uint176( new BigInteger("95780971304118053647396689196894323976171195136475135"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint184.class), new Uint184(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000ffffffffffffffffffffffffffffffffffffffffffffff", Uint184.class), new Uint184( new BigInteger( "24519928653854221733733552434404946937899825954937634815"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint192.class), new Uint192(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff", Uint192.class), new Uint192( new BigInteger( "6277101735386680763835789423207666416102355444464034512895"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint200.class), new Uint200(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000ffffffffffffffffffffffffffffffffffffffffffffffffff", Uint200.class), new Uint200( new BigInteger( "1606938044258990275541962092341162602522202993782792835301375"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint208.class), new Uint208(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffff", Uint208.class), new Uint208( new BigInteger( "411376139330301510538742295639337626245683966408394965837152255"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint216.class), new Uint216(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffff", Uint216.class), new Uint216( new BigInteger( "105312291668557186697918027683670432318895095400549111254310977535"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint224.class), new Uint224(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Uint224.class), new Uint224( new BigInteger( "26959946667150639794667015087019630673637144422540572481103610249215"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint232.class), new Uint232(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Uint232.class), new Uint232( new BigInteger( "6901746346790563787434755862277025452451108972170386555162524223799295"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint240.class), new Uint240(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Uint240.class), new Uint240( new BigInteger( "1766847064778384329583297500742918515827483896875618958121606201292619775"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint248.class), new Uint248(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Uint248.class), new Uint248( new BigInteger( "452312848583266388373324160190187140051835877600158453279131187530910662655"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Uint256.class), new Uint256(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Uint256.class), new Uint256( new BigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935"))); assertEquals(TypeDecoder.instantiateType("uint", 123), (new Uint(BigInteger.valueOf(123)))); assertEquals( TypeDecoder.instantiateType("uint", 1.0e20), (new Uint(BigInteger.TEN.pow(20)))); } @Test public void testIntDecode() throws Exception { assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int8.class), new Int8(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000000000000000000000000000000000007f", Int8.class), new Int8(BigInteger.valueOf(127))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int16.class), new Int16(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000007FFF", Int16.class), new Int16(BigInteger.valueOf(32767))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int24.class), new Int24(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000000000000000000000000000007fffff", Int24.class), new Int24(BigInteger.valueOf(8388607))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int32.class), new Int32(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000000000000000000000000000007fffffff", Int32.class), new Int32(BigInteger.valueOf(2147483647))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int40.class), new Int40(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000007FFFFFFFFF", Int40.class), new Int40(BigInteger.valueOf(549755813887L))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int48.class), new Int48(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000000000000000000000007FFFFFFFFFFF", Int48.class), new Int48(BigInteger.valueOf(140737488355327L))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int56.class), new Int56(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000000000000000000000007FFFFFFFFFFFFF", Int56.class), new Int56(BigInteger.valueOf(36028797018963967L))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int64.class), (new Int64(BigInteger.ZERO))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000007fffffffffffffff", Int64.class), (new Int64(BigInteger.valueOf(Long.MAX_VALUE)))); assertEquals( TypeDecoder.decodeNumeric( "fffffffffffffffffffffffffffffffffffffffffffffff88000000000000000", Int64.class), (new Int64(BigInteger.valueOf(Long.MIN_VALUE)))); assertEquals( TypeDecoder.decodeNumeric( "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Int64.class), (new Int64(BigInteger.valueOf(-1)))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int72.class), new Int72(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000000000000000007fffffffffffffffff", Int72.class), new Int72(new BigInteger("2361183241434822606847"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int80.class), new Int80(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000000000000000007fffffffffffffffffff", Int80.class), new Int80(new BigInteger("604462909807314587353087"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int88.class), new Int88(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000007fffffffffffffffffffff", Int88.class), new Int88(new BigInteger("154742504910672534362390527"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int96.class), new Int96(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000000000007fffffffffffffffffffffff", Int96.class), new Int96(new BigInteger("39614081257132168796771975167"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int104.class), new Int104(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000000000007fffffffffffffffffffffffff", Int104.class), new Int104(new BigInteger("10141204801825835211973625643007"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int112.class), new Int112(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000007fffffffffffffffffffffffffff", Int112.class), new Int112(new BigInteger("2596148429267413814265248164610047"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int120.class), new Int120(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000000000007fffffffffffffffffffffffffffff", Int120.class), new Int120(new BigInteger("664613997892457936451903530140172287"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int128.class), new Int128(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000000000007fffffffffffffffffffffffffffffff", Int128.class), new Int128(new BigInteger("170141183460469231731687303715884105727"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int136.class), new Int136(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000007fffffffffffffffffffffffffffffffff", Int136.class), new Int136(new BigInteger("43556142965880123323311949751266331066367"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int144.class), new Int144(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000000000007fffffffffffffffffffffffffffffffffff", Int144.class), new Int144(new BigInteger("11150372599265311570767859136324180752990207"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int152.class), new Int152(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000000000007fffffffffffffffffffffffffffffffffffff", Int152.class), new Int152(new BigInteger("2854495385411919762116571938898990272765493247"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int160.class), new Int160(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000007fffffffffffffffffffffffffffffffffffffff", Int160.class), new Int160(new BigInteger("730750818665451459101842416358141509827966271487"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int168.class), new Int168(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000000000007fffffffffffffffffffffffffffffffffffffffff", Int168.class), new Int168(new BigInteger("187072209578355573530071658587684226515959365500927"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int176.class), new Int176(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000000000007fffffffffffffffffffffffffffffffffffffffffff", Int176.class), new Int176( new BigInteger("47890485652059026823698344598447161988085597568237567"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int184.class), new Int184(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000007fffffffffffffffffffffffffffffffffffffffffffff", Int184.class), new Int184( new BigInteger( "12259964326927110866866776217202473468949912977468817407"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int192.class), new Int192(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000000000007fffffffffffffffffffffffffffffffffffffffffffffff", Int192.class), new Int192( new BigInteger( "3138550867693340381917894711603833208051177722232017256447"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int200.class), new Int200(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000000000007fffffffffffffffffffffffffffffffffffffffffffffffff", Int200.class), new Int200( new BigInteger( "803469022129495137770981046170581301261101496891396417650687"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int208.class), new Int208(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000000000007fffffffffffffffffffffffffffffffffffffffffffffffffff", Int208.class), new Int208( new BigInteger( "205688069665150755269371147819668813122841983204197482918576127"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int216.class), new Int216(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00000000007fffffffffffffffffffffffffffffffffffffffffffffffffffff", Int216.class), new Int216( new BigInteger( "52656145834278593348959013841835216159447547700274555627155488767"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int224.class), new Int224(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "000000007fffffffffffffffffffffffffffffffffffffffffffffffffffffff", Int224.class), new Int224( new BigInteger( "13479973333575319897333507543509815336818572211270286240551805124607"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int232.class), new Int232(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "0000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Int232.class), new Int232( new BigInteger( "3450873173395281893717377931138512726225554486085193277581262111899647"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int240.class), new Int240(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "00007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Int240.class), new Int240( new BigInteger( "883423532389192164791648750371459257913741948437809479060803100646309887"))); assertEquals( TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Int248.class), new Int248(BigInteger.ZERO)); assertEquals( TypeDecoder.decodeNumeric( "007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Int248.class), new Int248( new BigInteger( "226156424291633194186662080095093570025917938800079226639565593765455331327"))); assertEquals( TypeDecoder.decodeNumeric( "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Int256.class), (new Int256(BigInteger.valueOf(-1)))); assertEquals(TypeDecoder.instantiateType("int", 123), (new Int(BigInteger.valueOf(123)))); assertEquals(TypeDecoder.instantiateType("int", -123), (new Int(BigInteger.valueOf(-123)))); } /* TODO: Enable once Solidity supports fixed types - see https://github.com/ethereum/solidity/issues/409 @Test public void testUfixedDecode() { assertEquals(TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Ufixed24x40.class), (new Ufixed24x40(BigInteger.ZERO))); assertEquals(TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000007fffffffffffffff", Ufixed24x40.class), (new Ufixed24x40(BigInteger.valueOf(Long.MAX_VALUE)))); assertEquals(TypeDecoder.decodeNumeric( "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Ufixed.class), (new Ufixed( new BigInteger( "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16 )))); } @Test public void testFixedDecode() { assertEquals(TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000000000000000000000", Fixed24x40.class), (new Fixed24x40(BigInteger.ZERO))); assertEquals(TypeDecoder.decodeNumeric( "0000000000000000000000000000000000000000000000007fffffffffffffff", Fixed24x40.class), (new Fixed24x40(BigInteger.valueOf(Long.MAX_VALUE)))); assertEquals(TypeDecoder.decodeNumeric( "ffffffffffffffffffffffffffffffffffffffffffffffff8000000000000000", Fixed24x40.class), (new Fixed24x40(BigInteger.valueOf(Long.MIN_VALUE)))); assertEquals(TypeDecoder.decodeNumeric( "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", Fixed.class), (new Fixed(BigInteger.valueOf(-1)))); } */ @Test public void testStaticBytes() throws Exception { byte[] testbytes = new byte[] {0, 1, 2, 3, 4, 5}; Bytes6 staticBytes = new Bytes6(testbytes); assertEquals( TypeDecoder.decodeBytes( "0001020304050000000000000000000000000000000000000000000000000000", Bytes6.class), (staticBytes)); Bytes empty = new Bytes1(new byte[] {0}); assertEquals( TypeDecoder.decodeBytes( "0000000000000000000000000000000000000000000000000000000000000000", Bytes1.class), (empty)); Bytes dave = new Bytes4("dave".getBytes()); assertEquals( TypeDecoder.decodeBytes( "6461766500000000000000000000000000000000000000000000000000000000", Bytes4.class), (dave)); assertEquals(TypeDecoder.instantiateType("bytes6", testbytes), (new Bytes6(testbytes))); } @Test public void testDynamicBytes() throws Exception { byte[] testbytes = new byte[] {0, 1, 2, 3, 4, 5}; DynamicBytes dynamicBytes = new DynamicBytes(testbytes); assertEquals( TypeDecoder.decodeDynamicBytes( "0000000000000000000000000000000000000000000000000000000000000006" // length + "0001020304050000000000000000000000000000000000000000000000000000", 0), (dynamicBytes)); DynamicBytes empty = new DynamicBytes(new byte[] {0}); assertEquals( TypeDecoder.decodeDynamicBytes( "0000000000000000000000000000000000000000000000000000000000000001" + "0000000000000000000000000000000000000000000000000000000000000000", 0), (empty)); DynamicBytes dave = new DynamicBytes("dave".getBytes()); assertEquals( TypeDecoder.decodeDynamicBytes( "0000000000000000000000000000000000000000000000000000000000000004" + "6461766500000000000000000000000000000000000000000000000000000000", 0), (dave)); DynamicBytes loremIpsum = new DynamicBytes( ("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod " + "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim " + "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex " + "ea commodo consequat. Duis aute irure dolor in reprehenderit in " + "voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur " + "sint occaecat cupidatat non proident, sunt in culpa qui officia " + "deserunt mollit anim id est laborum.") .getBytes()); assertEquals( TypeDecoder.decodeDynamicBytes( "00000000000000000000000000000000000000000000000000000000000001bd" + "4c6f72656d20697073756d20646f6c6f722073697420616d65742c20636f6e73" + "656374657475722061646970697363696e6720656c69742c2073656420646f20" + "656975736d6f642074656d706f7220696e6369646964756e74207574206c6162" + "6f726520657420646f6c6f7265206d61676e6120616c697175612e2055742065" + "6e696d206164206d696e696d2076656e69616d2c2071756973206e6f73747275" + "6420657865726369746174696f6e20756c6c616d636f206c61626f726973206e" + "69736920757420616c697175697020657820656120636f6d6d6f646f20636f6e" + "7365717561742e2044756973206175746520697275726520646f6c6f7220696e" + "20726570726568656e646572697420696e20766f6c7570746174652076656c69" + "7420657373652063696c6c756d20646f6c6f726520657520667567696174206e" + "756c6c612070617269617475722e204578636570746575722073696e74206f63" + "63616563617420637570696461746174206e6f6e2070726f6964656e742c2073" + "756e7420696e2063756c706120717569206f666669636961206465736572756e" + "74206d6f6c6c697420616e696d20696420657374206c61626f72756d2e000000", 0), (loremIpsum)); assertEquals( TypeDecoder.instantiateType("bytes", testbytes), (new DynamicBytes(testbytes))); } @Test public void testAddress() throws Exception { assertEquals( TypeDecoder.decodeAddress( "000000000000000000000000be5422d15f39373eb0a97ff8c10fbd0e40e29338"), (new Address("0xbe5422d15f39373eb0a97ff8c10fbd0e40e29338"))); assertEquals( TypeDecoder.decodeAddress( "000000000000000000000000be5422d15f39373eb0a97ff8c10fbd0e40e29338"), (new Address("0xbe5422d15f39373eb0a97ff8c10fbd0e40e29338"))); assertEquals( TypeDecoder.instantiateType( "address", "0xbe5422d15f39373eb0a97ff8c10fbd0e40e29338"), (new Address("0xbe5422d15f39373eb0a97ff8c10fbd0e40e29338"))); assertEquals( TypeDecoder.instantiateType("address", BigInteger.ONE), (new Address("0x0000000000000000000000000000000000000001"))); } @Test public void testUtf8String() throws Exception { assertEquals( TypeDecoder.decodeUtf8String( "000000000000000000000000000000000000000000000000000000000000000d" // length + "48656c6c6f2c20776f726c642100000000000000000000000000000000000000", 0), (new Utf8String("Hello, world!"))); assertEquals( TypeDecoder.instantiateType("string", "Hello, world!"), (new Utf8String("Hello, world!"))); } @Test public void testStaticArray() throws Exception { assertEquals( TypeDecoder.decodeStaticArray( "000000000000000000000000000000000000000000000000000000000000000a" + "0000000000000000000000000000000000000000000000007fffffffffffffff", 0, new TypeReference.StaticArrayTypeReference<StaticArray<Uint256>>(2) {}, 2), (new StaticArray2<>( Uint256.class, new Uint256(BigInteger.TEN), new Uint256(BigInteger.valueOf(Long.MAX_VALUE))))); assertEquals( TypeDecoder.decodeStaticArray( "000000000000000000000000000000000000000000000000000000000000000d" + "48656c6c6f2c20776f726c642100000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000d" + "776f726c64212048656c6c6f2c00000000000000000000000000000000000000", 0, new TypeReference.StaticArrayTypeReference<StaticArray<Utf8String>>(2) {}, 2), (new StaticArray2<>( Utf8String.class, new Utf8String("Hello, world!"), new Utf8String("world! Hello,")))); Type arr = TypeDecoder.instantiateType("uint256[2]", new long[] {10, Long.MAX_VALUE}); assertTrue(arr instanceof StaticArray2); StaticArray2 staticArray2 = (StaticArray2) arr; assertEquals(staticArray2.getComponentType(), Uint256.class); assertEquals(staticArray2.getValue().get(0), (new Uint256(BigInteger.TEN))); assertEquals( staticArray2.getValue().get(1), (new Uint256(BigInteger.valueOf(Long.MAX_VALUE)))); } @Test public void testEmptyStaticArray() { assertThrows( UnsupportedOperationException.class, () -> TypeDecoder.decodeStaticArray( "0000000000000000000000000000000000000000000000000000000000000000", 0, new TypeReference.StaticArrayTypeReference<StaticArray<Uint256>>( 0) {}, 0)); } @Test public void testEmptyStaticArrayInstantiateType() { assertThrows( ClassNotFoundException.class, () -> TypeDecoder.instantiateType("uint256[0]", new long[] {})); } @Test public void testDynamicArray() throws Exception { assertEquals( TypeDecoder.decodeDynamicArray( "0000000000000000000000000000000000000000000000000000000000000000", // length 0, new TypeReference<DynamicArray<Uint256>>() {}), (new DynamicArray<>(Uint256.class))); assertEquals( TypeDecoder.decodeDynamicArray( "0000000000000000000000000000000000000000000000000000000000000002" // length + "000000000000000000000000000000000000000000000000000000000000000a" + "0000000000000000000000000000000000000000000000007fffffffffffffff", 0, new TypeReference<DynamicArray<Uint256>>() {}), (new DynamicArray<>( Uint256.class, new Uint256(BigInteger.TEN), new Uint256(BigInteger.valueOf(Long.MAX_VALUE))))); assertEquals( TypeDecoder.decodeDynamicArray( "0000000000000000000000000000000000000000000000000000000000000002" // length + "000000000000000000000000000000000000000000000000000000000000000d" + "48656c6c6f2c20776f726c642100000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000d" + "776f726c64212048656c6c6f2c00000000000000000000000000000000000000", 0, new TypeReference<DynamicArray<Utf8String>>() {}), (new DynamicArray<>( Utf8String.class, new Utf8String("Hello, world!"), new Utf8String("world! Hello,")))); Type arr = TypeDecoder.instantiateType( "string[]", new String[] {"Hello, world!", "world! Hello,"}); assertTrue(arr instanceof DynamicArray); DynamicArray dynamicArray = (DynamicArray) arr; assertEquals(dynamicArray.getComponentType(), Utf8String.class); assertEquals(dynamicArray.getValue().get(0), (new Utf8String("Hello, world!"))); assertEquals(dynamicArray.getValue().get(1), (new Utf8String("world! Hello,"))); } @SuppressWarnings("unchecked") @Test public void multiDimArrays() throws Exception { byte[] bytes1d = new byte[] {1, 2, 3}; byte[][] bytes2d = new byte[][] {bytes1d, bytes1d, bytes1d}; final byte[][][] bytes3d = new byte[][][] {bytes2d, bytes2d, bytes2d}; assertEquals(TypeDecoder.instantiateType("bytes", bytes1d), (new DynamicBytes(bytes1d))); Type twoDim = TypeDecoder.instantiateType("uint256[][3]", bytes2d); assertTrue(twoDim instanceof StaticArray3); StaticArray3<DynamicArray<Uint256>> staticArray3 = (StaticArray3<DynamicArray<Uint256>>) twoDim; assertEquals(staticArray3.getComponentType(), DynamicArray.class); DynamicArray<Uint256> row1 = staticArray3.getValue().get(1); assertEquals(row1.getValue().get(2), new Uint256(3)); Type threeDim = TypeDecoder.instantiateType("uint256[][3][3]", bytes3d); assertTrue(threeDim instanceof StaticArray3); StaticArray3<StaticArray3<DynamicArray<Uint256>>> staticArray3StaticArray3 = (StaticArray3<StaticArray3<DynamicArray<Uint256>>>) threeDim; assertEquals(staticArray3StaticArray3.getComponentType(), StaticArray3.class); row1 = staticArray3StaticArray3.getValue().get(1).getValue().get(1); assertEquals(row1.getValue().get(1), (new Uint256(2))); } }
{ "pile_set_name": "Github" }
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Resizable - Default functionality</title> <link rel="stylesheet" href="../../themes/base/all.css"> <script src="../../external/jquery/jquery.js"></script> <script src="../../ui/core.js"></script> <script src="../../ui/widget.js"></script> <script src="../../ui/mouse.js"></script> <script src="../../ui/resizable.js"></script> <link rel="stylesheet" href="../demos.css"> <style> #resizable { width: 150px; height: 150px; padding: 0.5em; } #resizable h3 { text-align: center; margin: 0; } </style> <script> $(function() { $( "#resizable" ).resizable(); }); </script> </head> <body> <div id="resizable" class="ui-widget-content"> <h3 class="ui-widget-header">Resizable</h3> </div> <div class="demo-description"> <p>Enable any DOM element to be resizable. With the cursor grab the right or bottom border and drag to the desired width or height.</p> </div> </body> </html>
{ "pile_set_name": "Github" }
------------------------ Gc收集器 | ------------------------ # 收集算法是内存回收的方法论, 收集器则是实现了 # jvm规范对收集器怎么去实现, 没有任何规定, 所以不同厂家, 不同版本的可能不一样 # GC收集器目前主要的有 * 新生代收集器 Serial ParNew Parallel Scavenge * 老年代收集器 Concurrent Mark Sweep(CMS) Parallel Old Serial Old(MSC) * 全堆收集器 Garbage First(G1) * 不同的收集器可以共存, 组合使用 * 它们之间没有绝对的最完美的收集器,(如果有, 也不用实现那么多出来) ------------------------ Gc收集器关系图 | ------------------------ +-------------------------年轻代回收------------------------------------+ |[Serial] [ParNew] [Parallel Scavenge] | |--------------------------老年代回收-------------------------------[G1]| |[Concurrent Mark Sweep(CMS)] [Serial Old(MSC)] [Parallel Old] | +-----------------------------------------------------------------------+ # 可以组合的GC收集器 [Serial] + Concurrent Mark Sweep(CMS)] [Serial] + [Serial Old(MSC)] [ParNew] + [Concurrent Mark Sweep(CMS)] [ParNew] + [Serial Old(MSC)] [Parallel Scavenge] + [Serial Old(MSC)] [Parallel Scavenge] + [Parallel Old] [Serial Old(MSC)] + [Concurrent Mark Sweep(CMS)] ------------------------ Serial | ------------------------ # 最基本的, 历史最悠久的收集器, 在JDK1.3.1之前是虚拟机新生代的唯一选择 # 这个收集器是一个单线程的收集器 # 它在执行GC的时候, 会暂停所有的工作线程, 直到它收集结束 # 它在Client模式下的虚拟机来说, 是一个很好的选择 * Client模式(桌面环境), 一般分配给jvm管理的内存不是很大 * GC导致的停顿时间, 完全可以控制在几十毫秒 - 100毫秒以内, 这是可以接收的 * 单线程, 免去了多线程的切换, 可以专注的进行收集工作, 效率更高 # 工作模式(采用复制算法) 1. (第一阶段标记)暂停业务线程, 单线程收集(新生代采用复制算法) 2. 唤醒业务线程 3. (第二阶段标记)暂停业务线程, 单线程收集(老年代采用标记整理算法) ------------------------ ParNew | ------------------------ # 它其实就是 Serial 的多线程版本 # 还可以通过一系列的JVM参数对它进行控制 -XX:SurvivorRatio -XX:PretenureSizeThreshold -XX:HandlePromotionFailure # 他的工作流程 1. (第一阶段标记)暂停业务线程, 多线程收集(新生代采用复制算法) 2. 唤醒业务线程 3. (第二阶段标记)暂停业务线程, 单线程收集(老年代采用标记整理算法) # 它相对于 Serial 并没太多的创新之处, 甚至连部分代码都是共用的, 但它却是很多在运行Server模式的JVM的'新生代'首选收集器 * 因为一个与性能无关的原因: 除了 Serial 以外, 只有它能与Concurrent Mark Sweep(CMS)收集器配合工作 # 在单核的CPU环境中, 它的效果不一定比 Serial 好 * 甚至由于多线程交互的开销, 可能不如 Serial * 这个收集器, 在通过超线程技术实现的两个CPU核心环境中, 都不能100%的 保证超越 Serial # 随着CPU核心数量的增加, 它对于GC时系统资源的有效利用还是很有好处的 * 默认开启的收集线程数量与CPU的核心数量相同 * 在核心数量非常多的情况下, 可以通过参数来限制垃圾收集的线程的数量 -XX:ParallelGCThreads=10 # 指定使用ParNew收集器 -XX:+UseConMarkSweepGC * 使用Concurrent Mark Sweep(CMS)作为老年代收集器 * 如果使用该参数, 默认就会使用: ParNew 作为新生代的收集器 -XX:+UseParNewGC * 强制系统使用 ParNew 作为新生代的收集器 ------------------------ Parallel Scavenge | ------------------------ # 新生代收集器, 使用复制算法, 也是可以并行收集的 # 看似与 ParNew 一样, 但是它的目的则是达到一个可控制的吞吐量 吞吐量 = CPU用于业务线程的时间 / (CPU用于业务线程的时间 + CPU用于垃圾收集的时间) * 虚拟机运行了 100分钟, 垃圾回收花费了1 分钟, 则吞吐量就是: 99% * 因为与吞吐量相关,也被称为:吞吐量优先的收集器 # 提供了参数用于精准的控制吞吐量 -XX:MaxGCPauseMillis * 置最大垃圾收集停顿时间, 它的值是一个大于 0 的整数 * 收集器在工作时, 会调整 Java 堆大小或者其他一些参数,尽可能地把停顿时间控制在 MaxGCPauseMillis 以内 * 停顿时间的缩短, 是牺牲了吞吐量(以前10s一次100ms的GC, 现在5s一次70ms的GC)和新生代空间(对体积小的内存收集比较快)换来的, 这也导致GC发生得更加的频繁 * 过小的话, GC停顿时间确实下降了, 但是吞吐量也下降了 -XX:GCTimeRatio * 设置吞吐量大小, 它的值是一个大于 0 小于 100 之间的整数 * 可以理解为: 垃圾收集时间占总时间的比例 * 默认 GCTimeRatio 的值为 99, 那么系统将花费不超过 1 / (1 + 99) = 1% 的时间用于垃圾收集 -XX:+UseAdaptiveSizePolicy * 打开自适应 GC 策略, 在这种模式下, 其他的一些属性不需要自己去设置, 参数会被自动调整, 以达到在堆大小, 吞吐量和停顿时间之间的平衡点 -Xmn(新生代大小) -XX:+SuivivorRatio(Eden和Survivor区的比例) -XX:+PretenureSizeThreshold(晋升老年代对象年龄) * 使用自适应GC策略, 只需要把基本的内存数据设置好,例如堆内存大小值 * 然后仅仅关注/设置最大停顿时间:-XX:MaxGCPauseMillis * 或者给JVM设置一个最大吞吐量 -XX:GCTimeRatio 的优化目标, 具体的工作细节就由jvm完成 ------------------------ Serial Old | ------------------------ # 它是 Serial 收集器的老年代版本, 也是一个单线程的收集器 # 它存在的意义, 也是给 Client 模式的JVM使用 # 如果在Server模式下使用, 它有两个用途 * 在JDK1.5之前与 Parallel Scavenge 搭配使用 * 作为 Concurrent Mark Sweep(CMS) 收集器的后备预案, 在并发收集发生 Concurrent Mode Failure 时使用 * 出现此现象的原因主要有两个:一个是在年老代被用完之前不能完成对无引用对象的回收 , 一个是当新空间分配请求在年老代的剩余空间中得到满足 # Serial 配合 Serial Old工作模式 1. (第一阶段标记)暂停业务线程, 单线程收集(新生代采用复制算法) 2. 唤醒业务线程 3. (第二阶段标记)暂停业务线程, 单线程收集(老年代采用标记-整理算法) ------------------------ Parallel Old | ------------------------ # 它其实是 Parallel Scavenge 收集器的老年代版本, 使用标记清理算法, 在JDK1.6以后才提供 # 在此之前, 新生代的Parallel Scavenge收集器存在一个尴尬的问题 * 如果选择了Parallel Scavenge收集器, 那么老年代除了Serial Old收集器外别无选择 * 由于老年代收集器Serial Old在服务端性能上的拖累, 就算使用 Parallel Scavenge 也未必能获得最大的吞吐量效果 * 这种组合的吞吐量, 不一定比使用 ParNew + Serial Old 更好 # Parallel Old 收集器出现后, 就有了和Parallel Scavenge收集器的一个优良组合 * 在注重吞吐量和CPU资源敏感的场合, 都可以优先考虑 Parallel Scavenge + Parallel Old # Parallel Scavenge 配合 Parallel Old 工作原理 1. (第一阶段标记)暂停业务线程, 多线程收集 2. 唤醒业务线程 3. (第二阶段标记)暂停业务线程, 多线程收集 -------------------------- Concurrent Mark Sweep(CMS)| -------------------------- # 以获取最短停顿时间为目标的收集器, 基于标记-清除的算法实现 # 目前很大一部分Java都是应用在B/S环境下的, 尤其重视响应速度, 希望系统停顿时间短, CMS就非常适合 # 它的执行过程稍微要复杂一点 1. 初始标记(Initial Mark) * 停止业务线程 * 标记一下GC Roots能直接关联的对象, 速度很快 2. 并发标记(Concurrent Mark) 3. 重新标记(Remark) * 停止业务线程 * 修正并发标记期间, 因为程序逻辑导致标记产生变动的对象记录 4. 并发清除(Concurrent Sweeo) * 整个过程中, 最耗时的并发标记和并发清除过程不会停止业务线程 # 它是优秀的收集器, 并发收集, 低停顿, 但是也有一些缺点 1, 对CPU资源敏感 * 事实上, 面向并发设计的程序都对CPU资源敏感 * 并发阶段, 虽然不会停止业务线程, 但是因为占用了一部分CPU资源, 从而会导致应用程序变慢, 导致总吞吐量变低 * CMS默认启动的回收线程数:(CPU数量 + 3) / 4, 也就是说在CPU核心数 >= 4的时候, 并发回收时, 占用 25% d CPU资源 * 如果CPU核心数不足 4, 业务线程受到的影响就比较大了, 因为需要付出一半的算力去执行GC * 为了解决这个问题, JVM提供了一种"增量式并发收集器" , 没用,已经被标识为过时 2, 无法处理浮动垃圾, 可能出现:Concurrent Mode Failure 失败而导致另一次Full GC的产生 * 浮动垃圾就是, 在执行并发清理的时候, 因为是并发,业务线程不会停止, 在此期间产生的垃圾, 只能在下一次GC处理 * 也就是说要留足内存空间给业务线程使用, 因此CMS不能跟其他的收集器一样要等到老年代几乎被完全填满了后再进行收集,因为需要预留空间给并发业务线程使用 * JDK1.5环境下,默认老年代内存使用了 68%后, 就会触发该收集器, 这个设置比较保守 * 如果中老年代增长不是很快, 可以适当的调高参数(0 - 100 百分比), 降低GC次数 -XX:CMSInitiatingOccupancyFraction * 如果CMS运行期间,预留的内存不足以业务线程的使用, 就会出现一次:Concurrent Mode Failure 失败 * 这是JVM会启动预案, 临时启动:Serial Old 收集器来重新对老年代进行垃圾收集 * 也就是说-XX:CMSInitiatingOccupancyFraction设置太高, 可能会导致大量的Concurrent Mode Failure 失败, 性能反而降低 3, 因为使用标记清除算法,导致大量的内存碎片 * 碎片过多, 这会给内存分配带来很大的麻烦 * 往往老年代还有足够的内存, 但是因为找不到连续的空间不得不触发一次 Full GC * 为了解决这个问题,CMS提供了一个参数(默认已经开启) -XX:+UseCMSCompactAtFullCollection * 用于在CMS顶不住要进行Full GC的时候, 开启内存碎片的合并整理过程 * 内存整理的国产没法并发, 空间随便问题解决了, 但是业务线程停顿时间不得不变长了 * 设置执行多少次不压缩的FullGC后, 跟着来一次带压缩的 -XX:CMSFullGCsBeforeCompaction * 默认为0, 表示每次进入Full GC时都进行碎片整理 -------------------------- G1收集器 | -------------------------- # Garbage-First, 收集器是当前收集器技术发展的最前沿成果之一 * 从JDK7开始 * 设计的目标就是为了替代掉:Concurrent Mark Sweep(CMS) 收集器 # 它是全堆收集器, 老年代, 新生代都行 # 因为是全堆收集器, 所以使用G1的时候, 内存布局就有点儿与其他的收集器不同 * 它把整个堆划分为多个相等大小的独立区域(Region) * 还是保留了新生代, 老年代的概念, 但是新生代和老年代不再是物理隔离了, 它们都是一部分 Region 的集合 * 引入了分区的概念, 弱到了分代的概念 # 比较重要, 单独写
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>ExampleModule</title> <link rel="stylesheet" href="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.7.0&#x2F;build&#x2F;cssgrids&#x2F;cssgrids-min.css"> <link rel="stylesheet" href="..&#x2F;assets/vendor/prettify/prettify-min.css"> <link rel="stylesheet" href="..&#x2F;assets/css/main.css" id="site_styles"> <link rel="shortcut icon" type="image/png" href="..&#x2F;assets/favicon.png"> <script src="http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;combo?3.7.0&#x2F;build&#x2F;yui&#x2F;yui-min.js"></script> </head> <body class="yui3-skin-sam"> <div id="doc"> <div id="hd" class="yui3-g header"> <div class="yui3-u-3-4"> <h1><img src="..&#x2F;assets/css/logo.png" title=""></h1> </div> <div class="yui3-u-1-4 version"> <em>API Docs for: </em> </div> </div> <div id="bd" class="yui3-g"> <div class="yui3-u-1-4"> <div id="docs-sidebar" class="sidebar apidocs"> <div id="api-list"> <h2 class="off-left">APIs</h2> <div id="api-tabview" class="tabview"> <ul class="tabs"> <li><a href="#api-classes">Classes</a></li> <li><a href="#api-modules">Modules</a></li> </ul> <div id="api-tabview-filter"> <input type="search" id="api-filter" placeholder="Type to filter APIs"> </div> <div id="api-tabview-panel"> <ul id="api-classes" class="apis classes"> <li><a href="..&#x2F;classes/Anim.html">Anim</a></li> <li><a href="..&#x2F;classes/AreaSeries.html">AreaSeries</a></li> <li><a href="..&#x2F;classes/AreaSplineSeries.html">AreaSplineSeries</a></li> <li><a href="..&#x2F;classes/Axis.html">Axis</a></li> <li><a href="..&#x2F;classes/AxisType.html">AxisType</a></li> <li><a href="..&#x2F;classes/BarSeries.html">BarSeries</a></li> <li><a href="..&#x2F;classes/BottomAxisLayout.html">BottomAxisLayout</a></li> <li><a href="..&#x2F;classes/CartesianChart.html">CartesianChart</a></li> <li><a href="..&#x2F;classes/CartesianSeries.html">CartesianSeries</a></li> <li><a href="..&#x2F;classes/CategoryAxis.html">CategoryAxis</a></li> <li><a href="..&#x2F;classes/Chart.html">Chart</a></li> <li><a href="..&#x2F;classes/ChartBase.html">ChartBase</a></li> <li><a href="..&#x2F;classes/ChartLegend.html">ChartLegend</a></li> <li><a href="..&#x2F;classes/ColumnSeries.html">ColumnSeries</a></li> <li><a href="..&#x2F;classes/ComboSeries.html">ComboSeries</a></li> <li><a href="..&#x2F;classes/ComboSplineSeries.html">ComboSplineSeries</a></li> <li><a href="..&#x2F;classes/CurveUtil.html">CurveUtil</a></li> <li><a href="..&#x2F;classes/Easing.html">Easing</a></li> <li><a href="..&#x2F;classes/EasingFoo.html">EasingFoo</a></li> <li><a href="..&#x2F;classes/EllipseGroup.html">EllipseGroup</a></li> <li><a href="..&#x2F;classes/Fills.html">Fills</a></li> <li><a href="..&#x2F;classes/Foo.Bar.html">Foo.Bar</a></li> <li><a href="..&#x2F;classes/Graph.html">Graph</a></li> <li><a href="..&#x2F;classes/Gridlines.html">Gridlines</a></li> <li><a href="..&#x2F;classes/GroupCircle.html">GroupCircle</a></li> <li><a href="..&#x2F;classes/GroupDiamond.html">GroupDiamond</a></li> <li><a href="..&#x2F;classes/GroupRect.html">GroupRect</a></li> <li><a href="..&#x2F;classes/Histogram.html">Histogram</a></li> <li><a href="..&#x2F;classes/HorizontalLegendLayout.html">HorizontalLegendLayout</a></li> <li><a href="..&#x2F;classes/JSON.html">JSON</a></li> <li><a href="..&#x2F;classes/LeftAxisLayout.html">LeftAxisLayout</a></li> <li><a href="..&#x2F;classes/Lines.html">Lines</a></li> <li><a href="..&#x2F;classes/LineSeries.html">LineSeries</a></li> <li><a href="..&#x2F;classes/Main.html">Main</a></li> <li><a href="..&#x2F;classes/MarkerSeries.html">MarkerSeries</a></li> <li><a href="..&#x2F;classes/myclass.html">myclass</a></li> <li><a href="..&#x2F;classes/mywidget.SubWidget.html">mywidget.SubWidget</a></li> <li><a href="..&#x2F;classes/mywidget.SubWidget2.html">mywidget.SubWidget2</a></li> <li><a href="..&#x2F;classes/mywidget.SuperWidget.html">mywidget.SuperWidget</a></li> <li><a href="..&#x2F;classes/NumericAxis.html">NumericAxis</a></li> <li><a href="..&#x2F;classes/OtherClass.html">OtherClass</a></li> <li><a href="..&#x2F;classes/OtherClass2.html">OtherClass2</a></li> <li><a href="..&#x2F;classes/P.storage.html">P.storage</a></li> <li><a href="..&#x2F;classes/P.storage.LocalStore.html">P.storage.LocalStore</a></li> <li><a href="..&#x2F;classes/P.storage.Store.html">P.storage.Store</a></li> <li><a href="..&#x2F;classes/PieChart.html">PieChart</a></li> <li><a href="..&#x2F;classes/PieSeries.html">PieSeries</a></li> <li><a href="..&#x2F;classes/Plots.html">Plots</a></li> <li><a href="..&#x2F;classes/Renderer.html">Renderer</a></li> <li><a href="..&#x2F;classes/RightAxisLayout.html">RightAxisLayout</a></li> <li><a href="..&#x2F;classes/ShapeGroup.html">ShapeGroup</a></li> <li><a href="..&#x2F;classes/SplineSeries.html">SplineSeries</a></li> <li><a href="..&#x2F;classes/StackedAreaSeries.html">StackedAreaSeries</a></li> <li><a href="..&#x2F;classes/StackedAreaSplineSeries.html">StackedAreaSplineSeries</a></li> <li><a href="..&#x2F;classes/StackedAxis.html">StackedAxis</a></li> <li><a href="..&#x2F;classes/StackedBarSeries.html">StackedBarSeries</a></li> <li><a href="..&#x2F;classes/StackedColumnSeries.html">StackedColumnSeries</a></li> <li><a href="..&#x2F;classes/StackedComboSeries.html">StackedComboSeries</a></li> <li><a href="..&#x2F;classes/StackedComboSplineSeries.html">StackedComboSplineSeries</a></li> <li><a href="..&#x2F;classes/StackedLineSeries.html">StackedLineSeries</a></li> <li><a href="..&#x2F;classes/StackedMarkerSeries.html">StackedMarkerSeries</a></li> <li><a href="..&#x2F;classes/StackedSplineSeries.html">StackedSplineSeries</a></li> <li><a href="..&#x2F;classes/StackingUtil.html">StackingUtil</a></li> <li><a href="..&#x2F;classes/TimeAxis.html">TimeAxis</a></li> <li><a href="..&#x2F;classes/TopAxisLayout.html">TopAxisLayout</a></li> <li><a href="..&#x2F;classes/VerticalLegendLayout.html">VerticalLegendLayout</a></li> <li><a href="..&#x2F;classes/YUI~dump.html">YUI~dump</a></li> <li><a href="..&#x2F;classes/YUI~oop.html">YUI~oop</a></li> </ul> <ul id="api-modules" class="apis modules"> <li><a href="..&#x2F;modules/anim.html">anim</a></li> <li><a href="..&#x2F;modules/anim-easing.html">anim-easing</a></li> <li><a href="..&#x2F;modules/anim-easing-foo.html">anim-easing-foo</a></li> <li><a href="..&#x2F;modules/charts.html">charts</a></li> <li><a href="..&#x2F;modules/charts-legend.html">charts-legend</a></li> <li><a href="..&#x2F;modules/dump.html">dump</a></li> <li><a href="..&#x2F;modules/ExampleModule.html">ExampleModule</a></li> <li><a href="..&#x2F;modules/foobar.html">foobar</a></li> <li><a href="..&#x2F;modules/graphics.html">graphics</a></li> <li><a href="..&#x2F;modules/json.html">json</a></li> <li><a href="..&#x2F;modules/json-parse.html">json-parse</a></li> <li><a href="..&#x2F;modules/json-stringify.html">json-stringify</a></li> <li><a href="..&#x2F;modules/myapp_views_index.html">myapp&#x2F;views&#x2F;index</a></li> <li><a href="..&#x2F;modules/mymodule.html">mymodule</a></li> <li><a href="..&#x2F;modules/mysubmodule.html">mysubmodule</a></li> <li><a href="..&#x2F;modules/oop.html">oop</a></li> <li><a href="..&#x2F;modules/P.storage.html">P.storage</a></li> </ul> </div> </div> </div> </div> </div> <div class="yui3-u-3-4"> <div id="api-options"> Show: <label for="api-show-inherited"> <input type="checkbox" id="api-show-inherited" checked> Inherited </label> <label for="api-show-protected"> <input type="checkbox" id="api-show-protected"> Protected </label> <label for="api-show-private"> <input type="checkbox" id="api-show-private"> Private </label> <label for="api-show-deprecated"> <input type="checkbox" id="api-show-deprecated"> Deprecated </label> </div> <div class="apidocs"> <div id="docs-main"> <div class="content"> <h1>ExampleModule Module</h1> <div class="box clearfix meta"> <div class="foundat"> Defined in: <a href="..&#x2F;files&#x2F;input_inherit_examplemodule.js.html#l94"><code>input&#x2F;inherit&#x2F;examplemodule.js:94</code></a> </div> </div> <div class="box intro"> <p>This is my example module</p> </div> <div class="example"> <h4>Example:</h4> <div class="example-content"> <pre class="code"><code class="prettyprint">var bar; </code></pre> </div> </div> <div class="yui3-g"> <div class="yui3-u-1-2"> <p>This module provides the following classes:</p> <ul class="module-classes"> <li class="module-class"> <a href="..&#x2F;classes/mywidget.SubWidget.html"> mywidget.SubWidget </a> </li> <li class="module-class"> <a href="..&#x2F;classes/mywidget.SubWidget2.html"> mywidget.SubWidget2 </a> </li> <li class="module-class"> <a href="..&#x2F;classes/mywidget.SuperWidget.html"> mywidget.SuperWidget </a> </li> </ul> </div> <div class="yui3-u-1-2"> </div> </div> </div> </div> </div> </div> </div> </div> <script src="..&#x2F;assets/vendor/prettify/prettify-min.js"></script> <script>prettyPrint();</script> <script src="..&#x2F;assets/js/yui-prettify.js"></script> <script src="..&#x2F;assets/../api.js"></script> <script src="..&#x2F;assets/js/api-filter.js"></script> <script src="..&#x2F;assets/js/api-list.js"></script> <script src="..&#x2F;assets/js/api-search.js"></script> <script src="..&#x2F;assets/js/apidocs.js"></script> </body> </html>
{ "pile_set_name": "Github" }
/* * Copyright (c) 2018, 2019, 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. * */ #ifndef SHARE_MEMORY_METASPACE_METADEBUG_HPP #define SHARE_MEMORY_METASPACE_METADEBUG_HPP #include "memory/allocation.hpp" namespace metaspace { class Metadebug : AllStatic { // Debugging support for Metaspaces static int _allocation_fail_alot_count; public: static void init_allocation_fail_alot_count(); #ifdef ASSERT static bool test_metadata_failure(); #endif }; #ifdef ASSERT #define EVERY_NTH(n) \ { static int counter_ = 0; \ if (n > 0) { \ counter_ ++; \ if (counter_ > n) { \ counter_ = 0; \ #define END_EVERY_NTH } } } #endif // ASSERT } // namespace metaspace #endif // SHARE_MEMORY_METASPACE_METADEBUG_HPP
{ "pile_set_name": "Github" }
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Local File Inclusion Test Case</title> </head> <body> <%@ include file="include.jsp"%> <% //*** Re-define Default Exposure Variables - Per Page *** //CONTEXT_STREAM, FILE_CLASS, URL_CLASS, FTP_CLASS, INCLUDE, REDIRECT, FORWARD fileAccessMethod = FileAccessMethod.FILE_CLASS; //NONE, WHITE_LIST, LOCAL_FOLDER_ONLY, PERMISSIONS, //UNIX_TRAVESAL_INPUT_VALIDATION, UNIX_TRAVESAL_INPUT_REMOVAL, //WINDOWS_TRAVESAL_INPUT_VALIDATION, WINDOWS_TRAVESAL_INPUT_REMOVAL, //SLASH_INPUT_VALIDATION, SLASH_INPUT_REMOVAL, //BACKSLASH_INPUT_VALIDATION, BACKSLASH_INPUT_REMOVAL, accessRestriction = FileAccessRestriction.UNIX_TRAVESAL_INPUT_REMOVAL; //FULL_PATH_INPUT, RELATIVE_INPUT, INVALID_INPUT , EMPTY_INPUT defaultInputType = DefaultInputType.FULL_PATH_INPUT; //FULL_FILENAME, FILENAME_ONLY, DIRECTORY, EXTENSION injectionContext = FileInjectionContext.FULL_FILENAME; //ANY, NONE, SLASH_PREFIX, BACKSLASH_PREFIX, //FTP_DIRECTIVE, HTTP_DIRECTIVE, prefixRequired = PrefixRequirement.BACKSLASH_PREFIX; //WINDOWS, UNIX //osSimulated = OsType.WINDOWS; //Use the default defined in include.jsp //ERROR_500, ERROR_404, REDIRECT_302, ERROR_200, VALID_200, Identical_200 //invalidResponseType = ResponseType.ERROR_200; //Use the default defined in include.jsp //CONTENT_TYPE_TEXT_HTML ("text/html"), CONTENT_TYPE_STREAM ("application/octet-stream") //validResposeStream = ContentConstants.CONTENT_TYPE_TEXT_HTML; //OS_PATH, FILE_DIRECTIVE_URL, FTP_URL, HTTP_URL pathType = PathType.OS_PATH; //LFI, RFI, DIRECTORY_TRAVERSAL, CODE_LFI, CODE_RFI, FALSE_POSITIVE vulnerability = VulnerabilityType.LFI; %> <%@ include file="inclusion-logic.jsp"%>
{ "pile_set_name": "Github" }
import torch import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches from transforms3d.euler import euler2mat from skimage.io import imsave def visualize_bounding_box(rgb, corners_pred, corners_targets=None, centers_pred=None, centers_targets=None, save=False, save_fn=None): ''' :param rgb: torch tensor with size [b,3,h,w] or numpy array with size [b,h,w,3] :param corners_pred: [b,1,8,2] :param corners_targets: [b,1,8,2] or None :param centers_pred: [b,1,2] or None :param centers_targets: [b,1,2] or None :param save: :param save_fn: :return: ''' if isinstance(rgb, torch.Tensor): rgb = rgb.permute(0, 2, 3, 1).detach().cpu().numpy() rgb = rgb.astype(np.uint8) batch_size = corners_pred.shape[0] for idx in range(batch_size): _, ax = plt.subplots(1) ax.imshow(rgb[idx]) ax.add_patch( patches.Polygon(xy=corners_pred[idx, 0][[0, 1, 3, 2, 0, 4, 6, 2]], fill=False, linewidth=1, edgecolor='b')) ax.add_patch( patches.Polygon(xy=corners_pred[idx, 0][[5, 4, 6, 7, 5, 1, 3, 7]], fill=False, linewidth=1, edgecolor='b')) if corners_targets is not None: ax.add_patch(patches.Polygon(xy=corners_targets[idx, 0][[0, 1, 3, 2, 0, 4, 6, 2]], fill=False, linewidth=1, edgecolor='g')) ax.add_patch(patches.Polygon(xy=corners_targets[idx, 0][[5, 4, 6, 7, 5, 1, 3, 7]], fill=False, linewidth=1, edgecolor='g')) if centers_pred is not None: ax.plot(centers_pred[idx, 0, 0],centers_pred[idx, 0, 1],'*') if centers_targets is not None: ax.plot(centers_targets[idx, 0, 0], centers_pred[idx, 0, 1], '*') if not save: plt.show() else: plt.savefig(save_fn.format(idx)) plt.close() def visualize_mask(mask_pred,mask_gt, save=False, save_fn=None): ''' :param mask_pred: [b,h,w] :param mask_gt: [b,h,w] :return: ''' b,h,w=mask_gt.shape for bi in range(b): img=np.zeros([h,w,3],np.uint8) img[np.logical_and(mask_gt[bi],mask_pred[bi])]=np.asarray([0,255,0]) img[np.logical_and(np.logical_not(mask_gt[bi]),mask_pred[bi])]=np.asarray([[[255,255,0]]]) img[np.logical_and(np.logical_not(mask_pred[bi]),mask_gt[bi])]=np.asarray([[[255,0,0]]]) plt.imshow(img) if not save: plt.show() else: plt.savefig(save_fn.format(bi)) plt.close() def visualize_overlap_mask(img,mask,save_fn): b,h,w=mask.shape for bi in range(b): img[bi][mask[bi]>0]//=2 img[bi][mask[bi]>0]+=np.asarray([0,128,0],np.uint8) imsave(save_fn.format(bi),img[bi]) def visualize_points_3d(pts1,pts2,K,h=480,w=640): ''' :param pts1: [pn,3] prediction :param pts2: [pn,3] target :param K: [3,3] :return: ''' def get_pts_img(pts,R,T): img_pts,_=pts_to_img_pts(pts,np.identity(3),np.zeros(3),K) pts_img=img_pts_to_pts_img(img_pts,h,w) trans_pts=np.matmul(pts-T,R.transpose())+T trans_img_pts,_=pts_to_img_pts(trans_pts,np.identity(3),np.zeros(3),K) trans_pts_img=img_pts_to_pts_img(trans_img_pts,h,w) return pts_img,trans_pts_img def get_img(pts_img1,pts_img2): img=np.zeros([h,w,3],np.uint8) img[np.logical_and(pts_img1>0,pts_img2>0)]=np.asarray([0,255,0],np.uint8) img[np.logical_and(pts_img1>0,pts_img2==0)]=np.asarray([255,255,0],np.uint8) img[np.logical_and(pts_img1==0,pts_img2>0)]=np.asarray([255,0,0],np.uint8) return img T=np.mean(np.concatenate([pts1,pts2],0),0)[None,:] R=euler2mat(np.pi/2,0,0,'syzx') pts_img1, trans_pts_img1=get_pts_img(pts1,R,T) pts_img2, trans_pts_img2=get_pts_img(pts2,R,T) overlap1=get_img(pts_img1,pts_img2) overlap2=get_img(trans_pts_img1,trans_pts_img2) return overlap1,overlap2 def visualize_mask_multi_class(mask_pred, mask_gt, colors, save=False, save_fn=None): ''' :param mask_pred: [b,h,w] :param mask_gt: [b,h,w] :param colors: [cn,3] :return: ''' b,h,w=mask_gt.shape cn,_=colors.shape for bi in range(b): img_pred=np.zeros([h,w,3],np.uint8) for ci in range(cn): img_pred[mask_pred[bi]==ci]=colors[ci] img_gt=np.zeros([h,w,3],np.uint8) for ci in range(cn): img_gt[mask_gt[bi]==ci]=colors[ci] plt.subplots(121) plt.imshow(img_pred) plt.subplots(122) plt.imshow(img_gt) if not save: plt.show() else: plt.savefig(save_fn.format(bi)) plt.close() def visualize_hypothesis(rgb, hyp_pts, hyp_counts, pts_target, save=False, save_fn=None): ''' :param rgb: b,h,w :param hyp_pts: b,hn,vn,2 :param hyp_counts: b,hn,vn :param pts_target: b,vn,2 :param save: :param save_fn: :return: ''' b,hn,vn,_=hyp_pts.shape _,h,w,_=rgb.shape for bi in range(b): for vi in range(vn): cur_hyp_counts=hyp_counts[bi,:,vi] # [hn] cur_hyp_pts=hyp_pts[bi,:,vi] # [hn,2] # mask=np.logical_and(np.logical_and(cur_hyp_pts[:,0]>-w*0.5,cur_hyp_pts[:,0]<w*1.5), # np.logical_and(cur_hyp_pts[:,1]>-h*0.5,cur_hyp_pts[:,1]<h*1.5)) mask=np.logical_and(np.logical_and(cur_hyp_pts[:,0]>0,cur_hyp_pts[:,0]<w*1.0), np.logical_and(cur_hyp_pts[:,1]>0,cur_hyp_pts[:,1]<h*1.0)) cur_hyp_pts[np.logical_not(mask)]=0.0 cur_hyp_counts[np.logical_not(mask)]=0 cur_hyp_counts=cur_hyp_counts.astype(np.float32) colors=(cur_hyp_counts/cur_hyp_counts.max())#[:,None]#*np.array([[255,0,0]]) plt.figure(figsize=(10,8)) plt.imshow(rgb[bi]) plt.scatter(cur_hyp_pts[:,0],cur_hyp_pts[:,1],c=colors,s=0.1,cmap='viridis') # plt.plot(pts_target[bi,vi,0],pts_target[bi,vi,1],'*',c='r') if save: plt.savefig(save_fn.format(bi,vi)) else: plt.show() plt.close() def visualize_voting_ellipse(rgb,mean,var,target,save=False, save_fn=None): ''' :param rgb: b,h,w,3 :param mean: b,vn,2 :param var: b,vn,2,2 :param save: :param save_fn: :return: ''' b,vn,_=mean.shape yellow=np.array([1.0,0.0,0.0]) red=np.asarray([1.0,1.0,0.0]) num=5 for bi in range(b): for vi in range(vn): _, ax = plt.subplots(1, figsize=(10, 8)) cov=var[bi,vi] w,v=np.linalg.eig(cov) for k in range(num): size=w*k*3 elp = patches.Ellipse(mean[bi, vi], size[0], size[1], np.arctan2(v[1, 0], v[0, 0]) / np.pi * 180, fill=False, color=yellow/num*(num-k)+red/num*k) ax.add_patch(elp) ax.scatter(mean[bi,vi,0],mean[bi,vi,1], marker='*', c=[yellow], s=8) ax.imshow(rgb[bi]) if save: plt.savefig(save_fn.format(bi)) else: plt.show() plt.close() def visualize_vanishing_points(rgb, van_cens, save=False, save_fn=None): b,h,w,_=rgb.shape cen=van_cens[:,3,:] # [b,3] van=van_cens[:,:3,:] # [b,3,3] cen/=cen[:,2:] for bi in range(b): dir_2d=[] for di in range(3): dir=(van[bi,di,:]-cen[bi]*van[bi,di,2])[:2] dir/=np.linalg.norm(dir) dir_2d.append(dir) dir_2d=np.asarray(dir_2d)*20 # [4,2] _, ax = plt.subplots(1) ax.imshow(rgb[bi]) ax.add_patch(patches.Arrow(x=cen[bi,0],y=cen[bi,1],dx=dir_2d[0,0],dy=dir_2d[0,1],linewidth=2,edgecolor='r')) ax.add_patch(patches.Arrow(x=cen[bi,0],y=cen[bi,1],dx=dir_2d[1,0],dy=dir_2d[1,1],linewidth=2,edgecolor='g')) ax.add_patch(patches.Arrow(x=cen[bi,0],y=cen[bi,1],dx=dir_2d[2,0],dy=dir_2d[2,1],linewidth=2,edgecolor='b')) if save: plt.savefig(save_fn.format(bi)) else: plt.show() plt.close() def visualize_points(rgb, pts_target, pts_pred=None, save=False, save_fn=None): ''' :param rgb: torch tensor with size [b,3,h,w] or numpy array with size [b,h,w,3] :param pts_target: [b,pn,2] :param pts_pred: [b,pn,2] :param save: :param save_fn: :return: ''' if isinstance(rgb, torch.Tensor): rgb = rgb.permute(0, 2, 3, 1).detach().cpu().numpy() rgb = rgb.astype(np.uint8) batch_size = pts_target.shape[0] for idx in range(batch_size): _, ax = plt.subplots(1) ax.imshow(rgb[idx]) ax.plot(pts_target[idx,:,0],pts_target[idx,:,1],'*') if pts_pred is not None: ax.plot(pts_pred[idx,:,0],pts_pred[idx,:,1],'*') if not save: plt.show() else: plt.savefig(save_fn.format(idx)) plt.close() def visualize_keypoints(rgb, pts_target, pts_pred=None, save=False, save_fn=None): rgb=rgb.astype(np.uint8) batch_size=rgb.shape[0] for bi in range(batch_size): _, ax = plt.subplots(1) ax.imshow(rgb[bi]) ax.scatter(pts_target[bi,:,0],pts_target[bi,:,1],c=np.arange(pts_target.shape[1])) if pts_pred is not None: ax.scatter(pts_pred[bi,:,0],pts_pred[bi,:,1],c=np.arange(pts_pred.shape[1])) if not save: plt.show() else: plt.savefig(save_fn.format(bi)) plt.close() def imagenet_to_uint8(rgb,torch_format=True): ''' :param rgb: [b,3,h,w] :return: ''' if torch_format: if len(rgb.shape)==4: rgb = rgb.transpose(0, 2, 3, 1) else: rgb = rgb.transpose(1, 2, 0) rgb *= np.asarray([0.229, 0.224, 0.225])[None, None, :] rgb += np.asarray([0.485, 0.456, 0.406])[None, None, :] rgb *= 255 rgb = rgb.astype(np.uint8) return rgb def write_points(filename, pts, colors=None): has_color=pts.shape[1]>=6 with open(filename, 'w') as f: for i,pt in enumerate(pts): if colors is None: if has_color: f.write('{} {} {} {} {} {}\n'.format(pt[0],pt[1],pt[2],int(pt[3]),int(pt[4]),int(pt[5]))) else: f.write('{} {} {}\n'.format(pt[0],pt[1],pt[2])) else: if colors.shape[0]==pts.shape[0]: f.write('{} {} {} {} {} {}\n'.format(pt[0],pt[1],pt[2],int(colors[i,0]),int(colors[i,1]),int(colors[i,2]))) else: f.write('{} {} {} {} {} {}\n'.format(pt[0],pt[1],pt[2],int(colors[0]),int(colors[1]),int(colors[2]))) def img_pts_to_pts_img(im_pts, img_row, img_col): pts_img=np.zeros([img_row,img_col],dtype=np.float32) for pt in im_pts: x,y = round(pt[0]), round(pt[1]) x=int(img_col-1 if x>=img_col else x) y=int(img_row-1 if y>=img_row else y) x=0 if x<0 else x y=0 if y<0 else y pts_img[y,x]=1.0 return pts_img def img_pts_to_pts_img_colors(img, im_pts, img_rgbs): pts_img=img.copy() img_row,img_col,_=img.shape for pt,rgb in zip(im_pts,img_rgbs): x,y = round(pt[0]), round(pt[1]) x=int(img_col-1 if x>=img_col else x) y=int(img_row-1 if y>=img_row else y) x=0 if x<0 else x y=0 if y<0 else y pts_img[y,x]=rgb return pts_img def pts_to_img_pts(pts,R,T,K): img_pts=np.matmul(np.matmul(pts,R.transpose())+T[None,:],K.transpose()) img_dpt=img_pts[:,2] img_pts=img_pts[:,:2]/img_pts[:,2:] return img_pts,img_dpt
{ "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.druid.query; /** */ public interface QueryToolChestWarehouse { <T, QueryType extends Query<T>> QueryToolChest<T, QueryType> getToolChest(QueryType query); }
{ "pile_set_name": "Github" }
// // TDFMockResourceImageFetcher.h // DFImageManager // // Created by Alexander Grebenyuk on 11/07/15. // Copyright (c) 2015 Alexander Grebenyuk. All rights reserved. // #import "DFImageManagerKit.h" #import <Foundation/Foundation.h> extern NSString *TDFMockFetcherDidStartOperationNotification; @interface TDFMockResponse : NSObject @property (nonatomic) NSTimeInterval elapsedTime; @property (nonatomic) NSData *data; @property (nonatomic) NSError *error; @property (nonatomic) NSDictionary *info; + (instancetype)mockWithData:(NSData *)data; + (instancetype)mockWithData:(NSData *)data elapsedTime:(NSTimeInterval)elapsedTime; + (instancetype)mockWithError:(NSError *)error elapsedTime:(NSTimeInterval)elapsedTime; @end /*! Mock used for composite image task tests. */ @interface TDFMockFetcher : NSObject <DFImageFetching> @property (nonatomic, readonly) NSOperationQueue *queue; - (void)setResponse:(TDFMockResponse *)response forResource:(NSString *)resource; @end
{ "pile_set_name": "Github" }
/* * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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 "config.h" #include "ReduceWhitespace.h" #include <wtf/ASCIICType.h> #include <wtf/StringPrintStream.h> namespace JSC { CString reduceWhitespace(const CString& input) { StringPrintStream out; const char* data = input.data(); for (unsigned i = 0; i < input.length();) { if (isASCIISpace(data[i])) { while (i < input.length() && isASCIISpace(data[i])) ++i; out.print(CharacterDump(' ')); continue; } out.print(CharacterDump(data[i])); ++i; } return out.toCString(); } } // namespace JSC
{ "pile_set_name": "Github" }
#!/bin/bash heapsize=4096 TCID="ion_test.sh" errcode=0 # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 run_test() { heaptype=$1 ./ionapp_export -i $heaptype -s $heapsize & sleep 1 ./ionapp_import if [ $? -ne 0 ]; then echo "$TCID: heap_type: $heaptype - [FAIL]" errcode=1 else echo "$TCID: heap_type: $heaptype - [PASS]" fi sleep 1 echo "" } check_root() { uid=$(id -u) if [ $uid -ne 0 ]; then echo $TCID: must be run as root >&2 exit $ksft_skip fi } check_device() { DEVICE=/dev/ion if [ ! -e $DEVICE ]; then echo $TCID: No $DEVICE device found >&2 echo $TCID: May be CONFIG_ION is not set >&2 exit $ksft_skip fi } main_function() { check_device check_root # ION_SYSTEM_HEAP TEST run_test 0 # ION_SYSTEM_CONTIG_HEAP TEST run_test 1 } main_function echo "$TCID: done" exit $errcode
{ "pile_set_name": "Github" }
package hcldec import ( "github.com/hashicorp/hcl/v2" "github.com/zclconf/go-cty/cty" ) func decode(body hcl.Body, blockLabels []blockLabel, ctx *hcl.EvalContext, spec Spec, partial bool) (cty.Value, hcl.Body, hcl.Diagnostics) { schema := ImpliedSchema(spec) var content *hcl.BodyContent var diags hcl.Diagnostics var leftovers hcl.Body if partial { content, leftovers, diags = body.PartialContent(schema) } else { content, diags = body.Content(schema) } val, valDiags := spec.decode(content, blockLabels, ctx) diags = append(diags, valDiags...) return val, leftovers, diags } func impliedType(spec Spec) cty.Type { return spec.impliedType() } func sourceRange(body hcl.Body, blockLabels []blockLabel, spec Spec) hcl.Range { schema := ImpliedSchema(spec) content, _, _ := body.PartialContent(schema) return spec.sourceRange(content, blockLabels) }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 6481d171179ace74495504668c11206c timeCreated: 1473765592 licenseType: Pro NativeFormatImporter: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
// The MIT License (MIT) // // Copyright (c) 2015, 2016 Arian Fornaris // // 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. package phasereditor.canvas.ui.shapes; import phasereditor.canvas.core.BaseSpriteModel; /** * @author arian * */ public class ImageSpriteNode extends FrameNode implements ISpriteNode { private ImageSpriteControl _control; ImageSpriteNode(ImageSpriteControl control) { super(control.getModel().getAssetKey(), control.isHeadless()); _control = control; } @Override public ImageSpriteControl getControl() { return _control; } @Override public BaseSpriteModel getModel() { return _control.getModel(); } @Override public ImageSpriteNode getNode() { return this; } }
{ "pile_set_name": "Github" }
// Copyright 2016 The Draco 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. // #ifndef DRACO_COMPRESSION_POINT_CLOUD_ALGORITHMS_POINT_CLOUD_COMPRESSION_METHOD_H_ #define DRACO_COMPRESSION_POINT_CLOUD_ALGORITHMS_POINT_CLOUD_COMPRESSION_METHOD_H_ namespace draco { // Enum indicating the used compression method, used by Encoder and Decoder. enum PointCloudCompressionMethod { RESERVED_POINT_CLOUD_METHOD_0 = 0, // Reserved for internal use. // Generalized version of Encoding using the Octree method by Olivier // Devillers to d dimensions. // "Progressive lossless compression of arbitrary simplicial complexes" // https://doi.org/10.1145/566570.566591 KDTREE = 1, RESERVED_POINT_CLOUD_METHOD_2 = 2, // Reserved for internal use. RESERVED_POINT_CLOUD_METHOD_3 = 0, // Reserved for internal use. }; } // namespace draco #endif // DRACO_COMPRESSION_POINT_CLOUD_ALGORITHMS_POINT_CLOUD_COMPRESSION_METHOD_H_
{ "pile_set_name": "Github" }
_ _ ____ _ ___| | | | _ \| | / __| | | | |_) | | | (__| |_| | _ <| |___ \___|\___/|_| \_\_____| TODO Things to do in project cURL. Please tell us what you think, contribute and send us patches that improve things! Also check the http://curl.haxx.se/dev web section for various technical development notes. LIBCURL * Introduce an interface to libcurl that allows applications to easier get to know what cookies that are received. Pushing interface that calls a callback on each received cookie? Querying interface that asks about existing cookies? We probably need both. Enable applications to modify existing cookies as well. * Make content encoding/decoding internally be made using a filter system. * Introduce another callback interface for upload/download that makes one less copy of data and thus a faster operation. [http://curl.haxx.se/dev/no_copy_callbacks.txt] * Add asynchronous name resolving (http://libdenise.sf.net/). This should be made to work on most of the supported platforms, or otherwise it isn't really interesting. * Data sharing. Tell which easy handles within a multi handle that should share cookies, connection cache, dns cache, ssl session cache. Full suggestion found here: http://curl.haxx.se/dev/sharing.txt * Mutexes. By adding mutex callback support, the 'data sharing' mentioned above can be made between several easy handles running in different threads too. The actual mutex implementations will be left for the application to implement, libcurl will merely call 'getmutex' and 'leavemutex' callbacks. Part of the sharing suggestion at: http://curl.haxx.se/dev/sharing.txt * Set the SO_KEEPALIVE socket option to make libcurl notice and disconnect very long time idle connections. * Go through the code and verify that libcurl deals with big files >2GB and >4GB all over. Bug reports (and source reviews) indicate that it doesn't currently work properly. * CURLOPT_MAXFILESIZE. Prevent downloads that are larger than the specified size. CURLE_FILESIZE_EXCEEDED would then be returned. Gautam Mani requested. That is, the download should not even begin but be aborted immediately. * Allow the http_proxy (and other) environment variables to contain user and password as well in the style: http://proxyuser:proxypasswd@proxy:port Berend Reitsma suggested. LIBCURL - multi interface * Make sure we don't ever loop because of non-blocking sockets return EWOULDBLOCK or similar. This FTP command sending, the SSL connection etc. * Make transfers treated more carefully. We need a way to tell libcurl we have data to write, as the current system expects us to upload data each time the socket is writable and there is no way to say that we want to upload data soon just not right now, without that aborting the upload. The opposite situation should be possible as well, that we tell libcurl we're ready to accept read data. Today libcurl feeds the data as soon as it is available for reading, no matter what. DOCUMENTATION * More and better FTP * Make CURLOPT_FTPPORT support an additional port number on the IP/if/name, like "blabla:[port]" or possibly even "blabla:[portfirst]-[portsecond]". * FTP ASCII upload does not follow RFC959 section 3.1.1.1: "The sender converts the data from an internal character representation to the standard 8-bit NVT-ASCII representation (see the Telnet specification). The receiver will convert the data from the standard form to his own internal form." * Since USERPWD always override the user and password specified in URLs, we might need another way to specify user+password for anonymous ftp logins. * An option to only download remote FTP files if they're newer than the local one is a good idea, and it would fit right into the same syntax as the already working http dito works (-z). It of course requires that 'MDTM' works, and it isn't a standard FTP command. * Add FTPS support with SSL for the data connection too. This should be made according to the specs written in draft-murray-auth-ftp-ssl-08.txt, "Securing FTP with TLS" * --disable-epsv exists, but for active connections we have no --disable-eprt (or even --disable-lprt). HTTP * If the "body" of the POST is < MSS it really aught to be sent along with the headers. More generally, if the last chunk of the POST body is < MSS, it should be sent with the previous chunk (which may be the POST headers). So long as any one send is larger than MSS (or there is only one send when < MSS :), the Nagle Algorithm will not be a problem on any stack where Nagle is implemented correctly. (pointed out by Rick Jones) * Authentication: NTLM. Support for that MS crap called NTLM authentication. MS proxies and servers sometime require that. Since that protocol is a proprietary one, it involves reverse engineering and network sniffing. This should however be a library-based functionality. There are a few different efforts "out there" to make open source HTTP clients support this and it should be possible to take advantage of other people's hard work. http://modntlm.sourceforge.net/ is one. There's a web page at http://www.innovation.ch/java/ntlm.html that contains detailed reverse- engineered info. * RFC2617 compliance, "Digest Access Authentication" A valid test page seem to exist at: http://hopf.math.nwu.edu/testpage/digest/ And some friendly person's server source code is available at http://hopf.math.nwu.edu/digestauth/index.html Then there's the Apache mod_digest source code too of course. It seems as if Netscape doesn't support this, and not many servers do. Although this is a lot better authentication method than the more common "Basic". Basic sends the password in cleartext over the network, this "Digest" method uses a challange-response protocol which increases security quite a lot. * Pipelining. Sending multiple requests before the previous one(s) are done. This could possibly be implemented using the multi interface to queue requests and the response data. TELNET * Make TELNET work on windows98! * Reading input (to send to the remote server) on stdin is a crappy solution for library purposes. We need to invent a good way for the application to be able to provide the data to send. * Move the telnet support's network select() loop go away and merge the code into the main transfer loop. Until this is done, the multi interface won't work for telnet. SSL * If you really want to improve the SSL situation, you should probably have a look at SSL cafile loading as well - quick traces look to me like these are done on every request as well, when they should only be necessary once per ssl context (or once per handle). Even better would be to support the SSL CAdir option - instead of loading all of the root CA certs for every request, this option allows you to only read the CA chain that is actually required (into the cache)... * Add an interface to libcurl that enables "session IDs" to get exported/imported. Cris Bailiff said: "OpenSSL has functions which can serialise the current SSL state to a buffer of your choice, and recover/reset the state from such a buffer at a later date - this is used by mod_ssl for apache to implement and SSL session ID cache". This whole idea might become moot if we enable the 'data sharing' as mentioned in the LIBCURL label above. * OpenSSL supports a callback for customised verification of the peer certificate, but this doesn't seem to be exposed in the libcurl APIs. Could it be? There's so much that could be done if it were! (brought by Chris Clark) * Make curl's SSL layer option capable of using other free SSL libraries. Such as the Mozilla Security Services (http://www.mozilla.org/projects/security/pki/nss/) and GNUTLS (http://gnutls.hellug.gr/) LDAP * Look over the implementation. The looping will have to "go away" from the lib/ldap.c source file and get moved to the main network code so that the multi interface and friends will work for LDAP as well. CLIENT * Add an option that prevents cURL from overwiting existing local files. When used, and there already is an existing file with the target file name (either -O or -o), a number should be appended (and increased if already existing). So that index.html becomes first index.html.1 and then index.html.2 etc. Jeff Pohlmeyer suggested. * "curl ftp://site.com/*.txt" * Several URLs can be specified to get downloaded. We should be able to use the same syntax to specify several files to get uploaded (using the same persistant connection), using -T. * When the multi interface has been implemented and proved to work, the client could be told to use maximum N simultaneous transfers and then just make sure that happens. It should of course not make more than one connection to the same remote host. * Extending the capabilities of the multipart formposting. How about leaving the ';type=foo' syntax as it is and adding an extra tag (headers) which works like this: curl -F "[email protected];[email protected]" where fil1.hdr contains extra headers like Content-Type: text/plain; charset=KOI8-R" Content-Transfer-Encoding: base64 X-User-Comment: Please don't use browser specific HTML code which should overwrite the program reasonable defaults (plain/text, 8bit...) (Idea brough to us by kromJx) TEST SUITE * If perl wasn't found by the configure script, don't attempt to run the tests but explain something nice why it doesn't. * Extend the test suite to include more protocols. The telnet could just do ftp or http operations (for which we have test servers). * Make the test suite work on more platforms. OpenBSD and Mac OS. Remove fork()s and it should become even more portable. * Introduce a test suite that tests libcurl better and more explicitly. NEXT MAJOR RELEASE * curl_easy_cleanup() returns void, but curl_multi_cleanup() returns a CURLMcode. These should be changed to be the same. * curl_formparse() should be removed
{ "pile_set_name": "Github" }
136b240c0082461b206b32c9f7943b91b1eafeda
{ "pile_set_name": "Github" }
--- title: "Streamlining React Elements" author: [sebmarkbage] date: 2015-02-24 11:00 --- React v0.13 is right around the corner and so we wanted to discuss some upcoming changes to ReactElement. In particular, we added several warnings to some esoteric use cases of ReactElement. There are no runtime behavior changes for ReactElement - we're adding these warnings in the hope that we can change some behavior in v0.14 if the changes are valuable to the community. If you use React in an idiomatic way, chances are, you’ll never see any of these warnings. In that case, you can skip this blog post. You can just enjoy the benefits! These changes will unlock simplified semantics, better error messages, stack traces and compiler optimizations! ## Immutable Props {#immutable-props} In React 0.12, the props object was mutable. It allows you to do patterns like this: ```js var element = <Foo bar={false} />; if (shouldUseFoo) { element.props.foo = 10; element.props.bar = true; } ``` The problem is that we don’t have a convenient way to tell when you’re done mutating. ### Problem: Mutating Props You Don’t Own {#problem-mutating-props-you-dont-own} If you mutate something, you destroy the original value. Therefore, there is nothing to diff against. Imagine something like this: ```js var element = this.props.child; element.props.count = this.state.count; return element; ``` You take a ReactElement through `props.child` and mutate its property before rendering it. If this component's state updates, this render function won't actually get a new ReactElement in `props.child`. It will be the same one. You're mutating the same props. You could imagine that this would work. However, this disables the ability for any component to use `shouldComponentUpdate`. It looks like the component never changed because the previous value is always the same as the next one. Since the DOM layer does diffing, this pattern doesn't even work in this case. The change will never propagate down to the DOM except the first time. Additionally, if this element is reused in other places or used to switch back and forth between two modes, then you have all kinds of weird race conditions. It has always been broken to mutate the props of something passed into you. The problem is that we can’t warn you about this special case if you accidentally do this. ### Problem: Too Late Validation {#problem-too-late-validation} In React 0.12, we do PropType validation very deep inside React during mounting. This means that by the time you get an error, the debugger stack is long gone. This makes it difficult to find complex issues during debugging. We have to do this since it is fairly common for extra props to be added between the call to React.createElement and the mount time. So the type is incomplete until then. The static analysis in Flow is also impaired by this. There is no convenient place in the code where Flow can determine that the props are finalized. ### Solution: Immutable Props {#solution-immutable-props} Therefore, we would like to be able to freeze the element.props object so that it is immediately immutable at the JSX callsite (or createElement). In React 0.13 we will start warning you if you mutate `element.props` after this point. You can generally refactor these pattern to simply use two different JSX calls: ```js if (shouldUseFoo) { return <Foo foo={10} bar={true} />; } else { return <Foo bar={false} />; } ``` However, if you really need to dynamically build up your props you can just use a temporary object and spread it into JSX: ```js var props = { bar: false }; if (shouldUseFoo) { props.foo = 10; props.bar = true; } return <Foo {...props} />; ``` It is still OK to do deep mutations of objects. E.g: ```js return <Foo nestedObject={this.state.myModel} />; ``` In this case it's still ok to mutate the myModel object in state. We recommend that you use fully immutable models. E.g. by using immutable-js. However, we realize that mutable models are still convenient in many cases. Therefore we're only considering shallow freezing the props object that belongs to the ReactElement itself. Not nested objects. ### Solution: Early PropType Warnings {#solution-early-proptype-warnings} We will also start warning you for PropTypes at the JSX or createElement callsite. This will help debugging as you’ll have the stack trace right there. Similarly, Flow also validates PropTypes at this callsite. Note: There are valid patterns that clones a ReactElement and adds additional props to it. In that case these additional props needs to be optional. ```js var element1 = <Foo />; // extra prop is optional var element2 = React.addons.cloneWithProps(element1, { extra: 'prop' }); ``` ## Owner {#owner} In React each child has both a "parent" and an “owner”. The owner is the component that created a ReactElement. I.e. the render method which contains the JSX or createElement callsite. ```js class Foo { render() { return <div><span /></div>; } } ``` In this example, the owner of the `span` is `Foo` but the parent is the `div`. There is also an undocumented feature called "context" that also relies on the concept of an “owner” to pass hidden props down the tree. ### Problem: The Semantics are Opaque and Confusing {#problem-the-semantics-are-opaque-and-confusing} The problem is that these are hidden artifacts attached to the ReactElement. In fact, you probably didn’t even know about it. It silently changes semantics. Take this for example: ```js var foo = <input className="foo" />; class Component { render() { return bar ? <input className="bar" /> : foo; } } ``` These two inputs have different owners, therefore React will not keep its state when the conditional switches. There is nothing in the code to indicate that. Similarly, if you use `React.addons.cloneWithProps`, the owner changes. ### Problem: Timing Matters {#problem-timing-matters} The owner is tracked by the currently executing stack. This means that the semantics of a ReactElement varies depending on when it is executed. Take this example: ```js class A { render() { return <B renderer={text => <span>{text}</span>} />; } } class B { render() { return this.props.renderer('foo'); } } ``` The owner of the `span` is actually `B`, not `A` because of the timing of the callback. This all adds complexity and suffers from similar problems as mutation. ### Problem: It Couples JSX to React {#problem-it-couples-jsx-to-react} Have you wondered why JSX depends on React? Couldn’t the transpiler have that built-in to its runtime? The reason you need to have `React.createElement` in scope is because we depend on internal state of React to capture the current "owner". Without this, you wouldn’t need to have React in scope. ### Solution: Make Context Parent-Based Instead of Owner-Based {#solution-make-context-parent-based-instead-of-owner-based} The first thing we’re doing is warning you if you’re using the "owner" feature in a way that relies on it propagating through owners. Instead, we’re planning on propagating it through parents to its children. In almost all cases, this shouldn’t matter. In fact, parent-based contexts is simply a superset. ### Solution: Remove the Semantic Implications of Owner {#solution-remove-the-semantic-implications-of-owner} It turns out that there are very few cases where owners are actually important part of state-semantics. As a precaution, we’ll warn you if it turns out that the owner is important to determine state. In almost every case this shouldn’t matter. Unless you’re doing some weird optimizations, you shouldn’t see this warning. ### Pending: Change the refs Semantics {#pending-change-the-refs-semantics} Refs are still based on "owner". We haven’t fully solved this special case just yet. In 0.13 we introduced a new callback-refs API that doesn’t suffer from these problems but we’ll keep on a nice declarative alternative to the current semantics for refs. As always, we won’t deprecate something until we’re sure that you’ll have a nice upgrade path. ## Keyed Objects as Maps {#keyed-objects-as-maps} In React 0.12, and earlier, you could use keyed objects to provide an external key to an element or a set. This pattern isn’t actually widely used. It shouldn’t be an issue for most of you. ```js <div>{ {a: <span />, b: <span />} }</div> ``` ### Problem: Relies on Enumeration Order {#problem-relies-on-enumeration-order} The problem with this pattern is that it relies on enumeration order of objects. This is technically unspecified, even though implementations now agree to use insertion order. Except for the special case when numeric keys are used. ### Problem: Using Objects as Maps is Bad {#problem-using-objects-as-maps-is-bad} It is generally accepted that using objects as maps screw up type systems, VM optimizations, compilers etc. It is much better to use a dedicated data structure like ES6 Maps. More importantly, this can have important security implications. For example this has a potential security problem: ```js var children = {}; items.forEach(item => children[item.title] = <span />); return <div>{children}</div>; ``` Imagine if `item.title === '__proto__'` for example. ### Problem: Can’t be Differentiated from Arbitrary Objects {#problem-cant-be-differentiated-from-arbitrary-objects} Since these objects can have any keys with almost any value, we can’t differentiate them from a mistake. If you put some random object, we will try our best to traverse it and render it, instead of failing with a helpful warning. In fact, this is one of the few places where you can accidentally get an infinite loop in React. To differentiate ReactElements from one of these objects, we have to tag them with `_isReactElement`. This is another issue preventing us from inlining ReactElements as simple object literals. ### Solution: Just use an Array and key={…} {#solution-just-use-an-array-and-key} Most of the time you can just use an array with keyed ReactElements. ```js var children = items.map(item => <span key={item.title} />); <div>{children}</div> ``` ### Solution: React.addons.createFragment {#solution-reactaddonscreatefragment} However, this is not always possible if you’re trying to add a prefix key to an unknown set (e.g. this.props.children). It is also not always the easiest upgrade path. Therefore, we are adding a helper to `React.addons` called `createFragment()`. This accepts a keyed object and returns an opaque type. ```js <div>{React.addons.createFragment({ a: <div />, b: this.props.children })}</div> ``` The exact signature of this kind of fragment will be determined later. It will likely be some kind of immutable sequence. Note: This will still not be valid as the direct return value of `render()`. Unfortunately, they still need to be wrapped in a `<div />` or some other element. ## Compiler Optimizations: Unlocked! {#compiler-optimizations-unlocked} These changes also unlock several possible compiler optimizations for static content in React 0.14. These optimizations were previously only available to template-based frameworks. They will now also be possible for React code! Both for JSX and `React.createElement/Factory`*! See these GitHub Issues for a deep dive into compiler optimizations: - [Reuse Constant Value Types](https://github.com/facebook/react/issues/3226) - [Tagging ReactElements](https://github.com/facebook/react/issues/3227) - [Inline ReactElements](https://github.com/facebook/react/issues/3228) \* If you use the recommended pattern of explicit React.createFactory calls on the consumer side - since they are easily statically analyzed. ## Rationale {#rationale} I thought that these changes were particularly important because the mere existence of these patterns means that even components that DON’T use these patterns have to pay the price. There are other problematic patterns such as mutating state, but they’re at least localized to a component subtree so they don’t harm the ecosystem. As always, we’d love to hear your feedback and if you have any trouble upgrading, please let us know.
{ "pile_set_name": "Github" }
#!/bin/bash # description: system-wide syscall counts # args: [comm] if [ $# -gt 0 ] ; then if ! expr match "$1" "-" > /dev/null ; then comm=$1 shift fi fi perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/syscall-counts.py $comm
{ "pile_set_name": "Github" }
using GridBlazorClientSide.Shared.Models; using Microsoft.EntityFrameworkCore; using System; using System.Linq; using System.Threading.Tasks; namespace GridBlazorClientSide.Server.Models { public class EmployeeRepository : SqlRepository<Employee>, IEmployeeRepository { public EmployeeRepository(NorthwindDbContext context) : base(context) { } public override IQueryable<Employee> GetAll() { return EfDbSet; } public override async Task<Employee> GetById(object id) { return await GetAll().SingleOrDefaultAsync(c => c.EmployeeID == (int)id); } public async Task Insert(Employee employee) { await EfDbSet.AddAsync(employee); } public async Task Update(Employee employee) { var entry = Context.Entry(employee); if (entry.State == EntityState.Detached) { var attachedEmployee = await GetById(employee.EmployeeID); if (attachedEmployee != null) { var photo = attachedEmployee.Photo; Context.Entry(attachedEmployee).CurrentValues.SetValues(employee); attachedEmployee.Photo = photo; } else { entry.State = EntityState.Modified; } } } public async Task UpdatePhoto(int id, string photo) { var employee = await GetById(id); if (employee != null) { // convert url scaped base64 to byte array photo = photo.Replace('.', '+'); photo = photo.Replace('_', '/'); photo = photo.Replace('-', '='); employee.Photo = Convert.FromBase64String(photo); } } public void Delete(Employee employee) { EfDbSet.Remove(employee); } public void Save() { Context.SaveChanges(); } } public interface IEmployeeRepository { Task Insert(Employee employee); Task Update(Employee employee); Task UpdatePhoto(int id, string photo); void Delete(Employee employee); void Save(); } }
{ "pile_set_name": "Github" }
<?php /* * Copyright 2007-2017 Charles du Jeu - Abstrium SAS <team (at) pyd.io> * This file is part of Pydio. * * Pydio is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Pydio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Pydio. If not, see <http://www.gnu.org/licenses/>. * * The latest code can be found at <https://pydio.com>. */ namespace Pydio\Conf\Core; defined('AJXP_EXEC') or die( 'Access not allowed'); /** * @package Pydio * @subpackage Core */ interface IGroupPathProvider { /** * @abstract * @return String */ public function getGroupPath(); /** * @abstract * @param String $groupPath * @param bool $update Save use after setting groupPath * @return void */ public function setGroupPath($groupPath, $update=true); }
{ "pile_set_name": "Github" }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; namespace Microsoft.Extensions.Internal.LE { internal struct AwaitableInfo { public Type AwaiterType { get; } public PropertyInfo AwaiterIsCompletedProperty { get; } public MethodInfo AwaiterGetResultMethod { get; } public MethodInfo AwaiterOnCompletedMethod { get; } public MethodInfo AwaiterUnsafeOnCompletedMethod { get; } public Type ResultType { get; } public MethodInfo GetAwaiterMethod { get; } public AwaitableInfo( Type awaiterType, PropertyInfo awaiterIsCompletedProperty, MethodInfo awaiterGetResultMethod, MethodInfo awaiterOnCompletedMethod, MethodInfo awaiterUnsafeOnCompletedMethod, Type resultType, MethodInfo getAwaiterMethod) { AwaiterType = awaiterType; AwaiterIsCompletedProperty = awaiterIsCompletedProperty; AwaiterGetResultMethod = awaiterGetResultMethod; AwaiterOnCompletedMethod = awaiterOnCompletedMethod; AwaiterUnsafeOnCompletedMethod = awaiterUnsafeOnCompletedMethod; ResultType = resultType; GetAwaiterMethod = getAwaiterMethod; } public static bool IsTypeAwaitable(Type type, out AwaitableInfo awaitableInfo) { // Based on Roslyn code: http://source.roslyn.io/#Microsoft.CodeAnalysis.Workspaces/Shared/Extensions/ISymbolExtensions.cs,db4d48ba694b9347 // Awaitable must have method matching "object GetAwaiter()" var getAwaiterMethod = type.GetRuntimeMethods().FirstOrDefault(m => m.Name.Equals("GetAwaiter", StringComparison.OrdinalIgnoreCase) && m.GetParameters().Length == 0 && m.ReturnType != null); if (getAwaiterMethod == null) { awaitableInfo = default(AwaitableInfo); return false; } var awaiterType = getAwaiterMethod.ReturnType; // Awaiter must have property matching "bool IsCompleted { get; }" var isCompletedProperty = awaiterType.GetRuntimeProperties().FirstOrDefault(p => p.Name.Equals("IsCompleted", StringComparison.OrdinalIgnoreCase) && p.PropertyType == typeof(bool) && p.GetMethod != null); if (isCompletedProperty == null) { awaitableInfo = default(AwaitableInfo); return false; } // Awaiter must implement INotifyCompletion var awaiterInterfaces = awaiterType.GetInterfaces(); var implementsINotifyCompletion = awaiterInterfaces.Any(t => t == typeof(INotifyCompletion)); if (!implementsINotifyCompletion) { awaitableInfo = default(AwaitableInfo); return false; } // INotifyCompletion supplies a method matching "void OnCompleted(Action action)" var iNotifyCompletionMap = awaiterType .GetTypeInfo() .GetRuntimeInterfaceMap(typeof(INotifyCompletion)); var onCompletedMethod = iNotifyCompletionMap.InterfaceMethods.Single(m => m.Name.Equals("OnCompleted", StringComparison.OrdinalIgnoreCase) && m.ReturnType == typeof(void) && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType == typeof(Action)); // Awaiter optionally implements ICriticalNotifyCompletion var implementsICriticalNotifyCompletion = awaiterInterfaces.Any(t => t == typeof(ICriticalNotifyCompletion)); MethodInfo unsafeOnCompletedMethod; if (implementsICriticalNotifyCompletion) { // ICriticalNotifyCompletion supplies a method matching "void UnsafeOnCompleted(Action action)" var iCriticalNotifyCompletionMap = awaiterType .GetTypeInfo() .GetRuntimeInterfaceMap(typeof(ICriticalNotifyCompletion)); unsafeOnCompletedMethod = iCriticalNotifyCompletionMap.InterfaceMethods.Single(m => m.Name.Equals("UnsafeOnCompleted", StringComparison.OrdinalIgnoreCase) && m.ReturnType == typeof(void) && m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType == typeof(Action)); } else { unsafeOnCompletedMethod = null; } // Awaiter must have method matching "void GetResult" or "T GetResult()" var getResultMethod = awaiterType.GetRuntimeMethods().FirstOrDefault(m => m.Name.Equals("GetResult") && m.GetParameters().Length == 0); if (getResultMethod == null) { awaitableInfo = default(AwaitableInfo); return false; } awaitableInfo = new AwaitableInfo( awaiterType, isCompletedProperty, getResultMethod, onCompletedMethod, unsafeOnCompletedMethod, getResultMethod.ReturnType, getAwaiterMethod); return true; } } }
{ "pile_set_name": "Github" }
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery UI Resizable - Default functionality</title> <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> <script src="../../jquery-1.9.1.js"></script> <script src="../../ui/jquery.ui.core.js"></script> <script src="../../ui/jquery.ui.widget.js"></script> <script src="../../ui/jquery.ui.mouse.js"></script> <script src="../../ui/jquery.ui.resizable.js"></script> <link rel="stylesheet" href="../demos.css"> <style> #resizable { width: 150px; height: 150px; padding: 0.5em; } #resizable h3 { text-align: center; margin: 0; } </style> <script> $(function() { $( "#resizable" ).resizable(); }); </script> </head> <body> <div id="resizable" class="ui-widget-content"> <h3 class="ui-widget-header">Resizable</h3> </div> <div class="demo-description"> <p>Enable any DOM element to be resizable. With the cursor grab the right or bottom border and drag to the desired width or height.</p> </div> </body> </html>
{ "pile_set_name": "Github" }
<?php namespace CodeIgniter\Helpers; final class DateHelperTest extends \CodeIgniter\Test\CIUnitTestCase { private $name; private $value; private $expire; private $response; protected function setUp(): void { parent::setUp(); helper('date'); } //-------------------------------------------------------------------- public function testNowDefault() { $time = new \DateTime(); $this->assertCloseEnough(now(), time()); // close enough } //-------------------------------------------------------------------- public function testNowSpecific() { // Chicago should be two hours ahead of Vancouver $this->assertCloseEnough(7200, now('America/Chicago') - now('America/Vancouver')); } }
{ "pile_set_name": "Github" }
# The MIT License # # Italian localization plugin for Jenkins # Copyright © 2020 Alessandro Menti # # 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. blurb=Questa vista visualizza automaticamente tutti i processi a cui \ l''utente corrente ha accesso.
{ "pile_set_name": "Github" }
Array3d v(2,3,4), w(4,2,3); cout << v.min(w) << endl;
{ "pile_set_name": "Github" }
package org.json; /* Copyright (c) 2002 JSON.org 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 shall be used for Good, not Evil. 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. */ /** * The XMLTokener extends the JSONTokener to provide additional methods * for the parsing of XML texts. * @author JSON.org * @version 2010-01-30 */ public class XMLTokener extends JSONTokener { /** The table of entity values. It initially contains Character values for * amp, apos, gt, lt, quot. */ public static final java.util.HashMap entity; static { entity = new java.util.HashMap(8); entity.put("amp", XML.AMP); entity.put("apos", XML.APOS); entity.put("gt", XML.GT); entity.put("lt", XML.LT); entity.put("quot", XML.QUOT); } /** * Construct an XMLTokener from a string. * @param s A source string. */ public XMLTokener(String s) { super(s); } /** * Get the text in the CDATA block. * @return The string up to the <code>]]&gt;</code>. * @throws JSONException If the <code>]]&gt;</code> is not found. */ public String nextCDATA() throws JSONException { char c; int i; StringBuffer sb = new StringBuffer(); for (;;) { c = next(); if (end()) { throw syntaxError("Unclosed CDATA"); } sb.append(c); i = sb.length() - 3; if (i >= 0 && sb.charAt(i) == ']' && sb.charAt(i + 1) == ']' && sb.charAt(i + 2) == '>') { sb.setLength(i); return sb.toString(); } } } /** * Get the next XML outer token, trimming whitespace. There are two kinds * of tokens: the '<' character which begins a markup tag, and the content * text between markup tags. * * @return A string, or a '<' Character, or null if there is no more * source text. * @throws JSONException */ public Object nextContent() throws JSONException { char c; StringBuffer sb; do { c = next(); } while (Character.isWhitespace(c)); if (c == 0) { return null; } if (c == '<') { return XML.LT; } sb = new StringBuffer(); for (;;) { if (c == '<' || c == 0) { back(); return sb.toString().trim(); } if (c == '&') { sb.append(nextEntity(c)); } else { sb.append(c); } c = next(); } } /** * Return the next entity. These entities are translated to Characters: * <code>&amp; &apos; &gt; &lt; &quot;</code>. * @param a An ampersand character. * @return A Character or an entity String if the entity is not recognized. * @throws JSONException If missing ';' in XML entity. */ public Object nextEntity(char a) throws JSONException { StringBuffer sb = new StringBuffer(); for (;;) { char c = next(); if (Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if (c == ';') { break; } else { throw syntaxError("Missing ';' in XML entity: &" + sb); } } String s = sb.toString(); Object e = entity.get(s); return e != null ? e : a + s + ";"; } /** * Returns the next XML meta token. This is used for skipping over <!...> * and <?...?> structures. * @return Syntax characters (<code>< > / = ! ?</code>) are returned as * Character, and strings and names are returned as Boolean. We don't care * what the values actually are. * @throws JSONException If a string is not properly closed or if the XML * is badly structured. */ public Object nextMeta() throws JSONException { char c; char q; do { c = next(); } while (Character.isWhitespace(c)); switch (c) { case 0: throw syntaxError("Misshaped meta tag"); case '<': return XML.LT; case '>': return XML.GT; case '/': return XML.SLASH; case '=': return XML.EQ; case '!': return XML.BANG; case '?': return XML.QUEST; case '"': case '\'': q = c; for (;;) { c = next(); if (c == 0) { throw syntaxError("Unterminated string"); } if (c == q) { return Boolean.TRUE; } } default: for (;;) { c = next(); if (Character.isWhitespace(c)) { return Boolean.TRUE; } switch (c) { case 0: case '<': case '>': case '/': case '=': case '!': case '?': case '"': case '\'': back(); return Boolean.TRUE; } } } } /** * Get the next XML Token. These tokens are found inside of angle * brackets. It may be one of these characters: <code>/ > = ! ?</code> or it * may be a string wrapped in single quotes or double quotes, or it may be a * name. * @return a String or a Character. * @throws JSONException If the XML is not well formed. */ public Object nextToken() throws JSONException { char c; char q; StringBuffer sb; do { c = next(); } while (Character.isWhitespace(c)); switch (c) { case 0: throw syntaxError("Misshaped element"); case '<': throw syntaxError("Misplaced '<'"); case '>': return XML.GT; case '/': return XML.SLASH; case '=': return XML.EQ; case '!': return XML.BANG; case '?': return XML.QUEST; // Quoted string case '"': case '\'': q = c; sb = new StringBuffer(); for (;;) { c = next(); if (c == 0) { throw syntaxError("Unterminated string"); } if (c == q) { return sb.toString(); } if (c == '&') { sb.append(nextEntity(c)); } else { sb.append(c); } } default: // Name sb = new StringBuffer(); for (;;) { sb.append(c); c = next(); if (Character.isWhitespace(c)) { return sb.toString(); } switch (c) { case 0: return sb.toString(); case '>': case '/': case '=': case '!': case '?': case '[': case ']': back(); return sb.toString(); case '<': case '"': case '\'': throw syntaxError("Bad character in a name"); } } } } /** * Skip characters until past the requested string. * If it is not found, we are left at the end of the source with a result of false. * @param to A string to skip past. * @throws JSONException */ public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int n = to.length(); char[] circle = new char[n]; /* * First fill the circle buffer with as many characters as are in the * to string. If we reach an early end, bail. */ for (i = 0; i < n; i += 1) { c = next(); if (c == 0) { return false; } circle[i] = c; } /* * We will loop, possibly for all of the remaining characters. */ for (;;) { j = offset; b = true; /* * Compare the circle buffer with the to string. */ for (i = 0; i < n; i += 1) { if (circle[j] != to.charAt(i)) { b = false; break; } j += 1; if (j >= n) { j -= n; } } /* * If we exit the loop with b intact, then victory is ours. */ if (b) { return true; } /* * Get the next character. If there isn't one, then defeat is ours. */ c = next(); if (c == 0) { return false; } /* * Shove the character in the circle buffer and advance the * circle offset. The offset is mod n. */ circle[offset] = c; offset += 1; if (offset >= n) { offset -= n; } } } }
{ "pile_set_name": "Github" }
require 'strscan' require 'digest/sha1' require 'sass/tree/node' require 'sass/tree/root_node' require 'sass/tree/rule_node' require 'sass/tree/comment_node' require 'sass/tree/prop_node' require 'sass/tree/directive_node' require 'sass/tree/variable_node' require 'sass/tree/mixin_def_node' require 'sass/tree/mixin_node' require 'sass/tree/extend_node' require 'sass/tree/if_node' require 'sass/tree/while_node' require 'sass/tree/for_node' require 'sass/tree/debug_node' require 'sass/tree/warn_node' require 'sass/tree/import_node' require 'sass/selector' require 'sass/environment' require 'sass/script' require 'sass/scss' require 'sass/error' require 'sass/files' require 'haml/shared' module Sass # A Sass mixin. # # `name`: `String` # : The name of the mixin. # # `args`: `Array<(String, Script::Node)>` # : The arguments for the mixin. # Each element is a tuple containing the name of the argument # and the parse tree for the default value of the argument. # # `environment`: {Sass::Environment} # : The environment in which the mixin was defined. # This is captured so that the mixin can have access # to local variables defined in its scope. # # `tree`: {Sass::Tree::Node} # : The parse tree for the mixin. Mixin = Struct.new(:name, :args, :environment, :tree) # This class handles the parsing and compilation of the Sass template. # Example usage: # # template = File.load('stylesheets/sassy.sass') # sass_engine = Sass::Engine.new(template) # output = sass_engine.render # puts output class Engine include Haml::Util # A line of Sass code. # # `text`: `String` # : The text in the line, without any whitespace at the beginning or end. # # `tabs`: `Fixnum` # : The level of indentation of the line. # # `index`: `Fixnum` # : The line number in the original document. # # `offset`: `Fixnum` # : The number of bytes in on the line that the text begins. # This ends up being the number of bytes of leading whitespace. # # `filename`: `String` # : The name of the file in which this line appeared. # # `children`: `Array<Line>` # : The lines nested below this one. class Line < Struct.new(:text, :tabs, :index, :offset, :filename, :children) def comment? text[0] == COMMENT_CHAR && (text[1] == SASS_COMMENT_CHAR || text[1] == CSS_COMMENT_CHAR) end end # The character that begins a CSS property. PROPERTY_CHAR = ?: # The character that designates that # a property should be assigned to a SassScript expression. SCRIPT_CHAR = ?= # The character that designates the beginning of a comment, # either Sass or CSS. COMMENT_CHAR = ?/ # The character that follows the general COMMENT_CHAR and designates a Sass comment, # which is not output as a CSS comment. SASS_COMMENT_CHAR = ?/ # The character that follows the general COMMENT_CHAR and designates a CSS comment, # which is embedded in the CSS document. CSS_COMMENT_CHAR = ?* # The character used to denote a compiler directive. DIRECTIVE_CHAR = ?@ # Designates a non-parsed rule. ESCAPE_CHAR = ?\\ # Designates block as mixin definition rather than CSS rules to output MIXIN_DEFINITION_CHAR = ?= # Includes named mixin declared using MIXIN_DEFINITION_CHAR MIXIN_INCLUDE_CHAR = ?+ # The regex that matches properties of the form `name: prop`. PROPERTY_NEW_MATCHER = /^[^\s:"\[]+\s*[=:](\s|$)/ # The regex that matches and extracts data from # properties of the form `name: prop`. PROPERTY_NEW = /^([^\s=:"]+)\s*(=|:)(?:\s+|$)(.*)/ # The regex that matches and extracts data from # properties of the form `:name prop`. PROPERTY_OLD = /^:([^\s=:"]+)\s*(=?)(?:\s+|$)(.*)/ # The default options for Sass::Engine. # @api public DEFAULT_OPTIONS = { :style => :nested, :load_paths => ['.'], :cache => true, :cache_location => './.sass-cache', :syntax => :sass, }.freeze # @param template [String] The Sass template. # This template can be encoded using any encoding # that can be converted to Unicode. # If the template contains an `@charset` declaration, # that overrides the Ruby encoding # (see {file:SASS_REFERENCE.md#encodings the encoding documentation}) # @param options [{Symbol => Object}] An options hash; # see {file:SASS_REFERENCE.md#sass_options the Sass options documentation} def initialize(template, options={}) @options = DEFAULT_OPTIONS.merge(options.reject {|k, v| v.nil?}) @template = template # Support both, because the docs said one and the other actually worked # for quite a long time. @options[:line_comments] ||= @options[:line_numbers] # Backwards compatibility @options[:property_syntax] ||= @options[:attribute_syntax] case @options[:property_syntax] when :alternate; @options[:property_syntax] = :new when :normal; @options[:property_syntax] = :old end end # Render the template to CSS. # # @return [String] The CSS # @raise [Sass::SyntaxError] if there's an error in the document # @raise [Encoding::UndefinedConversionError] if the source encoding # cannot be converted to UTF-8 # @raise [ArgumentError] if the document uses an unknown encoding with `@charset` def render return _render unless @options[:quiet] Haml::Util.silence_haml_warnings {_render} end alias_method :to_css, :render # Parses the document into its parse tree. # # @return [Sass::Tree::Node] The root of the parse tree. # @raise [Sass::SyntaxError] if there's an error in the document def to_tree return _to_tree unless @options[:quiet] Haml::Util.silence_haml_warnings {_to_tree} end # Returns the original encoding of the document, # or `nil` under Ruby 1.8. # # @return [Encoding, nil] # @raise [Encoding::UndefinedConversionError] if the source encoding # cannot be converted to UTF-8 # @raise [ArgumentError] if the document uses an unknown encoding with `@charset` def source_encoding check_encoding! @original_encoding end private def _render rendered = _to_tree.render return rendered if ruby1_8? return rendered.encode(source_encoding) end def _to_tree check_encoding! if @options[:syntax] == :scss root = Sass::SCSS::Parser.new(@template).parse else root = Tree::RootNode.new(@template) append_children(root, tree(tabulate(@template)).first, true) end root.options = @options root rescue SyntaxError => e e.modify_backtrace(:filename => @options[:filename], :line => @line) e.sass_template = @template raise e end def check_encoding! return if @checked_encoding @checked_encoding = true @template, @original_encoding = check_sass_encoding(@template) do |msg, line| raise Sass::SyntaxError.new(msg, :line => line) end end def tabulate(string) tab_str = nil comment_tab_str = nil first = true lines = [] string.gsub(/\r|\n|\r\n|\r\n/, "\n").scan(/^.*?$/).each_with_index do |line, index| index += (@options[:line] || 1) if line.strip.empty? lines.last.text << "\n" if lines.last && lines.last.comment? next end line_tab_str = line[/^\s*/] unless line_tab_str.empty? if tab_str.nil? comment_tab_str ||= line_tab_str next if try_comment(line, lines.last, "", comment_tab_str, index) comment_tab_str = nil end tab_str ||= line_tab_str raise SyntaxError.new("Indenting at the beginning of the document is illegal.", :line => index) if first raise SyntaxError.new("Indentation can't use both tabs and spaces.", :line => index) if tab_str.include?(?\s) && tab_str.include?(?\t) end first &&= !tab_str.nil? if tab_str.nil? lines << Line.new(line.strip, 0, index, 0, @options[:filename], []) next end comment_tab_str ||= line_tab_str if try_comment(line, lines.last, tab_str * lines.last.tabs, comment_tab_str, index) next else comment_tab_str = nil end line_tabs = line_tab_str.scan(tab_str).size if tab_str * line_tabs != line_tab_str message = <<END.strip.gsub("\n", ' ') Inconsistent indentation: #{Haml::Shared.human_indentation line_tab_str, true} used for indentation, but the rest of the document was indented using #{Haml::Shared.human_indentation tab_str}. END raise SyntaxError.new(message, :line => index) end lines << Line.new(line.strip, line_tabs, index, tab_str.size, @options[:filename], []) end lines end def try_comment(line, last, tab_str, comment_tab_str, index) return unless last && last.comment? # Nested comment stuff must be at least one whitespace char deeper # than the normal indentation return unless line =~ /^#{tab_str}\s/ unless line =~ /^(?:#{comment_tab_str})(.*)$/ raise SyntaxError.new(<<MSG.strip.gsub("\n", " "), :line => index) Inconsistent indentation: previous line was indented by #{Haml::Shared.human_indentation comment_tab_str}, but this line was indented by #{Haml::Shared.human_indentation line[/^\s*/]}. MSG end last.text << "\n" << $1 true end def tree(arr, i = 0) return [], i if arr[i].nil? base = arr[i].tabs nodes = [] while (line = arr[i]) && line.tabs >= base if line.tabs > base raise SyntaxError.new("The line was indented #{line.tabs - base} levels deeper than the previous line.", :line => line.index) if line.tabs > base + 1 nodes.last.children, i = tree(arr, i) else nodes << line i += 1 end end return nodes, i end def build_tree(parent, line, root = false) @line = line.index node_or_nodes = parse_line(parent, line, root) Array(node_or_nodes).each do |node| # Node is a symbol if it's non-outputting, like a variable assignment next unless node.is_a? Tree::Node node.line = line.index node.filename = line.filename append_children(node, line.children, false) end node_or_nodes end def append_children(parent, children, root) continued_rule = nil continued_comment = nil children.each do |line| child = build_tree(parent, line, root) if child.is_a?(Tree::RuleNode) && child.continued? raise SyntaxError.new("Rules can't end in commas.", :line => child.line) unless child.children.empty? if continued_rule continued_rule.add_rules child else continued_rule = child end next end if continued_rule raise SyntaxError.new("Rules can't end in commas.", :line => continued_rule.line) unless child.is_a?(Tree::RuleNode) continued_rule.add_rules child continued_rule.children = child.children continued_rule, child = nil, continued_rule end if child.is_a?(Tree::CommentNode) && child.silent if continued_comment && child.line == continued_comment.line + continued_comment.value.count("\n") + 1 continued_comment.value << "\n" << child.value next end continued_comment = child end check_for_no_children(child) validate_and_append_child(parent, child, line, root) end raise SyntaxError.new("Rules can't end in commas.", :line => continued_rule.line) if continued_rule parent end def validate_and_append_child(parent, child, line, root) case child when Array child.each {|c| validate_and_append_child(parent, c, line, root)} when Tree::Node parent << child end end def check_for_no_children(node) return unless node.is_a?(Tree::RuleNode) && node.children.empty? Haml::Util.haml_warn(<<WARNING.strip) WARNING on line #{node.line}#{" of #{node.filename}" if node.filename}: This selector doesn't have any properties and will not be rendered. WARNING end def parse_line(parent, line, root) case line.text[0] when PROPERTY_CHAR if line.text[1] == PROPERTY_CHAR || (@options[:property_syntax] == :new && line.text =~ PROPERTY_OLD && $3.empty?) # Support CSS3-style pseudo-elements, # which begin with ::, # as well as pseudo-classes # if we're using the new property syntax Tree::RuleNode.new(parse_interp(line.text)) else name, eq, value = line.text.scan(PROPERTY_OLD)[0] raise SyntaxError.new("Invalid property: \"#{line.text}\".", :line => @line) if name.nil? || value.nil? parse_property(name, parse_interp(name), eq, value, :old, line) end when ?!, ?$ parse_variable(line) when COMMENT_CHAR parse_comment(line.text) when DIRECTIVE_CHAR parse_directive(parent, line, root) when ESCAPE_CHAR Tree::RuleNode.new(parse_interp(line.text[1..-1])) when MIXIN_DEFINITION_CHAR parse_mixin_definition(line) when MIXIN_INCLUDE_CHAR if line.text[1].nil? || line.text[1] == ?\s Tree::RuleNode.new(parse_interp(line.text)) else parse_mixin_include(line, root) end else parse_property_or_rule(line) end end def parse_property_or_rule(line) scanner = StringScanner.new(line.text) hack_char = scanner.scan(/[:\*\.]|\#(?!\{)/) parser = Sass::SCSS::SassParser.new(scanner, @line) unless res = parser.parse_interp_ident return Tree::RuleNode.new(parse_interp(line.text)) end res.unshift(hack_char) if hack_char if comment = scanner.scan(Sass::SCSS::RX::COMMENT) res << comment end name = line.text[0...scanner.pos] if scanner.scan(/\s*([:=])(?:\s|$)/) parse_property(name, res, scanner[1], scanner.rest, :new, line) else res.pop if comment Tree::RuleNode.new(res + parse_interp(scanner.rest)) end end def parse_property(name, parsed_name, eq, value, prop, line) if value.strip.empty? expr = Sass::Script::String.new("") else expr = parse_script(value, :offset => line.offset + line.text.index(value)) if eq.strip[0] == SCRIPT_CHAR expr.context = :equals Script.equals_warning("properties", name, Sass::Tree::PropNode.val_to_sass(expr, @options), false, @line, line.offset + 1, @options[:filename]) end end Tree::PropNode.new(parse_interp(name), expr, prop) end def parse_variable(line) name, op, value, default = line.text.scan(Script::MATCH)[0] guarded = op =~ /^\|\|/ raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath variable declarations.", :line => @line + 1) unless line.children.empty? raise SyntaxError.new("Invalid variable: \"#{line.text}\".", :line => @line) unless name && value Script.var_warning(name, @line, line.offset + 1, @options[:filename]) if line.text[0] == ?! expr = parse_script(value, :offset => line.offset + line.text.index(value)) if op =~ /=$/ expr.context = :equals type = guarded ? "variable defaults" : "variables" Script.equals_warning(type, "$#{name}", expr.to_sass, guarded, @line, line.offset + 1, @options[:filename]) end Tree::VariableNode.new(name, expr, default || guarded) end def parse_comment(line) if line[1] == CSS_COMMENT_CHAR || line[1] == SASS_COMMENT_CHAR silent = line[1] == SASS_COMMENT_CHAR Tree::CommentNode.new( format_comment_text(line[2..-1], silent), silent) else Tree::RuleNode.new(parse_interp(line)) end end def parse_directive(parent, line, root) directive, whitespace, value = line.text[1..-1].split(/(\s+)/, 2) offset = directive.size + whitespace.size + 1 if whitespace # If value begins with url( or ", # it's a CSS @import rule and we don't want to touch it. if directive == "import" parse_import(line, value) elsif directive == "mixin" parse_mixin_definition(line) elsif directive == "include" parse_mixin_include(line, root) elsif directive == "for" parse_for(line, root, value) elsif directive == "else" parse_else(parent, line, value) elsif directive == "while" raise SyntaxError.new("Invalid while directive '@while': expected expression.") unless value Tree::WhileNode.new(parse_script(value, :offset => offset)) elsif directive == "if" raise SyntaxError.new("Invalid if directive '@if': expected expression.") unless value Tree::IfNode.new(parse_script(value, :offset => offset)) elsif directive == "debug" raise SyntaxError.new("Invalid debug directive '@debug': expected expression.") unless value raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath debug directives.", :line => @line + 1) unless line.children.empty? offset = line.offset + line.text.index(value).to_i Tree::DebugNode.new(parse_script(value, :offset => offset)) elsif directive == "extend" raise SyntaxError.new("Invalid extend directive '@extend': expected expression.") unless value raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath extend directives.", :line => @line + 1) unless line.children.empty? offset = line.offset + line.text.index(value).to_i Tree::ExtendNode.new(parse_interp(value, offset)) elsif directive == "warn" raise SyntaxError.new("Invalid warn directive '@warn': expected expression.") unless value raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath warn directives.", :line => @line + 1) unless line.children.empty? offset = line.offset + line.text.index(value).to_i Tree::WarnNode.new(parse_script(value, :offset => offset)) else Tree::DirectiveNode.new(line.text) end end def parse_for(line, root, text) var, from_expr, to_name, to_expr = text.scan(/^([^\s]+)\s+from\s+(.+)\s+(to|through)\s+(.+)$/).first if var.nil? # scan failed, try to figure out why for error message if text !~ /^[^\s]+/ expected = "variable name" elsif text !~ /^[^\s]+\s+from\s+.+/ expected = "'from <expr>'" else expected = "'to <expr>' or 'through <expr>'" end raise SyntaxError.new("Invalid for directive '@for #{text}': expected #{expected}.") end raise SyntaxError.new("Invalid variable \"#{var}\".") unless var =~ Script::VALIDATE if var.slice!(0) == ?! offset = line.offset + line.text.index("!" + var) + 1 Script.var_warning(var, @line, offset, @options[:filename]) end parsed_from = parse_script(from_expr, :offset => line.offset + line.text.index(from_expr)) parsed_to = parse_script(to_expr, :offset => line.offset + line.text.index(to_expr)) Tree::ForNode.new(var, parsed_from, parsed_to, to_name == 'to') end def parse_else(parent, line, text) previous = parent.children.last raise SyntaxError.new("@else must come after @if.") unless previous.is_a?(Tree::IfNode) if text if text !~ /^if\s+(.+)/ raise SyntaxError.new("Invalid else directive '@else #{text}': expected 'if <expr>'.") end expr = parse_script($1, :offset => line.offset + line.text.index($1)) end node = Tree::IfNode.new(expr) append_children(node, line.children, false) previous.add_else node nil end def parse_import(line, value) raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath import directives.", :line => @line + 1) unless line.children.empty? scanner = StringScanner.new(value) values = [] loop do unless node = parse_import_arg(scanner) raise SyntaxError.new("Invalid @import: expected file to import, was #{scanner.rest.inspect}", :line => @line) end values << node break unless scanner.scan(/,\s*/) end return values end def parse_import_arg(scanner) return if scanner.eos? unless (str = scanner.scan(Sass::SCSS::RX::STRING)) || (uri = scanner.scan(Sass::SCSS::RX::URI)) return Tree::ImportNode.new(scanner.scan(/[^,]+/)) end val = scanner[1] || scanner[2] scanner.scan(/\s*/) if media = scanner.scan(/[^,].*/) Tree::DirectiveNode.new("@import #{str || uri} #{media}") elsif uri Tree::DirectiveNode.new("@import #{uri}") elsif val =~ /^http:\/\// Tree::DirectiveNode.new("@import url(#{val})") else Tree::ImportNode.new(val) end end MIXIN_DEF_RE = /^(?:=|@mixin)\s*(#{Sass::SCSS::RX::IDENT})(.*)$/ def parse_mixin_definition(line) name, arg_string = line.text.scan(MIXIN_DEF_RE).first raise SyntaxError.new("Invalid mixin \"#{line.text[1..-1]}\".") if name.nil? offset = line.offset + line.text.size - arg_string.size args = Script::Parser.new(arg_string.strip, @line, offset, @options). parse_mixin_definition_arglist default_arg_found = false Tree::MixinDefNode.new(name, args) end MIXIN_INCLUDE_RE = /^(?:\+|@include)\s*(#{Sass::SCSS::RX::IDENT})(.*)$/ def parse_mixin_include(line, root) name, arg_string = line.text.scan(MIXIN_INCLUDE_RE).first raise SyntaxError.new("Invalid mixin include \"#{line.text}\".") if name.nil? offset = line.offset + line.text.size - arg_string.size args = Script::Parser.new(arg_string.strip, @line, offset, @options). parse_mixin_include_arglist raise SyntaxError.new("Illegal nesting: Nothing may be nested beneath mixin directives.", :line => @line + 1) unless line.children.empty? Tree::MixinNode.new(name, args) end def parse_script(script, options = {}) line = options[:line] || @line offset = options[:offset] || 0 Script.parse(script, line, offset, @options) end def format_comment_text(text, silent) content = text.split("\n") if content.first && content.first.strip.empty? removed_first = true content.shift end return silent ? "//" : "/* */" if content.empty? content.last.gsub!(%r{ ?\*/ *$}, '') content.map! {|l| l.gsub!(/^\*( ?)/, '\1') || (l.empty? ? "" : " ") + l} content.first.gsub!(/^ /, '') unless removed_first if silent "//" + content.join("\n//") else # The #gsub fixes the case of a trailing */ "/*" + content.join("\n *").gsub(/ \*\Z/, '') + " */" end end def parse_interp(text, offset = 0) self.class.parse_interp(text, @line, offset, :filename => @filename) end # It's important that this have strings (at least) # at the beginning, the end, and between each Script::Node. # # @private def self.parse_interp(text, line, offset, options) res = [] rest = Haml::Shared.handle_interpolation text do |scan| escapes = scan[2].size res << scan.matched[0...-2 - escapes] if escapes % 2 == 1 res << "\\" * (escapes - 1) << '#{' else res << "\\" * [0, escapes - 1].max res << Script::Parser.new( scan, line, offset + scan.pos - scan.matched_size, options). parse_interpolated end end res << rest end end end
{ "pile_set_name": "Github" }
#define CUDA_KERNEL_LOOP(i, n) \ for (int i = blockIdx.x * blockDim.x + threadIdx.x; \ i < (n); \ i += blockDim.x * gridDim.x) #define INDEX(b,c,h,w,channels,height,width) ((b * channels + c) * height + h) * width+ w extern "C" __global__ void IRNNForward( const float* input_feature, const float* weight_up, const float* weight_right, const float* weight_down, const float* weight_left, const float* bias_up, const float* bias_right, const float* bias_down, const float* bias_left, float* output_up, float* output_right, float* output_down, float* output_left, const int channels, const int height, const int width, const int n){ CUDA_KERNEL_LOOP(index,n){ int w = index % width; int h = index / width % height; int c = index / width / height % channels; int b = index / width / height / channels; float temp = 0; // left output_left[index] = input_feature[INDEX(b, c, h, width-1, channels, height, width)] > 0 ? input_feature[INDEX(b, c, h, width-1, channels, height, width)] : 0; for (int i = width-2; i>=w; i--) { temp = output_left[index] * weight_left[c] + bias_left[c] + input_feature[INDEX(b, c, h, i, channels, height, width)]; output_left[index] = (temp > 0)? temp : 0; } // right output_right[index] = input_feature[INDEX(b, c, h, 0, channels, height, width)] > 0 ? input_feature[INDEX(b, c, h, 0, channels, height, width)] : 0; for (int i = 1; i <= w; i++) { temp = output_right[index] * weight_right[c] + bias_right[c] + input_feature[INDEX(b, c, h, i, channels, height, width)]; output_right[index] = (temp > 0)? temp : 0; } // up output_up[index] = input_feature[INDEX(b,c,height-1,w,channels,height,width)] > 0 ? input_feature[INDEX(b,c,height-1,w,channels,height,width)] : 0; for (int i = height-2; i >= h; i--) { temp = output_up[index] * weight_up[c] + bias_up[c] + input_feature[INDEX(b, c, i, w, channels, height, width)]; output_up[index] = (temp > 0)? temp : 0; } // down output_down[index] = input_feature[INDEX(b, c, 0, w, channels, height, width)] > 0 ? input_feature[INDEX(b, c, 0, w, channels, height, width)] : 0; for (int i = 1; i <= h; i++) { temp = output_down[index] * weight_down[c] + bias_down[c] + input_feature[INDEX(b, c, i, w, channels, height, width)]; output_down[index] = (temp > 0)? temp : 0; } } }
{ "pile_set_name": "Github" }
#define COMMON_DIGEST_FOR_OPENSSL 1 #include <CommonCrypto/CommonDigest.h> #define SHA1_BLOCK_LENGTH CC_SHA1_BLOCK_BYTES #define SHA1_DIGEST_LENGTH CC_SHA1_DIGEST_LENGTH #define SHA1_CTX CC_SHA1_CTX static DEFINE_UPDATE_FUNC_FOR_UINT(SHA1) static DEFINE_FINISH_FUNC_FROM_FINAL(SHA1) #undef SHA1_Update #undef SHA1_Finish #define SHA1_Update rb_digest_SHA1_update #define SHA1_Finish rb_digest_SHA1_finish
{ "pile_set_name": "Github" }
# macos-lib.pl # Quota functions for OSX # XXX checking if on/off # quotas_init() sub quotas_init { if (&has_command("quotaon") && &has_command("quotaoff")) { return undef; } else { return "The quotas programs do not appear to be installed on ". "your system\n"; } } # quotas_supported() # Returns 1 for user quotas, 2 for group quotas or 3 for both sub quotas_supported { return 3; } # free_space(filesystem) # Returns an array containing btotal, bfree, ftotal, ffree sub free_space { local(@out, @rv); $ENV{'BLOCKSIZE'} = 1024; `df -i $_[0]` =~ /Mounted on\n\S+\s+(\d+)\s+\d+\s+(\d+)\s+\S+\s+(\d+)\s+(\d+)/; return ($1, $2, $3+$4, $4); } # quota_can(&mnttab, &fstab) # Can this filesystem type support quotas? # 0 = No quota support (or not turned on in /etc/fstab) # 1 = User quotas only # 2 = Group quotas only # 3 = User and group quotas sub quota_can { return 0 if ($_[0]->[2] ne 'ufs' && $_[0]->[2] ne 'hfs'); return &quota_now($_[0], $_[1]) || 3; # use the current mode if active } # quota_now(&mnttab, &fstab) # Are quotas currently active? # 0 = Not active # 1 = User quotas active # 2 = Group quotas active # 3 = Both active sub quota_now { local $rv; $rv += 1 if (-r "$_[0]->[0]/.quota.ops.user" && &big_enough("$_[0]->[0]/.quota.user")); $rv += 2 if (-r "$_[0]->[0]/.quota.ops.group" && &big_enough("$_[0]->[0]/.quota.group")); return $rv; } # quotaon(filesystem, mode) # Activate quotas and create quota files for some filesystem. The mode can # be 1 for user only, 2 for group only or 3 for user and group sub quotaon { return if (&is_readonly_mode()); local($out, $qf, @qfile, $flags); if ($_[1]%2 == 1) { # turn on user quotas $qf = "$_[0]/.quota.ops.user"; &open_tempfile(QUOTAFILE, ">$qf", 0, 1); &close_tempfile(QUOTAFILE); $qf = "$_[0]/.quota.user"; if (!&big_enough($qf)) { &unlink_file($qf); &system_logged("$config{'quotacheck_command'} $_[0]"); } $out = &backquote_logged("$config{'user_quotaon_command'} $_[0] 2>&1"); if ($?) { return $out; } } if ($_[1] > 1) { # turn on group quotas $qf = "$_[0]/.quota.ops.group"; &open_tempfile(QUOTAFILE, ">$qf", 0, 1); &close_tempfile(QUOTAFILE); $qf = "$_[0]/quota.group"; if (!&big_enough($qf)) { &unlink_file($qf); &system_logged("$config{'quotacheck_command'} $_[0]"); } $out = &backquote_logged("$config{'group_quotaon_command'} $_[0] 2>&1"); if ($?) { return $out; } } return undef; } sub big_enough { local @st = stat($_[0]); return $st[7] >= 1024; } # quotaoff(filesystem, mode) # Turn off quotas for some filesystem sub quotaoff { return if (&is_readonly_mode()); local($out); if ($_[1]%2 == 1) { $out = &backquote_logged("$config{'user_quotaoff_command'} $_[0] 2>&1"); if ($?) { return $out; } &unlink_file("$_[0]/.quota.ops.user"); } if ($_[1] > 1) { $out = &backquote_logged("$config{'group_quotaoff_command'} $_[0] 2>&1"); if ($?) { return $out; } &unlink_file("$_[0]/.quota.ops.group"); } return undef; } # user_filesystems(user) # Fills the array %filesys with details of all filesystem some user has # quotas on sub user_filesystems { local($n, $_, %mtab); open(QUOTA, "$config{'user_quota_command'} ".quotemeta($_[0])." |"); $n=0; while(<QUOTA>) { chop; if (/^(Disk|\s+Filesystem)/) { next; } if (/^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+).(.{9})\s+(\S+)\s+(\S+)\s+(\S+)/) { $filesys{$n,'filesys'} = $1; $filesys{$n,'ublocks'} = int($2); $filesys{$n,'sblocks'} = int($3); $filesys{$n,'hblocks'} = int($4); $filesys{$n,'ufiles'} = int($6); $filesys{$n,'sfiles'} = int($7); $filesys{$n,'hfiles'} = int($8); $n++; } } close(QUOTA); return $n; } # group_filesystems(group) # Fills the array %filesys with details of all filesystem some group has # quotas on sub group_filesystems { local($n, $_, %mtab); open(QUOTA, "$config{'group_quota_command'} ".quotemeta($_[0])." |"); $n=0; while(<QUOTA>) { chop; if (/^(Disk|\s+Filesystem)/) { next; } if (/^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+).(.{9})\s+(\S+)\s+(\S+)\s+(\S+)/) { $filesys{$n,'filesys'} = $1; $filesys{$n,'ublocks'} = int($2); $filesys{$n,'sblocks'} = int($3); $filesys{$n,'hblocks'} = int($4); $filesys{$n,'ufiles'} = int($6); $filesys{$n,'sfiles'} = int($7); $filesys{$n,'hfiles'} = int($8); $n++; } } close(QUOTA); return $n; } # filesystem_users(filesystem) # Fills the array %user with information about all users with quotas # on this filesystem. This may not be all users on the system.. sub filesystem_users { local($rep, @rep, $n, $what); $rep = `$config{'user_repquota_command'} $_[0] 2>&1`; if ($?) { return -1; } @rep = split(/\n/, $rep); @rep = grep { !/^root\s/ } @rep[3..$#rep]; for($n=0; $n<@rep; $n++) { if ($rep[$n] =~ /(\S+)\s*[\-\+]{2}\s+(\d+)\s+(\d+)\s+(\d+)\s.{0,15}\s(\d+)\s+(\d+)\s+(\d+)/ || $rep[$n] =~ /(\S+)\s+..(.{8})(.{8})(.{8}).{7}(.{8})(.{8})(.{8})/) { $user{$n,'user'} = $1; $user{$n,'ublocks'} = int($2); $user{$n,'sblocks'} = int($3); $user{$n,'hblocks'} = int($4); $user{$n,'ufiles'} = int($5); $user{$n,'sfiles'} = int($6); $user{$n,'hfiles'} = int($7); } } return $n; } # filesystem_groups(filesystem) # Fills the array %group with information about all groups with quotas # on this filesystem. This may not be all groups on the system.. sub filesystem_groups { local($rep, @rep, $n, $what); $rep = `$config{'group_repquota_command'} $_[0] 2>&1`; if ($?) { return -1; } @rep = split(/\n/, $rep); @rep = @rep[3..$#rep]; for($n=0; $n<@rep; $n++) { if ($rep[$n] =~ /(\S+)\s*[\-\+]{2}\s+(\d+)\s+(\d+)\s+(\d+)\s.{0,15}\s(\d+)\s+(\d+)\s+(\d+)/ || $rep[$n] =~ /(\S+)\s+..(.{8})(.{8})(.{8}).{7}(.{8})(.{8})(.{8})/) { $group{$n,'group'} = $1; $group{$n,'ublocks'} = int($2); $group{$n,'sblocks'} = int($3); $group{$n,'hblocks'} = int($4); $group{$n,'ufiles'} = int($5); $group{$n,'sfiles'} = int($6); $group{$n,'hfiles'} = int($7); } } return $n; } # edit_quota_file(data, filesys, sblocks, hblocks, sfiles, hfiles) sub edit_quota_file { local($rv, $line, %mtab, @m); @line = split(/\n/, $_[0]); for($i=0; $i<@line; $i++) { if ($line[$i] =~ /^(\S+): (.*) in use: (\d+), limits \(soft = (\d+), hard = (\d+)\)$/ && $1 eq $_[1]) { # found lines to change $rv .= "$1: $2 in use: $3, limits (soft = $_[2], hard = $_[3])\n"; $line[++$i] =~ /^\s*inodes in use: (\d+), limits \(soft = (\d+), hard = (\d+)\)$/; $rv .= "\tinodes in use: $1, limits (soft = $_[4], hard = $_[5])\n"; } else { $rv .= "$line[$i]\n"; } } return $rv; } # quotacheck(filesystem, mode) # Runs quotacheck on some filesystem sub quotacheck { $out = &backquote_logged("$config{'quotacheck_command'} $_[0] 2>&1"); if ($?) { return $out; } return undef; } # copy_user_quota(user, [user]+) # Copy the quotas for some user to many others sub copy_user_quota { for($i=1; $i<@_; $i++) { $out = &backquote_logged("$config{'user_copy_command'} ". quotemeta($_[0])." ".quotemeta($_[$i])." 2>&1"); if ($?) { return $out; } } return undef; } # copy_group_quota(group, [group]+) # Copy the quotas for some group to many others sub copy_group_quota { for($i=1; $i<@_; $i++) { $out = &backquote_logged("$config{'group_copy_command'} ". quotemeta($_[0])." ".quotemeta($_[$i])." 2>&1"); if ($?) { return $out; } } return undef; } # default_grace() # Returns 0 if grace time can be 0, 1 if zero grace means default sub default_grace { return 0; } # get_user_grace(filesystem) # Returns an array containing btime, bunits, ftime, funits # The units can be 0=sec, 1=min, 2=hour, 3=day sub get_user_grace { local(@rv, %mtab, @m); $ENV{'EDITOR'} = $ENV{'VISUAL'} = "cat"; open(GRACE, "$config{'user_grace_command'} $_[0] |"); while(<GRACE>) { if (/^(\S+): block grace period: (\d+) (\S+), file grace period: (\d+) (\S+)/ && $1 eq $_[0]) { @rv = ($2, $name_to_unit{$3}, $4, $name_to_unit{$5}); } } close(GRACE); return @rv; } # get_group_grace(filesystem) # Returns an array containing btime, bunits, ftime, funits # The units can be 0=sec, 1=min, 2=hour, 3=day sub get_group_grace { local(@rv, %mtab, @m); $ENV{'EDITOR'} = $ENV{'VISUAL'} = "cat"; open(GRACE, "$config{'group_grace_command'} $_[0] |"); while(<GRACE>) { if (/^(\S+): block grace period: (\d+) (\S+), file grace period: (\d+) (\S+)/ && $1 eq $_[0]) { @rv = ($2, $name_to_unit{$3}, $4, $name_to_unit{$5}); } } close(GRACE); return @rv; } # edit_grace_file(data, filesystem, btime, bunits, ftime, funits) sub edit_grace_file { local($rv, $line, @m, %mtab); foreach $line (split(/\n/, $_[0])) { if ($line =~ /^(\S+): block grace period: (\d+) (\S+), file grace period: (\d+) (\S+)/ && $1 eq $_[1]) { # replace this line $line = "$1: block grace period: $_[2] $unit_to_name{$_[3]}, file grace period: $_[4] $unit_to_name{$_[5]}"; } $rv .= "$line\n"; } return $rv; } # grace_units() # Returns an array of possible units for grace periods sub grace_units { return ($text{'grace_seconds'}, $text{'grace_minutes'}, $text{'grace_hours'}, $text{'grace_days'}); } # Always returns 1024 on MacOS sub fs_block_size { return 1024; } %name_to_unit = ( "second", 0, "seconds", 0, "minute", 1, "minutes", 1, "hour", 2, "hours", 2, "day", 3, "days", 3, ); foreach $k (keys %name_to_unit) { $unit_to_name{$name_to_unit{$k}} = $k; } 1;
{ "pile_set_name": "Github" }
import pytest from awx.api.versioning import reverse from awx.main.models import Project @pytest.fixture def organization_resource_creator(organization, user): def rf(users, admins, job_templates, projects, inventories, teams): # Associate one resource of every type with the organization for i in range(users): member_user = user('org-member %s' % i) organization.member_role.members.add(member_user) for i in range(admins): admin_user = user('org-admin %s' % i) organization.admin_role.members.add(admin_user) for i in range(teams): organization.teams.create(name='org-team %s' % i) for i in range(inventories): inventory = organization.inventories.create(name="associated-inv %s" % i) for i in range(projects): Project.objects.create( name="test-proj %s" % i, description="test-proj-desc", organization=organization ) # Mix up the inventories and projects used by the job templates i_proj = 0 i_inv = 0 for i in range(job_templates): project = Project.objects.filter(organization=organization)[i_proj] # project = organization.projects.all()[i_proj] inventory = organization.inventories.all()[i_inv] project.jobtemplates.create(name="test-jt %s" % i, description="test-job-template-desc", inventory=inventory, playbook="test_playbook.yml", organization=organization) i_proj += 1 i_inv += 1 if i_proj >= Project.objects.filter(organization=organization).count(): i_proj = 0 if i_inv >= organization.inventories.count(): i_inv = 0 return organization return rf COUNTS_PRIMES = { 'users': 11, 'admins': 5, 'job_templates': 3, 'projects': 3, 'inventories': 7, 'teams': 5 } COUNTS_ZEROS = { 'users': 0, 'admins': 0, 'job_templates': 0, 'projects': 0, 'inventories': 0, 'teams': 0 } @pytest.fixture def resourced_organization(organization_resource_creator): return organization_resource_creator(**COUNTS_PRIMES) @pytest.mark.django_db def test_org_counts_detail_admin(resourced_organization, user, get): # Check that all types of resources are counted by a superuser external_admin = user('admin', True) response = get(reverse('api:organization_detail', kwargs={'pk': resourced_organization.pk}), external_admin) assert response.status_code == 200 counts = response.data['summary_fields']['related_field_counts'] assert counts == COUNTS_PRIMES @pytest.mark.django_db def test_org_counts_detail_member(resourced_organization, user, get): # Check that a non-admin org member can only see users / admin in detail view member_user = resourced_organization.member_role.members.get(username='org-member 1') response = get(reverse('api:organization_detail', kwargs={'pk': resourced_organization.pk}), member_user) assert response.status_code == 200 counts = response.data['summary_fields']['related_field_counts'] assert counts == { 'users': COUNTS_PRIMES['users'], # Policy is that members can see other users and admins 'admins': COUNTS_PRIMES['admins'], 'job_templates': 0, 'projects': 0, 'inventories': 0, 'teams': 0 } @pytest.mark.django_db def test_org_counts_list_admin(resourced_organization, user, get): # Check that all types of resources are counted by a superuser external_admin = user('admin', True) response = get(reverse('api:organization_list'), external_admin) assert response.status_code == 200 counts = response.data['results'][0]['summary_fields']['related_field_counts'] assert counts == COUNTS_PRIMES @pytest.mark.django_db def test_org_counts_list_member(resourced_organization, user, get): # Check that a non-admin user can only see the full project and # user count, consistent with the RBAC rules member_user = resourced_organization.member_role.members.get(username='org-member 1') response = get(reverse('api:organization_list'), member_user) assert response.status_code == 200 counts = response.data['results'][0]['summary_fields']['related_field_counts'] assert counts == { 'users': COUNTS_PRIMES['users'], # Policy is that members can see other users and admins 'admins': COUNTS_PRIMES['admins'], 'job_templates': 0, 'projects': 0, 'inventories': 0, 'teams': 0 } @pytest.mark.django_db def test_new_org_zero_counts(user, post): # Check that a POST to the organization list endpoint returns # correct counts, including the new record org_list_url = reverse('api:organization_list') post_response = post(url=org_list_url, data={'name': 'test organization', 'description': ''}, user=user('admin', True)) assert post_response.status_code == 201 new_org_list = post_response.render().data counts_dict = new_org_list['summary_fields']['related_field_counts'] assert counts_dict == COUNTS_ZEROS @pytest.mark.django_db def test_two_organizations(resourced_organization, organizations, user, get): # Check correct results for two organizations are returned external_admin = user('admin', True) organization_zero = organizations(1)[0] response = get(reverse('api:organization_list'), external_admin) assert response.status_code == 200 org_id_full = resourced_organization.id org_id_zero = organization_zero.id counts = {} for i in range(2): org_id = response.data['results'][i]['id'] counts[org_id] = response.data['results'][i]['summary_fields']['related_field_counts'] assert counts[org_id_full] == COUNTS_PRIMES assert counts[org_id_zero] == COUNTS_ZEROS @pytest.mark.django_db def test_scan_JT_counted(resourced_organization, user, get): admin_user = user('admin', True) counts_dict = COUNTS_PRIMES # Test list view list_response = get(reverse('api:organization_list'), admin_user) assert list_response.status_code == 200 assert list_response.data['results'][0]['summary_fields']['related_field_counts'] == counts_dict # Test detail view detail_response = get(reverse('api:organization_detail', kwargs={'pk': resourced_organization.pk}), admin_user) assert detail_response.status_code == 200 assert detail_response.data['summary_fields']['related_field_counts'] == counts_dict @pytest.mark.django_db def test_JT_not_double_counted(resourced_organization, user, get): admin_user = user('admin', True) proj = Project.objects.filter(organization=resourced_organization).all()[0] # Add a run job template to the org proj.jobtemplates.create( job_type='run', inventory=resourced_organization.inventories.all()[0], project=proj, name='double-linked-job-template', organization=resourced_organization) counts_dict = COUNTS_PRIMES counts_dict['job_templates'] += 1 # Test list view list_response = get(reverse('api:organization_list'), admin_user) assert list_response.status_code == 200 assert list_response.data['results'][0]['summary_fields']['related_field_counts'] == counts_dict # Test detail view detail_response = get(reverse('api:organization_detail', kwargs={'pk': resourced_organization.pk}), admin_user) assert detail_response.status_code == 200 assert detail_response.data['summary_fields']['related_field_counts'] == counts_dict
{ "pile_set_name": "Github" }
{ "nickname": "haohao", "age": 18 }
{ "pile_set_name": "Github" }
*cmdline.txt* Nvim VIM REFERENCE MANUAL by Bram Moolenaar *Cmdline-mode* *Command-line-mode* *Cmdline* Command-line mode *cmdline* *Command-line* *mode-cmdline* *:* Command-line mode is used to enter Ex commands (":"), search patterns ("/" and "?"), and filter commands ("!"). Basic command line editing is explained in chapter 20 of the user manual |usr_20.txt|. Type |gO| to see the table of contents. ============================================================================== 1. Command-line editing *cmdline-editing* Normally characters are inserted in front of the cursor position. You can move around in the command-line with the left and right cursor keys. With the <Insert> key, you can toggle between inserting and overstriking characters. Note that if your keyboard does not have working cursor keys or any of the other special keys, you can use ":cnoremap" to define another key for them. For example, to define tcsh style editing keys: *tcsh-style* > :cnoremap <C-A> <Home> :cnoremap <C-F> <Right> :cnoremap <C-B> <Left> :cnoremap <Esc>b <S-Left> :cnoremap <Esc>f <S-Right> (<> notation |<>|; type all this literally) *cmdline-too-long* When the command line is getting longer than what fits on the screen, only the part that fits will be shown. The cursor can only move in this visible part, thus you cannot edit beyond that. *cmdline-history* *history* The command-lines that you enter are remembered in a history table. You can recall them with the up and down cursor keys. There are actually five history tables: - one for ':' commands - one for search strings - one for expressions - one for input lines, typed for the |input()| function. - one for debug mode commands These are completely separate. Each history can only be accessed when entering the same type of line. Use the 'history' option to set the number of lines that are remembered. Notes: - When you enter a command-line that is exactly the same as an older one, the old one is removed (to avoid repeated commands moving older commands out of the history). - Only commands that are typed are remembered. Ones that completely come from mappings are not put in the history. - All searches are put in the search history, including the ones that come from commands like "*" and "#". But for a mapping, only the last search is remembered (to avoid that long mappings trash the history). There is an automatic completion of names on the command-line; see |cmdline-completion|. *c_CTRL-V* CTRL-V Insert next non-digit literally. Up to three digits form the decimal value of a single byte. The non-digit and the three digits are not considered for mapping. This works the same way as in Insert mode (see above, |i_CTRL-V|). Note: Under Windows CTRL-V is often mapped to paste text. Use CTRL-Q instead then. *c_CTRL-Q* CTRL-Q Same as CTRL-V. But with some terminals it is used for control flow, it doesn't work then. *c_<Left>* *c_Left* <Left> cursor left *c_<Right>* *c_Right* <Right> cursor right *c_<S-Left>* <S-Left> or <C-Left> *c_<C-Left>* cursor one WORD left *c_<S-Right>* <S-Right> or <C-Right> *c_<C-Right>* cursor one WORD right CTRL-B or <Home> *c_CTRL-B* *c_<Home>* *c_Home* cursor to beginning of command-line CTRL-E or <End> *c_CTRL-E* *c_<End>* *c_End* cursor to end of command-line *c_<LeftMouse>* <LeftMouse> Move the cursor to the position of the mouse click. *c_<MiddleMouse>* <MiddleMouse> Paste the contents of the clipboard (for X11 the primary selection). This is similar to using CTRL-R *, but no CR characters are inserted between lines. CTRL-H *c_<BS>* *c_CTRL-H* *c_BS* <BS> Delete the character in front of the cursor. *c_<Del>* *c_Del* <Del> Delete the character under the cursor (at end of line: character before the cursor). *c_CTRL-W* CTRL-W Delete the |word| before the cursor. This depends on the 'iskeyword' option. *c_CTRL-U* CTRL-U Remove all characters between the cursor position and the beginning of the line. Previous versions of vim deleted all characters on the line. If that is the preferred behavior, add the following to your vimrc: > :cnoremap <C-U> <C-E><C-U> < *c_<Insert>* *c_Insert* <Insert> Toggle between insert and overstrike. {char1} <BS> {char2} or *c_digraph* CTRL-K {char1} {char2} *c_CTRL-K* enter digraph (see |digraphs|). When {char1} is a special key, the code for that key is inserted in <> form. CTRL-R {0-9a-z"%#:-=.} *c_CTRL-R* *c_<C-R>* Insert the contents of a numbered or named register. Between typing CTRL-R and the second character '"' will be displayed to indicate that you are expected to enter the name of a register. The text is inserted as if you typed it, but mappings and abbreviations are not used. Command-line completion through 'wildchar' is not triggered though. And characters that end the command line are inserted literally (<Esc>, <CR>, <NL>, <C-C>). A <BS> or CTRL-W could still end the command line though, and remaining characters will then be interpreted in another mode, which might not be what you intended. Special registers: '"' the unnamed register, containing the text of the last delete or yank '%' the current file name '#' the alternate file name '*' the clipboard contents (X11: primary selection) '+' the clipboard contents '/' the last search pattern ':' the last command-line '-' the last small (less than a line) delete '.' the last inserted text *c_CTRL-R_=* '=' the expression register: you are prompted to enter an expression (see |expression|) (doesn't work at the expression prompt; some things such as changing the buffer or current window are not allowed to avoid side effects) When the result is a |List| the items are used as lines. They can have line breaks inside too. When the result is a Float it's automatically converted to a String. See |registers| about registers. Implementation detail: When using the |expression| register and invoking setcmdpos(), this sets the position before inserting the resulting string. Use CTRL-R CTRL-R to set the position afterwards. CTRL-R CTRL-F *c_CTRL-R_CTRL-F* *c_<C-R>_<C-F>* CTRL-R CTRL-P *c_CTRL-R_CTRL-P* *c_<C-R>_<C-P>* CTRL-R CTRL-W *c_CTRL-R_CTRL-W* *c_<C-R>_<C-W>* CTRL-R CTRL-A *c_CTRL-R_CTRL-A* *c_<C-R>_<C-A>* CTRL-R CTRL-L *c_CTRL-R_CTRL-L* *c_<C-R>_<C-L>* Insert the object under the cursor: CTRL-F the Filename under the cursor CTRL-P the Filename under the cursor, expanded with 'path' as in |gf| CTRL-W the Word under the cursor CTRL-A the WORD under the cursor; see |WORD| CTRL-L the line under the cursor When 'incsearch' is set the cursor position at the end of the currently displayed match is used. With CTRL-W the part of the word that was already typed is not inserted again. *c_CTRL-R_CTRL-R* *c_<C-R>_<C-R>* *c_CTRL-R_CTRL-O* *c_<C-R>_<C-O>* CTRL-R CTRL-R {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A CTRL-L} CTRL-R CTRL-O {0-9a-z"%#:-=. CTRL-F CTRL-P CTRL-W CTRL-A CTRL-L} Insert register or object under the cursor. Works like |c_CTRL-R| but inserts the text literally. For example, if register a contains "xy^Hz" (where ^H is a backspace), "CTRL-R a" will insert "xz" while "CTRL-R CTRL-R a" will insert "xy^Hz". CTRL-\ e {expr} *c_CTRL-\_e* Evaluate {expr} and replace the whole command line with the result. You will be prompted for the expression, type <Enter> to finish it. It's most useful in mappings though. See |expression|. See |c_CTRL-R_=| for inserting the result of an expression. Useful functions are |getcmdtype()|, |getcmdline()| and |getcmdpos()|. The cursor position is unchanged, except when the cursor was at the end of the line, then it stays at the end. |setcmdpos()| can be used to set the cursor position. The |sandbox| is used for evaluating the expression to avoid nasty side effects. Example: > :cmap <F7> <C-\>eAppendSome()<CR> :func AppendSome() :let cmd = getcmdline() . " Some()" :" place the cursor on the ) :call setcmdpos(strlen(cmd)) :return cmd :endfunc < This doesn't work recursively, thus not when already editing an expression. But it is possible to use in a mapping. *c_CTRL-Y* CTRL-Y When there is a modeless selection, copy the selection into the clipboard. If there is no selection CTRL-Y is inserted as a character. CTRL-M or CTRL-J *c_CTRL-M* *c_CTRL-J* *c_<NL>* *c_<CR>* *c_CR* <CR> or <NL> start entered command CTRL-[ *c_CTRL-[* *c_<Esc>* *c_Esc* <Esc> When typed and 'x' not present in 'cpoptions', quit Command-line mode without executing. In macros or when 'x' present in 'cpoptions', start entered command. Note: If your <Esc> key is hard to hit on your keyboard, train yourself to use CTRL-[. *c_CTRL-C* CTRL-C quit command-line without executing *c_<Up>* *c_Up* <Up> recall older command-line from history, whose beginning matches the current command-line (see below). *c_<Down>* *c_Down* <Down> recall more recent command-line from history, whose beginning matches the current command-line (see below). *c_<S-Up>* *c_<PageUp>* <S-Up> or <PageUp> recall older command-line from history *c_<S-Down>* *c_<PageDown>* <S-Down> or <PageDown> recall more recent command-line from history CTRL-D command-line completion (see |cmdline-completion|) 'wildchar' option command-line completion (see |cmdline-completion|) CTRL-N command-line completion (see |cmdline-completion|) CTRL-P command-line completion (see |cmdline-completion|) CTRL-A command-line completion (see |cmdline-completion|) CTRL-L command-line completion (see |cmdline-completion|) *c_CTRL-_* CTRL-_ Switch between Hebrew and English keyboard mode, which is private to the command-line and not related to hkmap. This is useful when Hebrew text entry is required in the command-line, searches, abbreviations, etc. Applies only if the 'allowrevins' option is set. See |rileft.txt|. *c_CTRL-^* CTRL-^ Toggle the use of language |:lmap| mappings and/or Input Method. When typing a pattern for a search command and 'imsearch' is not -1, VAL is the value of 'imsearch', otherwise VAL is the value of 'iminsert'. When language mappings are defined: - If VAL is 1 (langmap mappings used) it becomes 0 (no langmap mappings used). - If VAL was not 1 it becomes 1, thus langmap mappings are enabled. When no language mappings are defined: - If VAL is 2 (Input Method is used) it becomes 0 (no input method used) - If VAL has another value it becomes 2, thus the Input Method is enabled. These language mappings are normally used to type characters that are different from what the keyboard produces. The 'keymap' option can be used to install a whole number of them. When entering a command line, langmap mappings are switched off, since you are expected to type a command. After switching it on with CTRL-^, the new state is not used again for the next command or Search pattern. *c_CTRL-]* CTRL-] Trigger abbreviation, without inserting a character. For Emacs-style editing on the command-line see |emacs-keys|. The <Up> and <Down> keys take the current command-line as a search string. The beginning of the next/previous command-lines are compared with this string. The first line that matches is the new command-line. When typing these two keys repeatedly, the same string is used again. For example, this can be used to find the previous substitute command: Type ":s" and then <Up>. The same could be done by typing <S-Up> a number of times until the desired command-line is shown. (Note: the shifted arrow keys do not work on all terminals) *:his* *:history* :his[tory] Print the history of last entered commands. :his[tory] [{name}] [{first}][, [{last}]] List the contents of history {name} which can be: c[md] or : command-line history s[earch] or / or ? search string history e[xpr] or = expression register history i[nput] or @ input line history d[ebug] or > debug command history a[ll] all of the above If the numbers {first} and/or {last} are given, the respective range of entries from a history is listed. These numbers can be specified in the following form: *:history-indexing* A positive number represents the absolute index of an entry as it is given in the first column of a :history listing. This number remains fixed even if other entries are deleted. A negative number means the relative position of an entry, counted from the newest entry (which has index -1) backwards. Examples: List entries 6 to 12 from the search history: > :history / 6,12 < List the penultimate entry from all histories: > :history all -2 < List the most recent two entries from all histories: > :history all -2, :keepp[atterns] {command} *:keepp* *:keeppatterns* Execute {command}, without adding anything to the search history ============================================================================== 2. Command-line completion *cmdline-completion* When editing the command-line, a few commands can be used to complete the word before the cursor. This is available for: - Command names: At the start of the command-line. - Tags: Only after the ":tag" command. - File names: Only after a command that accepts a file name or a setting for an option that can be set to a file name. This is called file name completion. - Shell command names: After ":!cmd", ":r !cmd" and ":w !cmd". $PATH is used. - Options: Only after the ":set" command. - Mappings: Only after a ":map" or similar command. - Variable and function names: Only after a ":if", ":call" or similar command. The number of help item matches is limited (currently to 300) to avoid a long delay when there are very many matches. These are the commands that can be used: *c_CTRL-D* CTRL-D List names that match the pattern in front of the cursor. When showing file names, directories are highlighted (see |highlight-groups|). Names where 'suffixes' matches are moved to the end. The 'wildoptions' option can be set to "tagfile" to list the file of matching tags. *c_CTRL-I* *c_wildchar* *c_<Tab>* 'wildchar' option A match is done on the pattern in front of the cursor. The match (if there are several, the first match) is inserted in place of the pattern. (Note: does not work inside a macro, because <Tab> or <Esc> are mostly used as 'wildchar', and these have a special meaning in some macros.) When typed again and there were multiple matches, the next match is inserted. After the last match, the first is used again (wrap around). The behavior can be changed with the 'wildmode' option. *c_<S-Tab>* <S-Tab> Like 'wildchar' or <Tab>, but begin with the last match and then go to the previous match. *c_CTRL-N* CTRL-N After using 'wildchar' which got multiple matches, go to next match. Otherwise recall more recent command-line from history. *c_CTRL-P* CTRL-P After using 'wildchar' which got multiple matches, go to previous match. Otherwise recall older command-line from history. *c_CTRL-A* CTRL-A All names that match the pattern in front of the cursor are inserted. *c_CTRL-L* CTRL-L A match is done on the pattern in front of the cursor. If there is one match, it is inserted in place of the pattern. If there are multiple matches the longest common part is inserted in place of the pattern. If the result is shorter than the pattern, no completion is done. */_CTRL-L* When 'incsearch' is set, entering a search pattern for "/" or "?" and the current match is displayed then CTRL-L will add one character from the end of the current match. If 'ignorecase' and 'smartcase' are set and the command line has no uppercase characters, the added character is converted to lowercase. *c_CTRL-G* */_CTRL-G* CTRL-G When 'incsearch' is set, entering a search pattern for "/" or "?" and the current match is displayed then CTRL-G will move to the next match (does not take |search-offset| into account) Use CTRL-T to move to the previous match. Hint: on a regular keyboard T is above G. *c_CTRL-T* */_CTRL-T* CTRL-T When 'incsearch' is set, entering a search pattern for "/" or "?" and the current match is displayed then CTRL-T will move to the previous match (does not take |search-offset| into account). Use CTRL-G to move to the next match. Hint: on a regular keyboard T is above G. The 'wildchar' option defaults to <Tab> (CTRL-E when in Vi compatible mode; in a previous version <Esc> was used). In the pattern standard wildcards '*' and '?' are accepted when matching file names. '*' matches any string, '?' matches exactly one character. When repeating 'wildchar' or CTRL-N you cycle through the matches, eventually ending up back to what was typed. If the first match is not what you wanted, you can use <S-Tab> or CTRL-P to go straight back to what you typed. The 'wildignorecase' option can be set to ignore case in filenames. The 'wildmenu' option can be set to show the matches just above the command line. If you like tcsh's autolist completion, you can use this mapping: :cnoremap X <C-L><C-D> (Where X is the command key to use, <C-L> is CTRL-L and <C-D> is CTRL-D) This will find the longest match and then list all matching files. If you like tcsh's autolist completion, you can use the 'wildmode' option to emulate it. For example, this mimics autolist=ambiguous: :set wildmode=longest,list This will find the longest match with the first 'wildchar', then list all matching files with the next. *suffixes* For file name completion you can use the 'suffixes' option to set a priority between files with almost the same name. If there are multiple matches, those files with an extension that is in the 'suffixes' option are ignored. The default is ".bak,~,.o,.h,.info,.swp,.obj", which means that files ending in ".bak", "~", ".o", ".h", ".info", ".swp" and ".obj" are sometimes ignored. An empty entry, two consecutive commas, match a file name that does not contain a ".", thus has no suffix. This is useful to ignore "prog" and prefer "prog.c". Examples: pattern: files: match: ~ test* test.c test.h test.o test.c test* test.h test.o test.h and test.o test* test.i test.h test.c test.i and test.c It is impossible to ignore suffixes with two dots. If there is more than one matching file (after ignoring the ones matching the 'suffixes' option) the first file name is inserted. You can see that there is only one match when you type 'wildchar' twice and the completed match stays the same. You can get to the other matches by entering 'wildchar', CTRL-N or CTRL-P. All files are included, also the ones with extensions matching the 'suffixes' option. To completely ignore files with some extension use 'wildignore'. To match only files that end at the end of the typed text append a "$". For example, to match only files that end in ".c": > :e *.c$ This will not match a file ending in ".cpp". Without the "$" it does match. The old value of an option can be obtained by hitting 'wildchar' just after the '='. For example, typing 'wildchar' after ":set dir=" will insert the current value of 'dir'. This overrules file name completion for the options that take a file name. If you would like using <S-Tab> for CTRL-P in an xterm, put this command in your .cshrc: > xmodmap -e "keysym Tab = Tab Find" And this in your vimrc: > :cmap <Esc>[1~ <C-P> ============================================================================== 3. Ex command-lines *cmdline-lines* The Ex commands have a few specialties: *:quote* *:comment* '"' at the start of a line causes the whole line to be ignored. '"' after a command causes the rest of the line to be ignored. This can be used to add comments. Example: > :set ai "set 'autoindent' option It is not possible to add a comment to a shell command ":!cmd" or to the ":map" command and a few others (mainly commands that expect expressions) that see the '"' as part of their argument: :argdo :autocmd :bufdo :cexpr (and the like) :cdo (and the like) :command :cscope (and the like) :debug :display :echo (and the like) :elseif :execute :folddoopen :folddoclosed :for :grep (and the like) :help (and the like) :if :let :make :map (and the like including :abbrev commands) :menu (and the like) :mkspell :normal :ownsyntax :popup :promptfind (and the like) :registers :return :sort :syntax :tabdo :tearoff :vimgrep (and the like) :while :windo *:bar* *:\bar* '|' can be used to separate commands, so you can give multiple commands in one line. If you want to use '|' in an argument, precede it with '\'. These commands see the '|' as their argument, and can therefore not be followed by another Vim command: :argdo :autocmd :bufdo :cdo :cfdo :command :cscope :debug :folddoopen :folddoclosed :function :global :help :lcscope :ldo :lfdo :make :normal :promptfind :promptrepl :pyfile :python :registers :read ! :scscope :sign :vglobal :windo :write ! :[range]! a user defined command without the "-bar" argument |:command| Note that this is confusing (inherited from Vi): With ":g" the '|' is included in the command, with ":s" it is not. To be able to use another command anyway, use the ":execute" command. Example (append the output of "ls" and jump to the first line): > :execute 'r !ls' | '[ There is one exception: When the 'b' flag is present in 'cpoptions', with the ":map" and ":abbr" commands and friends CTRL-V needs to be used instead of '\'. You can also use "<Bar>" instead. See also |map_bar|. Examples: > :!ls | wc view the output of two commands :r !ls | wc insert the same output in the text :%g/foo/p|> moves all matching lines one shiftwidth :%s/foo/bar/|> moves one line one shiftwidth :map q 10^V| map "q" to "10|" :map q 10\| map \ l map "q" to "10\" and map "\" to "l" (when 'b' is present in 'cpoptions') You can also use <NL> to separate commands in the same way as with '|'. To insert a <NL> use CTRL-V CTRL-J. "^@" will be shown. Using '|' is the preferred method. But for external commands a <NL> must be used, because a '|' is included in the external command. To avoid the special meaning of <NL> it must be preceded with a backslash. Example: > :r !date<NL>-join This reads the current date into the file and joins it with the previous line. Note that when the command before the '|' generates an error, the following commands will not be executed. Because of Vi compatibility the following strange commands are supported: > :| print current line (like ":p") :3| print line 3 (like ":3p") :3 goto line 3 A colon is allowed between the range and the command name. It is ignored (this is Vi compatible). For example: > :1,$:s/pat/string When the character '%' or '#' is used where a file name is expected, they are expanded to the current and alternate file name (see the chapter "editing files" |:_%| |:_#|). Trailing spaces in filenames will be ignored, unless escaped with a backslash or CTRL-V. Note that the ":next" command uses spaces to separate file names. Escape the spaces to include them in a file name. Example: > :next foo\ bar goes\ to school\ starts editing the three files "foo bar", "goes to" and "school ". When you want to use the special characters '"' or '|' in a command, or want to use '%' or '#' in a file name, precede them with a backslash. The backslash is not required in a range and in the ":substitute" command. See also |`=|. *:_!* The '!' (bang) character after an Ex command makes the command behave in a different way. The '!' should be placed immediately after the command, without any blanks in between. If you insert blanks the '!' will be seen as an argument for the command, which has a different meaning. For example: :w! name write the current buffer to file "name", overwriting any existing file :w !name send the current buffer as standard input to command "name" ============================================================================== 4. Ex command-line ranges *cmdline-ranges* *[range]* *E16* Some Ex commands accept a line range in front of them. This is noted as [range]. It consists of one or more line specifiers, separated with ',' or ';'. The basics are explained in section |10.3| of the user manual. *:,* *:;* When separated with ';' the cursor position will be set to that line before interpreting the next line specifier. This doesn't happen for ','. Examples: > 4,/this line/ < from line 4 till match with "this line" after the cursor line. > 5;/that line/ < from line 5 till match with "that line" after line 5. The default line specifier for most commands is the cursor position, but the commands ":write" and ":global" have the whole file (1,$) as default. If more line specifiers are given than required for the command, the first one(s) will be ignored. Line numbers may be specified with: *:range* *{address}* {number} an absolute line number . the current line *:.* $ the last line in the file *:$* % equal to 1,$ (the entire file) *:%* 't position of mark t (lowercase) *:'* 'T position of mark T (uppercase); when the mark is in another file it cannot be used in a range /{pattern}[/] the next line where {pattern} matches *:/* ?{pattern}[?] the previous line where {pattern} matches *:?* \/ the next line where the previously used search pattern matches \? the previous line where the previously used search pattern matches \& the next line where the previously used substitute pattern matches Each may be followed (several times) by '+' or '-' and an optional number. This number is added or subtracted from the preceding line number. If the number is omitted, 1 is used. The "/" and "?" after {pattern} are required to separate the pattern from anything that follows. The "/" and "?" may be preceded with another address. The search starts from there. The difference from using ';' is that the cursor isn't moved. Examples: > /pat1//pat2/ Find line containing "pat2" after line containing "pat1", without moving the cursor. 7;/pat2/ Find line containing "pat2", after line 7, leaving the cursor in line 7. The {number} must be between 0 and the number of lines in the file. When using a 0 (zero) this is interpreted as a 1 by most commands. Commands that use it as a count do use it as a zero (|:tag|, |:pop|, etc). Some commands interpret the zero as "before the first line" (|:read|, search pattern, etc). Examples: > .+3 three lines below the cursor /that/+1 the line below the next line containing "that" .,$ from current line until end of file 0;/that the first line containing "that", also matches in the first line. 1;/that the first line after line 1 containing "that" Some commands allow for a count after the command. This count is used as the number of lines to be used, starting with the line given in the last line specifier (the default is the cursor line). The commands that accept a count are the ones that use a range but do not have a file name argument (because a file name can also be a number). Examples: > :s/x/X/g 5 substitute 'x' by 'X' in the current line and four following lines :23d 4 delete lines 23, 24, 25 and 26 Folds and Range When folds are active the line numbers are rounded off to include the whole closed fold. See |fold-behavior|. Reverse Range *E493* A range should have the lower line number first. If this is not the case, Vim will ask you if it should swap the line numbers. Backwards range given, OK to swap ~ This is not done within the global command ":g". You can use ":silent" before a command to avoid the question, the range will always be swapped then. Count and Range *N:* When giving a count before entering ":", this is translated into: :.,.+(count - 1) In words: The 'count' lines at and after the cursor. Example: To delete three lines: > 3:d<CR> is translated into: .,.+2d<CR> < Visual Mode and Range *v_:* {Visual}: Starts a command-line with the Visual selected lines as a range. The code `:'<,'>` is used for this range, which makes it possible to select a similar line from the command-line history for repeating a command on different Visually selected lines. When Visual mode was already ended, a short way to use the Visual area for a range is `:*`. ============================================================================== 5. Ex command-line flags *ex-flags* These flags are supported by a selection of Ex commands. They print the line that the cursor ends up after executing the command: l output like for |:list| # add line number p output like for |:print| The flags can be combined, thus "l#" uses both a line number and |:list| style output. ============================================================================== 6. Ex special characters *cmdline-special* Note: These are special characters in the executed command line. If you want to insert special things while typing you can use the CTRL-R command. For example, "%" stands for the current file name, while CTRL-R % inserts the current file name right away. See |c_CTRL-R|. Note: If you want to avoid the effects of special characters in a Vim script you may want to use |fnameescape()|. Also see |`=|. In Ex commands, at places where a file name can be used, the following characters have a special meaning. These can also be used in the expression function |expand()|. % Is replaced with the current file name. *:_%* *c_%* # Is replaced with the alternate file name. *:_#* *c_#* This is remembered for every window. #n (where n is a number) is replaced with *:_#0* *:_#n* the file name of buffer n. "#0" is the same as "#". *c_#n* ## Is replaced with all names in the argument list *:_##* *c_##* concatenated, separated by spaces. Each space in a name is preceded with a backslash. #<n (where n is a number > 0) is replaced with old *:_#<* *c_#<* file name n. See |:oldfiles| or |v:oldfiles| to get the number. *E809* Note that these, except "#<n", give the file name as it was typed. If an absolute path is needed (when using the file name from a different directory), you need to add ":p". See |filename-modifiers|. The "#<n" item returns an absolute path, but it will start with "~/" for files below your home directory. Note that backslashes are inserted before spaces, so that the command will correctly interpret the file name. But this doesn't happen for shell commands. For those you probably have to use quotes (this fails for files that contain a quote and wildcards): > :!ls "%" :r !spell "%" To avoid the special meaning of '%' and '#' insert a backslash before it. Detail: The special meaning is always escaped when there is a backslash before it, no matter how many backslashes. you type: result ~ # alternate.file \# # \\# \# Also see |`=|. *:<cword>* *<cword>* *:<cWORD>* *<cWORD>* *:<cexpr>* *<cexpr>* *:<cfile>* *<cfile>* *:<afile>* *<afile>* *:<abuf>* *<abuf>* *:<amatch>* *<amatch>* *:<sfile>* *<sfile>* *:<slnum>* *<slnum>* *:<sflnum>* *<sflnum>* *E499* *E500* Note: these are typed literally, they are not special keys! <cword> is replaced with the word under the cursor (like |star|) <cWORD> is replaced with the WORD under the cursor (see |WORD|) <cexpr> is replaced with the word under the cursor, including more to form a C expression. E.g., when the cursor is on "arg" of "ptr->arg" then the result is "ptr->arg"; when the cursor is on "]" of "list[idx]" then the result is "list[idx]". This is used for |v:beval_text|. <cfile> is replaced with the path name under the cursor (like what |gf| uses) <afile> When executing autocommands, is replaced with the file name of the buffer being manipulated, or the file for a read or write. *E495* <abuf> When executing autocommands, is replaced with the currently effective buffer number (for ":r file" and ":so file" it is the current buffer, the file being read/sourced is not in a buffer). *E496* <amatch> When executing autocommands, is replaced with the match for which this autocommand was executed. *E497* It differs from <afile> only when the file name isn't used to match with (for FileType, Syntax and SpellFileMissing events). <sfile> When executing a ":source" command, is replaced with the file name of the sourced file. *E498* When executing a function, is replaced with: "function {function-name}[{lnum}]" function call nesting is indicated like this: "function {function-name1}[{lnum}]..{function-name2}[{lnum}]" Note that filename-modifiers are useless when <sfile> is used inside a function. <slnum> When executing a ":source" command, is replaced with the line number. *E842* When executing a function it's the line number relative to the start of the function. <sflnum> When executing a script, is replaced with the line number. It differs from <slnum> in that <sflnum> is replaced with the script line number in any situation. *E961* *filename-modifiers* *:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs* *::S* *%:8* *%:p* *%:.* *%:~* *%:h* *%:t* *%:r* *%:e* *%:s* *%:gs* *%:S* The file name modifiers can be used after "%", "#", "#n", "<cfile>", "<sfile>", "<afile>" or "<abuf>". They are also used with the |fnamemodify()| function. These modifiers can be given, in this order: :p Make file name a full path. Must be the first modifier. Also changes "~/" (and "~user/" for Unix) to the path for the home directory. If the name is a directory a path separator is added at the end. For a file name that does not exist and does not have an absolute path the result is unpredictable. On MS-Windows an 8.3 filename is expanded to the long name. :8 Converts the path to 8.3 short format (currently only on MS-Windows). Will act on as much of a path that is an existing path. :~ Reduce file name to be relative to the home directory, if possible. File name is unmodified if it is not below the home directory. :. Reduce file name to be relative to current directory, if possible. File name is unmodified if it is not below the current directory, but on MS-Windows the drive is removed if it is the current drive. For maximum shortness, use ":~:.". :h Head of the file name (the last component and any separators removed). Cannot be used with :e, :r or :t. Can be repeated to remove several components at the end. When the file name ends in a path separator, only the path separator is removed. Thus ":p:h" on a directory name results on the directory name itself (without trailing slash). When the file name is an absolute path (starts with "/" for Unix; "x:\" for Windows), that part is not removed. When there is no head (path is relative to current directory) the result is empty. :t Tail of the file name (last component of the name). Must precede any :r or :e. :r Root of the file name (the last extension removed). When there is only an extension (file name that starts with '.', e.g., ".nvimrc"), it is not removed. Can be repeated to remove several extensions (last one first). :e Extension of the file name. Only makes sense when used alone. When there is no extension the result is empty. When there is only an extension (file name that starts with '.'), the result is empty. Can be repeated to include more extensions. If there are not enough extensions (but at least one) as much as possible are included. :s?pat?sub? Substitute the first occurrence of "pat" with "sub". This works like the |:s| command. "pat" is a regular expression. Any character can be used for '?', but it must not occur in "pat" or "sub". After this, the previous modifiers can be used again. For example ":p", to make a full path after the substitution. :gs?pat?sub? Substitute all occurrences of "pat" with "sub". Otherwise this works like ":s". :S Escape special characters for use with a shell command (see |shellescape()|). Must be the last one. Examples: > :!dir <cfile>:S :call system('chmod +w -- ' . expand('%:S')) Examples, when the file name is "src/version.c", current dir "/home/mool/vim": > :p /home/mool/vim/src/version.c :p:. src/version.c :p:~ ~/vim/src/version.c :h src :p:h /home/mool/vim/src :p:h:h /home/mool/vim :t version.c :p:t version.c :r src/version :p:r /home/mool/vim/src/version :t:r version :e c :s?version?main? src/main.c :s?version?main?:p /home/mool/vim/src/main.c :p:gs?/?\\? \home\mool\vim\src\version.c Examples, when the file name is "src/version.c.gz": > :p /home/mool/vim/src/version.c.gz :e gz :e:e c.gz :e:e:e c.gz :e:e:r c :r src/version.c :r:e c :r:r src/version :r:r:r src/version < *extension-removal* *:_%<* If a "<" is appended to "%", "#", "#n" or "CTRL-V p" the extension of the file name is removed (everything after and including the last '.' in the file name). This is included for backwards compatibility with version 3.0, the ":r" form is preferred. Examples: > % current file name %< current file name without extension # alternate file name for current window #< idem, without extension #31 alternate file number 31 #31< idem, without extension <cword> word under the cursor <cWORD> WORD under the cursor (see |WORD|) <cfile> path name under the cursor <cfile>< idem, without extension Note: Where a file name is expected wildcards expansion is done. On Unix the shell is used for this, unless it can be done internally (for speed). Unless in |restricted-mode|, backticks work also, like in > :n `echo *.c` But expansion is only done if there are any wildcards before expanding the '%', '#', etc.. This avoids expanding wildcards inside a file name. If you want to expand the result of <cfile>, add a wildcard character to it. Examples: (alternate file name is "?readme?") command expands to ~ :e # :e ?readme? :e `ls #` :e {files matching "?readme?"} :e #.* :e {files matching "?readme?.*"} :cd <cfile> :cd {file name under cursor} :cd <cfile>* :cd {file name under cursor plus "*" and then expanded} Also see |`=|. When the expanded argument contains a "!" and it is used for a shell command (":!cmd", ":r !cmd" or ":w !cmd"), the "!" is escaped with a backslash to avoid it being expanded into a previously used command. When the 'shell' option contains "sh", this is done twice, to avoid the shell trying to expand the "!". *filename-backslash* For filesystems that use a backslash as directory separator (Windows filesystems), it's a bit difficult to recognize a backslash that is used to escape the special meaning of the next character. The general rule is: If the backslash is followed by a normal file name character, it does not have a special meaning. Therefore "\file\foo" is a valid file name, you don't have to type the backslash twice. An exception is the '$' sign. It is a valid character in a file name. But to avoid a file name like "$home" to be interpreted as an environment variable, it needs to be preceded by a backslash. Therefore you need to use "/\$home" for the file "$home" in the root directory. A few examples: FILE NAME INTERPRETED AS ~ $home expanded to value of environment var $home \$home file "$home" in current directory /\$home file "$home" in root directory \\$home file "\\", followed by expanded $home Also see |`=|. ============================================================================== 7. Command-line window *cmdline-window* *cmdwin* *command-line-window* In the command-line window the command line can be edited just like editing text in any window. It is a special kind of window, because you cannot leave it in a normal way. OPEN *c_CTRL-F* *q:* *q/* *q?* There are two ways to open the command-line window: 1. From Command-line mode, use the key specified with the 'cedit' option. 2. From Normal mode, use the "q:", "q/" or "q?" command. This starts editing an Ex command-line ("q:") or search string ("q/" or "q?"). Note that this is not possible while recording is in progress (the "q" stops recording then). When the window opens it is filled with the command-line history. The last line contains the command as typed so far. The left column will show a character that indicates the type of command-line being edited, see |cmdwin-char|. Vim will be in Normal mode when the editor is opened, except when 'insertmode' is set. The height of the window is specified with 'cmdwinheight' (or smaller if there is no room). The window is always full width and is positioned just above the command-line. EDIT You can now use commands to move around and edit the text in the window. Both in Normal mode and Insert mode. It is possible to use ":", "/" and other commands that use the command-line, but it's not possible to open another command-line window then. There is no nesting. *E11* The command-line window is not a normal window. It is not possible to move to another window or edit another buffer. All commands that would do this are disabled in the command-line window. Of course it _is_ possible to execute any command that you entered in the command-line window. Other text edits are discarded when closing the window. CLOSE *E199* There are several ways to leave the command-line window: <CR> Execute the command-line under the cursor. Works both in Insert and in Normal mode. CTRL-C Continue in Command-line mode. The command-line under the cursor is used as the command-line. Works both in Insert and in Normal mode. There is no redraw, thus the window will remain visible. :quit Discard the command line and go back to Normal mode. ":close", ":exit", ":xit" and CTRL-\ CTRL-N also work. :qall Quit Vim, unless there are changes in some buffer. :qall! Quit Vim, discarding changes to any buffer. Once the command-line window is closed the old window sizes are restored. The executed command applies to the window and buffer where the command-line was started from. This works as if the command-line window was not there, except that there will be an extra screen redraw. The buffer used for the command-line window is deleted. Any changes to lines other than the one that is executed with <CR> are lost. If you would like to execute the command under the cursor and then have the command-line window open again, you may find this mapping useful: > :autocmd CmdwinEnter * map <buffer> <F5> <CR>q: VARIOUS The command-line window cannot be used when there already is a command-line window (no nesting). Some options are set when the command-line window is opened: 'filetype' "vim", when editing an Ex command-line; this starts Vim syntax highlighting if it was enabled 'rightleft' off 'modifiable' on 'buftype' "nofile" 'swapfile' off It is allowed to write the buffer contents to a file. This is an easy way to save the command-line history and read it back later. If the 'wildchar' option is set to <Tab>, and the command-line window is used for an Ex command, then two mappings will be added to use <Tab> for completion in the command-line window, like this: > :imap <buffer> <Tab> <C-X><C-V> :nmap <buffer> <Tab> a<C-X><C-V> Note that hitting <Tab> in Normal mode will do completion on the next character. That way it works at the end of the line. If you don't want these mappings, disable them with: > au CmdwinEnter [:>] iunmap <buffer> <Tab> au CmdwinEnter [:>] nunmap <buffer> <Tab> You could put these lines in your vimrc file. While in the command-line window you cannot use the mouse to put the cursor in another window, or drag statuslines of other windows. You can drag the statusline of the command-line window itself and the statusline above it. Thus you can resize the command-line window, but not others. The |getcmdwintype()| function returns the type of the command-line being edited as described in |cmdwin-char|. AUTOCOMMANDS Two autocommand events are used: |CmdwinEnter| and |CmdwinLeave|. You can use the Cmdwin events to do settings specifically for the command-line window. Be careful not to cause side effects! Example: > :au CmdwinEnter : let b:cpt_save = &cpt | set cpt=. :au CmdwinLeave : let &cpt = b:cpt_save This sets 'complete' to use completion in the current window for |i_CTRL-N|. Another example: > :au CmdwinEnter [/?] startinsert This will make Vim start in Insert mode in the command-line window. *cmdline-char* *cmdwin-char* The character used for the pattern indicates the type of command-line: : normal Ex command > debug mode command |debug-mode| / forward search string ? backward search string = expression for "= |expr-register| @ string for |input()| - text for |:insert| or |:append| vim:tw=78:ts=8:noet:ft=help:norl:
{ "pile_set_name": "Github" }
class ServiceMap constructor: -> @remotes = Object.create null @count = 0 end: -> for remoteId, remote of @remotes remote.end() @remotes = Object.create null @count = 0 return insert: (remoteId, socket) -> if @remotes[remoteId] throw new Error "Remote ID #{remoteId} is already being used" else @count += 1 @remotes[remoteId] = socket get: (remoteId) -> @remotes[remoteId] or null remove: (remoteId) -> if remote = @remotes[remoteId] delete @remotes[remoteId] @count -= 1 remote else null module.exports = ServiceMap
{ "pile_set_name": "Github" }
BEGIN_COM_MAP(COuter1) COM_INTERFACE_ENTRY_AGGREGATE(__uuidof(IAgg), m_punkAgg) END_COM_MAP()
{ "pile_set_name": "Github" }
 /*=================================================================================== * * Copyright (c) Userware (OpenSilver.net, CSHTML5.com) * * This file is part of both the OpenSilver Simulator (https://opensilver.net), which * is licensed under the MIT license (https://opensource.org/licenses/MIT), and the * CSHTML5 Simulator (http://cshtml5.com), which is dual-licensed (MIT + commercial). * * As stated in the MIT license, "the above copyright notice and this permission * notice shall be included in all copies or substantial portions of the Software." * \*====================================================================================*/ using System; using System.Collections.ObjectModel; using System.Reflection; using System.Windows.Controls; using System.Linq; using System.Windows; using System.Collections; using System.Windows.Shapes; using DotNetForHtml5.Compiler; namespace DotNetForHtml5.EmulatorWithoutJavascript.XamlInspection { internal static class XamlInspectionHelper { public static bool TryInitializeTreeView(TreeView treeView, Assembly entryPointAssembly, out int NbTreeViewElement) { NbTreeViewElement = 0; IEnumerable treeRootElements = GetVisualTreeRootElements(); if (treeRootElements != null) { treeView.Items.Clear(); foreach (object treeRootElement in treeRootElements) { treeView.Items.Add(RecursivelyAddElementsToTree(treeRootElement, false, ref NbTreeViewElement)); } return true; } else return false; } static TreeNode RecursivelyAddElementsToTree(dynamic uiElement, bool alreadyInsertedANodeForXamlSourcePath, ref int NbTreeViewElement) { // If the element is a XAML root element (that is, if its "XamlSourcePath" property has been filled), we add a node to the tree that tells us in which XAML file the element is defined: string xamlSourcePathOrNull = alreadyInsertedANodeForXamlSourcePath ? null : GetXamlSourcePathOrNullFromElement(uiElement); ; bool isNodeForXamlSourcePath = !string.IsNullOrEmpty(xamlSourcePathOrNull); TreeNode treeNode; if (isNodeForXamlSourcePath) { string fileName = GetFileNameFromPath(xamlSourcePathOrNull); // Create the tree node for displaying the XAML source path: treeNode = new TreeNode() { Title = xamlSourcePathOrNull, //"---- File: " + fileName + " ----", IsNodeForXamlSourcePath = isNodeForXamlSourcePath, //XamlSourcePathOrNull = (xamlSourcePathOrNull != fileName ? "(" + fileName + ")" : null), Children = new ObservableCollection<TreeNode>(), }; // Call itself and set "alreadyInsertedANodeForXamlSourcePath" to true: treeNode.Children.Add(RecursivelyAddElementsToTree(uiElement, true, ref NbTreeViewElement)); } else { // Create the tree node for displaying the element: treeNode = new TreeNode() { Element = (object)uiElement, Title = GetTitleFromElement(uiElement), Name = GetNameOrNullFromElement(uiElement), Children = new ObservableCollection<TreeNode>() }; // Handle the children recursively: IDictionary visualChildrenInformation = uiElement.INTERNAL_VisualChildrenInformation as IDictionary; if (visualChildrenInformation != null) { foreach (dynamic item in visualChildrenInformation.Values) // This corresponds to elements of type "INTERNAL_VisualChildInformation" in the "Core" assembly. { var childElement = item.INTERNAL_UIElement; if (childElement != null) { treeNode.Children.Add(RecursivelyAddElementsToTree(childElement, isNodeForXamlSourcePath, ref NbTreeViewElement)); } } } } NbTreeViewElement++; return treeNode; } static string GetFileNameFromPath(string path) { if (!string.IsNullOrEmpty(path)) { int i = path.LastIndexOf('\\'); if (i > 0) { return path.Substring(i + 1); } int j = path.LastIndexOf('/'); if (j > 0) { return path.Substring(j + 1); } return path; } else { return ""; } } static string GetTitleFromElement(dynamic uiElement) { if (uiElement != null) { var type = uiElement.GetType(); if (type is Type) { return ((Type)type).Name; } else return "[UNKNOWN ELEMENT]"; } else return "[UNKNOWN ELEMENT]"; } static string GetNameOrNullFromElement(dynamic uiElement) { if (uiElement != null) { var type = uiElement.GetType(); if (type is Type) { var propertyInfo = ((Type)type).GetProperty("Name"); if (propertyInfo != null) return propertyInfo.GetValue(uiElement); else return null; } else return null; } else return null; } static string GetXamlSourcePathOrNullFromElement(dynamic uiElement) { const string xamlSourcePathMemberName = "XamlSourcePath"; if (uiElement != null) { var type = uiElement.GetType(); if (type is Type) { var propertyInfo = ((Type)type).GetProperty(xamlSourcePathMemberName); if (propertyInfo != null) { return propertyInfo.GetValue(uiElement); } else { var fieldInfo = ((Type)type).GetField(xamlSourcePathMemberName); if (fieldInfo != null) { return fieldInfo.GetValue(uiElement); } else return null; } } else return null; } else return null; } static IEnumerable GetVisualTreeRootElements() { // Find the "Core" assembly among the loaded assemblies: Assembly coreAssembly = (from a in AppDomain.CurrentDomain.GetAssemblies() where a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY || a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY_USING_BRIDGE || a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY_SLMIGRATION || a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY_SLMIGRATION_USING_BRIDGE || a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY_USING_BLAZOR || a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY_SLMIGRATION_USING_BLAZOR select a).FirstOrDefault(); if (coreAssembly != null) { // Find the type "INTERNAL_PopupsManager" in Core: Type manager = (from type in coreAssembly.GetTypes() where (type.Namespace == "DotNetForHtml5.Core" && type.Name == "INTERNAL_PopupsManager") select type).FirstOrDefault(); if (manager != null) { // Call the "GetAllRootUIElements" method: var methodInfo = manager.GetMethod("GetAllRootUIElements", BindingFlags.Public | BindingFlags.Static); if (methodInfo != null) { var rootElements = methodInfo.Invoke(null, null); if (rootElements is IEnumerable) { return (IEnumerable)rootElements; } else return null; } else return null; } else return null; } else return null; } public static object GetElementAtSpecifiedCoordinates(Point coordinates) { // Find the "Core" assembly among the loaded assemblies: Assembly coreAssembly = (from a in AppDomain.CurrentDomain.GetAssemblies() where a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY || a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY_USING_BRIDGE || a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY_SLMIGRATION || a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY_SLMIGRATION_USING_BRIDGE || a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY_USING_BLAZOR || a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY_SLMIGRATION_USING_BLAZOR select a).FirstOrDefault(); if (coreAssembly != null) { // Find the type "VisualTreeHelper" in Core: Type manager = (from type in coreAssembly.GetTypes() where (type.Namespace == "CSHTML5.Internal" && type.Name == "INTERNAL_HtmlDomManager") select type).FirstOrDefault(); if (manager != null) { // Call the "GetAllRootUIElements" method: var methodInfo = manager.GetMethod("FindElementInHostCoordinates_UsedBySimulatorToo", BindingFlags.Public | BindingFlags.Static); if (methodInfo != null) { double dpiAwareX = ScreenCoordinatesHelper.ConvertWidthOrNaNToDpiAwareWidthOrNaN(coordinates.X, invert: true); double dpiAwareY = ScreenCoordinatesHelper.ConvertWidthOrNaNToDpiAwareWidthOrNaN(coordinates.Y, invert: true); var element = methodInfo.Invoke(null, new object[] { dpiAwareX, dpiAwareY }); return element; } else return null; } else return null; } else return null; } public static void HighlightElement(object userUIElementThatWeWantToHighlight, Rectangle rectangleUsedToHighlight, DotNetBrowser.Browser browser) { bool wasElementHighlighted = false; if (userUIElementThatWeWantToHighlight != null) { try { // Get the coordinates of the element in HTML: string uniqueIdentifier = ((dynamic)((dynamic)userUIElementThatWeWantToHighlight).INTERNAL_OuterDomElement).UniqueIdentifier.ToString(); if (uniqueIdentifier != null) { string coordinates = browser.ExecuteJavaScriptAndReturnValue(string.Format( @"var div = document.getElementById('{0}'); var rect = div.getBoundingClientRect(); var result = rect.top + ';' + rect.right + ';' + rect.bottom + ';' + rect.left; result; ", uniqueIdentifier)).ToString(); string[] coordinatesArray = coordinates.Replace(',', '.').Split(';'); double top = double.Parse(coordinatesArray[0]); double right = double.Parse(coordinatesArray[1]); double bottom = double.Parse(coordinatesArray[2]); double left = double.Parse(coordinatesArray[3]); // Take into account the screen DPI: double dpiAwareTop = ScreenCoordinatesHelper.ConvertWidthOrNaNToDpiAwareWidthOrNaN(top, invert: false); double dpiAwareRight = ScreenCoordinatesHelper.ConvertWidthOrNaNToDpiAwareWidthOrNaN(right, invert: false); double dpiAwareBottom = ScreenCoordinatesHelper.ConvertWidthOrNaNToDpiAwareWidthOrNaN(bottom, invert: false); double dpiAwareLeft = ScreenCoordinatesHelper.ConvertWidthOrNaNToDpiAwareWidthOrNaN(left, invert: false); Canvas.SetLeft(rectangleUsedToHighlight, dpiAwareLeft); Canvas.SetTop(rectangleUsedToHighlight, dpiAwareTop); rectangleUsedToHighlight.Width = (dpiAwareRight > dpiAwareLeft ? (dpiAwareRight - dpiAwareLeft) : 0); rectangleUsedToHighlight.Height = (dpiAwareBottom > dpiAwareTop ? (dpiAwareBottom - dpiAwareTop) : 0); rectangleUsedToHighlight.Visibility = Visibility.Visible; // Remember the highlighted element reference: rectangleUsedToHighlight.Tag = userUIElementThatWeWantToHighlight; wasElementHighlighted = true; } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } // Remove highlight if error or empty: if (!wasElementHighlighted) { rectangleUsedToHighlight.Width = double.NaN; rectangleUsedToHighlight.Height = double.NaN; rectangleUsedToHighlight.Visibility = Visibility.Collapsed; } } /* static dynamic GetVisualTreeRootElement() { // Find the "Core" assembly among the loaded assemblies: Assembly coreAssembly = (from a in AppDomain.CurrentDomain.GetAssemblies() where a.GetName().Name == Constants.NAME_OF_CORE_ASSEMBLY select a).FirstOrDefault(); if (coreAssembly != null) { // Find the "Window" type: Type windowType = (from type in coreAssembly.GetTypes() where (type.Namespace == "Windows.UI.Xaml" && type.Name == "Window") select type).FirstOrDefault(); if (windowType != null) { // Get the current window: var propertyInfo = windowType.GetProperty("Current", BindingFlags.Public | BindingFlags.Static); if (propertyInfo != null) { var window = propertyInfo.GetValue(null, null); return window; } else return null; } else return null; } else { return null; } } */ } }
{ "pile_set_name": "Github" }
1 8 64 1 14 16 64 test @
{ "pile_set_name": "Github" }
#ifndef _SHA1_H #define _SHA1_H #ifdef __cplusplus extern "C" { #endif #ifndef _STD_TYPES #define _STD_TYPES #define uchar unsigned char #define uint unsigned int #define ulong unsigned long int #endif typedef struct { ulong total[2]; ulong state[5]; uchar buffer[64]; } sha1_context; /* * Core SHA-1 functions */ void sha1_starts( sha1_context *ctx ); void sha1_update( sha1_context *ctx, uchar *input, uint length ); void sha1_finish( sha1_context *ctx, uchar digest[20] ); /* * Output SHA-1(file contents), returns 0 if successful. */ int sha1_file( char *filename, uchar digest[20] ); /* * Output SHA-1(buf) */ void sha1_csum( uchar *buf, uint buflen, uchar digest[20] ); /* * Output HMAC-SHA-1(key,buf) */ void sha1_hmac( uchar *key, uint keylen, uchar *buf, uint buflen, uchar digest[20] ); /* * Checkup routine */ int sha1_self_test( void ); #ifdef __cplusplus } #endif #endif /* sha1.h */
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <ZopeData> <record id="1" aka="AAAAAAAAAAE="> <pickle> <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> </pickle> <pickle> <dictionary> <item> <key> <string>delegated_list</string> </key> <value> <list/> </value> </item> <item> <key> <string>id</string> </key> <value> <string>my_source_decision_title</string> </value> </item> <item> <key> <string>message_values</string> </key> <value> <dictionary> <item> <key> <string>external_validator_failed</string> </key> <value> <string>The input failed the external validator.</string> </value> </item> </dictionary> </value> </item> <item> <key> <string>overrides</string> </key> <value> <dictionary> <item> <key> <string>field_id</string> </key> <value> <string></string> </value> </item> <item> <key> <string>form_id</string> </key> <value> <string></string> </value> </item> <item> <key> <string>target</string> </key> <value> <string></string> </value> </item> </dictionary> </value> </item> <item> <key> <string>tales</string> </key> <value> <dictionary> <item> <key> <string>field_id</string> </key> <value> <string></string> </value> </item> <item> <key> <string>form_id</string> </key> <value> <string></string> </value> </item> <item> <key> <string>target</string> </key> <value> <string></string> </value> </item> </dictionary> </value> </item> <item> <key> <string>values</string> </key> <value> <dictionary> <item> <key> <string>field_id</string> </key> <value> <string>my_source_decision_title</string> </value> </item> <item> <key> <string>form_id</string> </key> <value> <string>Base_viewCRMFieldLibrary</string> </value> </item> <item> <key> <string>target</string> </key> <value> <string>Click to edit the target</string> </value> </item> </dictionary> </value> </item> </dictionary> </pickle> </record> </ZopeData>
{ "pile_set_name": "Github" }
function(boost_modular_headers) cmake_parse_arguments(_bm "" "SOURCE_PATH" "" ${ARGN}) if(NOT DEFINED _bm_SOURCE_PATH) message(FATAL_ERROR "SOURCE_PATH is a required argument to boost_modular_headers.") endif() message(STATUS "Packaging headers") file( COPY ${_bm_SOURCE_PATH}/include/boost DESTINATION ${CURRENT_PACKAGES_DIR}/include ) message(STATUS "Packaging headers done") vcpkg_download_distfile(ARCHIVE URLS "https://raw.githubusercontent.com/boostorg/boost/boost-1.73.0/LICENSE_1_0.txt" FILENAME "boost_LICENSE_1_0.txt" SHA512 d6078467835dba8932314c1c1e945569a64b065474d7aced27c9a7acc391d52e9f234138ed9f1aa9cd576f25f12f557e0b733c14891d42c16ecdc4a7bd4d60b8 ) file(INSTALL ${ARCHIVE} DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) endfunction()
{ "pile_set_name": "Github" }
/** * Solarized Light theme for reveal.js. * Author: Achim Staebler */ // Default mixins and settings ----------------- @import "../template/mixins"; @import "../template/settings"; // --------------------------------------------- // Include theme-specific fonts @import url(../../lib/font/league-gothic/league-gothic.css); @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic); /** * Solarized colors by Ethan Schoonover */ html * { color-profile: sRGB; rendering-intent: auto; } // Solarized colors $base03: #002b36; $base02: #073642; $base01: #586e75; $base00: #657b83; $base0: #839496; $base1: #93a1a1; $base2: #eee8d5; $base3: #fdf6e3; $yellow: #b58900; $orange: #cb4b16; $red: #dc322f; $magenta: #d33682; $violet: #6c71c4; $blue: #268bd2; $cyan: #2aa198; $green: #859900; // Override theme settings (see ../template/settings.scss) $mainColor: $base00; $headingColor: $base01; $headingTextShadow: none; $backgroundColor: $base3; $linkColor: $blue; $linkColorHover: lighten( $linkColor, 20% ); $selectionBackgroundColor: $magenta; // Background generator // @mixin bodyBackground() { // @include radial-gradient( rgba($base3,1), rgba(lighten($base3, 20%),1) ); // } // Theme template ------------------------------ @import "../template/theme"; // ---------------------------------------------
{ "pile_set_name": "Github" }
// Copyright 2015 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 "base/trace_event/heap_profiler_stack_frame_deduplicator.h" #include <inttypes.h> #include <stddef.h> #include <string> #include <utility> #include "base/strings/stringprintf.h" #include "base/trace_event/trace_event_argument.h" #include "base/trace_event/trace_event_memory_overhead.h" namespace base { namespace trace_event { StackFrameDeduplicator::FrameNode::FrameNode(StackFrame frame, int parent_frame_index) : frame(frame), parent_frame_index(parent_frame_index) {} StackFrameDeduplicator::FrameNode::FrameNode(const FrameNode& other) = default; StackFrameDeduplicator::FrameNode::~FrameNode() {} StackFrameDeduplicator::StackFrameDeduplicator() {} StackFrameDeduplicator::~StackFrameDeduplicator() {} int StackFrameDeduplicator::Insert(const StackFrame* beginFrame, const StackFrame* endFrame) { int frame_index = -1; std::map<StackFrame, int>* nodes = &roots_; // Loop through the frames, early out when a frame is null. for (const StackFrame* it = beginFrame; it != endFrame; it++) { StackFrame frame = *it; auto node = nodes->find(frame); if (node == nodes->end()) { // There is no tree node for this frame yet, create it. The parent node // is the node associated with the previous frame. FrameNode frame_node(frame, frame_index); // The new frame node will be appended, so its index is the current size // of the vector. frame_index = static_cast<int>(frames_.size()); // Add the node to the trie so it will be found next time. nodes->insert(std::make_pair(frame, frame_index)); // Append the node after modifying |nodes|, because the |frames_| vector // might need to resize, and this invalidates the |nodes| pointer. frames_.push_back(frame_node); } else { // A tree node for this frame exists. Look for the next one. frame_index = node->second; } nodes = &frames_[frame_index].children; } return frame_index; } void StackFrameDeduplicator::AppendAsTraceFormat(std::string* out) const { out->append("{"); // Begin the |stackFrames| dictionary. int i = 0; auto frame_node = begin(); auto it_end = end(); std::string stringify_buffer; while (frame_node != it_end) { // The |stackFrames| format is a dictionary, not an array, so the // keys are stringified indices. Write the index manually, then use // |TracedValue| to format the object. This is to avoid building the // entire dictionary as a |TracedValue| in memory. SStringPrintf(&stringify_buffer, "\"%d\":", i); out->append(stringify_buffer); std::unique_ptr<TracedValue> frame_node_value(new TracedValue); const StackFrame& frame = frame_node->frame; switch (frame.type) { case StackFrame::Type::TRACE_EVENT_NAME: frame_node_value->SetString( "name", static_cast<const char*>(frame.value)); break; case StackFrame::Type::THREAD_NAME: SStringPrintf(&stringify_buffer, "[Thread: %s]", static_cast<const char*>(frame.value)); frame_node_value->SetString("name", stringify_buffer); break; case StackFrame::Type::PROGRAM_COUNTER: SStringPrintf(&stringify_buffer, "pc:%" PRIxPTR, reinterpret_cast<uintptr_t>(frame.value)); frame_node_value->SetString("name", stringify_buffer); break; } if (frame_node->parent_frame_index >= 0) { SStringPrintf(&stringify_buffer, "%d", frame_node->parent_frame_index); frame_node_value->SetString("parent", stringify_buffer); } frame_node_value->AppendAsTraceFormat(out); i++; frame_node++; if (frame_node != it_end) out->append(","); } out->append("}"); // End the |stackFrames| dictionary. } void StackFrameDeduplicator::EstimateTraceMemoryOverhead( TraceEventMemoryOverhead* overhead) { // The sizes here are only estimates; they fail to take into account the // overhead of the tree nodes for the map, but as an estimate this should be // fine. size_t maps_size = roots_.size() * sizeof(std::pair<StackFrame, int>); size_t frames_allocated = frames_.capacity() * sizeof(FrameNode); size_t frames_resident = frames_.size() * sizeof(FrameNode); for (const FrameNode& node : frames_) maps_size += node.children.size() * sizeof(std::pair<StackFrame, int>); overhead->Add("StackFrameDeduplicator", sizeof(StackFrameDeduplicator) + maps_size + frames_allocated, sizeof(StackFrameDeduplicator) + maps_size + frames_resident); } } // namespace trace_event } // namespace base
{ "pile_set_name": "Github" }
# frozen_string_literal: true # AsyncableJobMessaging handles the decision-making around how and whether events in the # lifecycle of an async job triggers sending a message to the user's inbox. class AsyncableJobMessaging FAILING_TIME_BEFORE_MESSAGING = 1.day.freeze attr_reader :job, :user def initialize(job:, user: RequestStore[:current_user]) @job = job @user = user end def add_job_note(text:, send_to_intake_user:) ApplicationRecord.transaction do job_note = JobNote.create!(job: job, user: user, note: text, send_to_intake_user: send_to_intake_user) if send_to_intake_user && job.asyncable_user message_text = <<-EOS.strip_heredoc A new note has been added to #{job.label}. <a href="#{job_note.path}">Click here</a> to view the note. EOS Message.create!(detail: job_note, text: message_text, user: job.asyncable_user, message_type: :job_note_added) end job_note end end def add_job_cancellation_note(text:) send_to_intake_user = !!job.asyncable_user ApplicationRecord.transaction do text = "This job has been cancelled with the following note:\n#{text}" job_note = JobNote.create!(job: job, user: user, note: text, send_to_intake_user: send_to_intake_user) if send_to_intake_user message_text = <<-EOS.strip_heredoc The job for processing <a href="#{job_note.path}">#{job.label}</a> has been cancelled.<br /> No further action is necessary. Please see the job details page for more information on why this job has been cancelled. EOS Message.create!(detail: job_note, text: message_text, user: job.asyncable_user, message_type: :job_cancelled) end job_note end end def handle_job_failure return unless messaging_enabled_for_job_attempt? return if job.messages.job_failing.any? err = ERB::Util.html_escape(job.sanitized_error) ApplicationRecord.transaction do note = "This job was unable to complete because of an error: #{err}" JobNote.create!(job: job, user: User.system_user, note: note) message_text = <<-EOS.strip_heredoc The job for <a href="#{job.path}">#{job.label}</a> was unable to complete because of an error: #{err}<br /> No further action is necessary as the (IT) support team has been notified. You will receive a separate message in your inbox when the issue has resolved. EOS Message.create!( detail: job, text: message_text, user: job.asyncable_user, message_type: :job_failing ) end end def handle_job_success return unless messaging_enabled_for_job_attempt? return if job.messages.failing_job_succeeded.any? ApplicationRecord.transaction do note = "This job has successfully been processed." JobNote.create!(job: job, user: User.system_user, note: note) message_text = <<-EOS.strip_heredoc <a href="#{job.path}">#{job.label}</a> has successfully been processed. No further action is necessary. If you have opened a support ticket for this issue, you may inform them that it may be closed. EOS Message.create!( detail: job, text: message_text, user: job.asyncable_user, message_type: "failing_job_succeeded" ) end end private def messaging_enabled_for_job_attempt? return false unless job.submitted? && job.asyncable_user Time.zone.now - job[job.class.submitted_at_column] >= FAILING_TIME_BEFORE_MESSAGING end end
{ "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.spark.launcher; import java.io.Closeable; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicLong; import java.util.logging.Level; import java.util.logging.Logger; import static org.apache.spark.launcher.LauncherProtocol.*; /** * A server that listens locally for connections from client launched by the library. Each client * has a secret that it needs to send to the server to identify itself and establish the session. * * I/O is currently blocking (one thread per client). Clients have a limited time to connect back * to the server, otherwise the server will ignore the connection. * * === Architecture Overview === * * The launcher server is used when Spark apps are launched as separate processes than the calling * app. It looks more or less like the following: * * ----------------------- ----------------------- * | User App | spark-submit | Spark App | * | | -------------------> | | * | ------------| |------------- | * | | | hello | | | * | | L. Server |<----------------------| L. Backend | | * | | | | | | * | ------------- ----------------------- * | | | ^ * | v | | * | -------------| | * | | | <per-app channel> | * | | App Handle |<------------------------------ * | | | * ----------------------- * * The server is started on demand and remains active while there are active or outstanding clients, * to avoid opening too many ports when multiple clients are launched. Each client is given a unique * secret, and have a limited amount of time to connect back * ({@link SparkLauncher#CHILD_CONNECTION_TIMEOUT}), at which point the server will throw away * that client's state. A client is only allowed to connect back to the server once. * * The launcher server listens on the localhost only, so it doesn't need access controls (aside from * the per-app secret) nor encryption. It thus requires that the launched app has a local process * that communicates with the server. In cluster mode, this means that the client that launches the * application must remain alive for the duration of the application (or until the app handle is * disconnected). */ class LauncherServer implements Closeable { private static final Logger LOG = Logger.getLogger(LauncherServer.class.getName()); private static final String THREAD_NAME_FMT = "LauncherServer-%d"; private static final long DEFAULT_CONNECT_TIMEOUT = 10000L; /** For creating secrets used for communication with child processes. */ private static final SecureRandom RND = new SecureRandom(); private static volatile LauncherServer serverInstance; static synchronized LauncherServer getOrCreateServer() throws IOException { LauncherServer server; do { server = serverInstance != null ? serverInstance : new LauncherServer(); } while (!server.running); server.ref(); serverInstance = server; return server; } // For testing. static synchronized LauncherServer getServer() { return serverInstance; } private final AtomicLong refCount; private final AtomicLong threadIds; private final ConcurrentMap<String, AbstractAppHandle> secretToPendingApps; private final List<ServerConnection> clients; private final ServerSocket server; private final Thread serverThread; private final ThreadFactory factory; private final Timer timeoutTimer; private volatile boolean running; private LauncherServer() throws IOException { this.refCount = new AtomicLong(0); ServerSocket server = new ServerSocket(); try { server.setReuseAddress(true); server.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); this.clients = new ArrayList<>(); this.threadIds = new AtomicLong(); this.factory = new NamedThreadFactory(THREAD_NAME_FMT); this.secretToPendingApps = new ConcurrentHashMap<>(); this.timeoutTimer = new Timer("LauncherServer-TimeoutTimer", true); this.server = server; this.running = true; this.serverThread = factory.newThread(this::acceptConnections); serverThread.start(); } catch (IOException ioe) { close(); throw ioe; } catch (Exception e) { close(); throw new IOException(e); } } /** * Registers a handle with the server, and returns the secret the child app needs to connect * back. */ synchronized String registerHandle(AbstractAppHandle handle) { String secret = createSecret(); secretToPendingApps.put(secret, handle); return secret; } @Override public void close() throws IOException { synchronized (this) { if (!running) { return; } running = false; } synchronized(LauncherServer.class) { serverInstance = null; } timeoutTimer.cancel(); server.close(); synchronized (clients) { List<ServerConnection> copy = new ArrayList<>(clients); clients.clear(); for (ServerConnection client : copy) { client.close(); } } if (serverThread != null) { try { serverThread.join(); } catch (InterruptedException ie) { // no-op } } } void ref() { refCount.incrementAndGet(); } void unref() { synchronized(LauncherServer.class) { if (refCount.decrementAndGet() == 0) { try { close(); } catch (IOException ioe) { // no-op. } } } } int getPort() { return server.getLocalPort(); } /** * Removes the client handle from the pending list (in case it's still there), and unrefs * the server. */ void unregister(AbstractAppHandle handle) { for (Map.Entry<String, AbstractAppHandle> e : secretToPendingApps.entrySet()) { if (e.getValue().equals(handle)) { String secret = e.getKey(); secretToPendingApps.remove(secret); break; } } unref(); } private void acceptConnections() { try { while (running) { final Socket client = server.accept(); TimerTask timeout = new TimerTask() { @Override public void run() { LOG.warning("Timed out waiting for hello message from client."); try { client.close(); } catch (IOException ioe) { // no-op. } } }; ServerConnection clientConnection = new ServerConnection(client, timeout); Thread clientThread = factory.newThread(clientConnection); clientConnection.setConnectionThread(clientThread); synchronized (clients) { clients.add(clientConnection); } long timeoutMs = getConnectionTimeout(); // 0 is used for testing to avoid issues with clock resolution / thread scheduling, // and force an immediate timeout. if (timeoutMs > 0) { timeoutTimer.schedule(timeout, timeoutMs); } else { timeout.run(); } clientThread.start(); } } catch (IOException ioe) { if (running) { LOG.log(Level.SEVERE, "Error in accept loop.", ioe); } } } private long getConnectionTimeout() { String value = SparkLauncher.launcherConfig.get(SparkLauncher.CHILD_CONNECTION_TIMEOUT); return (value != null) ? Long.parseLong(value) : DEFAULT_CONNECT_TIMEOUT; } private String createSecret() { while (true) { byte[] secret = new byte[128]; RND.nextBytes(secret); StringBuilder sb = new StringBuilder(); for (byte b : secret) { int ival = b >= 0 ? b : Byte.MAX_VALUE - b; if (ival < 0x10) { sb.append("0"); } sb.append(Integer.toHexString(ival)); } String secretStr = sb.toString(); if (!secretToPendingApps.containsKey(secretStr)) { return secretStr; } } } class ServerConnection extends LauncherConnection { private TimerTask timeout; private volatile Thread connectionThread; private volatile AbstractAppHandle handle; ServerConnection(Socket socket, TimerTask timeout) throws IOException { super(socket); this.timeout = timeout; } void setConnectionThread(Thread t) { this.connectionThread = t; } @Override protected void handle(Message msg) throws IOException { try { if (msg instanceof Hello) { timeout.cancel(); timeout = null; Hello hello = (Hello) msg; AbstractAppHandle handle = secretToPendingApps.remove(hello.secret); if (handle != null) { handle.setConnection(this); handle.setState(SparkAppHandle.State.CONNECTED); this.handle = handle; } else { throw new IllegalArgumentException("Received Hello for unknown client."); } } else { if (handle == null) { throw new IllegalArgumentException("Expected hello, got: " + msg != null ? msg.getClass().getName() : null); } if (msg instanceof SetAppId) { SetAppId set = (SetAppId) msg; handle.setAppId(set.appId); } else if (msg instanceof SetState) { handle.setState(((SetState)msg).state); } else { throw new IllegalArgumentException("Invalid message: " + msg != null ? msg.getClass().getName() : null); } } } catch (Exception e) { LOG.log(Level.INFO, "Error handling message from client.", e); if (timeout != null) { timeout.cancel(); } close(); if (handle != null) { handle.dispose(); } } finally { timeoutTimer.purge(); } } @Override public void close() throws IOException { if (!isOpen()) { return; } synchronized (clients) { clients.remove(this); } super.close(); } /** * Wait for the remote side to close the connection so that any pending data is processed. * This ensures any changes reported by the child application take effect. * * This method allows a short period for the above to happen (same amount of time as the * connection timeout, which is configurable). This should be fine for well-behaved * applications, where they close the connection arond the same time the app handle detects the * app has finished. * * In case the connection is not closed within the grace period, this method forcefully closes * it and any subsequent data that may arrive will be ignored. */ public void waitForClose() throws IOException { Thread connThread = this.connectionThread; if (Thread.currentThread() != connThread) { try { connThread.join(getConnectionTimeout()); } catch (InterruptedException ie) { // Ignore. } if (connThread.isAlive()) { LOG.log(Level.WARNING, "Timed out waiting for child connection to close."); close(); } } } } }
{ "pile_set_name": "Github" }
package com.duckduckgo.mobile.android.events.deleteEvents; public class DeleteStoryInHistoryEvent extends DeleteEvent { public String feedObjectId; public DeleteStoryInHistoryEvent(String feedObjectId){ this.feedObjectId = feedObjectId; } }
{ "pile_set_name": "Github" }
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": { "0": "\u043f\u0440. \u043e\u0431.", "1": "\u0441\u043b. \u043e\u0431." }, "DAY": { "0": "\u043d\u0435\u0434\u0435\u043b\u044f", "1": "\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a", "2": "\u0432\u0442\u043e\u0440\u043d\u0438\u043a", "3": "\u0441\u0440\u044f\u0434\u0430", "4": "\u0447\u0435\u0442\u0432\u044a\u0440\u0442\u044a\u043a", "5": "\u043f\u0435\u0442\u044a\u043a", "6": "\u0441\u044a\u0431\u043e\u0442\u0430" }, "MONTH": { "0": "\u044f\u043d\u0443\u0430\u0440\u0438", "1": "\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438", "2": "\u043c\u0430\u0440\u0442", "3": "\u0430\u043f\u0440\u0438\u043b", "4": "\u043c\u0430\u0439", "5": "\u044e\u043d\u0438", "6": "\u044e\u043b\u0438", "7": "\u0430\u0432\u0433\u0443\u0441\u0442", "8": "\u0441\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438", "9": "\u043e\u043a\u0442\u043e\u043c\u0432\u0440\u0438", "10": "\u043d\u043e\u0435\u043c\u0432\u0440\u0438", "11": "\u0434\u0435\u043a\u0435\u043c\u0432\u0440\u0438" }, "SHORTDAY": { "0": "\u043d\u0434", "1": "\u043f\u043d", "2": "\u0432\u0442", "3": "\u0441\u0440", "4": "\u0447\u0442", "5": "\u043f\u0442", "6": "\u0441\u0431" }, "SHORTMONTH": { "0": "\u044f\u043d.", "1": "\u0444\u0435\u0432\u0440.", "2": "\u043c\u0430\u0440\u0442", "3": "\u0430\u043f\u0440.", "4": "\u043c\u0430\u0439", "5": "\u044e\u043d\u0438", "6": "\u044e\u043b\u0438", "7": "\u0430\u0432\u0433.", "8": "\u0441\u0435\u043f\u0442.", "9": "\u043e\u043a\u0442.", "10": "\u043d\u043e\u0435\u043c.", "11": "\u0434\u0435\u043a." }, "fullDate": "dd MMMM y, EEEE", "longDate": "dd MMMM y", "medium": "dd.MM.yyyy HH:mm:ss", "mediumDate": "dd.MM.yyyy", "mediumTime": "HH:mm:ss", "short": "dd.MM.yy HH:mm", "shortDate": "dd.MM.yy", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "lev", "DECIMAL_SEP": ",", "GROUP_SEP": "\u00a0", "PATTERNS": { "0": { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, "1": { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "-", "negSuf": "\u00a0\u00a4", "posPre": "", "posSuf": "\u00a0\u00a4" } } }, "id": "bg", "pluralCat": function (n) { if (n == 1) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;} }); }]);
{ "pile_set_name": "Github" }
package com.yugabyte.yw.common;// Copyright (c) YugaByte, Inc. import com.google.inject.Singleton; import com.google.inject.Inject; import java.io.InputStream; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.CustomClassLoaderConstructor; @Singleton public class YamlWrapper { private final play.Environment environment; @Inject public YamlWrapper(play.Environment environment) { this.environment = environment; } /** * Load a com.yugabyte.yw.common.Yaml file from the classpath. */ public Object load(String resourceName) { return load( environment.resourceAsStream(resourceName), environment.classLoader() ); } /** * Load the specified InputStream as com.yugabyte.yw.common.Yaml. * * @param classloader The classloader to use to instantiate Java objects. */ public Object load(InputStream is, ClassLoader classloader) { Yaml yaml = new Yaml(new CustomClassLoaderConstructor(classloader)); return yaml.load(is); } }
{ "pile_set_name": "Github" }
[![Stories in Ready](https://badge.waffle.io/dynosrc/dynosrc.png?label=ready)](https://waffle.io/dynosrc/dynosrc) [![NPM](https://nodei.co/npm/dynosrc.png?downloads=true&stars=true)](https://nodei.co/npm/dynosrc/) # [DynoSrc](http://www.dynosrc.com) DynoSRC is a general solution for efficiently delivering JS resources to clients, using diff-based updates as assets change over time. ## Benefits #### Minimize HTTP Requests DynoSRC loads JavaScript files inline in your HTML response, then stores them in localStorage. You can even inline the calls to the DynoSRC client lib in your HTML response, eliminating all HTTP requests for JavaScript on your site. #### Differential Updates Normally, if a JS asset on your site changes, your users will have to download the entire file again even though just a fraction of it changed. DynoSRC sends down differentials updates so changes to large files don't require full downloads. ## Getting Started #### Install DynoSrc npm install dynosrc #### Configure Middleware dynSrc.globals({ //folder containing your JS / CSS files assetsDir: __dirname + '/assets' }); //install express style middleware app.use(dynoSrc.middleware()); dynSrc.assets({ //point directly to files on github 'ryanstevens/ModelFlow': { filename: 'package.json', source: 'git', //this can also be a tag head: '8050f1' }, 'jquery': { head: '1.9.1', //this lives on disk source: 'asset' } }); #### Get Patches, Send to Client app.get('/', function (req, res) { dynSrc.getPatches(req, { patches: ['jquery', 'backbone'] }, function(err, patches) { res.render('index.html', { title: 'Super Cool Project', patches: patches }); }); }); ##### This will produce corresponding "patch" deltas in your HTML //inserted from dynSrc.getPatches dynoSrc.apply('my-cool-module', '0.1.2', '...diff...'); ## How does it work? * git diff * We are relying on forking out to a child_process. * This means the process you are running node with must have access to git. * The reason we are not using js-git for this was because that feature was not implemented yet. * DEV mode FTW * dynoSrc eats its own dog food in while developing. We really felt this was an important feature so this isn't just a build tool for "production". This way any bugs that come from using this strategy will appear earlier in the dev cycle, rather than in production. Here is a simple run down of what the middleware will do on every page load. * Look at the resources in your cookie * Look at every local resource in your repo that needs to be served * Determine if there were changes (due to direct file change via a human, or maybe grunt rewrote them) * Write the changed file to a scratch area with an epoc timestamp * Compute a diff from the last page load * Send ONLY the diff ## TODOs * DEV mode WILL eat your entire HD. Someone needs to write a thing to clean up all the things :) * Move sever oriented unit tests out of NodeKnockout repo and into public dynoSrc repo. * Remove hard dependancy on shelling out to git. * Much of this feels like it could be complimented with a Grunt task. * Write client unit tests against dynoSrc.js ;) * Bit mask resources in cookie to not store entire resource name
{ "pile_set_name": "Github" }
from pyrevit import forms from pyrevit import revit, DB class ViewTemplateToPurge(forms.TemplateListItem): @property def name(self): return self.item.Name viewlist = DB.FilteredElementCollector(revit.doc)\ .OfClass(DB.View)\ .WhereElementIsNotElementType()\ .ToElements() vtemp = set() usedvtemp = set() views = [] for v in viewlist: if v.IsTemplate and 'master' not in revit.query.get_name(v).lower(): vtemp.add(v.Id.IntegerValue) else: views.append(v) for v in views: vtid = v.ViewTemplateId.IntegerValue if vtid > 0: usedvtemp.add(vtid) unusedvtemp = vtemp - usedvtemp if not unusedvtemp: forms.alert('All View Templates are in use. No purging in necessary.') else: # ask user for wipe actions return_options = \ forms.SelectFromList.show( [ViewTemplateToPurge(revit.doc.GetElement(DB.ElementId(x))) for x in unusedvtemp], title='Select View Templates to Purge', width=500, button_name='Purge View Templates', multiselect=True ) if return_options: with revit.Transaction('Purge Unused View Templates'): for vtp in return_options: print('Purging View Template: {0}\t{1}' .format(vtp.Id, vtp.Name)) revit.doc.Delete(vtp.Id)
{ "pile_set_name": "Github" }
<?php /** * Copyright (c) UNA, Inc - https://una.io * MIT License - https://opensource.org/licenses/MIT * * @defgroup UnaStudioView UNA Studio Representation classes * @ingroup UnaStudio * @{ */ defined('BX_DOL') or die('hack attempt'); class BxTemplStudioGrid extends BxBaseStudioGrid { function __construct($aOptions, $oTemplate = false) { parent::__construct($aOptions, $oTemplate); } } /** @} */
{ "pile_set_name": "Github" }
<?php require 'includes/html/graphs/common.inc.php'; $rrd_options .= " COMMENT:' Min Last Max\\n'"; $sensor['sensor_descr_fixed'] = rrdtool_escape($sensor['sensor_descr'], 23); $rrd_options .= " DEF:sensor=$rrd_filename:sensor:AVERAGE"; $rrd_options .= " DEF:sensor_max=$rrd_filename:sensor:MAX"; $rrd_options .= " DEF:sensor_min=$rrd_filename:sensor:MIN"; $rrd_options .= " LINE1.5:sensor#cc0000:'" . $sensor['sensor_descr_fixed'] . "'"; $rrd_options .= " GPRINT:sensor_min$current_id:MIN:%4.0lf"; $rrd_options .= ' GPRINT:sensor:LAST:%4.0lf'; $rrd_options .= ' GPRINT:sensor_max:MAX:%4.0lf\\l'; if (is_numeric($sensor['sensor_limit'])) { $rrd_options .= ' HRULE:' . $sensor['sensor_limit'] . '#999999::dashes'; } if (is_numeric($sensor['sensor_limit_low'])) { $rrd_options .= ' HRULE:' . $sensor['sensor_limit_low'] . '#999999::dashes'; }
{ "pile_set_name": "Github" }
<?php declare(strict_types=1); /* * This file is part of the tenancy/tenancy package. * * Copyright Tenancy for Laravel * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @see https://tenancy.dev * @see https://github.com/tenancy */ namespace Tenancy\Tests; trait UsesMigrations { public function getMigrationsPath() { return __DIR__.DIRECTORY_SEPARATOR .'Mocks'.DIRECTORY_SEPARATOR .'Migrations'; } }
{ "pile_set_name": "Github" }
# Copied from Dynmap. With thanks to Mike Primm 1 133 129 118 255 111 108 98 255 93 90 82 255 111 108 98 255 2 60 113 17 255 50 94 14 255 42 79 12 255 50 94 14 255 3 103 83 51 255 86 69 43 255 72 58 36 255 86 69 43 255 3:2 122 87 57 255 97 69 45 255 61 43 28 255 48 34 22 255 4 118 112 96 255 98 93 80 255 82 78 67 255 98 93 80 255 5 109 80 60 255 91 67 50 255 76 56 41 255 91 67 50 255 5:1 103 77 46 255 82 61 36 255 51 38 23 255 41 30 18 255 5:2 195 179 123 255 156 143 98 255 97 89 61 255 78 71 49 255 5:3 154 110 77 255 123 88 61 255 77 55 38 255 61 44 30 255 5:4 169 91 51 255 135 72 40 255 84 45 25 255 67 36 20 255 5:5 61 39 18 255 48 31 14 255 30 19 9 255 24 15 7 255 6 120 120 120 0 96 96 96 0 60 60 60 0 48 48 48 0 6:1 51 58 33 83 40 46 26 83 25 29 16 83 20 23 13 83 6:2 118 150 84 107 94 120 67 107 59 75 42 107 47 60 33 107 6:3 48 86 18 85 38 68 14 85 24 43 9 85 19 34 7 85 6:4 114 115 20 75 91 92 16 75 57 57 10 75 45 46 8 75 6:5 56 86 28 100 44 68 22 100 28 43 14 100 22 34 11 100 6:9 51 58 33 83 40 46 26 83 25 29 16 83 20 23 13 83 6:10 118 150 84 107 94 120 67 107 59 75 42 107 47 60 33 107 6:11 48 86 18 85 38 68 14 85 24 43 9 85 19 34 7 85 6:12 114 115 20 75 91 92 16 75 57 57 10 75 45 46 8 75 6:13 56 86 28 100 44 68 22 100 28 43 14 100 22 34 11 100 7 79 79 82 255 66 66 68 255 55 55 57 255 66 66 68 255 8 94 170 255 51 82 148 223 51 69 124 186 51 82 148 223 51 9 94 170 255 51 82 148 223 51 69 124 186 51 82 148 223 51 10 255 164 41 255 255 164 41 255 212 137 34 255 255 164 41 255 11 255 164 41 255 255 164 41 255 212 137 34 255 255 164 41 255 12 192 178 110 255 160 148 92 255 134 124 77 255 160 148 92 255 13 120 105 79 255 100 87 66 255 84 73 55 255 100 87 66 255 14 255 181 38 255 255 181 38 255 212 151 31 255 255 181 38 255 15 231 174 113 255 193 145 94 255 161 121 79 255 193 145 94 255 16 56 60 70 255 46 50 58 255 39 42 49 255 46 50 58 255 17 119 97 74 255 99 81 62 255 83 68 52 255 99 81 62 255 17:0 119 97 74 255 99 81 62 255 83 68 52 255 99 81 62 255 17:1 75 44 24 255 125 102 63 255 78 64 39 255 30 18 10 255 17:2 191 191 191 255 125 102 63 255 78 64 39 255 76 76 76 255 17:3 75 44 24 255 125 102 63 255 78 64 39 255 30 18 10 255 18 27 69 37 180 22 57 31 180 19 48 25 180 22 57 31 180 18:1 44 69 44 0 35 55 35 0 22 34 22 0 17 27 17 0 18:2 67 88 45 0 53 70 36 0 33 44 22 0 26 35 18 0 18:3 18 71 25 0 14 56 20 0 9 35 12 0 7 28 10 0 18:5 44 69 44 0 35 55 35 0 22 34 22 0 17 27 17 0 18:6 67 88 45 0 53 70 36 0 33 44 22 0 26 35 18 0 18:7 18 71 25 0 14 56 20 0 9 35 12 0 7 28 10 0 18:9 44 69 44 0 35 55 35 0 22 34 22 0 17 27 17 0 18:10 67 88 45 0 53 70 36 0 33 44 22 0 26 35 18 0 18:11 18 71 25 0 14 56 20 0 9 35 12 0 7 28 10 0 18:13 44 69 44 0 35 55 35 0 22 34 22 0 17 27 17 0 18:14 67 88 45 0 53 70 36 0 33 44 22 0 26 35 18 0 18:15 18 71 25 0 14 56 20 0 9 35 12 0 7 28 10 0 19 193 193 65 255 174 174 47 255 97 97 5 255 76 76 20 255 20 178 217 223 90 148 181 186 90 124 151 155 90 148 181 186 90 21 23 68 196 255 18 56 158 255 14 43 122 255 14 43 78 255 22 23 68 196 255 18 56 158 255 14 43 122 255 14 43 78 255 23 96 96 96 255 76 76 76 255 48 48 48 255 38 38 38 255 24 192 178 110 255 160 148 92 255 134 124 77 255 160 148 92 255 25 125 91 38 255 100 72 30 255 62 45 19 255 50 36 15 255 26 200 20 20 255 160 16 16 255 100 10 10 255 80 8 8 255 27 150 134 102 180 120 107 81 180 75 67 51 180 60 53 40 180 28 150 134 102 180 120 107 81 180 75 67 51 180 60 53 40 180 29 109 80 60 255 111 108 98 255 76 56 41 255 111 108 98 255 30 138 145 145 255 110 115 115 255 69 72 72 255 55 57 57 255 31 97 156 53 255 73 120 38 255 38 68 16 255 26 50 9 255 31:1 14 58 21 0 11 46 16 0 7 29 10 0 5 23 8 0 31:2 15 60 22 0 12 48 17 0 7 30 11 0 6 24 8 0 32 75 44 24 255 60 35 19 255 37 22 12 255 30 18 10 255 33 109 80 60 255 111 108 98 255 76 56 41 255 111 108 98 255 34 109 80 60 255 111 108 98 255 76 56 41 255 111 108 98 255 35 247 255 239 255 244 251 236 255 204 210 197 255 244 251 236 255 35:0 247 255 239 255 244 251 236 255 204 210 197 255 244 251 236 255 35:1 227 128 52 255 224 126 51 255 187 105 42 255 224 126 51 255 35:2 185 76 188 255 183 75 186 255 153 63 155 255 183 75 186 255 35:3 102 139 199 255 100 137 196 255 84 114 164 255 100 137 196 255 35:4 189 181 26 255 187 178 26 255 156 149 22 255 187 178 26 255 35:5 57 189 45 255 56 186 44 255 47 156 37 255 56 186 44 255 35:6 211 132 145 255 209 130 143 255 174 109 120 255 209 130 143 255 35:7 65 67 63 255 64 66 62 255 54 55 52 255 64 66 62 255 35:8 154 166 156 255 152 163 154 255 127 137 128 255 152 163 154 255 35:9 38 117 141 255 37 115 139 255 31 96 116 255 37 115 139 255 35:10 126 54 184 255 124 53 181 255 104 44 151 255 124 53 181 255 35:11 38 51 144 255 37 50 143 255 31 42 119 255 37 50 143 255 35:12 83 51 26 255 82 50 26 255 69 42 22 255 82 50 26 255 35:13 54 77 22 255 54 76 22 255 45 63 19 255 54 76 22 255 35:14 159 45 38 255 157 44 38 255 131 37 32 255 157 44 38 255 35:15 26 23 22 255 26 23 21 255 22 19 18 255 26 23 21 255 37 73 108 60 254 61 90 50 254 51 75 42 254 61 90 50 254 38 84 139 187 254 70 116 155 254 59 97 130 254 70 116 155 254 38:1 37 152 138 45 29 121 110 45 18 76 69 45 14 60 55 45 38:2 177 141 211 38 141 112 168 38 88 70 105 38 70 56 84 38 38:3 162 191 138 42 129 152 110 42 81 95 69 42 64 76 55 42 38:4 103 135 38 48 82 108 30 48 51 67 19 48 41 54 15 48 38:5 95 134 32 49 76 107 25 49 47 67 16 49 38 53 12 49 38:6 94 153 65 48 75 122 52 48 47 76 32 48 37 61 26 48 38:7 101 150 73 47 80 120 58 47 50 75 36 47 40 60 29 47 38:8 176 197 139 43 140 157 111 43 88 98 69 43 70 78 55 43 39 184 144 0 254 153 119 0 254 128 100 0 254 153 119 0 254 40 201 17 17 254 168 14 14 254 140 12 12 254 168 14 14 254 41 247 255 239 255 244 251 236 255 204 210 197 255 244 251 236 255 42 249 249 249 255 207 207 207 255 173 173 173 255 207 207 207 255 43 122 112 99 255 101 93 82 255 85 78 69 255 101 93 82 255 43:0 122 112 99 255 101 93 82 255 85 78 69 255 101 93 82 255 43:1 192 178 110 255 160 148 92 255 134 124 77 255 160 148 92 255 43:2 109 80 60 255 91 67 50 255 76 56 41 255 91 67 50 255 43:3 118 112 96 255 98 93 80 255 82 78 67 255 98 93 80 255 43:4 170 86 62 255 136 68 49 255 85 43 31 255 68 34 24 255 43:5 200 200 200 255 160 160 160 255 100 100 100 255 80 80 80 255 43:6 122 112 99 255 101 93 82 255 85 78 69 255 101 93 82 255 44 122 112 99 254 101 93 82 254 85 78 69 254 101 93 82 254 44:0 122 112 99 254 101 93 82 254 85 78 69 254 101 93 82 254 44:1 192 178 110 255 160 148 92 255 134 124 77 255 160 148 92 255 44:2 109 80 60 255 91 67 50 255 76 56 41 255 91 67 50 255 44:3 118 112 96 255 98 93 80 255 82 78 67 255 98 93 80 255 44:4 170 86 62 255 136 68 49 255 85 43 31 255 68 34 24 255 44:5 200 200 200 255 160 160 160 255 100 100 100 255 80 80 80 255 44:6 122 112 99 254 101 93 82 254 85 78 69 254 101 93 82 254 44:8 122 112 99 254 101 93 82 254 85 78 69 254 101 93 82 254 44:9 192 178 110 255 160 148 92 255 134 124 77 255 160 148 92 255 44:10 109 80 60 255 91 67 50 255 76 56 41 255 91 67 50 255 44:11 118 112 96 255 98 93 80 255 82 78 67 255 98 93 80 255 44:12 170 86 62 255 136 68 49 255 85 43 31 255 68 34 24 255 44:13 200 200 200 255 160 160 160 255 100 100 100 255 80 80 80 255 44:14 122 112 99 254 101 93 82 254 85 78 69 254 101 93 82 254 45 230 103 73 255 192 86 61 255 160 71 50 255 192 86 61 255 46 255 79 30 255 231 72 27 255 193 60 22 255 231 72 27 255 47 125 91 38 192 100 72 30 192 62 45 19 192 50 36 15 192 48 96 108 70 255 80 90 58 255 67 75 49 255 80 90 58 255 49 83 67 83 255 69 56 69 255 58 47 58 255 69 56 69 255 50 255 203 58 200 255 203 58 200 212 169 48 200 255 203 58 200 51 255 170 30 200 255 170 30 200 212 141 25 200 255 170 30 200 52 255 228 52 255 255 228 52 255 212 190 43 255 255 228 52 255 53 145 109 80 255 121 91 67 255 101 76 56 255 121 91 67 255 53:4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 54 165 132 100 255 138 110 84 255 115 92 70 255 138 110 84 255 55 116 21 21 255 97 18 18 255 81 15 15 255 97 18 18 255 56 115 230 255 255 105 210 232 255 88 175 194 255 105 210 232 255 57 164 217 237 255 136 181 198 255 114 151 165 255 136 181 198 255 58 171 138 99 255 142 115 82 255 118 96 68 255 142 115 82 255 59 136 152 21 255 114 127 17 255 95 106 14 255 114 127 17 255 60 123 82 51 255 103 68 43 255 86 57 36 255 103 68 43 255 61 158 128 73 255 132 106 61 255 110 89 51 255 132 106 61 255 62 158 128 73 255 132 106 61 255 110 89 51 255 132 106 61 255 63 60 112 17 255 50 93 14 255 42 78 12 255 50 93 14 255 64 129 97 69 255 108 81 57 255 90 68 47 255 108 81 57 255 65 144 128 99 32 120 106 82 32 100 89 69 32 120 106 82 32 66 113 109 102 180 94 91 85 180 79 76 71 180 94 91 85 180 67 115 107 93 255 96 89 78 255 80 75 65 255 96 89 78 255 68 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255 69 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255 70 120 120 120 255 96 96 96 255 60 60 60 255 48 48 48 255 71 255 255 255 255 229 229 229 255 191 191 191 255 229 229 229 255 72 111 91 54 255 88 72 43 255 55 45 27 255 44 36 21 255 73 174 107 107 255 145 89 89 255 121 75 75 255 145 89 89 255 74 174 107 107 255 145 89 89 255 121 75 75 255 145 89 89 255 75 255 140 61 254 217 119 52 254 181 99 43 254 217 119 52 254 76 255 0 0 254 255 0 0 254 212 0 0 254 255 0 0 254 77 120 120 120 255 96 96 96 255 60 60 60 255 48 48 48 255 78 237 248 255 254 237 248 255 254 198 207 212 254 237 248 255 254 79 166 222 255 55 166 222 255 55 139 185 212 55 166 222 255 55 80 237 248 255 255 237 248 255 255 198 207 212 255 237 248 255 255 81 116 167 80 255 97 139 67 255 81 116 56 255 97 139 67 255 82 234 240 255 255 216 221 235 255 180 185 196 255 216 221 235 255 83 136 167 74 255 114 139 62 255 95 116 52 255 114 139 62 255 84 116 97 80 255 97 81 67 255 81 68 55 255 97 81 67 255 85 115 99 63 255 96 82 52 255 80 69 44 255 96 82 52 255 86 255 115 0 200 204 92 0 200 126 57 0 200 102 46 0 200 87 166 89 89 255 141 80 62 255 135 15 15 255 96 6 6 255 88 133 109 94 255 121 97 82 255 90 70 57 255 79 59 46 255 89 249 212 156 255 255 188 94 255 192 143 70 255 122 91 44 255 90 140 0 196 128 120 0 196 128 140 0 196 128 120 0 196 128 91 255 115 0 255 204 92 0 255 126 57 0 255 102 46 0 255 92 234 234 234 255 210 210 210 255 203 203 203 255 190 190 190 255 93 159 127 80 255 72 56 25 0 181 140 64 255 144 112 51 0 Below - same as standard 94 125 125 125 255 100 100 100 255 62 62 62 255 50 50 50 255 95 255 255 255 123 204 204 204 123 127 127 127 123 102 102 102 123 95:1 216 127 51 123 172 101 40 123 108 63 25 123 86 50 20 123 95:2 178 76 216 123 142 60 172 123 89 38 108 123 71 30 86 123 95:3 102 153 216 123 81 122 172 123 51 76 108 123 40 61 86 123 95:4 229 229 51 123 183 183 40 123 114 114 25 123 91 91 20 123 95:5 127 204 25 123 101 163 20 123 63 102 12 123 50 81 10 123 95:6 242 127 165 123 193 101 132 123 121 63 82 123 96 50 66 123 95:7 76 76 76 123 60 60 60 123 38 38 38 123 30 30 30 123 95:8 153 153 153 123 122 122 122 123 76 76 76 123 61 61 61 123 95:9 76 127 153 123 60 101 122 123 38 63 76 123 30 50 61 123 95:10 127 63 178 123 101 50 142 123 63 31 89 123 50 25 71 123 95:11 51 76 178 123 40 60 142 123 25 38 89 123 20 30 71 123 95:12 102 76 51 123 81 60 40 123 51 38 25 123 40 30 20 123 95:13 102 127 51 123 81 101 40 123 51 63 25 123 40 50 20 123 95:14 153 51 51 123 122 40 40 123 76 25 25 123 61 20 20 123 95:15 25 25 25 123 20 20 20 123 12 12 12 123 10 10 10 123 96 126 93 45 219 100 74 36 219 63 46 22 219 50 37 18 219 97 125 125 125 255 100 100 100 255 62 62 62 255 50 50 50 255 97:1 122 122 122 255 97 97 97 255 61 61 61 255 48 48 48 255 97:2 122 122 122 255 97 97 97 255 61 61 61 255 48 48 48 255 98 122 122 122 255 97 97 97 255 61 61 61 255 48 48 48 255 98:1 114 119 106 255 91 95 84 255 57 59 53 255 45 47 42 255 98:2 118 118 118 255 94 94 94 255 59 59 59 255 47 47 47 255 98:3 118 118 118 255 94 94 94 255 59 59 59 255 47 47 47 255 99 202 171 120 255 161 136 96 255 101 85 60 255 80 68 48 255 99:1 141 106 83 255 112 84 66 255 70 53 41 255 56 42 33 255 99:4 141 106 83 255 112 84 66 255 70 53 41 255 56 42 33 255 99:7 141 106 83 255 112 84 66 255 70 53 41 255 56 42 33 255 99:10 207 204 194 255 165 163 155 255 103 102 97 255 82 81 77 255 99:14 141 106 83 255 112 84 66 255 70 53 41 255 56 42 33 255 99:15 207 204 194 255 165 163 155 255 103 102 97 255 82 81 77 255 100 202 171 120 255 161 136 96 255 101 85 60 255 80 68 48 255 100:1 182 37 36 255 145 29 28 255 91 18 18 255 72 14 14 255 100:4 182 37 36 255 145 29 28 255 91 18 18 255 72 14 14 255 100:7 182 37 36 255 145 29 28 255 91 18 18 255 72 14 14 255 100:10 207 204 194 255 165 163 155 255 103 102 97 255 82 81 77 255 100:14 182 37 36 255 145 29 28 255 91 18 18 255 72 14 14 255 100:15 207 204 194 255 165 163 155 255 103 102 97 255 82 81 77 255 101 109 108 106 115 87 86 84 115 54 54 53 115 43 43 42 115 102 218 240 244 70 174 192 195 70 109 120 122 70 87 96 97 70 103 141 145 36 255 112 116 28 255 70 72 18 255 56 58 14 255 104 90 112 56 34 72 89 44 34 45 56 28 34 36 44 22 34 105 90 112 56 34 72 89 44 34 45 56 28 34 36 44 22 34 106 54 73 23 138 43 58 18 138 27 36 11 138 21 29 9 138 107 156 127 78 255 124 101 62 255 78 63 39 255 62 50 31 255 108 146 99 86 255 116 79 68 255 73 49 43 255 58 39 34 255 109 122 122 122 255 97 97 97 255 61 61 61 255 48 48 48 255 110 113 88 73 255 90 70 58 255 56 44 36 255 45 35 29 255 111 14 59 22 0 11 47 17 0 7 29 11 0 5 23 8 0 112 44 22 26 255 35 17 20 255 22 11 13 255 17 8 10 255 113 44 22 26 255 35 17 20 255 22 11 13 255 17 8 10 255 114 44 22 26 255 35 17 20 255 22 11 13 255 17 8 10 255 115 106 14 30 42 84 11 24 42 53 7 15 42 42 5 12 42 115:1 108 15 22 120 86 12 17 120 54 7 11 120 43 6 8 120 115:2 108 15 22 120 86 12 17 120 54 7 11 120 43 6 8 120 115:3 111 18 17 204 88 14 13 204 55 9 8 204 44 7 6 204 115:4 111 18 17 204 88 14 13 204 55 9 8 204 44 7 6 204 115:5 111 18 17 204 88 14 13 204 55 9 8 204 44 7 6 204 115:6 111 18 17 204 88 14 13 204 55 9 8 204 44 7 6 204 115:7 111 18 17 204 88 14 13 204 55 9 8 204 44 7 6 204 116 41 43 46 191 32 34 36 191 20 21 23 191 16 17 18 191 117 106 106 106 255 84 84 84 255 53 53 53 255 42 42 42 255 118 62 62 62 231 49 49 49 231 31 31 31 231 24 24 24 231 119 20 18 29 255 16 14 23 255 10 9 14 255 8 7 11 255 120 147 160 123 207 117 128 98 207 73 80 61 207 58 64 49 207 121 221 223 165 255 176 178 132 255 110 111 82 255 88 89 66 255 122 12 9 15 255 9 7 12 255 6 4 7 255 4 3 6 255 123 70 43 26 255 56 34 20 255 35 21 13 255 28 17 10 255 124 119 89 55 255 95 71 44 255 59 44 27 255 47 35 22 255 125 156 127 78 255 124 101 62 255 78 63 39 255 62 50 31 255 125:1 103 77 46 255 82 61 36 255 51 38 23 255 41 30 18 255 125:2 195 179 123 255 156 143 98 255 97 89 61 255 78 71 49 255 125:3 154 110 77 255 123 88 61 255 77 55 38 255 61 44 30 255 125:4 169 91 51 255 135 72 40 255 84 45 25 255 67 36 20 255 125:5 61 39 18 255 48 31 14 255 30 19 9 255 24 15 7 255 125:9 103 77 46 255 82 61 36 255 51 38 23 255 41 30 18 255 125:10 195 179 123 255 156 143 98 255 97 89 61 255 78 71 49 255 125:11 154 110 77 255 123 88 61 255 77 55 38 255 61 44 30 255 125:12 169 91 51 255 135 72 40 255 84 45 25 255 67 36 20 255 125:13 61 39 18 255 48 31 14 255 30 19 9 255 24 15 7 255 126 156 127 78 255 124 101 62 255 78 63 39 255 62 50 31 255 126:1 103 77 46 255 82 61 36 255 51 38 23 255 41 30 18 255 126:2 195 179 123 255 156 143 98 255 97 89 61 255 78 71 49 255 126:3 154 110 77 255 123 88 61 255 77 55 38 255 61 44 30 255 126:4 169 91 51 255 135 72 40 255 84 45 25 255 67 36 20 255 126:5 61 39 18 255 48 31 14 255 30 19 9 255 24 15 7 255 126:9 103 77 46 255 82 61 36 255 51 38 23 255 41 30 18 255 126:10 195 179 123 255 156 143 98 255 97 89 61 255 78 71 49 255 126:11 154 110 77 255 123 88 61 255 77 55 38 255 61 44 30 255 126:12 169 91 51 255 135 72 40 255 84 45 25 255 67 36 20 255 126:13 61 39 18 255 48 31 14 255 30 19 9 255 24 15 7 255 127 145 80 30 131 116 64 24 131 72 40 15 131 58 32 12 131 128 216 209 157 255 172 167 125 255 108 104 78 255 86 83 62 255 129 109 128 116 255 87 102 92 255 54 64 58 255 43 51 46 255 130:2 20 31 32 199 16 24 25 199 10 15 16 199 8 12 12 199 130:3 20 31 32 199 16 24 25 199 10 15 16 199 8 12 12 199 130:4 34 49 44 195 27 39 35 195 17 24 22 195 13 19 17 195 130:5 16 28 32 195 12 22 25 195 8 14 16 195 6 11 12 195 131 122 122 122 255 97 97 97 255 61 61 61 255 48 48 48 255 133 81 217 117 255 64 173 93 255 40 108 58 255 32 86 46 255 134 103 77 46 255 82 61 36 255 51 38 23 255 41 30 18 255 135 195 179 123 255 156 143 98 255 97 89 61 255 78 71 49 255 136 154 110 77 255 123 88 61 255 77 55 38 255 61 44 30 255 137 178 137 111 255 142 109 88 255 89 68 55 255 71 54 44 255 138 218 240 244 70 174 192 195 70 109 120 122 70 87 96 97 70 139 122 122 122 255 97 97 97 255 61 61 61 255 48 48 48 255 139:1 103 121 103 255 82 96 82 255 51 60 51 255 41 48 41 255 140 118 65 51 49 94 52 40 49 59 32 25 49 47 26 20 49 141 1 171 16 9 0 136 12 9 0 85 8 9 0 68 6 9 141:2 1 187 15 23 0 149 12 23 0 93 7 23 0 74 6 23 141:3 1 187 15 23 0 149 12 23 0 93 7 23 0 74 6 23 141:4 0 190 16 54 0 152 12 54 0 95 8 54 0 76 6 54 141:5 0 190 16 54 0 152 12 54 0 95 8 54 0 76 6 54 141:6 0 190 16 54 0 152 12 54 0 95 8 54 0 76 6 54 141:7 21 128 2 111 16 102 1 111 10 64 1 111 8 51 0 111 142 1 171 16 9 0 136 12 9 0 85 8 9 0 68 6 9 142:2 1 187 15 23 0 149 12 23 0 93 7 23 0 74 6 23 142:3 1 187 15 23 0 149 12 23 0 93 7 23 0 74 6 23 142:4 0 190 16 54 0 152 12 54 0 95 8 54 0 76 6 54 142:5 0 190 16 54 0 152 12 54 0 95 8 54 0 76 6 54 142:6 0 190 16 54 0 152 12 54 0 95 8 54 0 76 6 54 142:7 34 170 36 105 27 136 28 105 17 85 18 105 13 68 14 105 143 156 127 78 255 124 101 62 255 78 63 39 255 62 50 31 255 145 64 64 64 255 51 51 51 255 32 32 32 255 25 25 25 255 146 118 87 39 199 94 69 31 199 59 43 19 199 47 34 15 199 146:1 118 87 38 195 94 69 30 195 59 43 19 195 47 34 15 195 146:2 119 87 39 199 95 69 31 199 59 43 19 199 47 34 15 199 146:3 119 88 42 195 95 70 33 195 59 44 21 195 47 35 16 195 146:5 123 89 37 209 98 71 29 209 61 44 18 209 49 35 14 209 146:6 119 87 39 199 95 69 31 199 59 43 19 199 47 34 15 199 146:7 126 92 41 209 100 73 32 209 63 46 20 209 50 36 16 209 146:9 125 91 38 209 100 72 30 209 62 45 19 209 50 36 15 209 146:10 119 87 39 199 95 69 31 199 59 43 19 199 47 34 15 199 146:11 122 89 38 209 97 71 30 209 61 44 19 209 48 35 15 209 147 249 236 78 255 199 188 62 255 124 118 39 255 99 94 31 255 148 219 219 219 255 175 175 175 255 109 109 109 255 87 87 87 255 149 125 125 125 255 100 100 100 255 62 62 62 255 50 50 50 255 150 125 125 125 255 100 100 100 255 62 62 62 255 50 50 50 255 151 66 55 35 255 52 44 28 255 33 27 17 255 26 22 14 255 152 171 27 9 255 136 21 7 255 85 13 4 255 68 10 3 255 153 125 84 79 255 100 67 63 255 62 42 39 255 50 33 31 255 154 62 62 62 255 49 49 49 255 31 31 31 255 24 24 24 255 155 236 233 226 255 188 186 180 255 118 116 113 255 94 93 90 255 155:1 231 228 220 255 184 182 176 255 115 114 110 255 92 91 88 255 155:2 231 227 219 255 184 181 175 255 115 113 109 255 92 90 87 255 155:3 232 229 221 255 185 183 176 255 116 114 110 255 92 91 88 255 155:4 231 227 219 255 184 181 175 255 115 113 109 255 92 90 87 255 156 236 233 226 255 188 186 180 255 118 116 113 255 94 93 90 255 157 104 83 71 155 83 66 56 155 52 41 35 155 41 33 28 155 157:8 141 81 70 155 112 64 56 155 70 40 35 155 56 32 28 155 157:9 141 81 70 155 112 64 56 155 70 40 35 155 56 32 28 155 157:10 141 81 70 155 112 64 56 155 70 40 35 155 56 32 28 155 157:11 141 81 70 155 112 64 56 155 70 40 35 155 56 32 28 155 157:12 141 81 70 155 112 64 56 155 70 40 35 155 56 32 28 155 157:13 141 81 70 155 112 64 56 155 70 40 35 155 56 32 28 155 158 96 96 96 255 76 76 76 255 48 48 48 255 38 38 38 255 158:2 113 113 113 255 90 90 90 255 56 56 56 255 45 45 45 255 158:3 113 113 113 255 90 90 90 255 56 56 56 255 45 45 45 255 158:4 116 116 116 255 92 92 92 255 58 58 58 255 46 46 46 255 158:5 113 113 113 255 90 90 90 255 56 56 56 255 45 45 45 255 159 209 178 161 255 167 142 128 255 104 89 80 255 83 71 64 255 159:1 161 83 37 255 128 66 29 255 80 41 18 255 64 33 14 255 159:2 149 88 108 255 119 70 86 255 74 44 54 255 59 35 43 255 159:3 113 108 137 255 90 86 109 255 56 54 68 255 45 43 54 255 159:4 186 133 35 255 148 106 28 255 93 66 17 255 74 53 14 255 159:5 103 117 52 255 82 93 41 255 51 58 26 255 41 46 20 255 159:6 161 78 78 255 128 62 62 255 80 39 39 255 64 31 31 255 159:7 57 42 35 255 45 33 28 255 28 21 17 255 22 16 14 255 159:8 135 106 97 255 108 84 77 255 67 53 48 255 54 42 38 255 159:9 86 91 91 255 68 72 72 255 43 45 45 255 34 36 36 255 159:10 118 70 86 255 94 56 68 255 59 35 43 255 47 28 34 255 159:11 74 59 91 255 59 47 72 255 37 29 45 255 29 23 36 255 159:12 77 51 35 255 61 40 28 255 38 25 17 255 30 20 14 255 159:13 76 83 42 255 60 66 33 255 38 41 21 255 30 33 16 255 159:14 143 61 46 255 114 48 36 255 71 30 23 255 57 24 18 255 159:15 37 22 16 255 29 17 12 255 18 11 8 255 14 8 6 255 160 255 255 255 123 204 204 204 123 127 127 127 123 102 102 102 123 160:1 216 127 51 123 172 101 40 123 108 63 25 123 86 50 20 123 160:2 178 76 216 123 142 60 172 123 89 38 108 123 71 30 86 123 160:3 102 153 216 123 81 122 172 123 51 76 108 123 40 61 86 123 160:4 229 229 51 123 183 183 40 123 114 114 25 123 91 91 20 123 160:5 127 204 25 123 101 163 20 123 63 102 12 123 50 81 10 123 160:6 242 127 165 123 193 101 132 123 121 63 82 123 96 50 66 123 160:7 76 76 76 123 60 60 60 123 38 38 38 123 30 30 30 123 160:8 153 153 153 123 122 122 122 123 76 76 76 123 61 61 61 123 160:9 76 127 153 123 60 101 122 123 38 63 76 123 30 50 61 123 160:10 127 63 178 123 101 50 142 123 63 31 89 123 50 25 71 123 160:11 51 76 178 123 40 60 142 123 25 38 89 123 20 30 71 123 160:12 102 76 51 123 81 60 40 123 51 38 25 123 40 30 20 123 160:13 102 127 51 123 81 101 40 123 51 63 25 123 40 50 20 123 160:14 153 51 51 123 122 40 40 123 76 25 25 123 61 20 20 123 160:15 25 25 25 123 20 20 20 123 12 12 12 123 10 10 10 123 161 66 88 28 154 52 70 22 154 33 44 14 154 26 35 11 154 162 105 99 89 255 84 79 71 255 52 49 44 255 42 39 35 255 162:1 45 28 12 255 36 22 9 255 22 14 6 255 18 11 4 255 162:4 154 91 64 255 123 72 51 255 77 45 32 255 61 36 25 255 162:5 104 81 48 255 83 64 38 255 52 40 24 255 41 32 19 255 162:9 45 28 12 255 36 22 9 255 22 14 6 255 18 11 4 255 162:13 45 28 12 255 36 22 9 255 22 14 6 255 18 11 4 255 163 169 91 51 255 135 72 40 255 84 45 25 255 67 36 20 255 164 61 39 18 255 48 31 14 255 30 19 9 255 24 15 7 255 170 157 116 18 255 125 92 14 255 78 58 9 255 62 46 7 255 171 221 221 221 255 176 176 176 255 110 110 110 255 88 88 88 255 171:1 219 125 62 255 175 100 49 255 109 62 31 255 87 50 24 255 171:2 179 80 188 255 143 64 150 255 89 40 94 255 71 32 75 255 171:3 106 138 201 255 84 110 160 255 53 69 100 255 42 55 80 255 171:4 177 166 39 255 141 132 31 255 88 83 19 255 70 66 15 255 171:5 65 174 56 255 52 139 44 255 32 87 28 255 26 69 22 255 171:6 208 132 153 255 166 105 122 255 104 66 76 255 83 52 61 255 171:7 64 64 64 255 51 51 51 255 32 32 32 255 25 25 25 255 171:8 154 161 161 255 123 128 128 255 77 80 80 255 61 64 64 255 171:9 46 110 137 255 36 88 109 255 23 55 68 255 18 44 54 255 171:10 126 61 181 255 100 48 144 255 63 30 90 255 50 24 72 255 171:11 46 56 141 255 36 44 112 255 23 28 70 255 18 22 56 255 171:12 79 50 31 255 63 40 24 255 39 25 15 255 31 20 12 255 171:13 53 70 27 255 42 56 21 255 26 35 13 255 21 28 10 255 171:14 150 52 48 255 120 41 38 255 75 26 24 255 60 20 19 255 171:15 25 22 22 255 20 17 17 255 12 11 11 255 10 8 8 255 172 150 92 66 255 120 73 52 255 75 46 33 255 60 36 26 255 173 18 18 18 255 14 14 14 255 9 9 9 255 7 7 7 255 174 165 194 245 255 132 155 196 255 82 97 122 255 66 77 98 255 175 65 109 43 51 52 87 34 51 32 54 21 51 26 43 17 51 175:1 142 148 132 86 113 118 105 86 71 74 66 86 56 59 52 86 175:2 72 89 44 138 57 71 35 138 36 44 22 138 28 35 17 138 175:3 72 90 45 158 57 72 36 158 36 45 22 158 28 36 18 158 175:4 69 64 3 185 55 51 2 185 34 32 1 185 27 25 1 185 175:5 54 88 59 147 43 70 47 147 27 44 29 147 21 35 23 147 175:8 67 111 45 26 53 88 36 26 33 55 22 26 26 44 18 26 175:9 148 148 140 83 118 118 112 83 74 74 70 83 59 59 56 83 175:10 76 94 47 92 60 75 37 92 38 47 23 92 30 37 18 92 175:11 74 91 46 122 59 72 36 122 37 45 23 122 29 36 18 122 175:12 115 61 7 107 92 48 5 107 57 30 3 107 46 24 2 107 175:13 132 133 141 129 105 106 112 129 66 66 70 129 52 53 56 129 178 106 109 112 255 84 87 89 255 53 54 56 255 42 43 44 255 179 166 85 29 255 132 68 23 255 83 42 14 255 66 34 11 255 180 165 84 29 255 132 67 23 255 82 42 14 255 66 33 11 255 181 166 85 29 255 132 68 23 255 83 42 14 255 66 34 11 255 182 166 85 29 255 132 68 23 255 83 42 14 255 66 34 11 255 183 103 77 46 255 82 61 36 255 51 38 23 255 41 30 18 255 184 195 179 123 255 156 143 98 255 97 89 61 255 78 71 49 255 185 154 110 77 255 123 88 61 255 77 55 38 255 61 44 30 255 186 61 39 18 255 48 31 14 255 30 19 9 255 24 15 7 255 187 169 91 51 255 135 72 40 255 84 45 25 255 67 36 20 255 188 103 77 46 255 82 61 36 255 51 38 23 255 41 30 18 255 189 195 179 123 255 156 143 98 255 97 89 61 255 78 71 49 255 190 154 110 77 255 123 88 61 255 77 55 38 255 61 44 30 255 191 61 39 18 255 48 31 14 255 30 19 9 255 24 15 7 255 192 169 91 51 255 135 72 40 255 84 45 25 255 67 36 20 255 193 96 74 49 255 76 59 39 255 48 37 24 255 38 29 19 255 194 217 210 179 255 173 168 143 255 108 105 89 255 86 84 71 255 195 151 113 85 207 120 90 68 207 75 56 42 207 60 45 34 207 196 161 93 58 183 128 74 46 183 80 46 29 183 64 37 23 183 197 69 47 25 255 55 37 20 255 34 23 12 255 27 18 10 255 Biome Mapping [RAINFOREST] 49 67 21 255 39 54 17 255 25 34 11 255 20 27 8 255 [SWAMPLAND] 64 128 0 255 51 102 0 255 32 64 0 255 26 51 0 255 [SEASONAL_FOREST] 51 165 42 255 41 132 34 255 26 83 21 255 20 66 17 255 [FOREST] 0 128 64 255 0 102 51 255 0 64 32 255 0 51 26 255 [SAVANNA] 58 58 58 255 46 46 46 255 29 29 29 255 23 23 23 255 [SHRUBLAND] 170 158 24 255 136 126 19 255 85 79 12 255 68 63 10 255 [TAIGA] 204 255 102 255 163 204 82 255 102 128 51 255 82 102 41 255 [DESERT] 255 255 102 255 204 204 82 255 128 128 51 255 102 102 41 255 [PLAINS] 255 204 102 255 204 163 82 255 128 102 51 255 102 82 41 255 [ICE_DESERT] 26 33 103 255 21 26 82 255 13 17 52 255 10 13 41 255 [TUNDRA] 222 222 222 255 178 178 178 255 111 111 111 255 89 89 89 255 [HELL] 255 0 0 255 204 0 0 255 128 0 0 255 102 0 0 255 [SKY] 102 204 255 255 82 163 204 255 51 102 128 255 41 82 102 255 [OCEAN] 0 0 255 255 0 0 204 255 0 0 128 255 0 0 102 255 [RIVER] 0 128 255 255 0 102 204 255 0 64 128 255 0 51 102 255 [EXTREME_HILLS] 128 64 0 255 102 51 0 255 64 32 0 255 51 26 0 255 [FROZEN_OCEAN] 102 255 204 255 82 204 163 255 51 128 102 255 41 102 82 255 [FROZEN_RIVER] 102 102 255 255 82 82 204 255 51 51 128 255 41 41 102 255 [ICE_PLAINS] 102 255 255 255 82 204 204 255 51 128 128 255 41 102 102 255 [ICE_MOUNTAINS] 255 255 255 255 204 204 204 255 128 128 128 255 102 102 102 255 [MUSHROOM_ISLAND] 255 111 207 255 204 89 166 255 128 56 104 255 102 44 83 255 [MUSHROOM_SHORE] 255 0 128 255 204 0 102 255 128 0 64 255 102 0 51 255 [BEACH] 255 206 75 255 230 185 68 255 255 206 75 255 179 144 53 255 [DESERT_HILLS] 255 146 51 255 230 131 46 255 255 146 51 255 179 102 36 255 [FOREST_HILLS] 0 162 100 255 0 146 90 255 0 162 100 255 0 113 70 255 [TAIGA_HILLS] 178 212 117 255 160 191 105 255 178 212 117 255 125 148 82 255 [SMALL_MOUNTAINS] 184 103 33 255 166 93 30 255 184 103 33 255 129 72 23 255 [JUNGLE] 49 67 21 255 39 54 17 255 25 34 11 255 20 27 8 255 [JUNGLE_HILLS] 33 44 14 255 26 36 12 255 16 22 7 255 13 18 6 255 Rainfall/Temperature Mapping [RAINFALL-0.0] 120 120 120 255 96 96 96 255 60 60 60 255 48 48 48 255 [RAINFALL-1.0] 38 92 255 255 30 73 204 255 19 46 127 255 15 36 102 255 [TEMPERATURE-0.0] 38 92 255 255 30 73 204 255 19 46 127 255 15 36 102 255 [TEMPERATURE-0.5] 91 121 185 255 73 96 147 255 46 61 92 255 36 48 73 255 [TEMPERATURE-0.8] 51 165 42 255 41 131 33 255 26 82 21 255 20 65 17 255 [TEMPERATURE-0.9] 170 158 24 255 135 126 19 255 85 79 12 255 67 62 10 255 [TEMPERATURE-0.95] 204 111 48 255 162 89 38 255 102 56 24 255 81 44 19 255 [TEMPERATURE-1.0] 143 39 36 255 114 31 28 255 71 20 18 255 57 16 14 255
{ "pile_set_name": "Github" }
/* * Copyright (C) 2015 Amarula Solutions B.V. * * This file is dual-licensed: you can use it either under the terms * of the GPL or the X11 license, at your option. Note that this dual * licensing only applies to this file, and not this project as a * whole. * * a) This file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This file 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. * * Or, alternatively * * b) 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 , 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. */ /dts-v1/; #include "imx6q.dtsi" #include "imx6qdl-icore-rqs.dtsi" / { model = "Engicam i.CoreM6 Quad/Dual RQS Starter Kit"; compatible = "engicam,imx6-icore-rqs", "fsl,imx6q"; };
{ "pile_set_name": "Github" }
/* * Copyright 2016- huaxz <[email protected]> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * 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/>. * * Author: [email protected] (huaxz) */ #ifndef ADJLISTGRAPH #define ADJLISTGRAPH #include<vector> #include<array> namespace IntroductionToAlgorithm { namespace GraphAlgorithm { //!ADJListGraph:图的邻接表表示,算法导论22章22.1节 /*! * 图的邻接表主要包含一个数据: * * - `array`:邻接表,类型为`std::array<std::vector<std::pair<VIDType,EWeightType>>,N> `,为`N`行,每一行代表一个节点: * * 为了便于计算,这里并不管理边和顶点,只是维护邻接表。边、顶点与邻接表的同步由使用者确保。 */ template<unsigned N> struct ADJListGraph { typedef int VIDType; /*!< 顶点编号的类型*/ typedef int EWeightType; /*!< 权重的类型*/ typedef std::tuple<VIDType,VIDType,EWeightType> EdgeTupleType; /*!< 边的三元素(顶点1编号,顶点2编号,权重)组成的元组*/ static const unsigned NUM=N; /*!< 顶点的最大容量*/ //!add_edge:添加一条边 /*! * \param edge_tuple:一条边的三元素元组 * * 为了便于计算,添加边时并不是添加`Edge`类型,而是`std::tuple<VIDType,VIDType,EWeightType>`类型的值。 * * 如果指定节点之间的边已经存在,则抛出`std::invalid_argument`异常 * > 要求边的顶点均在`[0,N)`这个半闭半开区间。如果任何一个值超过该区间则认为顶点`id`无效,直接返回而不作添加 */ void add_edge(const EdgeTupleType& edge_tuple) { auto id1=std::get<0>(edge_tuple); auto id2=std::get<1>(edge_tuple); auto wt=std::get<2>(edge_tuple); if(id1<0||id1>=N||id2<0||id2>=N) return; if(has_edge(id1,id2)) throw std::invalid_argument("edge add error,edge has already exist."); array.at(id1).push_back(std::make_pair(id2,wt)); } //!add_edges:添加一组边 /*! * \param begin:边容器的起始迭代器 * \param end:边容器的终止迭代器 * * 为了便于计算,添加边时并不是添加`Edge`类型,而是`std::tuple<VIDType,VIDType,EWeightType>`类型的值 * * 如果指定节点之间的边已经存在,则抛出`std::invalid_argument`异常 * > 要求边的顶点均在`[0,N)`这个半闭半开区间。如果任何一个值超过该区间则认为顶点`id`无效,直接返回而不作添加 */ template<typename Iteator> void add_edges(const Iteator&begin ,const Iteator&end) { if(std::distance(begin,end)<=0) return; auto iter=begin; while(iter!=end) { add_edge(*iter); iter++; } } //!adjust_edge:修改一条边的权重 /*! * \param id1:待修改边的第一个顶点 * \param id2:待修改边的第二个顶点 * \param wt:新的权重 * * 修改顶点`id1`和`id2`直接的边的权重为`wt`。如果指定结点之间的边不存在,则抛出`std::invalid_argument`异常。 * > 要求`id1`和`id2`均在`[0,N)`这个半闭半开区间。如果任何一个值超过该区间则认为顶点`id`无效,直接返回而不作权重修改 * */ void adjust_edge(VIDType id1,VIDType id2,EWeightType wt) { if(id1<0||id1>=N||id2<0||id2>=N) return; if(!has_edge(id1,id2)) throw std::invalid_argument("edge adjust error,edge does not exist."); auto& vec=array.at(id1); //这里必须用引用类型,因为要修改邻接表 for(auto& pair:vec) { if(pair.first==id2) { pair.second=wt; break; } } } //!edge_tuples:返回图中所有边的三元素元组集合,这里集合采用`std::vector<std::tuple<VIDType,VIDType,EWeightType>>` /*! * \return :图中所有边的三元素元组集合 * */ const std::vector<EdgeTupleType> edge_tuples() const { std::vector<EdgeTupleType> result; for(unsigned i=0;i<N;i++) for(const auto& pair:array.at(i)) { result.push_back(std::make_tuple(i,pair.first,pair.second)); } return result; } //!vertex_edge_tuples:返回图中从指定顶点出发的边的三元素元组集合,这里集合采用`std::vector<std::tuple<VIDType,VIDType,EWeightType>>` /*! * \param id: 指定顶点`id` * \return :图中指定顶点出发的边的三元素元组集合 * * - 如果指定的顶点`id`不在`[0,N)`之间,则无效 */ const std::vector<EdgeTupleType> vertex_edge_tuples(VIDType id) const { if(id<0||id>=N) { throw std::invalid_argument("vertex_edge_tuples: id must belongs [0,N),"); } std::vector<EdgeTupleType> result; for(const auto& pair:array.at(id)) { result.push_back(std::make_tuple(id,pair.first,pair.second)); } return result; } //!has_edge:返回图中指定顶点之间是否存在边 /*! * \param id_from: 第一个顶点的`id` * \param id_to: 第二个顶点的`id` * \return :第一个顶点和第二个顶点之间是否存在边 * * - 当`id_from`与`id_to`无效时,抛出异常 * >这里的无效值得是`id_from`、`id_to`不在区间`[0,N)`之间 * - 当`id_from`与`id_to`之间有边时,返回`true` * - 当`id_from`与`id_to`之间没有边时,返回`false` */ bool has_edge(VIDType id_from,VIDType id_to) const { if(id_from<0||id_from>=N||id_to<0||id_to>=N) { throw std::invalid_argument("has_edge: id_from and id _to must belongs [0,N),"); } const auto& vec=array.at(id_from); for(const auto& pair:vec) { if(pair.first==id_to) return true; } return false; } //!weight:返回图中指定顶点之间的边的权重 /*! * \param id_from: 第一个顶点的`id` * \param id_to: 第二个顶点的`id` * \return :第一个顶点和第二个顶点之间的边的权重 * * 当且仅当`id_from`与`id_to`之间存在边时返回该边的权重。其他情况下都会抛出`std::invalid_argument`异常 * * - 当`id_from`与`id_to`无效时,抛出异常 * >这里的无效值得是`id_from`、`id_to`不在区间`[0,N)`之间 * - 当`id_from`与`id_to`之间无边时,抛出异常 */ EWeightType weight(VIDType id_from,VIDType id_to) const { if(has_edge(id_from,id_to)) { const auto& vec=array.at(id_from); for(const auto& pair:vec) { if(pair.first==id_to) return pair.second; } }else { throw std::invalid_argument("weight error: the edge does not exist."); } } std::array<std::vector<std::pair<VIDType,EWeightType>>,N> array; /*!< 图的邻接表*/ }; } } #endif // ADJLISTGRAPH
{ "pile_set_name": "Github" }
1.0.5 * Added placeholder for textinput * Fixed a crasher when resizing a tab container * Icon can now be loaded from memory * Bitmap can be converted to icons using `Bitmap::copy_as_icon` * Systray pop up menu now closes when you click outside of them * Embedded image loading functions (`EmbedResource::image`, `EmbedResource::icon`, etc) have a new `size` parameter * 2 new events for menus * OnMenuEnter: Raised when a menu is shown on screen * OnMenuExit: Raised when a menu is closed by the user. Either by selecting an item or by clicking outside of it. 1.0.4 * Documentation fixes * Get parent item in tree view * Load any image from embed source * Set/Get listview background color * always show selected items in listview and treeview (even if the control does not have focus) 1.0.3 * A few bug fixes * Add the ability to move controls in a grid layout * Added the `OnMinMaxInfo` event to handle the min/max size of a window * Fixed the tab header height 1.0.2 * Fix carriage return in multiline textbox. 100% sure it was working but heh * Clipboard internal APi improvement by @DoumanAsh * Update some progress bar flags at runtime with `add_flags` and `remove_flags` * Modal message boxes 1.0.1 * A quickfix for the docs.rs documentation. 1.0.0 * Initial release
{ "pile_set_name": "Github" }
{ "_args": [ [ { "raw": "babel-plugin-transform-async-generator-functions@^6.22.0", "scope": null, "escapedName": "babel-plugin-transform-async-generator-functions", "name": "babel-plugin-transform-async-generator-functions", "rawSpec": "^6.22.0", "spec": ">=6.22.0 <7.0.0", "type": "range" }, "/Users/admin/Documents/codesmith/electron/my-electron-ex/lib/new-project-template/new-project/node_modules/babel-preset-stage-3" ] ], "_from": "babel-plugin-transform-async-generator-functions@>=6.22.0 <7.0.0", "_id": "[email protected]", "_inCache": true, "_location": "/babel-plugin-transform-async-generator-functions", "_nodeVersion": "6.9.0", "_npmOperationalInternal": { "host": "packages-12-west.internal.npmjs.com", "tmp": "tmp/babel-plugin-transform-async-generator-functions-6.22.0.tgz_1484872421876_0.9297375113237649" }, "_npmUser": { "name": "hzoo", "email": "[email protected]" }, "_npmVersion": "3.10.10", "_phantomChildren": {}, "_requested": { "raw": "babel-plugin-transform-async-generator-functions@^6.22.0", "scope": null, "escapedName": "babel-plugin-transform-async-generator-functions", "name": "babel-plugin-transform-async-generator-functions", "rawSpec": "^6.22.0", "spec": ">=6.22.0 <7.0.0", "type": "range" }, "_requiredBy": [ "/babel-preset-stage-3" ], "_resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.22.0.tgz", "_shasum": "a720a98153a7596f204099cd5409f4b3c05bab46", "_shrinkwrap": null, "_spec": "babel-plugin-transform-async-generator-functions@^6.22.0", "_where": "/Users/admin/Documents/codesmith/electron/my-electron-ex/lib/new-project-template/new-project/node_modules/babel-preset-stage-3", "dependencies": { "babel-helper-remap-async-to-generator": "^6.22.0", "babel-plugin-syntax-async-generators": "^6.5.0", "babel-runtime": "^6.22.0" }, "description": "Turn async generator functions into ES2015 generators", "devDependencies": { "babel-helper-plugin-test-runner": "^6.22.0" }, "directories": {}, "dist": { "shasum": "a720a98153a7596f204099cd5409f4b3c05bab46", "tarball": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.22.0.tgz" }, "keywords": [ "babel-plugin" ], "license": "MIT", "main": "lib/index.js", "maintainers": [ { "name": "hzoo", "email": "[email protected]" } ], "name": "babel-plugin-transform-async-generator-functions", "optionalDependencies": {}, "readme": "ERROR: No README data found!", "repository": { "type": "git", "url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-async-generator-functions" }, "scripts": {}, "version": "6.22.0" }
{ "pile_set_name": "Github" }
#include "LightDefs.hlsli" #include "LightingModel.hlsli" #include "EnvAmbient.hlsli" #include <ShadowsOld/Csm.hlsli> #include <Postprocess/PostprocessBase.hlsli> #include <GBuffer/GBuffer.hlsli> #include <VertexTransformations.hlsli>
{ "pile_set_name": "Github" }
#include <linux/mm.h> #include <linux/file.h> #include <linux/fdtable.h> #include <linux/fs_struct.h> #include <linux/mount.h> #include <linux/ptrace.h> #include <linux/slab.h> #include <linux/seq_file.h> #include "internal.h" /* * Logic: we've got two memory sums for each process, "shared", and * "non-shared". Shared memory may get counted more than once, for * each process that owns it. Non-shared memory is counted * accurately. */ void task_mem(struct seq_file *m, struct mm_struct *mm) { struct vm_area_struct *vma; struct vm_region *region; struct rb_node *p; unsigned long bytes = 0, sbytes = 0, slack = 0, size; down_read(&mm->mmap_sem); for (p = rb_first(&mm->mm_rb); p; p = rb_next(p)) { vma = rb_entry(p, struct vm_area_struct, vm_rb); bytes += kobjsize(vma); region = vma->vm_region; if (region) { size = kobjsize(region); size += region->vm_end - region->vm_start; } else { size = vma->vm_end - vma->vm_start; } if (atomic_read(&mm->mm_count) > 1 || vma->vm_flags & VM_MAYSHARE) { sbytes += size; } else { bytes += size; if (region) slack = region->vm_end - vma->vm_end; } } if (atomic_read(&mm->mm_count) > 1) sbytes += kobjsize(mm); else bytes += kobjsize(mm); if (current->fs && current->fs->users > 1) sbytes += kobjsize(current->fs); else bytes += kobjsize(current->fs); if (current->files && atomic_read(&current->files->count) > 1) sbytes += kobjsize(current->files); else bytes += kobjsize(current->files); if (current->sighand && atomic_read(&current->sighand->count) > 1) sbytes += kobjsize(current->sighand); else bytes += kobjsize(current->sighand); bytes += kobjsize(current); /* includes kernel stack */ seq_printf(m, "Mem:\t%8lu bytes\n" "Slack:\t%8lu bytes\n" "Shared:\t%8lu bytes\n", bytes, slack, sbytes); up_read(&mm->mmap_sem); } unsigned long task_vsize(struct mm_struct *mm) { struct vm_area_struct *vma; struct rb_node *p; unsigned long vsize = 0; down_read(&mm->mmap_sem); for (p = rb_first(&mm->mm_rb); p; p = rb_next(p)) { vma = rb_entry(p, struct vm_area_struct, vm_rb); vsize += vma->vm_end - vma->vm_start; } up_read(&mm->mmap_sem); return vsize; } unsigned long task_statm(struct mm_struct *mm, unsigned long *shared, unsigned long *text, unsigned long *data, unsigned long *resident) { struct vm_area_struct *vma; struct vm_region *region; struct rb_node *p; unsigned long size = kobjsize(mm); down_read(&mm->mmap_sem); for (p = rb_first(&mm->mm_rb); p; p = rb_next(p)) { vma = rb_entry(p, struct vm_area_struct, vm_rb); size += kobjsize(vma); region = vma->vm_region; if (region) { size += kobjsize(region); size += region->vm_end - region->vm_start; } } *text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) >> PAGE_SHIFT; *data = (PAGE_ALIGN(mm->start_stack) - (mm->start_data & PAGE_MASK)) >> PAGE_SHIFT; up_read(&mm->mmap_sem); size >>= PAGE_SHIFT; size += *text + *data; *resident = size; return size; } static void pad_len_spaces(struct seq_file *m, int len) { len = 25 + sizeof(void*) * 6 - len; if (len < 1) len = 1; seq_printf(m, "%*c", len, ' '); } /* * display a single VMA to a sequenced file */ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma, int is_pid) { struct mm_struct *mm = vma->vm_mm; struct proc_maps_private *priv = m->private; unsigned long ino = 0; struct file *file; dev_t dev = 0; int flags, len; unsigned long long pgoff = 0; flags = vma->vm_flags; file = vma->vm_file; if (file) { struct inode *inode = vma->vm_file->f_path.dentry->d_inode; dev = inode->i_sb->s_dev; ino = inode->i_ino; pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT; } seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n", vma->vm_start, vma->vm_end, flags & VM_READ ? 'r' : '-', flags & VM_WRITE ? 'w' : '-', flags & VM_EXEC ? 'x' : '-', flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p', pgoff, MAJOR(dev), MINOR(dev), ino, &len); if (file) { pad_len_spaces(m, len); seq_path(m, &file->f_path, ""); } else if (mm) { pid_t tid = vm_is_stack(priv->task, vma, is_pid); if (tid != 0) { pad_len_spaces(m, len); /* * Thread stack in /proc/PID/task/TID/maps or * the main process stack. */ if (!is_pid || (vma->vm_start <= mm->start_stack && vma->vm_end >= mm->start_stack)) seq_printf(m, "[stack]"); else seq_printf(m, "[stack:%d]", tid); } } seq_putc(m, '\n'); return 0; } /* * display mapping lines for a particular process's /proc/pid/maps */ static int show_map(struct seq_file *m, void *_p, int is_pid) { struct rb_node *p = _p; return nommu_vma_show(m, rb_entry(p, struct vm_area_struct, vm_rb), is_pid); } static int show_pid_map(struct seq_file *m, void *_p) { return show_map(m, _p, 1); } static int show_tid_map(struct seq_file *m, void *_p) { return show_map(m, _p, 0); } static void *m_start(struct seq_file *m, loff_t *pos) { struct proc_maps_private *priv = m->private; struct mm_struct *mm; struct rb_node *p; loff_t n = *pos; /* pin the task and mm whilst we play with them */ priv->task = get_pid_task(priv->pid, PIDTYPE_PID); if (!priv->task) return ERR_PTR(-ESRCH); mm = mm_for_maps(priv->task); if (!mm || IS_ERR(mm)) { put_task_struct(priv->task); priv->task = NULL; return mm; } down_read(&mm->mmap_sem); /* start from the Nth VMA */ for (p = rb_first(&mm->mm_rb); p; p = rb_next(p)) if (n-- == 0) return p; return NULL; } static void m_stop(struct seq_file *m, void *_vml) { struct proc_maps_private *priv = m->private; if (priv->task) { struct mm_struct *mm = priv->task->mm; up_read(&mm->mmap_sem); mmput(mm); put_task_struct(priv->task); } } static void *m_next(struct seq_file *m, void *_p, loff_t *pos) { struct rb_node *p = _p; (*pos)++; return p ? rb_next(p) : NULL; } static const struct seq_operations proc_pid_maps_ops = { .start = m_start, .next = m_next, .stop = m_stop, .show = show_pid_map }; static const struct seq_operations proc_tid_maps_ops = { .start = m_start, .next = m_next, .stop = m_stop, .show = show_tid_map }; static int maps_open(struct inode *inode, struct file *file, const struct seq_operations *ops) { struct proc_maps_private *priv; int ret = -ENOMEM; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (priv) { priv->pid = proc_pid(inode); ret = seq_open(file, ops); if (!ret) { struct seq_file *m = file->private_data; m->private = priv; } else { kfree(priv); } } return ret; } static int pid_maps_open(struct inode *inode, struct file *file) { return maps_open(inode, file, &proc_pid_maps_ops); } static int tid_maps_open(struct inode *inode, struct file *file) { return maps_open(inode, file, &proc_tid_maps_ops); } const struct file_operations proc_pid_maps_operations = { .open = pid_maps_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release_private, }; const struct file_operations proc_tid_maps_operations = { .open = tid_maps_open, .read = seq_read, .llseek = seq_lseek, .release = seq_release_private, };
{ "pile_set_name": "Github" }
<article id="post-0" class="<?php hybrid_entry_class(); ?>"> <header class="entry-header"> <h1 class="entry-title"><?php __( 'Nothing found', 'bearded' ); ?></h1> </header> <div class="entry-content"> <p><?php _e( 'Apologies, but no entries were found.', 'bearded' ); ?></p> </div><!-- .entry-content --> </article><!-- .hentry .error -->
{ "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. */ // +k8s:deepcopy-gen=package // +k8s:protobuf-gen=package // +k8s:openapi-gen=true package v1 // import "k8s.io/api/batch/v1"
{ "pile_set_name": "Github" }
// This file is part of CPAchecker, // a tool for configurable software verification: // https://cpachecker.sosy-lab.org // // SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org> // // SPDX-License-Identifier: Apache-2.0 #include <stdlib.h> #include <stdio.h> struct node { int* ptr; }; int main() { struct node f; struct node* tmp; int t = 3; int* ptr = &t; tmp = &f; tmp->ptr = ptr; if (*(f.ptr) != 3) { goto ERROR; } printf ("SAFE\n"); return 0; ERROR: printf ("UNSAFE\n"); ERROR2: goto ERROR2; return 1; }
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Jun 9 2015 22:53:21). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2014 by Steve Nygard. // #import <objc/NSObject.h> @class NSArray; @interface MBPortScanner : NSObject { NSArray *_interfaceArray; } - (void).cxx_destruct; - (id)nameAtIndex:(long long)arg1; - (id)portKindAtIndex:(long long)arg1; - (id)deviceAtIndex:(long long)arg1; @property(readonly) long long count; - (id)init; @end
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.18"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Games Task Scheduler (GTS): Member List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="custom.css" rel="stylesheet" type="text/css"/> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Games Task Scheduler (GTS) </div> <div id="projectbrief">A multi-processor scheduling framework for games engines</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.18 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('classgts_1_1_backoff.html',''); initResizable(); }); /* @license-end */ </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="headertitle"> <div class="title">gts::Backoff&lt; GROWTH_RATE, YIELD &gt; Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="classgts_1_1_backoff.html">gts::Backoff&lt; GROWTH_RATE, YIELD &gt;</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="classgts_1_1_backoff.html#a8f5b7f674fe1b3c9e7adeb764bc6f72d">reset</a>()</td><td class="entry"><a class="el" href="classgts_1_1_backoff.html">gts::Backoff&lt; GROWTH_RATE, YIELD &gt;</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr><td class="entry"><a class="el" href="classgts_1_1_backoff.html#a687c5538760f24f294844cc571040983">spinCount</a>() const</td><td class="entry"><a class="el" href="classgts_1_1_backoff.html">gts::Backoff&lt; GROWTH_RATE, YIELD &gt;</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classgts_1_1_backoff.html#a6a2fa4707f0d6a4b18fb72256000d336">tick</a>()</td><td class="entry"><a class="el" href="classgts_1_1_backoff.html">gts::Backoff&lt; GROWTH_RATE, YIELD &gt;</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> </table></div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.18 </li> </ul> </div> </body> </html>
{ "pile_set_name": "Github" }
require 'spec_helper' require 'ronin/campaign' describe Campaign do describe "targets?" do pending "needs specs" end describe "#target!" do pending "needs specs" end end
{ "pile_set_name": "Github" }
{ "name": "Kun the Forgotten King", "baseManaCost": 10, "type": "MINION", "baseAttack": 7, "baseHp": 7, "heroClass": "DRUID", "rarity": "LEGENDARY", "description": "Choose One - Gain 10 Armor; or Refresh your Mana Crystals.", "options": [ { "description": "Gain 10 Armor", "spell": { "class": "BuffHeroSpell", "target": "FRIENDLY_HERO", "armorBonus": 10 } }, { "description": "Refresh Mana", "spell": { "class": "GainManaSpell", "value": { "class": "AlgebraicValueProvider", "operation": "SUBTRACT", "value1": { "class": "PlayerAttributeValueProvider", "playerAttribute": "MAX_MANA" }, "value2": { "class": "PlayerAttributeValueProvider", "playerAttribute": "MANA" } } } } ], "bothOptions": { "description": "10 Armor and Refresh", "spell": { "class": "MetaSpell", "spells": [ { "class": "BuffHeroSpell", "target": "FRIENDLY_HERO", "armorBonus": 10 }, { "class": "GainManaSpell", "value": { "class": "AlgebraicValueProvider", "operation": "SUBTRACT", "value1": { "class": "PlayerAttributeValueProvider", "playerAttribute": "MAX_MANA" }, "value2": { "class": "PlayerAttributeValueProvider", "playerAttribute": "MANA" } } } ] } }, "collectible": true, "set": "MEAN_STREETS_OF_GADGETZAN", "fileFormatVersion": 1 }
{ "pile_set_name": "Github" }
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * @category Zend * @package Zend_Server * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ /** * Zend_Server_Reflection_ReturnValue */ require_once 'Zend/Server/Reflection/ReturnValue.php'; /** * Zend_Server_Reflection_Parameter */ require_once 'Zend/Server/Reflection/Parameter.php'; /** * Method/Function prototypes * * Contains accessors for the return value and all method arguments. * * @category Zend * @package Zend_Server * @subpackage Reflection * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Prototype.php 2504 2011-12-28 07:35:29Z liu21st $ */ class Zend_Server_Reflection_Prototype { /** * Constructor * * @param Zend_Server_Reflection_ReturnValue $return * @param array $params * @return void */ public function __construct(Zend_Server_Reflection_ReturnValue $return, $params = null) { $this->_return = $return; if (!is_array($params) && (null !== $params)) { require_once 'Zend/Server/Reflection/Exception.php'; throw new Zend_Server_Reflection_Exception('Invalid parameters'); } if (is_array($params)) { foreach ($params as $param) { if (!$param instanceof Zend_Server_Reflection_Parameter) { require_once 'Zend/Server/Reflection/Exception.php'; throw new Zend_Server_Reflection_Exception('One or more params are invalid'); } } } $this->_params = $params; } /** * Retrieve return type * * @return string */ public function getReturnType() { return $this->_return->getType(); } /** * Retrieve the return value object * * @access public * @return Zend_Server_Reflection_ReturnValue */ public function getReturnValue() { return $this->_return; } /** * Retrieve method parameters * * @return array Array of {@link Zend_Server_Reflection_Parameter}s */ public function getParameters() { return $this->_params; } }
{ "pile_set_name": "Github" }
## 一个笑话 - { 第2018-10-31期 } </hr> ### :jack_o_lantern: { 第1档 } 二到没治了 第一次去学校医院是因为发烧,医生大妈二话不说递给我一根体温计,我也二话不说就含在了嘴里……<br/><br/>  大妈看了我一眼,温柔地说道:“腋下。”<br/><br/>  我想了想,还是听话地叫了声:“耶!” ### :jack_o_lantern: { 第2档 } 毕竟游戏和命比起来 A:如果你在玩游戏女朋友给你打电话,让你陪他逛街,你会去吗?<br/><br/>  B:这还问吗,肯定会毫不犹豫的退游戏。<br/><br/>  A:你这种人不多了啊!<br/><br/>  B:是的,毕竟游戏和命比起来,肯定后者重要。<br/><br/>  A:。。。 ### :jack_o_lantern: { 第3档 } 两种女同事不能得罪 作为体制内的一员,刚入职前辈就告诉我,两种女同事不能得罪,一是长得漂亮的,背后有很厉害的干爹;一种是长得难看的,背后有很厉害的亲爹。 ### :jack_o_lantern: { 第4档 } 好儿子爸爸没白疼你 三岁的儿子从幼儿园回来气呼呼的对我说:“爸爸,老师一点都不好,总是凶我,中午还不拍拍我睡觉。”<br/><br/>  我:“老师不可能像妈妈一样照顾那么多人的,你要听话。”<br/><br/>  儿子:“让老师和妈妈换换就好了,妈妈每天在幼儿园陪我,老师在家陪爸爸睡觉。”<br/><br/>  想想竟然有点激动呢。 ### :jack_o_lantern: { 第5档 } 高中那会和学霸处对象 高中那会和学霸处对象,被班任找了家长,为了守住这份爱情,我们决定私奔,结果在约定地点,我等了大半夜,也没见人来,又冷又饿,就跑回家了,被老爸揍了一顿,第二天气呼呼的质问女友,女友弱弱的对我说“晚上学习太投入忘了!忘了!!!”然后这朵爱情小花,还没有绽放,就枯萎了!!! ### :jack_o_lantern: { 第6档 } 好伟大的梦 老师课上提问,问到一男孩,“你长大后要干什么”<br/><br/>  小男孩说:“我以后要当女浴室的一名搓澡工。”<br/><br/>  正当老师惊叹之余,男孩接着说:“这样我妈妈就不用那么辛苦了!” ### :jack_o_lantern: { 第7档 } 这天气简直是女人的天敌 妹子我仔细认真的化了一个多小时的妆,出门一分钟就变成素颜了。 ### :jack_o_lantern: { 第8档 } 太气人了 刚才走路上,看见地上有张纸片,像是100块钱,赶紧捡起来看了看背面,竟然没有包小姐的电话,就是真正的100块钱,太气人了! ### :jack_o_lantern: { 第9档 } 我不止是只单身狗 快七夕了,突然发现我不只是一只单身狗,而且还是只流浪狗。 ### :jack_o_lantern: { 第10档 } 姐弟斗智斗勇 中午,表弟来我家,我正好炖了一锅排骨,又往排骨汤里煮了一些手擀面<br/><br/>  我拿起一只大碗对表弟说:“你年轻,饭量大,我给你多盛点儿面。”<br/><br/>  表弟听了,忙冲我摆手说:“姐,我吃不了那么多面,你给我多盛点儿排骨就行了。” ### :jack_o_lantern: { 第11档 } 七月七怎么了? 七夕那天,女友给他提醒今天是七月七。<br/><br/>  他说:“七月七怎么了?”<br/><br/>  女友再给他提醒有座桥,他才恍然大悟说了句:“原来今天是七七卢沟桥事变啊!” ### :jack_o_lantern: { 第12档 } 我受够了!我要离婚! 老公气愤地喊道:“你整天这样骂人,我受够了!我要离婚!我要再找一个!”<br/><br/>  老婆鄙夷说道:“就你这样,再找就不会挨骂了?”<br/><br/>  老公没好气回道:“挨骂就挨骂,至少能听点新鲜的!” ### :jack_o_lantern: { 第13档 } 一个月才赚两千 一个月才赚两千,感觉生活好没自信啊;<br/><br/>  那你试试加个万字;<br/><br/>  我一万个月才赚两千。。。。。; ### :jack_o_lantern: { 第14档 } 你们什?么时侯能捐我点啊! 钱这个东西,真是害人精。<br/><br/>  小到人与人之间的矛盾,大到国家之间的战争,无不是为了钱。<br/><br/>  钱可以把人推上万众瞩目之颠,也可以使人瞬间变成阶下囚。<br/><br/>  可是,富人们却没认识到,当钱几辈子花不完时,<br/><br/>  挣再多已经没有意义,还不如早日尽点社会责任,<br/><br/>  捐助给需要的人,求得个平安幸福。<br/><br/>  看到这个的有钱人们呐,你们什?么时侯能捐我点啊! ### :jack_o_lantern: { 第15档 } 有花也有草 慎重告诉大家一个秘密,如果有个美女加你好友,找你聊天,一定要注意,那怕她远在几个城市,说不定就是你女朋友的朋友在外地帮忙试探你——哎,城市套路深,我要回农村,农村环境好,有花也有草! ### :jack_o_lantern: { 第16档 } 都要出差 男孩:叔叔,你找我妈有事吗?<br/><br/>  叔叔:哦,你告诉你妈一声,就说我老婆出差了!<br/><br/>  男孩:你老婆出差干嘛要告诉我妈呀?<br/><br/>  叔叔:你妈知道的……&再说小孩子别管大人的事!<br/><br/>  男孩:艹,我能不管吗!昨天你老婆跟我爸说你出差了,结果我老爸跟妈说也要出差……现在你又来说你老婆出差了,那是不是我老妈也要出差呀……让我一个人留在家谁给我做饭啊!<br/><br/>  叔叔:……… ### :jack_o_lantern: { 第17档 } 刚才朋友还我钱 刚才朋友还我钱,在微信问我往哪打,我就发了电话号码给他。本来想说手机号就是微信和支付宝,那个都行。后面一串字没打完发出,10086发来短信“500元充值成功” ### :jack_o_lantern: { 第18档 } 去森林公园玩 上个周末和朋友们去森林公园玩,步行途中肚子忽然疼得厉害,于是跑到树林里拉S。<br/><br/>  拉完以后才知道纸忘记带了,于是打电话给我朋友,让他给送点纸来。<br/><br/>  朋友嫌麻烦就说:这到处都是树叶,你就摘几片应付下不就完了?<br/><br/>  我火了,怒道:尼马这里是松树林。。。 ### :jack_o_lantern: { 第19档 } 你说我这样能干什么工作? 问:“我这人脾气很犟,别人说什么我都听不进去,没人能要求我做事情,总是自己想怎么做就怎么做,你说我这样能干什么工作?”<br/><br/>  答:“适合干理发师!” ### :jack_o_lantern: { 第20档 } 短的边上那根! 拿着两根差不多长短的吸管问3岁半的女儿:“宝贝,你看这两根吸管,哪一根更长?”<br/><br/>  女儿撇了一眼道:“短的边上那根!”
{ "pile_set_name": "Github" }
// license:BSD-3-Clause // copyright-holders:Mariusz Wojcieszek /* Photon IK-3 system Driver by Mariusz Wojcieszek Russian arcade system based on ZX Spectrum home computer clone "Leningrad-1". Changes are: - ROM bank switching added - original IO addressing replaced by: A7 A0 0 0 ROM bank switch 0 1 i8255 1 0 standard ZX FEh port (beeper, border color) 1 1 nothing - added i8255, uses A5 and A6 to select ports, usage are: PortA - joystick PortB - joystick (unused) PortC - bit 0 - Coin in, 1-3 - Time per Coin switches, 4 - block Coin in (out), 5 - NMI (out) Each coin buys you 1-6 minutes of game time. */ #include "emu.h" #include "cpu/z80/z80.h" #include "machine/timer.h" #include "sound/spkrdev.h" #include "emupal.h" #include "screen.h" #include "speaker.h" class photon2_state : public driver_device { public: photon2_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this,"maincpu"), m_speaker(*this, "speaker"), m_spectrum_video_ram(*this, "spectrum_vram") { } void photon2(machine_config &config); protected: virtual void machine_start() override; virtual void video_start() override; private: required_device<cpu_device> m_maincpu; required_device<speaker_sound_device> m_speaker; required_shared_ptr<uint8_t> m_spectrum_video_ram; int m_spectrum_frame_number; int m_spectrum_flash_invert; uint8_t m_spectrum_port_fe; uint8_t m_nmi_enable; void membank_w(uint8_t data); uint8_t fe_r(); void fe_w(uint8_t data); void misc_w(uint8_t data); void photon2_palette(palette_device &palette) const; uint32_t screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_spectrum); TIMER_DEVICE_CALLBACK_MEMBER(spec_interrupt_hack); void spectrum_io(address_map &map); void spectrum_mem(address_map &map); }; /************************************* * * Video (copied from MESS apart from support * for changing border color mid-frame) * *************************************/ /* Spectrum screen size in pixels */ #define SPEC_UNSEEN_LINES 16 /* Non-visible scanlines before first border line. Some of these may be vertical retrace. */ #define SPEC_TOP_BORDER 48 /* Number of border lines before actual screen */ #define SPEC_DISPLAY_YSIZE 192 /* Vertical screen resolution */ #define SPEC_BOTTOM_BORDER 56 /* Number of border lines at bottom of screen */ #define SPEC_SCREEN_HEIGHT (SPEC_TOP_BORDER + SPEC_DISPLAY_YSIZE + SPEC_BOTTOM_BORDER) #define SPEC_LEFT_BORDER 48 /* Number of left hand border pixels */ #define SPEC_DISPLAY_XSIZE 256 /* Horizontal screen resolution */ #define SPEC_RIGHT_BORDER 48 /* Number of right hand border pixels */ #define SPEC_SCREEN_WIDTH (SPEC_LEFT_BORDER + SPEC_DISPLAY_XSIZE + SPEC_RIGHT_BORDER) #define SPEC_LEFT_BORDER_CYCLES 24 /* Cycles to display left hand border */ #define SPEC_DISPLAY_XSIZE_CYCLES 128 /* Horizontal screen resolution */ #define SPEC_RIGHT_BORDER_CYCLES 24 /* Cycles to display right hand border */ #define SPEC_RETRACE_CYCLES 48 /* Cycles taken for horizonal retrace */ #define SPEC_CYCLES_PER_LINE 224 /* Number of cycles to display a single line */ static constexpr rgb_t spectrum_palette[16] = { rgb_t(0x00, 0x00, 0x00), rgb_t(0x00, 0x00, 0xbf), rgb_t(0xbf, 0x00, 0x00), rgb_t(0xbf, 0x00, 0xbf), rgb_t(0x00, 0xbf, 0x00), rgb_t(0x00, 0xbf, 0xbf), rgb_t(0xbf, 0xbf, 0x00), rgb_t(0xbf, 0xbf, 0xbf), rgb_t(0x00, 0x00, 0x00), rgb_t(0x00, 0x00, 0xff), rgb_t(0xff, 0x00, 0x00), rgb_t(0xff, 0x00, 0xff), rgb_t(0x00, 0xff, 0x00), rgb_t(0x00, 0xff, 0xff), rgb_t(0xff, 0xff, 0x00), rgb_t(0xff, 0xff, 0xff) }; // Initialise the palette void photon2_state::photon2_palette(palette_device &palette) const { palette.set_pen_colors(0, spectrum_palette); } void photon2_state::video_start() { m_spectrum_frame_number = 0; m_spectrum_flash_invert = 0; save_item(NAME(m_spectrum_frame_number)); save_item(NAME(m_spectrum_flash_invert)); save_item(NAME(m_spectrum_port_fe)); } #if 0 /* return the color to be used inverting FLASHing colors if necessary */ static inline unsigned char get_display_color (unsigned char color, int invert) { if (invert && (color & 0x80)) return (color & 0xc0) + ((color & 0x38) >> 3) + ((color & 0x07) << 3); else return color; } #endif /* Code to change the FLASH status every 25 frames. Note this must be independent of frame skip etc. */ WRITE_LINE_MEMBER(photon2_state::screen_vblank_spectrum) { // rising edge if (state) { m_spectrum_frame_number++; if (m_spectrum_frame_number >= 25) { m_spectrum_frame_number = 0; m_spectrum_flash_invert = !m_spectrum_flash_invert; } } } static inline void spectrum_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color) { bitmap.pix(y, x) = (uint16_t)color; } uint32_t photon2_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* for now do a full-refresh */ // int full_refresh = 1; unsigned char const *scr=m_spectrum_video_ram; bitmap.fill(m_spectrum_port_fe & 0x07, cliprect); for (int y=0; y<192; y++) { int scrx=SPEC_LEFT_BORDER; int scry=((y&7) * 8) + ((y&0x38)>>3) + (y&0xC0); unsigned char const *attr=m_spectrum_video_ram + ((scry>>3)*32) + 0x1800; for (int x=0;x<32;x++) { /* Get ink and paper colour with bright */ unsigned short ink, pap; if (m_spectrum_flash_invert && (*attr & 0x80)) { ink=((*attr)>>3) & 0x0f; pap=((*attr) & 0x07) + (((*attr)>>3) & 0x08); } else { ink=((*attr) & 0x07) + (((*attr)>>3) & 0x08); pap=((*attr)>>3) & 0x0f; } for (int b=0x80;b!=0;b>>=1) { if (*scr&b) spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,ink); else spectrum_plot_pixel(bitmap,scrx++,SPEC_TOP_BORDER+scry,pap); } scr++; attr++; } } return 0; } /************************************* * * I/O - memory banking, sound * *************************************/ void photon2_state::membank_w(uint8_t data) { int bank = 0; if (data == 0) { bank = 0; } else if (data == 1) { bank = 1; } else if (data == 5) { bank = 2; } else { logerror( "Unknown banking write: %02X\n", data); } membank("mainbank")->set_entry(bank); } uint8_t photon2_state::fe_r() { return 0xff; } void photon2_state::fe_w(uint8_t data) { m_spectrum_port_fe = data; m_speaker->level_w(BIT(data,4)); } void photon2_state::misc_w(uint8_t data) { m_nmi_enable = !BIT(data,5); } /************************************* * * Memory maps * *************************************/ void photon2_state::spectrum_mem(address_map &map) { map(0x0000, 0x3fff).bankr("mainbank"); map(0x4000, 0x5aff).ram().share("spectrum_vram"); map(0x5b00, 0xffff).ram(); } void photon2_state::spectrum_io(address_map &map) { map.global_mask(0xff); map(0x1f, 0x1f).portr("JOY"); map(0x5b, 0x5b).portr("COIN").w(FUNC(photon2_state::misc_w)); map(0x7a, 0x7a).w(FUNC(photon2_state::membank_w)); map(0x7b, 0x7b).nopw(); // unknown write map(0x7e, 0x7e).w(FUNC(photon2_state::membank_w)); map(0xfe, 0xfe).rw(FUNC(photon2_state::fe_r), FUNC(photon2_state::fe_w)); } /************************************* * * Inputs * *************************************/ static INPUT_PORTS_START( photon2 ) PORT_START("JOY") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_PLAYER(1) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) PORT_START("COIN") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN1) PORT_PLAYER(1) PORT_IMPULSE(1) PORT_DIPNAME( 0x0e, 0x0e, "Time per Coin" ) PORT_DIPSETTING( 0x00, "1:00" ) PORT_DIPSETTING( 0x02, "1:30" ) PORT_DIPSETTING( 0x04, "2:00" ) PORT_DIPSETTING( 0x06, "2:30" ) PORT_DIPSETTING( 0x08, "3:00" ) PORT_DIPSETTING( 0x0a, "4:00" ) PORT_DIPSETTING( 0x0c, "5:00" ) PORT_DIPSETTING( 0x0e, "6:00" ) // todo: check if these are really unused.. PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) INPUT_PORTS_END static INPUT_PORTS_START( black ) PORT_INCLUDE( photon2 ) PORT_MODIFY("JOY") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) INPUT_PORTS_END /************************************* * * Machine * *************************************/ TIMER_DEVICE_CALLBACK_MEMBER(photon2_state::spec_interrupt_hack) { int scanline = param; if (scanline == SPEC_SCREEN_HEIGHT/2) { m_maincpu->set_input_line(0, HOLD_LINE); } else if(scanline == 0) { if ( m_nmi_enable ) { m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); } } } void photon2_state::machine_start() { membank("mainbank")->configure_entries(0, 4, memregion("maincpu")->base(), 0x4000); membank("mainbank")->set_entry(0); save_item(NAME(m_nmi_enable)); } void photon2_state::photon2(machine_config &config) { /* basic machine hardware */ Z80(config, m_maincpu, 3500000); /* 3.5 MHz */ m_maincpu->set_addrmap(AS_PROGRAM, &photon2_state::spectrum_mem); m_maincpu->set_addrmap(AS_IO, &photon2_state::spectrum_io); TIMER(config, "scantimer").configure_scanline(FUNC(photon2_state::spec_interrupt_hack), "screen", 0, 1); /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(50.08); screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ screen.set_size(SPEC_SCREEN_WIDTH, SPEC_SCREEN_HEIGHT); screen.set_visarea(0, SPEC_SCREEN_WIDTH-1, 0, SPEC_SCREEN_HEIGHT-1); screen.set_screen_update(FUNC(photon2_state::screen_update_spectrum)); screen.screen_vblank().set(FUNC(photon2_state::screen_vblank_spectrum)); screen.set_palette("palette"); PALETTE(config, "palette", FUNC(photon2_state::photon2_palette), 16); /* sound hardware */ SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50); } /************************************* * * Globals * *************************************/ ROM_START( kok ) ROM_REGION( 0x20000, "maincpu", 0 ) ROM_LOAD( "kok00.bin", 0x0000, 0x2000, CRC(ff790d0b) SHA1(26dce26e43c15fd90d99abf25a86ca55ed13de94) ) ROM_LOAD( "kok01.bin", 0x2000, 0x2000, CRC(bf81811e) SHA1(26f073e49f126a70008256ea74394fbf11649503) ) ROM_LOAD( "kok10.bin", 0x4000, 0x2000, CRC(73fc7b92) SHA1(226abcb40aa3b8cfa96bc4ac89ba62b79ee79b2a) ) ROM_LOAD( "kok11.bin", 0x6000, 0x2000, CRC(7de0f54a) SHA1(3ee73f8e133ff3356e0ee8d1918b99d66f5ba53f) ) ROM_END ROM_START( black ) ROM_REGION( 0x20000, "maincpu", 0 ) ROM_LOAD( "black1.bin", 0x0000, 0x2000, CRC(8b02b314) SHA1(2e2de2b21634538515d4d6ca0930c4e3e5d1e80f) ) ROM_LOAD( "black2.bin", 0x2000, 0x2000, CRC(ed93469a) SHA1(5e23da3f649f5e20f7c8450bfa5d7d0b190f892c) ) ROM_LOAD( "black5.bin", 0x4000, 0x2000, CRC(f7c0baf5) SHA1(0d0a6f8b7f9bf65be61c8c78270a8c6e60fa3fe9) ) ROM_LOAD( "black6.bin", 0x6000, 0x2000, CRC(1f60bc18) SHA1(fd1a902c51e01dfc6fa42dac94d25566ce5bb3d7) ) ROM_LOAD( "black3.bin", 0x8000, 0x2000, CRC(784ea7f4) SHA1(f3008ad180ad14e0728bf0ba78fe85302ef2ff85) ) ROM_LOAD( "black4.bin", 0xa000, 0x2000, CRC(20281f74) SHA1(83df590e21a44fa07d4bc76818a8d0d0c4de42b3) ) ROM_END ROM_START( brod ) ROM_REGION( 0x20000, "maincpu", 0 ) ROM_LOAD( "brod00.bin", 0x0000, 0x2000, CRC(cbd6653f) SHA1(18b9134529a1e56c6e90f3bcef5102d5d4b352e3) ) ROM_FILL( 0x2000, 0x2000, 0x00 ) ROM_LOAD( "brod10.bin", 0x4000, 0x2000, CRC(9c25d44a) SHA1(f78c7e5b4e6f9fe34f81dc574ca335f70b61e68d) ) ROM_LOAD( "brod11.bin", 0x6000, 0x2000, CRC(f6505a16) SHA1(3b2ccca78fd83855003cc752766df83b19f89364) ) ROM_LOAD( "brod12.bin", 0x8000, 0x2000, CRC(94e53d47) SHA1(698415c5e25528e3b1dcab7471cc98c1dc9cb335) ) ROM_LOAD( "brod13.bin", 0xa000, 0x2000, CRC(1177cd17) SHA1(58c5c09a7b857ce6311339c4d0f4d8c1a7e232a3) ) ROM_END GAME( 19??, kok, 0, photon2, photon2, photon2_state, empty_init, ROT0, "bootleg", "Povar / Sobrat' Buran / Agroprom (Arcade multi-game bootleg of ZX Spectrum 'Cookie', 'Jetpac' & 'Pssst')", MACHINE_SUPPORTS_SAVE ) // originals (c)1983 ACG / Ultimate GAME( 19??, black, 0, photon2, black, photon2_state, empty_init, ROT0, "bootleg", "Czernyj Korabl (Arcade bootleg of ZX Spectrum 'Blackbeard')", MACHINE_SUPPORTS_SAVE ) // original (c)1988 Toposoft GAME( 19??, brod, 0, photon2, black, photon2_state, empty_init, ROT0, "bootleg", "Brodjaga (Arcade bootleg of ZX Spectrum 'Inspector Gadget and the Circus of Fear')", MACHINE_SUPPORTS_SAVE ) // original (c)1987 BEAM software
{ "pile_set_name": "Github" }
import { browser, by, element } from 'protractor'; export class AppPage { navigateTo() { return browser.get('/'); } getTitleText() { return element(by.css('app-root h1')).getText(); } }
{ "pile_set_name": "Github" }
/* Flot plugin for adding the ability to pan and zoom the plot. Copyright (c) 2007-2013 IOLA and Ole Laursen. Licensed under the MIT license. The default behaviour is double click and scrollwheel up/down to zoom in, drag to pan. The plugin defines plot.zoom({ center }), plot.zoomOut() and plot.pan( offset ) so you easily can add custom controls. It also fires "plotpan" and "plotzoom" events, useful for synchronizing plots. The plugin supports these options: zoom: { interactive: false trigger: "dblclick" // or "click" for single click amount: 1.5 // 2 = 200% (zoom in), 0.5 = 50% (zoom out) } pan: { interactive: false cursor: "move" // CSS mouse cursor value used when dragging, e.g. "pointer" frameRate: 20 } xaxis, yaxis, x2axis, y2axis: { zoomRange: null // or [ number, number ] (min range, max range) or false panRange: null // or [ number, number ] (min, max) or false } "interactive" enables the built-in drag/click behaviour. If you enable interactive for pan, then you'll have a basic plot that supports moving around; the same for zoom. "amount" specifies the default amount to zoom in (so 1.5 = 150%) relative to the current viewport. "cursor" is a standard CSS mouse cursor string used for visual feedback to the user when dragging. "frameRate" specifies the maximum number of times per second the plot will update itself while the user is panning around on it (set to null to disable intermediate pans, the plot will then not update until the mouse button is released). "zoomRange" is the interval in which zooming can happen, e.g. with zoomRange: [1, 100] the zoom will never scale the axis so that the difference between min and max is smaller than 1 or larger than 100. You can set either end to null to ignore, e.g. [1, null]. If you set zoomRange to false, zooming on that axis will be disabled. "panRange" confines the panning to stay within a range, e.g. with panRange: [-10, 20] panning stops at -10 in one end and at 20 in the other. Either can be null, e.g. [-10, null]. If you set panRange to false, panning on that axis will be disabled. Example API usage: plot = $.plot(...); // zoom default amount in on the pixel ( 10, 20 ) plot.zoom({ center: { left: 10, top: 20 } }); // zoom out again plot.zoomOut({ center: { left: 10, top: 20 } }); // zoom 200% in on the pixel (10, 20) plot.zoom({ amount: 2, center: { left: 10, top: 20 } }); // pan 100 pixels to the left and 20 down plot.pan({ left: -100, top: 20 }) Here, "center" specifies where the center of the zooming should happen. Note that this is defined in pixel space, not the space of the data points (you can use the p2c helpers on the axes in Flot to help you convert between these). "amount" is the amount to zoom the viewport relative to the current range, so 1 is 100% (i.e. no change), 1.5 is 150% (zoom in), 0.7 is 70% (zoom out). You can set the default in the options. */ // First two dependencies, jquery.event.drag.js and // jquery.mousewheel.js, we put them inline here to save people the // effort of downloading them. /* jquery.event.drag.js ~ v1.5 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com) Licensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt */ (function(a){function e(h){var k,j=this,l=h.data||{};if(l.elem)j=h.dragTarget=l.elem,h.dragProxy=d.proxy||j,h.cursorOffsetX=l.pageX-l.left,h.cursorOffsetY=l.pageY-l.top,h.offsetX=h.pageX-h.cursorOffsetX,h.offsetY=h.pageY-h.cursorOffsetY;else if(d.dragging||l.which>0&&h.which!=l.which||a(h.target).is(l.not))return;switch(h.type){case"mousedown":return a.extend(l,a(j).offset(),{elem:j,target:h.target,pageX:h.pageX,pageY:h.pageY}),b.add(document,"mousemove mouseup",e,l),i(j,!1),d.dragging=null,!1;case!d.dragging&&"mousemove":if(g(h.pageX-l.pageX)+g(h.pageY-l.pageY)<l.distance)break;h.target=l.target,k=f(h,"dragstart",j),k!==!1&&(d.dragging=j,d.proxy=h.dragProxy=a(k||j)[0]);case"mousemove":if(d.dragging){if(k=f(h,"drag",j),c.drop&&(c.drop.allowed=k!==!1,c.drop.handler(h)),k!==!1)break;h.type="mouseup"}case"mouseup":b.remove(document,"mousemove mouseup",e),d.dragging&&(c.drop&&c.drop.handler(h),f(h,"dragend",j)),i(j,!0),d.dragging=d.proxy=l.elem=!1}return!0}function f(b,c,d){b.type=c;var e=a.event.dispatch.call(d,b);return e===!1?!1:e||b.result}function g(a){return Math.pow(a,2)}function h(){return d.dragging===!1}function i(a,b){a&&(a.unselectable=b?"off":"on",a.onselectstart=function(){return b},a.style&&(a.style.MozUserSelect=b?"":"none"))}a.fn.drag=function(a,b,c){return b&&this.bind("dragstart",a),c&&this.bind("dragend",c),a?this.bind("drag",b?b:a):this.trigger("drag")};var b=a.event,c=b.special,d=c.drag={not:":input",distance:0,which:1,dragging:!1,setup:function(c){c=a.extend({distance:d.distance,which:d.which,not:d.not},c||{}),c.distance=g(c.distance),b.add(this,"mousedown",e,c),this.attachEvent&&this.attachEvent("ondragstart",h)},teardown:function(){b.remove(this,"mousedown",e),this===d.dragging&&(d.dragging=d.proxy=!1),i(this,!0),this.detachEvent&&this.detachEvent("ondragstart",h)}};c.dragstart=c.dragend={setup:function(){},teardown:function(){}}})(jQuery); /* jquery.mousewheel.min.js * Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) * Licensed under the MIT License (LICENSE.txt). * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. * Thanks to: Seamus Leahy for adding deltaX and deltaY * * Version: 3.0.6 * * Requires: 1.2.2+ */ (function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;void 0!==b.axis&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);void 0!==b.wheelDeltaY&&(g=b.wheelDeltaY/120);void 0!==b.wheelDeltaX&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]=d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,!1);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,!1);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery); (function ($) { var options = { xaxis: { zoomRange: null, // or [number, number] (min range, max range) panRange: null // or [number, number] (min, max) }, zoom: { interactive: false, trigger: "dblclick", // or "click" for single click amount: 1.5 // how much to zoom relative to current position, 2 = 200% (zoom in), 0.5 = 50% (zoom out) }, pan: { interactive: false, cursor: "move", frameRate: 20 } }; function init(plot) { function onZoomClick(e, zoomOut) { var c = plot.offset(); c.left = e.pageX - c.left; c.top = e.pageY - c.top; if (zoomOut) plot.zoomOut({ center: c }); else plot.zoom({ center: c }); } function onMouseWheel(e, delta) { onZoomClick(e, delta < 0); return false; } var prevCursor = 'default', prevPageX = 0, prevPageY = 0, panTimeout = null; function onDragStart(e) { if (e.which != 1) // only accept left-click return false; var c = plot.getPlaceholder().css('cursor'); if (c) prevCursor = c; plot.getPlaceholder().css('cursor', plot.getOptions().pan.cursor); prevPageX = e.pageX; prevPageY = e.pageY; } function onDrag(e) { var frameRate = plot.getOptions().pan.frameRate; if (panTimeout || !frameRate) return; panTimeout = setTimeout(function () { plot.pan({ left: prevPageX - e.pageX, top: prevPageY - e.pageY }); prevPageX = e.pageX; prevPageY = e.pageY; panTimeout = null; }, 1 / frameRate * 1000); } function onDragEnd(e) { if (panTimeout) { clearTimeout(panTimeout); panTimeout = null; } plot.getPlaceholder().css('cursor', prevCursor); plot.pan({ left: prevPageX - e.pageX, top: prevPageY - e.pageY }); } function bindEvents(plot, eventHolder) { var o = plot.getOptions(); if (o.zoom.interactive) { eventHolder[o.zoom.trigger](onZoomClick); eventHolder.mousewheel(onMouseWheel); } if (o.pan.interactive) { eventHolder.bind("dragstart", { distance: 10 }, onDragStart); eventHolder.bind("drag", onDrag); eventHolder.bind("dragend", onDragEnd); } } plot.zoomOut = function (args) { if (!args) args = {}; if (!args.amount) args.amount = plot.getOptions().zoom.amount; args.amount = 1 / args.amount; plot.zoom(args); }; plot.zoom = function (args) { if (!args) args = {}; var c = args.center, amount = args.amount || plot.getOptions().zoom.amount, w = plot.width(), h = plot.height(); if (!c) c = { left: w / 2, top: h / 2 }; var xf = c.left / w, yf = c.top / h, minmax = { x: { min: c.left - xf * w / amount, max: c.left + (1 - xf) * w / amount }, y: { min: c.top - yf * h / amount, max: c.top + (1 - yf) * h / amount } }; $.each(plot.getAxes(), function(_, axis) { var opts = axis.options, min = minmax[axis.direction].min, max = minmax[axis.direction].max, zr = opts.zoomRange, pr = opts.panRange; if (zr === false) // no zooming on this axis return; min = axis.c2p(min); max = axis.c2p(max); if (min > max) { // make sure min < max var tmp = min; min = max; max = tmp; } //Check that we are in panRange if (pr) { if (pr[0] != null && min < pr[0]) { min = pr[0]; } if (pr[1] != null && max > pr[1]) { max = pr[1]; } } var range = max - min; if (zr && ((zr[0] != null && range < zr[0]) || (zr[1] != null && range > zr[1]))) return; opts.min = min; opts.max = max; }); plot.setupGrid(); plot.draw(); if (!args.preventEvent) plot.getPlaceholder().trigger("plotzoom", [ plot, args ]); }; plot.pan = function (args) { var delta = { x: +args.left, y: +args.top }; if (isNaN(delta.x)) delta.x = 0; if (isNaN(delta.y)) delta.y = 0; $.each(plot.getAxes(), function (_, axis) { var opts = axis.options, min, max, d = delta[axis.direction]; min = axis.c2p(axis.p2c(axis.min) + d), max = axis.c2p(axis.p2c(axis.max) + d); var pr = opts.panRange; if (pr === false) // no panning on this axis return; if (pr) { // check whether we hit the wall if (pr[0] != null && pr[0] > min) { d = pr[0] - min; min += d; max += d; } if (pr[1] != null && pr[1] < max) { d = pr[1] - max; min += d; max += d; } } opts.min = min; opts.max = max; }); plot.setupGrid(); plot.draw(); if (!args.preventEvent) plot.getPlaceholder().trigger("plotpan", [ plot, args ]); }; function shutdown(plot, eventHolder) { eventHolder.unbind(plot.getOptions().zoom.trigger, onZoomClick); eventHolder.unbind("mousewheel", onMouseWheel); eventHolder.unbind("dragstart", onDragStart); eventHolder.unbind("drag", onDrag); eventHolder.unbind("dragend", onDragEnd); if (panTimeout) clearTimeout(panTimeout); } plot.hooks.bindEvents.push(bindEvents); plot.hooks.shutdown.push(shutdown); } $.plot.plugins.push({ init: init, options: options, name: 'navigate', version: '1.3' }); })(jQuery);
{ "pile_set_name": "Github" }
/* * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. */ /* * 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. */ /* * $Id: ElemDesc.java,v 1.2.4.1 2005/09/15 08:15:44 suresh_emailid Exp $ */ package com.sun.org.apache.xml.internal.utils; import java.util.HashMap; import java.util.Map; /** * This class is in support of SerializerToHTML, and acts as a sort * of element representative for HTML elements. * @xsl.usage internal */ class ElemDesc { /** Table of attributes for the element */ Map<String, Integer> m_attrs = null; /** Element's flags, describing the role this element plays during * formatting of the document. This is used as a bitvector; more than one flag * may be set at a time, bitwise-ORed together. Mnemonic and bits * have been assigned to the flag values. NOTE: Some bits are * currently assigned multiple mnemonics; it is the caller's * responsibility to disambiguate these if necessary. */ int m_flags; /** Defines mnemonic and bit-value for the EMPTY flag */ static final int EMPTY = (1 << 1); /** Defines mnemonic and bit-value for the FLOW flag */ static final int FLOW = (1 << 2); /** Defines mnemonic and bit-value for the BLOCK flag */ static final int BLOCK = (1 << 3); /** Defines mnemonic and bit-value for the BLOCKFORM flag */ static final int BLOCKFORM = (1 << 4); /** Defines mnemonic and bit-value for the BLOCKFORMFIELDSET flag */ static final int BLOCKFORMFIELDSET = (1 << 5); /** Defines mnemonic and bit-value for the CDATA flag */ static final int CDATA = (1 << 6); /** Defines mnemonic and bit-value for the PCDATA flag */ static final int PCDATA = (1 << 7); /** Defines mnemonic and bit-value for the RAW flag */ static final int RAW = (1 << 8); /** Defines mnemonic and bit-value for the INLINE flag */ static final int INLINE = (1 << 9); /** Defines mnemonic and bit-value for the INLINEA flag */ static final int INLINEA = (1 << 10); /** Defines mnemonic and bit-value for the INLINELABEL flag */ static final int INLINELABEL = (1 << 11); /** Defines mnemonic and bit-value for the FONTSTYLE flag */ static final int FONTSTYLE = (1 << 12); /** Defines mnemonic and bit-value for the PHRASE flag */ static final int PHRASE = (1 << 13); /** Defines mnemonic and bit-value for the FORMCTRL flag */ static final int FORMCTRL = (1 << 14); /** Defines mnemonic and bit-value for the SPECIAL flag */ static final int SPECIAL = (1 << 15); /** Defines mnemonic and bit-value for the ASPECIAL flag */ static final int ASPECIAL = (1 << 16); /** Defines mnemonic and bit-value for the HEADMISC flag */ static final int HEADMISC = (1 << 17); /** Defines mnemonic and bit-value for the HEAD flag */ static final int HEAD = (1 << 18); /** Defines mnemonic and bit-value for the LIST flag */ static final int LIST = (1 << 19); /** Defines mnemonic and bit-value for the PREFORMATTED flag */ static final int PREFORMATTED = (1 << 20); /** Defines mnemonic and bit-value for the WHITESPACESENSITIVE flag */ static final int WHITESPACESENSITIVE = (1 << 21); /** Defines mnemonic and bit-value for the ATTRURL flag */ static final int ATTRURL = (1 << 1); /** Defines mnemonic and bit-value for the ATTREMPTY flag */ static final int ATTREMPTY = (1 << 2); /** * Construct an ElementDescription with an initial set of flags. * * @param flags Element flags * @see m_flags */ ElemDesc(int flags) { m_flags = flags; } /** * "is (this element described by these flags)". * * This might more properly be called areFlagsSet(). It accepts an * integer (being used as a bitvector) and checks whether all the * corresponding bits are set in our internal flags. Note that this * test is performed as a bitwise AND, not an equality test, so a * 0 bit in the input means "don't test", not "must be set false". * * @param flags Vector of flags to compare against this element's flags * * @return true if the flags set in the parameter are also set in the * element's stored flags. * * @see m_flags * @see isAttrFlagSet */ boolean is(int flags) { // int which = (m_flags & flags); return (m_flags & flags) != 0; } /** * Set a new attribute for this element * * * @param name Attribute name * @param flags Attibute flags */ void setAttr(String name, int flags) { if (null == m_attrs) m_attrs = new HashMap<>(); m_attrs.put(name, flags); } /** * Find out if a flag is set in a given attribute of this element * * * @param name Attribute name * @param flags Flag to check * * @return True if the flag is set in the attribute. Returns false * if the attribute is not found * @see m_flags */ boolean isAttrFlagSet(String name, int flags) { if (null != m_attrs) { Integer _flags = m_attrs.get(name); if (null != _flags) { return (_flags & flags) != 0; } } return false; } }
{ "pile_set_name": "Github" }
/* * This file is part of the Soletta™ Project * * Copyright (C) 2015 Intel Corporation. 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. */ body{ margin: 0px; background-color: rgba(45,50,55,1); font-family: sans-serif; } .transparent{ background-color: rgba(255,255,255,0.1); } #top{ background-color: rgba(45,50,55,0.9); height:101px; position: fixed; right: 0px; left:0px; z-index: 10; } #title-image{ position: absolute; left:64px; top:25px; } #sidebar{ position: absolute; top:101px; width:263px; } #contents{ position: absolute; top:101px; right:0px; left:263px; margin-bottom: 50px; } .category{ /*category definitions goes here*/ } .category-label{ height: 34px; color: #33b7e9; font-weight: bold; font-size: 0.8em; padding-top: 57px; } .menu-label{ color: #33b7e9; font-weight: bold; font-size: 0.8em; height: 34px; padding-top: 57px; padding-left: 66px; } .entry{ width: 350px; border-radius: 3px; background-color: #cfd2d5; margin-right: 17px; margin-bottom: 17px; } .entry-header{ min-height: 121px; background-color: #33b7e9; padding-top: 30px; padding-left: 24px; border-top-left-radius: 3px; border-top-right-radius: 3px; } .entry-name{ color: white; font-weight: bold; font-size: 1.4em; } .entry-description{ color: white; font-size: 1em; } .entry-separator{ height:20px; background-color:#bfc2c5; color:#222529; font-size: 0.75em; font-weight: bold; padding-left: 24px; padding-top: 5px; } .entry ul{ padding-left: 24px; } .entry li{ color:#222529; list-style: none; margin: 0 0 10px 0; padding: 0; font-size: 0.95em; } .cover{ border-radius:2px; width: 350px; height:351px; background-color: rgba(26,31,35,0.9); position: absolute; top:0px; left:0px; cursor:pointer; cursor:hand; color: white; } .cover-header{ min-height: 121px; padding-top: 30px; padding-left: 24px; } .cover-name{ font-weight: bold; font-size: 1.4em; } .cover-description{ font-size: 1em; } #example{ position: absolute; top:101px; bottom:59px; right:59px; left:263px; overflow: hidden; } #example-header{ height: 91px; border-color: #4c5155; border-bottom-style: dotted; border-bottom-width: 1px; } #example-info{ position: absolute; margin-top: 32px; width: 291px; /*fixed size*/ right:0px; top:91px; bottom:0px; padding-right:22px; /*Added padding to prevent overlap of Nodetype title with scroll bar*/ overflow-y: auto; /*Added scrollbar*/ overflow-x: hidden; } /*Scroll bar styling*/ ::-webkit-scrollbar { height: 8px; width: 6px; background-color: #4f5357; } ::-webkit-scrollbar-track { border-radius: 5px; } ::-webkit-scrollbar-thumb { border-radius: 5px; background-color: #33b7e9; } ::-webkit-scrollbar-corner{ background-color: #4f5357; } #example-image-container{ position: absolute; top:123px; background-color: rgba(255,255,255,0.05); overflow: hidden; } #example-image-container p{ clear: both; color: white; width: auto; height: auto; text-align: center; } .example-thumb{ float: left; margin-bottom: 8px; margin-right: 8px; cursor: pointer; overflow: hidden; } .example-thumb-active{ outline: #33b7e9 solid 5px; outline-offset: -5px; } #example-get-code{ cursor: pointer; margin-top: 51px; } #example-info-code{ /*Added styling for hidden textarea*/ position: inherit; resize:none; z-index:-1; background: #2d3237; border: none; outline: none; overflow: hidden; color: #2d3237; } #example-info-code::selection { /*Stay hidden while selection*/ background-color: #2d3237; background: transparent; color: #2d3237; } #example-code-copied{ margin-top: 51px; } #example-info h1{ color: white; float:left; clear: both; margin: 0; } #example-info p{ float: left; clear: both; color: white; width: 291px; margin-bottom: 50px; } .button-example{ position:absolute; bottom:92px; left:72px; } .button-back{ cursor: pointer; margin-top: 50px; } nav ul{ list-style-type: none; margin:0; margin-left: 39px; margin-right: 39px; padding: 0; } nav li{ margin-left: 27px; height: 23px; padding-top: 5px; border-color: #4c5155; border-top-style: dotted; border-top-width: 1px; } nav li a{ padding-left: 10px; padding-right: 10px; font-size: 0.9em; color:#afb2b6; } nav li a:hover{ color:white; } a{ text-decoration: none; } .active{ color:white; }
{ "pile_set_name": "Github" }
// GENERATED package com.fkorotkov.openshift import io.fabric8.openshift.api.model.DeploymentConfigStatus as model_DeploymentConfigStatus import io.fabric8.openshift.api.model.DeploymentDetails as model_DeploymentDetails fun model_DeploymentConfigStatus.`details`(block: model_DeploymentDetails.() -> Unit = {}) { if(this.`details` == null) { this.`details` = model_DeploymentDetails() } this.`details`.block() }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <string xmlns="http://tempuri.org/">{ "Info": [ { "IsSuccess": "True", "InAddress": "屏東縣屏東市中華路61-1號", "InSRS": "EPSG:4326", "InFuzzyType": "[單雙號機制]+[最近門牌號機制]", "InFuzzyBuffer": "0", "InIsOnlyFullMatch": "False", "InIsLockCounty": "True", "InIsLockTown": "False", "InIsLockVillage": "False", "InIsLockRoadSection": "False", "InIsLockLane": "False", "InIsLockAlley": "False", "InIsLockArea": "False", "InIsSameNumber_SubNumber": "True", "InCanIgnoreVillage": "True", "InCanIgnoreNeighborhood": "True", "InReturnMaxCount": "0", "OutTotal": "1", "OutMatchType": "模糊比對", "OutMatchCode": "[屏東縣]\tT:1,V:-1,R:1,S:-1,L:-1,A:-1,SA:-1,T:-1,AR:-1,NO:1,E:-1,N:-1", "OutTraceInfo": "[屏東縣]\t { 模糊比對 } (屏東市)\t找到符合的[鄉鎮市區],(中華路)\t找到符合的[路街名],(61-1號)\t找到符合的[門牌號碼],模糊比對找到 1 筆符合的門牌地址。" } ], "AddressList": [ { "FULL_ADDR": "屏東縣屏東市端正里2鄰中華路61之1號", "COUNTY": "屏東縣", "TOWN": "屏東市", "VILLAGE": "端正里", "NEIGHBORHOOD": "2鄰", "ROAD": "中華路", "SECTION": "", "LANE": "", "ALLEY": "", "SUB_ALLEY": "", "TONG": "", "NUMBER": "61之1號", "X": 120.489999, "Y": 22.672813 } ] }</string>
{ "pile_set_name": "Github" }
class A {a(){};b(){};}
{ "pile_set_name": "Github" }
<resources> <string name="app_name">CustomBroadcastPermissions</string> </resources>
{ "pile_set_name": "Github" }