text
stringlengths
2
99k
meta
dict
<?xml version="1.0" encoding="utf-8"?> <!-- @@BEGIN_SDKSPLIT THRESHOLD RESTRICED CAPABILITIES MANIFEST SCHEMA This is the Schema that defines elements and attributes for the Universal App Platform features in Thresold. These types are imported into the Foundation schema and included in products that support UAP. !!!WARNING!!! Don't make any changes to this schema. Changes will affect a wide range of partners and can potentially break product and test code, as well as existing .appx packages and manifests. Please contact 'manifest' alias if you need to request any addition or modification. @@END_SDKSPLIT --> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:t="http://schemas.microsoft.com/appx/manifest/types" xmlns:f="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10" > <xs:import namespace="http://schemas.microsoft.com/appx/manifest/types"/> <xs:import namespace="http://schemas.microsoft.com/appx/manifest/foundation/windows10"/> <xs:import namespace="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"/> <xs:element name="Capability" substitutionGroup="f:CapabilityChoice"> <xs:complexType> <xs:attribute name="Name" type="t:ST_Capability_Windows_Restricted_Party" use="required"/> </xs:complexType> </xs:element> <xs:element name="Extension" substitutionGroup="f:ApplicationExtensionChoice"> <xs:complexType> <xs:choice minOccurs="0"> <xs:element name="SettingsApp" type="CT_SettingsApp"/> </xs:choice> <xs:attribute name="Category" type="t:ST_ApplicationExtensionCategory_Restricted" use="required"/> <xs:attributeGroup ref="t:ExtensionBaseAttributes"/> <xs:attributeGroup ref="uap10:TrustLevelGroup"/> </xs:complexType> </xs:element> <xs:complexType name="CT_SettingsApp"> <xs:sequence> <xs:element name="AppLinks" type="CT_SettingsExtensionAppLinkCollection" minOccurs="0" maxOccurs="1"/> <xs:element name="SearchTerms" type="CT_SettingsExtensionAppSearchTermsCollection" minOccurs="0" maxOccurs="1"/> </xs:sequence> <xs:attribute name="SettingsPageUri" type="t:ST_SettingsPageUri" use="optional"/> <xs:attribute name="Category" type="t:ST_SettingsAppCategories" use="optional"/> </xs:complexType> <xs:complexType name="CT_SettingsExtensionAppLinkCollection"> <xs:sequence> <xs:element name="Link" type="CT_SettingsExtensionAppLink" minOccurs="1" maxOccurs="5" /> </xs:sequence> </xs:complexType> <xs:complexType name="CT_SettingsExtensionAppLink"> <xs:attribute name="AppActivationMode" type="xs:string"/> <xs:attribute name="DisplayName" type="xs:string"/> </xs:complexType> <xs:complexType name="CT_SettingsExtensionAppSearchTermsCollection"> <xs:sequence> <xs:element name="Term" type="xs:string" minOccurs="0" maxOccurs="5" /> </xs:sequence> </xs:complexType> </xs:schema>
{ "pile_set_name": "Github" }
#! UFH and B3LYP cc-pVQZ properties for the CH2 molecule. molecule ch2 { 0 3 c h 1 b1 h 1 b1 2 a1 b1 = 1.0 a1 = 125.0 } # Get a reasonable guess, to save some iterations set globals = { scf_type pk basis 6-31G** e_convergence 8 docc [2, 0, 0, 1] socc [1, 0, 1, 0] reference uhf } ch2.update_geometry() compare_values(6.6484189450, ch2.nuclear_repulsion_energy(), 9, "Nuclear repulsion energy") #TEST props = ['DIPOLE', 'QUADRUPOLE', 'MULLIKEN_CHARGES', 'LOWDIN_CHARGES', 'WIBERG_LOWDIN_INDICES', 'MAYER_INDICES', 'MAYER_INDICES', 'MO_EXTENTS', 'GRID_FIELD', 'GRID_ESP', 'ESP_AT_NUCLEI', 'MULTIPOLE(5)', 'NO_OCCUPATIONS'] properties('scf', properties=props) compare_values(psi4.variable("CURRENT ENERGY"), -38.91591819679808, 6, "SCF energy") #TEST compare_values(psi4.variable('SCF DIPOLE X'), 0.000000000000, 4, "SCF DIPOLE X") #TEST compare_values(psi4.variable('SCF DIPOLE Y'), 0.000000000000, 4, "SCF DIPOLE Y") #TEST compare_values(psi4.variable('SCF DIPOLE Z'), 0.572697798348, 4, "SCF DIPOLE Z") #TEST compare_values(psi4.variable('SCF QUADRUPOLE XX'), -7.664066833060, 4, "SCF QUADRUPOLE XX") #TEST compare_values(psi4.variable('SCF QUADRUPOLE YY'), -6.097755074075, 4, "SCF QUADRUPOLE YY") #TEST compare_values(psi4.variable('SCF QUADRUPOLE ZZ'), -7.074596012050, 4, "SCF QUADRUPOLE ZZ") #TEST compare_values(psi4.variable('SCF QUADRUPOLE XY'), 0.000000000000, 4, "SCF QUADRUPOLE XY") #TEST compare_values(psi4.variable('SCF QUADRUPOLE XZ'), 0.000000000000, 4, "SCF QUADRUPOLE XZ") #TEST compare_values(psi4.variable('SCF QUADRUPOLE YZ'), 0.000000000000, 4, "SCF QUADRUPOLE YZ") #TEST properties('B3LYP', properties=props) compare_values(psi4.variable('CURRENT ENERGY'), -39.14134740550916, 6, "B3LYP energy") #TEST compare_values(psi4.variable('B3LYP DIPOLE X'), 0.000000000000, 4, "B3LYP DIPOLE X") #TEST compare_values(psi4.variable('B3LYP DIPOLE Y'), -0.000000000000, 4, "B3LYP DIPOLE Y") #TEST compare_values(psi4.variable('B3LYP DIPOLE Z'), 0.641741521158, 4, "B3LYP DIPOLE Z") #TEST compare_values(psi4.variable('B3LYP QUADRUPOLE XX'), -7.616483183211, 4, "B3LYP QUADRUPOLE XX") #TEST compare_values(psi4.variable('B3LYP QUADRUPOLE YY'), -6.005896804551, 4, "B3LYP QUADRUPOLE YY") #TEST compare_values(psi4.variable('B3LYP QUADRUPOLE ZZ'), -7.021817489904, 4, "B3LYP QUADRUPOLE ZZ") #TEST compare_values(psi4.variable('B3LYP QUADRUPOLE XY'), 0.000000000000, 4, "B3LYP QUADRUPOLE XY") #TEST compare_values(psi4.variable('B3LYP QUADRUPOLE XZ'), 0.000000000000, 4, "B3LYP QUADRUPOLE XZ") #TEST compare_values(psi4.variable('B3LYP QUADRUPOLE YZ'), -0.000000000000, 4, "B3LYP QUADRUPOLE YZ") #TEST
{ "pile_set_name": "Github" }
{ "name": "Concrete5", "author": "Andrew Horton", "version": "0.3", "description": "Concrete5 is an OpenSource CMS written in PHP.", "website": "www.concrete5.org", "matches": [ { "name": "JavaScript", "regexp": "(?-mix:\\bvar CCM_DISPATCHER_FILENAME ?=)" }, { "name": "meta generator tag", "regexp": "(?-mix:<meta name=\"generator\" content=\"concrete5 - ([0-9\\.a-z]+)\")", "offset": 1 }, { "name": "CONCRETE5 cookie", "search": "headers[set-cookie]", "regexp": "(?i-mx:^CONCRETE5=)" } ] }
{ "pile_set_name": "Github" }
using System; using LanguageExt; using LanguageExt.Common; using static LanguageExt.Prelude; using LanguageExt.ClassInstances; using LanguageExt.TypeClasses; using System.Diagnostics.Contracts; using System.Collections.Generic; /// <summary> /// Extension methods for RWS /// </summary> public static class RWSExtensions { /// <summary> /// Monadic join /// </summary> [Pure] public static RWS<MonoidW, R, W, S, A> Flatten<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, RWS<MonoidW, R, W, S, A>> ma) where MonoidW : struct, Monoid<W> => ma.Bind(identity); /// <summary> /// Runs the RWS monad and memoizes the result in a TryOption monad. Use /// Match, IfSucc, IfNone, etc to extract. /// </summary> public static RWSResult<MonoidW, R, W, S, A> Run<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self, R env, S state) where MonoidW : struct, Monoid<W> { if (self == null) throw new ArgumentNullException(nameof(self)); if (state == null) throw new ArgumentNullException(nameof(state)); try { return self(env, state); } catch (Exception e) { return RWSResult<MonoidW, R, W, S, A>.New(state, Error.New(e)); } } [Pure] public static RWS<MonoidW, R, W, S, int> Sum<MonoidW, R, W, S>(this RWS<MonoidW, R, W, S, int> self) where MonoidW : struct, Monoid<W> => self; [Pure] public static RWS<MonoidW, R, W, S, Seq<A>> ToSeq<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self) where MonoidW : struct, Monoid<W> => self.Map(x => x.Cons()); [Pure] public static RWS<MonoidW, R, W, S, Seq<A>> AsEnumerable<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self) where MonoidW : struct, Monoid<W> => ToSeq(self); [Pure] public static Seq<A> ToSeq<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self, R env, S state) where MonoidW : struct, Monoid<W> { IEnumerable<A> Yield() { var res = self(env, state); if (!res.IsFaulted) { yield return res.Value; } } return Seq(Yield()); } [Pure] public static Seq<A> AsEnumerable<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self, R env, S state) where MonoidW : struct, Monoid<W> => ToSeq(self, env, state); [Pure] public static RWS<MonoidW, R, W, S, int> Count<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self) where MonoidW : struct, Monoid<W> => (env, state) => { var res = self(env, state); return res.IsFaulted ? RWSResult<MonoidW, R, W, S, int>.New(res.Output, state, res.Error) : RWSResult<MonoidW, R, W, S, int>.New(res.Output, res.State, 1); }; [Pure] public static RWS<MonoidW, R, W, S, bool> Exists<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self, Func<A, bool> pred) where MonoidW : struct, Monoid<W> => (env, state) => { var res = self(env, state); return res.IsFaulted ? RWSResult<MonoidW, R, W, S, bool>.New(res.Output, state, false) : RWSResult<MonoidW, R, W, S, bool>.New(res.Output, res.State, pred(res.Value)); }; [Pure] public static RWS<MonoidW, R, W, S, bool> ForAll<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self, Func<A, bool> pred) where MonoidW : struct, Monoid<W> => Exists(self, pred); [Pure] public static RWS<MonoidW, R, W, S, B> Fold<MonoidW, R, W, S, A, B>(this RWS<MonoidW, R, W, S, A> self, B initialValue, Func<B, A, B> f) where MonoidW : struct, Monoid<W> => (env, state) => { var res = self(env, state); return res.IsFaulted ? RWSResult<MonoidW, R, W, S, B>.New(res.Output, state, res.Error) : RWSResult<MonoidW, R, W, S, B>.New(res.Output, res.State, f(initialValue, res.Value)); }; [Pure] public static RWS<MonoidW, R, W, S, R> Fold<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self, Func<R, A, R> f) where MonoidW : struct, Monoid<W> => (env, state) => { var res = self(env, state); return res.IsFaulted ? RWSResult<MonoidW, R, W, S, R>.New(res.Output, state, res.Error) : RWSResult<MonoidW, R, W, S, R>.New(res.Output, res.State, f(env, res.Value)); }; /// <summary> /// Force evaluation of the monad (once only) /// </summary> [Pure] public static RWS<MonoidW, R, W, S, A> Strict<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> ma) where MonoidW : struct, Monoid<W> { Option<RWSResult<MonoidW, R, W, S, A>> cache = default; object sync = new object(); return (env, state) => { if (cache.IsSome) return cache.Value; lock (sync) { if (cache.IsSome) return cache.Value; cache = ma(env, state); return cache.Value; } }; } /// <summary> /// Impure iteration of the bound value in the structure /// </summary> /// <returns> /// Returns the original unmodified structure /// </returns> public static RWS<MonoidW, R, W, S, A> Do<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> ma, Action<A> f) where MonoidW : struct, Monoid<W> => (env, state) => { var r = ma(env, state); if (!r.IsFaulted) { f(r.Value); } return r; }; /// <summary> /// Monadic state transformer. /// Maps an old state to a new state inside a RWS monad. The old state is thrown away. /// </summary> [Pure] public static RWS<MonoidW, R, W, S, Unit> Modify<MonoidW, R, W, S, A>(RWS<MonoidW, R, W, S, A> self, Func<S, S> f) where MonoidW : struct, Monoid<W> => (env, state) => RWSResult<MonoidW, R, W, S, Unit>.New(default(MonoidW).Empty(), f(state), unit); [Pure] public static RWS<MonoidW, R, W, S, B> Map<MonoidW, R, W, S, A, B>(this RWS<MonoidW, R, W, S, A> self, Func<A, B> project) where MonoidW: struct, Monoid<W> => self.Select(project); /// <summary> /// Pass is an action that executes the monad, which /// returns a value and a function, and returns the value, applying /// the function to the output. /// </summary> [Pure] public static RWS<MonoidW, R, W, S, A> Pass<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, (A, Func<W, W>)> self) where MonoidW : struct, Monoid<W> => (env, state) => { var res = self(env, state); return res.IsFaulted ? RWSResult<MonoidW, R, W, S, A>.New(res.Output, state, res.Error) : RWSResult<MonoidW, R, W, S, A>.New(res.Value.Item2(res.Output), res.State, res.Value.Item1); }; /// <summary> /// Listen is an action that executes the monad and adds /// its output to the value of the computation. /// </summary> [Pure] public static RWS<MonoidW, R, W, S, (A, B)> Listen<MonoidW, R, W, S, A, B>(this RWS<MonoidW, R, W, S, A> ma, Func<W, B> f) where MonoidW : struct, Monoid<W> => (env, state) => { var res = ma(env, state); return res.IsFaulted ? RWSResult<MonoidW, R, W, S, (A, B)>.New(res.State, res.Error) : RWSResult<MonoidW, R, W, S, (A, B)>.New(res.Output, res.State, (res.Value, f(res.Output))); }; /// <summary> /// Censor is an action that executes the monad and applies the function f /// to its output, leaving the return value unchanged. /// </summary> [Pure] public static RWS<MonoidW, R, W, S, A> Censor<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> ma, Func<W, W> f) where MonoidW : struct, Monoid<W> => Pass(ma.Bind(a => RWS<MonoidW, R, W, S, (A, Func<W, W>)>((a, f)))); [Pure] public static RWS<MonoidW, R, W, S, B> Bind<MonoidW, R, W, S, A, B>(this RWS<MonoidW, R, W, S, A> ma, Func<A, RWS<MonoidW, R, W, S, B>> f) where MonoidW : struct, Monoid<W> => (env, state) => { var ra = ma(env, state); if (ra.IsFaulted) return RWSResult<MonoidW, R, W, S, B>.New(ra.Output, ra.State, ra.Error); var rb = f(ra.Value)(env, ra.State); var noutput = default(MonoidW).Append(ra.Output, rb.Output); return rb.IsFaulted ? RWSResult<MonoidW, R, W, S, B>.New(noutput, state, rb.Error) : RWSResult<MonoidW, R, W, S, B>.New(noutput, rb.State, rb.Value); }; [Pure] public static RWS<MonoidW, R, W, S, B> Select<MonoidW, R, W, S, A, B>(this RWS<MonoidW, R, W, S, A> ma, Func<A, B> f) where MonoidW : struct, Monoid<W> => (env, state) => { var ra = ma(env, state); return ra.IsFaulted ? RWSResult<MonoidW, R, W, S, B>.New(ra.Output, state, ra.Error) : RWSResult<MonoidW, R, W, S, B>.New(ra.Output, ra.State, f(ra.Value)); }; [Pure] public static RWS<MonoidW, R, W, S, C> SelectMany<MonoidW, R, W, S, A, B, C>( this RWS<MonoidW, R, W, S, A> ma, Func<A, RWS<MonoidW, R, W, S, B>> bind, Func<A, B, C> project) where MonoidW : struct, Monoid<W> => (env, state) => { var ra = ma(env, state); if (ra.IsFaulted) return RWSResult<MonoidW, R, W, S, C>.New(ra.Output, ra.State, ra.Error); var rb = bind(ra.Value)(env, ra.State); var noutput = default(MonoidW).Append(ra.Output, rb.Output); return rb.IsFaulted ? RWSResult<MonoidW, R, W, S, C>.New(noutput, state, rb.Error) : RWSResult<MonoidW, R, W, S, C>.New(noutput, rb.State, project(ra.Value, rb.Value)); }; [Pure] public static RWS<MonoidW, R, W, S, A> Filter<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self, Func<A, bool> pred) where MonoidW : struct, Monoid<W> => (env, state) => { var res = self(env, state); if (res.IsFaulted) return res; return pred(res.Value) ? res : RWSResult<MonoidW, R, W, S, A>.New(res.Output, state, Error.Bottom); }; [Pure] public static RWS<MonoidW, R, W, S, A> Where<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self, Func<A, bool> pred) where MonoidW : struct, Monoid<W> => Filter(self, pred); public static RWS<MonoidW, R, W, S, Unit> Iter<MonoidW, R, W, S, A>(this RWS<MonoidW, R, W, S, A> self, Action<A> action) where MonoidW : struct, Monoid<W> => (env, state) => { var res = self(env, state); return res.IsFaulted ? RWSResult<MonoidW, R, W, S, Unit>.New(res.Output, state, res.Error) : RWSResult<MonoidW, R, W, S, Unit>.New(res.Output, res.State, fun(action)(res.Value)); }; }
{ "pile_set_name": "Github" }
Program["{{module}}"] = function ( module, exports ) { {{source}} };
{ "pile_set_name": "Github" }
// Copyright 2016 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 "DiagnosticsReporter.h" #include "llvm/Support/ErrorHandling.h" using namespace clang; namespace { const char kClassMustLeftMostlyDeriveGC[] = "[blink-gc] Class %0 must derive from GarbageCollected in the left-most position."; const char kClassRequiresTraceMethod[] = "[blink-gc] Class %0 requires a trace method."; const char kBaseRequiresTracing[] = "[blink-gc] Base class %0 of derived class %1 requires tracing."; const char kBaseRequiresTracingNote[] = "[blink-gc] Untraced base class %0 declared here:"; const char kFieldsRequireTracing[] = "[blink-gc] Class %0 has untraced fields that require tracing."; const char kFieldsImproperlyTraced[] = "[blink-gc] Class %0 has untraced or not traceable fields."; const char kFieldRequiresTracingNote[] = "[blink-gc] Untraced field %0 declared here:"; const char kFieldShouldNotBeTracedNote[] = "[blink-gc] Untraceable field %0 declared here:"; const char kClassContainsInvalidFields[] = "[blink-gc] Class %0 contains invalid fields."; const char kClassContainsGCRoot[] = "[blink-gc] Class %0 contains GC root in field %1."; const char kFinalizerAccessesFinalizedField[] = "[blink-gc] Finalizer %0 accesses potentially finalized field %1."; const char kRawPtrToGCManagedClassNote[] = "[blink-gc] Raw pointer field %0 to a GC managed class declared here:"; const char kRefPtrToGCManagedClassNote[] = "[blink-gc] scoped_refptr field %0 to a GC managed class declared here:"; const char kWeakPtrToGCManagedClassNote[] = "[blink-gc] WeakPtr field %0 to a GC managed class declared here:"; const char kReferencePtrToGCManagedClassNote[] = "[blink-gc] Reference pointer field %0 to a GC managed class" " declared here:"; const char kUniquePtrToGCManagedClassNote[] = "[blink-gc] std::unique_ptr field %0 to a GC managed class declared here:"; const char kMemberToGCUnmanagedClassNote[] = "[blink-gc] Member field %0 to non-GC managed class declared here:"; const char kStackAllocatedFieldNote[] = "[blink-gc] Stack-allocated field %0 declared here:"; const char kMemberInUnmanagedClassNote[] = "[blink-gc] Member field %0 in unmanaged class declared here:"; const char kPartObjectToGCDerivedClassNote[] = "[blink-gc] Part-object field %0 to a GC derived class declared here:"; const char kPartObjectContainsGCRootNote[] = "[blink-gc] Field %0 with embedded GC root in %1 declared here:"; const char kFieldContainsGCRootNote[] = "[blink-gc] Field %0 defining a GC root declared here:"; const char kOverriddenNonVirtualTrace[] = "[blink-gc] Class %0 overrides non-virtual trace of base class %1."; const char kOverriddenNonVirtualTraceNote[] = "[blink-gc] Non-virtual trace method declared here:"; const char kMissingTraceDispatchMethod[] = "[blink-gc] Class %0 is missing manual trace dispatch."; const char kVirtualAndManualDispatch[] = "[blink-gc] Class %0 contains or inherits virtual methods" " but implements manual dispatching."; const char kMissingTraceDispatch[] = "[blink-gc] Missing dispatch to class %0 in manual trace dispatch."; const char kMissingFinalizeDispatch[] = "[blink-gc] Missing dispatch to class %0 in manual finalize dispatch."; const char kFinalizedFieldNote[] = "[blink-gc] Potentially finalized field %0 declared here:"; const char kManualDispatchMethodNote[] = "[blink-gc] Manual dispatch %0 declared here:"; const char kStackAllocatedDerivesGarbageCollected[] = "[blink-gc] Stack-allocated class %0 derives class %1" " which is garbage collected."; const char kClassOverridesNew[] = "[blink-gc] Garbage collected class %0" " is not permitted to override its new operator."; const char kClassDeclaresPureVirtualTrace[] = "[blink-gc] Garbage collected class %0" " is not permitted to declare a pure-virtual trace method."; const char kLeftMostBaseMustBePolymorphic[] = "[blink-gc] Left-most base class %0 of derived class %1" " must be polymorphic."; const char kBaseClassMustDeclareVirtualTrace[] = "[blink-gc] Left-most base class %0 of derived class %1" " must define a virtual trace method."; const char kClassMustCRTPItself[] = "[blink-gc] GC base class %0 must be specialized with the derived class " "%1."; const char kIteratorToGCManagedCollectionNote[] = "[blink-gc] Iterator field %0 to a GC managed collection declared here:"; const char kTraceMethodOfStackAllocatedParentNote[] = "[blink-gc] The stack allocated class %0 provides an unnecessary " "trace method:"; const char kMemberInStackAllocated[] = "[blink-gc] Member field %0 in stack allocated class declared here (use " "raw pointer or reference instead):"; const char kUniquePtrUsedWithGC[] = "[blink-gc] Disallowed use of %0 found; %1 is a garbage-collected type. " "std::unique_ptr cannot hold garbage-collected objects."; const char kOptionalUsedWithGC[] = "[blink-gc] Disallowed construction of %0 found; %1 is a garbage-collected " "type. optional cannot hold garbage-collected objects."; } // namespace DiagnosticBuilder DiagnosticsReporter::ReportDiagnostic( SourceLocation location, unsigned diag_id) { SourceManager& manager = instance_.getSourceManager(); FullSourceLoc full_loc(location, manager); return diagnostic_.Report(full_loc, diag_id); } DiagnosticsReporter::DiagnosticsReporter( clang::CompilerInstance& instance) : instance_(instance), diagnostic_(instance.getDiagnostics()) { // Register warning/error messages. diag_class_must_left_mostly_derive_gc_ = diagnostic_.getCustomDiagID( getErrorLevel(), kClassMustLeftMostlyDeriveGC); diag_class_requires_trace_method_ = diagnostic_.getCustomDiagID(getErrorLevel(), kClassRequiresTraceMethod); diag_base_requires_tracing_ = diagnostic_.getCustomDiagID(getErrorLevel(), kBaseRequiresTracing); diag_fields_require_tracing_ = diagnostic_.getCustomDiagID(getErrorLevel(), kFieldsRequireTracing); diag_fields_improperly_traced_ = diagnostic_.getCustomDiagID(getErrorLevel(), kFieldsImproperlyTraced); diag_class_contains_invalid_fields_ = diagnostic_.getCustomDiagID( getErrorLevel(), kClassContainsInvalidFields); diag_class_contains_gc_root_ = diagnostic_.getCustomDiagID(getErrorLevel(), kClassContainsGCRoot); diag_finalizer_accesses_finalized_field_ = diagnostic_.getCustomDiagID( getErrorLevel(), kFinalizerAccessesFinalizedField); diag_overridden_non_virtual_trace_ = diagnostic_.getCustomDiagID( getErrorLevel(), kOverriddenNonVirtualTrace); diag_missing_trace_dispatch_method_ = diagnostic_.getCustomDiagID( getErrorLevel(), kMissingTraceDispatchMethod); diag_virtual_and_manual_dispatch_ = diagnostic_.getCustomDiagID(getErrorLevel(), kVirtualAndManualDispatch); diag_missing_trace_dispatch_ = diagnostic_.getCustomDiagID(getErrorLevel(), kMissingTraceDispatch); diag_missing_finalize_dispatch_ = diagnostic_.getCustomDiagID(getErrorLevel(), kMissingFinalizeDispatch); diag_stack_allocated_derives_gc_ = diagnostic_.getCustomDiagID( getErrorLevel(), kStackAllocatedDerivesGarbageCollected); diag_class_overrides_new_ = diagnostic_.getCustomDiagID(getErrorLevel(), kClassOverridesNew); diag_class_declares_pure_virtual_trace_ = diagnostic_.getCustomDiagID( getErrorLevel(), kClassDeclaresPureVirtualTrace); diag_left_most_base_must_be_polymorphic_ = diagnostic_.getCustomDiagID( getErrorLevel(), kLeftMostBaseMustBePolymorphic); diag_base_class_must_declare_virtual_trace_ = diagnostic_.getCustomDiagID( getErrorLevel(), kBaseClassMustDeclareVirtualTrace); diag_class_must_crtp_itself_ = diagnostic_.getCustomDiagID(getErrorLevel(), kClassMustCRTPItself); diag_iterator_to_gc_managed_collection_note_ = diagnostic_.getCustomDiagID( getErrorLevel(), kIteratorToGCManagedCollectionNote); diag_trace_method_of_stack_allocated_parent_ = diagnostic_.getCustomDiagID( getErrorLevel(), kTraceMethodOfStackAllocatedParentNote); diag_member_in_stack_allocated_class_ = diagnostic_.getCustomDiagID(getErrorLevel(), kMemberInStackAllocated); // Register note messages. diag_base_requires_tracing_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kBaseRequiresTracingNote); diag_field_requires_tracing_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kFieldRequiresTracingNote); diag_field_should_not_be_traced_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kFieldShouldNotBeTracedNote); diag_raw_ptr_to_gc_managed_class_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kRawPtrToGCManagedClassNote); diag_ref_ptr_to_gc_managed_class_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kRefPtrToGCManagedClassNote); diag_weak_ptr_to_gc_managed_class_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kWeakPtrToGCManagedClassNote); diag_reference_ptr_to_gc_managed_class_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kReferencePtrToGCManagedClassNote); diag_unique_ptr_to_gc_managed_class_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kUniquePtrToGCManagedClassNote); diag_member_to_gc_unmanaged_class_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kMemberToGCUnmanagedClassNote); diag_stack_allocated_field_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kStackAllocatedFieldNote); diag_member_in_unmanaged_class_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kMemberInUnmanagedClassNote); diag_part_object_to_gc_derived_class_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kPartObjectToGCDerivedClassNote); diag_part_object_contains_gc_root_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kPartObjectContainsGCRootNote); diag_field_contains_gc_root_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kFieldContainsGCRootNote); diag_finalized_field_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kFinalizedFieldNote); diag_overridden_non_virtual_trace_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kOverriddenNonVirtualTraceNote); diag_manual_dispatch_method_note_ = diagnostic_.getCustomDiagID( DiagnosticsEngine::Note, kManualDispatchMethodNote); diag_unique_ptr_used_with_gc_ = diagnostic_.getCustomDiagID(getErrorLevel(), kUniquePtrUsedWithGC); diag_optional_used_with_gc_ = diagnostic_.getCustomDiagID(getErrorLevel(), kOptionalUsedWithGC); } bool DiagnosticsReporter::hasErrorOccurred() const { return diagnostic_.hasErrorOccurred(); } DiagnosticsEngine::Level DiagnosticsReporter::getErrorLevel() const { return diagnostic_.getWarningsAsErrors() ? DiagnosticsEngine::Error : DiagnosticsEngine::Warning; } void DiagnosticsReporter::ClassMustLeftMostlyDeriveGC( RecordInfo* info) { ReportDiagnostic(info->record()->getInnerLocStart(), diag_class_must_left_mostly_derive_gc_) << info->record(); } void DiagnosticsReporter::ClassRequiresTraceMethod(RecordInfo* info) { ReportDiagnostic(info->record()->getInnerLocStart(), diag_class_requires_trace_method_) << info->record(); for (auto& base : info->GetBases()) if (base.second.NeedsTracing().IsNeeded()) NoteBaseRequiresTracing(&base.second); for (auto& field : info->GetFields()) if (!field.second.IsProperlyTraced()) NoteFieldRequiresTracing(info, field.first); } void DiagnosticsReporter::BaseRequiresTracing( RecordInfo* derived, CXXMethodDecl* trace, CXXRecordDecl* base) { ReportDiagnostic(trace->getBeginLoc(), diag_base_requires_tracing_) << base << derived->record(); } void DiagnosticsReporter::FieldsImproperlyTraced( RecordInfo* info, CXXMethodDecl* trace) { // Only mention untraceable in header diagnostic if they appear. unsigned diag = diag_fields_require_tracing_; for (auto& field : info->GetFields()) { if (field.second.IsInproperlyTraced()) { diag = diag_fields_improperly_traced_; break; } } ReportDiagnostic(trace->getBeginLoc(), diag) << info->record(); for (auto& field : info->GetFields()) { if (!field.second.IsProperlyTraced()) NoteFieldRequiresTracing(info, field.first); if (field.second.IsInproperlyTraced()) NoteFieldShouldNotBeTraced(info, field.first); } } void DiagnosticsReporter::ClassContainsInvalidFields( RecordInfo* info, const CheckFieldsVisitor::Errors& errors) { ReportDiagnostic(info->record()->getBeginLoc(), diag_class_contains_invalid_fields_) << info->record(); for (auto& error : errors) { unsigned note; if (error.second == CheckFieldsVisitor::kRawPtrToGCManaged) { note = diag_raw_ptr_to_gc_managed_class_note_; } else if (error.second == CheckFieldsVisitor::kRefPtrToGCManaged) { note = diag_ref_ptr_to_gc_managed_class_note_; } else if (error.second == CheckFieldsVisitor::kWeakPtrToGCManaged) { note = diag_weak_ptr_to_gc_managed_class_note_; } else if (error.second == CheckFieldsVisitor::kReferencePtrToGCManaged) { note = diag_reference_ptr_to_gc_managed_class_note_; } else if (error.second == CheckFieldsVisitor::kUniquePtrToGCManaged) { note = diag_unique_ptr_to_gc_managed_class_note_; } else if (error.second == CheckFieldsVisitor::kMemberToGCUnmanaged) { note = diag_member_to_gc_unmanaged_class_note_; } else if (error.second == CheckFieldsVisitor::kMemberInUnmanaged) { note = diag_member_in_unmanaged_class_note_; } else if (error.second == CheckFieldsVisitor::kPtrFromHeapToStack) { note = diag_stack_allocated_field_note_; } else if (error.second == CheckFieldsVisitor::kGCDerivedPartObject) { note = diag_part_object_to_gc_derived_class_note_; } else if (error.second == CheckFieldsVisitor::kIteratorToGCManaged) { note = diag_iterator_to_gc_managed_collection_note_; } else if (error.second == CheckFieldsVisitor::kMemberInStackAllocated) { note = diag_member_in_stack_allocated_class_; } else { llvm_unreachable("Unknown field error."); } NoteField(error.first, note); } } void DiagnosticsReporter::ClassContainsGCRoots( RecordInfo* info, const CheckGCRootsVisitor::Errors& errors) { for (auto& error : errors) { FieldPoint* point = nullptr; for (FieldPoint* path : error) { if (!point) { point = path; ReportDiagnostic(info->record()->getBeginLoc(), diag_class_contains_gc_root_) << info->record() << point->field(); continue; } NotePartObjectContainsGCRoot(point); point = path; } NoteFieldContainsGCRoot(point); } } void DiagnosticsReporter::FinalizerAccessesFinalizedFields( CXXMethodDecl* dtor, const CheckFinalizerVisitor::Errors& errors) { for (auto& error : errors) { ReportDiagnostic(error.member->getBeginLoc(), diag_finalizer_accesses_finalized_field_) << dtor << error.field->field(); NoteField(error.field, diag_finalized_field_note_); } } void DiagnosticsReporter::OverriddenNonVirtualTrace( RecordInfo* info, CXXMethodDecl* trace, CXXMethodDecl* overridden) { ReportDiagnostic(trace->getBeginLoc(), diag_overridden_non_virtual_trace_) << info->record() << overridden->getParent(); NoteOverriddenNonVirtualTrace(overridden); } void DiagnosticsReporter::MissingTraceDispatchMethod(RecordInfo* info) { ReportMissingDispatchMethod(info, diag_missing_trace_dispatch_method_); } void DiagnosticsReporter::ReportMissingDispatchMethod( RecordInfo* info, unsigned error) { ReportDiagnostic(info->record()->getInnerLocStart(), error) << info->record(); } void DiagnosticsReporter::VirtualAndManualDispatch( RecordInfo* info, CXXMethodDecl* dispatch) { ReportDiagnostic(info->record()->getInnerLocStart(), diag_virtual_and_manual_dispatch_) << info->record(); NoteManualDispatchMethod(dispatch); } void DiagnosticsReporter::MissingTraceDispatch( const FunctionDecl* dispatch, RecordInfo* receiver) { ReportMissingDispatch(dispatch, receiver, diag_missing_trace_dispatch_); } void DiagnosticsReporter::MissingFinalizeDispatch( const FunctionDecl* dispatch, RecordInfo* receiver) { ReportMissingDispatch(dispatch, receiver, diag_missing_finalize_dispatch_); } void DiagnosticsReporter::ReportMissingDispatch( const FunctionDecl* dispatch, RecordInfo* receiver, unsigned error) { ReportDiagnostic(dispatch->getBeginLoc(), error) << receiver->record(); } void DiagnosticsReporter::StackAllocatedDerivesGarbageCollected( RecordInfo* info, BasePoint* base) { ReportDiagnostic(base->spec().getBeginLoc(), diag_stack_allocated_derives_gc_) << info->record() << base->info()->record(); } void DiagnosticsReporter::ClassOverridesNew( RecordInfo* info, CXXMethodDecl* newop) { ReportDiagnostic(newop->getBeginLoc(), diag_class_overrides_new_) << info->record(); } void DiagnosticsReporter::ClassDeclaresPureVirtualTrace( RecordInfo* info, CXXMethodDecl* trace) { ReportDiagnostic(trace->getBeginLoc(), diag_class_declares_pure_virtual_trace_) << info->record(); } void DiagnosticsReporter::LeftMostBaseMustBePolymorphic( RecordInfo* derived, CXXRecordDecl* base) { ReportDiagnostic(base->getBeginLoc(), diag_left_most_base_must_be_polymorphic_) << base << derived->record(); } void DiagnosticsReporter::BaseClassMustDeclareVirtualTrace( RecordInfo* derived, CXXRecordDecl* base) { ReportDiagnostic(base->getBeginLoc(), diag_base_class_must_declare_virtual_trace_) << base << derived->record(); } void DiagnosticsReporter::ClassMustCRTPItself( const RecordInfo* derived, const CXXRecordDecl* base, const CXXBaseSpecifier* base_spec) { ReportDiagnostic(base_spec->getBeginLoc(), diag_class_must_crtp_itself_) << base << derived->record(); } void DiagnosticsReporter::TraceMethodForStackAllocatedClass( RecordInfo* info, CXXMethodDecl* trace) { ReportDiagnostic(trace->getBeginLoc(), diag_trace_method_of_stack_allocated_parent_) << info->record(); } void DiagnosticsReporter::NoteManualDispatchMethod(CXXMethodDecl* dispatch) { ReportDiagnostic(dispatch->getBeginLoc(), diag_manual_dispatch_method_note_) << dispatch; } void DiagnosticsReporter::NoteBaseRequiresTracing(BasePoint* base) { ReportDiagnostic(base->spec().getBeginLoc(), diag_base_requires_tracing_note_) << base->info()->record(); } void DiagnosticsReporter::NoteFieldRequiresTracing( RecordInfo* holder, FieldDecl* field) { NoteField(field, diag_field_requires_tracing_note_); } void DiagnosticsReporter::NoteFieldShouldNotBeTraced( RecordInfo* holder, FieldDecl* field) { NoteField(field, diag_field_should_not_be_traced_note_); } void DiagnosticsReporter::NotePartObjectContainsGCRoot(FieldPoint* point) { FieldDecl* field = point->field(); ReportDiagnostic(field->getBeginLoc(), diag_part_object_contains_gc_root_note_) << field << field->getParent(); } void DiagnosticsReporter::NoteFieldContainsGCRoot(FieldPoint* point) { NoteField(point, diag_field_contains_gc_root_note_); } void DiagnosticsReporter::NoteField(FieldPoint* point, unsigned note) { NoteField(point->field(), note); } void DiagnosticsReporter::NoteField(FieldDecl* field, unsigned note) { ReportDiagnostic(field->getBeginLoc(), note) << field; } void DiagnosticsReporter::NoteOverriddenNonVirtualTrace( CXXMethodDecl* overridden) { ReportDiagnostic(overridden->getBeginLoc(), diag_overridden_non_virtual_trace_note_) << overridden; } void DiagnosticsReporter::UniquePtrUsedWithGC( const clang::Expr* expr, const clang::FunctionDecl* bad_function, const clang::CXXRecordDecl* gc_type) { ReportDiagnostic(expr->getBeginLoc(), diag_unique_ptr_used_with_gc_) << bad_function << gc_type << expr->getSourceRange(); } void DiagnosticsReporter::OptionalUsedWithGC( const clang::Expr* expr, const clang::CXXRecordDecl* optional, const clang::CXXRecordDecl* gc_type) { ReportDiagnostic(expr->getBeginLoc(), diag_optional_used_with_gc_) << optional << gc_type << expr->getSourceRange(); }
{ "pile_set_name": "Github" }
# Czech translation for gnome-pomodoro # Copyright (c) 2012 gnome-pomodoro contributors # This file is distributed under the same license as the gnome-pomodoro package. # Jakub Veverka, 2012. # msgid "" msgstr "" "Project-Id-Version: gnome-pomodoro\n" "Report-Msgid-Bugs-To: https://github.com/codito/gnome-pomodoro/issues\n" "POT-Creation-Date: 2016-10-02 19:50+0200\n" "PO-Revision-Date: 2016-10-04 06:18+0200\n" "Last-Translator: Petr Hložek <[email protected]>\n" "Language-Team: <>\n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" "X-Generator: Poedit 1.8.7.1\n" #: data/org.gnome.Pomodoro.appdata.xml.in:7 #: data/org.gnome.Pomodoro.desktop.in:3 lib/resources/ui/menus.ui:51 #: lib/resources/ui/window.ui:275 lib/about-dialog.vala:31 #: lib/notifications-capability.vala:106 src/main.vala:30 msgid "Pomodoro" msgstr "Pomodoro" #: data/org.gnome.Pomodoro.appdata.xml.in:8 msgid "A time management utility for GNOME" msgstr "Jednoduchý nástroj pro time management" #: data/org.gnome.Pomodoro.appdata.xml.in:10 msgid "" "A GNOME utility that helps managing time according to Pomodoro Technique. It " "intends to improve productivity and focus by taking short breaks after every " "25 minutes of work." msgstr "" "Nástroj pro Gnome, který vám pomůže se správou času pomocí techniky " "Pomodoro. Záměrem je zlepšit vaši produktivitu a koncentraci pomocí krátkých " "přestávek po každých 25 minutách práce." #: data/org.gnome.Pomodoro.appdata.xml.in:19 msgid "Main window" msgstr "Hlavní okno" #: data/org.gnome.Pomodoro.appdata.xml.in:23 lib/preferences-dialog.vala:721 msgid "Preferences" msgstr "Předvolby" #: data/org.gnome.Pomodoro.appdata.xml.in:27 msgid "Indicator for GNOME Shell" msgstr "Indikátor pro GNOME Shell" #: data/org.gnome.Pomodoro.appdata.xml.in:32 msgid "Kamil Prusko" msgstr "Kamil Prusko" #: data/org.gnome.Pomodoro.desktop.in:4 lib/about-dialog.vala:32 msgid "A simple time management utility" msgstr "Jednoduchý nástroj pro time management " #: data/org.gnome.Pomodoro.desktop.in:5 msgid "timer;" msgstr "Časovač;" #: data/org.gnome.Pomodoro.desktop.in:7 msgid "gnome-pomodoro" msgstr "Pomodoro" #: lib/resources/ui/menus.ui:6 lib/resources/ui/menus.ui:68 msgid "_Timer" msgstr "Časovač" #: lib/resources/ui/menus.ui:10 lib/resources/ui/menus.ui:72 msgid "_Preferences" msgstr "Předvolby" #: lib/resources/ui/menus.ui:16 msgid "_About" msgstr "_O aplikaci" #: lib/resources/ui/menus.ui:20 lib/resources/ui/menus.ui:76 msgid "_Quit" msgstr "_Konec" #: lib/resources/ui/menus.ui:29 lib/application.vala:69 msgid "Start" msgstr "Start" #: lib/resources/ui/menus.ui:34 lib/resources/ui/window.ui:173 #: lib/application.vala:78 lib/window.vala:161 msgid "Pause" msgstr "Pozastavit" #: lib/resources/ui/menus.ui:39 lib/application.vala:81 lib/window.vala:147 msgid "Resume" msgstr "Pokračovat" #: lib/resources/ui/menus.ui:44 lib/resources/ui/window.ui:200 #: lib/application.vala:72 msgid "Stop" msgstr "Stop" #: lib/resources/ui/menus.ui:56 lib/resources/ui/window.ui:290 msgid "Short Break" msgstr "Krátká přestávka" #: lib/resources/ui/menus.ui:61 lib/resources/ui/window.ui:305 msgid "Long Break" msgstr "Dlouhá přestávka" #: lib/resources/ui/preferences.ui:8 lib/preferences-dialog.vala:725 msgid "Plugins" msgstr "Rošíření" #: lib/resources/ui/preferences.ui:47 msgid "Back" msgstr "Zpět" #: lib/resources/ui/preferences-keyboard-shortcut-page.ui:29 msgid "Keyboard shortcut to toggle the timer. Enter new shortcut to change." msgstr "Klávesová zkratka pro spuštění časovače. Nastavte novou." #: lib/resources/ui/preferences-keyboard-shortcut-page.ui:83 msgid "Disable" msgstr "Vypnuto" #: lib/resources/ui/preferences-main-page.ui:45 msgid "Timer" msgstr "Časovač" #: lib/resources/ui/preferences-main-page.ui:112 msgid "Pomodoro duration" msgstr "Délka pomodora" #: lib/resources/ui/preferences-main-page.ui:164 msgid "Break duration" msgstr "Délka přestávky" #: lib/resources/ui/preferences-main-page.ui:217 msgid "Long break duration" msgstr "Délka dlouhé přestávky" #: lib/resources/ui/preferences-main-page.ui:249 msgid "Pomodoros before a long break" msgstr "Počet pomodor před dlouhou přestávkou" #: lib/resources/ui/preferences-main-page.ui:298 msgid "Keyboard shortcut" msgstr "Klávesové zkratky" #: lib/resources/ui/preferences-main-page.ui:363 msgid "Notifications" msgstr "Notifikace" #: lib/resources/ui/preferences-main-page.ui:410 msgid "Screen notifications" msgstr "Oznámení na obrazovce" #: lib/resources/ui/preferences-main-page.ui:452 msgid "Remind to take a break" msgstr "Připomenout vzít si přestávku" #: lib/resources/ui/preferences-main-page.ui:514 msgid "Extras" msgstr "Další" #: lib/resources/ui/preferences-main-page.ui:561 msgid "Wait for activity after a break" msgstr "Po ukončení přestávky počkat na akci " #: lib/resources/ui/preferences-main-page.ui:603 msgid "Hide other notifications" msgstr "Skrýt ostatní notifikace" #: lib/resources/ui/preferences-main-page.ui:639 msgid "Plugins…" msgstr "Rozšíření" #: lib/resources/ui/preferences-sound-page.ui:33 msgid "Volume:" msgstr "Hlasitost:" #: lib/resources/ui/preferences-sound-page.ui:168 msgid "Add Sound" msgstr "Přidat zvuk" #: lib/resources/ui/preferences-sound-page.ui:180 msgid "Remove Sound" msgstr "Odstranit zvuk" #: lib/resources/ui/screen-notification.ui:31 #: lib/resources/ui/screen-notification.ui:65 lib/resources/ui/window.ui:98 #: lib/resources/ui/window.ui:132 msgid "00" msgstr "00" #: lib/resources/ui/screen-notification.ui:49 lib/resources/ui/window.ui:116 msgid ":" msgstr ":" #: lib/resources/ui/screen-notification.ui:89 msgid "It's time to take a break" msgstr "Je čas udělat si přestávku..." #: lib/resources/ui/window.ui:31 msgid "Start Pomodoro" msgstr "Začni pomodoro" #: lib/about-dialog.vala:30 msgid "About Pomodoro" msgstr "O Pomodoro" #: lib/about-dialog.vala:41 msgid "translator-credits" msgstr "Petr Hložek" #: lib/application.vala:66 msgid "Start/Stop" msgstr "Start/Stop" #: lib/application.vala:75 msgid "Pause/Resume" msgstr "Pozastavit/Pokračovat" #: lib/application.vala:84 msgid "Run as background service" msgstr "Spustit na pozadí" #: lib/application.vala:87 msgid "Show preferences" msgstr "Předvolby" #: lib/application.vala:90 msgid "Quit application" msgstr "Ukončit program" #: lib/application.vala:93 msgid "Print version information and exit" msgstr "Zobrazí informaci o verzi a ukončí se" #: lib/notifications-capability.vala:107 msgid "Focus on your task." msgstr "Soustřeď se na svůj úkol" #: lib/notifications-capability.vala:118 lib/notifications-capability.vala:139 msgid "Take a break" msgstr "Dej si pauzu!" #: lib/notifications-capability.vala:133 #, c-format msgid "You have %d minute" msgid_plural "You have %d minutes" msgstr[0] "Zbývá %d minuta" msgstr[1] "Zbývá %d minuty" msgstr[2] "Zbývá %d minut" #: lib/notifications-capability.vala:135 #, c-format msgid "You have %d second" msgid_plural "You have %d seconds" msgstr[0] "Zbývá %d vteřina" msgstr[1] "Zbývá %d vteřiny" msgstr[2] "Zbývá %d vteřin" #: lib/notifications-capability.vala:140 msgid "Take a longer break" msgstr "Dej si delší pauzu!" #: lib/notifications-capability.vala:156 msgid "Lengthen it" msgstr "Prodlužte si ji" #: lib/notifications-capability.vala:161 msgid "Shorten it" msgstr "Zkraťte si ji" #: lib/notifications-capability.vala:166 msgid "Start pomodoro" msgstr "Začni pomodoro" #: lib/preferences-dialog.vala:158 #, c-format msgid "" "Using \"%s\" as shortcut will interfere with typing. Try adding another key, " "such as Control, Alt or Shift." msgstr "" "Klávesovou zkratku \"%s\" nelze použít protože by nešlo psát.\n" "Zkuste ji stisknout zároveň s CTRL, ALT nebo Shiftem." #: lib/preferences-dialog.vala:579 plugins/sounds/sounds-plugin.vala:595 msgid "Off" msgstr "Vypnuto" #: lib/preferences-dialog.vala:729 msgid "Keyboard Shortcut" msgstr "Klávesové zkratky" #: lib/presence.vala:78 msgid "Available" msgstr "Dostupný" #: lib/presence.vala:81 msgid "Busy" msgstr "Zaneprázdněný" #: lib/presence.vala:84 msgid "Idle" msgstr "Nečinný" #: lib/presence.vala:87 msgid "Invisible" msgstr "Neviditelný" #: lib/utils.vala:64 #, c-format msgid "%d hour" msgid_plural "%d hours" msgstr[0] "%d hodina" msgstr[1] "%d hodiny" msgstr[2] "%d hodin" #: lib/utils.vala:73 #, c-format msgid "%d minute" msgid_plural "%d minutes" msgstr[0] "%d minuta" msgstr[1] "%d minuty" msgstr[2] "%d minut" #: plugins/gnome/gnome-shell-extension.vala:340 #: plugins/gnome/gnome-shell-extension.vala:359 #: plugins/gnome/gnome-shell-extension.vala:392 msgid "Failed to enable extension" msgstr "Nepodařilo se zapnout rozšíření" #: plugins/gnome/gnome-shell-extension.vala:341 msgid "It seems to be uninstalled" msgstr "Zdá se být odinstalováno" #: plugins/gnome/gnome-shell-extension.vala:360 msgid "Extension is out of date" msgstr "Rozšíření je zastaralé" #: plugins/gnome/gnome-shell-extension.vala:361 msgid "Upgrade" msgstr "Upgrade" #: plugins/gnome/gnome-shell-extension.vala:394 msgid "Report issue" msgstr "Nahlásit problém" #: plugins/sounds/sounds-plugin.vala:35 plugins/sounds/sounds-plugin.vala:402 msgid "Clock Ticking" msgstr "Tikání" #: plugins/sounds/sounds-plugin.vala:36 plugins/sounds/sounds-plugin.vala:403 msgid "Timer Ticking" msgstr "Tikání časovače" #: plugins/sounds/sounds-plugin.vala:37 plugins/sounds/sounds-plugin.vala:404 msgid "Woodland Birds" msgstr "Lesní ptáci" #: plugins/sounds/sounds-plugin.vala:38 plugins/sounds/sounds-plugin.vala:462 #: plugins/sounds/sounds-plugin.vala:502 msgid "Bell" msgstr "Zvonek" #: plugins/sounds/sounds-plugin.vala:39 plugins/sounds/sounds-plugin.vala:463 #: plugins/sounds/sounds-plugin.vala:503 msgid "Loud Bell" msgstr "Hlasitý zvonek" #: plugins/sounds/sounds-plugin.vala:328 msgid "Select Custom Sound" msgstr "Vyberte vlastní zvuk" #: plugins/sounds/sounds-plugin.vala:561 msgid "Ticking Sound" msgstr "Tikání" #: plugins/sounds/sounds-plugin.vala:565 msgid "End of Break Sound" msgstr "Zvuk na konci přestávky" #: plugins/sounds/sounds-plugin.vala:569 msgid "Start of Break Sound" msgstr "Zvuk na začátku přestávky" #: plugins/sounds/sounds-plugin.vala:728 msgid "Ticking sound" msgstr "Tikání" #: plugins/sounds/sounds-plugin.vala:733 msgid "Start of break sound" msgstr "Zvuk na začátku přestávky" #: plugins/sounds/sounds-plugin.vala:738 msgid "End of break sound" msgstr "Zvuk na konci přestávky" #~ msgid "Pomodoro Timer" #~ msgstr "Časovač Pomodoro" #~ msgid "A new pomodoro is starting" #~ msgstr "Nové pomodoro začíná" #~ msgid "Hey, you're missing out on a break" #~ msgstr "Hej, zapomínáš na přestávku" #~ msgid "Could not run pomodoro" #~ msgstr "Pomodoro nelze spustit" #~ msgid "Something went badly wrong..." #~ msgstr "Stalo se něco moc špatného..." #~ msgid "Looks like gnome-pomodoro is not installed" #~ msgstr "Vypadá to, že jste nenainstalovali gnome-pomodoro" #~ msgid "Install" #~ msgstr "Instalovat" #~ msgid "Short break duration" #~ msgstr "Délka krátké přestávky" #~ msgid "Shortcut to toggle the timer" #~ msgstr "Klávesová zkratka k přepnutí časovače" #~ msgid "Select sound for start of break" #~ msgstr "Vyberte zvukový soubor, který se přehraje na začátku přestávky" #~ msgid "Select sound for pomodoro start" #~ msgstr "Vyberte zvukový soubor, který se přehraje na začátku pomodora" #~ msgid "Pomodoro start sound" #~ msgstr "Zvuk na začátku pomodora" #~ msgid "Presence" #~ msgstr "Dostupnost" #~ msgid "Postpone pomodoro when idle" #~ msgstr "Odložit pomodoro v době nečinnosti" #~ msgid "Status during pomodoro" #~ msgstr "Stav během pomodora" #~ msgid "Status during break" #~ msgstr "Stav během přestávky" #~ msgid "" #~ "System notifications including chat messages won't show up during " #~ "pomodoro." #~ msgstr "" #~ "Systémová oznámení a zprávy z chatu se nebudou zobrazovat dokud je " #~ "pomodoro aktivní." #~ msgid "" #~ "System notifications including chat messages won't show up during break." #~ msgstr "" #~ "Systémová oznámení a zprávy z chatu se nebudou během přestávky zobrazovat." #~ msgid "System notifications including chat messages won't show up." #~ msgstr "Systémová oznámení a zprávy z chatu se nebudou zobrazovat vůbec." #~ msgid "OK" #~ msgstr "OK" #~ msgid "" #~ "The shortcut \"%s\" cannot be used because it will become impossible to " #~ "type using this key.\n" #~ "Please try with a key such as Control, Alt or Shift at the same time." #~ msgstr "" #~ "Klávesovou zkratku \"%s\" nelze použít protože by nešlo psát.\n" #~ "Zkuste ji stisknout zároveň s CTRL, ALE nebo Shiftem." #~ msgid "_No sound" #~ msgstr "_Bez zvuku" #~ msgid "_Cancel" #~ msgstr "_Zrušit" #~ msgid "_Open" #~ msgstr "_Otevřít" #~ msgid "Select a file" #~ msgstr "Zvolte soubor" #~ msgid "All files" #~ msgstr "Všechny soubory" #~ msgid "Other…" #~ msgstr "Další..." #~ msgid "None" #~ msgstr "Žádný" #~ msgid "Supported audio files" #~ msgstr "Podporované zvukové soubory" #~ msgid "Manage your time and tasks" #~ msgstr "Správa času a úkolů" #~ msgid "time;timer;tasks;manage;organize;" #~ msgstr "čas;časovač;úkoly;řídit;organizovat;" #~ msgid "Options" #~ msgstr "Možnosti" #~ msgid "Reset Counts and Timer" #~ msgstr "Vynulovat cykly a časovač" #~ msgid "Away From Desk" #~ msgstr "Nepřítomen" #~ msgid "Control Presence Status" #~ msgstr "Zkontroluj stav dostupnosti" #~ msgid "No Completed Sessions" #~ msgstr "Žádný kompletní cyklus" #~ msgid "%d Completed Session" #~ msgid_plural "%d Completed Sessions" #~ msgstr[0] "%d kompletní cyklus" #~ msgstr[1] "%d kompletních cyklů" #~ msgid "Pause finished." #~ msgstr "Konec pauzy." #~ msgid "Time in seconds you are supposed to be working." #~ msgstr "Délka pracovní doby ve vteřinách." #~ msgid "Short pause duration" #~ msgstr "Trvání krátké pauzy" #~ msgid "Time in seconds you are supposed to have a short break." #~ msgstr "Délka krátké pauzy ve vteřinách." #~ msgid "Long pause duration" #~ msgstr "Trvání dlouhé pauzy" #~ msgid "Time in seconds you are supposed to have a longer break." #~ msgstr "Délka dlouhé pauzy ve vteřinách." #~ msgid "Whether to show a notification dialog when pause starts." #~ msgstr "Jestli ukazovat notifikační dialog když začíná pauza." #~ msgid "Disable flexible breaks" #~ msgstr "Zakaž upravitelné pauzy" #~ msgid "Whether you are not using a computer to work." #~ msgstr "Jestli nepoužíváš k práci počítač." #~ msgid "Change user presence status to busy" #~ msgstr "Změň status uživatele na zaneprázdněn" #~ msgid "Whether to change user and IM presence to busy." #~ msgstr "Zdali změnit status uživatele a IM na zaneprázdněn." #~ msgid "Whether to play a sound to notify of events." #~ msgstr "Zdali přehrát zvuk při notifikaci události." #~ msgid "Notification sound file" #~ msgstr "Zvukový soubor pro notifikaci" #~ msgid "Restore timer state" #~ msgstr "Obnovit stav časovače" #~ msgid "Whether to restore state on startup." #~ msgstr "Jestli obnovit stav při startu." #~ msgid "Number of completed sessions" #~ msgstr "Počet kompletních cyklů" #~ msgid "Number of completed sessions since long break" #~ msgstr "Počet kompletních cyklů od dlouhé pauzy" #~ msgid "Saved timer state" #~ msgstr "Uložený stav časovače" #~ msgid "Time of saved state" #~ msgstr "Ćas uloženého stavu" #~ msgid "Click to reset session counts to zero" #~ msgstr "Klikni pro vynulování cyklů" #~ msgid "Set optimal settings for doing paperwork" #~ msgstr "Nastav optimální čas pro papírování" #~ msgid "Show a dialog message at the end of pomodoro session" #~ msgstr "Ukaž dialogové zprávy na konci pomodora" #~ msgid "Play a sound at start of pomodoro session" #~ msgstr "Přehraj zvuk na začátku pomodora" #~ msgid "Pomodoro Finished!" #~ msgstr "Konec pomodora" #~ msgid "Hide" #~ msgstr "Skryj" #~ msgid "Show dialog" #~ msgstr "Ukaž dialog" #~ msgid "Timer toggle key" #~ msgstr "Přepínací tlačítko časovače"
{ "pile_set_name": "Github" }
/* --COPYRIGHT--,BSD * Copyright (c) 2016, Texas Instruments Incorporated * 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 Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * --/COPYRIGHT--*/ #ifndef IMAGEBUTTON_H_ #define IMAGEBUTTON_H_ //***************************************************************************** // //! This structure defines the characteristics of a ImageButton // //***************************************************************************** typedef struct Graphics_ImageButton { uint16_t xPosition; /*!< x coordinate for upper left corner of button */ uint16_t yPosition; /*!< y coordinate for upper left corner of button */ uint8_t borderWidth; /*!< border width in pixels */ bool selected; /*!< draws button with selected colors enabled */ uint16_t imageHeight; /*!< image height in pixels */ uint16_t imageWidth; /*!< image width in pixels */ uint32_t borderColor; /*!< Border color, border is drawn if borderWidth >0 */ uint32_t selectedColor; /*!< Background button color when selected */ Graphics_Image *image; /*!< Pointer to the image */ } Graphics_ImageButton; //***************************************************************************** //globals //***************************************************************************** extern Graphics_Context g_sContext; //***************************************************************************** // the function prototypes //***************************************************************************** extern void Graphics_drawImageButton(const Graphics_Context *context, const Graphics_ImageButton *imageButton); extern bool Graphics_isImageButtonSelected( const Graphics_ImageButton *imageButton, uint16_t x, uint16_t y); extern void Graphics_drawSelectedImageButton(const Graphics_Context *context, const Graphics_ImageButton * imageButton); extern void Graphics_drawReleasedImageButton(const Graphics_Context *context, const Graphics_ImageButton * imageButton); #endif /* IMAGEBUTTON_H_ */
{ "pile_set_name": "Github" }
// // FBAppDelegate.h // AnnotationClustering // // Created by Filip Bec on 06/04/14. // Copyright (c) 2014 Infinum Ltd. All rights reserved. // #import <UIKit/UIKit.h> @interface FBAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
{ "pile_set_name": "Github" }
--- layout: post title: "「译」iOS 9,为前端世界都带来了些什么?" subtitle: "iOS 9, Safari and the Web: 3D Touch, new Responsive Web Design, Native integration and HTML5 APIs" date: 2015-12-15 author: "Hux" header-img: "img/post-bg-ios9-web.jpg" catalog: true tags: - Web - 译 --- 2015 年 9 月,Apple 重磅发布了全新的 iPhone 6s/6s Plus、iPad Pro 与全新的操作系统 watchOS 2 与 tvOS 9(是的,这货居然是第 9 版),加上已经发布的 iOS 9,它们都为前端世界带来了哪些变化呢?作为一个 web 开发者,是时候站在我们的角度来说一说了! > **注!** 该译文存在大量英文术语,笔者将默认读者知晓 ES6、viewport、native app、webview 等常用前端术语,并不对这些已知术语进行汉语翻译 > 对于新发布或较新的产品名称与技术术语,诸如 Apple Pen、Split View 等专有名词,笔者将在文中使用其英文名,但会尝试对部分名词进行汉语标注 > 另外,出于对 wiki 式阅读的偏爱,笔者为您添加了很多额外的链接,方便您查阅文档或出处 ## 简而言之 如果你不想阅读整篇文章,这里为你准备了一个总结: #### 新的设备特性 * iPhone 6s 与 6s Plus 拥有 **“[3D Touch](http://www.apple.com/iphone-6s/3d-touch/)”**,这是一个全新的硬件特性,它可以侦测压力,是一个可以让你拿到手指压力数据的 API * iPad Pro 的 viewport 为 1024px,与以往的 iPad 全都不同 * 想在 iPad Pro 上支持新的 Apple Pen?不好意思,目前似乎并没有适用于网站的 API #### 新的操作系统特性(与 web 相关的) * iPad 上的 Safari 现在可以通过 [Split View](https://developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/QuickStartForSlideOverAndSplitView.html#//apple_ref/doc/uid/TP40015145-CH13-SW1)(分屏视图)与其他应用一起使用,这意味着新的 viewport 尺寸将会越来越常见 * 新的 Safari View Controller([`SFSafariViewController`](https://developer.apple.com/library/prerelease/ios/documentation/SafariServices/Reference/SFSafariViewController_Ref/index.html#//apple_ref/occ/cl/SFSafariViewController))可以让你在 native app 内提供与 Safari 界面、行为连贯一致的应用内网页浏览体验 * 注意啦!Safari 新加入了 Content Blocker(内容拦截器)。以后,并不是所有的访问都一定会出现在你的 Google Analytics 了 * [Universal Links](https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12) 可以让应用的拥有者在 iOS 内部“占有”自己的域名。因此,访问 yourdomain.com 将会打开你的应用(类似 Android 的 Intents 机制) * [App Search(应用搜索)](https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/index.html#//apple_ref/doc/uid/TP40016308):现在,Apple 将会抓取你的网页内容(与 native app 内容)用于 Spotlight 与 Siri 的搜索结果,[想知道你的标签都兼容吗?](https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/WebContent.html#//apple_ref/doc/uid/TP40016308-CH8) * 你的网站现在可以通过 JavaScript API 访问 iCloud 的用户数据 #### 新的 API 支持 * [Performance Timing API](https://developer.mozilla.org/en-US/docs/Web/API/Performance/timing) 在 iOS 9 得到回归 * 关于 HTML5 Video,你现在可以在支持 [Picture in Picture(画中画)](https://developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/QuickStartForPictureInPicture.html#//apple_ref/doc/uid/TP40015145-CH14)的 iPad 设备上提供这项新功能;你的视频甚至可以在 Safari 关闭后继续播放 * 更好的 ES6 支持:classes(类), computed properties(可计算属性), template literals(模版字符串)等 * Backdrop CSS filters(背景滤镜) * CSS @supports 与 CSS Supports JavaScript API * CSS Level4 伪选择器 * 用于支持分页内容的 CSS Scroll Snapping * WKWebView 现在可以访问本地文件了 * 我们仍然需要等待 Push Notification,camera access,Service Workers 这些现代 web API 的到来 #### 新的操作系统 * 新一代 Apple TV 的 **tvOS**: 没有浏览器,也没有 webview。但是 JavaScript、XHR 和 DOM 可以通过一个叫做 TVML 的标记语言来使用 * Apple Watch 的 **watchOS**:完全没有任何浏览器和 webview > **再注!** 由于原文写于 Apple 发布会之前,为了不让读者感到奇怪,笔者将会对文章进行适当改写与补充,以保证本文的连贯性 ## 新的 iOS 设备特性 ### iPhones 6s 与 3D Touch 从 web 设计与开发的角度来说,新的 iPhone 6s 与 6s Plus 与之前的版本并没有太多差别。不过,有一个特性注定会吸引我们的目光:**3D Touch** 我们无法确定 Apple 是不是只是重命名了一下 “Force Touch”(用于 Apple Watch、TrackPad 2 与最新的 MacBook 上)或者 3D Touch 的确是一个为 iPhone 定制的似曾相识却不同的东西。3D Touch 允许操作系统和应用侦测每一个手指与屏幕接触时的压力。从用户体验的角度来说,最大的变化莫过于当你用点力去触碰或者拖拽屏幕时,操作系统将会触发诸如 peek,pop 这些新机制。那么问题来了:**我们是否能够在网站中使用这个新玩意呢?让我们一点点来看:** iOS 9 搭载的 Safari 包含了一些用于 “Force Touch” 的新 API,但它们其实并不是那个用于 iPhone 6s 3D Touch 的 API。你可以理解为这些 API 就是 MacBook 版 Safari 里为 Force Touch 准备的那些 API ,因为共享一套 codebase,所以它理所当然得存在了 iOS 版里而已。 Force Touch API 为我们添加了两个新东西: 1. 你的 click 事件处理函数将会从 MouseEvent 中收到一个新的属性:`webkitForce` 2. DOM 也新增了四个事件:`(webkit)mouseforcewillbegin`,`mouseforcedown`,`mouseforceup` 与 `mouseforcechange`。下边的示意图将告诉你这些事件是在何时被触发的: ![Force Events](http://www.mobilexweb.com/wp-content/uploads/2015/09/foceevents.png) 相信你已经从它们的名字中意识到了,这些事件都是基于鼠标而非触摸的,毕竟它们是为 MacBook 设计的。并且,TouchEvent 也并没有包含 `webkitForce` 这个属性,它仅仅存在于 MouseEvent 里。在 iOS Safari 里,你确实可以找到 `onwebkitmouseforce` 这一系列事件处理器,但是很可惜它们并不会被触发,click 返回的 MouseEvent 也永远只能得到一个 `webkitForce: 0` 可喜可贺的是,故事还没有结束。[Touch Events v2 draft spec(触摸事件第二版草案)](https://w3c.github.io/touch-events/) 中正式添加了 `force` 属性。3D Touch 也得以在 iPhone 6s 与 6s+ 中通过 TouchEvent 访问到。不过,笔者也要在这里提醒大家,由于没有 `webkitmouseforcechange` 这样给力的事件,在手机上我们只能通过 **轮询 TouchEvent 的做法** 来不断检测压力值的改变……非常坑爹 [@Marcel Freinbichler](https://twitter.com/fr3ino) 第一个在 Twitter 上晒出了自己的 [Demo](http://freinbichler.me/apps/3dtouch)。在 6s 或 new Macbook 的 Safari(目前仅 Safari 支持)上访问就可以看到圆圈会随着压力放大。墙内的小伙伴可以直接试试下面这个圆圈,体验下 3D/Force Touch 带来的的奇妙体验。 <iframe src="//huangxuan.me/forcify/" style=" width:100%; height:500px; border: 0; "></iframe> 如果你不巧在用不支持 3D/Force Touch 的设备,发现尼玛用力按下去之后居然圆圈也有反映!? 放心,这真的不是你的设备突然习得了“感应压力”这项技能,而是因为 [Forcify](http://huangxuan.me/forcify) 是一个用于在所有设备上 polyfill 3D/Force Touch API 的 JS 库……它不但封装了 OSX/iOS 两个平台之间 API 的差异,还使用"长按"来模拟了 `force` 值的变化…… ### iPad Pro 全新的 iPad Pro(12.9 寸)打破了以往 iPad 渲染网站的方式。在此之前,市面上所有的 iPad(从初代 iPad,到 iPad Air 4,到 iPad Mini)都是以 768px 的宽度提供 viewport。 而屏幕更大的 iPad Pro 选择了宽 1024px 的 viewport,这使得它天生就能容纳更多的内容。不少人说iPad Pro 就是抄 Microsft Surface Pro 的嘛……嗯哼,IE/Edge 在 Surface Pro 上就是以 1024px 作为视口宽度的…… 从交互的角度上来说,iPad Pro 虽然不支持 3D Touch,但是可以搭配 Smart Keyboard 与/或 Apple Pen(带有压力侦测)使用。对于键盘其实并没有什么好说的,如果一个网站在搭配键盘的桌面电脑上好用,它在 iPad Pro 上应该也不赖。而对于 Apple Pen,很可惜,目前似乎并没有 API 能让你在网站上获得这根笔的压力与角度。 ## 新的 iOS 操作系统特性 ### iPad 上的多任务处理 自 iOS 9 起,iPad 允许两个应用在同一时刻并肩执行,有三种方式:**Slide Over**,**Split View** 与 **Picture-in-Picture**。不过,每一种方式都有其硬件需求,比如说 Slide Over 需要 iPad Air, iPad Mini 2 以上的设备,而 Split View 由于对内存的要求目前只支持 iPad Air 2 与 iPad Pro。 #### Slide Over(滑过来!) Slide Over 支持的 App 并不多,不过 Safari 名列其中,这意味着我们的网站将可能在这个模式下被渲染。当网站处于 Slide Over 模式下时,它将在屏幕的右 1/4 位置渲染,并且置于其他 native app 之上。 这个模式也为 Responsive Web Design(响应式网站设计)提出了新的挑战:**一个只为 iPad 优化的网站,也需要能在该设备上以无需手动刷新的形式支持小屏幕的渲染。**因此,如果你正在使用服务器端探测(RESS),那么你的 iPad 版本需要以某种方式包含手机版本的网站,或者在进入该模式后重新加载一次。(如果你不了解 RESS,你可以观看我的[另一篇博文](/2014/11/20/responsive-web-design/)) ![Slide Over](http://www.mobilexweb.com/wp-content/uploads/2015/09/slideover.png) 在这个模式下,无论横屏还是竖屏,所有的 iPad(包括 Pro)都会把你的网站以 320px 的 viewport 宽度进行渲染,就好像在一个大 iPhone 5 上一样。你可以在 CSS 中通过 media query(媒体查询)探测到这个模式: ```css /* iPad Air or iPad Mini */ (device-width: 768px) and (width: 320px) /* iPad Pro */ (device-width: 1024px) and (width: 320px) ``` #### Split View(分屏视图) 在较新版本的 iPad 上,你可以将 Slide Over 的 Side View(侧视图)升级为 Split View。此时,两个应用将以相同比例在你的屏幕上同时工作。 在这个模式下,我们的网站将可能…… * **以屏幕 1/3 比例渲染时**,viewport 在 iPad Air/mini 犹如 iPhone 5,宽 320px。而在 iPad Pro 上则像是 iPhone 6:宽 375px * **以屏幕 1/2 比例渲染时**,viewport 在 iPad Air/mini 上呈现为 507px 宽,而在 iPad Pro(横屏)下呈现为 678px 宽 * **以屏幕 2/3 比例渲染时**,viewport 在 iPad Air/mini 上呈现为 694px 宽,而在 iPad Pro(横屏)下呈现为 981px 宽 ![Split View](http://www.mobilexweb.com/wp-content/uploads/2015/09/splitview.png) #### Picture in Picture(画中画) 在一些较新版本的 iPad 上,使用 HTML5 video 标签的网站可以将其暴露到 Picture in Picture 机制中。通过 API(本文稍后会讲)或用户的触发,视频可以独立于网站在其他应用的上方继续播放。 ![Picture in Picture](http://www.mobilexweb.com/wp-content/uploads/2015/09/pip.png) ### iOS 9 下的响应式网页设计 下图向你展示了 iOS 9 所有可能的 viewport 尺寸,检查检查你的响应式断点都包含它们了吗? ![iOS 9 RWD](http://www.mobilexweb.com/wp-content/uploads/2015/09/ios9rwd.png) ### Safari View Controller 如果你用过 Twitter 或者 Facebook(或者微信,微博……),那么你一定知道很多 native app 在打开一个网页链接时并不会默认使用 Safari。它们试图让你留在它们的应用里,所以通过提供 webview 让你在应用内进行网页浏览。可是问题在于,这类 webview 并不会与浏览器共享 cookies,sessions,autofill(自动填充)与 bookmark(书签),为了解决这些问题,就有了 Safari View Controller。 现在,native app 可以使用 Safari View Controller 来打开网站,它提供与 Safari 完全一致的隐私政策、local storage,cookies、sessions 同时让用户留在你的 app 中,它通过一个 “Done”(完成)按钮使用户可以回到 native app 的上一个 controller。这个全新的 controller 还可以让我们在 Share(分享)按钮上添加自定义的操作,这些操作在用户使用 Safari 应用时并不会出现。同时,native app 对这个自定义 Safari 实例具有完全的内容控制,你可以屏蔽不想被渲染的内容。 当你需要基于 web 的鉴权,比如 OAuth 时,使用 Safari View Controller 同样是一个好主意,这样就不再需要打开浏览器再重定向回你的应用。不过注意了,Safari View Controller 只适用于在线、公开的 web 内容。如果你的 web 内容假设在本地或者私服,那么 WKWebView 仍然是最推荐的选择。 > 笔者八卦一下,Safari View Controller 实际上也算是半个社区推进的产物。早在 2014 年 12 月,Tumblr 的 iOS 工程师 Bryan 就发表了一篇著名的 [We need a “Safari view controller”](http://bryan.io/post/104845880796/we-need-a-safari-view-controller) 叙述现有 webview 在第三方登录鉴权时的窘境。 > 2015 年 6 月,Apple Safari 工程师 Ricky Mondello 的 Twitter 宣告了这个设想的落地:You all asked for it. Come see me introduce it. Introducing Safari View Controller 1:30 PM, Tuesday. Nob Hill. ### Safari Content Blockers 现在,iOS 9 上的 Safari 支持一种全新的 App Extensions(应用拓展):**Content Blocker**(内容拦截器)。这类拓展以 native app 的形式存在,你可以在 App Store 上下载到,它们可以拦截 Safari 内的任何内容,包括:跟踪器、广告、自定义字体、大图片、JavaScript 文件等等。 作为 web 开发者,尽管我们不能禁用 Content Blocker,我们仍然应该注意到它们的存在。诸如 Crystal 的一些拦截器宣称他们[可以提高网页的打开速度](http://murphyapps.co/blog/2015/8/22/crystal-benchmarks)。Crystal 声称可以加快网页的加载速度 3.9 倍并且少用 53% 的带宽。不过问题是:到底哪些东西被拦截器拦截了?[这篇文章](http://thenextweb.com/apple/2015/08/27/content-blocking-in-ios-9-is-going-to-screw-up-way-more-than-just-ads/)提到了一些我们未来可能会遇到的问题。 ![crystal](http://www.mobilexweb.com/wp-content/uploads/2015/09/crystal.png) 在 iOS 9 发布后,Peace,一个 Content Blocker,曾在 App Store 排名跻身前十。从用户的角度来说,如果一个网站由于被 Content Blocker 拦截了某些重要资源而不能正常工作,你可以长按重新加载按钮并且以不启用 Content Blocker 的方式重新加载这个网站(见下图,来自 MacWorld.com) ![disable content blocker](http://www.mobilexweb.com/wp-content/uploads/2015/09/macworld.png) Content Blocker 能隐藏元素,也有能力通过 CSS 选择器、域名、类型、或者 URL 来过滤并拦截某个文件的加载,[Purify Blocker](https://itunes.apple.com/us/app/purify-blocker-fast-clutter/id1030156203?ls=1&mt=8) 给用户提供了拦截某一种内容类型的进阶选项,比如 Web Fonts。 ![purify](http://www.mobilexweb.com/wp-content/uploads/2015/09/purify.png) ### WKWebView 的增强 UIWebView 已经被官方弃用,虽然它还在在那,不过它再也不会得到什么升级。与此相反,WKWebView 正在取代它的位置。一个最受期待的特性现在终于推出:加载本地文件到 WKWebView。因此,现在 Apache Cordova 应用与其他 web 内容都可以直接从 iOS 包中使用本地文件了,不再需要各种诡异的 hack 了。 此外,还有一些新特性也一并推出。比如说,通过 WKWebsiteDataStore,Objective-C 或 Swift 有能力查询与管理 webview 的本地存储(比如 localStorage 或 IndexedDB)。这就允许我们将原有的数据存储替换成新的某些东西,比如说替换成一个不永久的(Chrome for iOS 的隐身模式就需要这种东西) ### Universal Links(通用链接) 如果你既有一个网站,又有一个 native app,你现在可以通过 Universal Links 来增强用户体验。它允许你在操作系统内“占有”自己的域名,这样,一切指向你网站的链接都会被重定向到你的 app。 目前,所有的 app 都是通过自定义 URI 来达到这个效果的,比如 `comgooglemaps://` 就可以用来从网站或者其他原生 iOS 应用中打开 Google Maps。 想要提供这个特性的话,你首先需要在 native app 中实现 Deep Linking(深度链接),让应用中的内容与 Safari 的 URL 吻合。然后,你需要在 Apple 的网站上关联你的域名,取得这个域名的 SSL 认证并且把签名后的 JSON 部署到该域名上。这是为了防止第三方的应用“占据”了属于你而不属于他们的域名,比如说 twitter.com 被非 Twitter 的其他应用占据掉。 目前唯一的缺点是用户好像并不能决定到底以哪种方式来打开内容(使用 web 还是 app),不过我们可以观望一段时间看看它会如何发展。在不远的这段时间里,你可能会发现在网站或 Google 搜索里点击一个链接时会没有任何预警的就跳进了 native app 里。 ### App Search(应用搜索) Apple 带着自己的 web 蜘蛛杀进了搜索的市场,而我们需要支持它得以在 Siri 与 Spotlight 中提升自己的曝光率。这在我们同时拥有网站与 app 时尤为重要,因为现在 Apple 会索引你网站的内容,但打开时却可能将用户带到了 app 里去。 尽管这会开启 SEO 的新篇章,不过却相当容易。你需要使用一些标签标准,诸如 [Web Schema](http://schema.org/)、[AppLinks](http://applinks.org)、[OpenGraph](http://ogp.me) 或者 [Twitter Cards](https://dev.twitter.com/cards/mobile),配合上 App Banner 与 `app-argument`,如果你有你自己的 native app 的话。 > 关于“让你的网页支持 Apple 搜索”的更多详情,请查阅 Apple 官方文档 [Mark Up Web Content](https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/WebContent.html#//apple_ref/doc/uid/TP40016308-CH8-SW5) Apple 刚刚发布了一个 [App Search Validation Tool(应用搜索验证工具)](https://search.developer.apple.com/appsearch-validation-tool/)来帮助你搞清楚,需要向你的网站添加什么才能支持 App Search ![App Search](http://www.mobilexweb.com/wp-content/uploads/2015/09/appsearch-1024x467.png) ### CloudKit JS 如果你拥有一个 native app,你很可能会将用户数据保存在 iCloud 上。在过去,只有 iOS 与 Mac 应用被允许使用它。现在,通过 CloudKit JS,你的网站也可以连接上 iCloud 数据了。 ### Back Button 现在,当你链接到一个 native app 时(通过自定义 URI 或者 Universal Link),Safari 会询问用户是否想要使用 native app 打开这个链接(见下图)。如果用户同意了,这个应用将被打开,并且在左上角会有一个返回按钮可以返回 Safari ,返回到你的网站。 <img src="http://www.mobilexweb.com/wp-content/uploads/2015/09/back.png" alt="backbutton" width="320" /> ## 新的 API 支持 ### Navigation Timing API Navigation Timing API 在 iOS 9 迎来了回归。让我们回忆一下,这货添加于 8.0 却在一周后的 8.1 中去掉了。这对于 Web 性能是个好消息。通过这个 API,我们可以更精确的测量时间,还可以获得一系列有关加载过程的时间戳,它们对于追踪与在真实场景中做决策来改进用户体验都非常有用。 ### Picture in Picture PiP API(被称为 Presentation Mode API)目前只支持 iOS,它允许我们手动让一个 `<video>` 元素进入或离开 PiP 模式如果 `video.webkitSupportsPresentationMode` 是支持的。 举个例子,我们可以在内嵌模式与 PiP 模式中切换: ```js video.webkitSetPresentationMode( video.webkitPresentationMode === "picture-in-picture" ? "inline" : "picture-in-picture" ); ``` 我们还可以通过新的 `onwebkitpresentationmodechanged` 事件来检测 Presentation Mode(展示模式)的变化。 ### Backdrop CSS iOS 7 与最近的 Mac OS 使用 Backdrop filter(背景滤镜)来模糊背景(指 native 开发),而在网站上实现这个却并不容易。 iOS 9 上的 Safari 现在支持了来自 Filter Effect v2 spec(滤镜特效第二版规范)的 **backdrop-filter**。比如说,我们可以使用一个半透明的背景并且对其背后的背景使用滤镜: ```css header { background-color: rgba(255, 255, 255, 0.4); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); } ``` ![backdrop](http://www.mobilexweb.com/wp-content/uploads/2015/09/backdrop.png) ### CSS Scroll Snapping 在 web 上实现分页内容(比如相册跑马灯)总是非常麻烦,无论是使用 JavaScript 框架、touch 事件还是 hacking 滚动条等等。Apple 新添加了一个很赞的 CSS 特性叫做 CSS Scroll Snapping。这个特性新增了一系列的 CSS 属性让你定义规则或者不规则的 snap zone(停留区域),这样滚动的位置就会“啪”地一下停在这个区域,而非像以前一样可以停在任何地方。 来看个例子: ```css #photo-gallery{ width: 100%; overflow-x: scroll; -webkit-scroll-snap-points-x: repeat(100%); -webkit-scroll-snap-type: mandatory; } ``` > 想要看个跑起来后的例子?笔者为大家准备了 webkit 的官方 [demo](http://www.webkit.org/demos/scroll-snap/),不过这个属性目前只支持 iOS 9 Safari 哦,并不支持 webview ### CSS Supports CSS Supports,包括 CSS `@supports` 与来自 CSS Conditional Rules Module Level 3 spec 的 JavaScript CSS Supports API 都在 iOS 上迎来降临。现在,我们可以针对某个 CSS 属性的特定值的支持情况来编写代码: ```css @supports(-webkit-scroll-snap-type: mandatory) { /* we use it */ } ``` 同样,使用 JavaScript: ```js if (CSS.supports("-webkit-scroll-snap-type", "mandatory")) {} ``` ### 一些细微的改进 * ECMAScript 6 的更完善支持:classed、computed properties、template literial 与 week sets * 新的 CSS Level4 伪类/元素选择器:`:not`、`:matches`、`:any-link`、`:placeholder-shown`、`:read-write`、`:read-only` * Native app 现在可以通过 extension 来向 Safari 的 Shared Links(分享链接)窗口上注入信息 * 大量无前缀 CSS 属性的支持(终于),比如 transition、animation、@keyframes、flex 与 columns * Mac OS El Capitán 上的 Safari 9 提供了一个全新设计的 Web Inspector(Web 检查器)。幸运的是,iOS 9 的远程调试完全兼容 Mac OS 上的 Safari 8,所以你倒是不用急着升级你的 Mac OS * iOS 9 通过 `-apple-font` 加入了一些 Dynamic Fonts(动态字体),并且它们现在应用的是 Apple 的新字体:San Francisco,笔者的博客就已经用上它啦 * scrollingElement 现在可用了 * `<input type=file>` 现在允许你从 iCloud Drive 与已安装的第三方应用,比如 Google Drive 中选择文件 <img src="http://www.mobilexweb.com/wp-content/uploads/2015/09/IMG_2017.png" alt="input file" width="320" /> * 当你加载一个 HTTPS 协议的页面时,你不能混用 HTTP 与 HTTPS 的资源 ## Bugs Bug 通常都要在几周之后才会显露出来,我也会持续跟进并更新这篇文章。目前为止,我的发现如下: * 对于 Home Screen webapps(添加至主屏的 web 应用),`apple-mobile-web-app-status-bar-style` 这个 meta 标签不起作用了!所以你现在不能再像过去一样使用 `black-translucent` 让你的 webapp 渲染在状态栏的后面了。(iOS 9.2 fixed 了这个 bug) * Speech Synthesis API (语音综合 API)不再工作了 ## 仍在等待…… 当 Mac 上的 Safari、桌面电脑与 Android 上的 Chrome 都已经为网站支持 Push Notification (通知推送)时,iOS 上的 Safari 仍然不支持这个特性。就 API 而言,我们仍然没有:WebRTC、getUserMedia、Service Worker、FileSystem API、Network Information API、Battery Status API、Vibration API 等等……你又在 iOS 上等待哪些特性呢? ## watchOS 与 tvOS 新发布的 watchOS 2.0 与 tvOS 9.0 都是基于 iOS 的操作系统,它们针对特定的设备发行(Apple Watch 与新的 Apple TV)。从用户的角度来说,那里并没有浏览器了。从开发者的角度,那里也没有 Webview 了。 尽管有不少人抱怨(大部分都是针对 webview 的缺失),我并不能确定这是不是个坏主意。我猜测 Apple 会尝试通过 Siri 来将 “web” 带给 TV、手表、甚至 CarPlay 的用户。所以,如果你遵循了上述的 “App Search” 的步骤,你的内容将可能通过 Siri 在这些设备上以 widget(小部件)或者快捷回复的形式变得可以访问。 对于 Apple TV ,它支持使用 JavaScript、DOM API 与 XMLHttpRequest 来让我们构建某种类似 Client-Server webapp 的东西。没有 HTML 和 CSS,这是什么把戏?其实它支持的叫 TVML,是一种基于 XML、为那些可以被渲染在 TV 屏幕上的特定内容而优化后的标签。这些标签只可以在来自应用商店的 native app 中渲染,但是这些 TVML 是由服务器端来生成的。 ## 著作权声明 本文译自 [iOS 9, Safari and the Web: 3D Touch, new Responsive Web Design, Native integration and HTML5 APIs --- Breaking the Mobile Web](http://www.mobilexweb.com/blog/ios9-safari-for-web-developers) 译者 [黄玄](http://weibo.com/huxpro),首次发布于 [Hux Blog](http://huangxuan.me),转载请保留以上链接
{ "pile_set_name": "Github" }
include 'meta_dataset/learn/gin/setups/mini_imagenet.gin' EpisodeDescriptionConfig.num_support = 5 include 'meta_dataset/learn/gin/models/baselinefinetune_cosine_config.gin' LearnerConfig.learning_rate = 1e-4 LearnerConfig.decay_learning_rate = True
{ "pile_set_name": "Github" }
"""SCons.Tool.swig Tool-specific initialization for swig. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ from __future__ import print_function # # Copyright (c) 2001 - 2017 The SCons Foundation # # 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. # __revision__ = "src/engine/SCons/Tool/swig.py 74b2c53bc42290e911b334a6b44f187da698a668 2017/11/14 13:16:53 bdbaddog" import os.path import re import subprocess import SCons.Action import SCons.Defaults import SCons.Tool import SCons.Util import SCons.Node verbose = False swigs = [ 'swig', 'swig3.0', 'swig2.0' ] SwigAction = SCons.Action.Action('$SWIGCOM', '$SWIGCOMSTR') def swigSuffixEmitter(env, source): if '-c++' in SCons.Util.CLVar(env.subst("$SWIGFLAGS", source=source)): return '$SWIGCXXFILESUFFIX' else: return '$SWIGCFILESUFFIX' # Match '%module test', as well as '%module(directors="1") test' # Also allow for test to be quoted (SWIG permits double quotes, but not single) # Also allow for the line to have spaces after test if not quoted _reModule = re.compile(r'%module(\s*\(.*\))?\s+("?)(\S+)\2') def _find_modules(src): """Find all modules referenced by %module lines in `src`, a SWIG .i file. Returns a list of all modules, and a flag set if SWIG directors have been requested (SWIG will generate an additional header file in this case.)""" directors = 0 mnames = [] try: matches = _reModule.findall(open(src).read()) except IOError: # If the file's not yet generated, guess the module name from the file stem matches = [] mnames.append(os.path.splitext(os.path.basename(src))[0]) for m in matches: mnames.append(m[2]) directors = directors or m[0].find('directors') >= 0 return mnames, directors def _add_director_header_targets(target, env): # Directors only work with C++ code, not C suffix = env.subst(env['SWIGCXXFILESUFFIX']) # For each file ending in SWIGCXXFILESUFFIX, add a new target director # header by replacing the ending with SWIGDIRECTORSUFFIX. for x in target[:]: n = x.name d = x.dir if n[-len(suffix):] == suffix: target.append(d.File(n[:-len(suffix)] + env['SWIGDIRECTORSUFFIX'])) def _swigEmitter(target, source, env): swigflags = env.subst("$SWIGFLAGS", target=target, source=source) flags = SCons.Util.CLVar(swigflags) for src in source: src = str(src.rfile()) mnames = None if "-python" in flags and "-noproxy" not in flags: if mnames is None: mnames, directors = _find_modules(src) if directors: _add_director_header_targets(target, env) python_files = [m + ".py" for m in mnames] outdir = env.subst('$SWIGOUTDIR', target=target, source=source) # .py files should be generated in SWIGOUTDIR if specified, # otherwise in the same directory as the target if outdir: python_files = [env.fs.File(os.path.join(outdir, j)) for j in python_files] else: python_files = [target[0].dir.File(m) for m in python_files] target.extend(python_files) if "-java" in flags: if mnames is None: mnames, directors = _find_modules(src) if directors: _add_director_header_targets(target, env) java_files = [[m + ".java", m + "JNI.java"] for m in mnames] java_files = SCons.Util.flatten(java_files) outdir = env.subst('$SWIGOUTDIR', target=target, source=source) if outdir: java_files = [os.path.join(outdir, j) for j in java_files] java_files = list(map(env.fs.File, java_files)) def t_from_s(t, p, s, x): return t.dir tsm = SCons.Node._target_from_source_map tkey = len(tsm) tsm[tkey] = t_from_s for jf in java_files: jf._func_target_from_source = tkey target.extend(java_files) return (target, source) def _get_swig_version(env, swig): """Run the SWIG command line tool to get and return the version number""" swig = env.subst(swig) pipe = SCons.Action._subproc(env, SCons.Util.CLVar(swig) + ['-version'], stdin = 'devnull', stderr = 'devnull', stdout = subprocess.PIPE) if pipe.wait() != 0: return # MAYBE: out = SCons.Util.to_str (pipe.stdout.read()) out = SCons.Util.to_str(pipe.stdout.read()) match = re.search('SWIG Version\s+(\S+).*', out, re.MULTILINE) if match: if verbose: print("Version is:%s"%match.group(1)) return match.group(1) else: if verbose: print("Unable to detect version: [%s]"%out) def generate(env): """Add Builders and construction variables for swig to an Environment.""" c_file, cxx_file = SCons.Tool.createCFileBuilders(env) c_file.suffix['.i'] = swigSuffixEmitter cxx_file.suffix['.i'] = swigSuffixEmitter c_file.add_action('.i', SwigAction) c_file.add_emitter('.i', _swigEmitter) cxx_file.add_action('.i', SwigAction) cxx_file.add_emitter('.i', _swigEmitter) java_file = SCons.Tool.CreateJavaFileBuilder(env) java_file.suffix['.i'] = swigSuffixEmitter java_file.add_action('.i', SwigAction) java_file.add_emitter('.i', _swigEmitter) if 'SWIG' not in env: env['SWIG'] = env.Detect(swigs) or swigs[0] env['SWIGVERSION'] = _get_swig_version(env, env['SWIG']) env['SWIGFLAGS'] = SCons.Util.CLVar('') env['SWIGDIRECTORSUFFIX'] = '_wrap.h' env['SWIGCFILESUFFIX'] = '_wrap$CFILESUFFIX' env['SWIGCXXFILESUFFIX'] = '_wrap$CXXFILESUFFIX' env['_SWIGOUTDIR'] = r'${"-outdir \"%s\"" % SWIGOUTDIR}' env['SWIGPATH'] = [] env['SWIGINCPREFIX'] = '-I' env['SWIGINCSUFFIX'] = '' env['_SWIGINCFLAGS'] = '$( ${_concat(SWIGINCPREFIX, SWIGPATH, SWIGINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' env['SWIGCOM'] = '$SWIG -o $TARGET ${_SWIGOUTDIR} ${_SWIGINCFLAGS} $SWIGFLAGS $SOURCES' def exists(env): swig = env.get('SWIG') or env.Detect(['swig']) return swig # Local Variables: # tab-width:4 # indent-tabs-mode:nil # End: # vim: set expandtab tabstop=4 shiftwidth=4:
{ "pile_set_name": "Github" }
@-webkit-keyframes vex-flyin { 0% { opacity: 0; -webkit-transform: translateY(-40px); transform: translateY(-40px); } 100% { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); } } @keyframes vex-flyin { 0% { opacity: 0; -webkit-transform: translateY(-40px); transform: translateY(-40px); } 100% { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); } } @-webkit-keyframes vex-flyout { 0% { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); } 100% { opacity: 0; -webkit-transform: translateY(-40px); transform: translateY(-40px); } } @keyframes vex-flyout { 0% { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); } 100% { opacity: 0; -webkit-transform: translateY(-40px); transform: translateY(-40px); } } @-webkit-keyframes vex-pulse { 0% { box-shadow: inset 0 0 0 300px transparent; } 70% { box-shadow: inset 0 0 0 300px rgba(255, 255, 255, 0.25); } 100% { box-shadow: inset 0 0 0 300px transparent; } } @keyframes vex-pulse { 0% { box-shadow: inset 0 0 0 300px transparent; } 70% { box-shadow: inset 0 0 0 300px rgba(255, 255, 255, 0.25); } 100% { box-shadow: inset 0 0 0 300px transparent; } } .vex.vex-theme-btcpay { padding-top: 160px; padding-bottom: 160px; } .vex.vex-theme-btcpay.vex-closing .vex-content { -webkit-animation: vex-flyout .5s forwards; animation: vex-flyout .5s forwards; } .vex.vex-theme-btcpay .vex-content { -webkit-animation: vex-flyin .5s; animation: vex-flyin .5s; } .vex.vex-theme-btcpay .vex-content { border-radius: 5px; background: #ffffff; color: #444; padding: 5px; position: relative; margin: 0 auto; max-width: 100%; width: 300px; font-size: 14px; } .vex.vex-theme-btcpay .vex-content h1, .vex.vex-theme-btcpay .vex-content h2, .vex.vex-theme-btcpay .vex-content h3, .vex.vex-theme-btcpay .vex-content h4, .vex.vex-theme-btcpay .vex-content h5, .vex.vex-theme-btcpay .vex-content h6, .vex.vex-theme-btcpay .vex-content p, .vex.vex-theme-btcpay .vex-content ul, .vex.vex-theme-btcpay .vex-content li { color: inherit; } .vex.vex-theme-btcpay .vex-close { display: none; } .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-message { margin-bottom: .5em; } .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input { margin-bottom: 1em; } .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input select, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input textarea, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="date"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="datetime"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="datetime-local"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="email"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="month"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="number"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="password"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="search"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="tel"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="text"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="time"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="url"], .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="week"] { border-radius: 3px; background: #fff; width: 100%; padding: .25em .67em; border: 0; font-family: inherit; font-weight: inherit; font-size: inherit; min-height: 2.5em; margin: 0 0 .25em; } .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input select:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input textarea:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="date"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="datetime"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="datetime-local"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="email"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="month"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="number"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="password"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="search"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="tel"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="text"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="time"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="url"]:focus, .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-input input[type="week"]:focus { box-shadow: inset 0 0 0 2px #8dbdf1; outline: none; } .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-buttons { *zoom: 1; } .vex.vex-theme-btcpay .vex-dialog-form .vex-dialog-buttons:after { content: ""; display: table; clear: both; } .vex.vex-theme-btcpay .vex-dialog-button { border-radius: 3px; border: 0; float: right; margin: 0 0 0 .5em; font-family: inherit; text-transform: uppercase; letter-spacing: .1em; font-size: .8em; line-height: 1em; padding: .75em 2em; } .vex.vex-theme-btcpay .vex-dialog-button.vex-last { margin-left: 0; } .vex.vex-theme-btcpay .vex-dialog-button:focus { -webkit-animation: vex-pulse 1.1s infinite; animation: vex-pulse 1.1s infinite; outline: none; } @media (max-width: 568px) { .vex.vex-theme-btcpay .vex-dialog-button:focus { -webkit-animation: none; animation: none; } } .vex.vex-theme-btcpay .vex-dialog-button.vex-dialog-button-primary { background: #3288e6; color: #fff; } .vex.vex-theme-btcpay .vex-dialog-button.vex-dialog-button-secondary { background: #e0e0e0; color: #777; } .vex-loading-spinner.vex-theme-btcpay { box-shadow: 0 0 0 0.5em #f0f0f0, 0 0 1px 0.5em rgba(0, 0, 0, 0.3); border-radius: 100%; background: #f0f0f0; border: .2em solid transparent; border-top-color: #bbb; top: -1.1em; bottom: auto; }
{ "pile_set_name": "Github" }
changelog: - type: HELM description: Add Extra ServiceAccount annotations to helm chart for Gloo, Discovery, and Proxy pods. issueLink: https://github.com/solo-io/gloo/issues/2698
{ "pile_set_name": "Github" }
# RUN: not llvm-mc -arch=hexagon -filetype=asm %s 2> %t; FileCheck %s < %t # # Check that changes to a read-only register is caught. { c9:8 = r1:0 } # CHECK: error: Cannot write to read-only register
{ "pile_set_name": "Github" }
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ syntax = "proto3"; package tensorflow; option cc_enable_arenas = true; option java_outer_classname = "ClusterProtos"; option java_multiple_files = true; option java_package = "org.tensorflow.distruntime"; // This file contains protos to be used when defining a TensorFlow // cluster. // // EXAMPLES // -------- // // 1. A single-process cluster, containing "/job:local/task:0". // // Cluster: // job { name: 'local' tasks { key: 0 value: 'localhost:2222' } } // // Server: // cluster { $CLUSTER } job_name: 'local' task_index: 0 // // 2. A two-process cluster, containing "/job:local/task:{0,1}". // // Cluster: // job { name: 'local' tasks { key: 0 value: 'localhost:2222' } // tasks { key: 1 value: 'localhost:2223' } } // // Servers: // cluster { $CLUSTER } job_name: 'local' task_index: 0 // cluster { $CLUSTER } job_name: 'local' task_index: 1 // // 3. A two-job cluster, containing "/job:worker/task:{0,1,2}" and // "/job:ps/task:{0,1}". // // Cluster: // job { name: 'worker' tasks { key: 0 value: 'worker1:2222' } // tasks { key: 1 value: 'worker2:2222' } // tasks { key: 2 value: 'worker3:2222' } } // job { name: 'ps' tasks { key: 0 value: 'ps0:2222' } // tasks { key: 1 value: 'ps1:2222' } } // // Servers: // cluster { $CLUSTER } job_name: 'worker' task_index: 0 // cluster { $CLUSTER } job_name: 'worker' task_index: 1 // cluster { $CLUSTER } job_name: 'worker' task_index: 2 // cluster { $CLUSTER } job_name: 'ps' task_index: 0 // cluster { $CLUSTER } job_name: 'ps' task_index: 1 // Defines a single job in a TensorFlow cluster. message JobDef { // The name of this job. string name = 1; // Mapping from task ID to "hostname:port" string. // // If the `name` field contains "worker", and the `tasks` map contains a // mapping from 7 to "example.org:2222", then the device prefix // "/job:worker/task:7" will be assigned to "example.org:2222". map<int32, string> tasks = 2; } // Defines a TensorFlow cluster as a set of jobs. message ClusterDef { // The jobs that comprise the cluster. repeated JobDef job = 1; }
{ "pile_set_name": "Github" }
'use strict'; /** * @ngdoc directive * @name webAppApp.directive:FileEditor * @description * # FileEditor */ angular.module('webAppApp') .directive('fileEditor', function () { return { templateUrl: 'views/directives/fileEditor.html', scope: { ngModel: '=', ngDisabled: '=', filesLocationUrl: '=', filesUploadUrl: '=' }, restrict: 'E', link: function postLink(scope, element, attrs) { }, controller: ['$scope', 'api', 'FileUploader', function ($scope, api, FileUploader) { var uploader = new FileUploader({ url: api.getStorageEndpoint(), removeAfterUpload: true, autoUpload: true }); $scope.uploader = uploader; $scope.showProgress = false; $scope.configuration = ''; uploader.onBeforeUploadItem = function () { $scope.showProgress = true; }; uploader.onAfterAddingFile = function () { uploader.queue[uploader.queue.length - 1].headers.Authorization = "Bearer " + api.getToken(); }; uploader.filters.push({ name: 'customFilter', fn: function (item /*{File|FileLikeObject}*/, options) { return this.queue.length < 10; } }); uploader.onErrorItem = function () { $scope.uploadedFileUrl = ''; }; uploader.onCompleteItem = function (fileItem, response) { debugger; $scope.ngModel = response.url; $scope.showProgress = false; }; function isUrl(str) { return !!str && str.indexOf('http') > -1; } function reload() { api.getConfiguration().then(function (response) { $scope.configuration = response.url; }); } reload(); }] }; });
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: 3c96b49acb6e2ef4d82261004ac19fda folderAsset: yes timeCreated: 1481915314 licenseType: Pro DefaultImporter: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
package zfs import ( "bytes" "context" "fmt" "io/ioutil" "os" "os/exec" "time" log "github.com/sirupsen/logrus" ) func doSimpleZFSCommand(cmd *exec.Cmd, description string) error { errBuffer := bytes.Buffer{} cmd.Stderr = &errBuffer err := cmd.Run() if err != nil { readBytes, readErr := ioutil.ReadAll(&errBuffer) if readErr != nil { return fmt.Errorf("error reading error: %v", readErr) } return fmt.Errorf("error running ZFS command to %s: %v / %v", description, err, string(readBytes)) } return nil } // zfsCommandWithRetries runs a given command, it will retry as long as ctx is not cancelled. func zfsCommandWithRetries(ctx context.Context, description, name string, arg ...string) error { var err error for { select { case <-ctx.Done(): return fmt.Errorf("deadline exceeded, last error: %s", err) default: cmd := exec.Command(name, arg...) bts, err := cmd.CombinedOutput() if err != nil { log.WithFields(log.Fields{ "error": err, "description": description, "output": string(bts), }).Warn("[zfsCommandWithRetries] failed to read error buffer after command failed") time.Sleep(500 * time.Millisecond) continue } // success! return nil } } } // TODO: why not use a logger and using a file with it // then tune the level? This is used aalllll over the codebase. func LogZFSCommand(filesystemId, command string) { // Disabled by default; we need to change the code and recompile to enable this. if false { f, err := os.OpenFile(os.Getenv("POOL_LOGFILE"), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644) if err != nil { panic(err) } defer f.Close() fmt.Fprintf(f, "%s # %s\n", command, filesystemId) } }
{ "pile_set_name": "Github" }
load("@tf_runtime//tools:mlir_to_bef.bzl", "glob_tfrt_lit_tests") licenses(["notice"]) # GPU tests glob_tfrt_lit_tests( data = [":test_utilities"], default_tags = ["requires-gpu-nvidia"], tags_override = { "tf_biasadd.benchmark.mlir": ["manual"], "tf_conv2d.benchmark.mlir": ["manual"], "tf_fusedbatchnorm.benchmark.mlir": ["manual"], "tf_reduction.benchmark.mlir": ["manual"], "tf_relu.benchmark.mlir": ["manual"], "multi_gpu.mlir": [ "manual", "notap", ], }, tfrt_translate = "@tf_runtime//backends/gpu:tfrt_gpu_translate", ) # Bundle together all of the test utilities that are used by tests. filegroup( name = "test_utilities", testonly = True, srcs = [ "@llvm-project//llvm:FileCheck", "@tf_runtime//tools:bef_executor", "@tf_runtime//tools:bef_name", ], )
{ "pile_set_name": "Github" }
<?php /* * Copyright 2014 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. */ class Google_Service_Appengine_OperationMetadataV1Beta extends Google_Collection { protected $collection_key = 'warning'; protected $createVersionMetadataType = 'Google_Service_Appengine_CreateVersionMetadataV1Beta'; protected $createVersionMetadataDataType = ''; public $endTime; public $ephemeralMessage; public $insertTime; public $method; public $target; public $user; public $warning; /** * @param Google_Service_Appengine_CreateVersionMetadataV1Beta */ public function setCreateVersionMetadata(Google_Service_Appengine_CreateVersionMetadataV1Beta $createVersionMetadata) { $this->createVersionMetadata = $createVersionMetadata; } /** * @return Google_Service_Appengine_CreateVersionMetadataV1Beta */ public function getCreateVersionMetadata() { return $this->createVersionMetadata; } public function setEndTime($endTime) { $this->endTime = $endTime; } public function getEndTime() { return $this->endTime; } public function setEphemeralMessage($ephemeralMessage) { $this->ephemeralMessage = $ephemeralMessage; } public function getEphemeralMessage() { return $this->ephemeralMessage; } public function setInsertTime($insertTime) { $this->insertTime = $insertTime; } public function getInsertTime() { return $this->insertTime; } public function setMethod($method) { $this->method = $method; } public function getMethod() { return $this->method; } public function setTarget($target) { $this->target = $target; } public function getTarget() { return $this->target; } public function setUser($user) { $this->user = $user; } public function getUser() { return $this->user; } public function setWarning($warning) { $this->warning = $warning; } public function getWarning() { return $this->warning; } }
{ "pile_set_name": "Github" }
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ // // Partitioner.cs // // <OWNER>Microsoft</OWNER> // // Represents a particular way of splitting a collection into multiple partitions. // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System; using System.Collections.Generic; using System.Security.Permissions; using System.Threading; namespace System.Collections.Concurrent { /// <summary> /// Represents a particular manner of splitting a data source into multiple partitions. /// </summary> /// <typeparam name="TSource">Type of the elements in the collection.</typeparam> /// <remarks> /// <para> /// Inheritors of <see cref="Partitioner{TSource}"/> must adhere to the following rules: /// <ol> /// <li><see cref="GetPartitions"/> should throw a /// <see cref="T:System.ArgumentOutOfRangeException"/> if the requested partition count is less than or /// equal to zero.</li> /// <li><see cref="GetPartitions"/> should always return a number of enumerables equal to the requested /// partition count. If the partitioner runs out of data and cannot create as many partitions as /// requested, an empty enumerator should be returned for each of the remaining partitions. If this rule /// is not followed, consumers of the implementation may throw a <see /// cref="T:System.InvalidOperationException"/>.</li> /// <li><see cref="GetPartitions"/> and <see cref="GetDynamicPartitions"/> /// should never return null. If null is returned, a consumer of the implementation may throw a /// <see cref="T:System.InvalidOperationException"/>.</li> /// <li><see cref="GetPartitions"/> and <see cref="GetDynamicPartitions"/> should always return /// partitions that can fully and uniquely enumerate the input data source. All of the data and only the /// data contained in the input source should be enumerated, with no duplication that was not already in /// the input, unless specifically required by the particular partitioner's design. If this is not /// followed, the output ordering may be scrambled.</li> /// </ol> /// </para> /// </remarks> [HostProtection(Synchronization = true, ExternalThreading = true)] public abstract class Partitioner<TSource> { /// <summary> /// Partitions the underlying collection into the given number of partitions. /// </summary> /// <param name="partitionCount">The number of partitions to create.</param> /// <returns>A list containing <paramref name="partitionCount"/> enumerators.</returns> public abstract IList<IEnumerator<TSource>> GetPartitions(int partitionCount); /// <summary> /// Gets whether additional partitions can be created dynamically. /// </summary> /// <returns> /// true if the <see cref="Partitioner{TSource}"/> can create partitions dynamically as they are /// requested; false if the <see cref="Partitioner{TSource}"/> can only allocate /// partitions statically. /// </returns> /// <remarks> /// <para> /// If a derived class does not override and implement <see cref="GetDynamicPartitions"/>, /// <see cref="SupportsDynamicPartitions"/> should return false. The value of <see /// cref="SupportsDynamicPartitions"/> should not vary over the lifetime of this instance. /// </para> /// </remarks> public virtual bool SupportsDynamicPartitions { get { return false; } } /// <summary> /// Creates an object that can partition the underlying collection into a variable number of /// partitions. /// </summary> /// <remarks> /// <para> /// The returned object implements the <see /// cref="T:System.Collections.Generic.IEnumerable{TSource}"/> interface. Calling <see /// cref="System.Collections.Generic.IEnumerable{TSource}.GetEnumerator">GetEnumerator</see> on the /// object creates another partition over the sequence. /// </para> /// <para> /// The <see cref="GetDynamicPartitions"/> method is only supported if the <see /// cref="SupportsDynamicPartitions"/> /// property returns true. /// </para> /// </remarks> /// <returns>An object that can create partitions over the underlying data source.</returns> /// <exception cref="NotSupportedException">Dynamic partitioning is not supported by this /// partitioner.</exception> public virtual IEnumerable<TSource> GetDynamicPartitions() { throw new NotSupportedException(Environment.GetResourceString("Partitioner_DynamicPartitionsNotSupported")); } } }
{ "pile_set_name": "Github" }
# amdefine A module that can be used to implement AMD's define() in Node. This allows you to code to the AMD API and have the module work in node programs without requiring those other programs to use AMD. ## Usage **1)** Update your package.json to indicate amdefine as a dependency: ```javascript "dependencies": { "amdefine": ">=0.1.0" } ``` Then run `npm install` to get amdefine into your project. **2)** At the top of each module that uses define(), place this code: ```javascript if (typeof define !== 'function') { var define = require('amdefine')(module) } ``` **Only use these snippets** when loading amdefine. If you preserve the basic structure, with the braces, it will be stripped out when using the [RequireJS optimizer](#optimizer). You can add spaces, line breaks and even require amdefine with a local path, but keep the rest of the structure to get the stripping behavior. As you may know, because `if` statements in JavaScript don't have their own scope, the var declaration in the above snippet is made whether the `if` expression is truthy or not. If RequireJS is loaded then the declaration is superfluous because `define` is already already declared in the same scope in RequireJS. Fortunately JavaScript handles multiple `var` declarations of the same variable in the same scope gracefully. If you want to deliver amdefine.js with your code rather than specifying it as a dependency with npm, then just download the latest release and refer to it using a relative path: [Latest Version](https://github.com/jrburke/amdefine/raw/latest/amdefine.js) ### amdefine/intercept Consider this very experimental. Instead of pasting the piece of text for the amdefine setup of a `define` variable in each module you create or consume, you can use `amdefine/intercept` instead. It will automatically insert the above snippet in each .js file loaded by Node. **Warning**: you should only use this if you are creating an application that is consuming AMD style defined()'d modules that are distributed via npm and want to run that code in Node. For library code where you are not sure if it will be used by others in Node or in the browser, then explicitly depending on amdefine and placing the code snippet above is suggested path, instead of using `amdefine/intercept`. The intercept module affects all .js files loaded in the Node app, and it is inconsiderate to modify global state like that unless you are also controlling the top level app. #### Why distribute AMD-style modules via npm? npm has a lot of weaknesses for front-end use (installed layout is not great, should have better support for the `baseUrl + moduleID + '.js' style of loading, single file JS installs), but some people want a JS package manager and are willing to live with those constraints. If that is you, but still want to author in AMD style modules to get dynamic require([]), better direct source usage and powerful loader plugin support in the browser, then this tool can help. #### amdefine/intercept usage Just require it in your top level app module (for example index.js, server.js): ```javascript require('amdefine/intercept'); ``` The module does not return a value, so no need to assign the result to a local variable. Then just require() code as you normally would with Node's require(). Any .js loaded after the intercept require will have the amdefine check injected in the .js source as it is loaded. It does not modify the source on disk, just prepends some content to the text of the module as it is loaded by Node. #### How amdefine/intercept works It overrides the `Module._extensions['.js']` in Node to automatically prepend the amdefine snippet above. So, it will affect any .js file loaded by your app. ## define() usage It is best if you use the anonymous forms of define() in your module: ```javascript define(function (require) { var dependency = require('dependency'); }); ``` or ```javascript define(['dependency'], function (dependency) { }); ``` ## RequireJS optimizer integration. <a name="optimizer"></name> Version 1.0.3 of the [RequireJS optimizer](http://requirejs.org/docs/optimization.html) will have support for stripping the `if (typeof define !== 'function')` check mentioned above, so you can include this snippet for code that runs in the browser, but avoid taking the cost of the if() statement once the code is optimized for deployment. ## Node 0.4 Support If you want to support Node 0.4, then add `require` as the second parameter to amdefine: ```javascript //Only if you want Node 0.4. If using 0.5 or later, use the above snippet. if (typeof define !== 'function') { var define = require('amdefine')(module, require) } ``` ## Limitations ### Synchronous vs Asynchronous amdefine creates a define() function that is callable by your code. It will execute and trace dependencies and call the factory function *synchronously*, to keep the behavior in line with Node's synchronous dependency tracing. The exception: calling AMD's callback-style require() from inside a factory function. The require callback is called on process.nextTick(): ```javascript define(function (require) { require(['a'], function(a) { //'a' is loaded synchronously, but //this callback is called on process.nextTick(). }); }); ``` ### Loader Plugins Loader plugins are supported as long as they call their load() callbacks synchronously. So ones that do network requests will not work. However plugins like [text](http://requirejs.org/docs/api.html#text) can load text files locally. The plugin API's `load.fromText()` is **not supported** in amdefine, so this means transpiler plugins like the [CoffeeScript loader plugin](https://github.com/jrburke/require-cs) will not work. This may be fixable, but it is a bit complex, and I do not have enough node-fu to figure it out yet. See the source for amdefine.js if you want to get an idea of the issues involved. ## Tests To run the tests, cd to **tests** and run: ``` node all.js node all-intercept.js ``` ## License New BSD and MIT. Check the LICENSE file for all the details.
{ "pile_set_name": "Github" }
/****************************************************************************** * Copyright 2019 The Apollo Authors. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *****************************************************************************/ #include "modules/data/tools/smart_recorder/small_topics_trigger.h" #include <set> #include <string> #include "cyber/common/log.h" #include "modules/data/tools/smart_recorder/channel_pool.h" namespace apollo { namespace data { SmallTopicsTrigger::SmallTopicsTrigger() { trigger_name_ = "SmallTopicsTrigger"; } bool SmallTopicsTrigger::ShouldRestore( const cyber::record::RecordMessage& msg) const { const std::set<std::string>& small_channels = ChannelPool::Instance()->GetSmallChannels(); return trigger_obj_->enabled() && small_channels.find(msg.channel_name) != small_channels.end(); } } // namespace data } // namespace apollo
{ "pile_set_name": "Github" }
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // +build !go1.11 package http2 import "net/textproto" func traceHasWroteHeaderField(trace *clientTrace) bool { return false } func traceWroteHeaderField(trace *clientTrace, k, v string) {} func traceGot1xxResponseFunc(trace *clientTrace) func(int, textproto.MIMEHeader) error { return nil }
{ "pile_set_name": "Github" }
{ "images" : [ { "idiom" : "universal", "filename" : "[email protected]", "scale" : "1x" }, { "idiom" : "universal", "filename" : "[email protected]", "scale" : "2x" }, { "idiom" : "universal", "filename" : "[email protected]", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" }, "properties" : { "template-rendering-intent" : "template" } }
{ "pile_set_name": "Github" }
package org.wikipedia.json; import com.google.gson.Gson; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; public class PostProcessingTypeAdapter implements TypeAdapterFactory { public interface PostProcessable { void postProcess(); } public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { final TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type); return new TypeAdapter<T>() { public void write(JsonWriter out, T value) throws IOException { delegate.write(out, value); } public T read(JsonReader in) throws IOException { T obj = delegate.read(in); if (obj instanceof PostProcessable) { ((PostProcessable)obj).postProcess(); } return obj; } }; } }
{ "pile_set_name": "Github" }
using ScottPlot.Renderer; using System.Diagnostics; namespace ScottPlot.Renderable { public class FigureBackground : IRenderable { public bool Visible { get; set; } = true; public bool AntiAlias { get; set; } = true; public PlotLayer Layer => PlotLayer.BelowData; public Color Color = Colors.White; public void Render(IRenderer renderer, Dimensions dims, bool lowQuality) { if (Visible == false) return; renderer.Clear(Color); } } }
{ "pile_set_name": "Github" }
tarball=polylib-VERSION.tar.gz sha1=72b23c09a50ce9583c419e8376544630d6f99ea3 md5=c0088786e0a5ae64b7cc47ad19ae4f83 cksum=116350713
{ "pile_set_name": "Github" }
# See README.md for usage information define apache::custom_config ( $ensure = 'present', $confdir = $::apache::confd_dir, $content = undef, $priority = '25', $source = undef, $verify_command = $::apache::params::verify_command, $verify_config = true, $filename = undef, ) { if $content and $source { fail('Only one of $content and $source can be specified.') } if $ensure == 'present' and ! $content and ! $source { fail('One of $content and $source must be specified.') } validate_re($ensure, '^(present|absent)$', "${ensure} is not supported for ensure. Allowed values are 'present' and 'absent'.") validate_bool($verify_config) if $filename { $_filename = $filename } else { if $priority { $priority_prefix = "${priority}-" } else { $priority_prefix = '' } ## Apache include does not always work with spaces in the filename $filename_middle = regsubst($name, ' ', '_', 'G') $_filename = "${priority_prefix}${filename_middle}.conf" } if ! $verify_config or $ensure == 'absent' { $notifies = Class['Apache::Service'] } else { $notifies = undef } file { "apache_${name}": ensure => $ensure, path => "${confdir}/${_filename}", content => $content, source => $source, require => Package['httpd'], notify => $notifies, } if $ensure == 'present' and $verify_config { exec { "syntax verification for ${name}": command => $verify_command, subscribe => File["apache_${name}"], refreshonly => true, notify => Class['Apache::Service'], before => Exec["remove ${name} if invalid"], require => Anchor['::apache::modules_set_up'], } exec { "remove ${name} if invalid": command => "/bin/rm ${confdir}/${_filename}", unless => $verify_command, subscribe => File["apache_${name}"], refreshonly => true, } } }
{ "pile_set_name": "Github" }
'use strict'; const os = require('os'); const hasFlag = require('has-flag'); const env = process.env; let forceColor; if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { forceColor = false; } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) { forceColor = true; } if ('FORCE_COLOR' in env) { forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; } function translateLevel(level) { if (level === 0) { return false; } return { level, hasBasic: true, has256: level >= 2, has16m: level >= 3 }; } function supportsColor(stream) { if (forceColor === false) { return 0; } if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) { return 3; } if (hasFlag('color=256')) { return 2; } if (stream && !stream.isTTY && forceColor !== true) { return 0; } const min = forceColor ? 1 : 0; if (process.platform === 'win32') { // Node.js 7.5.0 is the first version of Node.js to include a patch to // libuv that enables 256 color output on Windows. Anything earlier and it // won't work. However, here we target Node.js 8 at minimum as it is an LTS // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows // release that supports 256 colors. Windows 10 build 14931 is the first release // that supports 16m/TrueColor. const osRelease = os.release().split('.'); if ( Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586 ) { return Number(osRelease[2]) >= 14931 ? 3 : 2; } return 1; } if ('CI' in env) { if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { return 1; } return min; } if ('TEAMCITY_VERSION' in env) { return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } if (env.COLORTERM === 'truecolor') { return 3; } if ('TERM_PROGRAM' in env) { const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); switch (env.TERM_PROGRAM) { case 'iTerm.app': return version >= 3 ? 3 : 2; case 'Apple_Terminal': return 2; // No default } } if (/-256(color)?$/i.test(env.TERM)) { return 2; } if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { return 1; } if ('COLORTERM' in env) { return 1; } if (env.TERM === 'dumb') { return min; } return min; } function getSupportLevel(stream) { const level = supportsColor(stream); return translateLevel(level); } module.exports = { supportsColor: getSupportLevel, stdout: getSupportLevel(process.stdout), stderr: getSupportLevel(process.stderr) };
{ "pile_set_name": "Github" }
# Copyright (C) 2006 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # world ${.TARGETS}: @gmake $@
{ "pile_set_name": "Github" }
b.cBold { font-weight: bold } code.cCode { font-family: Courier New, Courier, mono } .codebox { background: #f1f5f9; border: 1px solid #c7cfd5; font-family: Courier New, Courier, mono margin: 20px 0; padding: 8px; text-align: left; } em.cEmphasis { font-style: italic } sub.cSubscript { vertical-align: sub } sup.cSuperscript { vertical-align: super } u.cUnderline { text-decoration: underline } p.pBody { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pBodyRelative { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-bottom: 6pt; margin-left: 0em; margin-right: 0em; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pCellBody { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pCellHeading { color: #FFFFFF; background-color: #999999; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: bold; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; text-align: center; text-decoration: none; text-indent: 0em; text-transform: none } p.pCopyrightText { color: #999999; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; margin-top: 0em; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } h2.pGroupTitlesIX { color: #CC0000; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } h2.pHeading1 { color: #CC0000; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: bold; margin-top: 0em; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } h3.pHeading2 { color: #CC0000; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } h4.pHeading3 { color: #CC0000; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 10px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } h5.pHeading4 { color: #CC0000; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 9px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pIndented1 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 2.5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pIndented2 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pIndented3 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 7.5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pIndented4 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 10em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pIndented5 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 12.5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pIndentedRelative { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 2.5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pLevel1IX { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 2.5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pLevel2IX { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pLevel3IX { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 7.5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pLevel4IX { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 10em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pLevel5IX { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 12.5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } h2.pNewHTMLPage { color: #CC0000; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: bold; margin-top: 0em; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pNoteTitle { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 0em; margin-right: 0em; margin-bottom: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pNote { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-top: 0em; margin-left: 1.25em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pPopup { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pPopupAppend { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pPreformatted { color: 666666; font-family: Courier New, Courier, mono; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pPreformattedRelative { color: 666666; font-family: Courier New, Courier, mono; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pRelatedTopic { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pSeeAlsoRef { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 10px; font-style: normal; font-variant: normal; font-weight: normal; margin-top: 0em; margin-bottom: 0em; margin-left: 2.5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pSmartList1 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-bottom: 6pt; margin-left: 0em; margin-right: 0em; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pSmartList2 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-bottom: 6pt; margin-left: 0em; margin-right: 0em; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pSmartList3 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-bottom: 6pt; margin-left: 0em; margin-right: 0em; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pSmartList4 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-bottom: 6pt; margin-left: 0em; margin-right: 0em; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pSmartList5 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; margin-bottom: 6pt; margin-left: 0em; margin-right: 0em; margin-top: 6pt; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } div.pTableTitle { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } h2.pTitle { color: #CC0000; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 18px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } h2.pTOC1 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 0em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pTOC2 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 2.5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pTOC3 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pTOC4 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 7.5em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pTOC5 { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: bold; margin-left: 10em; margin-right: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none } p.pWebSiteLink { color: #666666; font-family: 'Verdana', 'Arial', 'Helvetica', 'sans-serif'; font-size: 10px; font-style: normal; font-variant: normal; font-weight: bold; margin-top: 0em; margin-left: 0em; margin-right: 0em; margin-bottom: 0em; text-align: left; text-decoration: none; text-indent: 0em; text-transform: none }
{ "pile_set_name": "Github" }
org.jsoup.helper.DescendableLinkedList org.jsoup.helper.StringUtil org.jsoup.helper.Validate org.jsoup.Jsoup org.jsoup.nodes.Attributes org.jsoup.nodes.Comment org.jsoup.nodes.DataNode org.jsoup.nodes.Document org.jsoup.nodes.DocumentType org.jsoup.nodes.Element org.jsoup.nodes.Entities org.jsoup.nodes.Node org.jsoup.nodes.TextNode org.jsoup.parser.CharacterReader org.jsoup.parser.HtmlTreeBuilder org.jsoup.parser.HtmlTreeBuilderState org.jsoup.parser.ParseErrorList org.jsoup.parser.Parser org.jsoup.parser.Tag org.jsoup.parser.Token org.jsoup.parser.Tokeniser org.jsoup.parser.TokeniserState org.jsoup.parser.TokenQueue org.jsoup.parser.TreeBuilder org.jsoup.parser.XmlTreeBuilder org.jsoup.select.Collector org.jsoup.select.CombiningEvaluator org.jsoup.select.Elements org.jsoup.select.Evaluator org.jsoup.select.NodeTraversor org.jsoup.select.NodeVisitor org.jsoup.select.QueryParser org.jsoup.select.Selector
{ "pile_set_name": "Github" }
/* * This file is part of wl1271 * * Copyright (C) 2008-2010 Nokia Corporation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * */ #include <linux/module.h> #include <linux/platform_device.h> #include <linux/err.h> #include "../wlcore/wlcore.h" #include "../wlcore/debug.h" #include "../wlcore/io.h" #include "../wlcore/acx.h" #include "../wlcore/tx.h" #include "../wlcore/rx.h" #include "../wlcore/boot.h" #include "wl12xx.h" #include "reg.h" #include "cmd.h" #include "acx.h" #include "scan.h" #include "event.h" #include "debugfs.h" static char *fref_param; static char *tcxo_param; static struct wlcore_conf wl12xx_conf = { .sg = { .params = { [CONF_SG_ACL_BT_MASTER_MIN_BR] = 10, [CONF_SG_ACL_BT_MASTER_MAX_BR] = 180, [CONF_SG_ACL_BT_SLAVE_MIN_BR] = 10, [CONF_SG_ACL_BT_SLAVE_MAX_BR] = 180, [CONF_SG_ACL_BT_MASTER_MIN_EDR] = 10, [CONF_SG_ACL_BT_MASTER_MAX_EDR] = 80, [CONF_SG_ACL_BT_SLAVE_MIN_EDR] = 10, [CONF_SG_ACL_BT_SLAVE_MAX_EDR] = 80, [CONF_SG_ACL_WLAN_PS_MASTER_BR] = 8, [CONF_SG_ACL_WLAN_PS_SLAVE_BR] = 8, [CONF_SG_ACL_WLAN_PS_MASTER_EDR] = 20, [CONF_SG_ACL_WLAN_PS_SLAVE_EDR] = 20, [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_BR] = 20, [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_BR] = 35, [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_BR] = 16, [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_BR] = 35, [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MIN_EDR] = 32, [CONF_SG_ACL_WLAN_ACTIVE_MASTER_MAX_EDR] = 50, [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MIN_EDR] = 28, [CONF_SG_ACL_WLAN_ACTIVE_SLAVE_MAX_EDR] = 50, [CONF_SG_ACL_ACTIVE_SCAN_WLAN_BR] = 10, [CONF_SG_ACL_ACTIVE_SCAN_WLAN_EDR] = 20, [CONF_SG_ACL_PASSIVE_SCAN_BT_BR] = 75, [CONF_SG_ACL_PASSIVE_SCAN_WLAN_BR] = 15, [CONF_SG_ACL_PASSIVE_SCAN_BT_EDR] = 27, [CONF_SG_ACL_PASSIVE_SCAN_WLAN_EDR] = 17, /* active scan params */ [CONF_SG_AUTO_SCAN_PROBE_REQ] = 170, [CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_HV3] = 50, [CONF_SG_ACTIVE_SCAN_DURATION_FACTOR_A2DP] = 100, /* passive scan params */ [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_BR] = 800, [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_A2DP_EDR] = 200, [CONF_SG_PASSIVE_SCAN_DURATION_FACTOR_HV3] = 200, /* passive scan in dual antenna params */ [CONF_SG_CONSECUTIVE_HV3_IN_PASSIVE_SCAN] = 0, [CONF_SG_BCN_HV3_COLLISION_THRESH_IN_PASSIVE_SCAN] = 0, [CONF_SG_TX_RX_PROTECTION_BWIDTH_IN_PASSIVE_SCAN] = 0, /* general params */ [CONF_SG_STA_FORCE_PS_IN_BT_SCO] = 1, [CONF_SG_ANTENNA_CONFIGURATION] = 0, [CONF_SG_BEACON_MISS_PERCENT] = 60, [CONF_SG_DHCP_TIME] = 5000, [CONF_SG_RXT] = 1200, [CONF_SG_TXT] = 1000, [CONF_SG_ADAPTIVE_RXT_TXT] = 1, [CONF_SG_GENERAL_USAGE_BIT_MAP] = 3, [CONF_SG_HV3_MAX_SERVED] = 6, [CONF_SG_PS_POLL_TIMEOUT] = 10, [CONF_SG_UPSD_TIMEOUT] = 10, [CONF_SG_CONSECUTIVE_CTS_THRESHOLD] = 2, [CONF_SG_STA_RX_WINDOW_AFTER_DTIM] = 5, [CONF_SG_STA_CONNECTION_PROTECTION_TIME] = 30, /* AP params */ [CONF_AP_BEACON_MISS_TX] = 3, [CONF_AP_RX_WINDOW_AFTER_BEACON] = 10, [CONF_AP_BEACON_WINDOW_INTERVAL] = 2, [CONF_AP_CONNECTION_PROTECTION_TIME] = 0, [CONF_AP_BT_ACL_VAL_BT_SERVE_TIME] = 25, [CONF_AP_BT_ACL_VAL_WL_SERVE_TIME] = 25, /* CTS Diluting params */ [CONF_SG_CTS_DILUTED_BAD_RX_PACKETS_TH] = 0, [CONF_SG_CTS_CHOP_IN_DUAL_ANT_SCO_MASTER] = 0, }, .state = CONF_SG_PROTECTIVE, }, .rx = { .rx_msdu_life_time = 512000, .packet_detection_threshold = 0, .ps_poll_timeout = 15, .upsd_timeout = 15, .rts_threshold = IEEE80211_MAX_RTS_THRESHOLD, .rx_cca_threshold = 0, .irq_blk_threshold = 0xFFFF, .irq_pkt_threshold = 0, .irq_timeout = 600, .queue_type = CONF_RX_QUEUE_TYPE_LOW_PRIORITY, }, .tx = { .tx_energy_detection = 0, .sta_rc_conf = { .enabled_rates = 0, .short_retry_limit = 10, .long_retry_limit = 10, .aflags = 0, }, .ac_conf_count = 4, .ac_conf = { [CONF_TX_AC_BE] = { .ac = CONF_TX_AC_BE, .cw_min = 15, .cw_max = 63, .aifsn = 3, .tx_op_limit = 0, }, [CONF_TX_AC_BK] = { .ac = CONF_TX_AC_BK, .cw_min = 15, .cw_max = 63, .aifsn = 7, .tx_op_limit = 0, }, [CONF_TX_AC_VI] = { .ac = CONF_TX_AC_VI, .cw_min = 15, .cw_max = 63, .aifsn = CONF_TX_AIFS_PIFS, .tx_op_limit = 3008, }, [CONF_TX_AC_VO] = { .ac = CONF_TX_AC_VO, .cw_min = 15, .cw_max = 63, .aifsn = CONF_TX_AIFS_PIFS, .tx_op_limit = 1504, }, }, .max_tx_retries = 100, .ap_aging_period = 300, .tid_conf_count = 4, .tid_conf = { [CONF_TX_AC_BE] = { .queue_id = CONF_TX_AC_BE, .channel_type = CONF_CHANNEL_TYPE_EDCF, .tsid = CONF_TX_AC_BE, .ps_scheme = CONF_PS_SCHEME_LEGACY, .ack_policy = CONF_ACK_POLICY_LEGACY, .apsd_conf = {0, 0}, }, [CONF_TX_AC_BK] = { .queue_id = CONF_TX_AC_BK, .channel_type = CONF_CHANNEL_TYPE_EDCF, .tsid = CONF_TX_AC_BK, .ps_scheme = CONF_PS_SCHEME_LEGACY, .ack_policy = CONF_ACK_POLICY_LEGACY, .apsd_conf = {0, 0}, }, [CONF_TX_AC_VI] = { .queue_id = CONF_TX_AC_VI, .channel_type = CONF_CHANNEL_TYPE_EDCF, .tsid = CONF_TX_AC_VI, .ps_scheme = CONF_PS_SCHEME_LEGACY, .ack_policy = CONF_ACK_POLICY_LEGACY, .apsd_conf = {0, 0}, }, [CONF_TX_AC_VO] = { .queue_id = CONF_TX_AC_VO, .channel_type = CONF_CHANNEL_TYPE_EDCF, .tsid = CONF_TX_AC_VO, .ps_scheme = CONF_PS_SCHEME_LEGACY, .ack_policy = CONF_ACK_POLICY_LEGACY, .apsd_conf = {0, 0}, }, }, .frag_threshold = IEEE80211_MAX_FRAG_THRESHOLD, .tx_compl_timeout = 700, .tx_compl_threshold = 4, .basic_rate = CONF_HW_BIT_RATE_1MBPS, .basic_rate_5 = CONF_HW_BIT_RATE_6MBPS, .tmpl_short_retry_limit = 10, .tmpl_long_retry_limit = 10, .tx_watchdog_timeout = 5000, .slow_link_thold = 3, .fast_link_thold = 10, }, .conn = { .wake_up_event = CONF_WAKE_UP_EVENT_DTIM, .listen_interval = 1, .suspend_wake_up_event = CONF_WAKE_UP_EVENT_N_DTIM, .suspend_listen_interval = 3, .bcn_filt_mode = CONF_BCN_FILT_MODE_ENABLED, .bcn_filt_ie_count = 3, .bcn_filt_ie = { [0] = { .ie = WLAN_EID_CHANNEL_SWITCH, .rule = CONF_BCN_RULE_PASS_ON_APPEARANCE, }, [1] = { .ie = WLAN_EID_HT_OPERATION, .rule = CONF_BCN_RULE_PASS_ON_CHANGE, }, [2] = { .ie = WLAN_EID_ERP_INFO, .rule = CONF_BCN_RULE_PASS_ON_CHANGE, }, }, .synch_fail_thold = 12, .bss_lose_timeout = 400, .beacon_rx_timeout = 10000, .broadcast_timeout = 20000, .rx_broadcast_in_ps = 1, .ps_poll_threshold = 10, .bet_enable = CONF_BET_MODE_ENABLE, .bet_max_consecutive = 50, .psm_entry_retries = 8, .psm_exit_retries = 16, .psm_entry_nullfunc_retries = 3, .dynamic_ps_timeout = 1500, .forced_ps = false, .keep_alive_interval = 55000, .max_listen_interval = 20, .sta_sleep_auth = WL1271_PSM_ILLEGAL, .suspend_rx_ba_activity = 0, }, .itrim = { .enable = false, .timeout = 50000, }, .pm_config = { .host_clk_settling_time = 5000, .host_fast_wakeup_support = CONF_FAST_WAKEUP_DISABLE, }, .roam_trigger = { .trigger_pacing = 1, .avg_weight_rssi_beacon = 20, .avg_weight_rssi_data = 10, .avg_weight_snr_beacon = 20, .avg_weight_snr_data = 10, }, .scan = { .min_dwell_time_active = 7500, .max_dwell_time_active = 30000, .min_dwell_time_active_long = 25000, .max_dwell_time_active_long = 50000, .dwell_time_passive = 100000, .dwell_time_dfs = 150000, .num_probe_reqs = 2, .split_scan_timeout = 50000, }, .sched_scan = { /* * Values are in TU/1000 but since sched scan FW command * params are in TUs rounding up may occur. */ .base_dwell_time = 7500, .max_dwell_time_delta = 22500, /* based on 250bits per probe @1Mbps */ .dwell_time_delta_per_probe = 2000, /* based on 250bits per probe @6Mbps (plus a bit more) */ .dwell_time_delta_per_probe_5 = 350, .dwell_time_passive = 100000, .dwell_time_dfs = 150000, .num_probe_reqs = 2, .rssi_threshold = -90, .snr_threshold = 0, }, .ht = { .rx_ba_win_size = 8, .tx_ba_win_size = 64, .inactivity_timeout = 10000, .tx_ba_tid_bitmap = CONF_TX_BA_ENABLED_TID_BITMAP, }, /* * Memory config for wl127x chips is given in the * wl12xx_default_priv_conf struct. The below configuration is * for wl128x chips. */ .mem = { .num_stations = 1, .ssid_profiles = 1, .rx_block_num = 40, .tx_min_block_num = 40, .dynamic_memory = 1, .min_req_tx_blocks = 45, .min_req_rx_blocks = 22, .tx_min = 27, }, .fm_coex = { .enable = true, .swallow_period = 5, .n_divider_fref_set_1 = 0xff, /* default */ .n_divider_fref_set_2 = 12, .m_divider_fref_set_1 = 0xffff, .m_divider_fref_set_2 = 148, /* default */ .coex_pll_stabilization_time = 0xffffffff, /* default */ .ldo_stabilization_time = 0xffff, /* default */ .fm_disturbed_band_margin = 0xff, /* default */ .swallow_clk_diff = 0xff, /* default */ }, .rx_streaming = { .duration = 150, .queues = 0x1, .interval = 20, .always = 0, }, .fwlog = { .mode = WL12XX_FWLOG_CONTINUOUS, .mem_blocks = 2, .severity = 0, .timestamp = WL12XX_FWLOG_TIMESTAMP_DISABLED, .output = WL12XX_FWLOG_OUTPUT_DBG_PINS, .threshold = 0, }, .rate = { .rate_retry_score = 32000, .per_add = 8192, .per_th1 = 2048, .per_th2 = 4096, .max_per = 8100, .inverse_curiosity_factor = 5, .tx_fail_low_th = 4, .tx_fail_high_th = 10, .per_alpha_shift = 4, .per_add_shift = 13, .per_beta1_shift = 10, .per_beta2_shift = 8, .rate_check_up = 2, .rate_check_down = 12, .rate_retry_policy = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, }, .hangover = { .recover_time = 0, .hangover_period = 20, .dynamic_mode = 1, .early_termination_mode = 1, .max_period = 20, .min_period = 1, .increase_delta = 1, .decrease_delta = 2, .quiet_time = 4, .increase_time = 1, .window_size = 16, }, .recovery = { .bug_on_recovery = 0, .no_recovery = 0, }, }; static struct wl12xx_priv_conf wl12xx_default_priv_conf = { .rf = { .tx_per_channel_power_compensation_2 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, .tx_per_channel_power_compensation_5 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }, }, .mem_wl127x = { .num_stations = 1, .ssid_profiles = 1, .rx_block_num = 70, .tx_min_block_num = 40, .dynamic_memory = 1, .min_req_tx_blocks = 100, .min_req_rx_blocks = 22, .tx_min = 27, }, }; #define WL12XX_TX_HW_BLOCK_SPARE_DEFAULT 1 #define WL12XX_TX_HW_BLOCK_GEM_SPARE 2 #define WL12XX_TX_HW_BLOCK_SIZE 252 static const u8 wl12xx_rate_to_idx_2ghz[] = { /* MCS rates are used only with 11n */ 7, /* WL12XX_CONF_HW_RXTX_RATE_MCS7_SGI */ 7, /* WL12XX_CONF_HW_RXTX_RATE_MCS7 */ 6, /* WL12XX_CONF_HW_RXTX_RATE_MCS6 */ 5, /* WL12XX_CONF_HW_RXTX_RATE_MCS5 */ 4, /* WL12XX_CONF_HW_RXTX_RATE_MCS4 */ 3, /* WL12XX_CONF_HW_RXTX_RATE_MCS3 */ 2, /* WL12XX_CONF_HW_RXTX_RATE_MCS2 */ 1, /* WL12XX_CONF_HW_RXTX_RATE_MCS1 */ 0, /* WL12XX_CONF_HW_RXTX_RATE_MCS0 */ 11, /* WL12XX_CONF_HW_RXTX_RATE_54 */ 10, /* WL12XX_CONF_HW_RXTX_RATE_48 */ 9, /* WL12XX_CONF_HW_RXTX_RATE_36 */ 8, /* WL12XX_CONF_HW_RXTX_RATE_24 */ /* TI-specific rate */ CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL12XX_CONF_HW_RXTX_RATE_22 */ 7, /* WL12XX_CONF_HW_RXTX_RATE_18 */ 6, /* WL12XX_CONF_HW_RXTX_RATE_12 */ 3, /* WL12XX_CONF_HW_RXTX_RATE_11 */ 5, /* WL12XX_CONF_HW_RXTX_RATE_9 */ 4, /* WL12XX_CONF_HW_RXTX_RATE_6 */ 2, /* WL12XX_CONF_HW_RXTX_RATE_5_5 */ 1, /* WL12XX_CONF_HW_RXTX_RATE_2 */ 0 /* WL12XX_CONF_HW_RXTX_RATE_1 */ }; static const u8 wl12xx_rate_to_idx_5ghz[] = { /* MCS rates are used only with 11n */ 7, /* WL12XX_CONF_HW_RXTX_RATE_MCS7_SGI */ 7, /* WL12XX_CONF_HW_RXTX_RATE_MCS7 */ 6, /* WL12XX_CONF_HW_RXTX_RATE_MCS6 */ 5, /* WL12XX_CONF_HW_RXTX_RATE_MCS5 */ 4, /* WL12XX_CONF_HW_RXTX_RATE_MCS4 */ 3, /* WL12XX_CONF_HW_RXTX_RATE_MCS3 */ 2, /* WL12XX_CONF_HW_RXTX_RATE_MCS2 */ 1, /* WL12XX_CONF_HW_RXTX_RATE_MCS1 */ 0, /* WL12XX_CONF_HW_RXTX_RATE_MCS0 */ 7, /* WL12XX_CONF_HW_RXTX_RATE_54 */ 6, /* WL12XX_CONF_HW_RXTX_RATE_48 */ 5, /* WL12XX_CONF_HW_RXTX_RATE_36 */ 4, /* WL12XX_CONF_HW_RXTX_RATE_24 */ /* TI-specific rate */ CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL12XX_CONF_HW_RXTX_RATE_22 */ 3, /* WL12XX_CONF_HW_RXTX_RATE_18 */ 2, /* WL12XX_CONF_HW_RXTX_RATE_12 */ CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL12XX_CONF_HW_RXTX_RATE_11 */ 1, /* WL12XX_CONF_HW_RXTX_RATE_9 */ 0, /* WL12XX_CONF_HW_RXTX_RATE_6 */ CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL12XX_CONF_HW_RXTX_RATE_5_5 */ CONF_HW_RXTX_RATE_UNSUPPORTED, /* WL12XX_CONF_HW_RXTX_RATE_2 */ CONF_HW_RXTX_RATE_UNSUPPORTED /* WL12XX_CONF_HW_RXTX_RATE_1 */ }; static const u8 *wl12xx_band_rate_to_idx[] = { [NL80211_BAND_2GHZ] = wl12xx_rate_to_idx_2ghz, [NL80211_BAND_5GHZ] = wl12xx_rate_to_idx_5ghz }; enum wl12xx_hw_rates { WL12XX_CONF_HW_RXTX_RATE_MCS7_SGI = 0, WL12XX_CONF_HW_RXTX_RATE_MCS7, WL12XX_CONF_HW_RXTX_RATE_MCS6, WL12XX_CONF_HW_RXTX_RATE_MCS5, WL12XX_CONF_HW_RXTX_RATE_MCS4, WL12XX_CONF_HW_RXTX_RATE_MCS3, WL12XX_CONF_HW_RXTX_RATE_MCS2, WL12XX_CONF_HW_RXTX_RATE_MCS1, WL12XX_CONF_HW_RXTX_RATE_MCS0, WL12XX_CONF_HW_RXTX_RATE_54, WL12XX_CONF_HW_RXTX_RATE_48, WL12XX_CONF_HW_RXTX_RATE_36, WL12XX_CONF_HW_RXTX_RATE_24, WL12XX_CONF_HW_RXTX_RATE_22, WL12XX_CONF_HW_RXTX_RATE_18, WL12XX_CONF_HW_RXTX_RATE_12, WL12XX_CONF_HW_RXTX_RATE_11, WL12XX_CONF_HW_RXTX_RATE_9, WL12XX_CONF_HW_RXTX_RATE_6, WL12XX_CONF_HW_RXTX_RATE_5_5, WL12XX_CONF_HW_RXTX_RATE_2, WL12XX_CONF_HW_RXTX_RATE_1, WL12XX_CONF_HW_RXTX_RATE_MAX, }; static struct wlcore_partition_set wl12xx_ptable[PART_TABLE_LEN] = { [PART_DOWN] = { .mem = { .start = 0x00000000, .size = 0x000177c0 }, .reg = { .start = REGISTERS_BASE, .size = 0x00008800 }, .mem2 = { .start = 0x00000000, .size = 0x00000000 }, .mem3 = { .start = 0x00000000, .size = 0x00000000 }, }, [PART_BOOT] = { /* in wl12xx we can use a mix of work and down * partition here */ .mem = { .start = 0x00040000, .size = 0x00014fc0 }, .reg = { .start = REGISTERS_BASE, .size = 0x00008800 }, .mem2 = { .start = 0x00000000, .size = 0x00000000 }, .mem3 = { .start = 0x00000000, .size = 0x00000000 }, }, [PART_WORK] = { .mem = { .start = 0x00040000, .size = 0x00014fc0 }, .reg = { .start = REGISTERS_BASE, .size = 0x0000a000 }, .mem2 = { .start = 0x003004f8, .size = 0x00000004 }, .mem3 = { .start = 0x00040404, .size = 0x00000000 }, }, [PART_DRPW] = { .mem = { .start = 0x00040000, .size = 0x00014fc0 }, .reg = { .start = DRPW_BASE, .size = 0x00006000 }, .mem2 = { .start = 0x00000000, .size = 0x00000000 }, .mem3 = { .start = 0x00000000, .size = 0x00000000 } } }; static const int wl12xx_rtable[REG_TABLE_LEN] = { [REG_ECPU_CONTROL] = WL12XX_REG_ECPU_CONTROL, [REG_INTERRUPT_NO_CLEAR] = WL12XX_REG_INTERRUPT_NO_CLEAR, [REG_INTERRUPT_ACK] = WL12XX_REG_INTERRUPT_ACK, [REG_COMMAND_MAILBOX_PTR] = WL12XX_REG_COMMAND_MAILBOX_PTR, [REG_EVENT_MAILBOX_PTR] = WL12XX_REG_EVENT_MAILBOX_PTR, [REG_INTERRUPT_TRIG] = WL12XX_REG_INTERRUPT_TRIG, [REG_INTERRUPT_MASK] = WL12XX_REG_INTERRUPT_MASK, [REG_PC_ON_RECOVERY] = WL12XX_SCR_PAD4, [REG_CHIP_ID_B] = WL12XX_CHIP_ID_B, [REG_CMD_MBOX_ADDRESS] = WL12XX_CMD_MBOX_ADDRESS, /* data access memory addresses, used with partition translation */ [REG_SLV_MEM_DATA] = WL1271_SLV_MEM_DATA, [REG_SLV_REG_DATA] = WL1271_SLV_REG_DATA, /* raw data access memory addresses */ [REG_RAW_FW_STATUS_ADDR] = FW_STATUS_ADDR, }; /* TODO: maybe move to a new header file? */ #define WL127X_FW_NAME_MULTI "ti-connectivity/wl127x-fw-5-mr.bin" #define WL127X_FW_NAME_SINGLE "ti-connectivity/wl127x-fw-5-sr.bin" #define WL127X_PLT_FW_NAME "ti-connectivity/wl127x-fw-5-plt.bin" #define WL128X_FW_NAME_MULTI "ti-connectivity/wl128x-fw-5-mr.bin" #define WL128X_FW_NAME_SINGLE "ti-connectivity/wl128x-fw-5-sr.bin" #define WL128X_PLT_FW_NAME "ti-connectivity/wl128x-fw-5-plt.bin" static int wl127x_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len) { int ret; if (wl->chip.id != CHIP_ID_128X_PG20) { struct wl1271_acx_mem_map *wl_mem_map = wl->target_mem_map; struct wl12xx_priv *priv = wl->priv; /* * Choose the block we want to read * For aggregated packets, only the first memory block * should be retrieved. The FW takes care of the rest. */ u32 mem_block = rx_desc & RX_MEM_BLOCK_MASK; priv->rx_mem_addr->addr = (mem_block << 8) + le32_to_cpu(wl_mem_map->packet_memory_pool_start); priv->rx_mem_addr->addr_extra = priv->rx_mem_addr->addr + 4; ret = wlcore_write(wl, WL1271_SLV_REG_DATA, priv->rx_mem_addr, sizeof(*priv->rx_mem_addr), false); if (ret < 0) return ret; } return 0; } static int wl12xx_identify_chip(struct wl1271 *wl) { int ret = 0; switch (wl->chip.id) { case CHIP_ID_127X_PG10: wl1271_warning("chip id 0x%x (1271 PG10) support is obsolete", wl->chip.id); wl->quirks |= WLCORE_QUIRK_LEGACY_NVS | WLCORE_QUIRK_DUAL_PROBE_TMPL | WLCORE_QUIRK_TKIP_HEADER_SPACE | WLCORE_QUIRK_START_STA_FAILS | WLCORE_QUIRK_AP_ZERO_SESSION_ID; wl->sr_fw_name = WL127X_FW_NAME_SINGLE; wl->mr_fw_name = WL127X_FW_NAME_MULTI; memcpy(&wl->conf.mem, &wl12xx_default_priv_conf.mem_wl127x, sizeof(wl->conf.mem)); /* read data preparation is only needed by wl127x */ wl->ops->prepare_read = wl127x_prepare_read; wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER, WL127X_IFTYPE_SR_VER, WL127X_MAJOR_SR_VER, WL127X_SUBTYPE_SR_VER, WL127X_MINOR_SR_VER, WL127X_IFTYPE_MR_VER, WL127X_MAJOR_MR_VER, WL127X_SUBTYPE_MR_VER, WL127X_MINOR_MR_VER); break; case CHIP_ID_127X_PG20: wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1271 PG20)", wl->chip.id); wl->quirks |= WLCORE_QUIRK_LEGACY_NVS | WLCORE_QUIRK_DUAL_PROBE_TMPL | WLCORE_QUIRK_TKIP_HEADER_SPACE | WLCORE_QUIRK_START_STA_FAILS | WLCORE_QUIRK_AP_ZERO_SESSION_ID; wl->plt_fw_name = WL127X_PLT_FW_NAME; wl->sr_fw_name = WL127X_FW_NAME_SINGLE; wl->mr_fw_name = WL127X_FW_NAME_MULTI; memcpy(&wl->conf.mem, &wl12xx_default_priv_conf.mem_wl127x, sizeof(wl->conf.mem)); /* read data preparation is only needed by wl127x */ wl->ops->prepare_read = wl127x_prepare_read; wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER, WL127X_IFTYPE_SR_VER, WL127X_MAJOR_SR_VER, WL127X_SUBTYPE_SR_VER, WL127X_MINOR_SR_VER, WL127X_IFTYPE_MR_VER, WL127X_MAJOR_MR_VER, WL127X_SUBTYPE_MR_VER, WL127X_MINOR_MR_VER); break; case CHIP_ID_128X_PG20: wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1283 PG20)", wl->chip.id); wl->plt_fw_name = WL128X_PLT_FW_NAME; wl->sr_fw_name = WL128X_FW_NAME_SINGLE; wl->mr_fw_name = WL128X_FW_NAME_MULTI; /* wl128x requires TX blocksize alignment */ wl->quirks |= WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN | WLCORE_QUIRK_DUAL_PROBE_TMPL | WLCORE_QUIRK_TKIP_HEADER_SPACE | WLCORE_QUIRK_START_STA_FAILS | WLCORE_QUIRK_AP_ZERO_SESSION_ID; wlcore_set_min_fw_ver(wl, WL128X_CHIP_VER, WL128X_IFTYPE_SR_VER, WL128X_MAJOR_SR_VER, WL128X_SUBTYPE_SR_VER, WL128X_MINOR_SR_VER, WL128X_IFTYPE_MR_VER, WL128X_MAJOR_MR_VER, WL128X_SUBTYPE_MR_VER, WL128X_MINOR_MR_VER); break; case CHIP_ID_128X_PG10: default: wl1271_warning("unsupported chip id: 0x%x", wl->chip.id); ret = -ENODEV; goto out; } wl->fw_mem_block_size = 256; wl->fwlog_end = 0x2000000; /* common settings */ wl->scan_templ_id_2_4 = CMD_TEMPL_APP_PROBE_REQ_2_4_LEGACY; wl->scan_templ_id_5 = CMD_TEMPL_APP_PROBE_REQ_5_LEGACY; wl->sched_scan_templ_id_2_4 = CMD_TEMPL_CFG_PROBE_REQ_2_4; wl->sched_scan_templ_id_5 = CMD_TEMPL_CFG_PROBE_REQ_5; wl->max_channels_5 = WL12XX_MAX_CHANNELS_5GHZ; wl->ba_rx_session_count_max = WL12XX_RX_BA_MAX_SESSIONS; out: return ret; } static int __must_check wl12xx_top_reg_write(struct wl1271 *wl, int addr, u16 val) { int ret; /* write address >> 1 + 0x30000 to OCP_POR_CTR */ addr = (addr >> 1) + 0x30000; ret = wlcore_write32(wl, WL12XX_OCP_POR_CTR, addr); if (ret < 0) goto out; /* write value to OCP_POR_WDATA */ ret = wlcore_write32(wl, WL12XX_OCP_DATA_WRITE, val); if (ret < 0) goto out; /* write 1 to OCP_CMD */ ret = wlcore_write32(wl, WL12XX_OCP_CMD, OCP_CMD_WRITE); if (ret < 0) goto out; out: return ret; } static int __must_check wl12xx_top_reg_read(struct wl1271 *wl, int addr, u16 *out) { u32 val; int timeout = OCP_CMD_LOOP; int ret; /* write address >> 1 + 0x30000 to OCP_POR_CTR */ addr = (addr >> 1) + 0x30000; ret = wlcore_write32(wl, WL12XX_OCP_POR_CTR, addr); if (ret < 0) return ret; /* write 2 to OCP_CMD */ ret = wlcore_write32(wl, WL12XX_OCP_CMD, OCP_CMD_READ); if (ret < 0) return ret; /* poll for data ready */ do { ret = wlcore_read32(wl, WL12XX_OCP_DATA_READ, &val); if (ret < 0) return ret; } while (!(val & OCP_READY_MASK) && --timeout); if (!timeout) { wl1271_warning("Top register access timed out."); return -ETIMEDOUT; } /* check data status and return if OK */ if ((val & OCP_STATUS_MASK) != OCP_STATUS_OK) { wl1271_warning("Top register access returned error."); return -EIO; } if (out) *out = val & 0xffff; return 0; } static int wl128x_switch_tcxo_to_fref(struct wl1271 *wl) { u16 spare_reg; int ret; /* Mask bits [2] & [8:4] in the sys_clk_cfg register */ ret = wl12xx_top_reg_read(wl, WL_SPARE_REG, &spare_reg); if (ret < 0) return ret; if (spare_reg == 0xFFFF) return -EFAULT; spare_reg |= (BIT(3) | BIT(5) | BIT(6)); ret = wl12xx_top_reg_write(wl, WL_SPARE_REG, spare_reg); if (ret < 0) return ret; /* Enable FREF_CLK_REQ & mux MCS and coex PLLs to FREF */ ret = wl12xx_top_reg_write(wl, SYS_CLK_CFG_REG, WL_CLK_REQ_TYPE_PG2 | MCS_PLL_CLK_SEL_FREF); if (ret < 0) return ret; /* Delay execution for 15msec, to let the HW settle */ mdelay(15); return 0; } static bool wl128x_is_tcxo_valid(struct wl1271 *wl) { u16 tcxo_detection; int ret; ret = wl12xx_top_reg_read(wl, TCXO_CLK_DETECT_REG, &tcxo_detection); if (ret < 0) return false; if (tcxo_detection & TCXO_DET_FAILED) return false; return true; } static bool wl128x_is_fref_valid(struct wl1271 *wl) { u16 fref_detection; int ret; ret = wl12xx_top_reg_read(wl, FREF_CLK_DETECT_REG, &fref_detection); if (ret < 0) return false; if (fref_detection & FREF_CLK_DETECT_FAIL) return false; return true; } static int wl128x_manually_configure_mcs_pll(struct wl1271 *wl) { int ret; ret = wl12xx_top_reg_write(wl, MCS_PLL_M_REG, MCS_PLL_M_REG_VAL); if (ret < 0) goto out; ret = wl12xx_top_reg_write(wl, MCS_PLL_N_REG, MCS_PLL_N_REG_VAL); if (ret < 0) goto out; ret = wl12xx_top_reg_write(wl, MCS_PLL_CONFIG_REG, MCS_PLL_CONFIG_REG_VAL); out: return ret; } static int wl128x_configure_mcs_pll(struct wl1271 *wl, int clk) { u16 spare_reg; u16 pll_config; u8 input_freq; struct wl12xx_priv *priv = wl->priv; int ret; /* Mask bits [3:1] in the sys_clk_cfg register */ ret = wl12xx_top_reg_read(wl, WL_SPARE_REG, &spare_reg); if (ret < 0) return ret; if (spare_reg == 0xFFFF) return -EFAULT; spare_reg |= BIT(2); ret = wl12xx_top_reg_write(wl, WL_SPARE_REG, spare_reg); if (ret < 0) return ret; /* Handle special cases of the TCXO clock */ if (priv->tcxo_clock == WL12XX_TCXOCLOCK_16_8 || priv->tcxo_clock == WL12XX_TCXOCLOCK_33_6) return wl128x_manually_configure_mcs_pll(wl); /* Set the input frequency according to the selected clock source */ input_freq = (clk & 1) + 1; ret = wl12xx_top_reg_read(wl, MCS_PLL_CONFIG_REG, &pll_config); if (ret < 0) return ret; if (pll_config == 0xFFFF) return -EFAULT; pll_config |= (input_freq << MCS_SEL_IN_FREQ_SHIFT); pll_config |= MCS_PLL_ENABLE_HP; ret = wl12xx_top_reg_write(wl, MCS_PLL_CONFIG_REG, pll_config); return ret; } /* * WL128x has two clocks input - TCXO and FREF. * TCXO is the main clock of the device, while FREF is used to sync * between the GPS and the cellular modem. * In cases where TCXO is 32.736MHz or 16.368MHz, the FREF will be used * as the WLAN/BT main clock. */ static int wl128x_boot_clk(struct wl1271 *wl, int *selected_clock) { struct wl12xx_priv *priv = wl->priv; u16 sys_clk_cfg; int ret; /* For XTAL-only modes, FREF will be used after switching from TCXO */ if (priv->ref_clock == WL12XX_REFCLOCK_26_XTAL || priv->ref_clock == WL12XX_REFCLOCK_38_XTAL) { if (!wl128x_switch_tcxo_to_fref(wl)) return -EINVAL; goto fref_clk; } /* Query the HW, to determine which clock source we should use */ ret = wl12xx_top_reg_read(wl, SYS_CLK_CFG_REG, &sys_clk_cfg); if (ret < 0) return ret; if (sys_clk_cfg == 0xFFFF) return -EINVAL; if (sys_clk_cfg & PRCM_CM_EN_MUX_WLAN_FREF) goto fref_clk; /* If TCXO is either 32.736MHz or 16.368MHz, switch to FREF */ if (priv->tcxo_clock == WL12XX_TCXOCLOCK_16_368 || priv->tcxo_clock == WL12XX_TCXOCLOCK_32_736) { if (!wl128x_switch_tcxo_to_fref(wl)) return -EINVAL; goto fref_clk; } /* TCXO clock is selected */ if (!wl128x_is_tcxo_valid(wl)) return -EINVAL; *selected_clock = priv->tcxo_clock; goto config_mcs_pll; fref_clk: /* FREF clock is selected */ if (!wl128x_is_fref_valid(wl)) return -EINVAL; *selected_clock = priv->ref_clock; config_mcs_pll: return wl128x_configure_mcs_pll(wl, *selected_clock); } static int wl127x_boot_clk(struct wl1271 *wl) { struct wl12xx_priv *priv = wl->priv; u32 pause; u32 clk; int ret; if (WL127X_PG_GET_MAJOR(wl->hw_pg_ver) < 3) wl->quirks |= WLCORE_QUIRK_END_OF_TRANSACTION; if (priv->ref_clock == CONF_REF_CLK_19_2_E || priv->ref_clock == CONF_REF_CLK_38_4_E || priv->ref_clock == CONF_REF_CLK_38_4_M_XTAL) /* ref clk: 19.2/38.4/38.4-XTAL */ clk = 0x3; else if (priv->ref_clock == CONF_REF_CLK_26_E || priv->ref_clock == CONF_REF_CLK_26_M_XTAL || priv->ref_clock == CONF_REF_CLK_52_E) /* ref clk: 26/52 */ clk = 0x5; else return -EINVAL; if (priv->ref_clock != CONF_REF_CLK_19_2_E) { u16 val; /* Set clock type (open drain) */ ret = wl12xx_top_reg_read(wl, OCP_REG_CLK_TYPE, &val); if (ret < 0) goto out; val &= FREF_CLK_TYPE_BITS; ret = wl12xx_top_reg_write(wl, OCP_REG_CLK_TYPE, val); if (ret < 0) goto out; /* Set clock pull mode (no pull) */ ret = wl12xx_top_reg_read(wl, OCP_REG_CLK_PULL, &val); if (ret < 0) goto out; val |= NO_PULL; ret = wl12xx_top_reg_write(wl, OCP_REG_CLK_PULL, val); if (ret < 0) goto out; } else { u16 val; /* Set clock polarity */ ret = wl12xx_top_reg_read(wl, OCP_REG_CLK_POLARITY, &val); if (ret < 0) goto out; val &= FREF_CLK_POLARITY_BITS; val |= CLK_REQ_OUTN_SEL; ret = wl12xx_top_reg_write(wl, OCP_REG_CLK_POLARITY, val); if (ret < 0) goto out; } ret = wlcore_write32(wl, WL12XX_PLL_PARAMETERS, clk); if (ret < 0) goto out; ret = wlcore_read32(wl, WL12XX_PLL_PARAMETERS, &pause); if (ret < 0) goto out; wl1271_debug(DEBUG_BOOT, "pause1 0x%x", pause); pause &= ~(WU_COUNTER_PAUSE_VAL); pause |= WU_COUNTER_PAUSE_VAL; ret = wlcore_write32(wl, WL12XX_WU_COUNTER_PAUSE, pause); out: return ret; } static int wl1271_boot_soft_reset(struct wl1271 *wl) { unsigned long timeout; u32 boot_data; int ret = 0; /* perform soft reset */ ret = wlcore_write32(wl, WL12XX_SLV_SOFT_RESET, ACX_SLV_SOFT_RESET_BIT); if (ret < 0) goto out; /* SOFT_RESET is self clearing */ timeout = jiffies + usecs_to_jiffies(SOFT_RESET_MAX_TIME); while (1) { ret = wlcore_read32(wl, WL12XX_SLV_SOFT_RESET, &boot_data); if (ret < 0) goto out; wl1271_debug(DEBUG_BOOT, "soft reset bootdata 0x%x", boot_data); if ((boot_data & ACX_SLV_SOFT_RESET_BIT) == 0) break; if (time_after(jiffies, timeout)) { /* 1.2 check pWhalBus->uSelfClearTime if the * timeout was reached */ wl1271_error("soft reset timeout"); return -1; } udelay(SOFT_RESET_STALL_TIME); } /* disable Rx/Tx */ ret = wlcore_write32(wl, WL12XX_ENABLE, 0x0); if (ret < 0) goto out; /* disable auto calibration on start*/ ret = wlcore_write32(wl, WL12XX_SPARE_A2, 0xffff); out: return ret; } static int wl12xx_pre_boot(struct wl1271 *wl) { struct wl12xx_priv *priv = wl->priv; int ret = 0; u32 clk; int selected_clock = -1; if (wl->chip.id == CHIP_ID_128X_PG20) { ret = wl128x_boot_clk(wl, &selected_clock); if (ret < 0) goto out; } else { ret = wl127x_boot_clk(wl); if (ret < 0) goto out; } /* Continue the ELP wake up sequence */ ret = wlcore_write32(wl, WL12XX_WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL); if (ret < 0) goto out; udelay(500); ret = wlcore_set_partition(wl, &wl->ptable[PART_DRPW]); if (ret < 0) goto out; /* Read-modify-write DRPW_SCRATCH_START register (see next state) to be used by DRPw FW. The RTRIM value will be added by the FW before taking DRPw out of reset */ ret = wlcore_read32(wl, WL12XX_DRPW_SCRATCH_START, &clk); if (ret < 0) goto out; wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk); if (wl->chip.id == CHIP_ID_128X_PG20) clk |= ((selected_clock & 0x3) << 1) << 4; else clk |= (priv->ref_clock << 1) << 4; ret = wlcore_write32(wl, WL12XX_DRPW_SCRATCH_START, clk); if (ret < 0) goto out; ret = wlcore_set_partition(wl, &wl->ptable[PART_WORK]); if (ret < 0) goto out; /* Disable interrupts */ ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL); if (ret < 0) goto out; ret = wl1271_boot_soft_reset(wl); if (ret < 0) goto out; out: return ret; } static int wl12xx_pre_upload(struct wl1271 *wl) { u32 tmp; u16 polarity; int ret; /* write firmware's last address (ie. it's length) to * ACX_EEPROMLESS_IND_REG */ wl1271_debug(DEBUG_BOOT, "ACX_EEPROMLESS_IND_REG"); ret = wlcore_write32(wl, WL12XX_EEPROMLESS_IND, WL12XX_EEPROMLESS_IND); if (ret < 0) goto out; ret = wlcore_read_reg(wl, REG_CHIP_ID_B, &tmp); if (ret < 0) goto out; wl1271_debug(DEBUG_BOOT, "chip id 0x%x", tmp); /* 6. read the EEPROM parameters */ ret = wlcore_read32(wl, WL12XX_SCR_PAD2, &tmp); if (ret < 0) goto out; /* WL1271: The reference driver skips steps 7 to 10 (jumps directly * to upload_fw) */ if (wl->chip.id == CHIP_ID_128X_PG20) { ret = wl12xx_top_reg_write(wl, SDIO_IO_DS, HCI_IO_DS_6MA); if (ret < 0) goto out; } /* polarity must be set before the firmware is loaded */ ret = wl12xx_top_reg_read(wl, OCP_REG_POLARITY, &polarity); if (ret < 0) goto out; /* We use HIGH polarity, so unset the LOW bit */ polarity &= ~POLARITY_LOW; ret = wl12xx_top_reg_write(wl, OCP_REG_POLARITY, polarity); out: return ret; } static int wl12xx_enable_interrupts(struct wl1271 *wl) { int ret; ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL12XX_ACX_ALL_EVENTS_VECTOR); if (ret < 0) goto out; wlcore_enable_interrupts(wl); ret = wlcore_write_reg(wl, REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL & ~(WL12XX_INTR_MASK)); if (ret < 0) goto disable_interrupts; ret = wlcore_write32(wl, WL12XX_HI_CFG, HI_CFG_DEF_VAL); if (ret < 0) goto disable_interrupts; return ret; disable_interrupts: wlcore_disable_interrupts(wl); out: return ret; } static int wl12xx_boot(struct wl1271 *wl) { int ret; ret = wl12xx_pre_boot(wl); if (ret < 0) goto out; ret = wlcore_boot_upload_nvs(wl); if (ret < 0) goto out; ret = wl12xx_pre_upload(wl); if (ret < 0) goto out; ret = wlcore_boot_upload_firmware(wl); if (ret < 0) goto out; wl->event_mask = BSS_LOSE_EVENT_ID | REGAINED_BSS_EVENT_ID | SCAN_COMPLETE_EVENT_ID | ROLE_STOP_COMPLETE_EVENT_ID | RSSI_SNR_TRIGGER_0_EVENT_ID | PSPOLL_DELIVERY_FAILURE_EVENT_ID | SOFT_GEMINI_SENSE_EVENT_ID | PERIODIC_SCAN_REPORT_EVENT_ID | PERIODIC_SCAN_COMPLETE_EVENT_ID | DUMMY_PACKET_EVENT_ID | PEER_REMOVE_COMPLETE_EVENT_ID | BA_SESSION_RX_CONSTRAINT_EVENT_ID | REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID | INACTIVE_STA_EVENT_ID | CHANNEL_SWITCH_COMPLETE_EVENT_ID; wl->ap_event_mask = MAX_TX_RETRY_EVENT_ID; ret = wlcore_boot_run_firmware(wl); if (ret < 0) goto out; ret = wl12xx_enable_interrupts(wl); out: return ret; } static int wl12xx_trigger_cmd(struct wl1271 *wl, int cmd_box_addr, void *buf, size_t len) { int ret; ret = wlcore_write(wl, cmd_box_addr, buf, len, false); if (ret < 0) return ret; ret = wlcore_write_reg(wl, REG_INTERRUPT_TRIG, WL12XX_INTR_TRIG_CMD); return ret; } static int wl12xx_ack_event(struct wl1271 *wl) { return wlcore_write_reg(wl, REG_INTERRUPT_TRIG, WL12XX_INTR_TRIG_EVENT_ACK); } static u32 wl12xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks) { u32 blk_size = WL12XX_TX_HW_BLOCK_SIZE; u32 align_len = wlcore_calc_packet_alignment(wl, len); return (align_len + blk_size - 1) / blk_size + spare_blks; } static void wl12xx_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, u32 blks, u32 spare_blks) { if (wl->chip.id == CHIP_ID_128X_PG20) { desc->wl128x_mem.total_mem_blocks = blks; } else { desc->wl127x_mem.extra_blocks = spare_blks; desc->wl127x_mem.total_mem_blocks = blks; } } static void wl12xx_set_tx_desc_data_len(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, struct sk_buff *skb) { u32 aligned_len = wlcore_calc_packet_alignment(wl, skb->len); if (wl->chip.id == CHIP_ID_128X_PG20) { desc->wl128x_mem.extra_bytes = aligned_len - skb->len; desc->length = cpu_to_le16(aligned_len >> 2); wl1271_debug(DEBUG_TX, "tx_fill_hdr: hlid: %d len: %d life: %d mem: %d extra: %d", desc->hlid, le16_to_cpu(desc->length), le16_to_cpu(desc->life_time), desc->wl128x_mem.total_mem_blocks, desc->wl128x_mem.extra_bytes); } else { /* calculate number of padding bytes */ int pad = aligned_len - skb->len; desc->tx_attr |= cpu_to_le16(pad << TX_HW_ATTR_OFST_LAST_WORD_PAD); /* Store the aligned length in terms of words */ desc->length = cpu_to_le16(aligned_len >> 2); wl1271_debug(DEBUG_TX, "tx_fill_hdr: pad: %d hlid: %d len: %d life: %d mem: %d", pad, desc->hlid, le16_to_cpu(desc->length), le16_to_cpu(desc->life_time), desc->wl127x_mem.total_mem_blocks); } } static enum wl_rx_buf_align wl12xx_get_rx_buf_align(struct wl1271 *wl, u32 rx_desc) { if (rx_desc & RX_BUF_UNALIGNED_PAYLOAD) return WLCORE_RX_BUF_UNALIGNED; return WLCORE_RX_BUF_ALIGNED; } static u32 wl12xx_get_rx_packet_len(struct wl1271 *wl, void *rx_data, u32 data_len) { struct wl1271_rx_descriptor *desc = rx_data; /* invalid packet */ if (data_len < sizeof(*desc) || data_len < sizeof(*desc) + desc->pad_len) return 0; return data_len - sizeof(*desc) - desc->pad_len; } static int wl12xx_tx_delayed_compl(struct wl1271 *wl) { if (wl->fw_status->tx_results_counter == (wl->tx_results_count & 0xff)) return 0; return wlcore_tx_complete(wl); } static int wl12xx_hw_init(struct wl1271 *wl) { int ret; if (wl->chip.id == CHIP_ID_128X_PG20) { u32 host_cfg_bitmap = HOST_IF_CFG_RX_FIFO_ENABLE; ret = wl128x_cmd_general_parms(wl); if (ret < 0) goto out; /* * If we are in calibrator based auto detect then we got the FEM nr * in wl->fem_manuf. No need to continue further */ if (wl->plt_mode == PLT_FEM_DETECT) goto out; ret = wl128x_cmd_radio_parms(wl); if (ret < 0) goto out; if (wl->quirks & WLCORE_QUIRK_TX_BLOCKSIZE_ALIGN) /* Enable SDIO padding */ host_cfg_bitmap |= HOST_IF_CFG_TX_PAD_TO_SDIO_BLK; /* Must be before wl1271_acx_init_mem_config() */ ret = wl1271_acx_host_if_cfg_bitmap(wl, host_cfg_bitmap); if (ret < 0) goto out; } else { ret = wl1271_cmd_general_parms(wl); if (ret < 0) goto out; /* * If we are in calibrator based auto detect then we got the FEM nr * in wl->fem_manuf. No need to continue further */ if (wl->plt_mode == PLT_FEM_DETECT) goto out; ret = wl1271_cmd_radio_parms(wl); if (ret < 0) goto out; ret = wl1271_cmd_ext_radio_parms(wl); if (ret < 0) goto out; } out: return ret; } static void wl12xx_convert_fw_status(struct wl1271 *wl, void *raw_fw_status, struct wl_fw_status *fw_status) { struct wl12xx_fw_status *int_fw_status = raw_fw_status; fw_status->intr = le32_to_cpu(int_fw_status->intr); fw_status->fw_rx_counter = int_fw_status->fw_rx_counter; fw_status->drv_rx_counter = int_fw_status->drv_rx_counter; fw_status->tx_results_counter = int_fw_status->tx_results_counter; fw_status->rx_pkt_descs = int_fw_status->rx_pkt_descs; fw_status->fw_localtime = le32_to_cpu(int_fw_status->fw_localtime); fw_status->link_ps_bitmap = le32_to_cpu(int_fw_status->link_ps_bitmap); fw_status->link_fast_bitmap = le32_to_cpu(int_fw_status->link_fast_bitmap); fw_status->total_released_blks = le32_to_cpu(int_fw_status->total_released_blks); fw_status->tx_total = le32_to_cpu(int_fw_status->tx_total); fw_status->counters.tx_released_pkts = int_fw_status->counters.tx_released_pkts; fw_status->counters.tx_lnk_free_pkts = int_fw_status->counters.tx_lnk_free_pkts; fw_status->counters.tx_voice_released_blks = int_fw_status->counters.tx_voice_released_blks; fw_status->counters.tx_last_rate = int_fw_status->counters.tx_last_rate; fw_status->log_start_addr = le32_to_cpu(int_fw_status->log_start_addr); } static u32 wl12xx_sta_get_ap_rate_mask(struct wl1271 *wl, struct wl12xx_vif *wlvif) { return wlvif->rate_set; } static void wl12xx_conf_init(struct wl1271 *wl) { struct wl12xx_priv *priv = wl->priv; /* apply driver default configuration */ memcpy(&wl->conf, &wl12xx_conf, sizeof(wl12xx_conf)); /* apply default private configuration */ memcpy(&priv->conf, &wl12xx_default_priv_conf, sizeof(priv->conf)); } static bool wl12xx_mac_in_fuse(struct wl1271 *wl) { bool supported = false; u8 major, minor; if (wl->chip.id == CHIP_ID_128X_PG20) { major = WL128X_PG_GET_MAJOR(wl->hw_pg_ver); minor = WL128X_PG_GET_MINOR(wl->hw_pg_ver); /* in wl128x we have the MAC address if the PG is >= (2, 1) */ if (major > 2 || (major == 2 && minor >= 1)) supported = true; } else { major = WL127X_PG_GET_MAJOR(wl->hw_pg_ver); minor = WL127X_PG_GET_MINOR(wl->hw_pg_ver); /* in wl127x we have the MAC address if the PG is >= (3, 1) */ if (major == 3 && minor >= 1) supported = true; } wl1271_debug(DEBUG_PROBE, "PG Ver major = %d minor = %d, MAC %s present", major, minor, supported ? "is" : "is not"); return supported; } static int wl12xx_get_fuse_mac(struct wl1271 *wl) { u32 mac1, mac2; int ret; ret = wlcore_set_partition(wl, &wl->ptable[PART_DRPW]); if (ret < 0) goto out; ret = wlcore_read32(wl, WL12XX_REG_FUSE_BD_ADDR_1, &mac1); if (ret < 0) goto out; ret = wlcore_read32(wl, WL12XX_REG_FUSE_BD_ADDR_2, &mac2); if (ret < 0) goto out; /* these are the two parts of the BD_ADDR */ wl->fuse_oui_addr = ((mac2 & 0xffff) << 8) + ((mac1 & 0xff000000) >> 24); wl->fuse_nic_addr = mac1 & 0xffffff; ret = wlcore_set_partition(wl, &wl->ptable[PART_DOWN]); out: return ret; } static int wl12xx_get_pg_ver(struct wl1271 *wl, s8 *ver) { u16 die_info; int ret; if (wl->chip.id == CHIP_ID_128X_PG20) ret = wl12xx_top_reg_read(wl, WL128X_REG_FUSE_DATA_2_1, &die_info); else ret = wl12xx_top_reg_read(wl, WL127X_REG_FUSE_DATA_2_1, &die_info); if (ret >= 0 && ver) *ver = (s8)((die_info & PG_VER_MASK) >> PG_VER_OFFSET); return ret; } static int wl12xx_get_mac(struct wl1271 *wl) { if (wl12xx_mac_in_fuse(wl)) return wl12xx_get_fuse_mac(wl); return 0; } static void wl12xx_set_tx_desc_csum(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc, struct sk_buff *skb) { desc->wl12xx_reserved = 0; } static int wl12xx_plt_init(struct wl1271 *wl) { int ret; ret = wl->ops->boot(wl); if (ret < 0) goto out; ret = wl->ops->hw_init(wl); if (ret < 0) goto out_irq_disable; /* * If we are in calibrator based auto detect then we got the FEM nr * in wl->fem_manuf. No need to continue further */ if (wl->plt_mode == PLT_FEM_DETECT) goto out; ret = wl1271_acx_init_mem_config(wl); if (ret < 0) goto out_irq_disable; ret = wl12xx_acx_mem_cfg(wl); if (ret < 0) goto out_free_memmap; /* Enable data path */ ret = wl1271_cmd_data_path(wl, 1); if (ret < 0) goto out_free_memmap; /* Configure for CAM power saving (ie. always active) */ ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM); if (ret < 0) goto out_free_memmap; /* configure PM */ ret = wl1271_acx_pm_config(wl); if (ret < 0) goto out_free_memmap; goto out; out_free_memmap: kfree(wl->target_mem_map); wl->target_mem_map = NULL; out_irq_disable: mutex_unlock(&wl->mutex); /* Unlocking the mutex in the middle of handling is inherently unsafe. In this case we deem it safe to do, because we need to let any possibly pending IRQ out of the system (and while we are WL1271_STATE_OFF the IRQ work function will not do anything.) Also, any other possible concurrent operations will fail due to the current state, hence the wl1271 struct should be safe. */ wlcore_disable_interrupts(wl); mutex_lock(&wl->mutex); out: return ret; } static int wl12xx_get_spare_blocks(struct wl1271 *wl, bool is_gem) { if (is_gem) return WL12XX_TX_HW_BLOCK_GEM_SPARE; return WL12XX_TX_HW_BLOCK_SPARE_DEFAULT; } static int wl12xx_set_key(struct wl1271 *wl, enum set_key_cmd cmd, struct ieee80211_vif *vif, struct ieee80211_sta *sta, struct ieee80211_key_conf *key_conf) { return wlcore_set_key(wl, cmd, vif, sta, key_conf); } static int wl12xx_set_peer_cap(struct wl1271 *wl, struct ieee80211_sta_ht_cap *ht_cap, bool allow_ht_operation, u32 rate_set, u8 hlid) { return wl1271_acx_set_ht_capabilities(wl, ht_cap, allow_ht_operation, hlid); } static bool wl12xx_lnk_high_prio(struct wl1271 *wl, u8 hlid, struct wl1271_link *lnk) { u8 thold; if (test_bit(hlid, &wl->fw_fast_lnk_map)) thold = wl->conf.tx.fast_link_thold; else thold = wl->conf.tx.slow_link_thold; return lnk->allocated_pkts < thold; } static bool wl12xx_lnk_low_prio(struct wl1271 *wl, u8 hlid, struct wl1271_link *lnk) { /* any link is good for low priority */ return true; } static u32 wl12xx_convert_hwaddr(struct wl1271 *wl, u32 hwaddr) { return hwaddr << 5; } static int wl12xx_setup(struct wl1271 *wl); static struct wlcore_ops wl12xx_ops = { .setup = wl12xx_setup, .identify_chip = wl12xx_identify_chip, .boot = wl12xx_boot, .plt_init = wl12xx_plt_init, .trigger_cmd = wl12xx_trigger_cmd, .ack_event = wl12xx_ack_event, .wait_for_event = wl12xx_wait_for_event, .process_mailbox_events = wl12xx_process_mailbox_events, .calc_tx_blocks = wl12xx_calc_tx_blocks, .set_tx_desc_blocks = wl12xx_set_tx_desc_blocks, .set_tx_desc_data_len = wl12xx_set_tx_desc_data_len, .get_rx_buf_align = wl12xx_get_rx_buf_align, .get_rx_packet_len = wl12xx_get_rx_packet_len, .tx_immediate_compl = NULL, .tx_delayed_compl = wl12xx_tx_delayed_compl, .hw_init = wl12xx_hw_init, .init_vif = NULL, .convert_fw_status = wl12xx_convert_fw_status, .sta_get_ap_rate_mask = wl12xx_sta_get_ap_rate_mask, .get_pg_ver = wl12xx_get_pg_ver, .get_mac = wl12xx_get_mac, .set_tx_desc_csum = wl12xx_set_tx_desc_csum, .set_rx_csum = NULL, .ap_get_mimo_wide_rate_mask = NULL, .debugfs_init = wl12xx_debugfs_add_files, .scan_start = wl12xx_scan_start, .scan_stop = wl12xx_scan_stop, .sched_scan_start = wl12xx_sched_scan_start, .sched_scan_stop = wl12xx_scan_sched_scan_stop, .get_spare_blocks = wl12xx_get_spare_blocks, .set_key = wl12xx_set_key, .channel_switch = wl12xx_cmd_channel_switch, .pre_pkt_send = NULL, .set_peer_cap = wl12xx_set_peer_cap, .convert_hwaddr = wl12xx_convert_hwaddr, .lnk_high_prio = wl12xx_lnk_high_prio, .lnk_low_prio = wl12xx_lnk_low_prio, .interrupt_notify = NULL, .rx_ba_filter = NULL, .ap_sleep = NULL, }; static struct ieee80211_sta_ht_cap wl12xx_ht_cap = { .cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 | (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT), .ht_supported = true, .ampdu_factor = IEEE80211_HT_MAX_AMPDU_8K, .ampdu_density = IEEE80211_HT_MPDU_DENSITY_8, .mcs = { .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, .rx_highest = cpu_to_le16(72), .tx_params = IEEE80211_HT_MCS_TX_DEFINED, }, }; static const struct ieee80211_iface_limit wl12xx_iface_limits[] = { { .max = 3, .types = BIT(NL80211_IFTYPE_STATION), }, { .max = 1, .types = BIT(NL80211_IFTYPE_AP) | BIT(NL80211_IFTYPE_P2P_GO) | BIT(NL80211_IFTYPE_P2P_CLIENT), }, }; static const struct ieee80211_iface_combination wl12xx_iface_combinations[] = { { .max_interfaces = 3, .limits = wl12xx_iface_limits, .n_limits = ARRAY_SIZE(wl12xx_iface_limits), .num_different_channels = 1, }, }; static const struct wl12xx_clock wl12xx_refclock_table[] = { { 19200000, false, WL12XX_REFCLOCK_19 }, { 26000000, false, WL12XX_REFCLOCK_26 }, { 26000000, true, WL12XX_REFCLOCK_26_XTAL }, { 38400000, false, WL12XX_REFCLOCK_38 }, { 38400000, true, WL12XX_REFCLOCK_38_XTAL }, { 52000000, false, WL12XX_REFCLOCK_52 }, { 0, false, 0 } }; static const struct wl12xx_clock wl12xx_tcxoclock_table[] = { { 16368000, true, WL12XX_TCXOCLOCK_16_368 }, { 16800000, true, WL12XX_TCXOCLOCK_16_8 }, { 19200000, true, WL12XX_TCXOCLOCK_19_2 }, { 26000000, true, WL12XX_TCXOCLOCK_26 }, { 32736000, true, WL12XX_TCXOCLOCK_32_736 }, { 33600000, true, WL12XX_TCXOCLOCK_33_6 }, { 38400000, true, WL12XX_TCXOCLOCK_38_4 }, { 52000000, true, WL12XX_TCXOCLOCK_52 }, { 0, false, 0 } }; static int wl12xx_get_clock_idx(const struct wl12xx_clock *table, u32 freq, bool xtal) { int i; for (i = 0; table[i].freq != 0; i++) if ((table[i].freq == freq) && (table[i].xtal == xtal)) return table[i].hw_idx; return -EINVAL; } static int wl12xx_setup(struct wl1271 *wl) { struct wl12xx_priv *priv = wl->priv; struct wlcore_platdev_data *pdev_data = dev_get_platdata(&wl->pdev->dev); BUILD_BUG_ON(WL12XX_MAX_LINKS > WLCORE_MAX_LINKS); BUILD_BUG_ON(WL12XX_MAX_AP_STATIONS > WL12XX_MAX_LINKS); wl->rtable = wl12xx_rtable; wl->num_tx_desc = WL12XX_NUM_TX_DESCRIPTORS; wl->num_rx_desc = WL12XX_NUM_RX_DESCRIPTORS; wl->num_links = WL12XX_MAX_LINKS; wl->max_ap_stations = WL12XX_MAX_AP_STATIONS; wl->iface_combinations = wl12xx_iface_combinations; wl->n_iface_combinations = ARRAY_SIZE(wl12xx_iface_combinations); wl->num_mac_addr = WL12XX_NUM_MAC_ADDRESSES; wl->band_rate_to_idx = wl12xx_band_rate_to_idx; wl->hw_tx_rate_tbl_size = WL12XX_CONF_HW_RXTX_RATE_MAX; wl->hw_min_ht_rate = WL12XX_CONF_HW_RXTX_RATE_MCS0; wl->fw_status_len = sizeof(struct wl12xx_fw_status); wl->fw_status_priv_len = 0; wl->stats.fw_stats_len = sizeof(struct wl12xx_acx_statistics); wl->ofdm_only_ap = true; wlcore_set_ht_cap(wl, NL80211_BAND_2GHZ, &wl12xx_ht_cap); wlcore_set_ht_cap(wl, NL80211_BAND_5GHZ, &wl12xx_ht_cap); wl12xx_conf_init(wl); if (!fref_param) { priv->ref_clock = wl12xx_get_clock_idx(wl12xx_refclock_table, pdev_data->ref_clock_freq, pdev_data->ref_clock_xtal); if (priv->ref_clock < 0) { wl1271_error("Invalid ref_clock frequency (%d Hz, %s)", pdev_data->ref_clock_freq, pdev_data->ref_clock_xtal ? "XTAL" : "not XTAL"); return priv->ref_clock; } } else { if (!strcmp(fref_param, "19.2")) priv->ref_clock = WL12XX_REFCLOCK_19; else if (!strcmp(fref_param, "26")) priv->ref_clock = WL12XX_REFCLOCK_26; else if (!strcmp(fref_param, "26x")) priv->ref_clock = WL12XX_REFCLOCK_26_XTAL; else if (!strcmp(fref_param, "38.4")) priv->ref_clock = WL12XX_REFCLOCK_38; else if (!strcmp(fref_param, "38.4x")) priv->ref_clock = WL12XX_REFCLOCK_38_XTAL; else if (!strcmp(fref_param, "52")) priv->ref_clock = WL12XX_REFCLOCK_52; else wl1271_error("Invalid fref parameter %s", fref_param); } if (!tcxo_param && pdev_data->tcxo_clock_freq) { priv->tcxo_clock = wl12xx_get_clock_idx(wl12xx_tcxoclock_table, pdev_data->tcxo_clock_freq, true); if (priv->tcxo_clock < 0) { wl1271_error("Invalid tcxo_clock frequency (%d Hz)", pdev_data->tcxo_clock_freq); return priv->tcxo_clock; } } else if (tcxo_param) { if (!strcmp(tcxo_param, "19.2")) priv->tcxo_clock = WL12XX_TCXOCLOCK_19_2; else if (!strcmp(tcxo_param, "26")) priv->tcxo_clock = WL12XX_TCXOCLOCK_26; else if (!strcmp(tcxo_param, "38.4")) priv->tcxo_clock = WL12XX_TCXOCLOCK_38_4; else if (!strcmp(tcxo_param, "52")) priv->tcxo_clock = WL12XX_TCXOCLOCK_52; else if (!strcmp(tcxo_param, "16.368")) priv->tcxo_clock = WL12XX_TCXOCLOCK_16_368; else if (!strcmp(tcxo_param, "32.736")) priv->tcxo_clock = WL12XX_TCXOCLOCK_32_736; else if (!strcmp(tcxo_param, "16.8")) priv->tcxo_clock = WL12XX_TCXOCLOCK_16_8; else if (!strcmp(tcxo_param, "33.6")) priv->tcxo_clock = WL12XX_TCXOCLOCK_33_6; else wl1271_error("Invalid tcxo parameter %s", tcxo_param); } priv->rx_mem_addr = kmalloc(sizeof(*priv->rx_mem_addr), GFP_KERNEL); if (!priv->rx_mem_addr) return -ENOMEM; return 0; } static int wl12xx_probe(struct platform_device *pdev) { struct wl1271 *wl; struct ieee80211_hw *hw; int ret; hw = wlcore_alloc_hw(sizeof(struct wl12xx_priv), WL12XX_AGGR_BUFFER_SIZE, sizeof(struct wl12xx_event_mailbox)); if (IS_ERR(hw)) { wl1271_error("can't allocate hw"); ret = PTR_ERR(hw); goto out; } wl = hw->priv; wl->ops = &wl12xx_ops; wl->ptable = wl12xx_ptable; ret = wlcore_probe(wl, pdev); if (ret) goto out_free; return ret; out_free: wlcore_free_hw(wl); out: return ret; } static int wl12xx_remove(struct platform_device *pdev) { struct wl1271 *wl = platform_get_drvdata(pdev); struct wl12xx_priv *priv; if (!wl) goto out; priv = wl->priv; kfree(priv->rx_mem_addr); out: return wlcore_remove(pdev); } static const struct platform_device_id wl12xx_id_table[] = { { "wl12xx", 0 }, { } /* Terminating Entry */ }; MODULE_DEVICE_TABLE(platform, wl12xx_id_table); static struct platform_driver wl12xx_driver = { .probe = wl12xx_probe, .remove = wl12xx_remove, .id_table = wl12xx_id_table, .driver = { .name = "wl12xx_driver", } }; module_platform_driver(wl12xx_driver); module_param_named(fref, fref_param, charp, 0); MODULE_PARM_DESC(fref, "FREF clock: 19.2, 26, 26x, 38.4, 38.4x, 52"); module_param_named(tcxo, tcxo_param, charp, 0); MODULE_PARM_DESC(tcxo, "TCXO clock: 19.2, 26, 38.4, 52, 16.368, 32.736, 16.8, 33.6"); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Luciano Coelho <[email protected]>"); MODULE_FIRMWARE(WL127X_FW_NAME_SINGLE); MODULE_FIRMWARE(WL127X_FW_NAME_MULTI); MODULE_FIRMWARE(WL127X_PLT_FW_NAME); MODULE_FIRMWARE(WL128X_FW_NAME_SINGLE); MODULE_FIRMWARE(WL128X_FW_NAME_MULTI); MODULE_FIRMWARE(WL128X_PLT_FW_NAME);
{ "pile_set_name": "Github" }
// Copyright 2016 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // The go-ethereum library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. //+build windows package netutil import ( "net" "os" "syscall" ) const _WSAEMSGSIZE = syscall.Errno(10040) // isPacketTooBig reports whether err indicates that a UDP packet didn't // fit the receive buffer. On Windows, WSARecvFrom returns // code WSAEMSGSIZE and no data if this happens. func isPacketTooBig(err error) bool { if opErr, ok := err.(*net.OpError); ok { if scErr, ok := opErr.Err.(*os.SyscallError); ok { return scErr.Err == _WSAEMSGSIZE } return opErr.Err == _WSAEMSGSIZE } return false }
{ "pile_set_name": "Github" }
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/ec2/model/GetTransitGatewayRouteTablePropagationsRequest.h> #include <aws/core/utils/StringUtils.h> #include <aws/core/utils/memory/stl/AWSStringStream.h> using namespace Aws::EC2::Model; using namespace Aws::Utils; GetTransitGatewayRouteTablePropagationsRequest::GetTransitGatewayRouteTablePropagationsRequest() : m_transitGatewayRouteTableIdHasBeenSet(false), m_filtersHasBeenSet(false), m_maxResults(0), m_maxResultsHasBeenSet(false), m_nextTokenHasBeenSet(false), m_dryRun(false), m_dryRunHasBeenSet(false) { } Aws::String GetTransitGatewayRouteTablePropagationsRequest::SerializePayload() const { Aws::StringStream ss; ss << "Action=GetTransitGatewayRouteTablePropagations&"; if(m_transitGatewayRouteTableIdHasBeenSet) { ss << "TransitGatewayRouteTableId=" << StringUtils::URLEncode(m_transitGatewayRouteTableId.c_str()) << "&"; } if(m_filtersHasBeenSet) { unsigned filtersCount = 1; for(auto& item : m_filters) { item.OutputToStream(ss, "Filter.", filtersCount, ""); filtersCount++; } } if(m_maxResultsHasBeenSet) { ss << "MaxResults=" << m_maxResults << "&"; } if(m_nextTokenHasBeenSet) { ss << "NextToken=" << StringUtils::URLEncode(m_nextToken.c_str()) << "&"; } if(m_dryRunHasBeenSet) { ss << "DryRun=" << std::boolalpha << m_dryRun << "&"; } ss << "Version=2016-11-15"; return ss.str(); } void GetTransitGatewayRouteTablePropagationsRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const { uri.SetQueryString(SerializePayload()); }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2006 Mike McCormack * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #if 0 #pragma makedep install #endif [ object, uuid(0c733a8a-2a1c-11ce-ade5-00aa0044773d), pointer_default(unique) ] interface IDBProperties : IUnknown { [local] HRESULT GetProperties( [in] ULONG cPropertyIDSets, [in, size_is(cPropertyIDSets)] const DBPROPIDSET rgPropertyIDSets[], [in, out] ULONG *pcPropertySets, [out, size_is(,*pcPropertySets)] DBPROPSET **prgPropertySets); [call_as(GetProperties)] HRESULT RemoteGetProperties( [in] ULONG cPropertyIDSets, [in, unique, size_is(cPropertyIDSets)] const DBPROPIDSET *rgPropertyIDSets, [in, out] ULONG *pcPropertySets, [out, size_is(,*pcPropertySets)] DBPROPSET **prgPropertySets, [out] IErrorInfo **ppErrorInfoRem); [local] HRESULT GetPropertyInfo( [in] ULONG cPropertyIDSets, [in, size_is(cPropertyIDSets)] const DBPROPIDSET rgPropertyIDSets[], [in, out] ULONG *pcPropertyInfoSets, [out, size_is(,*pcPropertyInfoSets)] DBPROPINFOSET **prgPropertyInfoSets, [out, annotation("__deref_out_z_opt")] OLECHAR **ppDescBuffer); [call_as(GetPropertyInfo)] HRESULT RemoteGetPropertyInfo( [in] ULONG cPropertyIDSets, [in, unique, size_is(cPropertyIDSets)] const DBPROPIDSET *rgPropertyIDSets, [in, out] ULONG *pcPropertyInfoSets, [out, size_is(,*pcPropertyInfoSets)] DBPROPINFOSET **prgPropertyInfoSets, [in, out] ULONG *pcOffsets, [out, size_is(,*pcOffsets)] DBBYTEOFFSET **prgDescOffsets, [in, out] ULONG *pcbDescBuffer, [in, out, unique, size_is(,*pcbDescBuffer)] OLECHAR **ppDescBuffer, [out] IErrorInfo **ppErrorInfoRem); [local] HRESULT SetProperties( [in] ULONG cPropertySets, [in, out, size_is(cPropertySets)] DBPROPSET rgPropertySets[]); [call_as(SetProperties)] HRESULT RemoteSetProperties( [in] ULONG cPropertySets, [in, unique, size_is(cPropertySets)] DBPROPSET *rgPropertySets, [in] ULONG cTotalProps, [out, size_is(cTotalProps)] DBPROPSTATUS *rgPropStatus, [out] IErrorInfo **ppErrorInfoRem); }
{ "pile_set_name": "Github" }
import React from 'react'; import PropTypes from 'prop-types'; import { showModal } from 'components/common/Modal'; import './style.scss'; const playViaModal = (title, component, language) => showModal({ title, component, language, showFooter: false, }); const typeIconsMap = { video: 'bfi-film', audio: 'bfi-music', embed: 'bfi-code', }; const PlayerModal = ({ title, type, language, name, url, poster, children, onRemove, }) => { return ( <div className={`bf-player-holder ${type}`}> <div className="icon-badge"> <i className={typeIconsMap[type]} /> <span className="text">{language.media[type]}</span> </div> <button onMouseDown={onRemove} className="button-remove"> <i className="bfi-close" /> </button> <button onMouseDown={() => playViaModal(name ? `${title}:${name}` : title, children, language) } className="button-play" > <i className="bfi-play_arrow" /> </button> {name ? <h5 className="bf-name">{name}</h5> : null} <h6 className="bf-url">{url}</h6> {poster ? ( <div className="bf-poster" style={{ backgroundImage: `url(${poster})` }} /> ) : null} </div> ); }; PlayerModal.propTypes = { title: PropTypes.any, type: PropTypes.any, language: PropTypes.any, name: PropTypes.any, url: PropTypes.any, poster: PropTypes.any, children: PropTypes.any, onRemove: PropTypes.any, }; export default PlayerModal;
{ "pile_set_name": "Github" }
// @flow import { ReactComponentStyled } from "styled-components"; type ImageObject = {| "*"?: string, jpg?: string, webp?: string, |}; export type Props = {| placeholder?: ImageObject, original: ImageObject, name: string, |}; export type PictureProps = {| pictures: ImageObject, name: string, loaded: boolean, onLoad?: () => void, lowRes?: boolean, |}; declare export default React$ComponentType<Props>; declare export var StyledLazyImage: ReactComponentStyled<any>;
{ "pile_set_name": "Github" }
cheats = 6 cheat0_desc = "Infinite Lives - Player 1" cheat0_code = "00C0-6705" cheat0_enable = false cheat1_desc = "Infinite Lives - Player 2" cheat1_code = "00C0-6805" cheat1_enable = false cheat2_desc = "Final Round [51]" cheat2_code = "00C0-4C32+00C0-4D33" cheat2_enable = false cheat3_desc = "Collect one dot to finish a Round" cheat3_code = "00CD-0F01" cheat3_enable = false cheat4_desc = "Final Round (51)" cheat4_code = "00C0-4C32+00C0-4D33" cheat4_enable = false cheat5_desc = "Infinite Lives" cheat5_code = "00B-BCA-3BE" cheat5_enable = false
{ "pile_set_name": "Github" }
#ifndef ZC_INCREMENTALMERKLETREE_H_ #define ZC_INCREMENTALMERKLETREE_H_ #include <array> #include <deque> #include <boost/optional.hpp> #include <boost/static_assert.hpp> #include "uint256.h" #include "serialize.h" #include "Zcash.h" #include "zcash/util.h" namespace libzcash { class MerklePath { public: std::vector<std::vector<bool>> authentication_path; std::vector<bool> index; ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action) { std::vector<std::vector<unsigned char>> pathBytes; uint64_t indexInt; if (ser_action.ForRead()) { READWRITE(pathBytes); READWRITE(indexInt); MerklePath &us = *(const_cast<MerklePath*>(this)); for (size_t i = 0; i < pathBytes.size(); i++) { us.authentication_path.push_back(convertBytesVectorToVector(pathBytes[i])); us.index.push_back((indexInt >> ((pathBytes.size() - 1) - i)) & 1); } } else { assert(authentication_path.size() == index.size()); pathBytes.resize(authentication_path.size()); for (size_t i = 0; i < authentication_path.size(); i++) { pathBytes[i].resize((authentication_path[i].size()+7)/8); for (unsigned int p = 0; p < authentication_path[i].size(); p++) { pathBytes[i][p / 8] |= authentication_path[i][p] << (7-(p % 8)); } } indexInt = convertVectorToInt(index); READWRITE(pathBytes); READWRITE(indexInt); } } MerklePath() { } MerklePath(std::vector<std::vector<bool>> authentication_path, std::vector<bool> index) : authentication_path(authentication_path), index(index) { } }; template<size_t Depth, typename Hash> class EmptyMerkleRoots { public: EmptyMerkleRoots() { } Hash empty_root(size_t depth) const { return Hash::EmptyRoot(depth); } template <size_t D, typename H> friend bool operator==(const EmptyMerkleRoots<D, H>& a, const EmptyMerkleRoots<D, H>& b); private: std::array<Hash, Depth+1> empty_roots; }; template<size_t Depth, typename Hash> bool operator==(const EmptyMerkleRoots<Depth, Hash>& a, const EmptyMerkleRoots<Depth, Hash>& b) { return a.empty_roots == b.empty_roots; } template<size_t Depth, typename Hash> class IncrementalWitness; template<size_t Depth, typename Hash> class IncrementalMerkleTree { friend class IncrementalWitness<Depth, Hash>; public: BOOST_STATIC_ASSERT(Depth >= 1); IncrementalMerkleTree() { } size_t DynamicMemoryUsage() const { return 32 + // left 32 + // right parents.size() * 32; // parents } size_t size() const; void append(Hash obj); Hash root() const { return root(Depth, std::deque<Hash>()); } Hash last() const; IncrementalWitness<Depth, Hash> witness() const { return IncrementalWitness<Depth, Hash>(*this); } ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(left); READWRITE(right); READWRITE(parents); wfcheck(); } static Hash empty_root() { return emptyroots.empty_root(Depth); } template <size_t D, typename H> friend bool operator==(const IncrementalMerkleTree<D, H>& a, const IncrementalMerkleTree<D, H>& b); private: static EmptyMerkleRoots<Depth, Hash> emptyroots; boost::optional<Hash> left; boost::optional<Hash> right; // Collapsed "left" subtrees ordered toward the root of the tree. std::vector<boost::optional<Hash>> parents; MerklePath path(std::deque<Hash> filler_hashes = std::deque<Hash>()) const; Hash root(size_t depth, std::deque<Hash> filler_hashes = std::deque<Hash>()) const; bool is_complete(size_t depth = Depth) const; size_t next_depth(size_t skip) const; void wfcheck() const; }; template<size_t Depth, typename Hash> bool operator==(const IncrementalMerkleTree<Depth, Hash>& a, const IncrementalMerkleTree<Depth, Hash>& b) { return (a.emptyroots == b.emptyroots && a.left == b.left && a.right == b.right && a.parents == b.parents); } template <size_t Depth, typename Hash> class IncrementalWitness { friend class IncrementalMerkleTree<Depth, Hash>; public: // Required for Unserialize() IncrementalWitness() {} MerklePath path() const { return tree.path(partial_path()); } // Return the element being witnessed (should be a note // commitment!) Hash element() const { return tree.last(); } uint64_t position() const { return tree.size() - 1; } Hash root() const { return tree.root(Depth, partial_path()); } void append(Hash obj); ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action) { READWRITE(tree); READWRITE(filled); READWRITE(cursor); cursor_depth = tree.next_depth(filled.size()); } template <size_t D, typename H> friend bool operator==(const IncrementalWitness<D, H>& a, const IncrementalWitness<D, H>& b); private: IncrementalMerkleTree<Depth, Hash> tree; std::vector<Hash> filled; boost::optional<IncrementalMerkleTree<Depth, Hash>> cursor; size_t cursor_depth = 0; std::deque<Hash> partial_path() const; IncrementalWitness(IncrementalMerkleTree<Depth, Hash> tree) : tree(tree) {} }; template<size_t Depth, typename Hash> bool operator==(const IncrementalWitness<Depth, Hash>& a, const IncrementalWitness<Depth, Hash>& b) { return (a.tree == b.tree && a.filled == b.filled && a.cursor == b.cursor && a.cursor_depth == b.cursor_depth); } class SHA256Compress : public uint256 { public: SHA256Compress() : uint256() {} SHA256Compress(uint256 contents) : uint256(contents) { } static SHA256Compress combine( const SHA256Compress& a, const SHA256Compress& b, size_t depth ); static SHA256Compress uncommitted() { return SHA256Compress(); } static SHA256Compress EmptyRoot(size_t); }; class PedersenHash : public uint256 { public: PedersenHash() : uint256() {} PedersenHash(uint256 contents) : uint256(contents) { } static PedersenHash combine( const PedersenHash& a, const PedersenHash& b, size_t depth ); static PedersenHash uncommitted(); static PedersenHash EmptyRoot(size_t); }; template<size_t Depth, typename Hash> EmptyMerkleRoots<Depth, Hash> IncrementalMerkleTree<Depth, Hash>::emptyroots; } // end namespace `libzcash` typedef libzcash::IncrementalMerkleTree<INCREMENTAL_MERKLE_TREE_DEPTH, libzcash::SHA256Compress> SproutMerkleTree; typedef libzcash::IncrementalMerkleTree<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, libzcash::SHA256Compress> SproutTestingMerkleTree; typedef libzcash::IncrementalWitness<INCREMENTAL_MERKLE_TREE_DEPTH, libzcash::SHA256Compress> SproutWitness; typedef libzcash::IncrementalWitness<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, libzcash::SHA256Compress> SproutTestingWitness; typedef libzcash::IncrementalMerkleTree<SAPLING_INCREMENTAL_MERKLE_TREE_DEPTH, libzcash::PedersenHash> SaplingMerkleTree; typedef libzcash::IncrementalMerkleTree<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, libzcash::PedersenHash> SaplingTestingMerkleTree; typedef libzcash::IncrementalWitness<SAPLING_INCREMENTAL_MERKLE_TREE_DEPTH, libzcash::PedersenHash> SaplingWitness; typedef libzcash::IncrementalWitness<INCREMENTAL_MERKLE_TREE_DEPTH_TESTING, libzcash::PedersenHash> SaplingTestingWitness; #endif /* ZC_INCREMENTALMERKLETREE_H_ */
{ "pile_set_name": "Github" }
package com.dozingcatsoftware.vectorpinball.fields; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.Body; import com.dozingcatsoftware.vectorpinball.model.Ball; import com.dozingcatsoftware.vectorpinball.model.BaseFieldDelegate; import com.dozingcatsoftware.vectorpinball.model.Field; import com.dozingcatsoftware.vectorpinball.elements.DropTargetGroupElement; import com.dozingcatsoftware.vectorpinball.elements.FieldElement; import com.dozingcatsoftware.vectorpinball.elements.RolloverGroupElement; import com.dozingcatsoftware.vectorpinball.elements.SensorElement; import com.dozingcatsoftware.vectorpinball.elements.WallElement; public class Field2Delegate extends BaseFieldDelegate { static final double TAU = 2 * Math.PI; // pi is wrong. static class RotatingGroup { String[] elementIDs; double centerX, centerY; double radius; double rotationSpeed; double startAngle; double currentAngle; double angleIncrement; RotatingGroup( String[] ids, double cx, double cy, double radius, double startAngle, double speed) { this.elementIDs = ids; this.centerX = cx; this.centerY = cy; this.radius = radius; this.rotationSpeed = speed; this.startAngle = this.currentAngle = startAngle; this.angleIncrement = TAU / ids.length; } /** * Creates a RotatingGroup by computing the distance and angle to center from the first * element ID in the ids array. */ static RotatingGroup create( Field field, String[] ids, double cx, double cy, double speed) { FieldElement element = field.getFieldElementById(ids[0]); Body body = element.getBodies().get(0); Vector2 position = body.getPosition(); double radius = Math.hypot(position.x - cx, position.y - cy); double angle = Math.atan2(position.y - cy, position.x - cx); return new RotatingGroup(ids, cx, cy, radius, angle, speed); } void applyRotation(Field field, double dt) { currentAngle += dt * rotationSpeed; if (currentAngle > TAU) currentAngle -= TAU; if (currentAngle < 0) currentAngle += TAU; for (int i = 0; i < elementIDs.length; i++) { double angle = currentAngle + angleIncrement * i; FieldElement element = field.getFieldElementById(elementIDs[i]); Body body = element.getBodies().get(0); double x = centerX + radius * Math.cos(angle); double y = centerY + radius * Math.sin(angle); body.setTransform((float) x, (float) y, body.getAngle()); } } } RotatingGroup[] rotatingGroups; RotatingGroup createRotatingGroup(Field field, String centerID, String[] ids, double speed) { FieldElement centerElement = field.getFieldElementById(centerID); Vector2 centerPosition = centerElement.getBodies().get(0).getPosition(); return RotatingGroup.create(field, ids, centerPosition.x, centerPosition.y, speed); } private void setupRotatingGroups(Field field) { // Read rotation params from variables defined in the field. float b1Speed = ((Number) field.getValueWithKey("RotatingBumper1Speed")).floatValue(); float b2Speed = ((Number) field.getValueWithKey("RotatingBumper2Speed")).floatValue(); float b2cx = ((Number) field.getValueWithKey("RotatingBumper2CenterX")).floatValue(); float b2cy = ((Number) field.getValueWithKey("RotatingBumper2CenterY")).floatValue(); String[] group1Ids = { "RotatingBumper1A", "RotatingBumper1B", "RotatingBumper1C", "RotatingBumper1D" }; rotatingGroups = new RotatingGroup[] { createRotatingGroup(field, "CenterBumper1", group1Ids, b1Speed), RotatingGroup.create(field, new String[] {"RotatingBumper2A", "RotatingBumper2B"}, b2cx, b2cy, b2Speed) }; } @Override public void tick(Field field, long nanos) { if (rotatingGroups == null) { setupRotatingGroups(field); } double seconds = nanos / 1e9; for (RotatingGroup rotatingGroup : rotatingGroups) { rotatingGroup.applyRotation(field, seconds); } } private void restoreLeftBallSaver(Field field) { ((WallElement) field.getFieldElementById("BallSaver-left")).setRetracted(false); } private void restoreRightBallSaver(Field field) { ((WallElement) field.getFieldElementById("BallSaver-right")).setRetracted(false); } private void startMultiball(final Field field) { field.showGameMessage(field.resolveString("multiball_started_message"), 2000); restoreLeftBallSaver(field); restoreRightBallSaver(field); Runnable launchBall = () -> { if (field.getBalls().size() < 3) field.launchBall(); }; field.scheduleAction(1000, launchBall); field.scheduleAction(3500, launchBall); } /** * Always return true so the rotating bumpers animate smoothly */ @Override public boolean isFieldActive(Field field) { return true; } @Override public void allRolloversInGroupActivated( Field field, RolloverGroupElement rolloverGroup, Ball ball) { // Rollover groups increment field multiplier when all rollovers are activated. rolloverGroup.setAllRolloversActivated(false); field.incrementAndDisplayScoreMultiplier(1500); } @Override public void processCollision(Field field, FieldElement element, Body hitBody, Ball ball) { // When center red bumper is hit, start multiball if all center rollovers are lit, // otherwise retract left barrier. String elementID = element.getElementId(); if ("CenterBumper1".equals(elementID)) { WallElement barrier = field.getFieldElementById("LeftTubeBarrier"); RolloverGroupElement multiballRollovers = field.getFieldElementById("ExtraBallRollovers"); if (multiballRollovers.allRolloversActive()) { barrier.setRetracted(false); startMultiball(field); multiballRollovers.setAllRolloversActivated(false); } else { // don't retract during multiball if (field.getBalls().size() == 1) { barrier.setRetracted(true); } } } } @Override public void allDropTargetsInGroupHit( Field field, DropTargetGroupElement targetGroup, Ball ball) { // activate ball saver for left and right groups, "increment" multiball rollover for // left/right/center column int startRolloverIndex = -1; String id = targetGroup.getElementId(); if ("DropTargetLeft".equals(id)) { restoreLeftBallSaver(field); field.showGameMessage(field.resolveString("left_save_enabled_message"), 1500); startRolloverIndex = 0; } else if ("DropTargetRight".equals(id)) { restoreRightBallSaver(field); field.showGameMessage(field.resolveString("right_save_enabled_message"), 1500); startRolloverIndex = 2; } else if ("DropTargetTopLeft".equals(id)) { startRolloverIndex = 1; } // activate next rollover for appropriate column if possible if (startRolloverIndex >= 0) { RolloverGroupElement multiballRollovers = field.getFieldElementById("ExtraBallRollovers"); int numRollovers = multiballRollovers.numberOfRollovers(); while (startRolloverIndex < numRollovers) { if (!multiballRollovers.isRolloverActiveAtIndex(startRolloverIndex)) { multiballRollovers.setRolloverActiveAtIndex(startRolloverIndex, true); if (multiballRollovers.allRolloversActive()) { field.showGameMessage(field.resolveString( "shoot_red_bumper_message"), 1500); } break; } else { startRolloverIndex += 3; } } } } // support for enabling launch barrier after ball passes by it and hits sensor, and disabling // for new ball or new game void setLaunchBarrierEnabled(Field field, boolean enabled) { WallElement barrier = field.getFieldElementById("LaunchBarrier"); barrier.setRetracted(!enabled); } @Override public void ballInSensorRange(final Field field, SensorElement sensor, Ball ball) { String sensorID = sensor.getElementId(); // enable launch barrier if ("LaunchBarrierSensor".equals(sensorID)) { setLaunchBarrierEnabled(field, true); } else if ("LaunchBarrierRetract".equals(sensorID)) { setLaunchBarrierEnabled(field, false); } else if ("LeftTubeSensor".equals(sensorID)) { if (ball.getLinearVelocity().y > 0) { // ball going up, retract barrier after delay field.scheduleAction(1000, () -> { WallElement barrier = field.getFieldElementById("LeftTubeBarrier"); barrier.setRetracted(false); }); } } } @Override public void gameStarted(Field field) { setLaunchBarrierEnabled(field, false); } @Override public void ballLost(Field field) { setLaunchBarrierEnabled(field, false); } }
{ "pile_set_name": "Github" }
"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "O app %1$@ %2$@ foi baixado e está pronto para uso! Esta é uma atualização importante; deseja instalar e reabrir o app %1$@ agora?"; "%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "O app %1$@ %2$@ foi baixado e está pronto para uso! Deseja instalar e reabrir o app %1$@ agora?"; "%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "O app %1$@ não pode ser atualizado porque foi aberto de um volume somente leitura ou local temporário."; "Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Use o Finder para copiar o app %1$@ para a pasta Aplicativos, reabra-o e tente novamente."; "%@ %@ is currently the newest version available." = "%1$@ %2$@ é a versão mais recente disponível."; "%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ é a versão mais recente disponível.\n(Você está usando a versão %3$@.)"; /* Description text for SUUpdateAlert when the update is downloadable. */ "%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ está disponível — sua versão é %3$@. Deseja baixá-la agora?"; /* Description text for SUUpdateAlert when the update informational with no download. */ "%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ está disponível — sua versão é %3$@. Deseja saber mais sobre esta atualização na web?"; "%@ downloaded" = "%@ baixados"; "%@ of %@" = "%1$@ de %2$@"; "A new version of %@ is available!" = "Uma nova versão do app %@ está disponível!"; "A new version of %@ is ready to install!" = "Uma nova versão do app %@ está pronta para ser instalada!"; "An error occurred in retrieving update information. Please try again later." = "Ocorreu um erro ao obter informações da atualização. Tente novamente mais tarde."; "An error occurred while downloading the update. Please try again later." = "Ocorreu um erro ao baixar a atualização. Tente novamente mais tarde."; "An error occurred while extracting the archive. Please try again later." = "Ocorreu um erro ao extrair o arquivo comprimido. Tente novamente mais tarde."; "An error occurred while installing the update. Please try again later." = "Ocorreu um erro ao instalar a atualização. Tente novamente mais tarde."; "An error occurred while parsing the update feed." = "Ocorreu um erro ao analisar o feed de atualização."; "An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Ocorreu um erro ao reabrir o app %1$@. A nova versão estará disponível da próxima vez que você abrir o app %1$@."; "An important update to %@ is ready to install" = "Uma atualização importante do app %@ está pronta para ser instalada!"; /* the unit for bytes */ "B" = "B"; "Cancel" = "Cancelar"; "Cancel Update" = "Cancelar Atualização"; "Checking for updates..." = "Buscando atualizações…"; /* Take care not to overflow the status window. */ "Downloading update..." = "Baixando atualização…"; /* Take care not to overflow the status window. */ "Extracting update..." = "Extraindo atualização…"; /* the unit for gigabytes */ "GB" = "GB"; "Install and Relaunch" = "Instalar e Reabrir"; /* Take care not to overflow the status window. */ "Installing update..." = "Instalando atualização…"; /* the unit for kilobytes */ "KB" = "KB"; /* Alternative name for "Install" button if we have a paid update or other update without a download but with a URL. */ "Learn More..." = "Saber Mais…"; /* the unit for megabytes */ "MB" = "MB"; /* OK button. */ "OK" = "OK"; /* Status message on progress window once download has finished. */ "Ready to Install" = "Pronto para Instalar"; /* Message that is optionally shown at startup to allow users to turn on/off update checks. */ "Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Deseja que o app %1$@ busque atualizações automaticamente? Você pode buscar atualizações manualmente, através do menu %1$@."; "The update is improperly signed." = "A atualização está assinada incorretamente."; "Update Error!" = "Erro de atualização!"; "Updating %@" = "Atualizando o app %@"; /* 'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI) */ "You already have the newest version of %@." = "Você já possui a versão mais recente do app %@."; /* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */ "You're up-to-date!" = "O app está atualizado!";
{ "pile_set_name": "Github" }
/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * * 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 OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 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. */ using System; using System.Collections.Generic; using OpenMetaverse; using Mono.Addins; using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.CoreModules.World.Wind.Plugins { [Extension(Path = "/OpenSim/WindModule", NodeName = "WindModel", Id = "SimpleRandomWind")] class SimpleRandomWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin { private Vector2[] m_windSpeeds = new Vector2[16 * 16]; private float m_strength = 1.0f; private Random m_rndnums = new Random(Environment.TickCount); #region IPlugin Members public string Version { get { return "1.0.0.0"; } } public string Name { get { return "SimpleRandomWind"; } } public void Initialise() { } #endregion #region IDisposable Members public void Dispose() { m_windSpeeds = null; } #endregion #region IWindModelPlugin Members public void WindConfig(OpenSim.Region.Framework.Scenes.Scene scene, Nini.Config.IConfig windConfig) { if (windConfig != null) { if (windConfig.Contains("strength")) { m_strength = windConfig.GetFloat("strength", 1.0F); } } } public bool WindUpdate(uint frame) { //Make sure our object is valid (we haven't been disposed of yet) if (m_windSpeeds == null) return false; for (int y = 0; y < 16; y++) { for (int x = 0; x < 16; x++) { m_windSpeeds[y * 16 + x].X = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1 m_windSpeeds[y * 16 + x].Y = (float)(m_rndnums.NextDouble() * 2d - 1d); // -1 to 1 m_windSpeeds[y * 16 + x].X *= m_strength; m_windSpeeds[y * 16 + x].Y *= m_strength; } } return true; } public Vector3 WindSpeed(float fX, float fY, float fZ) { Vector3 windVector = new Vector3(0.0f, 0.0f, 0.0f); int x = (int)fX / 16; int y = (int)fY / 16; if (x < 0) x = 0; if (x > 15) x = 15; if (y < 0) y = 0; if (y > 15) y = 15; if (m_windSpeeds != null) { windVector.X = m_windSpeeds[y * 16 + x].X; windVector.Y = m_windSpeeds[y * 16 + x].Y; } return windVector; } public Vector2[] WindLLClientArray() { return m_windSpeeds; } public string Description { get { return "Provides a simple wind model that creates random wind of a given strength in 16m x 16m patches."; } } public System.Collections.Generic.Dictionary<string, string> WindParams() { Dictionary<string, string> Params = new Dictionary<string, string>(); Params.Add("strength", "wind strength"); return Params; } public void WindParamSet(string param, float value) { switch (param) { case "strength": m_strength = value; break; } } public float WindParamGet(string param) { switch (param) { case "strength": return m_strength; default: throw new Exception(String.Format("Unknown {0} parameter {1}", this.Name, param)); } } #endregion } }
{ "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.brooklyn.util.core.internal.ssh.sshj; import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; import java.io.File; import java.io.IOException; import net.schmizz.sshj.SSHClient; import net.schmizz.sshj.transport.verification.PromiscuousVerifier; import net.schmizz.sshj.userauth.keyprovider.OpenSSHKeyFile; import net.schmizz.sshj.userauth.password.PasswordUtils; import org.apache.brooklyn.util.core.internal.ssh.SshAbstractTool.SshAction; import org.apache.brooklyn.util.groovy.GroovyJavaMethods; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.base.Objects; import com.google.common.net.HostAndPort; /** based on code from jclouds */ public class SshjClientConnection implements SshAction<SSHClient> { private static final Logger LOG = LoggerFactory.getLogger(SshjClientConnection.class); public static Builder builder() { return new Builder(); } public static class Builder { protected HostAndPort hostAndPort; protected String username; protected String password; protected String privateKeyPassphrase; protected String privateKeyData; protected File privateKeyFile; protected long connectTimeout; protected long sessionTimeout; protected boolean strictHostKeyChecking; public Builder hostAndPort(HostAndPort hostAndPort) { this.hostAndPort = hostAndPort; return this; } public Builder username(String username) { this.username = username; return this; } public Builder password(String val) { this.password = val; return this; } /** @deprecated use privateKeyData */ public Builder privateKey(String val) { this.privateKeyData = val; return this; } public Builder privateKeyPassphrase(String val) { this.privateKeyPassphrase = val; return this; } public Builder privateKeyData(String val) { this.privateKeyData = val; return this; } public Builder privateKeyFile(File val) { this.privateKeyFile = val; return this; } public Builder strictHostKeyChecking(boolean val) { this.strictHostKeyChecking = val; return this; } public Builder connectTimeout(long connectTimeout) { this.connectTimeout = connectTimeout; return this; } public Builder sessionTimeout(long sessionTimeout) { this.sessionTimeout = sessionTimeout; return this; } public SshjClientConnection build() { return new SshjClientConnection(this); } protected static Builder fromSSHClientConnection(SshjClientConnection in) { return new Builder().hostAndPort(in.getHostAndPort()).connectTimeout(in.getConnectTimeout()).sessionTimeout( in.getSessionTimeout()).username(in.username).password(in.password).privateKey(in.privateKeyData).privateKeyFile(in.privateKeyFile); } } private final HostAndPort hostAndPort; private final String username; private final String password; private final String privateKeyPassphrase; private final String privateKeyData; private final File privateKeyFile; private final boolean strictHostKeyChecking; private final int connectTimeout; private final int sessionTimeout; SSHClient ssh; private SshjClientConnection(Builder builder) { this.hostAndPort = checkNotNull(builder.hostAndPort); this.username = builder.username; this.password = builder.password; this.privateKeyPassphrase = builder.privateKeyPassphrase; this.privateKeyData = builder.privateKeyData; this.privateKeyFile = builder.privateKeyFile; this.strictHostKeyChecking = builder.strictHostKeyChecking; this.connectTimeout = checkInt("connectTimeout", builder.connectTimeout, Integer.MAX_VALUE); this.sessionTimeout = checkInt("sessionTimeout", builder.sessionTimeout, Integer.MAX_VALUE); } static Integer checkInt(String context, long value, Integer ifTooLarge) { if (value > Integer.MAX_VALUE) { LOG.warn("Value '"+value+"' for "+context+" too large in SshjClientConnection; using "+value); return ifTooLarge; } return (int)value; } public boolean isConnected() { return ssh != null && ssh.isConnected(); } public boolean isAuthenticated() { return ssh != null && ssh.isAuthenticated(); } @Override public void clear() { if (ssh != null && ssh.isConnected()) { try { if (LOG.isTraceEnabled()) LOG.trace("Disconnecting SshjClientConnection {} ({})", this, System.identityHashCode(this)); ssh.disconnect(); } catch (IOException e) { if (LOG.isDebugEnabled()) LOG.debug("<< exception disconnecting from {}: {}", e, e.getMessage()); } } ssh = null; } @Override public SSHClient create() throws Exception { if (LOG.isTraceEnabled()) LOG.trace("Connecting SshjClientConnection {} ({})", this, System.identityHashCode(this)); ssh = new net.schmizz.sshj.SSHClient(); if (!strictHostKeyChecking) { ssh.addHostKeyVerifier(new PromiscuousVerifier()); } if (connectTimeout != 0) { ssh.setConnectTimeout(connectTimeout); } if (sessionTimeout != 0) { ssh.setTimeout(sessionTimeout); } ssh.connect(hostAndPort.getHostText(), hostAndPort.getPortOrDefault(22)); if (password != null) { ssh.authPassword(username, password); } else if (privateKeyData != null) { OpenSSHKeyFile key = new OpenSSHKeyFile(); key.init(privateKeyData, null, GroovyJavaMethods.truth(privateKeyPassphrase) ? PasswordUtils.createOneOff(privateKeyPassphrase.toCharArray()) : null); ssh.authPublickey(username, key); } else if (privateKeyFile != null) { OpenSSHKeyFile key = new OpenSSHKeyFile(); key.init(privateKeyFile, GroovyJavaMethods.truth(privateKeyPassphrase) ? PasswordUtils.createOneOff(privateKeyPassphrase.toCharArray()) : null); ssh.authPublickey(username, key); } else { // Accept defaults (in ~/.ssh) ssh.authPublickey(username); } return ssh; } /** * @return host and port, where port if not present defaults to {@code 22} */ public HostAndPort getHostAndPort() { return hostAndPort; } /** * @return username used in this ssh */ public String getUsername() { return username; } /** * * @return how long to wait for the initial connection to be made */ public int getConnectTimeout() { return connectTimeout; } /** * * @return how long to keep the ssh open, or {@code 0} for indefinitely */ public int getSessionTimeout() { return sessionTimeout; } /** * * @return the current ssh or {@code null} if not connected */ public SSHClient getSSHClient() { return ssh; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SshjClientConnection that = SshjClientConnection.class.cast(o); return equal(this.hostAndPort, that.hostAndPort) && equal(this.username, that.username) && equal(this.password, that.password) && equal(this.privateKeyData, that.privateKeyData) && equal(this.privateKeyFile, that.privateKeyFile) && equal(this.ssh, that.ssh); } @Override public int hashCode() { return Objects.hashCode(hostAndPort, username, password, privateKeyData, ssh); } @Override public String toString() { return Objects.toStringHelper("") .add("hostAndPort", hostAndPort) .add("user", username) .add("ssh", ssh != null ? ssh.hashCode() : null) .add("password", (password != null ? "xxxxxx" : null)) .add("privateKeyFile", privateKeyFile) .add("privateKey", (privateKeyData != null ? "xxxxxx" : null)) .add("connectTimeout", connectTimeout) .add("sessionTimeout", sessionTimeout).toString(); } }
{ "pile_set_name": "Github" }
/***************************************************************************** * * * This file is part of the BeanShell Java Scripting distribution. * * Documentation and updates may be found at http://www.beanshell.org/ * * * * Sun Public License Notice: * * * * The contents of this file are subject to the Sun Public License Version * * 1.0 (the "License"); you may not use this file except in compliance with * * the License. A copy of the License is available at http://www.sun.com * * * * The Original Code is BeanShell. The Initial Developer of the Original * * Code is Pat Niemeyer. Portions created by Pat Niemeyer are Copyright * * (C) 2000. All Rights Reserved. * * * * GNU Public License Notice: * * * * Alternatively, the contents of this file may be used under the terms of * * the GNU Lesser General Public License (the "LGPL"), in which case the * * provisions of LGPL are applicable instead of those above. If you wish to * * allow use of your version of this file only under the terms of the LGPL * * and not to allow others to use your version of this file under the SPL, * * indicate your decision by deleting the provisions above and replace * * them with the notice and other provisions required by the LGPL. If you * * do not delete the provisions above, a recipient may use your version of * * this file under either the SPL or the LGPL. * * * * Patrick Niemeyer ([email protected]) * * Author of Learning Java, O'Reilly & Associates * * http://www.pat.net/~pat/ * * * *****************************************************************************/ package bsh; class BSHTypedVariableDeclaration extends SimpleNode { public Modifiers modifiers; BSHTypedVariableDeclaration(int id) { super(id); } private BSHType getTypeNode() { return ((BSHType)jjtGetChild(0)); } Class evalType( CallStack callstack, Interpreter interpreter ) throws EvalError { BSHType typeNode = getTypeNode(); return typeNode.getType( callstack, interpreter ); } BSHVariableDeclarator [] getDeclarators() { int n = jjtGetNumChildren(); int start=1; BSHVariableDeclarator [] bvda = new BSHVariableDeclarator[ n-start ]; for (int i = start; i < n; i++) { bvda[i-start] = (BSHVariableDeclarator)jjtGetChild(i); } return bvda; } /** evaluate the type and one or more variable declarators, e.g.: int a, b=5, c; */ public Object eval( CallStack callstack, Interpreter interpreter) throws EvalError { try { NameSpace namespace = callstack.top(); BSHType typeNode = getTypeNode(); Class type = typeNode.getType( callstack, interpreter ); BSHVariableDeclarator [] bvda = getDeclarators(); for (int i = 0; i < bvda.length; i++) { BSHVariableDeclarator dec = bvda[i]; // Type node is passed down the chain for array initializers // which need it under some circumstances Object value = dec.eval( typeNode, callstack, interpreter); try { namespace.setTypedVariable( dec.name, type, value, modifiers ); } catch ( UtilEvalError e ) { throw e.toEvalError( this, callstack ); } } } catch ( EvalError e ) { e.reThrow( "Typed variable declaration" ); } return Primitive.VOID; } public String getTypeDescriptor( CallStack callstack, Interpreter interpreter, String defaultPackage ) { return getTypeNode().getTypeDescriptor( callstack, interpreter, defaultPackage ); } }
{ "pile_set_name": "Github" }
/// @ref gtx_transform namespace glm { template<typename T, qualifier Q> GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(vec<3, T, Q> const& v) { return translate(mat<4, 4, T, Q>(static_cast<T>(1)), v); } template<typename T, qualifier Q> GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate(T angle, vec<3, T, Q> const& v) { return rotate(mat<4, 4, T, Q>(static_cast<T>(1)), angle, v); } template<typename T, qualifier Q> GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale(vec<3, T, Q> const& v) { return scale(mat<4, 4, T, Q>(static_cast<T>(1)), v); } }//namespace glm
{ "pile_set_name": "Github" }
/* _____ __ ___ __ ____ _ __ / ___/__ ___ _ ___ / |/ /__ ___ / /_____ __ __/ __/_______(_)__ / /_ / (_ / _ `/ ' \/ -_) /|_/ / _ \/ _ \/ '_/ -_) // /\ \/ __/ __/ / _ \/ __/ \___/\_,_/_/_/_/\__/_/ /_/\___/_//_/_/\_\\__/\_, /___/\__/_/ /_/ .__/\__/ /___/ /_/ See Copyright Notice in gmMachine.h */ #include "gmConfig.h" #include "gmFunctionObject.h" #include "gmMachine.h" gmFunctionObject::gmFunctionObject() { m_cFunction = NULL; m_cUserData = NULL; m_debugInfo = NULL; m_byteCode = NULL; m_byteCodeLength = 0; m_maxStackSize = 1; // return value m_numLocals = 0; m_numParams = 0; m_numParamsLocals = 0; m_numReferences = 0; m_references = NULL; } void gmFunctionObject::Destruct(gmMachine * a_machine) { if(m_references) { a_machine->Sys_Free(m_references); m_references = NULL; } if(m_byteCode) { a_machine->Sys_Free(m_byteCode); m_byteCode = NULL; } if(m_debugInfo) { if(m_debugInfo->m_debugName) { a_machine->Sys_Free(m_debugInfo->m_debugName); } if(m_debugInfo->m_lineInfo) { a_machine->Sys_Free(m_debugInfo->m_lineInfo); } if(m_debugInfo->m_symbols) { int i; for(i = 0; i < m_numParamsLocals; ++i) { a_machine->Sys_Free(m_debugInfo->m_symbols[i]); } a_machine->Sys_Free(m_debugInfo->m_symbols); } a_machine->Sys_Free(m_debugInfo); m_debugInfo = NULL; } #if GM_USE_INCGC a_machine->DestructDeleteObject(this); #endif //GM_USE_INCGC } #if GM_USE_INCGC bool gmFunctionObject::Trace(gmMachine * a_machine, gmGarbageCollector* a_gc, const int a_workLeftToGo, int& a_workDone) { int i; for(i = 0; i < m_numReferences; ++i) { gmObject * object = a_machine->GetObject(m_references[i]); a_gc->GetNextObject(object); ++a_workDone; } ++a_workDone; return true; } #else //GM_USE_INCGC void gmFunctionObject::Mark(gmMachine * a_machine, gmuint32 a_mark) { if(m_mark != GM_MARK_PERSIST) m_mark = a_mark; int i; for(i = 0; i < m_numReferences; ++i) { gmObject * object = a_machine->GetObject(m_references[i]); if(object->NeedsMark(a_mark)) object->Mark(a_machine, a_mark); } } #endif //GM_USE_INCGC bool gmFunctionObject::Init(gmMachine * a_machine, bool a_debug, gmFunctionInfo &a_info, gmuint32 a_sourceId) { // byte code if(a_info.m_byteCodeLength) { m_byteCode = (gmuint8 *) a_machine->Sys_Alloc(a_info.m_byteCodeLength); memcpy(m_byteCode, a_info.m_byteCode, a_info.m_byteCodeLength); m_byteCodeLength = a_info.m_byteCodeLength; } else { m_byteCode = NULL; m_byteCodeLength = 0; } // stack info m_maxStackSize = a_info.m_maxStackSize; m_numLocals = a_info.m_numLocals; m_numParams = a_info.m_numParams; m_numParamsLocals = a_info.m_numParams + a_info.m_numLocals; // references m_numReferences = 0; m_references = NULL; if(m_byteCode) { // find the objects this function references by iterating over the byte code and collecting them. // we could perform this step in the compilation phase if we don't want to iterate over the byte code. gmptr * references = (gmptr *) GM_NEW( char[a_info.m_byteCodeLength] ); union { const gmuint8 * instruction; const gmuint32 * instruction32; }; instruction = (const gmuint8 *) m_byteCode; const gmuint8 * end = instruction + m_byteCodeLength; for(;instruction < end;) { switch(*(instruction32++)) { case BC_GETDOT : case BC_SETDOT : case BC_BRA : case BC_BRZ : case BC_BRNZ : case BC_BRZK : case BC_BRNZK : case BC_FOREACH : case BC_GETGLOBAL : case BC_SETGLOBAL : case BC_GETTHIS : case BC_SETTHIS : instruction += sizeof(gmptr); break; case BC_PUSHINT : instruction += sizeof(gmint); break; case BC_PUSHFP : instruction += sizeof(gmfloat); break; case BC_CALL : case BC_GETLOCAL : case BC_SETLOCAL : instruction += sizeof(gmuint32); break; case BC_PUSHSTR : case BC_PUSHFN : { // if the reference does not already exist, add it. gmptr reference = *((gmptr *) instruction); instruction += sizeof(gmptr); int i; for(i = 0; i < m_numReferences; ++i) { if(references[i] == reference) break; } if(i == m_numReferences) references[m_numReferences++] = reference; break; } default : break; } } if(m_numReferences > 0) { m_references = (gmptr *) a_machine->Sys_Alloc(sizeof(gmptr) * m_numReferences); memcpy(m_references, references, sizeof(gmptr) * m_numReferences); } delete [] (char*) references; } // debug info m_debugInfo = NULL; if(a_debug) { m_debugInfo = (gmFunctionObjectDebugInfo *) a_machine->Sys_Alloc(sizeof(gmFunctionObjectDebugInfo)); memset(m_debugInfo, 0, sizeof(gmFunctionObjectDebugInfo)); // source code id m_debugInfo->m_sourceId = a_sourceId; // debug name if(a_info.m_debugName) { int len = (int)strlen(a_info.m_debugName) + 1; m_debugInfo->m_debugName = (char *) a_machine->Sys_Alloc(len); memcpy(m_debugInfo->m_debugName, a_info.m_debugName, len); } // symbols if(a_info.m_symbols) { m_debugInfo->m_symbols = (char **) a_machine->Sys_Alloc(sizeof(char *) * m_numParamsLocals); int i; for(i = 0; i < m_numParamsLocals; ++i) { int len = (int)strlen(a_info.m_symbols[i]) + 1; m_debugInfo->m_symbols[i] = (char *) a_machine->Sys_Alloc(len); memcpy(m_debugInfo->m_symbols[i], a_info.m_symbols[i], len); } } // line number debugging. if(a_info.m_lineInfo) { // alloc and copy m_debugInfo->m_lineInfo = (gmLineInfo *) a_machine->Sys_Alloc(sizeof(gmLineInfo) * a_info.m_lineInfoCount); memcpy(m_debugInfo->m_lineInfo, a_info.m_lineInfo, sizeof(gmLineInfo) * a_info.m_lineInfoCount); m_debugInfo->m_lineInfoCount = a_info.m_lineInfoCount; } } return true; } int gmFunctionObject::GetLine(int a_address) const { if(m_debugInfo && m_debugInfo->m_lineInfo) { int i; for(i = 0; i < m_debugInfo->m_lineInfoCount; ++i) { if(a_address < m_debugInfo->m_lineInfo[i].m_address) { // return entry before if(i > 0) --i; return m_debugInfo->m_lineInfo[i].m_lineNumber; } } return m_debugInfo->m_lineInfo[i - 1].m_lineNumber; } return 0; } const void * gmFunctionObject::GetInstructionAtLine(int a_line) const { if(m_debugInfo && m_debugInfo->m_lineInfo && m_byteCode) { // serach for the first address using this line. int i; for(i = 0; i < m_debugInfo->m_lineInfoCount; ++i) { if(m_debugInfo->m_lineInfo[i].m_lineNumber == a_line) { return (void *) ((char *) m_byteCode + m_debugInfo->m_lineInfo[i].m_address); } } } return NULL; } gmuint32 gmFunctionObject::GetSourceId() const { if(m_debugInfo) { return m_debugInfo->m_sourceId; } return 0; }
{ "pile_set_name": "Github" }
<h1>Ajax Kullanımı</h1> React ile istediğiniz herhangi bir AJAX kütüphanesini kullanabilirsiniz. Popüler olanlar <a href="https://github.com/axios/axios">Axios</a>, <a href="https://api.jquery.com/jQuery.ajax/">jQuery AJAX</a> ve tarayıcıda yerleşik olarak bulunan <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">window.fetch</a>. <h2>Lifecycleda AJAX isteğini nerede yapmalıyım?</h2> AJAX isteklerini `componentDidMount` fonksiyonunda kullanmalısınız. AJAX isteğinden gelen veriyi `setState` yardımıyla state'e atarak componentin içerisinde kullanabilirsiniz. Aşağıdaki component, `state`i doldurmak için `componentDidMount`ta bir AJAX çağrısının nasıl yapılacağını gösterir: ```js { items: [ { id: 1, name: "Apples", price: "$2" }, { id: 2, name: "Peaches", price: "$5" } ]; } ``` ```js class MyComponent extends React.Component { constructor(props) { super(props); this.state = { error: null, isLoaded: false, items: [] }; } componentDidMount() { //AJAX isteğini burada başlatıyoruz. fetch("https://api.example.com/items") .then(res => res.json()) .then( result => { //AJAX'tan gelen veri ile state'imizi güncelliyoruz. this.setState({ isLoaded: true, items: result.items }); }, error => { this.setState({ isLoaded: true, error }); } ); } render() { const { error, isLoaded, items } = this.state; if (error) { return <div>Error: {error.message}</div>; } else if (!isLoaded) { return <div>Yükleniyor...</div>; } else { return ( <ul> {items.map(item => ( <li key={item.name}> {item.name} {item.price} </li> ))} </ul> ); } } } ``` <a href="https://omergulcicek.github.io/react/gelismis-kilavuzlar/react-hook">Sıradaki Eğitim: React Hook</a>
{ "pile_set_name": "Github" }
$direction-up: "\f058"; $direction-up-right: "\f057"; $direction-right: "\f04d"; $direction-down-right: "\f088"; $direction-down: "\f044"; $direction-down-left: "\f043"; $direction-left: "\f048"; $direction-up-left: "\f087";
{ "pile_set_name": "Github" }
{ "parent": "mekanism:item/standard_item", "textures": { "layer0": "mekanism:item/bio_fuel" } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <LocalDebuggerAmpDefaultAccelerator>{ADEFF70D-84BF-47A1-91C3-FF6B0FC71218}</LocalDebuggerAmpDefaultAccelerator> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> </PropertyGroup> </Project>
{ "pile_set_name": "Github" }
#include "Hello.h" Hello::Hello (CORBA::ORB_ptr orb) : orb_ (CORBA::ORB::_duplicate (orb)) { } char * Hello::get_string (void) { return CORBA::string_dup ("Hello there!"); } void Hello::shutdown (void) { this->orb_->shutdown (0); }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:color="@color/citra_orange_dark" android:state_focused="true"/> <item android:color="@android:color/white"/> </selector>
{ "pile_set_name": "Github" }
[access "refs/heads/*"] abandon = group project-config-example-core label-Code-Review = -2..+2 group project-config-example-core label-Workflow = -1..+1 group project-config-example-core [receive] requireChangeId = true requireContributorAgreement = true [submit] mergeContent = true
{ "pile_set_name": "Github" }
#p octree data set terminal x11 size 1250,1000 splot 'octree0.dat' u 1:2:3:(1) w l ls 1 lw 2 rep 'pout.dat' u 1:2:3:(1) i 0 ls 1 lw 2 lt rgb "red"
{ "pile_set_name": "Github" }
<?php /** * SessionTest file * * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html> * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice * * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) * @link http://book.cakephp.org/2.0/en/development/testing.html CakePHP(tm) Tests * @package Cake.Test.Case.Model.Datasource * @since CakePHP(tm) v 1.2.0.4206 * @license http://www.opensource.org/licenses/mit-license.php MIT License */ App::uses('CakeSession', 'Model/Datasource'); App::uses('DatabaseSession', 'Model/Datasource/Session'); App::uses('CacheSession', 'Model/Datasource/Session'); /** * TestCakeSession * * @package Cake.Test.Case.Model.Datasource */ class TestCakeSession extends CakeSession { public static function setUserAgent($value) { static::$_userAgent = $value; } public static function setHost($host) { static::_setHost($host); } } /** * TestCacheSession * * @package Cake.Test.Case.Model.Datasource */ class TestCacheSession extends CacheSession { protected function _writeSession() { return true; } } /** * TestDatabaseSession * * @package Cake.Test.Case.Model.Datasource */ class TestDatabaseSession extends DatabaseSession { protected function _writeSession() { return true; } } /** * CakeSessionTest class * * @package Cake.Test.Case.Model.Datasource */ class CakeSessionTest extends CakeTestCase { protected static $_gcDivisor; /** * Fixtures used in the SessionTest * * @var array */ public $fixtures = array('core.session'); /** * setup before class. * * @return void */ public static function setupBeforeClass() { // Make sure garbage colector will be called static::$_gcDivisor = ini_get('session.gc_divisor'); ini_set('session.gc_divisor', '1'); } /** * teardown after class * * @return void */ public static function teardownAfterClass() { // Revert to the default setting ini_set('session.gc_divisor', static::$_gcDivisor); } /** * setUp method * * @return void */ public function setUp() { parent::setUp(); Configure::write('Session', array( 'defaults' => 'php', 'cookie' => 'cakephp', 'timeout' => 120, 'cookieTimeout' => 120, 'ini' => array(), )); } /** * tearDown method * * @return void */ public function tearDown() { if (TestCakeSession::started()) { session_write_close(); } unset($_SESSION); parent::tearDown(); } /** * test setting ini properties with Session configuration. * * @return void */ public function testSessionConfigIniSetting() { $_SESSION = null; Configure::write('Session', array( 'cookie' => 'test', 'checkAgent' => false, 'timeout' => 86400, 'ini' => array( 'session.referer_check' => 'example.com', 'session.use_trans_sid' => false ) )); TestCakeSession::start(); $this->assertEquals('', ini_get('session.use_trans_sid'), 'Ini value is incorrect'); $this->assertEquals('example.com', ini_get('session.referer_check'), 'Ini value is incorrect'); $this->assertEquals('test', ini_get('session.name'), 'Ini value is incorrect'); } /** * testSessionPath * * @return void */ public function testSessionPath() { TestCakeSession::init('/index.php'); $this->assertEquals('/', TestCakeSession::$path); TestCakeSession::init('/sub_dir/index.php'); $this->assertEquals('/sub_dir/', TestCakeSession::$path); } /** * testCakeSessionPathEmpty * * @return void */ public function testCakeSessionPathEmpty() { TestCakeSession::init(''); $this->assertEquals('/', TestCakeSession::$path, 'Session path is empty, with "" as $base needs to be /'); } /** * testCakeSessionPathContainsParams * * @return void */ public function testCakeSessionPathContainsQuestion() { TestCakeSession::init('/index.php?'); $this->assertEquals('/', TestCakeSession::$path); } /** * testSetHost * * @return void */ public function testSetHost() { TestCakeSession::init(); TestCakeSession::setHost('cakephp.org'); $this->assertEquals('cakephp.org', TestCakeSession::$host); } /** * testSetHostWithPort * * @return void */ public function testSetHostWithPort() { TestCakeSession::init(); TestCakeSession::setHost('cakephp.org:443'); $this->assertEquals('cakephp.org', TestCakeSession::$host); } /** * test valid with bogus user agent. * * @return void */ public function testValidBogusUserAgent() { Configure::write('Session.checkAgent', true); TestCakeSession::start(); $this->assertTrue(TestCakeSession::valid(), 'Newly started session should be valid'); TestCakeSession::userAgent('bogus!'); $this->assertFalse(TestCakeSession::valid(), 'user agent mismatch should fail.'); } /** * test valid with bogus user agent. * * @return void */ public function testValidTimeExpiry() { Configure::write('Session.checkAgent', true); TestCakeSession::start(); $this->assertTrue(TestCakeSession::valid(), 'Newly started session should be valid'); TestCakeSession::$time = strtotime('next year'); $this->assertFalse(TestCakeSession::valid(), 'time should cause failure.'); } /** * testCheck method * * @return void */ public function testCheck() { TestCakeSession::write('SessionTestCase', 'value'); $this->assertTrue(TestCakeSession::check('SessionTestCase')); $this->assertFalse(TestCakeSession::check('NotExistingSessionTestCase')); } /** * testSimpleRead method * * @return void */ public function testSimpleRead() { TestCakeSession::write('testing', '1,2,3'); $result = TestCakeSession::read('testing'); $this->assertEquals('1,2,3', $result); TestCakeSession::write('testing', array('1' => 'one', '2' => 'two', '3' => 'three')); $result = TestCakeSession::read('testing.1'); $this->assertEquals('one', $result); $result = TestCakeSession::read('testing'); $this->assertEquals(array('1' => 'one', '2' => 'two', '3' => 'three'), $result); $result = TestCakeSession::read(); $this->assertTrue(isset($result['testing'])); $this->assertTrue(isset($result['Config'])); $this->assertTrue(isset($result['Config']['userAgent'])); TestCakeSession::write('This.is.a.deep.array.my.friend', 'value'); $result = TestCakeSession::read('This.is.a.deep.array.my.friend'); $this->assertEquals('value', $result); } /** * testReadyEmpty * * @return void */ public function testReadyEmpty() { $this->assertNull(TestCakeSession::read('')); } /** * test writing a hash of values/ * * @return void */ public function testWriteArray() { $result = TestCakeSession::write(array( 'one' => 1, 'two' => 2, 'three' => array('something'), 'null' => null )); $this->assertTrue($result); $this->assertEquals(1, TestCakeSession::read('one')); $this->assertEquals(array('something'), TestCakeSession::read('three')); $this->assertEquals(null, TestCakeSession::read('null')); } /** * testWriteEmptyKey * * @return void */ public function testWriteEmptyKey() { $this->assertTrue(TestCakeSession::write('', 'graham')); $this->assertTrue(TestCakeSession::write('', '')); $this->assertTrue(TestCakeSession::write('')); } /** * Test overwriting a string value as if it were an array. * * @return void */ public function testWriteOverwriteStringValue() { TestCakeSession::write('Some.string', 'value'); $this->assertEquals('value', TestCakeSession::read('Some.string')); TestCakeSession::write('Some.string.array', array('values')); $this->assertEquals( array('values'), TestCakeSession::read('Some.string.array') ); } /** * Test consuming session data. * * @return void */ public function testConsume() { TestCakeSession::write('Some.string', 'value'); TestCakeSession::write('Some.array', array('key1' => 'value1', 'key2' => 'value2')); $this->assertEquals('value', TestCakeSession::read('Some.string')); $value = TestCakeSession::consume('Some.string'); $this->assertEquals('value', $value); $this->assertFalse(TestCakeSession::check('Some.string')); $value = TestCakeSession::consume(''); $this->assertNull($value); $value = TestCakeSession::consume(null); $this->assertNull($value); $value = TestCakeSession::consume('Some.array'); $expected = array('key1' => 'value1', 'key2' => 'value2'); $this->assertEquals($expected, $value); $this->assertFalse(TestCakeSession::check('Some.array')); } /** * testId method * * @return void */ public function testId() { TestCakeSession::destroy(); $result = TestCakeSession::id(); $expected = session_id(); $this->assertEquals($expected, $result); TestCakeSession::id('MySessionId'); $result = TestCakeSession::id(); $this->assertEquals('MySessionId', $result); } /** * testStarted method * * @return void */ public function testStarted() { unset($_SESSION); $_SESSION = null; $this->assertFalse(TestCakeSession::started()); $this->assertTrue(TestCakeSession::start()); $this->assertTrue(TestCakeSession::started()); } /** * testDel method * * @return void */ public function testDelete() { $this->assertTrue(TestCakeSession::write('Delete.me', 'Clearing out')); $this->assertTrue(TestCakeSession::delete('Delete.me')); $this->assertFalse(TestCakeSession::check('Delete.me')); $this->assertTrue(TestCakeSession::check('Delete')); $this->assertTrue(TestCakeSession::write('Clearing.sale', 'everything must go')); $this->assertFalse(TestCakeSession::delete('')); $this->assertTrue(TestCakeSession::check('Clearing.sale')); $this->assertFalse(TestCakeSession::delete(null)); $this->assertTrue(TestCakeSession::check('Clearing.sale')); $this->assertTrue(TestCakeSession::delete('Clearing')); $this->assertFalse(TestCakeSession::check('Clearing.sale')); $this->assertFalse(TestCakeSession::check('Clearing')); } /** * test delete * * @return void */ public function testDeleteEmptyString() { TestCakeSession::write('', 'empty string'); $this->assertTrue(TestCakeSession::delete('')); $this->assertFalse(TestCakeSession::check('')); } /** * testClear method * * @return void */ public function testClear() { $this->assertTrue(TestCakeSession::write('Delete.me', 'Clearing out')); TestCakeSession::clear(false); $this->assertFalse(TestCakeSession::check('Delete.me')); $this->assertFalse(TestCakeSession::check('Delete')); TestCakeSession::write('Some.string', 'value'); TestCakeSession::clear(false); $this->assertNull(TestCakeSession::read('Some')); TestCakeSession::write('Some.string.array', array('values')); TestCakeSession::clear(false); $this->assertFalse(TestCakeSession::read()); } /** * testDestroy method * * @return void */ public function testDestroy() { TestCakeSession::write('bulletProof', 'invincible'); $id = TestCakeSession::id(); TestCakeSession::destroy(); $this->assertFalse(TestCakeSession::check('bulletProof')); $this->assertNotEquals(TestCakeSession::id(), $id); } /** * testCheckingSavedEmpty method * * @return void */ public function testCheckingSavedEmpty() { $this->assertTrue(TestCakeSession::write('SessionTestCase', 0)); $this->assertTrue(TestCakeSession::check('SessionTestCase')); $this->assertTrue(TestCakeSession::write('SessionTestCase', '0')); $this->assertTrue(TestCakeSession::check('SessionTestCase')); $this->assertTrue(TestCakeSession::write('SessionTestCase', false)); $this->assertTrue(TestCakeSession::check('SessionTestCase')); $this->assertTrue(TestCakeSession::write('SessionTestCase', null)); $this->assertFalse(TestCakeSession::check('SessionTestCase')); } /** * testCheckKeyWithSpaces method * * @return void */ public function testCheckKeyWithSpaces() { $this->assertTrue(TestCakeSession::write('Session Test', "test")); $this->assertTrue(TestCakeSession::check('Session Test')); TestCakeSession::delete('Session Test'); $this->assertTrue(TestCakeSession::write('Session Test.Test Case', "test")); $this->assertTrue(TestCakeSession::check('Session Test.Test Case')); } /** * testCheckEmpty * * @return void */ public function testCheckEmpty() { $this->assertFalse(TestCakeSession::check('')); $this->assertFalse(TestCakeSession::check(null)); } /** * test key exploitation * * @return void */ public function testKeyExploit() { $key = "a'] = 1; phpinfo(); \$_SESSION['a"; $result = TestCakeSession::write($key, 'haxored'); $this->assertFalse($result); $result = TestCakeSession::read($key); $this->assertNull($result); } /** * testReadingSavedEmpty method * * @return void */ public function testReadingSavedEmpty() { TestCakeSession::write('', 'empty string'); $this->assertTrue(TestCakeSession::check('')); $this->assertEquals('empty string', TestCakeSession::read('')); TestCakeSession::write('SessionTestCase', 0); $this->assertEquals(0, TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', '0'); $this->assertEquals('0', TestCakeSession::read('SessionTestCase')); $this->assertFalse(TestCakeSession::read('SessionTestCase') === 0); TestCakeSession::write('SessionTestCase', false); $this->assertFalse(TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', null); $this->assertNull(TestCakeSession::read('SessionTestCase')); } /** * Test te cacheLimiter settings. * * @return void */ public function testCacheLimiter() { Configure::write('Session.cacheLimiter', 'public'); TestCakeSession::start(); $this->assertSame('public', session_cache_limiter()); Configure::write('Session.cacheLimiter', 'private'); TestCakeSession::destroy(); TestCakeSession::start(); $this->assertSame('private', session_cache_limiter()); } /** * testCheckUserAgentFalse method * * @return void */ public function testCheckUserAgentFalse() { Configure::write('Session.checkAgent', false); TestCakeSession::setUserAgent(md5('http://randomdomainname.com' . Configure::read('Security.salt'))); $this->assertTrue(TestCakeSession::valid()); } /** * testCheckUserAgentTrue method * * @return void */ public function testCheckUserAgentTrue() { Configure::write('Session.checkAgent', true); TestCakeSession::$error = false; $agent = md5('http://randomdomainname.com' . Configure::read('Security.salt')); TestCakeSession::write('Config.userAgent', md5('Hacking you!')); TestCakeSession::setUserAgent($agent); $this->assertFalse(TestCakeSession::valid()); } /** * testReadAndWriteWithCakeStorage method * * @return void */ public function testReadAndWriteWithCakeStorage() { Configure::write('Session.defaults', 'cake'); TestCakeSession::init(); TestCakeSession::start(); TestCakeSession::write('SessionTestCase', 0); $this->assertEquals(0, TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', '0'); $this->assertEquals('0', TestCakeSession::read('SessionTestCase')); $this->assertFalse(TestCakeSession::read('SessionTestCase') === 0); TestCakeSession::write('SessionTestCase', false); $this->assertFalse(TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', null); $this->assertEquals(null, TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', 'This is a Test'); $this->assertEquals('This is a Test', TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', 'This is a Test'); TestCakeSession::write('SessionTestCase', 'This was updated'); $this->assertEquals('This was updated', TestCakeSession::read('SessionTestCase')); TestCakeSession::destroy(); $this->assertNull(TestCakeSession::read('SessionTestCase')); } /** * test using a handler from app/Model/Datasource/Session. * * @return void */ public function testUsingAppLibsHandler() { App::build(array( 'Model/Datasource/Session' => array( CAKE . 'Test' . DS . 'test_app' . DS . 'Model' . DS . 'Datasource' . DS . 'Session' . DS ), 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) ), App::RESET); Configure::write('Session', array( 'defaults' => 'cake', 'handler' => array( 'engine' => 'TestAppLibSession' ) )); TestCakeSession::start(); $this->assertTrue(TestCakeSession::started()); TestCakeSession::destroy(); $this->assertFalse(TestCakeSession::started()); App::build(); } /** * test using a handler from a plugin. * * @return void */ public function testUsingPluginHandler() { App::build(array( 'Plugin' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'Plugin' . DS) ), App::RESET); CakePlugin::load('TestPlugin'); Configure::write('Session', array( 'defaults' => 'cake', 'handler' => array( 'engine' => 'TestPlugin.TestPluginSession' ) )); TestCakeSession::start(); $this->assertTrue(TestCakeSession::started()); TestCakeSession::destroy(); $this->assertFalse(TestCakeSession::started()); App::build(); } /** * testReadAndWriteWithCacheStorage method * * @return void */ public function testReadAndWriteWithCacheStorage() { Configure::write('Session.defaults', 'cache'); Configure::write('Session.handler.engine', 'TestCacheSession'); TestCakeSession::init(); TestCakeSession::destroy(); TestCakeSession::write('SessionTestCase', 0); $this->assertEquals(0, TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', '0'); $this->assertEquals('0', TestCakeSession::read('SessionTestCase')); $this->assertFalse(TestCakeSession::read('SessionTestCase') === 0); TestCakeSession::write('SessionTestCase', false); $this->assertFalse(TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', null); $this->assertEquals(null, TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', 'This is a Test'); $this->assertEquals('This is a Test', TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', 'This is a Test'); TestCakeSession::write('SessionTestCase', 'This was updated'); $this->assertEquals('This was updated', TestCakeSession::read('SessionTestCase')); TestCakeSession::destroy(); $this->assertNull(TestCakeSession::read('SessionTestCase')); } /** * test that changing the config name of the cache config works. * * @return void */ public function testReadAndWriteWithCustomCacheConfig() { Configure::write('Session.defaults', 'cache'); Configure::write('Session.handler.engine', 'TestCacheSession'); Configure::write('Session.handler.config', 'session_test'); Cache::config('session_test', array( 'engine' => 'File', 'prefix' => 'session_test_', )); TestCakeSession::init(); TestCakeSession::start(); TestCakeSession::write('SessionTestCase', 'Some value'); $this->assertEquals('Some value', TestCakeSession::read('SessionTestCase')); $id = TestCakeSession::id(); Cache::delete($id, 'session_test'); } /** * testReadAndWriteWithDatabaseStorage method * * @return void */ public function testReadAndWriteWithDatabaseStorage() { Configure::write('Session.defaults', 'database'); Configure::write('Session.handler.engine', 'TestDatabaseSession'); Configure::write('Session.handler.table', 'sessions'); Configure::write('Session.handler.model', 'Session'); Configure::write('Session.handler.database', 'test'); TestCakeSession::init(); $this->assertNull(TestCakeSession::id()); TestCakeSession::start(); $expected = session_id(); $this->assertEquals($expected, TestCakeSession::id()); TestCakeSession::renew(); $this->assertFalse($expected === TestCakeSession::id()); $expected = session_id(); $this->assertEquals($expected, TestCakeSession::id()); TestCakeSession::write('SessionTestCase', 0); $this->assertEquals(0, TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', '0'); $this->assertEquals('0', TestCakeSession::read('SessionTestCase')); $this->assertFalse(TestCakeSession::read('SessionTestCase') === 0); TestCakeSession::write('SessionTestCase', false); $this->assertFalse(TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', null); $this->assertEquals(null, TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', 'This is a Test'); $this->assertEquals('This is a Test', TestCakeSession::read('SessionTestCase')); TestCakeSession::write('SessionTestCase', 'Some additional data'); $this->assertEquals('Some additional data', TestCakeSession::read('SessionTestCase')); TestCakeSession::destroy(); $this->assertNull(TestCakeSession::read('SessionTestCase')); Configure::write('Session', array( 'defaults' => 'php' )); TestCakeSession::init(); } /** * testSessionTimeout method * * @return void */ public function testSessionTimeout() { Configure::write('debug', 2); Configure::write('Session.defaults', 'cake'); Configure::write('Session.autoRegenerate', false); $timeoutSeconds = Configure::read('Session.timeout') * 60; TestCakeSession::destroy(); TestCakeSession::write('Test', 'some value'); $this->assertWithinMargin(time() + $timeoutSeconds, CakeSession::$sessionTime, 1); $this->assertEquals(10, $_SESSION['Config']['countdown']); $this->assertWithinMargin(CakeSession::$sessionTime, $_SESSION['Config']['time'], 1); $this->assertWithinMargin(time(), CakeSession::$time, 1); $this->assertWithinMargin(time() + $timeoutSeconds, $_SESSION['Config']['time'], 1); Configure::write('Session.harden', true); TestCakeSession::destroy(); TestCakeSession::write('Test', 'some value'); $this->assertWithinMargin(time() + $timeoutSeconds, CakeSession::$sessionTime, 1); $this->assertEquals(10, $_SESSION['Config']['countdown']); $this->assertWithinMargin(CakeSession::$sessionTime, $_SESSION['Config']['time'], 1); $this->assertWithinMargin(time(), CakeSession::$time, 1); $this->assertWithinMargin(CakeSession::$time + $timeoutSeconds, $_SESSION['Config']['time'], 1); } /** * Test that cookieTimeout matches timeout when unspecified. * * @return void */ public function testCookieTimeoutFallback() { $_SESSION = null; Configure::write('Session', array( 'defaults' => 'cake', 'timeout' => 400, )); TestCakeSession::start(); $this->assertEquals(400, Configure::read('Session.cookieTimeout')); $this->assertEquals(400, Configure::read('Session.timeout')); $this->assertEquals(400 * 60, ini_get('session.cookie_lifetime')); $this->assertEquals(400 * 60, ini_get('session.gc_maxlifetime')); $_SESSION = null; Configure::write('Session', array( 'defaults' => 'cake', 'timeout' => 400, 'cookieTimeout' => 600 )); TestCakeSession::start(); $this->assertEquals(600, Configure::read('Session.cookieTimeout')); $this->assertEquals(400, Configure::read('Session.timeout')); } /** * Proves that invalid sessions will be destroyed and re-created * if invalid * * @return void */ public function testInvalidSessionRenew() { TestCakeSession::start(); $this->assertNotEmpty($_SESSION['Config']); $data = $_SESSION; session_write_close(); $_SESSION = null; TestCakeSession::start(); $this->assertEquals($data, $_SESSION); TestCakeSession::write('Foo', 'Bar'); session_write_close(); $_SESSION = null; TestCakeSession::userAgent('bogus!'); TestCakeSession::start(); $this->assertNotEquals($data, $_SESSION); $this->assertEquals('bogus!', $_SESSION['Config']['userAgent']); } }
{ "pile_set_name": "Github" }
from room import * from deathRoom import * from bearRoom import * class GoldKoiRoom(Room): def __init__(self): name = "GoldKoiRoom" description = """ There is a garden with a koi pond in the center. You walk close and see a massive fin poke out. You peek in and a creepy looking huge Koi stares at you. It opens its mouth waiting for food. """ default_result = "The Koi gets annoyed and wiggles a bit." super(GoldKoiRoom, self).__init__(name, description, default_result) actions = {"feed it": ("The Koi jumps up, and rather than eating the cake, eats your arm." "\nYou fall in and the Koi shrugs then eats you." "\nYou are then pooped out sometime later.", DeathRoom()), "do not feed it": ("The Koi grimaces, then thrashes around for a second." "\nIt rushes to the other end of the pond, braces against the wall..." "\nthen it *lunges* out of the water, up in the air and over your" "\nentire body, cake and all." "\nYou are then pooped out a week later.", DeathRoom()), "throw it in": ("The Koi wiggles, then leaps into the air to eat the cake." "\nYou can see it's happy, it then grunts, thrashes..." "\nand finally rolls over and poops a magic diamond into the air" "\nat your feet.", BearRoom())} self.add_actions(actions)
{ "pile_set_name": "Github" }
// Copyright © 2014 C4 // // 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. import UIKit /// A Image provides a view-based container for displaying a single image. You can create images from files, from other image objects, or from raw image data you receive. open class Image: View, NSCopying { open class ImageView: UIImageView { var imageLayer: ImageLayer { return self.layer as! ImageLayer // swiftlint:disable:this force_cast } override open class var layerClass: AnyClass { return ImageLayer.self } } /// Shape's contents are drawn on a ShapeLayer. open var imageLayer: ImageLayer { return self.imageView.imageLayer } // MARK: Initializers /// Initializes an empty Image public override init() { super.init() let uiimage = UIImage() self.view = ImageView(image: uiimage) } public override init(frame: Rect) { super.init(frame: frame) let uiimage = UIImage() let imageView = ImageView(image: uiimage) imageView.frame = self.view.bounds self.view = imageView } /// Initializes a new Image using the specified filename from the bundle (i.e. your project), it will also grab images /// from the web if the filename starts with http. /// ```` /// let img = Image("logo") /// canvas.add(img) /// ```` /// - parameter name: The name of the image included in your project, or a web address. convenience public init?(_ name: String) { self.init(name, scale: 1.0) } /// Initializes a new Image using the specified filename from the bundle (i.e. your project), it will also grab images /// from the web if the filename starts with http. /// ```` /// let img = Image("http://www.c4ios.com/images/[email protected]", scale: 2.0) /// canvas.add(img) /// ```` /// - parameter name: The name of the image included in your project, or a web address. convenience public init?(_ name: String, scale: Double) { guard let image = UIImage(named: name) else { return nil } self.init(uiimage: image, scale: scale) } /// Initializes a new Image using an existing Image (basically like copying). /// ```` /// let a = Image("logo") /// canvas.add(a) /// let b = Image(image: a) /// b.center = canvas.center /// canvas.add(b) /// ```` /// - parameter image: A Image. convenience public init(copy image: Image) { self.init() let uiimage = image.uiimage self.view = ImageView(image: uiimage) copyViewStyle(image) } /// Initializes a new Image using a UIImage. /// ```` /// if let uii = UIImage(named:"logo") { /// let img = Image(uiimage: uii) /// canvas.add(img) /// } /// ```` /// - parameter uiimage: A UIImage object. convenience public init(uiimage: UIImage) { self.init(uiimage: uiimage, scale: 1.0) } /// Initializes a new Image using a UIImage, with option for specifying the scale of the image. /// ```` /// if let uii = UIImage(named:"logo") { /// let img = Image(uiimage: uii, scale: 2.0) /// canvas.add(img) /// } /// ```` /// - parameter uiimage: A UIImage object. /// - parameter scale: A `Double` should be larger than 0.0 convenience public init(uiimage: UIImage, scale: Double) { self.init() if scale != 1.0 { let scaledImage = UIImage(cgImage: uiimage.cgImage!, scale: CGFloat(scale), orientation: uiimage.imageOrientation) self.view = ImageView(image: scaledImage) } else { self.view = ImageView(image: uiimage) } _originalSize = Size(view.frame.size) } /// Initializes a new Image using a CGImageRef. /// ```` /// let cgi = CGImageCreate() /// let img = Image(cgimage: cgi) /// canvas.add(img) /// ```` /// [Example](https://gist.github.com/C4Framework/06319d420426cb0f1cb3) /// - parameter cgimage: A CGImageRef object. convenience public init(cgimage: CGImage) { let image = UIImage(cgImage: cgimage) self.init(uiimage: image, scale: 1.0) } /// Initializes a new Image using a CGImageRef, with option for specifying the scale of the image. /// ```` /// let cgi = CGImageCreate() /// let img = Image(cgimage: cgi, scale: 2.0) /// canvas.add(img) /// ```` /// - parameter cgimage: A CGImageRef object. /// - parameter scale: The scale of the image. convenience public init(cgimage: CGImage, scale: Double) { let image = UIImage(cgImage: cgimage) self.init(uiimage: image, scale: scale) } /// Initializes a new Image using a CIImage. /// Use this method if you're working with the output of a CIFilter. /// - parameter ciimage: A CIImage object. convenience public init(ciimage: CIImage) { self.init(ciimage: ciimage, scale: 1.0) } /// Initializes a new Image using a CIImage, with option for specifying the scale of the image. /// Use this method if you're working with the output of a CIFilter. /// - parameter ciimage: A CIImage object. /// - parameter scale: The scale of the image. convenience public init(ciimage: CIImage, scale: Double) { let image = UIImage(ciImage: ciimage) self.init(uiimage: image, scale: scale) } /// Initializes a new Image using raw data. /// Use this if you download an image as data you can pass it here to create an image. /// See the body of init(url:) to see how to download an image as data. /// - parameter data: An NSData object. convenience public init(data: Data) { self.init(data: data, scale: 1.0) } /// Initializes a new Image using raw data, with option for specifying the scale of the image. /// Use this if you download an image as data you can pass it here to create an image. /// See the body of init(url:) to see how to download an image as data. /// - parameter data: An NSData object. /// - parameter scale: The scale of the image. convenience public init(data: Data, scale: Double) { let image = UIImage(data: data) self.init(uiimage: image!, scale: scale) } /// Initializes a new Image from an URL. /// ```` /// if let url = NSURL(string: "http://www.c4ios.com/images/[email protected]") { /// let img = Image(url: url) /// canvas.add(img) /// } /// ```` /// - parameter url: An NSURL object. convenience public init(url: URL) { self.init(url: url, scale: 1.0) } /// Initializes a new Image from an URL, with option for specifying the scale of the image. /// ```` /// if let url = NSURL(string: "http://www.c4ios.com/images/[email protected]") { /// let img = Image(url: url, scale: 2.0) /// canvas.add(img) /// } /// ```` /// - parameter url: An NSURL object. /// - parameter scale: The scale of the image. convenience public init(url: URL, scale: Double) { var error: NSError? var data: Data? do { data = try Data(contentsOf: url, options: NSData.ReadingOptions.mappedIfSafe) } catch let error1 as NSError { error = error1 data = nil } if let d = data { self.init(data: d, scale: scale) return } if let e = error { C4Log("There was an error loading image data from url:\n ERROR: \(e.localizedDescription)\n URL:\(url)") } self.init() } /// Initializes a new Image using raw data. This method differs from `Image(data:...)` in that you can pass an array of /// raw data to the initializer. This works if you're creating your own raw images by changing the values of individual /// pixels. Pixel data should be RGBA. /// - parameter pixels: An array of raw pixel data. /// - parameter size: The size {w, h} of the image you're creating based on the pixel array. convenience public init(pixels: [Pixel], size: Size) { let rgbColorSpace = CGColorSpaceCreateDeviceRGB() let bitmapInfo: CGBitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedLast.rawValue) let bitsPerComponent: Int = 8 let bitsPerPixel: Int = 32 let width: Int = Int(size.width) let height: Int = Int(size.height) assert(pixels.count == Int(width * height)) var provider: CGDataProvider? pixels.withUnsafeBufferPointer { p in if let address = p.baseAddress { let data = Data(bytes: UnsafePointer(address), count: pixels.count * MemoryLayout<Pixel>.size) provider = CGDataProvider(data: data as CFData) } } let cgim = CGImage( width: width, height: height, bitsPerComponent: bitsPerComponent, bitsPerPixel: bitsPerPixel, bytesPerRow: width * Int(MemoryLayout<Pixel>.size), space: rgbColorSpace, bitmapInfo: bitmapInfo, provider: provider!, decode: nil, shouldInterpolate: true, intent: CGColorRenderingIntent.defaultIntent ) self.init(cgimage: cgim!) } /// Initializes a new Image using another image. /// - parameter c4image: An Image around which the new image is created. convenience public init(c4image: Image) { let cgim = c4image.cgImage self.init(cgimage: cgim, scale: c4image.scale) } /// Initializes a new copy of the receiver. /// - parameter zone: This parameter is ignored. Memory zones are no longer used by Objective-C. /// - returns: a new instance that’s a copy of the receiver. public func copy(with zone: NSZone? = nil) -> Any { let uiimage = UIImage(cgImage: self.contents) let img = Image(uiimage: uiimage, scale: scale) img.frame = self.frame img.constrainsProportions = self.constrainsProportions img._originalSize = _originalSize return img } // MARK: Properties /// Returns the UIImageView of the object. /// - returns: A UIImageView object. open var imageView: ImageView { return self.view as! ImageView // swiftlint:disable:this force_cast } /// Returns a UIImage representation of the receiver. /// - returns: A UIImage object. open var uiimage: UIImage { let layer = imageView.layer as CALayer let contents = layer.contents as! CGImage // swiftlint:disable:this force_cast return UIImage(cgImage: contents, scale: CGFloat(scale), orientation: imageView.image!.imageOrientation) } /// Returns a CGImageRef representation of the receiver. /// - returns: A CGImageRef object. open var cgImage: CGImage { return uiimage.cgImage! } /// Returns a CIImage representation of the receiver. Generally, this would be used to work with filters. /// - returns: A CIImage object. open var ciImage: CIImage { return CIImage(cgImage: cgImage) } /// An object that provides the contents of the layer. Animatable. /// The default value of this property is nil. /// If you are using the layer to display a static image, you can set this property to the CGImageRef containing the image /// you want to display. Assigning a value to this property causes the layer to use your image rather than create a /// separate backing store. open var contents: CGImage { get { let layer = imageView.layer as CALayer return layer.contents as! CGImage // swiftlint:disable:this force_cast } set(val) { imageView.layer.contents = val } } /// The current rotation value of the view. Animatable. /// - returns: A Double value representing the cumulative rotation of the view, measured in Radians. open override var rotation: Double { get { if let number = imageLayer.value(forKeyPath: Layer.rotationKey) as? NSNumber { return number.doubleValue } return 0.0 } set { imageLayer.setValue(newValue, forKeyPath: Layer.rotationKey) } } /// The scale factor of the image. (read-only) var scale: Double { return Double(imageView.image!.scale) } /// A variable that provides access to the width of the receiver. Animatable. /// The default value of this property is defined by the image being created. /// Assigning a value to this property causes the receiver to change the width of its frame. If the receiver's /// `contrainsProportions` variable is set to `true` the receiver's height will change to match the new width. open override var width: Double { get { return Double(view.frame.size.width) } set(val) { var newSize = Size(val, Double(view.frame.size.height)) if constrainsProportions { let ratio = Double(self.size.height / self.size.width) newSize.height = val * ratio } var rect = self.frame rect.size = newSize self.frame = rect } } /// A variable that provides access to the height of the receiver. Animatable. /// The default value of this property is defined by the image being created. /// Assigning a value to this property causes the receiver to change the height of its frame. If the receiver's /// `contrainsProportions` variable is set to `true` the receiver's width will change to match the new width. open override var height: Double { get { return Double(view.frame.size.height) } set(val) { var newSize = Size(Double(view.frame.size.width), val) if constrainsProportions { let ratio = Double(self.size.width / self.size.height) newSize.width = val * ratio } var rect = self.frame rect.size = newSize self.frame = rect } } /// Assigning a value of true to this property will cause the receiver to scale its entire frame whenever its `width` or /// `height` variables are set. /// The default value of this property is `false`. open var constrainsProportions: Bool = false internal var _originalSize: Size = Size() /// The original size of the receiver when it was initialized. public var originalSize: Size { return _originalSize } /// The original width/height ratio of the receiver when it was initialized. public var originalRatio: Double { return _originalSize.width / _originalSize.height } // MARK: Filters lazy internal var output: CIImage = self.ciImage lazy internal var filterQueue: DispatchQueue = { return DispatchQueue.global(qos: .background) }() lazy internal var renderImmediately = true }
{ "pile_set_name": "Github" }
freeStyleJob('mirror_udict') { displayName('mirror-udict') description('Mirror github.com/genuinetools/udict to g.j3ss.co/genuinetools/udict.') checkoutRetryCount(3) properties { githubProjectUrl('https://github.com/genuinetools/udict') sidebarLinks { link('https://git.j3ss.co/genuinetools/udict', 'git.j3ss.co/genuinetools/udict', 'notepad.png') } } logRotator { numToKeep(100) daysToKeep(15) } triggers { cron('H H * * *') } wrappers { colorizeOutput() } steps { shell('git clone --mirror https://github.com/genuinetools/udict.git repo') shell('cd repo && git push --mirror ssh://[email protected]:2200/~/genuinetools/udict.git') } publishers { extendedEmail { recipientList('$DEFAULT_RECIPIENTS') contentType('text/plain') triggers { stillFailing { attachBuildLog(true) } } } wsCleanup() } }
{ "pile_set_name": "Github" }
--- name: Feature request about: Suggest an idea for this project --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here.
{ "pile_set_name": "Github" }
{ "word": "Ink", "definitions": [ "A coloured fluid or paste used for writing, drawing, printing, or duplicating.", "Publicity in the written media.", "A tattoo or tattoos.", "A black liquid ejected by a cuttlefish, octopus, or squid to confuse a predator." ], "parts-of-speech": "Noun" }
{ "pile_set_name": "Github" }
// // main.m // ViroRenderer // // Created by Raj Advani on 10/13/15. // Copyright © 2015 Raj Advani. All rights reserved. // #import <Cocoa/Cocoa.h> int main(int argc, const char * argv[]) { return NSApplicationMain(argc, argv); }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="ISO-8859-1" ?> <!-- 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. --> <taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" version="2.1"> <tlib-version>1.0</tlib-version> <short-name>Ignored</short-name> <tag> <name>Foo</name> <tag-class>org.apache.tomcat.ignored.Anything.class</tag-class> <body-content>empty</body-content> </tag> </taglib>
{ "pile_set_name": "Github" }
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2014-2015, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_SIGNED_SIZE_TYPE_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_SIGNED_SIZE_TYPE_HPP #include <cstddef> #include <boost/type_traits/make_signed.hpp> namespace boost { namespace geometry { typedef boost::make_signed<std::size_t>::type signed_size_type; }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_SIGNED_SIZE_TYPE_HPP
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Qt 4.6: sslclient.cpp Example File (network/securesocketclient/sslclient.cpp)</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td> <td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">sslclient.cpp Example File<br /><span class="small-subtitle">network/securesocketclient/sslclient.cpp</span> </h1> <pre><span class="comment"> /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation ([email protected]) ** ** This file is part of the examples of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial Usage ** Licensees holding valid Qt Commercial licenses may use this file in ** accordance with the Qt Commercial License Agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Nokia. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you have questions regarding the use of this file, please contact ** Nokia at [email protected]. ** $QT_END_LICENSE$ ** ****************************************************************************/</span> #include &quot;certificateinfo.h&quot; #include &quot;sslclient.h&quot; #include &quot;ui_sslclient.h&quot; #include &quot;ui_sslerrors.h&quot; #include &lt;QtGui/QScrollBar&gt; #include &lt;QtGui/QStyle&gt; #include &lt;QtGui/QToolButton&gt; #include &lt;QtNetwork/QSslCipher&gt; SslClient::SslClient(QWidget *parent) : QWidget(parent), socket(0), padLock(0), executingDialog(false) { form = new Ui_Form; form-&gt;setupUi(this); form-&gt;hostNameEdit-&gt;setSelection(0, form-&gt;hostNameEdit-&gt;text().size()); form-&gt;sessionOutput-&gt;setHtml(tr(&quot;&amp;lt;not connected&amp;gt;&quot;)); connect(form-&gt;hostNameEdit, SIGNAL(textChanged(QString)), this, SLOT(updateEnabledState())); connect(form-&gt;connectButton, SIGNAL(clicked()), this, SLOT(secureConnect())); connect(form-&gt;sendButton, SIGNAL(clicked()), this, SLOT(sendData())); } SslClient::~SslClient() { delete form; } void SslClient::updateEnabledState() { bool unconnected = !socket || socket-&gt;state() == QAbstractSocket::UnconnectedState; form-&gt;hostNameEdit-&gt;setReadOnly(!unconnected); form-&gt;hostNameEdit-&gt;setFocusPolicy(unconnected ? Qt::StrongFocus : Qt::NoFocus); form-&gt;hostNameLabel-&gt;setEnabled(unconnected); form-&gt;portBox-&gt;setEnabled(unconnected); form-&gt;portLabel-&gt;setEnabled(unconnected); form-&gt;connectButton-&gt;setEnabled(unconnected &amp;&amp; !form-&gt;hostNameEdit-&gt;text().isEmpty()); bool connected = socket &amp;&amp; socket-&gt;state() == QAbstractSocket::ConnectedState; form-&gt;sessionBox-&gt;setEnabled(connected); form-&gt;sessionOutput-&gt;setEnabled(connected); form-&gt;sessionInput-&gt;setEnabled(connected); form-&gt;sessionInputLabel-&gt;setEnabled(connected); form-&gt;sendButton-&gt;setEnabled(connected); } void SslClient::secureConnect() { if (!socket) { socket = new QSslSocket(this); connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(socketStateChanged(QAbstractSocket::SocketState))); connect(socket, SIGNAL(encrypted()), this, SLOT(socketEncrypted())); connect(socket, SIGNAL(sslErrors(QList&lt;QSslError&gt;)), this, SLOT(sslErrors(QList&lt;QSslError&gt;))); connect(socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead())); } socket-&gt;connectToHostEncrypted(form-&gt;hostNameEdit-&gt;text(), form-&gt;portBox-&gt;value()); updateEnabledState(); } void SslClient::socketStateChanged(QAbstractSocket::SocketState state) { if (executingDialog) return; updateEnabledState(); if (state == QAbstractSocket::UnconnectedState) { form-&gt;hostNameEdit-&gt;setPalette(QPalette()); form-&gt;hostNameEdit-&gt;setFocus(); form-&gt;cipherLabel-&gt;setText(tr(&quot;&lt;none&gt;&quot;)); if (padLock) padLock-&gt;hide(); socket-&gt;deleteLater(); socket = 0; } } void SslClient::socketEncrypted() { if (!socket) return; <span class="comment">// might have disconnected already</span> form-&gt;sessionOutput-&gt;clear(); form-&gt;sessionInput-&gt;setFocus(); QPalette palette; palette.setColor(QPalette::Base, QColor(255, 255, 192)); form-&gt;hostNameEdit-&gt;setPalette(palette); QSslCipher ciph = socket-&gt;sessionCipher(); QString cipher = QString(&quot;%1, %2 (%3/%4)&quot;).arg(ciph.authenticationMethod()) .arg(ciph.name()).arg(ciph.usedBits()).arg(ciph.supportedBits());; form-&gt;cipherLabel-&gt;setText(cipher); if (!padLock) { padLock = new QToolButton; padLock-&gt;setIcon(QIcon(&quot;:/encrypted.png&quot;)); #ifndef QT_NO_CURSOR padLock-&gt;setCursor(Qt::ArrowCursor); #endif padLock-&gt;setToolTip(tr(&quot;Display encryption details.&quot;)); int extent = form-&gt;hostNameEdit-&gt;height() - 2; padLock-&gt;resize(extent, extent); padLock-&gt;setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored); QHBoxLayout *layout = new QHBoxLayout(form-&gt;hostNameEdit); layout-&gt;setMargin(form-&gt;hostNameEdit-&gt;style()-&gt;pixelMetric(QStyle::PM_DefaultFrameWidth)); layout-&gt;setSpacing(0); layout-&gt;addStretch(); layout-&gt;addWidget(padLock); form-&gt;hostNameEdit-&gt;setLayout(layout); connect(padLock, SIGNAL(clicked()), this, SLOT(displayCertificateInfo())); } else { padLock-&gt;show(); } } void SslClient::socketReadyRead() { appendString(QString::fromUtf8(socket-&gt;readAll())); } void SslClient::sendData() { QString input = form-&gt;sessionInput-&gt;text(); appendString(input + &quot;\n&quot;); socket-&gt;write(input.toUtf8() + &quot;\r\n&quot;); form-&gt;sessionInput-&gt;clear(); } void SslClient::sslErrors(const QList&lt;QSslError&gt; &amp;errors) { QDialog errorDialog(this); Ui_SslErrors ui; ui.setupUi(&amp;errorDialog); connect(ui.certificateChainButton, SIGNAL(clicked()), this, SLOT(displayCertificateInfo())); foreach (const QSslError &amp;error, errors) ui.sslErrorList-&gt;addItem(error.errorString()); executingDialog = true; if (errorDialog.exec() == QDialog::Accepted) socket-&gt;ignoreSslErrors(); executingDialog = false; <span class="comment">// did the socket state change?</span> if (socket-&gt;state() != QAbstractSocket::ConnectedState) socketStateChanged(socket-&gt;state()); } void SslClient::displayCertificateInfo() { CertificateInfo *info = new CertificateInfo(this); info-&gt;setCertificateChain(socket-&gt;peerCertificateChain()); info-&gt;exec(); info-&gt;deleteLater(); } void SslClient::appendString(const QString &amp;line) { QTextCursor cursor(form-&gt;sessionOutput-&gt;textCursor()); cursor.movePosition(QTextCursor::End); cursor.insertText(line); form-&gt;sessionOutput-&gt;verticalScrollBar()-&gt;setValue(form-&gt;sessionOutput-&gt;verticalScrollBar()-&gt;maximum()); }</pre> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="40%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td> <td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="40%" align="right"><div align="right">Qt 4.6.0</div></td> </tr></table></div></address></body> </html>
{ "pile_set_name": "Github" }
[Device] Name=Logitech M720 DeviceMatch=usb:046d:405e;bluetooth:046d:b015 Driver=hidpp20
{ "pile_set_name": "Github" }
#if FEAT_COMPILER //#define DEBUG_COMPILE using System; using System.Threading; using ProtoBuf.Meta; using ProtoBuf.Serializers; #if FEAT_IKVM using Type = IKVM.Reflection.Type; using IKVM.Reflection; using IKVM.Reflection.Emit; #else using System.Reflection; using System.Reflection.Emit; #endif namespace ProtoBuf.Compiler { internal struct CodeLabel { public readonly Label Value; public readonly int Index; public CodeLabel(Label value, int index) { this.Value = value; this.Index = index; } } internal class CompilerContext { public TypeModel Model { get { return model; } } #if !(FX11 || FEAT_IKVM) readonly DynamicMethod method; static int next; #endif internal CodeLabel DefineLabel() { CodeLabel result = new CodeLabel(il.DefineLabel(), nextLabel++); return result; } internal void MarkLabel(CodeLabel label) { il.MarkLabel(label.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine("#: " + label.Index); #endif } #if !(FX11 || FEAT_IKVM) public static ProtoSerializer BuildSerializer(IProtoSerializer head, TypeModel model) { Type type = head.ExpectedType; CompilerContext ctx = new CompilerContext(type, true, true, model); ctx.LoadValue(Local.InputValue); ctx.CastFromObject(type); ctx.WriteNullCheckedTail(type, head, null); ctx.Emit(OpCodes.Ret); return (ProtoSerializer)ctx.method.CreateDelegate( typeof(ProtoSerializer)); } /*public static ProtoCallback BuildCallback(IProtoTypeSerializer head) { Type type = head.ExpectedType; CompilerContext ctx = new CompilerContext(type, true, true); using (Local typedVal = new Local(ctx, type)) { ctx.LoadValue(Local.InputValue); ctx.CastFromObject(type); ctx.StoreValue(typedVal); CodeLabel[] jumpTable = new CodeLabel[4]; for(int i = 0 ; i < jumpTable.Length ; i++) { jumpTable[i] = ctx.DefineLabel(); } ctx.LoadReaderWriter(); ctx.Switch(jumpTable); ctx.Return(); for(int i = 0 ; i < jumpTable.Length ; i++) { ctx.MarkLabel(jumpTable[i]); if (head.HasCallbacks((TypeModel.CallbackType)i)) { head.EmitCallback(ctx, typedVal, (TypeModel.CallbackType)i); } ctx.Return(); } } ctx.Emit(OpCodes.Ret); return (ProtoCallback)ctx.method.CreateDelegate( typeof(ProtoCallback)); }*/ public static ProtoDeserializer BuildDeserializer(IProtoSerializer head, TypeModel model) { Type type = head.ExpectedType; CompilerContext ctx = new CompilerContext(type, false, true, model); using (Local typedVal = new Local(ctx, type)) { if (!type.IsValueType) { ctx.LoadValue(Local.InputValue); ctx.CastFromObject(type); ctx.StoreValue(typedVal); } else { ctx.LoadValue(Local.InputValue); CodeLabel notNull = ctx.DefineLabel(), endNull = ctx.DefineLabel(); ctx.BranchIfTrue(notNull, true); ctx.LoadAddress(typedVal, type); ctx.EmitCtor(type); ctx.Branch(endNull, true); ctx.MarkLabel(notNull); ctx.LoadValue(Local.InputValue); ctx.CastFromObject(type); ctx.StoreValue(typedVal); ctx.MarkLabel(endNull); } head.EmitRead(ctx, typedVal); if (head.ReturnsValue) { ctx.StoreValue(typedVal); } ctx.LoadValue(typedVal); ctx.CastToObject(type); } ctx.Emit(OpCodes.Ret); return (ProtoDeserializer)ctx.method.CreateDelegate( typeof(ProtoDeserializer)); } #endif internal void Return() { Emit(OpCodes.Ret); } static bool IsObject(Type type) { #if FEAT_IKVM return type.FullName == "System.Object"; #else return type == typeof(object); #endif } internal void CastToObject(Type type) { if(IsObject(type)) { } else if (type.IsValueType) { il.Emit(OpCodes.Box, type); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Box + ": " + type); #endif } else { il.Emit(OpCodes.Castclass, MapType(typeof(object))); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Castclass + ": " + type); #endif } } internal void CastFromObject(Type type) { if (IsObject(type)) { } else if (type.IsValueType) { switch (MetadataVersion) { case ILVersion.Net1: il.Emit(OpCodes.Unbox, type); il.Emit(OpCodes.Ldobj, type); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Unbox + ": " + type); Helpers.DebugWriteLine(OpCodes.Ldobj + ": " + type); #endif break; default: #if FX11 throw new NotSupportedException(); #else il.Emit(OpCodes.Unbox_Any, type); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Unbox_Any + ": " + type); #endif break; #endif } } else { il.Emit(OpCodes.Castclass, type); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Castclass + ": " + type); #endif } } private readonly bool isStatic; #if !SILVERLIGHT private readonly RuntimeTypeModel.SerializerPair[] methodPairs; internal MethodBuilder GetDedicatedMethod(int metaKey, bool read) { if (methodPairs == null) return null; // but if we *do* have pairs, we demand that we find a match... for (int i = 0; i < methodPairs.Length; i++ ) { if (methodPairs[i].MetaKey == metaKey) { return read ? methodPairs[i].Deserialize : methodPairs[i].Serialize; } } throw new ArgumentException("Meta-key not found", "metaKey"); } internal int MapMetaKeyToCompiledKey(int metaKey) { if (metaKey < 0 || methodPairs == null) return metaKey; // all meta, or a dummy/wildcard key for (int i = 0; i < methodPairs.Length; i++) { if (methodPairs[i].MetaKey == metaKey) return i; } throw new ArgumentException("Key could not be mapped: " + metaKey, "metaKey"); } #else internal int MapMetaKeyToCompiledKey(int metaKey) { return metaKey; } #endif private readonly bool nonPublic, isWriter; internal bool NonPublic { get { return nonPublic; } } #if !(SILVERLIGHT || PHONE8) private readonly string assemblyName; internal CompilerContext(ILGenerator il, bool isStatic, bool isWriter, RuntimeTypeModel.SerializerPair[] methodPairs, TypeModel model, ILVersion metadataVersion, string assemblyName) { if (il == null) throw new ArgumentNullException("il"); if (methodPairs == null) throw new ArgumentNullException("methodPairs"); if (model == null) throw new ArgumentNullException("model"); if (Helpers.IsNullOrEmpty(assemblyName)) throw new ArgumentNullException("assemblyName"); this.assemblyName = assemblyName; this.isStatic = isStatic; this.methodPairs = methodPairs; this.il = il; nonPublic = false; this.isWriter = isWriter; this.model = model; this.metadataVersion = metadataVersion; } #endif #if !(FX11 || FEAT_IKVM) private CompilerContext(Type associatedType, bool isWriter, bool isStatic, TypeModel model) { if (model == null) throw new ArgumentNullException("model"); #if FX11 metadataVersion = ILVersion.Net1; #else metadataVersion = ILVersion.Net2; #endif this.isStatic = isStatic; this.isWriter = isWriter; this.model = model; nonPublic = true; Type[] paramTypes; Type returnType; if (isWriter) { returnType = typeof(void); paramTypes = new Type[] { typeof(object), typeof(ProtoWriter) }; } else { returnType = typeof(object); paramTypes = new Type[] { typeof(object), typeof(ProtoReader) }; } int uniqueIdentifier; #if PLAT_NO_INTERLOCKED uniqueIdentifier = ++next; #else uniqueIdentifier = Interlocked.Increment(ref next); #endif method = new DynamicMethod("proto_" + uniqueIdentifier.ToString(), returnType, paramTypes, associatedType.IsInterface ? typeof(object) : associatedType, true); this.il = method.GetILGenerator(); } #endif private readonly ILGenerator il; private void Emit(OpCode opcode) { il.Emit(opcode); #if DEBUG_COMPILE Helpers.DebugWriteLine(opcode.ToString()); #endif } public void LoadValue(string value) { if (value == null) { LoadNullRef(); } else { il.Emit(OpCodes.Ldstr, value); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Ldstr + ": " + value); #endif } } public void LoadValue(float value) { il.Emit(OpCodes.Ldc_R4, value); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Ldc_R4 + ": " + value); #endif } public void LoadValue(double value) { il.Emit(OpCodes.Ldc_R8, value); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Ldc_R8 + ": " + value); #endif } public void LoadValue(long value) { il.Emit(OpCodes.Ldc_I8, value); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Ldc_I8 + ": " + value); #endif } public void LoadValue(int value) { switch (value) { case 0: Emit(OpCodes.Ldc_I4_0); break; case 1: Emit(OpCodes.Ldc_I4_1); break; case 2: Emit(OpCodes.Ldc_I4_2); break; case 3: Emit(OpCodes.Ldc_I4_3); break; case 4: Emit(OpCodes.Ldc_I4_4); break; case 5: Emit(OpCodes.Ldc_I4_5); break; case 6: Emit(OpCodes.Ldc_I4_6); break; case 7: Emit(OpCodes.Ldc_I4_7); break; case 8: Emit(OpCodes.Ldc_I4_8); break; case -1: Emit(OpCodes.Ldc_I4_M1); break; default: if (value >= -128 && value <= 127) { il.Emit(OpCodes.Ldc_I4_S, (sbyte)value); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Ldc_I4_S + ": " + value); #endif } else { il.Emit(OpCodes.Ldc_I4, value); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Ldc_I4 + ": " + value); #endif } break; } } MutableList locals = new MutableList(); internal LocalBuilder GetFromPool(Type type) { int count = locals.Count; for (int i = 0; i < count; i++) { LocalBuilder item = (LocalBuilder)locals[i]; if (item != null && item.LocalType == type) { locals[i] = null; // remove from pool return item; } } LocalBuilder result = il.DeclareLocal(type); #if DEBUG_COMPILE Helpers.DebugWriteLine("$ " + result + ": " + type); #endif return result; } // internal void ReleaseToPool(LocalBuilder value) { int count = locals.Count; for (int i = 0; i < count; i++) { if (locals[i] == null) { locals[i] = value; // released into existing slot return; } } locals.Add(value); // create a new slot } public void LoadReaderWriter() { Emit(isStatic ? OpCodes.Ldarg_1 : OpCodes.Ldarg_2); } public void StoreValue(Local local) { if (local == Local.InputValue) { byte b = isStatic ? (byte) 0 : (byte)1; il.Emit(OpCodes.Starg_S, b); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Starg_S + ": $" + b); #endif } else { #if !FX11 switch (local.Value.LocalIndex) { case 0: Emit(OpCodes.Stloc_0); break; case 1: Emit(OpCodes.Stloc_1); break; case 2: Emit(OpCodes.Stloc_2); break; case 3: Emit(OpCodes.Stloc_3); break; default: #endif OpCode code = UseShortForm(local) ? OpCodes.Stloc_S : OpCodes.Stloc; il.Emit(code, local.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": $" + local.Value); #endif #if !FX11 break; } #endif } } public void LoadValue(Local local) { if (local == null) { /* nothing to do; top of stack */} else if (local == Local.InputValue) { Emit(isStatic ? OpCodes.Ldarg_0 : OpCodes.Ldarg_1); } else { #if !FX11 switch (local.Value.LocalIndex) { case 0: Emit(OpCodes.Ldloc_0); break; case 1: Emit(OpCodes.Ldloc_1); break; case 2: Emit(OpCodes.Ldloc_2); break; case 3: Emit(OpCodes.Ldloc_3); break; default: #endif OpCode code = UseShortForm(local) ? OpCodes.Ldloc_S : OpCodes.Ldloc; il.Emit(code, local.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": $" + local.Value); #endif #if !FX11 break; } #endif } } public Local GetLocalWithValue(Type type, Compiler.Local fromValue) { if (fromValue != null) { return fromValue.AsCopy(); } // need to store the value from the stack Local result = new Local(this, type); StoreValue(result); return result; } internal void EmitBasicRead(string methodName, Type expectedType) { MethodInfo method = MapType(typeof(ProtoReader)).GetMethod( methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (method == null || method.ReturnType != expectedType || method.GetParameters().Length != 0) throw new ArgumentException("methodName"); LoadReaderWriter(); EmitCall(method); } internal void EmitBasicRead(Type helperType, string methodName, Type expectedType) { MethodInfo method = helperType.GetMethod( methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); if (method == null || method.ReturnType != expectedType || method.GetParameters().Length != 1) throw new ArgumentException("methodName"); LoadReaderWriter(); EmitCall(method); } internal void EmitBasicWrite(string methodName, Compiler.Local fromValue) { if (Helpers.IsNullOrEmpty(methodName)) throw new ArgumentNullException("methodName"); LoadValue(fromValue); LoadReaderWriter(); EmitCall(GetWriterMethod(methodName)); } private MethodInfo GetWriterMethod(string methodName) { Type writerType = MapType(typeof(ProtoWriter)); MethodInfo[] methods = writerType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); foreach (MethodInfo method in methods) { if(method.Name != methodName) continue; ParameterInfo[] pis = method.GetParameters(); if (pis.Length == 2 && pis[1].ParameterType == writerType) return method; } throw new ArgumentException("No suitable method found for: " + methodName, "methodName"); } internal void EmitWrite(Type helperType, string methodName, Compiler.Local valueFrom) { if (Helpers.IsNullOrEmpty(methodName)) throw new ArgumentNullException("methodName"); MethodInfo method = helperType.GetMethod( methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); if (method == null || method.ReturnType != MapType(typeof(void))) throw new ArgumentException("methodName"); LoadValue(valueFrom); LoadReaderWriter(); EmitCall(method); } public void EmitCall(MethodInfo method) { Helpers.DebugAssert(method != null); CheckAccessibility(method); OpCode opcode = (method.IsStatic || method.DeclaringType.IsValueType) ? OpCodes.Call : OpCodes.Callvirt; il.EmitCall(opcode, method, null); #if DEBUG_COMPILE Helpers.DebugWriteLine(opcode + ": " + method + " on " + method.DeclaringType); #endif } /// <summary> /// Pushes a null reference onto the stack. Note that this should only /// be used to return a null (or set a variable to null); for null-tests /// use BranchIfTrue / BranchIfFalse. /// </summary> public void LoadNullRef() { Emit(OpCodes.Ldnull); } private int nextLabel; internal void WriteNullCheckedTail(Type type, IProtoSerializer tail, Compiler.Local valueFrom) { if (type.IsValueType) { Type underlyingType = null; #if !FX11 underlyingType = Helpers.GetUnderlyingType(type); #endif if (underlyingType == null) { // not a nullable T; can invoke directly tail.EmitWrite(this, valueFrom); } else { // nullable T; check HasValue using (Compiler.Local valOrNull = GetLocalWithValue(type, valueFrom)) { LoadAddress(valOrNull, type); LoadValue(type.GetProperty("HasValue")); CodeLabel @end = DefineLabel(); BranchIfFalse(@end, false); LoadAddress(valOrNull, type); EmitCall(type.GetMethod("GetValueOrDefault", Helpers.EmptyTypes)); tail.EmitWrite(this, null); MarkLabel(@end); } } } else { // ref-type; do a null-check LoadValue(valueFrom); CopyValue(); CodeLabel hasVal = DefineLabel(), @end = DefineLabel(); BranchIfTrue(hasVal, true); DiscardValue(); Branch(@end, false); MarkLabel(hasVal); tail.EmitWrite(this, null); MarkLabel(@end); } } internal void ReadNullCheckedTail(Type type, IProtoSerializer tail, Compiler.Local valueFrom) { #if !FX11 Type underlyingType; if (type.IsValueType && (underlyingType = Helpers.GetUnderlyingType(type)) != null) { if(tail.RequiresOldValue) { // we expect the input value to be in valueFrom; need to unpack it from T? using (Local loc = GetLocalWithValue(type, valueFrom)) { LoadAddress(loc, type); EmitCall(type.GetMethod("GetValueOrDefault", Helpers.EmptyTypes)); } } else { Helpers.DebugAssert(valueFrom == null); // not expecting a valueFrom in this case } tail.EmitRead(this, null); // either unwrapped on the stack or not provided if (tail.ReturnsValue) { // now re-wrap the value EmitCtor(type, underlyingType); } return; } #endif // either a ref-type of a non-nullable struct; treat "as is", even if null // (the type-serializer will handle the null case; it needs to allow null // inputs to perform the correct type of subclass creation) tail.EmitRead(this, valueFrom); } public void EmitCtor(Type type) { EmitCtor(type, Helpers.EmptyTypes); } public void EmitCtor(ConstructorInfo ctor) { if (ctor == null) throw new ArgumentNullException("ctor"); CheckAccessibility(ctor); il.Emit(OpCodes.Newobj, ctor); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Newobj + ": " + ctor.DeclaringType); #endif } public void EmitCtor(Type type, params Type[] parameterTypes) { Helpers.DebugAssert(type != null); Helpers.DebugAssert(parameterTypes != null); if (type.IsValueType && parameterTypes.Length == 0) { il.Emit(OpCodes.Initobj, type); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Initobj + ": " + type); #endif } else { ConstructorInfo ctor = Helpers.GetConstructor(type, parameterTypes, true); if (ctor == null) throw new InvalidOperationException("No suitable constructor found for " + type.FullName); EmitCtor(ctor); } } #if !(PHONE8 || SILVERLIGHT || FX11) BasicList knownTrustedAssemblies, knownUntrustedAssemblies; #endif bool InternalsVisible(Assembly assembly) { #if PHONE8 || SILVERLIGHT || FX11 return false; #else if (Helpers.IsNullOrEmpty(assemblyName)) return false; if (knownTrustedAssemblies != null) { if (knownTrustedAssemblies.IndexOfReference(assembly) >= 0) { return true; } } if (knownUntrustedAssemblies != null) { if (knownUntrustedAssemblies.IndexOfReference(assembly) >= 0) { return false; } } bool isTrusted = false; Type attributeType = MapType(typeof(System.Runtime.CompilerServices.InternalsVisibleToAttribute)); if(attributeType == null) return false; #if FEAT_IKVM foreach (CustomAttributeData attrib in assembly.__GetCustomAttributes(attributeType, false)) { if (attrib.ConstructorArguments.Count == 1) { string privelegedAssembly = attrib.ConstructorArguments[0].Value as string; if (privelegedAssembly == assemblyName) { isTrusted = true; break; } } } #else foreach(System.Runtime.CompilerServices.InternalsVisibleToAttribute attrib in assembly.GetCustomAttributes(attributeType, false)) { if (attrib.AssemblyName == assemblyName) { isTrusted = true; break; } } #endif if (isTrusted) { if (knownTrustedAssemblies == null) knownTrustedAssemblies = new BasicList(); knownTrustedAssemblies.Add(assembly); } else { if (knownUntrustedAssemblies == null) knownUntrustedAssemblies = new BasicList(); knownUntrustedAssemblies.Add(assembly); } return isTrusted; #endif } internal void CheckAccessibility(MemberInfo member) { if (member == null) { throw new ArgumentNullException("member"); } if (!NonPublic) { bool isPublic; switch (member.MemberType) { case MemberTypes.TypeInfo: // top-level type isPublic = ((Type)member).IsPublic || InternalsVisible(((Type)member).Assembly); break; case MemberTypes.NestedType: Type type = (Type)member; do { isPublic = type.IsNestedPublic || type.IsPublic || ((type.DeclaringType == null || type.IsNestedAssembly || type.IsNestedFamORAssem) && InternalsVisible(type.Assembly)); } while (isPublic && (type = type.DeclaringType) != null); // ^^^ !type.IsNested, but not all runtimes have that break; case MemberTypes.Field: FieldInfo field = ((FieldInfo)member); isPublic = field.IsPublic || ((field.IsAssembly || field.IsFamilyOrAssembly) && InternalsVisible(field.DeclaringType.Assembly)); break; case MemberTypes.Constructor: ConstructorInfo ctor = ((ConstructorInfo)member); isPublic = ctor.IsPublic || ((ctor.IsAssembly || ctor.IsFamilyOrAssembly) && InternalsVisible(ctor.DeclaringType.Assembly)); break; case MemberTypes.Method: MethodInfo method = ((MethodInfo)member); isPublic = method.IsPublic || ((method.IsAssembly || method.IsFamilyOrAssembly) && InternalsVisible(method.DeclaringType.Assembly)); if (!isPublic) { // allow calls to TypeModel protected methods, and methods we are in the process of creating if( #if !SILVERLIGHT member is MethodBuilder || #endif member.DeclaringType == MapType(typeof(TypeModel))) isPublic = true; } break; case MemberTypes.Property: isPublic = true; // defer to get/set break; default: throw new NotSupportedException(member.MemberType.ToString()); } if (!isPublic) { switch (member.MemberType) { case MemberTypes.TypeInfo: case MemberTypes.NestedType: throw new InvalidOperationException("Non-public type cannot be used with full dll compilation: " + ((Type)member).FullName); default: throw new InvalidOperationException("Non-public member cannot be used with full dll compilation: " + member.DeclaringType.FullName + "." + member.Name); } } } } public void LoadValue(FieldInfo field) { CheckAccessibility(field); OpCode code = field.IsStatic ? OpCodes.Ldsfld : OpCodes.Ldfld; il.Emit(code, field); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": " + field + " on " + field.DeclaringType); #endif } #if FEAT_IKVM public void StoreValue(System.Reflection.FieldInfo field) { StoreValue(MapType(field.DeclaringType).GetField(field.Name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance)); } public void StoreValue(System.Reflection.PropertyInfo property) { StoreValue(MapType(property.DeclaringType).GetProperty(property.Name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance)); } public void LoadValue(System.Reflection.FieldInfo field) { LoadValue(MapType(field.DeclaringType).GetField(field.Name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance)); } public void LoadValue(System.Reflection.PropertyInfo property) { LoadValue(MapType(property.DeclaringType).GetProperty(property.Name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance)); } #endif public void StoreValue(FieldInfo field) { CheckAccessibility(field); OpCode code = field.IsStatic ? OpCodes.Stsfld : OpCodes.Stfld; il.Emit(code, field); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": " + field + " on " + field.DeclaringType); #endif } public void LoadValue(PropertyInfo property) { CheckAccessibility(property); EmitCall(Helpers.GetGetMethod(property, true, true)); } public void StoreValue(PropertyInfo property) { CheckAccessibility(property); EmitCall(Helpers.GetSetMethod(property, true, true)); } internal void EmitInstance() { if (isStatic) throw new InvalidOperationException(); Emit(OpCodes.Ldarg_0); } internal static void LoadValue(ILGenerator il, int value) { switch (value) { case 0: il.Emit(OpCodes.Ldc_I4_0); break; case 1: il.Emit(OpCodes.Ldc_I4_1); break; case 2: il.Emit(OpCodes.Ldc_I4_2); break; case 3: il.Emit(OpCodes.Ldc_I4_3); break; case 4: il.Emit(OpCodes.Ldc_I4_4); break; case 5: il.Emit(OpCodes.Ldc_I4_5); break; case 6: il.Emit(OpCodes.Ldc_I4_6); break; case 7: il.Emit(OpCodes.Ldc_I4_7); break; case 8: il.Emit(OpCodes.Ldc_I4_8); break; case -1: il.Emit(OpCodes.Ldc_I4_M1); break; default: il.Emit(OpCodes.Ldc_I4, value); break; } } private bool UseShortForm(Local local) { #if FX11 return locals.Count < 256; #else return local.Value.LocalIndex < 256; #endif } #if FEAT_IKVM internal void LoadAddress(Local local, System.Type type) { LoadAddress(local, MapType(type)); } #endif internal void LoadAddress(Local local, Type type) { if (type.IsValueType) { if (local == null) { throw new InvalidOperationException("Cannot load the address of a struct at the head of the stack"); } if (local == Local.InputValue) { il.Emit(OpCodes.Ldarga_S, (isStatic ? (byte)0 : (byte)1)); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Ldarga_S + ": $" + (isStatic ? 0 : 1)); #endif } else { OpCode code = UseShortForm(local) ? OpCodes.Ldloca_S : OpCodes.Ldloca; il.Emit(code, local.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": $" + local.Value); #endif } } else { // reference-type; already *is* the address; just load it LoadValue(local); } } internal void Branch(CodeLabel label, bool @short) { OpCode code = @short ? OpCodes.Br_S : OpCodes.Br; il.Emit(code, label.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": " + label.Index); #endif } internal void BranchIfFalse(CodeLabel label, bool @short) { OpCode code = @short ? OpCodes.Brfalse_S : OpCodes.Brfalse; il.Emit(code, label.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": " + label.Index); #endif } internal void BranchIfTrue(CodeLabel label, bool @short) { OpCode code = @short ? OpCodes.Brtrue_S : OpCodes.Brtrue; il.Emit(code, label.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": " + label.Index); #endif } internal void BranchIfEqual(CodeLabel label, bool @short) { OpCode code = @short ? OpCodes.Beq_S : OpCodes.Beq; il.Emit(code, label.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": " + label.Index); #endif } internal void TestEqual() { Emit(OpCodes.Ceq); } internal void CopyValue() { Emit(OpCodes.Dup); } internal void BranchIfGreater(CodeLabel label, bool @short) { OpCode code = @short ? OpCodes.Bgt_S : OpCodes.Bgt; il.Emit(code, label.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": " + label.Index); #endif } internal void BranchIfLess(CodeLabel label, bool @short) { OpCode code = @short ? OpCodes.Blt_S : OpCodes.Blt; il.Emit(code, label.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": " + label.Index); #endif } internal void DiscardValue() { Emit(OpCodes.Pop); } public void Subtract() { Emit(OpCodes.Sub); } public void Switch(CodeLabel[] jumpTable) { Label[] labels = new Label[jumpTable.Length]; #if DEBUG_COMPILE StringBuilder sb = new StringBuilder(OpCodes.Switch.ToString()); #endif for (int i = 0; i < labels.Length; i++) { labels[i] = jumpTable[i].Value; #if DEBUG_COMPILE sb.Append("; ").Append(i).Append("=>").Append(jumpTable[i].Index); #endif } il.Emit(OpCodes.Switch, labels); #if DEBUG_COMPILE Helpers.DebugWriteLine(sb.ToString()); #endif } internal void EndFinally() { il.EndExceptionBlock(); #if DEBUG_COMPILE Helpers.DebugWriteLine("EndExceptionBlock"); #endif } internal void BeginFinally() { il.BeginFinallyBlock(); #if DEBUG_COMPILE Helpers.DebugWriteLine("BeginFinallyBlock"); #endif } internal void EndTry(CodeLabel label, bool @short) { OpCode code = @short ? OpCodes.Leave_S : OpCodes.Leave; il.Emit(code, label.Value); #if DEBUG_COMPILE Helpers.DebugWriteLine(code + ": " + label.Index); #endif } internal CodeLabel BeginTry() { CodeLabel label = new CodeLabel(il.BeginExceptionBlock(), nextLabel++); #if DEBUG_COMPILE Helpers.DebugWriteLine("BeginExceptionBlock: " + label.Index); #endif return label; } #if !FX11 internal void Constrain(Type type) { il.Emit(OpCodes.Constrained, type); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Constrained + ": " + type); #endif } #endif internal void TryCast(Type type) { il.Emit(OpCodes.Isinst, type); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Isinst + ": " + type); #endif } internal void Cast(Type type) { il.Emit(OpCodes.Castclass, type); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Castclass + ": " + type); #endif } public IDisposable Using(Local local) { return new UsingBlock(this, local); } private class UsingBlock : IDisposable{ private Local local; CompilerContext ctx; CodeLabel label; /// <summary> /// Creates a new "using" block (equivalent) around a variable; /// the variable must exist, and note that (unlike in C#) it is /// the variables *final* value that gets disposed. If you need /// *original* disposal, copy your variable first. /// /// It is the callers responsibility to ensure that the variable's /// scope fully-encapsulates the "using"; if not, the variable /// may be re-used (and thus re-assigned) unexpectedly. /// </summary> public UsingBlock(CompilerContext ctx, Local local) { if (ctx == null) throw new ArgumentNullException("ctx"); if (local == null) throw new ArgumentNullException("local"); Type type = local.Type; // check if **never** disposable if ((type.IsValueType || type.IsSealed) && !ctx.MapType(typeof(IDisposable)).IsAssignableFrom(type)) { return; // nothing to do! easiest "using" block ever // (note that C# wouldn't allow this as a "using" block, // but we'll be generous and simply not do anything) } this.local = local; this.ctx = ctx; label = ctx.BeginTry(); } public void Dispose() { if (local == null || ctx == null) return; ctx.EndTry(label, false); ctx.BeginFinally(); Type disposableType = ctx.MapType(typeof (IDisposable)); MethodInfo dispose = disposableType.GetMethod("Dispose"); Type type = local.Type; // remember that we've already (in the .ctor) excluded the case // where it *cannot* be disposable if (type.IsValueType) { ctx.LoadAddress(local, type); switch (ctx.MetadataVersion) { case ILVersion.Net1: ctx.LoadValue(local); ctx.CastToObject(type); break; default: #if FX11 throw new NotSupportedException(); #else ctx.Constrain(type); break; #endif } ctx.EmitCall(dispose); } else { Compiler.CodeLabel @null = ctx.DefineLabel(); if (disposableType.IsAssignableFrom(type)) { // *known* to be IDisposable; just needs a null-check ctx.LoadValue(local); ctx.BranchIfFalse(@null, true); ctx.LoadAddress(local, type); } else { // *could* be IDisposable; test via "as" using (Compiler.Local disp = new Compiler.Local(ctx, disposableType)) { ctx.LoadValue(local); ctx.TryCast(disposableType); ctx.CopyValue(); ctx.StoreValue(disp); ctx.BranchIfFalse(@null, true); ctx.LoadAddress(disp, disposableType); } } ctx.EmitCall(dispose); ctx.MarkLabel(@null); } ctx.EndFinally(); this.local = null; this.ctx = null; label = new CodeLabel(); // default } } internal void Add() { Emit(OpCodes.Add); } internal void LoadLength(Local arr, bool zeroIfNull) { Helpers.DebugAssert(arr.Type.IsArray && arr.Type.GetArrayRank() == 1); if (zeroIfNull) { Compiler.CodeLabel notNull = DefineLabel(), done = DefineLabel(); LoadValue(arr); CopyValue(); // optimised for non-null case BranchIfTrue(notNull, true); DiscardValue(); LoadValue(0); Branch(done, true); MarkLabel(notNull); Emit(OpCodes.Ldlen); Emit(OpCodes.Conv_I4); MarkLabel(done); } else { LoadValue(arr); Emit(OpCodes.Ldlen); Emit(OpCodes.Conv_I4); } } internal void CreateArray(Type elementType, Local length) { LoadValue(length); il.Emit(OpCodes.Newarr, elementType); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Newarr + ": " + elementType); #endif } internal void LoadArrayValue(Local arr, Local i) { Type type = arr.Type; Helpers.DebugAssert(type.IsArray && arr.Type.GetArrayRank() == 1); type = type.GetElementType(); Helpers.DebugAssert(type != null, "Not an array: " + arr.Type.FullName); LoadValue(arr); LoadValue(i); switch(Helpers.GetTypeCode(type)) { case ProtoTypeCode.SByte: Emit(OpCodes.Ldelem_I1); break; case ProtoTypeCode.Int16: Emit(OpCodes.Ldelem_I2); break; case ProtoTypeCode.Int32: Emit(OpCodes.Ldelem_I4); break; case ProtoTypeCode.Int64: Emit(OpCodes.Ldelem_I8); break; case ProtoTypeCode.Byte: Emit(OpCodes.Ldelem_U1); break; case ProtoTypeCode.UInt16: Emit(OpCodes.Ldelem_U2); break; case ProtoTypeCode.UInt32: Emit(OpCodes.Ldelem_U4); break; case ProtoTypeCode.UInt64: Emit(OpCodes.Ldelem_I8); break; // odd, but this is what C# does... case ProtoTypeCode.Single: Emit(OpCodes.Ldelem_R4); break; case ProtoTypeCode.Double: Emit(OpCodes.Ldelem_R8); break; default: if (type.IsValueType) { il.Emit(OpCodes.Ldelema, type); il.Emit(OpCodes.Ldobj, type); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Ldelema + ": " + type); Helpers.DebugWriteLine(OpCodes.Ldobj + ": " + type); #endif } else { Emit(OpCodes.Ldelem_Ref); } break; } } internal void LoadValue(Type type) { il.Emit(OpCodes.Ldtoken, type); #if DEBUG_COMPILE Helpers.DebugWriteLine(OpCodes.Ldtoken + ": " + type); #endif EmitCall(MapType(typeof(System.Type)).GetMethod("GetTypeFromHandle")); } internal void ConvertToInt32(ProtoTypeCode typeCode, bool uint32Overflow) { switch (typeCode) { case ProtoTypeCode.Byte: case ProtoTypeCode.SByte: case ProtoTypeCode.Int16: case ProtoTypeCode.UInt16: Emit(OpCodes.Conv_I4); break; case ProtoTypeCode.Int32: break; case ProtoTypeCode.Int64: Emit(OpCodes.Conv_Ovf_I4); break; case ProtoTypeCode.UInt32: Emit(uint32Overflow ? OpCodes.Conv_Ovf_I4_Un : OpCodes.Conv_Ovf_I4); break; case ProtoTypeCode.UInt64: Emit(OpCodes.Conv_Ovf_I4_Un); break; default: throw new InvalidOperationException("ConvertToInt32 not implemented for: " + typeCode); } } internal void ConvertFromInt32(ProtoTypeCode typeCode, bool uint32Overflow) { switch (typeCode) { case ProtoTypeCode.SByte: Emit(OpCodes.Conv_Ovf_I1); break; case ProtoTypeCode.Byte: Emit(OpCodes.Conv_Ovf_U1); break; case ProtoTypeCode.Int16: Emit(OpCodes.Conv_Ovf_I2); break; case ProtoTypeCode.UInt16: Emit(OpCodes.Conv_Ovf_U2); break; case ProtoTypeCode.Int32: break; case ProtoTypeCode.UInt32: Emit(uint32Overflow ? OpCodes.Conv_Ovf_U4 : OpCodes.Conv_U4); break; case ProtoTypeCode.Int64: Emit(OpCodes.Conv_I8); break; case ProtoTypeCode.UInt64: Emit(OpCodes.Conv_U8); break; default: throw new InvalidOperationException(); } } internal void LoadValue(decimal value) { if (value == 0M) { LoadValue(typeof(decimal).GetField("Zero")); } else { int[] bits = decimal.GetBits(value); LoadValue(bits[0]); // lo LoadValue(bits[1]); // mid LoadValue(bits[2]); // hi LoadValue((int)(((uint)bits[3]) >> 31)); // isNegative (bool, but int for CLI purposes) LoadValue((bits[3] >> 16) & 0xFF); // scale (byte, but int for CLI purposes) EmitCtor(MapType(typeof(decimal)), new Type[] { MapType(typeof(int)), MapType(typeof(int)), MapType(typeof(int)), MapType(typeof(bool)), MapType(typeof(byte)) }); } } internal void LoadValue(Guid value) { if (value == Guid.Empty) { LoadValue(typeof(Guid).GetField("Empty")); } else { // note we're adding lots of shorts/bytes here - but at the IL level they are I4, not I1/I2 (which barely exist) byte[] bytes = value.ToByteArray(); int i = (bytes[0]) | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24); LoadValue(i); short s = (short)((bytes[4]) | (bytes[5] << 8)); LoadValue(s); s = (short)((bytes[6]) | (bytes[7] << 8)); LoadValue(s); for (i = 8; i <= 15; i++) { LoadValue(bytes[i]); } EmitCtor(MapType(typeof(Guid)), new Type[] { MapType(typeof(int)), MapType(typeof(short)), MapType(typeof(short)), MapType(typeof(byte)), MapType(typeof(byte)), MapType(typeof(byte)), MapType(typeof(byte)), MapType(typeof(byte)), MapType(typeof(byte)), MapType(typeof(byte)), MapType(typeof(byte)) }); } } internal void LoadValue(bool value) { Emit(value ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0); } internal void LoadSerializationContext() { LoadReaderWriter(); LoadValue((isWriter ? typeof(ProtoWriter) : typeof(ProtoReader)).GetProperty("Context")); } private readonly TypeModel model; internal Type MapType(System.Type type) { return model.MapType(type); } private readonly ILVersion metadataVersion; public ILVersion MetadataVersion { get { return metadataVersion; } } public enum ILVersion { Net1, Net2 } internal bool AllowInternal(PropertyInfo property) { return nonPublic ? true : InternalsVisible(property.DeclaringType.Assembly); } } } #endif
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <body> <p>The following button shows an alert box.</p> <button onclick="myAlertFunction()">Click me</button> <br> <p>The following button shows an confirm box.</p> <button onclick="myConfirmFunction()">Click me</button> <br> <p>The following button shows an Prompt box.</p> <button onclick="myPromptFunction()">Click me</button> <br> <p id="demo"></p> <script> function myAlertFunction() { alert('Custom dialog for JS Alert functions'); } function myConfirmFunction() { confirm("Press a button!"); } function myPromptFunction() { var person = prompt("Please enter your name", "Harry Potter"); if (person != null) { document.getElementById("demo").innerHTML = "Hello " + person + "! How are you today?"; } } </script> </body> </html>
{ "pile_set_name": "Github" }
" vim suffers: exec vam#DefineAndBind('s:c','g:vim_tiny_cmd', '{}') fun! tiny_cmd#Put(a) let new = get(s:c,'next',0) +1 let s:c['next'] = new let s:c[new] = a:a return new endf fun! tiny_cmd#Get(nr) return s:c[a:nr] endf " Get and remove item fun! tiny_cmd#Pop(nr) let r = s:c[a:nr] | unlet s:c[a:nr] | return r endf
{ "pile_set_name": "Github" }
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include "ptr_hdr.h" #define PTR_SIZE 100 #define PTR2_SIZE 10 #define PTR3_SIZE 10 #define OUT_OF_BOUNDS_EXCESS 1 int main() { struct IntStruct ptr((int*)malloc(PTR_SIZE*sizeof(int))); struct IntStruct ptr2((int*)malloc(PTR2_SIZE*sizeof(int))); struct IntStruct start_ptr(ptr); struct IntStruct start_ptr2(ptr2); struct IntStruct start_ptr3((int*)malloc(PTR_SIZE*sizeof(int))), start_ptr4(start_ptr2); #if 0 *start_ptr = 1; *start_ptr2 = 1; *ptr = 3; *ptr2 = 9; #endif return 1; }
{ "pile_set_name": "Github" }
#FIG 3.2 Produced by xfig version 3.2.5c Landscape Center Metric A4 100.00 Single -2 1200 2 6 7425 450 9000 5175 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 675 7875 675 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 900 7875 900 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 1125 7875 1125 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 1350 7875 1350 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 1575 7875 1575 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 1800 7875 1800 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 2025 7875 2025 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 2250 7875 2250 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 2475 7875 2475 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 2700 7875 2700 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 2925 7875 2925 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 3150 7875 3150 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 3375 7875 3375 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 3600 7875 3600 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 3825 7875 3825 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 4050 7875 4050 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 4275 7875 4275 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 4500 7875 4500 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 4725 7875 4725 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 4950 7875 4950 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 7875 450 9000 450 9000 5175 7875 5175 7875 450 4 0 0 50 -1 0 12 0.0000 4 135 105 7650 630 1\001 4 0 0 50 -1 0 12 0.0000 4 135 105 7650 855 2\001 4 0 0 50 -1 0 12 0.0000 4 135 105 7650 1080 3\001 4 0 0 50 -1 0 12 0.0000 4 135 105 7650 1305 4\001 4 0 0 50 -1 0 12 0.0000 4 135 105 7650 1530 5\001 4 0 0 50 -1 0 12 0.0000 4 135 105 7650 1755 6\001 4 0 0 50 -1 0 12 0.0000 4 135 105 7650 1980 7\001 4 0 0 50 -1 0 12 0.0000 4 135 105 7650 2205 8\001 4 0 0 50 -1 0 12 0.0000 4 135 105 7650 2430 9\001 4 0 0 50 -1 0 14 0.0000 4 165 450 7965 720 VSS\001 4 0 0 50 -1 0 14 0.0000 4 165 465 7965 2970 DB4\001 4 0 0 50 -1 0 14 0.0000 4 165 465 7965 3195 DB5\001 4 0 0 50 -1 0 14 0.0000 4 165 465 7965 3645 DB7\001 4 0 0 50 -1 0 14 0.0000 4 165 465 7965 3420 DB6\001 4 0 0 50 -1 0 14 0.0000 4 165 465 7965 2070 DB0\001 4 0 0 50 -1 0 14 0.0000 4 165 465 7965 2295 DB1\001 4 0 0 50 -1 0 14 0.0000 4 165 450 7965 2520 BB2\001 4 0 0 50 -1 0 14 0.0000 4 165 465 7965 2745 DB3\001 4 0 0 50 -1 0 14 0.0000 4 165 540 7965 945 VDD\001 4 0 0 50 -1 0 14 0.0000 4 165 360 7965 1170 VO\001 4 0 0 50 -1 0 14 0.0000 4 165 300 7965 1395 RS\001 4 0 0 50 -1 0 14 0.0000 4 165 450 7965 1620 R/W\001 4 0 0 50 -1 0 14 0.0000 4 165 150 7965 1845 E\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 2655 10\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 2880 11\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 3105 12\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 3330 13\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 3555 14\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 3780 15\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 4005 16\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 4230 17\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 4455 18\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 4680 19\001 4 0 0 50 -1 0 12 0.0000 4 135 210 7650 4905 20\001 4 0 0 50 -1 0 12 0.0000 4 135 270 7965 4095 NC\001 4 0 0 50 -1 0 14 0.0000 4 165 435 7965 3870 PSB\001 4 0 0 50 -1 0 14 0.0000 4 165 450 7965 4320 RST\001 4 0 0 50 -1 0 14 0.0000 4 165 690 7965 4545 VOUT\001 4 0 0 50 -1 0 14 0.0000 4 165 495 7965 4995 BLK\001 4 0 0 50 -1 0 14 0.0000 4 165 495 7965 4770 BLA\001 4 1 0 50 -1 0 18 1.5708 4 255 2835 8865 2475 ST7920 Graphic Display\001 -6 6 2655 630 2745 720 1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 2700 675 20 20 2700 675 2720 675 -6 6 2205 855 2295 945 1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 2250 900 20 20 2250 900 2270 900 -6 6 2925 450 4500 5175 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 675 3375 675 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 900 3375 900 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 1125 3375 1125 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 1350 3375 1350 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 1575 3375 1575 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 1800 3375 1800 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 2025 3375 2025 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 2250 3375 2250 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 2475 3375 2475 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 2700 3375 2700 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 2925 3375 2925 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 3150 3375 3150 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 3375 3375 3375 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 3600 3375 3600 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 3825 3375 3825 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 4050 3375 4050 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 4275 3375 4275 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 4500 3375 4500 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 4725 3375 4725 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 4950 3375 4950 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 3375 450 4500 450 4500 5175 3375 5175 3375 450 4 0 0 50 -1 0 12 0.0000 4 135 105 3150 630 1\001 4 0 0 50 -1 0 12 0.0000 4 135 105 3150 855 2\001 4 0 0 50 -1 0 12 0.0000 4 135 105 3150 1080 3\001 4 0 0 50 -1 0 12 0.0000 4 135 105 3150 1305 4\001 4 0 0 50 -1 0 12 0.0000 4 135 105 3150 1530 5\001 4 0 0 50 -1 0 12 0.0000 4 135 105 3150 1755 6\001 4 0 0 50 -1 0 12 0.0000 4 135 105 3150 1980 7\001 4 0 0 50 -1 0 12 0.0000 4 135 105 3150 2205 8\001 4 0 0 50 -1 0 12 0.0000 4 135 105 3150 2430 9\001 4 0 0 50 -1 0 14 0.0000 4 165 450 3465 720 VSS\001 4 0 0 50 -1 0 14 0.0000 4 165 465 3465 2970 DB4\001 4 0 0 50 -1 0 14 0.0000 4 165 465 3465 3195 DB5\001 4 0 0 50 -1 0 14 0.0000 4 165 465 3465 3645 DB7\001 4 0 0 50 -1 0 14 0.0000 4 165 465 3465 3420 DB6\001 4 0 0 50 -1 0 14 0.0000 4 165 465 3465 2070 DB0\001 4 0 0 50 -1 0 14 0.0000 4 165 465 3465 2295 DB1\001 4 0 0 50 -1 0 14 0.0000 4 165 450 3465 2520 BB2\001 4 0 0 50 -1 0 14 0.0000 4 165 465 3465 2745 DB3\001 4 0 0 50 -1 0 14 0.0000 4 165 540 3465 945 VDD\001 4 0 0 50 -1 0 14 0.0000 4 165 360 3465 1170 VO\001 4 0 0 50 -1 0 14 0.0000 4 165 300 3465 1395 RS\001 4 0 0 50 -1 0 14 0.0000 4 165 450 3465 1620 R/W\001 4 0 0 50 -1 0 14 0.0000 4 165 150 3465 1845 E\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 2655 10\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 2880 11\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 3105 12\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 3330 13\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 3555 14\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 3780 15\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 4005 16\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 4230 17\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 4455 18\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 4680 19\001 4 0 0 50 -1 0 12 0.0000 4 135 210 3150 4905 20\001 4 0 0 50 -1 0 12 0.0000 4 135 270 3465 4095 NC\001 4 0 0 50 -1 0 14 0.0000 4 165 435 3465 3870 PSB\001 4 0 0 50 -1 0 14 0.0000 4 165 450 3465 4320 RST\001 4 0 0 50 -1 0 14 0.0000 4 165 690 3465 4545 VOUT\001 4 0 0 50 -1 0 14 0.0000 4 165 495 3465 4995 BLK\001 4 0 0 50 -1 0 14 0.0000 4 165 495 3465 4770 BLA\001 4 1 0 50 -1 0 18 1.5708 4 255 2835 4365 2475 ST7920 Graphic Display\001 -6 6 1080 4680 1530 4770 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 1440 4725 1530 4725 2 2 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 5 1170 4770 1170 4680 1440 4680 1440 4770 1170 4770 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 1080 4725 1170 4725 -6 6 1575 630 1890 720 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 1575 630 1620 675 1575 720 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 1620 675 1890 675 -6 6 1575 855 1890 945 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 1575 855 1620 900 1575 945 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 1620 900 1890 900 -6 6 1575 1080 1890 1170 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 1575 1080 1620 1125 1575 1170 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 1620 1125 1890 1125 -6 6 1575 1530 1890 1620 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 1575 1530 1620 1575 1575 1620 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 1620 1575 1890 1575 -6 6 1575 1755 1890 1845 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 1575 1755 1620 1800 1575 1845 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 1620 1800 1890 1800 -6 6 1575 4680 1890 4770 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 1575 4680 1620 4725 1575 4770 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 1620 4725 1890 4725 -6 6 1170 5175 1440 5490 2 1 0 3 0 -1 0 0 -1 0.000 0 1 -1 0 0 2 1215 5445 1395 5445 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 1305 5175 1305 5445 -6 6 1575 4905 1890 4995 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 1575 4905 1620 4950 1575 4995 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 1620 4950 1890 4950 -6 6 2205 1305 2295 1395 1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 2250 1350 20 20 2250 1350 2270 1350 -6 6 6075 1080 6390 1170 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 1080 6120 1125 6075 1170 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 1125 6390 1125 -6 6 6075 855 6390 945 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 855 6120 900 6075 945 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 900 6390 900 -6 6 6075 630 6390 720 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 630 6120 675 6075 720 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 675 6390 675 -6 6 6075 4680 6390 4770 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 4680 6120 4725 6075 4770 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 4725 6390 4725 -6 6 6075 4905 6390 4995 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 4905 6120 4950 6075 4995 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 4950 6390 4950 -6 6 6705 855 6795 945 1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6750 900 20 20 6750 900 6770 900 -6 6 6705 3780 6795 3870 1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 6750 3825 20 20 6750 3825 6770 3825 -6 6 6075 2880 6390 2970 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 2880 6120 2925 6075 2970 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 2925 6390 2925 -6 6 6075 3105 6390 3195 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 3105 6120 3150 6075 3195 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 3150 6390 3150 -6 6 6075 3330 6390 3420 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 3330 6120 3375 6075 3420 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 3375 6390 3375 -6 6 6075 3555 6390 3645 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 3555 6120 3600 6075 3645 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 3600 6390 3600 -6 6 6075 1305 6390 1395 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 1305 6120 1350 6075 1395 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 1350 6390 1350 -6 6 6075 1755 6390 1845 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 1755 6120 1800 6075 1845 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 1800 6390 1800 -6 6 6075 1530 6390 1620 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 3 6075 1530 6120 1575 6075 1620 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 6120 1575 6390 1575 -6 6 5580 4680 6030 4770 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 5940 4725 6030 4725 2 2 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 5 5670 4770 5670 4680 5940 4680 5940 4770 5670 4770 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 5580 4725 5670 4725 -6 6 5715 5175 5985 5490 2 1 0 3 0 -1 0 0 -1 0.000 0 1 -1 0 0 2 5760 5445 5940 5445 2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 5850 5175 5850 5445 -6 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 1800 1890 1800 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 1575 1890 1575 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 2925 1350 2250 1350 2250 900 2925 900 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 3825 2700 3825 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 1890 675 2700 675 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 675 2700 675 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2700 675 2700 3825 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2250 900 1890 900 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 4725 1890 4725 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 1125 1890 1125 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 1305 5175 1305 4950 1530 4950 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 2925 4950 1890 4950 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 2250 1350 2250 4275 2925 4275 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 1125 6390 1125 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 900 6390 900 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 675 6390 675 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 4950 6390 4950 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 4725 6390 4725 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 6750 3825 7425 3825 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 6750 900 6750 4275 7425 4275 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 1350 6390 1350 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 1800 6390 1800 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 2925 6390 2925 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 3150 6390 3150 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 3375 6390 3375 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 3600 6390 3600 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 7425 1575 6390 1575 2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 5850 5175 5850 4950 6075 4950 2 1 1 1 0 7 50 -1 -1 4.000 0 0 -1 0 0 2 4815 315 4815 6075 4 2 0 50 -1 0 14 0.0000 4 165 435 1530 1665 PD2\001 4 2 0 50 -1 0 14 0.0000 4 165 435 1530 1950 PD5\001 4 2 0 50 -1 0 14 0.0000 4 165 540 1530 765 GND\001 4 2 0 50 -1 0 14 0.0000 4 165 510 1530 990 VCC\001 4 2 0 50 -1 0 14 0.0000 4 165 510 990 4815 VCC\001 4 2 0 50 -1 0 12 0.0000 4 135 375 1530 1215 VEE\001 4 2 0 50 -1 0 12 0.0000 4 135 375 6030 1215 VEE\001 4 2 0 50 -1 0 14 0.0000 4 165 540 6030 765 GND\001 4 2 0 50 -1 0 14 0.0000 4 165 510 5985 990 VCC\001 4 2 0 50 -1 0 14 0.0000 4 165 435 6030 3015 PD0\001 4 2 0 50 -1 0 14 0.0000 4 165 435 6030 3465 PD2\001 4 2 0 50 -1 0 14 0.0000 4 165 435 6030 3690 PD3\001 4 2 0 50 -1 0 14 0.0000 4 165 435 6030 3240 PD1\001 4 2 0 50 -1 0 14 0.0000 4 165 540 6030 1665 GND\001 4 2 0 50 -1 0 14 0.0000 4 165 435 6030 1440 PD4\001 4 2 0 50 -1 0 14 0.0000 4 165 435 6030 1890 PD5\001 4 2 0 50 -1 0 14 0.0000 4 165 510 5535 4815 VCC\001 4 1 0 50 -1 0 14 0.0000 4 165 1095 2205 6120 serial mode\001 4 1 0 50 -1 0 14 0.0000 4 210 1785 7335 6030 4-bit parallel mode\001
{ "pile_set_name": "Github" }
% Test file for @chebtech/sample.m function pass = test_sample(pref) % Get preferences. if ( nargin < 1 ) pref = chebtech.techPref(); end for n = 1:2 if ( n == 1 ) testclass = chebtech1(); else testclass = chebtech2(); end f = testclass.make(@(x) sin(x - 0.1)); % Test on a grid equal to length(f). [v, p] = sample(f); p_ex = testclass.chebpts(length(f)); v_ex = feval(f, p_ex); pass(n, 1) = (norm(p - p_ex) < 100*eps) && (norm(v - v_ex) < 100*eps); % Test on a grid shorter than length(f). m = round(length(f)/2); [v, p] = sample(f, m); p_ex = testclass.chebpts(m); v_ex = feval(f, p_ex); pass(n, 2) = (norm(p - p_ex) < 100*eps) && (norm(v - v_ex) < 100*eps); % Test on a grid longer than length(f). m = round(2*length(f)); [v, p] = sample(f, m); p_ex = testclass.chebpts(m); v_ex = feval(f, p_ex); pass(n, 3) = (norm(p - p_ex) < 100*eps) && (norm(v - v_ex) < 100*eps); end end
{ "pile_set_name": "Github" }
package gw.util.science uses gw.util.Rational uses java.math.RoundingMode uses java.math.MathContext final class Volume extends AbstractMeasure<VolumeUnit, Volume> { construct( value : Rational, unit: VolumeUnit, displayUnit: VolumeUnit ) { super( value, unit, displayUnit, VolumeUnit.BASE ) } construct( value : Rational, unit: VolumeUnit ) { this( value, unit, unit ) } function divide( t: Length ) : Area { return new Area( toBaseNumber() / t.toBaseNumber(), AreaUnit.BASE, AreaUnit.get( t.Unit ) ) } function divide( area: Area ) : Length { return new Length( toBaseNumber() / area.toBaseNumber(), LengthUnit.BASE, area.Unit.WidthUnit ) } function multiply( density: Density ) : Mass { return new Mass( toBaseNumber() * density.toBaseNumber(), MassUnit.BASE, density.Unit.MassUnit ) } }
{ "pile_set_name": "Github" }
/* * Copyright (c) 2019 [email protected] * * 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. */ // https://developer.android.com/training/basics/network-ops/xml package com.m2049r.xmrwallet.service.exchange.krakenEcb; import android.support.annotation.NonNull; import com.m2049r.xmrwallet.service.exchange.api.ExchangeApi; import com.m2049r.xmrwallet.service.exchange.api.ExchangeCallback; import com.m2049r.xmrwallet.service.exchange.api.ExchangeRate; import com.m2049r.xmrwallet.util.Helper; import okhttp3.OkHttpClient; import timber.log.Timber; /* Gets the XMR/EUR rate from kraken and then gets the EUR/fiat rate from the ECB */ public class ExchangeApiImpl implements ExchangeApi { static public final String BASE_FIAT = "EUR"; @NonNull private final OkHttpClient okHttpClient; public ExchangeApiImpl(@NonNull final OkHttpClient okHttpClient) { this.okHttpClient = okHttpClient; } @Override public void queryExchangeRate(@NonNull final String baseCurrency, @NonNull final String quoteCurrency, @NonNull final ExchangeCallback callback) { Timber.d("B=%s Q=%s", baseCurrency, quoteCurrency); if (baseCurrency.equals(quoteCurrency)) { Timber.d("BASE=QUOTE=1"); callback.onSuccess(new ExchangeRateImpl(baseCurrency, quoteCurrency, 1.0)); return; } if (!Helper.BASE_CRYPTO.equals(baseCurrency) && !Helper.BASE_CRYPTO.equals(quoteCurrency)) { callback.onError(new IllegalArgumentException("no " + Helper.BASE_CRYPTO + " specified")); return; } final String quote = Helper.BASE_CRYPTO.equals(baseCurrency) ? quoteCurrency : baseCurrency; final ExchangeApi krakenApi = new com.m2049r.xmrwallet.service.exchange.kraken.ExchangeApiImpl(okHttpClient); krakenApi.queryExchangeRate(Helper.BASE_CRYPTO, BASE_FIAT, new ExchangeCallback() { @Override public void onSuccess(final ExchangeRate krakenRate) { Timber.d("kraken = %f", krakenRate.getRate()); final ExchangeApi ecbApi = new com.m2049r.xmrwallet.service.exchange.ecb.ExchangeApiImpl(okHttpClient); ecbApi.queryExchangeRate(BASE_FIAT, quote, new ExchangeCallback() { @Override public void onSuccess(final ExchangeRate ecbRate) { Timber.d("ECB = %f", ecbRate.getRate()); double rate = ecbRate.getRate() * krakenRate.getRate(); Timber.d("Q=%s QC=%s", quote, quoteCurrency); if (!quote.equals(quoteCurrency)) rate = 1.0d / rate; Timber.d("rate = %f", rate); final ExchangeRate exchangeRate = new ExchangeRateImpl(baseCurrency, quoteCurrency, rate); callback.onSuccess(exchangeRate); } @Override public void onError(Exception ex) { Timber.d(ex); callback.onError(ex); } }); } @Override public void onError(Exception ex) { Timber.d(ex); callback.onError(ex); } }); } }
{ "pile_set_name": "Github" }
'use strict'; var Type = require('./Type'); // https://www.ecma-international.org/ecma-262/5.1/#sec-11.9.6 module.exports = function StrictEqualityComparison(x, y) { var xType = Type(x); var yType = Type(y); if (xType !== yType) { return false; } if (xType === 'Undefined' || xType === 'Null') { return true; } return x === y; // shortcut for steps 4-7 };
{ "pile_set_name": "Github" }
enum color { red, white, blue }; record R { var c: color; } var c: [0..1] R; c[0].c = color.red; c[1].c = color.blue; proc foo(x: int(64), y: int(64)) { writeln("In 64-bit foo!"); return false; } proc foo(x: color, y: color) { writeln("In enum foo!"); return true; } if (foo(c[0].c, color.white)) { writeln("Got correct version!"); }
{ "pile_set_name": "Github" }
package networkapi // Copyright (c) Microsoft and contributors. 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. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( "context" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network" ) // BaseClientAPI contains the set of methods on the BaseClient type. type BaseClientAPI interface { CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result network.DNSNameAvailabilityResult, err error) } var _ BaseClientAPI = (*network.BaseClient)(nil) // ApplicationGatewaysClientAPI contains the set of methods on the ApplicationGatewaysClient type. type ApplicationGatewaysClientAPI interface { BackendHealth(ctx context.Context, resourceGroupName string, applicationGatewayName string, expand string) (result network.ApplicationGatewaysBackendHealthFuture, err error) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters network.ApplicationGateway) (result network.ApplicationGatewaysCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewaysDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGateway, err error) GetSslPredefinedPolicy(ctx context.Context, predefinedPolicyName string) (result network.ApplicationGatewaySslPredefinedPolicy, err error) List(ctx context.Context, resourceGroupName string) (result network.ApplicationGatewayListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.ApplicationGatewayListResultIterator, err error) ListAll(ctx context.Context) (result network.ApplicationGatewayListResultPage, err error) ListAllComplete(ctx context.Context) (result network.ApplicationGatewayListResultIterator, err error) ListAvailableSslOptions(ctx context.Context) (result network.ApplicationGatewayAvailableSslOptions, err error) ListAvailableSslPredefinedPolicies(ctx context.Context) (result network.ApplicationGatewayAvailableSslPredefinedPoliciesPage, err error) ListAvailableSslPredefinedPoliciesComplete(ctx context.Context) (result network.ApplicationGatewayAvailableSslPredefinedPoliciesIterator, err error) ListAvailableWafRuleSets(ctx context.Context) (result network.ApplicationGatewayAvailableWafRuleSetsResult, err error) Start(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewaysStartFuture, err error) Stop(ctx context.Context, resourceGroupName string, applicationGatewayName string) (result network.ApplicationGatewaysStopFuture, err error) UpdateTags(ctx context.Context, resourceGroupName string, applicationGatewayName string, parameters network.TagsObject) (result network.ApplicationGatewaysUpdateTagsFuture, err error) } var _ ApplicationGatewaysClientAPI = (*network.ApplicationGatewaysClient)(nil) // ApplicationSecurityGroupsClientAPI contains the set of methods on the ApplicationSecurityGroupsClient type. type ApplicationSecurityGroupsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters network.ApplicationSecurityGroup) (result network.ApplicationSecurityGroupsCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result network.ApplicationSecurityGroupsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result network.ApplicationSecurityGroup, err error) List(ctx context.Context, resourceGroupName string) (result network.ApplicationSecurityGroupListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.ApplicationSecurityGroupListResultIterator, err error) ListAll(ctx context.Context) (result network.ApplicationSecurityGroupListResultPage, err error) ListAllComplete(ctx context.Context) (result network.ApplicationSecurityGroupListResultIterator, err error) } var _ ApplicationSecurityGroupsClientAPI = (*network.ApplicationSecurityGroupsClient)(nil) // AvailableEndpointServicesClientAPI contains the set of methods on the AvailableEndpointServicesClient type. type AvailableEndpointServicesClientAPI interface { List(ctx context.Context, location string) (result network.EndpointServicesListResultPage, err error) ListComplete(ctx context.Context, location string) (result network.EndpointServicesListResultIterator, err error) } var _ AvailableEndpointServicesClientAPI = (*network.AvailableEndpointServicesClient)(nil) // ExpressRouteCircuitAuthorizationsClientAPI contains the set of methods on the ExpressRouteCircuitAuthorizationsClient type. type ExpressRouteCircuitAuthorizationsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters network.ExpressRouteCircuitAuthorization) (result network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result network.ExpressRouteCircuitAuthorizationsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result network.ExpressRouteCircuitAuthorization, err error) List(ctx context.Context, resourceGroupName string, circuitName string) (result network.AuthorizationListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, circuitName string) (result network.AuthorizationListResultIterator, err error) } var _ ExpressRouteCircuitAuthorizationsClientAPI = (*network.ExpressRouteCircuitAuthorizationsClient)(nil) // ExpressRouteCircuitPeeringsClientAPI contains the set of methods on the ExpressRouteCircuitPeeringsClient type. type ExpressRouteCircuitPeeringsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters network.ExpressRouteCircuitPeering) (result network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result network.ExpressRouteCircuitPeeringsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result network.ExpressRouteCircuitPeering, err error) List(ctx context.Context, resourceGroupName string, circuitName string) (result network.ExpressRouteCircuitPeeringListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, circuitName string) (result network.ExpressRouteCircuitPeeringListResultIterator, err error) } var _ ExpressRouteCircuitPeeringsClientAPI = (*network.ExpressRouteCircuitPeeringsClient)(nil) // ExpressRouteCircuitsClientAPI contains the set of methods on the ExpressRouteCircuitsClient type. type ExpressRouteCircuitsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters network.ExpressRouteCircuit) (result network.ExpressRouteCircuitsCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, circuitName string) (result network.ExpressRouteCircuitsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, circuitName string) (result network.ExpressRouteCircuit, err error) GetPeeringStats(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result network.ExpressRouteCircuitStats, err error) GetStats(ctx context.Context, resourceGroupName string, circuitName string) (result network.ExpressRouteCircuitStats, err error) List(ctx context.Context, resourceGroupName string) (result network.ExpressRouteCircuitListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.ExpressRouteCircuitListResultIterator, err error) ListAll(ctx context.Context) (result network.ExpressRouteCircuitListResultPage, err error) ListAllComplete(ctx context.Context) (result network.ExpressRouteCircuitListResultIterator, err error) ListArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result network.ExpressRouteCircuitsListArpTableFuture, err error) ListRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result network.ExpressRouteCircuitsListRoutesTableFuture, err error) ListRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result network.ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) UpdateTags(ctx context.Context, resourceGroupName string, circuitName string, parameters network.TagsObject) (result network.ExpressRouteCircuitsUpdateTagsFuture, err error) } var _ ExpressRouteCircuitsClientAPI = (*network.ExpressRouteCircuitsClient)(nil) // ExpressRouteServiceProvidersClientAPI contains the set of methods on the ExpressRouteServiceProvidersClient type. type ExpressRouteServiceProvidersClientAPI interface { List(ctx context.Context) (result network.ExpressRouteServiceProviderListResultPage, err error) ListComplete(ctx context.Context) (result network.ExpressRouteServiceProviderListResultIterator, err error) } var _ ExpressRouteServiceProvidersClientAPI = (*network.ExpressRouteServiceProvidersClient)(nil) // LoadBalancersClientAPI contains the set of methods on the LoadBalancersClient type. type LoadBalancersClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters network.LoadBalancer) (result network.LoadBalancersCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancersDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (result network.LoadBalancer, err error) List(ctx context.Context, resourceGroupName string) (result network.LoadBalancerListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.LoadBalancerListResultIterator, err error) ListAll(ctx context.Context) (result network.LoadBalancerListResultPage, err error) ListAllComplete(ctx context.Context) (result network.LoadBalancerListResultIterator, err error) UpdateTags(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters network.TagsObject) (result network.LoadBalancersUpdateTagsFuture, err error) } var _ LoadBalancersClientAPI = (*network.LoadBalancersClient)(nil) // LoadBalancerBackendAddressPoolsClientAPI contains the set of methods on the LoadBalancerBackendAddressPoolsClient type. type LoadBalancerBackendAddressPoolsClientAPI interface { Get(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (result network.BackendAddressPool, err error) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerBackendAddressPoolListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerBackendAddressPoolListResultIterator, err error) } var _ LoadBalancerBackendAddressPoolsClientAPI = (*network.LoadBalancerBackendAddressPoolsClient)(nil) // LoadBalancerFrontendIPConfigurationsClientAPI contains the set of methods on the LoadBalancerFrontendIPConfigurationsClient type. type LoadBalancerFrontendIPConfigurationsClientAPI interface { Get(ctx context.Context, resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string) (result network.FrontendIPConfiguration, err error) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerFrontendIPConfigurationListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerFrontendIPConfigurationListResultIterator, err error) } var _ LoadBalancerFrontendIPConfigurationsClientAPI = (*network.LoadBalancerFrontendIPConfigurationsClient)(nil) // InboundNatRulesClientAPI contains the set of methods on the InboundNatRulesClient type. type InboundNatRulesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters network.InboundNatRule) (result network.InboundNatRulesCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string) (result network.InboundNatRulesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (result network.InboundNatRule, err error) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.InboundNatRuleListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.InboundNatRuleListResultIterator, err error) } var _ InboundNatRulesClientAPI = (*network.InboundNatRulesClient)(nil) // LoadBalancerLoadBalancingRulesClientAPI contains the set of methods on the LoadBalancerLoadBalancingRulesClient type. type LoadBalancerLoadBalancingRulesClientAPI interface { Get(ctx context.Context, resourceGroupName string, loadBalancerName string, loadBalancingRuleName string) (result network.LoadBalancingRule, err error) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerLoadBalancingRuleListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerLoadBalancingRuleListResultIterator, err error) } var _ LoadBalancerLoadBalancingRulesClientAPI = (*network.LoadBalancerLoadBalancingRulesClient)(nil) // LoadBalancerNetworkInterfacesClientAPI contains the set of methods on the LoadBalancerNetworkInterfacesClient type. type LoadBalancerNetworkInterfacesClientAPI interface { List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.InterfaceListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.InterfaceListResultIterator, err error) } var _ LoadBalancerNetworkInterfacesClientAPI = (*network.LoadBalancerNetworkInterfacesClient)(nil) // LoadBalancerProbesClientAPI contains the set of methods on the LoadBalancerProbesClient type. type LoadBalancerProbesClientAPI interface { Get(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string) (result network.Probe, err error) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerProbeListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result network.LoadBalancerProbeListResultIterator, err error) } var _ LoadBalancerProbesClientAPI = (*network.LoadBalancerProbesClient)(nil) // InterfacesClientAPI contains the set of methods on the InterfacesClient type. type InterfacesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters network.Interface) (result network.InterfacesCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfacesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, expand string) (result network.Interface, err error) GetEffectiveRouteTable(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfacesGetEffectiveRouteTableFuture, err error) GetVirtualMachineScaleSetIPConfiguration(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, expand string) (result network.InterfaceIPConfiguration, err error) GetVirtualMachineScaleSetNetworkInterface(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result network.Interface, err error) List(ctx context.Context, resourceGroupName string) (result network.InterfaceListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.InterfaceListResultIterator, err error) ListAll(ctx context.Context) (result network.InterfaceListResultPage, err error) ListAllComplete(ctx context.Context) (result network.InterfaceListResultIterator, err error) ListEffectiveNetworkSecurityGroups(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfacesListEffectiveNetworkSecurityGroupsFuture, err error) ListVirtualMachineScaleSetIPConfigurations(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result network.InterfaceIPConfigurationListResultPage, err error) ListVirtualMachineScaleSetIPConfigurationsComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (result network.InterfaceIPConfigurationListResultIterator, err error) ListVirtualMachineScaleSetNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result network.InterfaceListResultPage, err error) ListVirtualMachineScaleSetNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result network.InterfaceListResultIterator, err error) ListVirtualMachineScaleSetVMNetworkInterfaces(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result network.InterfaceListResultPage, err error) ListVirtualMachineScaleSetVMNetworkInterfacesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (result network.InterfaceListResultIterator, err error) UpdateTags(ctx context.Context, resourceGroupName string, networkInterfaceName string, parameters network.TagsObject) (result network.InterfacesUpdateTagsFuture, err error) } var _ InterfacesClientAPI = (*network.InterfacesClient)(nil) // InterfaceIPConfigurationsClientAPI contains the set of methods on the InterfaceIPConfigurationsClient type. type InterfaceIPConfigurationsClientAPI interface { Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (result network.InterfaceIPConfiguration, err error) List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfaceIPConfigurationListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfaceIPConfigurationListResultIterator, err error) } var _ InterfaceIPConfigurationsClientAPI = (*network.InterfaceIPConfigurationsClient)(nil) // InterfaceLoadBalancersClientAPI contains the set of methods on the InterfaceLoadBalancersClient type. type InterfaceLoadBalancersClientAPI interface { List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfaceLoadBalancerListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result network.InterfaceLoadBalancerListResultIterator, err error) } var _ InterfaceLoadBalancersClientAPI = (*network.InterfaceLoadBalancersClient)(nil) // SecurityGroupsClientAPI contains the set of methods on the SecurityGroupsClient type. type SecurityGroupsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters network.SecurityGroup) (result network.SecurityGroupsCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result network.SecurityGroupsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (result network.SecurityGroup, err error) List(ctx context.Context, resourceGroupName string) (result network.SecurityGroupListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.SecurityGroupListResultIterator, err error) ListAll(ctx context.Context) (result network.SecurityGroupListResultPage, err error) ListAllComplete(ctx context.Context) (result network.SecurityGroupListResultIterator, err error) UpdateTags(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters network.TagsObject) (result network.SecurityGroupsUpdateTagsFuture, err error) } var _ SecurityGroupsClientAPI = (*network.SecurityGroupsClient)(nil) // SecurityRulesClientAPI contains the set of methods on the SecurityRulesClient type. type SecurityRulesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters network.SecurityRule) (result network.SecurityRulesCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result network.SecurityRulesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result network.SecurityRule, err error) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result network.SecurityRuleListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result network.SecurityRuleListResultIterator, err error) } var _ SecurityRulesClientAPI = (*network.SecurityRulesClient)(nil) // DefaultSecurityRulesClientAPI contains the set of methods on the DefaultSecurityRulesClient type. type DefaultSecurityRulesClientAPI interface { Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (result network.SecurityRule, err error) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result network.SecurityRuleListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result network.SecurityRuleListResultIterator, err error) } var _ DefaultSecurityRulesClientAPI = (*network.DefaultSecurityRulesClient)(nil) // WatchersClientAPI contains the set of methods on the WatchersClient type. type WatchersClientAPI interface { CheckConnectivity(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.ConnectivityParameters) (result network.WatchersCheckConnectivityFuture, err error) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.Watcher) (result network.Watcher, err error) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string) (result network.WatchersDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, networkWatcherName string) (result network.Watcher, err error) GetAzureReachabilityReport(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.AzureReachabilityReportParameters) (result network.WatchersGetAzureReachabilityReportFuture, err error) GetFlowLogStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.FlowLogStatusParameters) (result network.WatchersGetFlowLogStatusFuture, err error) GetNextHop(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.NextHopParameters) (result network.WatchersGetNextHopFuture, err error) GetTopology(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.TopologyParameters) (result network.Topology, err error) GetTroubleshooting(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.TroubleshootingParameters) (result network.WatchersGetTroubleshootingFuture, err error) GetTroubleshootingResult(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.QueryTroubleshootingParameters) (result network.WatchersGetTroubleshootingResultFuture, err error) GetVMSecurityRules(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.SecurityGroupViewParameters) (result network.WatchersGetVMSecurityRulesFuture, err error) List(ctx context.Context, resourceGroupName string) (result network.WatcherListResult, err error) ListAll(ctx context.Context) (result network.WatcherListResult, err error) ListAvailableProviders(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.AvailableProvidersListParameters) (result network.WatchersListAvailableProvidersFuture, err error) SetFlowLogConfiguration(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.FlowLogInformation) (result network.WatchersSetFlowLogConfigurationFuture, err error) UpdateTags(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.TagsObject) (result network.Watcher, err error) VerifyIPFlow(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters network.VerificationIPFlowParameters) (result network.WatchersVerifyIPFlowFuture, err error) } var _ WatchersClientAPI = (*network.WatchersClient)(nil) // PacketCapturesClientAPI contains the set of methods on the PacketCapturesClient type. type PacketCapturesClientAPI interface { Create(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters network.PacketCapture) (result network.PacketCapturesCreateFuture, err error) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result network.PacketCapturesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result network.PacketCaptureResult, err error) GetStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result network.PacketCapturesGetStatusFuture, err error) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result network.PacketCaptureListResult, err error) Stop(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result network.PacketCapturesStopFuture, err error) } var _ PacketCapturesClientAPI = (*network.PacketCapturesClient)(nil) // OperationsClientAPI contains the set of methods on the OperationsClient type. type OperationsClientAPI interface { List(ctx context.Context) (result network.OperationListResultPage, err error) ListComplete(ctx context.Context) (result network.OperationListResultIterator, err error) } var _ OperationsClientAPI = (*network.OperationsClient)(nil) // PublicIPAddressesClientAPI contains the set of methods on the PublicIPAddressesClient type. type PublicIPAddressesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters network.PublicIPAddress) (result network.PublicIPAddressesCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, publicIPAddressName string) (result network.PublicIPAddressesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, err error) GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, err error) List(ctx context.Context, resourceGroupName string) (result network.PublicIPAddressListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.PublicIPAddressListResultIterator, err error) ListAll(ctx context.Context) (result network.PublicIPAddressListResultPage, err error) ListAllComplete(ctx context.Context) (result network.PublicIPAddressListResultIterator, err error) ListVirtualMachineScaleSetPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result network.PublicIPAddressListResultPage, err error) ListVirtualMachineScaleSetPublicIPAddressesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result network.PublicIPAddressListResultIterator, err error) ListVirtualMachineScaleSetVMPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result network.PublicIPAddressListResultPage, err error) ListVirtualMachineScaleSetVMPublicIPAddressesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result network.PublicIPAddressListResultIterator, err error) UpdateTags(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters network.TagsObject) (result network.PublicIPAddressesUpdateTagsFuture, err error) } var _ PublicIPAddressesClientAPI = (*network.PublicIPAddressesClient)(nil) // RouteFiltersClientAPI contains the set of methods on the RouteFiltersClient type. type RouteFiltersClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters network.RouteFilter) (result network.RouteFiltersCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, routeFilterName string) (result network.RouteFiltersDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, routeFilterName string, expand string) (result network.RouteFilter, err error) List(ctx context.Context) (result network.RouteFilterListResultPage, err error) ListComplete(ctx context.Context) (result network.RouteFilterListResultIterator, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result network.RouteFilterListResultPage, err error) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result network.RouteFilterListResultIterator, err error) Update(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters network.PatchRouteFilter) (result network.RouteFiltersUpdateFuture, err error) } var _ RouteFiltersClientAPI = (*network.RouteFiltersClient)(nil) // RouteFilterRulesClientAPI contains the set of methods on the RouteFilterRulesClient type. type RouteFilterRulesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters network.RouteFilterRule) (result network.RouteFilterRulesCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result network.RouteFilterRulesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result network.RouteFilterRule, err error) ListByRouteFilter(ctx context.Context, resourceGroupName string, routeFilterName string) (result network.RouteFilterRuleListResultPage, err error) ListByRouteFilterComplete(ctx context.Context, resourceGroupName string, routeFilterName string) (result network.RouteFilterRuleListResultIterator, err error) Update(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters network.PatchRouteFilterRule) (result network.RouteFilterRulesUpdateFuture, err error) } var _ RouteFilterRulesClientAPI = (*network.RouteFilterRulesClient)(nil) // RouteTablesClientAPI contains the set of methods on the RouteTablesClient type. type RouteTablesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters network.RouteTable) (result network.RouteTablesCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, routeTableName string) (result network.RouteTablesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (result network.RouteTable, err error) List(ctx context.Context, resourceGroupName string) (result network.RouteTableListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.RouteTableListResultIterator, err error) ListAll(ctx context.Context) (result network.RouteTableListResultPage, err error) ListAllComplete(ctx context.Context) (result network.RouteTableListResultIterator, err error) UpdateTags(ctx context.Context, resourceGroupName string, routeTableName string, parameters network.TagsObject) (result network.RouteTablesUpdateTagsFuture, err error) } var _ RouteTablesClientAPI = (*network.RouteTablesClient)(nil) // RoutesClientAPI contains the set of methods on the RoutesClient type. type RoutesClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters network.Route) (result network.RoutesCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result network.RoutesDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result network.Route, err error) List(ctx context.Context, resourceGroupName string, routeTableName string) (result network.RouteListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, routeTableName string) (result network.RouteListResultIterator, err error) } var _ RoutesClientAPI = (*network.RoutesClient)(nil) // BgpServiceCommunitiesClientAPI contains the set of methods on the BgpServiceCommunitiesClient type. type BgpServiceCommunitiesClientAPI interface { List(ctx context.Context) (result network.BgpServiceCommunityListResultPage, err error) ListComplete(ctx context.Context) (result network.BgpServiceCommunityListResultIterator, err error) } var _ BgpServiceCommunitiesClientAPI = (*network.BgpServiceCommunitiesClient)(nil) // UsagesClientAPI contains the set of methods on the UsagesClient type. type UsagesClientAPI interface { List(ctx context.Context, location string) (result network.UsagesListResultPage, err error) ListComplete(ctx context.Context, location string) (result network.UsagesListResultIterator, err error) } var _ UsagesClientAPI = (*network.UsagesClient)(nil) // VirtualNetworksClientAPI contains the set of methods on the VirtualNetworksClient type. type VirtualNetworksClientAPI interface { CheckIPAddressAvailability(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (result network.IPAddressAvailabilityResult, err error) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters network.VirtualNetwork) (result network.VirtualNetworksCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.VirtualNetworksDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (result network.VirtualNetwork, err error) List(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkListResultIterator, err error) ListAll(ctx context.Context) (result network.VirtualNetworkListResultPage, err error) ListAllComplete(ctx context.Context) (result network.VirtualNetworkListResultIterator, err error) ListUsage(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.VirtualNetworkListUsageResultPage, err error) ListUsageComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.VirtualNetworkListUsageResultIterator, err error) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters network.TagsObject) (result network.VirtualNetworksUpdateTagsFuture, err error) } var _ VirtualNetworksClientAPI = (*network.VirtualNetworksClient)(nil) // SubnetsClientAPI contains the set of methods on the SubnetsClient type. type SubnetsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters network.Subnet) (result network.SubnetsCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (result network.SubnetsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result network.Subnet, err error) List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.SubnetListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.SubnetListResultIterator, err error) } var _ SubnetsClientAPI = (*network.SubnetsClient)(nil) // VirtualNetworkPeeringsClientAPI contains the set of methods on the VirtualNetworkPeeringsClient type. type VirtualNetworkPeeringsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters network.VirtualNetworkPeering) (result network.VirtualNetworkPeeringsCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result network.VirtualNetworkPeeringsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result network.VirtualNetworkPeering, err error) List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.VirtualNetworkPeeringListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result network.VirtualNetworkPeeringListResultIterator, err error) } var _ VirtualNetworkPeeringsClientAPI = (*network.VirtualNetworkPeeringsClient)(nil) // VirtualNetworkGatewaysClientAPI contains the set of methods on the VirtualNetworkGatewaysClient type. type VirtualNetworkGatewaysClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters network.VirtualNetworkGateway) (result network.VirtualNetworkGatewaysCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewaysDeleteFuture, err error) Generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters network.VpnClientParameters) (result network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) GenerateVpnProfile(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters network.VpnClientParameters) (result network.VirtualNetworkGatewaysGenerateVpnProfileFuture, err error) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGateway, err error) GetAdvertisedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture, err error) GetBgpPeerStatus(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, peer string) (result network.VirtualNetworkGatewaysGetBgpPeerStatusFuture, err error) GetLearnedRoutes(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewaysGetLearnedRoutesFuture, err error) GetVpnProfilePackageURL(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewaysGetVpnProfilePackageURLFuture, err error) List(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkGatewayListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkGatewayListResultIterator, err error) ListConnections(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewayListConnectionsResultPage, err error) ListConnectionsComplete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.VirtualNetworkGatewayListConnectionsResultIterator, err error) Reset(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, gatewayVip string) (result network.VirtualNetworkGatewaysResetFuture, err error) SupportedVpnDevices(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string) (result network.String, err error) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters network.TagsObject) (result network.VirtualNetworkGatewaysUpdateTagsFuture, err error) VpnDeviceConfigurationScript(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.VpnDeviceScriptParameters) (result network.String, err error) } var _ VirtualNetworkGatewaysClientAPI = (*network.VirtualNetworkGatewaysClient)(nil) // VirtualNetworkGatewayConnectionsClientAPI contains the set of methods on the VirtualNetworkGatewayConnectionsClient type. type VirtualNetworkGatewayConnectionsClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.VirtualNetworkGatewayConnection) (result network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result network.VirtualNetworkGatewayConnectionsDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result network.VirtualNetworkGatewayConnection, err error) GetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result network.ConnectionSharedKey, err error) List(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkGatewayConnectionListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.VirtualNetworkGatewayConnectionListResultIterator, err error) ResetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.ConnectionResetSharedKey) (result network.VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) SetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.ConnectionSharedKey) (result network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters network.TagsObject) (result network.VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) } var _ VirtualNetworkGatewayConnectionsClientAPI = (*network.VirtualNetworkGatewayConnectionsClient)(nil) // LocalNetworkGatewaysClientAPI contains the set of methods on the LocalNetworkGatewaysClient type. type LocalNetworkGatewaysClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters network.LocalNetworkGateway) (result network.LocalNetworkGatewaysCreateOrUpdateFuture, err error) Delete(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result network.LocalNetworkGatewaysDeleteFuture, err error) Get(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result network.LocalNetworkGateway, err error) List(ctx context.Context, resourceGroupName string) (result network.LocalNetworkGatewayListResultPage, err error) ListComplete(ctx context.Context, resourceGroupName string) (result network.LocalNetworkGatewayListResultIterator, err error) UpdateTags(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters network.TagsObject) (result network.LocalNetworkGatewaysUpdateTagsFuture, err error) } var _ LocalNetworkGatewaysClientAPI = (*network.LocalNetworkGatewaysClient)(nil)
{ "pile_set_name": "Github" }
sparkles in its deft portrait of tinseltown's seasoned veterans of gossip , wealth , paranoia , and celebrityhood .
{ "pile_set_name": "Github" }
//----------------------------------------------------------------------- // <copyright file="BluetoothDevice.Android.cs" company="In The Hand Ltd"> // Copyright (c) 2017 In The Hand Ltd, All rights reserved. // This source code is licensed under the MIT License - see License.txt // </copyright> //----------------------------------------------------------------------- using Android.Bluetooth; using Android.Content; using Android.OS; using InTheHand.Devices.Bluetooth.Rfcomm; using InTheHand.Devices.Enumeration; using System; using System.Collections.Generic; using System.Globalization; using System.Threading.Tasks; namespace InTheHand.Devices.Bluetooth { partial class BluetoothDevice { internal Android.Bluetooth.BluetoothDevice _device; private BluetoothDevice(Android.Bluetooth.BluetoothDevice device) { _device = device; } public static implicit operator Android.Bluetooth.BluetoothDevice(BluetoothDevice device) { return device._device; } public static implicit operator BluetoothDevice(Android.Bluetooth.BluetoothDevice device) { return new BluetoothDevice(device); } private static async Task<BluetoothDevice> FromBluetoothAddressAsyncImpl(ulong bluetoothAddress) { byte[] buffer = new byte[6]; var addressBytes = BitConverter.GetBytes(bluetoothAddress); for (int i = 0; i < 6; i++) { buffer[i] = addressBytes[i]; } var device = DeviceInformation.Manager.Adapter.GetRemoteDevice(buffer); if (device.Type.HasFlag(BluetoothDeviceType.Classic)) { return device; } return null; } private static async Task<BluetoothDevice> FromIdAsyncImpl(string deviceId) { var device = Android.Bluetooth.BluetoothAdapter.DefaultAdapter.GetRemoteDevice(deviceId); if (device.Type.HasFlag(BluetoothDeviceType.Classic)) { return device; } return null; } private static async Task<BluetoothDevice> FromDeviceInformationAsyncImpl(DeviceInformation deviceInformation) { return deviceInformation._device; } private static string GetDeviceSelectorImpl() { return string.Empty; } private static string GetDeviceSelectorFromClassOfDeviceImpl(BluetoothClassOfDevice classOfDevice) { return "bluetoothClassOfDevice:" + classOfDevice.RawValue.ToString("X12"); } private static string GetDeviceSelectorFromPairingStateImpl(bool pairingState) { return "bluetoothPairingState:" + pairingState.ToString(); } private ulong GetBluetoothAddress() { return ulong.Parse(_device.Address.Replace(":", ""), NumberStyles.HexNumber); } private BluetoothClassOfDevice GetClassOfDevice() { return new BluetoothClassOfDevice((uint)_device.BluetoothClass.DeviceClass); } private BluetoothConnectionStatus _connectionStatus = BluetoothConnectionStatus.Disconnected; private BluetoothConnectionStatus GetConnectionStatus() { return _connectionStatus; } private string GetDeviceId() { return _device.Address; } private string GetName() { return _device.Name; } private async Task<RfcommDeviceServicesResult> GetRfcommServicesAsyncImpl(BluetoothCacheMode cacheMode) { BluetoothError error = BluetoothError.Success; List<RfcommDeviceService> services = new List<RfcommDeviceService>(); if (cacheMode == BluetoothCacheMode.Uncached) { error = _device.FetchUuidsWithSdp() ? BluetoothError.Success : BluetoothError.DeviceNotConnected; } ParcelUuid[] uuids = _device.GetUuids(); if (uuids != null) { foreach (ParcelUuid g in uuids) { services.Add(new RfcommDeviceService(this, RfcommServiceId.FromUuid(new Guid(g.Uuid.ToString())))); } } return new RfcommDeviceServicesResult(error, services.AsReadOnly()); } private void ConnectionStatusChangedAdd() { BluetoothAdapter.Default.DeviceConnected += Default_DeviceConnected; BluetoothAdapter.Default.DeviceDisconnected += Default_DeviceDisconnected; } private void Default_DeviceDisconnected(object sender, ulong e) { if(e == BluetoothAddress) { _connectionStatus = BluetoothConnectionStatus.Disconnected; RaiseConnectionStatusChanged(); } } private void Default_DeviceConnected(object sender, ulong e) { if (e == BluetoothAddress) { _connectionStatus = BluetoothConnectionStatus.Connected; RaiseConnectionStatusChanged(); } } private void ConnectionStatusChangedRemove() { BluetoothAdapter.Default.DeviceConnected -= Default_DeviceConnected; BluetoothAdapter.Default.DeviceDisconnected -= Default_DeviceDisconnected; } private void NameChangedAdd() { BluetoothAdapter.Default.NameChanged += Default_NameChanged; } private void NameChangedRemove() { BluetoothAdapter.Default.NameChanged -= Default_NameChanged; } private void Default_NameChanged(object sender, ulong e) { if (e == BluetoothAddress) { RaiseNameChanged(); } } } }
{ "pile_set_name": "Github" }
DROP TABLE IF EXISTS t5; CREATE TEMPORARY TABLE t5(c1 BIT(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` bit(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 TINYINT(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` tinyint(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 SMALLINT(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` smallint(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 MEDIUMINT(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` mediumint(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 INT(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` int(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 INTEGER(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` int(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 BIGINT(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` bigint(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 CHAR(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` char(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 VARCHAR(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` varchar(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 BINARY(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` binary(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 VARBINARY(10) NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` varbinary(10) DEFAULT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 BIT(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` bit(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 TINYINT(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` tinyint(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 SMALLINT(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` smallint(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 MEDIUMINT(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` mediumint(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 INT(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` int(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 INTEGER(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` int(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 BIGINT(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` bigint(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 CHAR(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` char(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 VARCHAR(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` varchar(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 BINARY(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` binary(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test CREATE TEMPORARY TABLE t5(c1 VARBINARY(10) NOT NULL); SHOW TABLES; Tables_in_test SHOW CREATE TABLE t5; Table Create Table t5 CREATE TEMPORARY TABLE `t5` ( `c1` varbinary(10) NOT NULL ) ENGINE=ENGINE DEFAULT CHARSET=latin1 DROP TABLE t5; SHOW TABLES; Tables_in_test
{ "pile_set_name": "Github" }
object Test { case class C(s: String) object C { def factory(): C = { val s = "hey!" wire[C] } } lazy val c: C = wireWith(C.factory _) } require(Test.c.s == "hey!")
{ "pile_set_name": "Github" }
/* ============================================================================== This file is part of the JUCE library. Copyright (c) 2015 - ROLI Ltd. Permission is granted to use this software under the terms of either: a) the GPL v2 (or any later version) b) the Affero GPL v3 Details of these licenses can be found at: www.gnu.org/licenses JUCE 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. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.juce.com for more information. ============================================================================== */ struct PropertyPanel::SectionComponent : public Component { SectionComponent (const String& sectionTitle, const Array<PropertyComponent*>& newProperties, const bool sectionIsOpen) : Component (sectionTitle), titleHeight (sectionTitle.isNotEmpty() ? 22 : 0), isOpen (sectionIsOpen) { propertyComps.addArray (newProperties); for (int i = propertyComps.size(); --i >= 0;) { addAndMakeVisible (propertyComps.getUnchecked(i)); propertyComps.getUnchecked(i)->refresh(); } } ~SectionComponent() { propertyComps.clear(); } void paint (Graphics& g) override { if (titleHeight > 0) getLookAndFeel().drawPropertyPanelSectionHeader (g, getName(), isOpen, getWidth(), titleHeight); } void resized() override { int y = titleHeight; for (int i = 0; i < propertyComps.size(); ++i) { PropertyComponent* const pec = propertyComps.getUnchecked (i); pec->setBounds (1, y, getWidth() - 2, pec->getPreferredHeight()); y = pec->getBottom(); } } int getPreferredHeight() const { int y = titleHeight; if (isOpen) for (int i = propertyComps.size(); --i >= 0;) y += propertyComps.getUnchecked(i)->getPreferredHeight(); return y; } void setOpen (const bool open) { if (isOpen != open) { isOpen = open; for (int i = propertyComps.size(); --i >= 0;) propertyComps.getUnchecked(i)->setVisible (open); if (PropertyPanel* const pp = findParentComponentOfClass<PropertyPanel>()) pp->resized(); } } void refreshAll() const { for (int i = propertyComps.size(); --i >= 0;) propertyComps.getUnchecked (i)->refresh(); } void mouseUp (const MouseEvent& e) override { if (e.getMouseDownX() < titleHeight && e.x < titleHeight && e.getNumberOfClicks() != 2) mouseDoubleClick (e); } void mouseDoubleClick (const MouseEvent& e) override { if (e.y < titleHeight) setOpen (! isOpen); } OwnedArray<PropertyComponent> propertyComps; const int titleHeight; bool isOpen; JUCE_DECLARE_NON_COPYABLE (SectionComponent) }; //============================================================================== struct PropertyPanel::PropertyHolderComponent : public Component { PropertyHolderComponent() {} void paint (Graphics&) override {} void updateLayout (int width) { int y = 0; for (int i = 0; i < sections.size(); ++i) { SectionComponent* const section = sections.getUnchecked(i); section->setBounds (0, y, width, section->getPreferredHeight()); y = section->getBottom(); } setSize (width, y); repaint(); } void refreshAll() const { for (int i = 0; i < sections.size(); ++i) sections.getUnchecked(i)->refreshAll(); } void insertSection (int indexToInsertAt, SectionComponent* newSection) { sections.insert (indexToInsertAt, newSection); addAndMakeVisible (newSection, 0); } SectionComponent* getSectionWithNonEmptyName (const int targetIndex) const noexcept { for (int index = 0, i = 0; i < sections.size(); ++i) { SectionComponent* const section = sections.getUnchecked (i); if (section->getName().isNotEmpty()) if (index++ == targetIndex) return section; } return nullptr; } OwnedArray<SectionComponent> sections; JUCE_DECLARE_NON_COPYABLE (PropertyHolderComponent) }; //============================================================================== PropertyPanel::PropertyPanel() { init(); } PropertyPanel::PropertyPanel (const String& name) : Component (name) { init(); } void PropertyPanel::init() { messageWhenEmpty = TRANS("(nothing selected)"); addAndMakeVisible (viewport); viewport.setViewedComponent (propertyHolderComponent = new PropertyHolderComponent()); viewport.setFocusContainer (true); } PropertyPanel::~PropertyPanel() { clear(); } //============================================================================== void PropertyPanel::paint (Graphics& g) { if (isEmpty()) { g.setColour (Colours::black.withAlpha (0.5f)); g.setFont (14.0f); g.drawText (messageWhenEmpty, getLocalBounds().withHeight (30), Justification::centred, true); } } void PropertyPanel::resized() { viewport.setBounds (getLocalBounds()); updatePropHolderLayout(); } //============================================================================== void PropertyPanel::clear() { if (! isEmpty()) { propertyHolderComponent->sections.clear(); updatePropHolderLayout(); } } bool PropertyPanel::isEmpty() const { return propertyHolderComponent->sections.size() == 0; } int PropertyPanel::getTotalContentHeight() const { return propertyHolderComponent->getHeight(); } void PropertyPanel::addProperties (const Array<PropertyComponent*>& newProperties) { if (isEmpty()) repaint(); propertyHolderComponent->insertSection (-1, new SectionComponent (String(), newProperties, true)); updatePropHolderLayout(); } void PropertyPanel::addSection (const String& sectionTitle, const Array<PropertyComponent*>& newProperties, const bool shouldBeOpen, const int indexToInsertAt) { jassert (sectionTitle.isNotEmpty()); if (isEmpty()) repaint(); propertyHolderComponent->insertSection (indexToInsertAt, new SectionComponent (sectionTitle, newProperties, shouldBeOpen)); updatePropHolderLayout(); } void PropertyPanel::updatePropHolderLayout() const { const int maxWidth = viewport.getMaximumVisibleWidth(); propertyHolderComponent->updateLayout (maxWidth); const int newMaxWidth = viewport.getMaximumVisibleWidth(); if (maxWidth != newMaxWidth) { // need to do this twice because of scrollbars changing the size, etc. propertyHolderComponent->updateLayout (newMaxWidth); } } void PropertyPanel::refreshAll() const { propertyHolderComponent->refreshAll(); } //============================================================================== StringArray PropertyPanel::getSectionNames() const { StringArray s; for (int i = 0; i < propertyHolderComponent->sections.size(); ++i) { SectionComponent* const section = propertyHolderComponent->sections.getUnchecked(i); if (section->getName().isNotEmpty()) s.add (section->getName()); } return s; } bool PropertyPanel::isSectionOpen (const int sectionIndex) const { if (SectionComponent* s = propertyHolderComponent->getSectionWithNonEmptyName (sectionIndex)) return s->isOpen; return false; } void PropertyPanel::setSectionOpen (const int sectionIndex, const bool shouldBeOpen) { if (SectionComponent* s = propertyHolderComponent->getSectionWithNonEmptyName (sectionIndex)) s->setOpen (shouldBeOpen); } void PropertyPanel::setSectionEnabled (const int sectionIndex, const bool shouldBeEnabled) { if (SectionComponent* s = propertyHolderComponent->getSectionWithNonEmptyName (sectionIndex)) s->setEnabled (shouldBeEnabled); } void PropertyPanel::removeSection (int sectionIndex) { if (SectionComponent* s = propertyHolderComponent->getSectionWithNonEmptyName (sectionIndex)) { propertyHolderComponent->sections.removeObject (s); updatePropHolderLayout(); } } //============================================================================== XmlElement* PropertyPanel::getOpennessState() const { XmlElement* const xml = new XmlElement ("PROPERTYPANELSTATE"); xml->setAttribute ("scrollPos", viewport.getViewPositionY()); const StringArray sections (getSectionNames()); for (int i = 0; i < sections.size(); ++i) { if (sections[i].isNotEmpty()) { XmlElement* const e = xml->createNewChildElement ("SECTION"); e->setAttribute ("name", sections[i]); e->setAttribute ("open", isSectionOpen (i) ? 1 : 0); } } return xml; } void PropertyPanel::restoreOpennessState (const XmlElement& xml) { if (xml.hasTagName ("PROPERTYPANELSTATE")) { const StringArray sections (getSectionNames()); forEachXmlChildElementWithTagName (xml, e, "SECTION") { setSectionOpen (sections.indexOf (e->getStringAttribute ("name")), e->getBoolAttribute ("open")); } viewport.setViewPosition (viewport.getViewPositionX(), xml.getIntAttribute ("scrollPos", viewport.getViewPositionY())); } } //============================================================================== void PropertyPanel::setMessageWhenEmpty (const String& newMessage) { if (messageWhenEmpty != newMessage) { messageWhenEmpty = newMessage; repaint(); } } const String& PropertyPanel::getMessageWhenEmpty() const noexcept { return messageWhenEmpty; }
{ "pile_set_name": "Github" }
op { graph_op_name: "Print" visibility: SKIP }
{ "pile_set_name": "Github" }
// boost::compressed_pair test program // (C) Copyright John Maddock 2000. // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). // standalone test program for <boost/call_traits.hpp> // 18 Mar 2002: // Changed some names to prevent conflicts with some new type_traits additions. // 03 Oct 2000: // Enabled extra tests for VC6. #include <iostream> #include <iomanip> #include <algorithm> #include <typeinfo> #include <boost/call_traits.hpp> #include <libs/type_traits/test/test.hpp> #include <libs/type_traits/test/check_type.hpp> #ifdef BOOST_MSVC #pragma warning(disable:4181) // : warning C4181: qualifier applied to reference type; ignored #endif // a way prevent warnings for unused variables template<class T> inline void unused_variable(const T&) {} // // struct contained models a type that contains a type (for example std::pair) // arrays are contained by value, and have to be treated as a special case: // template <class T> struct contained { // define our typedefs first, arrays are stored by value // so value_type is not the same as result_type: typedef typename boost::call_traits<T>::param_type param_type; typedef typename boost::call_traits<T>::reference reference; typedef typename boost::call_traits<T>::const_reference const_reference; typedef T value_type; typedef typename boost::call_traits<T>::value_type result_type; // stored value: value_type v_; // constructors: contained() {} contained(param_type p) : v_(p){} // return byval: result_type value()const { return v_; } // return by_ref: reference get() { return v_; } const_reference const_get()const { return v_; } // pass value: void call(param_type){} private: contained& operator=(const contained&); }; #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template <class T, std::size_t N> struct contained<T[N]> { typedef typename boost::call_traits<T[N]>::param_type param_type; typedef typename boost::call_traits<T[N]>::reference reference; typedef typename boost::call_traits<T[N]>::const_reference const_reference; typedef T value_type[N]; typedef typename boost::call_traits<T[N]>::value_type result_type; value_type v_; contained(param_type p) { std::copy(p, p+N, v_); } // return byval: result_type value()const { return v_; } // return by_ref: reference get() { return v_; } const_reference const_get()const { return v_; } void call(param_type){} private: contained& operator=(const contained&); }; #endif template <class T> contained<typename boost::call_traits<T>::value_type> test_wrap_type(const T& t) { typedef typename boost::call_traits<T>::value_type ct; return contained<ct>(t); } namespace test{ template <class T1, class T2> std::pair< typename boost::call_traits<T1>::value_type, typename boost::call_traits<T2>::value_type> make_pair(const T1& t1, const T2& t2) { return std::pair< typename boost::call_traits<T1>::value_type, typename boost::call_traits<T2>::value_type>(t1, t2); } } // namespace test using namespace std; // // struct call_traits_checker: // verifies behaviour of contained example: // template <class T> struct call_traits_checker { typedef typename boost::call_traits<T>::param_type param_type; void operator()(param_type); }; template <class T> void call_traits_checker<T>::operator()(param_type p) { T t(p); contained<T> c(t); cout << "checking contained<" << typeid(T).name() << ">..." << endl; BOOST_CHECK(t == c.value()); BOOST_CHECK(t == c.get()); BOOST_CHECK(t == c.const_get()); #ifndef __ICL //cout << "typeof contained<" << typeid(T).name() << ">::v_ is: " << typeid(&contained<T>::v_).name() << endl; cout << "typeof contained<" << typeid(T).name() << ">::value() is: " << typeid(&contained<T>::value).name() << endl; cout << "typeof contained<" << typeid(T).name() << ">::get() is: " << typeid(&contained<T>::get).name() << endl; cout << "typeof contained<" << typeid(T).name() << ">::const_get() is: " << typeid(&contained<T>::const_get).name() << endl; cout << "typeof contained<" << typeid(T).name() << ">::call() is: " << typeid(&contained<T>::call).name() << endl; cout << endl; #endif } #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template <class T, std::size_t N> struct call_traits_checker<T[N]> { typedef typename boost::call_traits<T[N]>::param_type param_type; void operator()(param_type t) { contained<T[N]> c(t); cout << "checking contained<" << typeid(T[N]).name() << ">..." << endl; unsigned int i = 0; for(i = 0; i < N; ++i) BOOST_CHECK(t[i] == c.value()[i]); for(i = 0; i < N; ++i) BOOST_CHECK(t[i] == c.get()[i]); for(i = 0; i < N; ++i) BOOST_CHECK(t[i] == c.const_get()[i]); cout << "typeof contained<" << typeid(T[N]).name() << ">::v_ is: " << typeid(&contained<T[N]>::v_).name() << endl; cout << "typeof contained<" << typeid(T[N]).name() << ">::value is: " << typeid(&contained<T[N]>::value).name() << endl; cout << "typeof contained<" << typeid(T[N]).name() << ">::get is: " << typeid(&contained<T[N]>::get).name() << endl; cout << "typeof contained<" << typeid(T[N]).name() << ">::const_get is: " << typeid(&contained<T[N]>::const_get).name() << endl; cout << "typeof contained<" << typeid(T[N]).name() << ">::call is: " << typeid(&contained<T[N]>::call).name() << endl; cout << endl; } }; #endif // // check_wrap: template <class W, class U> void check_wrap(const W& w, const U& u) { cout << "checking " << typeid(W).name() << "..." << endl; BOOST_CHECK(w.value() == u); } // // check_make_pair: // verifies behaviour of "make_pair": // template <class T, class U, class V> void check_make_pair(T c, U u, V v) { cout << "checking std::pair<" << typeid(c.first).name() << ", " << typeid(c.second).name() << ">..." << endl; BOOST_CHECK(c.first == u); BOOST_CHECK(c.second == v); cout << endl; } struct comparible_UDT { int i_; comparible_UDT() : i_(2){} comparible_UDT(const comparible_UDT& other) : i_(other.i_){} comparible_UDT& operator=(const comparible_UDT& other) { i_ = other.i_; return *this; } bool operator == (const comparible_UDT& v){ return v.i_ == i_; } }; int main() { call_traits_checker<comparible_UDT> c1; comparible_UDT u; c1(u); call_traits_checker<int> c2; call_traits_checker<enum_UDT> c2b; int i = 2; c2(i); c2b(one); int* pi = &i; int a[2] = {1,2}; #if defined(BOOST_MSVC6_MEMBER_TEMPLATES) && !defined(__ICL) call_traits_checker<int*> c3; c3(pi); call_traits_checker<int&> c4; c4(i); call_traits_checker<const int&> c5; c5(i); #if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__MWERKS__) && !defined(__SUNPRO_CC) call_traits_checker<int[2]> c6; c6(a); #endif #endif check_wrap(test_wrap_type(2), 2); #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__SUNPRO_CC) check_wrap(test_wrap_type(a), a); check_make_pair(test::make_pair(a, a), a, a); #endif // cv-qualifiers applied to reference types should have no effect // declare these here for later use with is_reference and remove_reference: typedef int& r_type; typedef const r_type cr_type; BOOST_CHECK_TYPE(comparible_UDT, boost::call_traits<comparible_UDT>::value_type); BOOST_CHECK_TYPE(comparible_UDT&, boost::call_traits<comparible_UDT>::reference); BOOST_CHECK_TYPE(const comparible_UDT&, boost::call_traits<comparible_UDT>::const_reference); BOOST_CHECK_TYPE(const comparible_UDT&, boost::call_traits<comparible_UDT>::param_type); BOOST_CHECK_TYPE(int, boost::call_traits<int>::value_type); BOOST_CHECK_TYPE(int&, boost::call_traits<int>::reference); BOOST_CHECK_TYPE(const int&, boost::call_traits<int>::const_reference); BOOST_CHECK_TYPE(const int, boost::call_traits<int>::param_type); BOOST_CHECK_TYPE(int*, boost::call_traits<int*>::value_type); BOOST_CHECK_TYPE(int*&, boost::call_traits<int*>::reference); BOOST_CHECK_TYPE(int*const&, boost::call_traits<int*>::const_reference); BOOST_CHECK_TYPE(int*const, boost::call_traits<int*>::param_type); #if defined(BOOST_MSVC6_MEMBER_TEMPLATES) BOOST_CHECK_TYPE(int&, boost::call_traits<int&>::value_type); BOOST_CHECK_TYPE(int&, boost::call_traits<int&>::reference); BOOST_CHECK_TYPE(const int&, boost::call_traits<int&>::const_reference); BOOST_CHECK_TYPE(int&, boost::call_traits<int&>::param_type); #if !(defined(__GNUC__) && ((__GNUC__ < 3) || (__GNUC__ == 3) && (__GNUC_MINOR__ < 1))) BOOST_CHECK_TYPE(int&, boost::call_traits<cr_type>::value_type); BOOST_CHECK_TYPE(int&, boost::call_traits<cr_type>::reference); BOOST_CHECK_TYPE(const int&, boost::call_traits<cr_type>::const_reference); BOOST_CHECK_TYPE(int&, boost::call_traits<cr_type>::param_type); #else std::cout << "Your compiler cannot instantiate call_traits<int&const>, skipping four tests (4 errors)" << std::endl; #endif BOOST_CHECK_TYPE(const int&, boost::call_traits<const int&>::value_type); BOOST_CHECK_TYPE(const int&, boost::call_traits<const int&>::reference); BOOST_CHECK_TYPE(const int&, boost::call_traits<const int&>::const_reference); BOOST_CHECK_TYPE(const int&, boost::call_traits<const int&>::param_type); #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_CHECK_TYPE(const int*, boost::call_traits<int[3]>::value_type); BOOST_CHECK_TYPE(int(&)[3], boost::call_traits<int[3]>::reference); BOOST_CHECK_TYPE(const int(&)[3], boost::call_traits<int[3]>::const_reference); BOOST_CHECK_TYPE(const int*const, boost::call_traits<int[3]>::param_type); BOOST_CHECK_TYPE(const int*, boost::call_traits<const int[3]>::value_type); BOOST_CHECK_TYPE(const int(&)[3], boost::call_traits<const int[3]>::reference); BOOST_CHECK_TYPE(const int(&)[3], boost::call_traits<const int[3]>::const_reference); BOOST_CHECK_TYPE(const int*const, boost::call_traits<const int[3]>::param_type); // test with abstract base class: BOOST_CHECK_TYPE(test_abc1, boost::call_traits<test_abc1>::value_type); BOOST_CHECK_TYPE(test_abc1&, boost::call_traits<test_abc1>::reference); BOOST_CHECK_TYPE(const test_abc1&, boost::call_traits<test_abc1>::const_reference); BOOST_CHECK_TYPE(const test_abc1&, boost::call_traits<test_abc1>::param_type); #else std::cout << "You're compiler does not support partial template specialiation, skipping 8 tests (8 errors)" << std::endl; #endif #else std::cout << "You're compiler does not support partial template specialiation, skipping 20 tests (20 errors)" << std::endl; #endif // test with an incomplete type: BOOST_CHECK_TYPE(incomplete_type, boost::call_traits<incomplete_type>::value_type); BOOST_CHECK_TYPE(incomplete_type&, boost::call_traits<incomplete_type>::reference); BOOST_CHECK_TYPE(const incomplete_type&, boost::call_traits<incomplete_type>::const_reference); BOOST_CHECK_TYPE(const incomplete_type&, boost::call_traits<incomplete_type>::param_type); // test enum: BOOST_CHECK_TYPE(enum_UDT, boost::call_traits<enum_UDT>::value_type); BOOST_CHECK_TYPE(enum_UDT&, boost::call_traits<enum_UDT>::reference); BOOST_CHECK_TYPE(const enum_UDT&, boost::call_traits<enum_UDT>::const_reference); BOOST_CHECK_TYPE(const enum_UDT, boost::call_traits<enum_UDT>::param_type); return 0; } // // define call_traits tests to check that the assertions in the docs do actually work // this is an compile-time only set of tests: // template <typename T, bool isarray = false> struct call_traits_test { typedef ::boost::call_traits<T> ct; typedef typename ct::param_type param_type; typedef typename ct::reference reference; typedef typename ct::const_reference const_reference; typedef typename ct::value_type value_type; static void assert_construct(param_type val); }; template <typename T, bool isarray> void call_traits_test<T, isarray>::assert_construct(typename call_traits_test<T, isarray>::param_type val) { // // this is to check that the call_traits assertions are valid: T t(val); value_type v(t); reference r(t); const_reference cr(t); param_type p(t); value_type v2(v); value_type v3(r); value_type v4(p); reference r2(v); reference r3(r); const_reference cr2(v); const_reference cr3(r); const_reference cr4(cr); const_reference cr5(p); param_type p2(v); param_type p3(r); param_type p4(p); unused_variable(v2); unused_variable(v3); unused_variable(v4); unused_variable(r2); unused_variable(r3); unused_variable(cr2); unused_variable(cr3); unused_variable(cr4); unused_variable(cr5); unused_variable(p2); unused_variable(p3); unused_variable(p4); } #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template <typename T> struct call_traits_test<T, true> { typedef ::boost::call_traits<T> ct; typedef typename ct::param_type param_type; typedef typename ct::reference reference; typedef typename ct::const_reference const_reference; typedef typename ct::value_type value_type; static void assert_construct(param_type val); }; template <typename T> void call_traits_test<T, true>::assert_construct(typename boost::call_traits<T>::param_type val) { // // this is to check that the call_traits assertions are valid: T t; value_type v(t); value_type v5(val); reference r = t; const_reference cr = t; reference r2 = r; #ifndef __BORLANDC__ // C++ Builder buglet: const_reference cr2 = r; #endif param_type p(t); value_type v2(v); const_reference cr3 = cr; value_type v3(r); value_type v4(p); param_type p2(v); param_type p3(r); param_type p4(p); unused_variable(v2); unused_variable(v3); unused_variable(v4); unused_variable(v5); #ifndef __BORLANDC__ unused_variable(r2); unused_variable(cr2); #endif unused_variable(cr3); unused_variable(p2); unused_variable(p3); unused_variable(p4); } #endif //BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // // now check call_traits assertions by instantiating call_traits_test: template struct call_traits_test<int>; template struct call_traits_test<const int>; template struct call_traits_test<int*>; #if defined(BOOST_MSVC6_MEMBER_TEMPLATES) template struct call_traits_test<int&>; template struct call_traits_test<const int&>; #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__SUNPRO_CC) template struct call_traits_test<int[2], true>; #endif #endif
{ "pile_set_name": "Github" }
[![MIT Licensed][icon-mit]][license] [![Awesome][icon-awesome]][awesome] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [![Telegram][icon-chat]][chat] # Offline Web Applications (optional) > Note: this task is optional because most likely, you will not use knowledge obtained from it during our course. But, you will need this information when you will work as a developer. At least a general understanding of the concept. That's why finishing this task is up to you. [Offline Web Applications](https://www.udacity.com/course/offline-web-applications--ud899) If you decide to complete the task then do the following after you're done: 1. Make screenshots of your progress in the course and put the screenshots in `task_offline_web_app` folder in your `kottans-frontend` repo 1. In your `kottans-frontend` repo `README.md`: * add header `## Offline Web Applications` * embed the screenshots or add links to the screenshots * list your reflections on the course (_what was new to you_, _what surprised you_, _what you intend to use in future_) 1. You did an extra effort! Go ahead share your progress with others – post a message in [course channel][chat]: `Offline Web Apps — #done` (or `Offline Web Apps — #p2p_done` if you are p2p course student) and add the link to your repo. **This step is important, as it helps mentors to track your progress!** 1. Study Extra Materials below to improve your skills. If you feel it affects your overall course performance consider reverting to those later e.g. when you have all mandatory tasks completed. 1. You may skip Optional materials from this task (if any). When you finish this task you can proceed to the next one. ## Extra materials - [15 тривиальных фактов о правильной работе с протоколом HTTP](https://habrahabr.ru/company/yandex/blog/265569/) - [How the Internet works](https://www.khanacademy.org/computing/computer-science/computers-and-internet-code-org/internet-works-intro/v/what-is-the-internet) - [HTTP/2 101 (Chrome Dev Summit 2015)](https://www.youtube.com/watch?v=r5oT_2ndjms) - [Introduction to HTTP/2](https://developers.google.com/web/fundamentals/performance/http2/) - [Serviceworkies mastery games(by the author of Flexbox Zombies)](https://serviceworkies.com/) ## Done? ➡️ Go forward to [Memory – Pair Game](memory-pair-game.md) ⤴️ Back to [Contents](../contents.md) [icon-chat]: https://img.shields.io/badge/chat-on%20telegram-blue.svg [icon-mit]: https://img.shields.io/badge/license-MIT-blue.svg [icon-awesome]: https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg [license]: https://github.com/Kottans/web/blob/master/LICENSE.md [awesome]: https://github.com/sindresorhus/awesome#front-end-development [chat]: https://t.me/joinchat/CX8EF1JmLm9IM6J6oy2U7Q
{ "pile_set_name": "Github" }
/* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.job; import android.util.KeyValueListParser; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.server.job.JobSchedulerService.MaxJobCounts; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) @SmallTest public class MaxJobCountsTest { private void check(String config, int defaultTotal, int defaultMaxBg, int defaultMinBg, int expectedTotal, int expectedMaxBg, int expectedMinBg) { final KeyValueListParser parser = new KeyValueListParser(','); parser.setString(config); final MaxJobCounts counts = new JobSchedulerService.MaxJobCounts( defaultTotal, "total", defaultMaxBg, "maxbg", defaultMinBg, "minbg"); counts.parse(parser); Assert.assertEquals(expectedTotal, counts.getMaxTotal()); Assert.assertEquals(expectedMaxBg, counts.getMaxBg()); Assert.assertEquals(expectedMinBg, counts.getMinBg()); } @Test public void test() { // Tests with various combinations. check("", /*default*/ 5, 1, 0, /*expected*/ 5, 1, 0); check("", /*default*/ 5, 0, 0, /*expected*/ 5, 1, 0); check("", /*default*/ 0, 0, 0, /*expected*/ 1, 1, 0); check("", /*default*/ -1, -1, -1, /*expected*/ 1, 1, 0); check("", /*default*/ 5, 5, 5, /*expected*/ 5, 5, 4); check("", /*default*/ 6, 5, 6, /*expected*/ 6, 5, 5); check("", /*default*/ 4, 5, 6, /*expected*/ 4, 4, 3); check("", /*default*/ 5, 1, 1, /*expected*/ 5, 1, 1); check("", /*default*/ 15, 15, 15, /*expected*/ 15, 15, 14); check("", /*default*/ 16, 16, 16, /*expected*/ 16, 16, 15); check("", /*default*/ 20, 20, 20, /*expected*/ 16, 16, 15); // Test for overriding with a setting string. check("total=5,maxbg=4,minbg=3", /*default*/ 9, 9, 9, /*expected*/ 5, 4, 3); check("total=5", /*default*/ 9, 9, 9, /*expected*/ 5, 5, 4); check("maxbg=4", /*default*/ 9, 9, 9, /*expected*/ 9, 4, 4); check("minbg=3", /*default*/ 9, 9, 9, /*expected*/ 9, 9, 3); } }
{ "pile_set_name": "Github" }
/* * NCA Status definitions * * Copyright 2007 Robert Shearman * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #define NCA_S_COMM_FAILURE 0x1C010001 #define NCA_S_OP_RNG_ERROR 0x1C010002 #define NCA_S_UNK_IF 0x1C010003 #define NCA_S_WRONG_BOOT_TIME 0x1C010006 #define NCA_S_YOU_CRASHED 0x1C010009 #define NCA_S_PROTO_ERROR 0x1C01000B #define NCA_S_OUT_ARGS_TOO_BIG 0x1C010013 #define NCA_S_SERVER_TOO_BUSY 0x1C010014 #define NCA_S_FAULT_STRING_TOO_LONG 0x1C010015 #define NCA_S_UNSUPPORTED_TYPE 0x1C010017 #define NCA_S_FAULT_INT_DIV_BY_ZERO 0x1C000001 #define NCA_S_FAULT_ADDR_ERROR 0x1C000002 #define NCA_S_FAULT_FP_DIV_ZERO 0x1C000003 #define NCA_S_FAULT_FP_UNDERFLOW 0x1C000004 #define NCA_S_FAULT_FP_OVERFLOW 0x1C000005 #define NCA_S_FAULT_INVALID_TAG 0x1C000006 #define NCA_S_FAULT_INVALID_BOUND 0x1C000007 #define NCA_S_RPC_VERSION_MISMATCH 0x1C000008 #define NCA_S_UNSPEC_REJECT 0x1C000009 #define NCA_S_BAD_ACTID 0x1C00000A #define NCA_S_WHO_ARE_YOU_FAILED 0x1C00000B #define NCA_S_MANAGER_NOT_ENTERED 0x1C00000C #define NCA_S_FAULT_CANCEL 0x1C00000D #define NCA_S_FAULT_ILL_INST 0x1C00000E #define NCA_S_FAULT_FP_ERROR 0x1C00000F #define NCA_S_FAULT_INT_OVERFLOW 0x1C000010 #define NCA_S_FAULT_UNSPEC 0x1C000012 #define NCA_S_FAULT_REMOTE_COMM_FAILURE 0x1C000013 #define NCA_S_FAULT_PIPE_EMPTY 0x1C000014 #define NCA_S_FAULT_PIPE_CLOSED 0x1C000015 #define NCA_S_FAULT_PIPE_ORDER 0x1C000016 #define NCA_S_FAULT_PIPE_DISCIPLINE 0x1C000017 #define NCA_S_FAULT_PIPE_COMM_ERROR 0x1C000018 #define NCA_S_FAULT_PIPE_MEMORY 0x1C000019 #define NCA_S_FAULT_CONTEXT_MISMATCH 0x1C00001A #define NCA_S_FAULT_REMOTE_NO_MEMORY 0x1C00001B #define NCA_S_INVALID_PRES_CONTEXT_ID 0x1C00001C #define NCA_S_UNSUPPORTED_AUTHN_LEVEL 0x1C00001D #define NCA_S_INVALID_CHECKSUM 0x1C00001F #define NCA_S_INVALID_CRC 0x1C000020 #define NCA_S_FAULT_USER_DEFINED 0x1C000021 #define NCA_S_FAULT_TX_OPEN_FAILED 0x1C000022 #define NCA_S_FAULT_CODESET_CONV_ERROR 0x1C000023 #define NCA_S_FAULT_OBJECT_NOT_FOUND 0x1C000024 #define NCA_S_FAULT_NO_CLIENT_STUB 0x1C000025
{ "pile_set_name": "Github" }
define([ "./arr" ], function( arr ) { return arr.indexOf; });
{ "pile_set_name": "Github" }
// // ImageFormat.swift // Kingfisher // // Created by onevcat on 2018/09/28. // // Copyright (c) 2019 Wei Wang <[email protected]> // // 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. import Foundation /// Represents image format. /// /// - unknown: The format cannot be recognized or not supported yet. /// - PNG: PNG image format. /// - JPEG: JPEG image format. /// - GIF: GIF image format. public enum ImageFormat { /// The format cannot be recognized or not supported yet. case unknown /// PNG image format. case PNG /// JPEG image format. case JPEG /// GIF image format. case GIF struct HeaderData { static var PNG: [UInt8] = [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A] static var JPEG_SOI: [UInt8] = [0xFF, 0xD8] static var JPEG_IF: [UInt8] = [0xFF] static var GIF: [UInt8] = [0x47, 0x49, 0x46] } /// https://en.wikipedia.org/wiki/JPEG public enum JPEGMarker { case SOF0 //baseline case SOF2 //progressive case DHT //Huffman Table case DQT //Quantization Table case DRI //Restart Interval case SOS //Start Of Scan case RSTn(UInt8) //Restart case APPn //Application-specific case COM //Comment case EOI //End Of Image var bytes: [UInt8] { switch self { case .SOF0: return [0xFF, 0xC0] case .SOF2: return [0xFF, 0xC2] case .DHT: return [0xFF, 0xC4] case .DQT: return [0xFF, 0xDB] case .DRI: return [0xFF, 0xDD] case .SOS: return [0xFF, 0xDA] case .RSTn(let n): return [0xFF, 0xD0 + n] case .APPn: return [0xFF, 0xE0] case .COM: return [0xFF, 0xFE] case .EOI: return [0xFF, 0xD9] } } } } extension Data: KingfisherCompatibleValue {} // MARK: - Misc Helpers extension KingfisherWrapper where Base == Data { /// Gets the image format corresponding to the data. public var imageFormat: ImageFormat { guard base.count > 8 else { return .unknown } var buffer = [UInt8](repeating: 0, count: 8) base.copyBytes(to: &buffer, count: 8) if buffer == ImageFormat.HeaderData.PNG { return .PNG } else if buffer[0] == ImageFormat.HeaderData.JPEG_SOI[0], buffer[1] == ImageFormat.HeaderData.JPEG_SOI[1], buffer[2] == ImageFormat.HeaderData.JPEG_IF[0] { return .JPEG } else if buffer[0] == ImageFormat.HeaderData.GIF[0], buffer[1] == ImageFormat.HeaderData.GIF[1], buffer[2] == ImageFormat.HeaderData.GIF[2] { return .GIF } return .unknown } public func contains(jpeg marker: ImageFormat.JPEGMarker) -> Bool { guard imageFormat == .JPEG else { return false } var buffer = [UInt8](repeating: 0, count: base.count) base.copyBytes(to: &buffer, count: base.count) for (index, item) in buffer.enumerated() { guard item == marker.bytes.first, buffer.count > index + 1, buffer[index + 1] == marker.bytes[1] else { continue } return true } return false } }
{ "pile_set_name": "Github" }
Ext.generator.Controller.templates.ControllerSpec = new Ext.XTemplate( 'describe("The {name} controller", function() {\n', ' var controller = Ext.ControllerManager.get("{name}");\n\n', '<tpl for="actions">', ' describe("the {.} action", function() {\n', ' beforeEach(function() {\n', ' \n', ' });\n\n\n', ' });\n\n', '</tpl>', '});\n' );
{ "pile_set_name": "Github" }
// REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-unknown-linux -debug-info-kind=limited -split-dwarf-file foo.dwo -split-dwarf-output %t -emit-obj -o - %s | llvm-dwarfdump -debug-info - | FileCheck %s // RUN: llvm-dwarfdump -debug-info %t | FileCheck %s int f() { return 0; } // CHECK: DW_AT_GNU_dwo_name ("foo.dwo")
{ "pile_set_name": "Github" }
require 'bwoken' require 'bwoken/script' module Bwoken class DeviceRunner attr_accessor :focus attr_accessor :formatter attr_accessor :app_dir attr_accessor :device alias_method :feature_names, :focus def initialize yield self if block_given? end def execute scripts.each(&:run) end def device_family Device.device_type end def scripts script_filenames.map do |filename| Script.new do |s| s.path = filename s.device_family = device_family s.formatter = formatter s.app_dir = app_dir s.device = device end end end def script_filenames if focus.respond_to?(:length) && focus.length > 0 test_files_from_feature_names else all_test_files end end def test_files_from_feature_names feature_names.map do |feature_name| File.join(Bwoken.test_suite_path, device_family, "#{feature_name}.js") end end def all_test_files all_files_in_test_dir - helper_files end def all_files_in_test_dir Dir["#{Bwoken.test_suite_path}/#{device_family}/**/*.js"] end def helper_files Dir["#{Bwoken.test_suite_path}/#{device_family}/**/helpers/**/*.js"] end end end
{ "pile_set_name": "Github" }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System; using UnityEngine; namespace XRTK.Definitions.InputSystem { /// <summary> /// Data structure for mapping Voice and Keyboard input to <see cref="MixedRealityInputAction"/>s that can be raised by the Input System. /// </summary> [Serializable] public struct SpeechCommands { /// <summary> /// Constructor. /// </summary> /// <param name="keyword">The Keyword.</param> /// <param name="keyCode">The KeyCode.</param> /// <param name="action">The Action to perform when Keyword or KeyCode is recognized.</param> public SpeechCommands(string keyword, KeyCode keyCode, MixedRealityInputAction action) { this.keyword = keyword; this.keyCode = keyCode; this.action = action; } [SerializeField] [Tooltip("The Keyword to listen for.")] private string keyword; /// <summary> /// The Keyword to listen for. /// </summary> public string Keyword => keyword; [SerializeField] [Tooltip("The corresponding KeyCode that also raises the same action as the Keyword.")] private KeyCode keyCode; /// <summary> /// The corresponding KeyCode that also raises the same action as the Keyword. /// </summary> public KeyCode KeyCode => keyCode; [SerializeField] [Tooltip("The Action that is raised by either the Keyword or KeyCode.")] private MixedRealityInputAction action; /// <summary> /// The <see cref="MixedRealityInputAction"/> that is raised by either the Keyword or KeyCode. /// </summary> public MixedRealityInputAction Action => action; } }
{ "pile_set_name": "Github" }
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package v1 import ( "fmt" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) // +genclient // +genclient:nonNamespaced // +genclient:onlyVerbs=create // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // SubjectAccessReview checks whether or not a user or group can perform an action. type SubjectAccessReview struct { metav1.TypeMeta `json:",inline"` // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec holds information about the request being evaluated Spec SubjectAccessReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` // Status is filled in by the server and indicates whether the request is allowed or not // +optional Status SubjectAccessReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // +genclient // +genclient:nonNamespaced // +genclient:onlyVerbs=create // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a // spec.namespace means "in all namespaces". Self is a special case, because users should always be able // to check whether they can perform an action type SelfSubjectAccessReview struct { metav1.TypeMeta `json:",inline"` // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec holds information about the request being evaluated. user and groups must be empty Spec SelfSubjectAccessReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` // Status is filled in by the server and indicates whether the request is allowed or not // +optional Status SubjectAccessReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // +genclient // +genclient:onlyVerbs=create // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. // Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions // checking. type LocalSubjectAccessReview struct { metav1.TypeMeta `json:",inline"` // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace // you made the request against. If empty, it is defaulted. Spec SubjectAccessReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` // Status is filled in by the server and indicates whether the request is allowed or not // +optional Status SubjectAccessReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface type ResourceAttributes struct { // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces // "" (empty) is defaulted for LocalSubjectAccessReviews // "" (empty) is empty for cluster-scoped resources // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"` // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. // +optional Verb string `json:"verb,omitempty" protobuf:"bytes,2,opt,name=verb"` // Group is the API Group of the Resource. "*" means all. // +optional Group string `json:"group,omitempty" protobuf:"bytes,3,opt,name=group"` // Version is the API Version of the Resource. "*" means all. // +optional Version string `json:"version,omitempty" protobuf:"bytes,4,opt,name=version"` // Resource is one of the existing resource types. "*" means all. // +optional Resource string `json:"resource,omitempty" protobuf:"bytes,5,opt,name=resource"` // Subresource is one of the existing resource types. "" means none. // +optional Subresource string `json:"subresource,omitempty" protobuf:"bytes,6,opt,name=subresource"` // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. // +optional Name string `json:"name,omitempty" protobuf:"bytes,7,opt,name=name"` } // NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface type NonResourceAttributes struct { // Path is the URL path of the request // +optional Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"` // Verb is the standard HTTP verb // +optional Verb string `json:"verb,omitempty" protobuf:"bytes,2,opt,name=verb"` } // SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes // and NonResourceAuthorizationAttributes must be set type SubjectAccessReviewSpec struct { // ResourceAuthorizationAttributes describes information for a resource access request // +optional ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty" protobuf:"bytes,1,opt,name=resourceAttributes"` // NonResourceAttributes describes information for a non-resource access request // +optional NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty" protobuf:"bytes,2,opt,name=nonResourceAttributes"` // User is the user you're testing for. // If you specify "User" but not "Groups", then is it interpreted as "What if User were not a member of any groups // +optional User string `json:"user,omitempty" protobuf:"bytes,3,opt,name=user"` // Groups is the groups you're testing for. // +optional Groups []string `json:"groups,omitempty" protobuf:"bytes,4,rep,name=groups"` // Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer // it needs a reflection here. // +optional Extra map[string]ExtraValue `json:"extra,omitempty" protobuf:"bytes,5,rep,name=extra"` // UID information about the requesting user. // +optional UID string `json:"uid,omitempty" protobuf:"bytes,6,opt,name=uid"` } // ExtraValue masks the value so protobuf can generate // +protobuf.nullable=true // +protobuf.options.(gogoproto.goproto_stringer)=false type ExtraValue []string func (t ExtraValue) String() string { return fmt.Sprintf("%v", []string(t)) } // SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes // and NonResourceAuthorizationAttributes must be set type SelfSubjectAccessReviewSpec struct { // ResourceAuthorizationAttributes describes information for a resource access request // +optional ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty" protobuf:"bytes,1,opt,name=resourceAttributes"` // NonResourceAttributes describes information for a non-resource access request // +optional NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty" protobuf:"bytes,2,opt,name=nonResourceAttributes"` } // SubjectAccessReviewStatus type SubjectAccessReviewStatus struct { // Allowed is required. True if the action would be allowed, false otherwise. Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"` // Denied is optional. True if the action would be denied, otherwise // false. If both allowed is false and denied is false, then the // authorizer has no opinion on whether to authorize the action. Denied // may not be true if Allowed is true. // +optional Denied bool `json:"denied,omitempty" protobuf:"varint,4,opt,name=denied"` // Reason is optional. It indicates why a request was allowed or denied. // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"` // EvaluationError is an indication that some error occurred during the authorization check. // It is entirely possible to get an error and be able to continue determine authorization status in spite of it. // For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request. // +optional EvaluationError string `json:"evaluationError,omitempty" protobuf:"bytes,3,opt,name=evaluationError"` } // +genclient // +genclient:nonNamespaced // +genclient:onlyVerbs=create // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. // The returned list of actions may be incomplete depending on the server's authorization mode, // and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, // or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to // drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. type SelfSubjectRulesReview struct { metav1.TypeMeta `json:",inline"` // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec holds information about the request being evaluated. Spec SelfSubjectRulesReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` // Status is filled in by the server and indicates the set of actions a user can perform. // +optional Status SubjectRulesReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } type SelfSubjectRulesReviewSpec struct { // Namespace to evaluate rules for. Required. Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"` } // SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on // the set of authorizers the server is configured with and any errors experienced during evaluation. // Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, // even if that list is incomplete. type SubjectRulesReviewStatus struct { // ResourceRules is the list of actions the subject is allowed to perform on resources. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete. ResourceRules []ResourceRule `json:"resourceRules" protobuf:"bytes,1,rep,name=resourceRules"` // NonResourceRules is the list of actions the subject is allowed to perform on non-resources. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete. NonResourceRules []NonResourceRule `json:"nonResourceRules" protobuf:"bytes,2,rep,name=nonResourceRules"` // Incomplete is true when the rules returned by this call are incomplete. This is most commonly // encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation. Incomplete bool `json:"incomplete" protobuf:"bytes,3,rep,name=incomplete"` // EvaluationError can appear in combination with Rules. It indicates an error occurred during // rule evaluation, such as an authorizer that doesn't support rule evaluation, and that // ResourceRules and/or NonResourceRules may be incomplete. // +optional EvaluationError string `json:"evaluationError,omitempty" protobuf:"bytes,4,opt,name=evaluationError"` } // ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, // may contain duplicates, and possibly be incomplete. type ResourceRule struct { // Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "*" means all. // +optional APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,2,rep,name=apiGroups"` // Resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. // "*/foo" represents the subresource 'foo' for all resources in the specified apiGroups. // +optional Resources []string `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"` // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. // +optional ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,4,rep,name=resourceNames"` } // NonResourceRule holds information that describes a rule for the non-resource type NonResourceRule struct { // Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, // final step in the path. "*" means all. // +optional NonResourceURLs []string `json:"nonResourceURLs,omitempty" protobuf:"bytes,2,rep,name=nonResourceURLs"` }
{ "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_Soap * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id$ */ /** * @see Zend_Soap_Wsdl_Strategy_Interface */ #require_once "Zend/Soap/Wsdl/Strategy/Interface.php"; /** * @see Zend_Soap_Wsdl_Strategy_Abstract */ #require_once "Zend/Soap/Wsdl/Strategy/Abstract.php"; /** @see Zend_Xml_Security */ #require_once "Zend/Xml/Security.php"; /** * Zend_Soap_Wsdl * * @category Zend * @package Zend_Soap */ class Zend_Soap_Wsdl { /** * @var object DomDocument Instance */ private $_dom; /** * @var object WSDL Root XML_Tree_Node */ private $_wsdl; /** * @var string URI where the WSDL will be available */ private $_uri; /** * @var DOMElement */ private $_schema = null; /** * Types defined on schema * * @var array */ private $_includedTypes = array(); /** * Strategy for detection of complex types */ protected $_strategy = null; /** * Constructor * * @param string $name Name of the Web Service being Described * @param string $uri URI where the WSDL will be available * @param boolean|string|Zend_Soap_Wsdl_Strategy_Interface $strategy */ public function __construct($name, $uri, $strategy = true) { if ($uri instanceof Zend_Uri_Http) { $uri = $uri->getUri(); } $this->_uri = $uri; /** * @todo change DomDocument object creation from cparsing to construxting using API * It also should authomatically escape $name and $uri values if necessary */ $wsdl = "<?xml version='1.0' ?> <definitions name='$name' targetNamespace='$uri' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:tns='$uri' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'></definitions>"; $this->_dom = new DOMDocument(); if (!$this->_dom = Zend_Xml_Security::scan($wsdl, $this->_dom)) { #require_once 'Zend/Server/Exception.php'; throw new Zend_Server_Exception('Unable to create DomDocument'); } $this->_wsdl = $this->_dom->documentElement; $this->setComplexTypeStrategy($strategy); } /** * Set a new uri for this WSDL * * @param string|Zend_Uri_Http $uri * @return Zend_Server_Wsdl */ public function setUri($uri) { if ($uri instanceof Zend_Uri_Http) { $uri = $uri->getUri(); } $oldUri = $this->_uri; $this->_uri = $uri; if($this->_dom !== null) { // @todo: This is the worst hack ever, but its needed due to design and non BC issues of WSDL generation $xml = $this->_dom->saveXML(); $xml = str_replace($oldUri, $uri, $xml); $this->_dom = new DOMDocument(); $this->_dom = Zend_Xml_Security::scan($xml, $this->_dom); } return $this; } /** * Set a strategy for complex type detection and handling * * @todo Boolean is for backwards compability with extractComplexType object var. Remove it in later versions. * @param boolean|string|Zend_Soap_Wsdl_Strategy_Interface $strategy * @return Zend_Soap_Wsdl */ public function setComplexTypeStrategy($strategy) { if($strategy === true) { #require_once "Zend/Soap/Wsdl/Strategy/DefaultComplexType.php"; $strategy = new Zend_Soap_Wsdl_Strategy_DefaultComplexType(); } else if($strategy === false) { #require_once "Zend/Soap/Wsdl/Strategy/AnyType.php"; $strategy = new Zend_Soap_Wsdl_Strategy_AnyType(); } else if(is_string($strategy)) { if(class_exists($strategy)) { $strategy = new $strategy(); } else { #require_once "Zend/Soap/Wsdl/Exception.php"; throw new Zend_Soap_Wsdl_Exception( sprintf("Strategy with name '%s does not exist.", $strategy )); } } if(!($strategy instanceof Zend_Soap_Wsdl_Strategy_Interface)) { #require_once "Zend/Soap/Wsdl/Exception.php"; throw new Zend_Soap_Wsdl_Exception("Set a strategy that is not of type 'Zend_Soap_Wsdl_Strategy_Interface'"); } $this->_strategy = $strategy; return $this; } /** * Get the current complex type strategy * * @return Zend_Soap_Wsdl_Strategy_Interface */ public function getComplexTypeStrategy() { return $this->_strategy; } /** * Add a {@link http://www.w3.org/TR/wsdl#_messages message} element to the WSDL * * @param string $name Name for the {@link http://www.w3.org/TR/wsdl#_messages message} * @param array $parts An array of {@link http://www.w3.org/TR/wsdl#_message parts} * The array is constructed like: 'name of part' => 'part xml schema data type' * or 'name of part' => array('type' => 'part xml schema type') * or 'name of part' => array('element' => 'part xml element name') * @return object The new message's XML_Tree_Node for use in {@link function addDocumentation} */ public function addMessage($name, $parts) { $message = $this->_dom->createElement('message'); $message->setAttribute('name', $name); if (sizeof($parts) > 0) { foreach ($parts as $name => $type) { $part = $this->_dom->createElement('part'); $part->setAttribute('name', $name); if (is_array($type)) { foreach ($type as $key => $value) { $part->setAttribute($key, $value); } } else { $part->setAttribute('type', $type); } $message->appendChild($part); } } $this->_wsdl->appendChild($message); return $message; } /** * Add a {@link http://www.w3.org/TR/wsdl#_porttypes portType} element to the WSDL * * @param string $name portType element's name * @return object The new portType's XML_Tree_Node for use in {@link function addPortOperation} and {@link function addDocumentation} */ public function addPortType($name) { $portType = $this->_dom->createElement('portType'); $portType->setAttribute('name', $name); $this->_wsdl->appendChild($portType); return $portType; } /** * Add an {@link http://www.w3.org/TR/wsdl#_request-response operation} element to a portType element * * @param object $portType a portType XML_Tree_Node, from {@link function addPortType} * @param string $name Operation name * @param string $input Input Message * @param string $output Output Message * @param string $fault Fault Message * @return object The new operation's XML_Tree_Node for use in {@link function addDocumentation} */ public function addPortOperation($portType, $name, $input = false, $output = false, $fault = false) { $operation = $this->_dom->createElement('operation'); $operation->setAttribute('name', $name); if (is_string($input) && (strlen(trim($input)) >= 1)) { $node = $this->_dom->createElement('input'); $node->setAttribute('message', $input); $operation->appendChild($node); } if (is_string($output) && (strlen(trim($output)) >= 1)) { $node= $this->_dom->createElement('output'); $node->setAttribute('message', $output); $operation->appendChild($node); } if (is_string($fault) && (strlen(trim($fault)) >= 1)) { $node = $this->_dom->createElement('fault'); $node->setAttribute('message', $fault); $operation->appendChild($node); } $portType->appendChild($operation); return $operation; } /** * Add a {@link http://www.w3.org/TR/wsdl#_bindings binding} element to WSDL * * @param string $name Name of the Binding * @param string $type name of the portType to bind * @return object The new binding's XML_Tree_Node for use with {@link function addBindingOperation} and {@link function addDocumentation} */ public function addBinding($name, $portType) { $binding = $this->_dom->createElement('binding'); $binding->setAttribute('name', $name); $binding->setAttribute('type', $portType); $this->_wsdl->appendChild($binding); return $binding; } /** * Add an operation to a binding element * * @param object $binding A binding XML_Tree_Node returned by {@link function addBinding} * @param array $input An array of attributes for the input element, allowed keys are: 'use', 'namespace', 'encodingStyle'. {@link http://www.w3.org/TR/wsdl#_soap:body More Information} * @param array $output An array of attributes for the output element, allowed keys are: 'use', 'namespace', 'encodingStyle'. {@link http://www.w3.org/TR/wsdl#_soap:body More Information} * @param array $fault An array of attributes for the fault element, allowed keys are: 'name', 'use', 'namespace', 'encodingStyle'. {@link http://www.w3.org/TR/wsdl#_soap:body More Information} * @return object The new Operation's XML_Tree_Node for use with {@link function addSoapOperation} and {@link function addDocumentation} */ public function addBindingOperation($binding, $name, $input = false, $output = false, $fault = false) { $operation = $this->_dom->createElement('operation'); $operation->setAttribute('name', $name); if (is_array($input)) { $node = $this->_dom->createElement('input'); $soap_node = $this->_dom->createElement('soap:body'); foreach ($input as $name => $value) { $soap_node->setAttribute($name, $value); } $node->appendChild($soap_node); $operation->appendChild($node); } if (is_array($output)) { $node = $this->_dom->createElement('output'); $soap_node = $this->_dom->createElement('soap:body'); foreach ($output as $name => $value) { $soap_node->setAttribute($name, $value); } $node->appendChild($soap_node); $operation->appendChild($node); } if (is_array($fault)) { $node = $this->_dom->createElement('fault'); /** * Note. Do we really need name attribute to be also set at wsdl:fault node??? * W3C standard doesn't mention it (http://www.w3.org/TR/wsdl#_soap:fault) * But some real world WSDLs use it, so it may be required for compatibility reasons. */ if (isset($fault['name'])) { $node->setAttribute('name', $fault['name']); } $soap_node = $this->_dom->createElement('soap:fault'); foreach ($fault as $name => $value) { $soap_node->setAttribute($name, $value); } $node->appendChild($soap_node); $operation->appendChild($node); } $binding->appendChild($operation); return $operation; } /** * Add a {@link http://www.w3.org/TR/wsdl#_soap:binding SOAP binding} element to a Binding element * * @param object $binding A binding XML_Tree_Node returned by {@link function addBinding} * @param string $style binding style, possible values are "rpc" (the default) and "document" * @param string $transport Transport method (defaults to HTTP) * @return boolean */ public function addSoapBinding($binding, $style = 'document', $transport = 'http://schemas.xmlsoap.org/soap/http') { $soap_binding = $this->_dom->createElement('soap:binding'); $soap_binding->setAttribute('style', $style); $soap_binding->setAttribute('transport', $transport); $binding->appendChild($soap_binding); return $soap_binding; } /** * Add a {@link http://www.w3.org/TR/wsdl#_soap:operation SOAP operation} to an operation element * * @param object $operation An operation XML_Tree_Node returned by {@link function addBindingOperation} * @param string $soap_action SOAP Action * @return boolean */ public function addSoapOperation($binding, $soap_action) { if ($soap_action instanceof Zend_Uri_Http) { $soap_action = $soap_action->getUri(); } $soap_operation = $this->_dom->createElement('soap:operation'); $soap_operation->setAttribute('soapAction', $soap_action); $binding->insertBefore($soap_operation, $binding->firstChild); return $soap_operation; } /** * Add a {@link http://www.w3.org/TR/wsdl#_services service} element to the WSDL * * @param string $name Service Name * @param string $port_name Name of the port for the service * @param string $binding Binding for the port * @param string $location SOAP Address for the service * @return object The new service's XML_Tree_Node for use with {@link function addDocumentation} */ public function addService($name, $port_name, $binding, $location) { if ($location instanceof Zend_Uri_Http) { $location = $location->getUri(); } $service = $this->_dom->createElement('service'); $service->setAttribute('name', $name); $port = $this->_dom->createElement('port'); $port->setAttribute('name', $port_name); $port->setAttribute('binding', $binding); $soap_address = $this->_dom->createElement('soap:address'); $soap_address->setAttribute('location', $location); $port->appendChild($soap_address); $service->appendChild($port); $this->_wsdl->appendChild($service); return $service; } /** * Add a documentation element to any element in the WSDL. * * Note that the WSDL {@link http://www.w3.org/TR/wsdl#_documentation specification} uses 'document', * but the WSDL {@link http://schemas.xmlsoap.org/wsdl/ schema} uses 'documentation' instead. * The {@link http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#WSDL_documentation_Element WS-I Basic Profile 1.1} recommends using 'documentation'. * * @param object $input_node An XML_Tree_Node returned by another method to add the documentation to * @param string $documentation Human readable documentation for the node * @return DOMElement The documentation element */ public function addDocumentation($input_node, $documentation) { if ($input_node === $this) { $node = $this->_dom->documentElement; } else { $node = $input_node; } $doc = $this->_dom->createElement('documentation'); $doc_cdata = $this->_dom->createTextNode(str_replace(array("\r\n", "\r"), "\n", $documentation)); $doc->appendChild($doc_cdata); if($node->hasChildNodes()) { $node->insertBefore($doc, $node->firstChild); } else { $node->appendChild($doc); } return $doc; } /** * Add WSDL Types element * * @param object $types A DomDocument|DomNode|DomElement|DomDocumentFragment with all the XML Schema types defined in it */ public function addTypes($types) { if ($types instanceof DomDocument) { $dom = $this->_dom->importNode($types->documentElement); $this->_wsdl->appendChild($types->documentElement); } elseif ($types instanceof DomNode || $types instanceof DomElement || $types instanceof DomDocumentFragment ) { $dom = $this->_dom->importNode($types); $this->_wsdl->appendChild($dom); } } /** * Add a complex type name that is part of this WSDL and can be used in signatures. * * @param string $type * @return Zend_Soap_Wsdl */ public function addType($type) { if(!in_array($type, $this->_includedTypes)) { $this->_includedTypes[] = $type; } return $this; } /** * Return an array of all currently included complex types * * @return array */ public function getTypes() { return $this->_includedTypes; } /** * Return the Schema node of the WSDL * * @return DOMElement */ public function getSchema() { if($this->_schema == null) { $this->addSchemaTypeSection(); } return $this->_schema; } /** * Return the WSDL as XML * * @return string WSDL as XML */ public function toXML() { return $this->_dom->saveXML(); } /** * Return DOM Document * * @return object DomDocum ent */ public function toDomDocument() { return $this->_dom; } /** * Echo the WSDL as XML * * @return boolean */ public function dump($filename = false) { if (!$filename) { echo $this->toXML(); return true; } else { return file_put_contents($filename, $this->toXML()); } } /** * Returns an XSD Type for the given PHP type * * @param string $type PHP Type to get the XSD type for * @return string */ public function getType($type) { switch (strtolower($type)) { case 'string': case 'str': return 'xsd:string'; case 'long': return 'xsd:long'; case 'int': case 'integer': return 'xsd:int'; case 'float': return 'xsd:float'; case 'double': return 'xsd:double'; case 'boolean': case 'bool': return 'xsd:boolean'; case 'array': return 'soap-enc:Array'; case 'object': return 'xsd:struct'; case 'mixed': return 'xsd:anyType'; case 'void': return ''; default: // delegate retrieval of complex type to current strategy return $this->addComplexType($type); } } /** * This function makes sure a complex types section and schema additions are set. * * @return Zend_Soap_Wsdl */ public function addSchemaTypeSection() { if ($this->_schema === null) { $this->_schema = $this->_dom->createElement('xsd:schema'); $this->_schema->setAttribute('targetNamespace', $this->_uri); $types = $this->_dom->createElement('types'); $types->appendChild($this->_schema); $this->_wsdl->appendChild($types); } return $this; } /** * Add a {@link http://www.w3.org/TR/wsdl#_types types} data type definition * * @param string $type Name of the class to be specified * @return string XSD Type for the given PHP type */ public function addComplexType($type) { if (in_array($type, $this->getTypes())) { return "tns:$type"; } $this->addSchemaTypeSection(); $strategy = $this->getComplexTypeStrategy(); $strategy->setContext($this); // delegates the detection of a complex type to the current strategy return $strategy->addComplexType($type); } /** * Parse an xsd:element represented as an array into a DOMElement. * * @param array $element an xsd:element represented as an array * @return DOMElement parsed element */ private function _parseElement($element) { if (!is_array($element)) { #require_once "Zend/Soap/Wsdl/Exception.php"; throw new Zend_Soap_Wsdl_Exception("The 'element' parameter needs to be an associative array."); } $elementXml = $this->_dom->createElement('xsd:element'); foreach ($element as $key => $value) { if (in_array($key, array('sequence', 'all', 'choice'))) { if (is_array($value)) { $complexType = $this->_dom->createElement('xsd:complexType'); if (count($value) > 0) { $container = $this->_dom->createElement('xsd:' . $key); foreach ($value as $subelement) { $subelementXml = $this->_parseElement($subelement); $container->appendChild($subelementXml); } $complexType->appendChild($container); } $elementXml->appendChild($complexType); } } else { $elementXml->setAttribute($key, $value); } } return $elementXml; } /** * Add an xsd:element represented as an array to the schema. * * Array keys represent attribute names and values their respective value. * The 'sequence', 'all' and 'choice' keys must have an array of elements as their value, * to add them to a nested complexType. * * Example: array( 'name' => 'MyElement', * 'sequence' => array( array('name' => 'myString', 'type' => 'string'), * array('name' => 'myInteger', 'type' => 'int') ) ); * Resulting XML: <xsd:element name="MyElement"><xsd:complexType><xsd:sequence> * <xsd:element name="myString" type="string"/> * <xsd:element name="myInteger" type="int"/> * </xsd:sequence></xsd:complexType></xsd:element> * * @param array $element an xsd:element represented as an array * @return string xsd:element for the given element array */ public function addElement($element) { $schema = $this->getSchema(); $elementXml = $this->_parseElement($element); $schema->appendChild($elementXml); return 'tns:' . $element['name']; } }
{ "pile_set_name": "Github" }
/* * Copyright 2010 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Alex Deucher */ #ifndef __EVERGREEN_REG_H__ #define __EVERGREEN_REG_H__ /* trinity */ #define TN_SMC_IND_INDEX_0 0x200 #define TN_SMC_IND_DATA_0 0x204 /* evergreen */ #define EVERGREEN_PIF_PHY0_INDEX 0x8 #define EVERGREEN_PIF_PHY0_DATA 0xc #define EVERGREEN_PIF_PHY1_INDEX 0x10 #define EVERGREEN_PIF_PHY1_DATA 0x14 #define EVERGREEN_MM_INDEX_HI 0x18 #define EVERGREEN_VGA_MEMORY_BASE_ADDRESS 0x310 #define EVERGREEN_VGA_MEMORY_BASE_ADDRESS_HIGH 0x324 #define EVERGREEN_D3VGA_CONTROL 0x3e0 #define EVERGREEN_D4VGA_CONTROL 0x3e4 #define EVERGREEN_D5VGA_CONTROL 0x3e8 #define EVERGREEN_D6VGA_CONTROL 0x3ec #define EVERGREEN_P1PLL_SS_CNTL 0x414 #define EVERGREEN_P2PLL_SS_CNTL 0x454 # define EVERGREEN_PxPLL_SS_EN (1 << 12) #define EVERGREEN_AUDIO_PLL1_MUL 0x5b0 #define EVERGREEN_AUDIO_PLL1_DIV 0x5b4 #define EVERGREEN_AUDIO_PLL1_UNK 0x5bc #define EVERGREEN_CG_IND_ADDR 0x8f8 #define EVERGREEN_CG_IND_DATA 0x8fc #define EVERGREEN_AUDIO_ENABLE 0x5e78 #define EVERGREEN_AUDIO_VENDOR_ID 0x5ec0 /* GRPH blocks at 0x6800, 0x7400, 0x10000, 0x10c00, 0x11800, 0x12400 */ #define EVERGREEN_GRPH_ENABLE 0x6800 #define EVERGREEN_GRPH_CONTROL 0x6804 # define EVERGREEN_GRPH_DEPTH(x) (((x) & 0x3) << 0) # define EVERGREEN_GRPH_DEPTH_8BPP 0 # define EVERGREEN_GRPH_DEPTH_16BPP 1 # define EVERGREEN_GRPH_DEPTH_32BPP 2 # define EVERGREEN_GRPH_NUM_BANKS(x) (((x) & 0x3) << 2) # define EVERGREEN_ADDR_SURF_2_BANK 0 # define EVERGREEN_ADDR_SURF_4_BANK 1 # define EVERGREEN_ADDR_SURF_8_BANK 2 # define EVERGREEN_ADDR_SURF_16_BANK 3 # define EVERGREEN_GRPH_Z(x) (((x) & 0x3) << 4) # define EVERGREEN_GRPH_BANK_WIDTH(x) (((x) & 0x3) << 6) # define EVERGREEN_ADDR_SURF_BANK_WIDTH_1 0 # define EVERGREEN_ADDR_SURF_BANK_WIDTH_2 1 # define EVERGREEN_ADDR_SURF_BANK_WIDTH_4 2 # define EVERGREEN_ADDR_SURF_BANK_WIDTH_8 3 # define EVERGREEN_GRPH_FORMAT(x) (((x) & 0x7) << 8) /* 8 BPP */ # define EVERGREEN_GRPH_FORMAT_INDEXED 0 /* 16 BPP */ # define EVERGREEN_GRPH_FORMAT_ARGB1555 0 # define EVERGREEN_GRPH_FORMAT_ARGB565 1 # define EVERGREEN_GRPH_FORMAT_ARGB4444 2 # define EVERGREEN_GRPH_FORMAT_AI88 3 # define EVERGREEN_GRPH_FORMAT_MONO16 4 # define EVERGREEN_GRPH_FORMAT_BGRA5551 5 /* 32 BPP */ # define EVERGREEN_GRPH_FORMAT_ARGB8888 0 # define EVERGREEN_GRPH_FORMAT_ARGB2101010 1 # define EVERGREEN_GRPH_FORMAT_32BPP_DIG 2 # define EVERGREEN_GRPH_FORMAT_8B_ARGB2101010 3 # define EVERGREEN_GRPH_FORMAT_BGRA1010102 4 # define EVERGREEN_GRPH_FORMAT_8B_BGRA1010102 5 # define EVERGREEN_GRPH_FORMAT_RGB111110 6 # define EVERGREEN_GRPH_FORMAT_BGR101111 7 # define EVERGREEN_GRPH_BANK_HEIGHT(x) (((x) & 0x3) << 11) # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_1 0 # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_2 1 # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_4 2 # define EVERGREEN_ADDR_SURF_BANK_HEIGHT_8 3 # define EVERGREEN_GRPH_TILE_SPLIT(x) (((x) & 0x7) << 13) # define EVERGREEN_ADDR_SURF_TILE_SPLIT_64B 0 # define EVERGREEN_ADDR_SURF_TILE_SPLIT_128B 1 # define EVERGREEN_ADDR_SURF_TILE_SPLIT_256B 2 # define EVERGREEN_ADDR_SURF_TILE_SPLIT_512B 3 # define EVERGREEN_ADDR_SURF_TILE_SPLIT_1KB 4 # define EVERGREEN_ADDR_SURF_TILE_SPLIT_2KB 5 # define EVERGREEN_ADDR_SURF_TILE_SPLIT_4KB 6 # define EVERGREEN_GRPH_MACRO_TILE_ASPECT(x) (((x) & 0x3) << 18) # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_1 0 # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_2 1 # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_4 2 # define EVERGREEN_ADDR_SURF_MACRO_TILE_ASPECT_8 3 # define EVERGREEN_GRPH_ARRAY_MODE(x) (((x) & 0x7) << 20) # define EVERGREEN_GRPH_ARRAY_LINEAR_GENERAL 0 # define EVERGREEN_GRPH_ARRAY_LINEAR_ALIGNED 1 # define EVERGREEN_GRPH_ARRAY_1D_TILED_THIN1 2 # define EVERGREEN_GRPH_ARRAY_2D_TILED_THIN1 4 #define EVERGREEN_GRPH_LUT_10BIT_BYPASS_CONTROL 0x6808 # define EVERGREEN_LUT_10BIT_BYPASS_EN (1 << 8) #define EVERGREEN_GRPH_SWAP_CONTROL 0x680c # define EVERGREEN_GRPH_ENDIAN_SWAP(x) (((x) & 0x3) << 0) # define EVERGREEN_GRPH_ENDIAN_NONE 0 # define EVERGREEN_GRPH_ENDIAN_8IN16 1 # define EVERGREEN_GRPH_ENDIAN_8IN32 2 # define EVERGREEN_GRPH_ENDIAN_8IN64 3 # define EVERGREEN_GRPH_RED_CROSSBAR(x) (((x) & 0x3) << 4) # define EVERGREEN_GRPH_RED_SEL_R 0 # define EVERGREEN_GRPH_RED_SEL_G 1 # define EVERGREEN_GRPH_RED_SEL_B 2 # define EVERGREEN_GRPH_RED_SEL_A 3 # define EVERGREEN_GRPH_GREEN_CROSSBAR(x) (((x) & 0x3) << 6) # define EVERGREEN_GRPH_GREEN_SEL_G 0 # define EVERGREEN_GRPH_GREEN_SEL_B 1 # define EVERGREEN_GRPH_GREEN_SEL_A 2 # define EVERGREEN_GRPH_GREEN_SEL_R 3 # define EVERGREEN_GRPH_BLUE_CROSSBAR(x) (((x) & 0x3) << 8) # define EVERGREEN_GRPH_BLUE_SEL_B 0 # define EVERGREEN_GRPH_BLUE_SEL_A 1 # define EVERGREEN_GRPH_BLUE_SEL_R 2 # define EVERGREEN_GRPH_BLUE_SEL_G 3 # define EVERGREEN_GRPH_ALPHA_CROSSBAR(x) (((x) & 0x3) << 10) # define EVERGREEN_GRPH_ALPHA_SEL_A 0 # define EVERGREEN_GRPH_ALPHA_SEL_R 1 # define EVERGREEN_GRPH_ALPHA_SEL_G 2 # define EVERGREEN_GRPH_ALPHA_SEL_B 3 #define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS 0x6810 #define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS 0x6814 # define EVERGREEN_GRPH_DFQ_ENABLE (1 << 0) # define EVERGREEN_GRPH_SURFACE_ADDRESS_MASK 0xffffff00 #define EVERGREEN_GRPH_PITCH 0x6818 #define EVERGREEN_GRPH_PRIMARY_SURFACE_ADDRESS_HIGH 0x681c #define EVERGREEN_GRPH_SECONDARY_SURFACE_ADDRESS_HIGH 0x6820 #define EVERGREEN_GRPH_SURFACE_OFFSET_X 0x6824 #define EVERGREEN_GRPH_SURFACE_OFFSET_Y 0x6828 #define EVERGREEN_GRPH_X_START 0x682c #define EVERGREEN_GRPH_Y_START 0x6830 #define EVERGREEN_GRPH_X_END 0x6834 #define EVERGREEN_GRPH_Y_END 0x6838 #define EVERGREEN_GRPH_UPDATE 0x6844 # define EVERGREEN_GRPH_SURFACE_UPDATE_PENDING (1 << 2) # define EVERGREEN_GRPH_UPDATE_LOCK (1 << 16) #define EVERGREEN_GRPH_FLIP_CONTROL 0x6848 # define EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN (1 << 0) /* CUR blocks at 0x6998, 0x7598, 0x10198, 0x10d98, 0x11998, 0x12598 */ #define EVERGREEN_CUR_CONTROL 0x6998 # define EVERGREEN_CURSOR_EN (1 << 0) # define EVERGREEN_CURSOR_MODE(x) (((x) & 0x3) << 8) # define EVERGREEN_CURSOR_MONO 0 # define EVERGREEN_CURSOR_24_1 1 # define EVERGREEN_CURSOR_24_8_PRE_MULT 2 # define EVERGREEN_CURSOR_24_8_UNPRE_MULT 3 # define EVERGREEN_CURSOR_2X_MAGNIFY (1 << 16) # define EVERGREEN_CURSOR_FORCE_MC_ON (1 << 20) # define EVERGREEN_CURSOR_URGENT_CONTROL(x) (((x) & 0x7) << 24) # define EVERGREEN_CURSOR_URGENT_ALWAYS 0 # define EVERGREEN_CURSOR_URGENT_1_8 1 # define EVERGREEN_CURSOR_URGENT_1_4 2 # define EVERGREEN_CURSOR_URGENT_3_8 3 # define EVERGREEN_CURSOR_URGENT_1_2 4 #define EVERGREEN_CUR_SURFACE_ADDRESS 0x699c # define EVERGREEN_CUR_SURFACE_ADDRESS_MASK 0xfffff000 #define EVERGREEN_CUR_SIZE 0x69a0 #define EVERGREEN_CUR_SURFACE_ADDRESS_HIGH 0x69a4 #define EVERGREEN_CUR_POSITION 0x69a8 #define EVERGREEN_CUR_HOT_SPOT 0x69ac #define EVERGREEN_CUR_COLOR1 0x69b0 #define EVERGREEN_CUR_COLOR2 0x69b4 #define EVERGREEN_CUR_UPDATE 0x69b8 # define EVERGREEN_CURSOR_UPDATE_PENDING (1 << 0) # define EVERGREEN_CURSOR_UPDATE_TAKEN (1 << 1) # define EVERGREEN_CURSOR_UPDATE_LOCK (1 << 16) # define EVERGREEN_CURSOR_DISABLE_MULTIPLE_UPDATE (1 << 24) /* LUT blocks at 0x69e0, 0x75e0, 0x101e0, 0x10de0, 0x119e0, 0x125e0 */ #define EVERGREEN_DC_LUT_RW_MODE 0x69e0 #define EVERGREEN_DC_LUT_RW_INDEX 0x69e4 #define EVERGREEN_DC_LUT_SEQ_COLOR 0x69e8 #define EVERGREEN_DC_LUT_PWL_DATA 0x69ec #define EVERGREEN_DC_LUT_30_COLOR 0x69f0 #define EVERGREEN_DC_LUT_VGA_ACCESS_ENABLE 0x69f4 #define EVERGREEN_DC_LUT_WRITE_EN_MASK 0x69f8 #define EVERGREEN_DC_LUT_AUTOFILL 0x69fc #define EVERGREEN_DC_LUT_CONTROL 0x6a00 #define EVERGREEN_DC_LUT_BLACK_OFFSET_BLUE 0x6a04 #define EVERGREEN_DC_LUT_BLACK_OFFSET_GREEN 0x6a08 #define EVERGREEN_DC_LUT_BLACK_OFFSET_RED 0x6a0c #define EVERGREEN_DC_LUT_WHITE_OFFSET_BLUE 0x6a10 #define EVERGREEN_DC_LUT_WHITE_OFFSET_GREEN 0x6a14 #define EVERGREEN_DC_LUT_WHITE_OFFSET_RED 0x6a18 #define EVERGREEN_DATA_FORMAT 0x6b00 # define EVERGREEN_INTERLEAVE_EN (1 << 0) #define EVERGREEN_DESKTOP_HEIGHT 0x6b04 #define EVERGREEN_VLINE_START_END 0x6b08 #define EVERGREEN_VLINE_STATUS 0x6bb8 # define EVERGREEN_VLINE_STAT (1 << 12) #define EVERGREEN_VIEWPORT_START 0x6d70 #define EVERGREEN_VIEWPORT_SIZE 0x6d74 /* display controller offsets used for crtc/cur/lut/grph/viewport/etc. */ #define EVERGREEN_CRTC0_REGISTER_OFFSET (0x6df0 - 0x6df0) #define EVERGREEN_CRTC1_REGISTER_OFFSET (0x79f0 - 0x6df0) #define EVERGREEN_CRTC2_REGISTER_OFFSET (0x105f0 - 0x6df0) #define EVERGREEN_CRTC3_REGISTER_OFFSET (0x111f0 - 0x6df0) #define EVERGREEN_CRTC4_REGISTER_OFFSET (0x11df0 - 0x6df0) #define EVERGREEN_CRTC5_REGISTER_OFFSET (0x129f0 - 0x6df0) /* CRTC blocks at 0x6df0, 0x79f0, 0x105f0, 0x111f0, 0x11df0, 0x129f0 */ #define EVERGREEN_CRTC_V_BLANK_START_END 0x6e34 #define EVERGREEN_CRTC_CONTROL 0x6e70 # define EVERGREEN_CRTC_MASTER_EN (1 << 0) # define EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE (1 << 24) #define EVERGREEN_CRTC_BLANK_CONTROL 0x6e74 # define EVERGREEN_CRTC_BLANK_DATA_EN (1 << 8) #define EVERGREEN_CRTC_STATUS 0x6e8c # define EVERGREEN_CRTC_V_BLANK (1 << 0) #define EVERGREEN_CRTC_STATUS_POSITION 0x6e90 #define EVERGREEN_CRTC_STATUS_HV_COUNT 0x6ea0 #define EVERGREEN_CRTC_UPDATE_LOCK 0x6ed4 #define EVERGREEN_MASTER_UPDATE_LOCK 0x6ef4 #define EVERGREEN_MASTER_UPDATE_MODE 0x6ef8 #define EVERGREEN_DC_GPIO_HPD_MASK 0x64b0 #define EVERGREEN_DC_GPIO_HPD_A 0x64b4 #define EVERGREEN_DC_GPIO_HPD_EN 0x64b8 #define EVERGREEN_DC_GPIO_HPD_Y 0x64bc /* HDMI blocks at 0x7030, 0x7c30, 0x10830, 0x11430, 0x12030, 0x12c30 */ #define EVERGREEN_HDMI_BASE 0x7030 /*DIG block*/ #define NI_DIG0_REGISTER_OFFSET (0x7000 - 0x7000) #define NI_DIG1_REGISTER_OFFSET (0x7C00 - 0x7000) #define NI_DIG2_REGISTER_OFFSET (0x10800 - 0x7000) #define NI_DIG3_REGISTER_OFFSET (0x11400 - 0x7000) #define NI_DIG4_REGISTER_OFFSET (0x12000 - 0x7000) #define NI_DIG5_REGISTER_OFFSET (0x12C00 - 0x7000) #define NI_DIG_FE_CNTL 0x7000 # define NI_DIG_FE_CNTL_SOURCE_SELECT(x) ((x) & 0x3) # define NI_DIG_FE_CNTL_SYMCLK_FE_ON (1<<24) #define NI_DIG_BE_CNTL 0x7140 # define NI_DIG_BE_CNTL_FE_SOURCE_SELECT(x) (((x) >> 8 ) & 0x3F) # define NI_DIG_FE_CNTL_MODE(x) (((x) >> 16) & 0x7 ) #define NI_DIG_BE_EN_CNTL 0x7144 # define NI_DIG_BE_EN_CNTL_ENABLE (1 << 0) # define NI_DIG_BE_EN_CNTL_SYMBCLK_ON (1 << 8) # define NI_DIG_BE_DPSST 0 /* Display Port block */ #define EVERGREEN_DP0_REGISTER_OFFSET (0x730C - 0x730C) #define EVERGREEN_DP1_REGISTER_OFFSET (0x7F0C - 0x730C) #define EVERGREEN_DP2_REGISTER_OFFSET (0x10B0C - 0x730C) #define EVERGREEN_DP3_REGISTER_OFFSET (0x1170C - 0x730C) #define EVERGREEN_DP4_REGISTER_OFFSET (0x1230C - 0x730C) #define EVERGREEN_DP5_REGISTER_OFFSET (0x12F0C - 0x730C) #define EVERGREEN_DP_VID_STREAM_CNTL 0x730C # define EVERGREEN_DP_VID_STREAM_CNTL_ENABLE (1 << 0) # define EVERGREEN_DP_VID_STREAM_STATUS (1 <<16) #define EVERGREEN_DP_STEER_FIFO 0x7310 # define EVERGREEN_DP_STEER_FIFO_RESET (1 << 0) #define EVERGREEN_DP_SEC_CNTL 0x7280 # define EVERGREEN_DP_SEC_STREAM_ENABLE (1 << 0) # define EVERGREEN_DP_SEC_ASP_ENABLE (1 << 4) # define EVERGREEN_DP_SEC_ATP_ENABLE (1 << 8) # define EVERGREEN_DP_SEC_AIP_ENABLE (1 << 12) # define EVERGREEN_DP_SEC_GSP_ENABLE (1 << 20) # define EVERGREEN_DP_SEC_AVI_ENABLE (1 << 24) # define EVERGREEN_DP_SEC_MPG_ENABLE (1 << 28) #define EVERGREEN_DP_SEC_TIMESTAMP 0x72a4 # define EVERGREEN_DP_SEC_TIMESTAMP_MODE(x) (((x) & 0x3) << 0) #define EVERGREEN_DP_SEC_AUD_N 0x7294 # define EVERGREEN_DP_SEC_N_BASE_MULTIPLE(x) (((x) & 0xf) << 24) # define EVERGREEN_DP_SEC_SS_EN (1 << 28) /*DCIO_UNIPHY block*/ #define NI_DCIO_UNIPHY0_UNIPHY_TX_CONTROL1 (0x6600 -0x6600) #define NI_DCIO_UNIPHY1_UNIPHY_TX_CONTROL1 (0x6640 -0x6600) #define NI_DCIO_UNIPHY2_UNIPHY_TX_CONTROL1 (0x6680 - 0x6600) #define NI_DCIO_UNIPHY3_UNIPHY_TX_CONTROL1 (0x66C0 - 0x6600) #define NI_DCIO_UNIPHY4_UNIPHY_TX_CONTROL1 (0x6700 - 0x6600) #define NI_DCIO_UNIPHY5_UNIPHY_TX_CONTROL1 (0x6740 - 0x6600) #define NI_DCIO_UNIPHY0_PLL_CONTROL1 0x6618 # define NI_DCIO_UNIPHY0_PLL_CONTROL1_ENABLE (1 << 0) #endif
{ "pile_set_name": "Github" }
--- name: Lint Docker # yamllint disable-line rule:truthy on: pull_request: paths-ignore: - '**/*.json' - '**/*.md' - '**/*.txt' - '.git*' - '.yamllint' - 'LICENSE' push: paths: - '**/*.y?ml' - '.github/workflows/lint-docker.yml' - 'Dockerfile' jobs: Hadolint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: brpaz/hadolint-action@master with: dockerfile: Dockerfile DockerCompose: runs-on: ubuntu-latest needs: Hadolint steps: - uses: actions/checkout@v1 - name: Validates Docker Compose files run: | find . -name docker-compose.yml -print | while read file; do docker-compose -f $file config -q || exit 1 done
{ "pile_set_name": "Github" }
/* ********** MIDI MODULE SPECIFIC SCRIPTING ********************* */ /* MIDI Modules have specific methods that can be used to send MIDI events such as noteOn, noteOff, controlChange and sysEx messages from Script. If you want to send a MIDI event from this script, you can do the following : local.sendNoteOn(1, 12, 127); //This will send a NoteOn Event on channel 1, pitch 12, velocity 127 local.sendNoteOff(1, 12); //This will send a NoteOff Event on chanenl 1, pitch 12 local.sendCC(3, 20, 65); //This will send a ControlChange on channel 3, number 20, value 65 local.sendSysEx(15,20,115,10); //This will send 4 bytes as a SysEx message local.sendPitchWheel (3, 2000); local.sendChannelPressure (1, 67); local.sendAfterTouch (3, 20, 65); */ /* You can intercept MIDI Events with the functions below */ function noteOnEvent(channel, pitch, velocity) { script.log("Note on received "+channel+", "+pitch+", "+velocity); } function noteOffEvent(channel, pitch, velocity) { script.log("Note off received "+channel+", "+pitch+", "+velocity); } function ccEvent(channel, number, value) { script.log("ControlChange received "+channel+", "+number+", "+value); } function ccEvent(channel, number, value) { script.log("ControlChange received "+channel+", "+number+", "+value); } function sysExEvent(data) { script.log("Sysex Message received, "+data.length+" bytes :"); for(var i=0; i < data.length; i++) { script.log(" > "+data[i]); } } function pitchWheelEvent(channel, value) { script.log("PitchWheel received "+channel+", "+value); } function channelPressureEvent(channel, value) { script.log("Channel Pressure received "+channel+", "+value); } function afterTouchEvent(channel, note, value) { script.log("After Touch received "+channel+", "+note+", "+value); }
{ "pile_set_name": "Github" }