text
stringlengths
2
99.9k
meta
dict
/* * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package test.javafx.collections; import org.junit.Before; import org.junit.Test; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javafx.collections.FXCollections; import javafx.collections.ObservableMap; import static test.javafx.collections.MockMapObserver.Tuple.tup; import static org.junit.Assert.*; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class UnmodifiableObservableMapTest { final Callable<ObservableMap<String, String>> mapFactory; private ObservableMap<String, String> observableMap; private ObservableMap<String, String> unmodifiableMap; private MockMapObserver<String, String> observer; public UnmodifiableObservableMapTest(final Callable<ObservableMap<String, String>> mapFactory) { this.mapFactory = mapFactory; } @Parameterized.Parameters public static Collection createParameters() { Object[][] data = new Object[][] { { TestedObservableMaps.HASH_MAP }, { TestedObservableMaps.TREE_MAP }, { TestedObservableMaps.LINKED_HASH_MAP }, { TestedObservableMaps.CONCURRENT_HASH_MAP }, { TestedObservableMaps.CHECKED_OBSERVABLE_HASH_MAP }, { TestedObservableMaps.SYNCHRONIZED_OBSERVABLE_HASH_MAP } }; return Arrays.asList(data); } @Before @SuppressWarnings("unchecked") public void setUp() throws Exception { observableMap = mapFactory.call(); unmodifiableMap = FXCollections.unmodifiableObservableMap(observableMap); observer = new MockMapObserver<String, String>(); unmodifiableMap.addListener(observer); useMapData(); } /** * Modifies the map in the fixture to use the strings passed in instead of * the default strings, and re-creates the observable map and the observer. * If no strings are passed in, the result is an empty map. * * @param strings the strings to use for the list in the fixture */ void useMapData(String... strings) { observableMap.clear(); observableMap.put("one", "1"); observableMap.put("two", "2"); observableMap.put("foo", "bar"); observer.clear(); } @Test public void testObservability() { /* * Since unmodifiable ObservableMap wraps an ObservableMap, we need to test * Observability of changes to the underlying Map, we won't test the full * ObservableMap API since that is already done. */ observableMap.put("observedFoo", "barVal"); observableMap.put("foo", "barfoo"); assertEquals("barVal", unmodifiableMap.get("observedFoo")); observableMap.remove("observedFoo"); observableMap.remove("foo"); observableMap.remove("bar"); observableMap.put("one", "1"); // dup, no change assertFalse(unmodifiableMap.containsKey("foo")); observer.assertAdded(0, tup("observedFoo", "barVal")); observer.assertAdded(1, tup("foo", "barfoo")); observer.assertRemoved(1, tup("foo", "bar")); observer.assertRemoved(2, tup("observedFoo", "barVal")); observer.assertRemoved(3, tup("foo", "barfoo")); assertEquals(observer.getCallsNumber(), 4); } @Test public void testPutAll() { Map<String, String> map = new HashMap<String, String>(); map.put("oFoo", "OFoo"); map.put("pFoo", "PFoo"); map.put("foo", "foofoo"); map.put("one", "1"); try { unmodifiableMap.putAll(map); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} } @Test public void testClear() { try { unmodifiableMap.clear(); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} } @Test public void testKeySet() { try { unmodifiableMap.keySet().remove("one"); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} try { unmodifiableMap.keySet().removeAll(Arrays.asList("one", "two", "three")); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} try { unmodifiableMap.keySet().retainAll(Arrays.asList("one", "two", "three")); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} try { unmodifiableMap.keySet().clear(); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} } @Test public void testKeySet_Iterator() { // iterators should not be removable Iterator<String> iterator = unmodifiableMap.keySet().iterator(); assertTrue("Test error, underlying Map should not be empty!", iterator.hasNext()); try { iterator.remove(); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} } @Test public void testValues() { try { unmodifiableMap.values().remove("1"); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} try { unmodifiableMap.values().removeAll(Arrays.asList("1", "2", "3")); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} try { unmodifiableMap.values().retainAll(Arrays.asList("1", "2", "3")); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} try { unmodifiableMap.values().clear(); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} } @Test public void testValues_Iterator() { Iterator<String> iterator = unmodifiableMap.values().iterator(); assertTrue("Test error, underlying Map should not be empty!", iterator.hasNext()); try { iterator.remove(); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} } @Test @SuppressWarnings("unchecked") public void testEntrySet() { try { unmodifiableMap.entrySet().remove(entry("one","1")); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} try { unmodifiableMap.entrySet().removeAll(Arrays.asList(entry("one","1"), entry("two","2"), entry("three","3"))); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} try { unmodifiableMap.entrySet().retainAll(Arrays.asList(entry("one","1"), entry("two","2"), entry("three","3"))); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} try { unmodifiableMap.entrySet().clear(); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} } @Test public void testEntrySet_Iterator() { Iterator<Map.Entry<String, String>> iterator = unmodifiableMap.entrySet().iterator(); assertTrue("Test error, underlying Map should not be empty!", iterator.hasNext()); try { iterator.remove(); fail("Expected UnsupportedOperationException"); } catch(UnsupportedOperationException e) {} } private<K, V> Map.Entry<K, V> entry(final K key, final V value) { return new Map.Entry<K, V>() { @Override public K getKey() { return key; } @Override public V getValue() { return value; } @Override public V setValue(V value) { throw new UnsupportedOperationException("Not supported."); } }; } }
{ "pile_set_name": "Github" }
# path-browserify the path module from node core for browsers
{ "pile_set_name": "Github" }
/*PGR-GNU***************************************************************** File: withPointsVia.sql Generated with Template by: Copyright (c) 2015 pgRouting developers Mail: project@pgrouting.org Function's developer: Copyright (c) 2015 Celia Virginia Vergara Castillo Mail: ------ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ ---------------------- -- _pgr_withPointsVia ---------------------- CREATE OR REPLACE FUNCTION _pgr_withPointsVia( sql TEXT, via_edges BIGINT[], fraction FLOAT[], directed BOOLEAN DEFAULT TRUE, OUT seq INTEGER, OUT path_id INTEGER, OUT path_seq INTEGER, OUT start_vid BIGINT, OUT end_vid BIGINT, OUT node BIGINT, OUT edge BIGINT, OUT cost FLOAT, OUT agg_cost FLOAT, OUT route_agg_cost FLOAT) RETURNS SETOF RECORD AS $BODY$ DECLARE has_rcost boolean; sql_new_vertices text := ' '; sql_on_vertex text; v_union text := ' '; dummyrec record; rec1 record; via_vertices int[]; sql_safe text; new_edges text; BEGIN BEGIN sql_safe = 'SELECT id, source, target, cost, reverse_cost FROM ('|| sql || ') AS __a'; EXECUTE 'select reverse_cost, pg_typeof(reverse_cost)::text as rev_type from ('||sql_safe||' ) AS __b__ limit 1 ' INTO rec1; has_rcost := true; EXCEPTION WHEN OTHERS THEN has_rcost = false; END; IF array_length(via_edges, 1) != array_length(fraction, 1) then RAISE EXCEPTION 'The length of via_edges is different of length of via_edges'; END IF; FOR i IN 1 .. array_length(via_edges, 1) LOOP IF fraction[i] = 0 THEN sql_on_vertex := 'SELECT source FROM ('|| sql || ') __a where id = ' || via_edges[i]; EXECUTE sql_on_vertex into dummyrec; via_vertices[i] = dummyrec.source; ELSE IF fraction[i] = 1 THEN sql_on_vertex := 'SELECT target FROM ('|| sql || ') __a where id = ' || via_edges[i]; EXECUTE sql_on_vertex into dummyrec; via_vertices[i] = dummyrec.target; ELSE via_vertices[i] = -i; IF has_rcost THEN sql_new_vertices = sql_new_vertices || v_union || '(SELECT id, source, ' || -i || ' AS target, cost * ' || fraction[i] || ' AS cost, reverse_cost * (1 - ' || fraction[i] || ') AS reverse_cost FROM (SELECT * FROM (' || sql || ') __b' || i || ' WHERE id = ' || via_edges[i] || ') __a' || i ||') UNION (SELECT id, ' || -i || ' AS source, target, cost * (1 -' || fraction[i] || ') AS cost, reverse_cost * ' || fraction[i] || ' AS reverse_cost FROM (SELECT * FROM (' || sql || ') __b' || i || ' where id = ' || via_edges[i] || ') __a' || i ||')'; v_union = ' UNION '; ELSE sql_new_vertices = sql_new_vertices || v_union || '(SELECT id, source, ' || -i || ' AS target, cost * ' || fraction[i] || ' AS cost FROM (SELECT * FROM (' || sql || ') __b' || i || ' WHERE id = ' || via_edges[i] || ') __a' || i ||') UNION (SELECT id, ' || -i || ' AS source, target, cost * (1 -' || fraction[i] || ') AS cost FROM (SELECT * FROM (' || sql || ') __b' || i || ' WHERE id = ' || via_edges[i] || ') __a' || i ||')'; v_union = ' UNION '; END IF; END IF; END IF; END LOOP; IF sql_new_vertices = ' ' THEN new_edges := sql; ELSE IF has_rcost THEN new_edges:= 'WITH original AS ( ' || sql || '), the_union AS ( ' || sql_new_vertices || '), first_part AS ( SELECT * FROM (SELECT id, target AS source, lead(target) OVER w AS target, lead(cost) OVER w - cost AS cost, lead(cost) OVER w - cost AS reverse_cost FROM the_union WHERE source > 0 AND cost > 0 WINDOW w AS (PARTITION BY id ORDER BY cost ASC) ) as n2 WHERE target IS NOT NULL), second_part AS ( SELECT * FROM (SELECT id, lead(source) OVER w AS source, source as target, reverse_cost - lead(reverse_cost) OVER w AS cost, reverse_cost - lead(reverse_cost) OVER w AS reverse_cost FROM the_union WHERE target > 0 and reverse_cost > 0 WINDOW w AS (PARTITION BY id ORDER BY reverse_cost ASC) ) as n2 WHERE source IS NOT NULL), more_union AS ( SELECT * from ( (SELECT * FROM original) UNION (SELECT * FROM the_union) UNION (SELECT * FROM first_part) UNION (SELECT * FROM second_part) ) _union ) SELECT * FROM more_union'; ELSE new_edges:= 'WITH original AS ( ' || sql || '), the_union AS ( ' || sql_new_vertices || '), first_part AS ( SELECT * FROM (SELECT id, target AS source, lead(target) OVER w AS target, lead(cost) OVER w - cost AS cost FROM the_union WHERE source > 0 AND cost > 0 WINDOW w AS (PARTITION BY id ORDER BY cost ASC) ) as n2 WHERE target IS NOT NULL ), more_union AS ( SELECT * from ( (SELECT * FROM original) UNION (SELECT * FROM the_union) UNION (SELECT * FROM first_part) ) _union ) SELECT * FROM more_union'; END IF; END IF; -- raise notice '%', new_edges; sql_new_vertices := sql_new_vertices || v_union || ' (' || sql || ')'; RETURN query SELECT * FROM pgr_dijkstraVia(new_edges, via_vertices, directed, has_rcost); END $BODY$ LANGUAGE plpgsql VOLATILE STRICT COST 100 ROWS 1000; -- COMMENTS COMMENT ON FUNCTION _pgr_withPointsVia(TEXT, BIGINT[], FLOAT[], BOOLEAN) IS 'pgRouting internal function';
{ "pile_set_name": "Github" }
/* Copyright 2016 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package apimachinery import ( "k8s.io/kubernetes/pkg/api/meta" "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/runtime" ) // GroupMeta stores the metadata of a group. type GroupMeta struct { // GroupVersion represents the preferred version of the group. GroupVersion unversioned.GroupVersion // GroupVersions is Group + all versions in that group. GroupVersions []unversioned.GroupVersion // Codec is the default codec for serializing output that should use // the preferred version. Use this Codec when writing to // disk, a data store that is not dynamically versioned, or in tests. // This codec can decode any object that the schema is aware of. Codec runtime.Codec // SelfLinker can set or get the SelfLink field of all API types. // TODO: when versioning changes, make this part of each API definition. // TODO(lavalamp): Combine SelfLinker & ResourceVersioner interfaces, force all uses // to go through the InterfacesFor method below. SelfLinker runtime.SelfLinker // RESTMapper provides the default mapping between REST paths and the objects declared in api.Scheme and all known // versions. RESTMapper meta.RESTMapper // InterfacesFor returns the default Codec and ResourceVersioner for a given version // or an error if the version is not known. InterfacesFor func(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) }
{ "pile_set_name": "Github" }
var gulp = require('gulp'); var wrap = require("gulp-wrap"); var uglify = require('gulp-uglify'); var rename = require("gulp-rename"); var minifyCSS = require('gulp-minify-css'); gulp.task('build', function() { gulp.src('./src/**/*.js') .pipe(wrap('!function(a,b){"function"==typeof define&&define.amd?define(b):"object"==typeof exports?module.exports=b(require,exports,module):b()}(this,function(){<%= contents %>});')) .pipe(uglify({ "output": { "beautify": true } })) .pipe(gulp.dest('./dist/')) .pipe(uglify({ "mangle": true })) .pipe(rename({ suffix: ".min" })) .pipe(gulp.dest('./dist/')); }); gulp.task('default', ['build']);
{ "pile_set_name": "Github" }
6a1a7b467eeab2795510e7dd1ca528ff *tests/data/fate/vsynth_lena-xface.nut 17504 tests/data/fate/vsynth_lena-xface.nut 6d87881d630439d02c7a97f468d67a1c *tests/data/fate/vsynth_lena-xface.out.rawvideo stddev: 99.01 PSNR: 8.22 MAXDIFF: 238 bytes: 7603200/ 7603200
{ "pile_set_name": "Github" }
/* * Copyright (c) 2002,2000 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * The contents of this file constitute Original Code as defined in and * are subject to the Apple Public Source License Version 1.1 (the * "License"). You may not use this file except in compliance with the * License. Please obtain a copy of the License at * http://www.apple.com/publicsource and read it before using this file. * * This Original Code and all software distributed under the License are * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License. * * @APPLE_LICENSE_HEADER_END@ */ /* * @OSF_COPYRIGHT@ */ /* * Mach RPC Subsystem Interfaces */ #ifndef _MACH_RPC_H_ #define _MACH_RPC_H_ #include <mach/boolean.h> #include <mach/kern_return.h> #include <mach/port.h> #include <mach/vm_types.h> #include <mach/mig.h> #include <mach/mig_errors.h> #include <mach/machine/rpc.h> #include <mach/thread_status.h> #include <sys/appleapiopts.h> #ifdef __APPLE_API_OBSOLETE /* * These are the types for RPC-specific variants of the MIG routine * descriptor and subsystem data types. * * THIS IS ONLY FOR COMPATIBILITY. WE WILL NOT BE IMPLEMENTING THIS. */ /* * Basic mach rpc types. */ typedef unsigned int routine_arg_type; typedef unsigned int routine_arg_offset; typedef unsigned int routine_arg_size; /* * Definitions for a signature's argument and routine descriptor's. */ struct rpc_routine_arg_descriptor { routine_arg_type type; /* Port, Array, etc. */ routine_arg_size size; /* element size in bytes */ routine_arg_size count; /* number of elements */ routine_arg_offset offset; /* Offset in list of routine args */ }; typedef struct rpc_routine_arg_descriptor *rpc_routine_arg_descriptor_t; struct rpc_routine_descriptor { mig_impl_routine_t impl_routine; /* Server work func pointer */ mig_stub_routine_t stub_routine; /* Unmarshalling func pointer */ unsigned int argc; /* Number of argument words */ unsigned int descr_count; /* Number of complex argument */ /* descriptors */ rpc_routine_arg_descriptor_t arg_descr; /* Pointer to beginning of */ /* the arg_descr array */ unsigned int max_reply_msg; /* Max size for reply msg */ }; typedef struct rpc_routine_descriptor *rpc_routine_descriptor_t; #define RPC_DESCR_SIZE(x) ((x)->descr_count * \ sizeof(struct rpc_routine_arg_descriptor)) struct rpc_signature { struct rpc_routine_descriptor rd; struct rpc_routine_arg_descriptor rad[1]; }; #define RPC_SIGBUF_SIZE 8 /* * A subsystem describes a set of server routines that can be invoked by * mach_rpc() on the ports that are registered with the subsystem. For * each routine, the routine number is given, along with the * address of the implementation function in the server and a * description of the arguments of the routine (it's "signature"). * * This structure definition is only a template for what is really a * variable-length structure (generated by MIG for each subsystem). * The actual structures do not always have one entry in the routine * array, and also have a varying number of entries in the arg_descr * array. Each routine has an array of zero or more arg descriptors * one for each complex arg. These arrays are all catenated together * to form the arg_descr field of the subsystem struct. The * arg_descr field of each routine entry points to a unique sub-sequence * within this catenated array. The goal is to keep everything * contiguous. */ struct rpc_subsystem { void *reserved; /* Reserved for system use */ mach_msg_id_t start; /* Min routine number */ mach_msg_id_t end; /* Max routine number + 1 */ unsigned int maxsize; /* Max mach_msg size */ vm_address_t base_addr; /* Address of this struct in user */ struct rpc_routine_descriptor /* Array of routine descriptors */ routine[1 /* Actually, (start-end+1) */ ]; struct rpc_routine_arg_descriptor arg_descriptor[1 /* Actually, the sum of the descr_ */ ]; /* count fields for all routines */ }; typedef struct rpc_subsystem *rpc_subsystem_t; #define RPC_SUBSYSTEM_NULL ((rpc_subsystem_t) 0) #endif /* __APPLE_API_OBSOLETE */ #endif /* _MACH_RPC_H_ */
{ "pile_set_name": "Github" }
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/debug/debugger.h" #include <stdlib.h> #include <windows.h> #include "base/clang_profiling_buildflags.h" #if BUILDFLAG(CLANG_PROFILING) #include "base/test/clang_profiling.h" #endif namespace base { namespace debug { bool BeingDebugged() { return ::IsDebuggerPresent() != 0; } void BreakDebugger() { #if BUILDFLAG(CLANG_PROFILING) WriteClangProfilingProfile(); #endif if (IsDebugUISuppressed()) _exit(1); __debugbreak(); } void VerifyDebugger() {} } // namespace debug } // namespace base
{ "pile_set_name": "Github" }
(* Check that arguments of impredicative types are not considered subterms even through commutative cuts on functional arguments (example prepared by Bruno) *) Inductive IMP : Prop := CIMP : (forall A:Prop, A->A) -> IMP | LIMP : (nat->IMP)->IMP. Definition i0 := (LIMP (fun _ => CIMP (fun _ x => x))). Fail Definition Paradox : False := (fix F y o {struct o} : False := match y with | tt => fun f => match f 0 with | CIMP h => F y (h _ o) | _ => F y (f 0) end end match o with LIMP f => f | _ => fun _ => o end) tt i0.
{ "pile_set_name": "Github" }
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; using Nuke.Common.Utilities; using Nuke.Common.Utilities.Collections; namespace Nuke.Common.CI.AppVeyor.Configuration { public class AppVeyorBranches : ConfigurationEntity { public string[] Only { get; set; } public string[] Except { get; set; } public override void Write(CustomFileWriter writer) { if (Only.Length > 0) { using (writer.WriteBlock("only:")) { Only.ForEach(x => writer.WriteLine($"- {x}")); } } if (Except.Length > 0) { using (writer.WriteBlock("except:")) { Except.ForEach(x => writer.WriteLine($"- {x}")); } } } } }
{ "pile_set_name": "Github" }
--- id: 587d7fae367417b2b2512be3 title: Get JSON with the JavaScript XMLHttpRequest Method challengeType: 6 videoUrl: '' localeTitle: Obtenha o JSON com o método JavaScript XMLHttpRequest --- ## Description <section id="description"> Você também pode solicitar dados de uma fonte externa. É aqui que entram as APIs. Lembre-se de que as APIs - ou Interfaces de Programação de Aplicativos - são ferramentas que os computadores usam para se comunicarem entre si. Você aprenderá a atualizar o HTML com os dados que obtemos das APIs usando uma tecnologia chamada AJAX. A maioria das APIs da web transfere dados em um formato chamado JSON. JSON significa JavaScript Object Notation. A sintaxe JSON é muito semelhante à notação literal do objeto JavaScript. O JSON tem propriedades de objeto e seus valores atuais, entre um <code>{</code> e um <code>}</code> . Essas propriedades e seus valores são geralmente chamados de &quot;pares de valor-chave&quot;. No entanto, o JSON transmitido por APIs é enviado como <code>bytes</code> e seu aplicativo o recebe como uma <code>string</code> . Estes podem ser convertidos em objetos JavaScript, mas eles não são objetos JavaScript por padrão. O método <code>JSON.parse</code> analisa a sequência e constrói o objeto JavaScript descrito por ela. Você pode solicitar o JSON da Cat Photo API do freeCodeCamp. Aqui está o código que você pode colocar no seu evento de clique para fazer isso: <blockquote> req = new XMLHttpRequest (); <br> req.open (&quot;GET&quot;, &#39;/ json / cats.json&#39;, true); <br> req.send (); <br> req.onload = function () { <br> json = JSON.parse (req.responseText); <br> document.getElementsByClassName (&#39;message&#39;) [0] .innerHTML = JSON.stringify (json); <br> }; </blockquote> Aqui está uma revisão do que cada peça está fazendo. O objeto JavaScript <code>XMLHttpRequest</code> possui várias propriedades e métodos usados ​​para transferir dados. Primeiro, uma instância do objeto <code>XMLHttpRequest</code> é criada e salva na variável <code>req</code> . Em seguida, o método <code>open</code> inicializa uma solicitação - este exemplo está solicitando dados de uma API, portanto, é uma solicitação &quot;GET&quot;. O segundo argumento para <code>open</code> é o URL da API da qual você está solicitando dados. O terceiro argumento é um valor booleano em que <code>true</code> faz dele uma solicitação assíncrona. O método <code>send</code> envia o pedido. Finalmente, o manipulador de eventos <code>onload</code> analisa os dados retornados e aplica o método <code>JSON.stringify</code> para converter o objeto JavaScript em uma string. Essa sequência é inserida como o texto da mensagem. </section> ## Instructions <section id="instructions"> Atualize o código para criar e enviar uma solicitação &quot;GET&quot; para a FreeCodeCamp Cat Photo API. Em seguida, clique no botão &quot;Obter mensagem&quot;. Sua função AJAX substituirá o texto &quot;A mensagem irá para cá&quot; pela saída JSON bruta da API. </section> ## Tests <section id='tests'> ```yml tests: - text: Seu código deve criar um novo <code>XMLHttpRequest</code> . testString: 'assert(code.match(/new\s+?XMLHttpRequest\(\s*?\)/g), "Your code should create a new <code>XMLHttpRequest</code>.");' - text: Seu código deve usar o método <code>open</code> para inicializar uma solicitação &quot;GET&quot; para a FreeCodeCamp Cat Photo API. testString: 'assert(code.match(/\.open\(\s*?("|")GET\1\s*?,\s*?("|")\/json\/cats\.json\2\s*?,\s*?true\s*?\)/g), "Your code should use the <code>open</code> method to initialize a "GET" request to the freeCodeCamp Cat Photo API.");' - text: Seu código deve usar o <code>send</code> método para enviar o pedido. testString: 'assert(code.match(/\.send\(\s*\)/g), "Your code should use the <code>send</code> method to send the request.");' - text: Seu código deve ter um manipulador de eventos <code>onload</code> configurado para uma função. testString: 'assert(code.match(/\.onload\s*=\s*function\(\s*?\)\s*?{/g), "Your code should have an <code>onload</code> event handler set to a function.");' - text: Seu código deve usar o método <code>JSON.parse</code> para analisar o <code>responseText</code> . testString: 'assert(code.match(/JSON\.parse\(.*\.responseText\)/g), "Your code should use the <code>JSON.parse</code> method to parse the <code>responseText</code>.");' - text: Seu código deve obter o elemento com <code>message</code> classe e alterar seu HTML interno para a string de dados JSON. testString: 'assert(code.match(/document\.getElementsByClassName\(\s*?("|")message\1\s*?\)\[0\]\.innerHTML\s*?=\s*?JSON\.stringify\(.+?\)/g), "Your code should get the element with class <code>message</code> and change its inner HTML to the string of JSON data.");' ``` </section> ## Challenge Seed <section id='challengeSeed'> <div id='html-seed'> ```html <script> document.addEventListener('DOMContentLoaded',function(){ document.getElementById('getMessage').onclick=function(){ // Add your code below this line // Add your code above this line }; }); </script> <style> body { text-align: center; font-family: "Helvetica", sans-serif; } h1 { font-size: 2em; font-weight: bold; } .box { border-radius: 5px; background-color: #eee; padding: 20px 5px; } button { color: white; background-color: #4791d0; border-radius: 5px; border: 1px solid #4791d0; padding: 5px 10px 8px 10px; } button:hover { background-color: #0F5897; border: 1px solid #0F5897; } </style> <h1>Cat Photo Finder</h1> <p class="message"> The message will go here </p> <p> <button id="getMessage"> Get Message </button> </p> ``` </div> </section> ## Solution <section id='solution'> ```js // solution required ``` </section>
{ "pile_set_name": "Github" }
// Copyright 2015 Emilie Gillet. // // Author: Emilie Gillet (emilie.o.gillet@gmail.com) // // 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. // // See http://creativecommons.org/licenses/MIT/ for more information. // // ----------------------------------------------------------------------------- // // String. #ifndef ELEMENTS_DSP_STRING_H_ #define ELEMENTS_DSP_STRING_H_ #include "stmlib/stmlib.h" #include <algorithm> #include "stmlib/dsp/delay_line.h" #include "stmlib/dsp/filter.h" namespace elements { const size_t kDelayLineSize = 2048; class DampingFilter { public: DampingFilter() { } ~DampingFilter() { } void Init() { x_ = 0.0f; x__ = 0.0f; brightness_ = 0.0f; brightness_increment_ = 0.0f; damping_ = 0.0f; damping_increment_ = 0.0f; } inline void Configure(float damping, float brightness, size_t size) { if (!size) { damping_ = damping; brightness_ = brightness; damping_increment_ = 0.0f; brightness_increment_ = 0.0f; } else { float step = 1.0f / static_cast<float>(size); damping_increment_ = (damping - damping_) * step; brightness_increment_ = (brightness - brightness_) * step; } } inline float Process(float x) { float h0 = (1.0f + brightness_) * 0.5f; float h1 = (1.0f - brightness_) * 0.25f; float y = damping_ * (h0 * x_ + h1 * (x + x__)); x__ = x_; x_ = x; brightness_ += brightness_increment_; damping_ += damping_increment_; return y; } private: float x_; float x__; float brightness_; float brightness_increment_; float damping_; float damping_increment_; DISALLOW_COPY_AND_ASSIGN(DampingFilter); }; typedef stmlib::DelayLine<float, kDelayLineSize> StringDelayLine; typedef stmlib::DelayLine<float, kDelayLineSize / 2> StiffnessDelayLine; class String { public: String() { } ~String() { } void Init(bool enable_dispersion); void Process(const float* in, float* out, float* aux, size_t size); inline void set_frequency(float frequency) { frequency_ = frequency; } inline void set_frequency(float frequency, float coefficient) { frequency_ += coefficient * (frequency - frequency_); } inline void set_dispersion(float dispersion) { dispersion = dispersion < 0.24f ? (dispersion - 0.24f) * 4.166f : (dispersion > 0.26f ? (dispersion - 0.26f) * 1.35135f : 0.0f); dispersion_ = dispersion; } inline void set_brightness(float brightness) { brightness_ = brightness; } inline void set_damping(float damping) { damping_ = damping; } inline void set_position(float position) { position_ = position; } inline StringDelayLine* mutable_string() { return &string_; } private: template<bool enable_dispersion> void ProcessInternal(const float* in, float* out, float* aux, size_t size); float frequency_; float dispersion_; float brightness_; float damping_; float position_; float delay_; float clamped_position_; float previous_dispersion_; float previous_damping_compensation_; bool enable_dispersion_; bool enable_iir_damping_; float dispersion_noise_; // Very crappy linear interpolation upsampler used for low pitches that // do not fit the delay line. Rarely used. float src_phase_; float out_sample_[2]; float aux_sample_[2]; float curved_bridge_; StringDelayLine string_; StiffnessDelayLine stretch_; DampingFilter fir_damping_filter_; stmlib::Svf iir_damping_filter_; stmlib::DCBlocker dc_blocker_; DISALLOW_COPY_AND_ASSIGN(String); }; } // namespace elements #endif // ELEMENTS_DSP_STRING_H_
{ "pile_set_name": "Github" }
#ifndef CAFFE_SPP_LAYER_HPP_ #define CAFFE_SPP_LAYER_HPP_ #include <vector> #include "caffe/blob.hpp" #include "caffe/layer.hpp" #include "caffe/proto/caffe.pb.h" namespace caffe { /** * @brief Does spatial pyramid pooling on the input image * by taking the max, average, etc. within regions * so that the result vector of different sized * images are of the same size. */ template <typename Dtype> class SPPLayer : public Layer<Dtype> { public: explicit SPPLayer(const LayerParameter& param) : Layer<Dtype>(param) {} virtual void LayerSetUp(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top); virtual void Reshape(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top); virtual inline const char* type() const { return "SPP"; } virtual inline int ExactNumBottomBlobs() const { return 1; } virtual inline int ExactNumTopBlobs() const { return 1; } protected: virtual void Forward_cpu(const vector<Blob<Dtype>*>& bottom, const vector<Blob<Dtype>*>& top); virtual void Backward_cpu(const vector<Blob<Dtype>*>& top, const vector<bool>& propagate_down, const vector<Blob<Dtype>*>& bottom); // calculates the kernel and stride dimensions for the pooling layer, // returns a correctly configured LayerParameter for a PoolingLayer virtual LayerParameter GetPoolingParam(const int pyramid_level, const int bottom_h, const int bottom_w, const SPPParameter spp_param); int pyramid_height_; int bottom_h_, bottom_w_; int num_; int channels_; int kernel_h_, kernel_w_; int pad_h_, pad_w_; bool reshaped_first_time_; /// the internal Split layer that feeds the pooling layers shared_ptr<SplitLayer<Dtype> > split_layer_; /// top vector holder used in call to the underlying SplitLayer::Forward vector<Blob<Dtype>*> split_top_vec_; /// bottom vector holder used in call to the underlying PoolingLayer::Forward vector<vector<Blob<Dtype>*>*> pooling_bottom_vecs_; /// the internal Pooling layers of different kernel sizes vector<shared_ptr<PoolingLayer<Dtype> > > pooling_layers_; /// top vector holders used in call to the underlying PoolingLayer::Forward vector<vector<Blob<Dtype>*>*> pooling_top_vecs_; /// pooling_outputs stores the outputs of the PoolingLayers vector<Blob<Dtype>*> pooling_outputs_; /// the internal Flatten layers that the Pooling layers feed into vector<FlattenLayer<Dtype>*> flatten_layers_; /// top vector holders used in call to the underlying FlattenLayer::Forward vector<vector<Blob<Dtype>*>*> flatten_top_vecs_; /// flatten_outputs stores the outputs of the FlattenLayers vector<Blob<Dtype>*> flatten_outputs_; /// bottom vector holder used in call to the underlying ConcatLayer::Forward vector<Blob<Dtype>*> concat_bottom_vec_; /// the internal Concat layers that the Flatten layers feed into shared_ptr<ConcatLayer<Dtype> > concat_layer_; }; } // namespace caffe #endif // CAFFE_SPP_LAYER_HPP_
{ "pile_set_name": "Github" }
<?php declare(strict_types=1); namespace ShlinkioTest\Shlink\Core\Util; use Fig\Http\Message\RequestMethodInterface; use GuzzleHttp\ClientInterface; use GuzzleHttp\Exception\ClientException; use GuzzleHttp\RequestOptions; use Laminas\Diactoros\Response; use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; use Shlinkio\Shlink\Core\Exception\InvalidUrlException; use Shlinkio\Shlink\Core\Options\UrlShortenerOptions; use Shlinkio\Shlink\Core\Util\UrlValidator; class UrlValidatorTest extends TestCase { private UrlValidator $urlValidator; private ObjectProphecy $httpClient; private UrlShortenerOptions $options; public function setUp(): void { $this->httpClient = $this->prophesize(ClientInterface::class); $this->options = new UrlShortenerOptions(['validate_url' => true]); $this->urlValidator = new UrlValidator($this->httpClient->reveal(), $this->options); } /** @test */ public function exceptionIsThrownWhenUrlIsInvalid(): void { $request = $this->httpClient->request(Argument::cetera())->willThrow(ClientException::class); $request->shouldBeCalledOnce(); $this->expectException(InvalidUrlException::class); $this->urlValidator->validateUrl('http://foobar.com/12345/hello?foo=bar'); } /** @test */ public function expectedUrlIsCalledWhenTryingToVerify(): void { $expectedUrl = 'http://foobar.com'; $request = $this->httpClient->request( RequestMethodInterface::METHOD_GET, $expectedUrl, [ RequestOptions::ALLOW_REDIRECTS => ['max' => 15], RequestOptions::IDN_CONVERSION => true, ], )->willReturn(new Response()); $this->urlValidator->validateUrl($expectedUrl); $request->shouldHaveBeenCalledOnce(); } /** @test */ public function noCheckIsPerformedWhenUrlValidationIsDisabled(): void { $request = $this->httpClient->request(Argument::cetera())->willReturn(new Response()); $this->options->validateUrl = false; $this->urlValidator->validateUrl(''); $request->shouldNotHaveBeenCalled(); } }
{ "pile_set_name": "Github" }
/** * Copyright 2016-present, Baifendian, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ .bfd-table { font: inherit; border-spacing: 0; border-collapse: collapse; margin-bottom: 20px; width: 100%; max-width: 100%; box-sizing: border-box; > thead { > tr { background-color: #fff; > th { font-weight: 400; border-bottom: 3px solid #e7ebed; padding: 8px; border-top: 0; text-align: left; } } } > tbody { > tr { background-color: #fff; > td { vertical-align: middle; word-wrap: break-word; word-break: break-word; color: #666; border-top: 1px solid #eff3f8; padding: 8px; } } tr:nth-child(2n) { background-color: #fafafa; } } } .bfd-table--align-center { text-align: center; width: 100%; height: 100%; }
{ "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.settings.privacy; import static android.Manifest.permission_group.CALENDAR; import static android.Manifest.permission_group.CAMERA; import static android.Manifest.permission_group.CONTACTS; import static android.Manifest.permission_group.LOCATION; import static android.Manifest.permission_group.MICROPHONE; import static android.Manifest.permission_group.PHONE; import static android.Manifest.permission_group.SMS; import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE; import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE; import static com.google.common.truth.Truth.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.content.Context; import android.content.pm.UserInfo; import android.os.UserManager; import android.permission.RuntimePermissionUsageInfo; import android.provider.DeviceConfig; import android.view.accessibility.AccessibilityManager; import androidx.preference.PreferenceScreen; import com.android.internal.widget.LockPatternUtils; import com.android.settings.Utils; import com.android.settings.testutils.FakeFeatureFactory; import com.android.settings.testutils.shadow.ShadowDeviceConfig; import com.android.settings.testutils.shadow.ShadowPermissionControllerManager; import com.android.settings.testutils.shadow.ShadowUserManager; import com.android.settingslib.widget.BarChartInfo; import com.android.settingslib.widget.BarChartPreference; import com.android.settingslib.widget.BarViewInfo; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; import org.robolectric.shadow.api.Shadow; import org.robolectric.shadows.ShadowAccessibilityManager; import org.robolectric.shadows.androidx.fragment.FragmentController; import java.util.ArrayList; import java.util.List; @RunWith(RobolectricTestRunner.class) @Config(shadows = {ShadowDeviceConfig.class, ShadowUserManager.class, ShadowPermissionControllerManager.class}) public class PermissionBarChartPreferenceControllerTest { @Mock private PreferenceScreen mScreen; @Mock private LockPatternUtils mLockPatternUtils; private PermissionBarChartPreferenceController mController; private BarChartPreference mPreference; private PrivacyDashboardFragment mFragment; @Before public void setUp() { MockitoAnnotations.initMocks(this); final Context context = RuntimeEnvironment.application; final UserManager userManager = context.getSystemService(UserManager.class); final ShadowUserManager shadowUserManager = Shadow.extract(userManager); final ShadowAccessibilityManager accessibilityManager = Shadow.extract( AccessibilityManager.getInstance(context)); accessibilityManager.setEnabledAccessibilityServiceList(new ArrayList<>()); shadowUserManager.addProfile(new UserInfo(123, null, 0)); when(FakeFeatureFactory.setupForTest().securityFeatureProvider.getLockPatternUtils( any(Context.class))).thenReturn(mLockPatternUtils); mController = spy(new PermissionBarChartPreferenceController(context, "test_key")); mFragment = spy(FragmentController.of(new PrivacyDashboardFragment()) .create().start().get()); mController.setFragment(mFragment); mPreference = spy(new BarChartPreference(context)); when(mScreen.findPreference(mController.getPreferenceKey())) .thenReturn((BarChartPreference) mPreference); } @After public void tearDown() { ShadowDeviceConfig.reset(); } @Test public void getAvailabilityStatus_permissionHubNotSet_shouldReturnUnsupported() { // We have not yet set the property to show the Permissions Hub. assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE); } @Test public void getAvailabilityStatus_permissionHubEnabled_shouldReturnAvailableUnsearchable() { DeviceConfig.setProperty(DeviceConfig.NAMESPACE_PRIVACY, Utils.PROPERTY_PERMISSIONS_HUB_ENABLED, "true", true); assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE); } @Test public void displayPreference_shouldInitializeBarChart() { mController.displayPreference(mScreen); verify(mPreference).initializeBarChart(any(BarChartInfo.class)); } @Test public void displayPreference_usageInfosSet_shouldSetBarViewInfos() { final RuntimePermissionUsageInfo info1 = new RuntimePermissionUsageInfo("permission 1", 10); mController.mOldUsageInfos.add(info1); mController.displayPreference(mScreen); verify(mPreference).setBarViewInfos(any(BarViewInfo[].class)); verify(mPreference).initializeBarChart(any(BarChartInfo.class)); } @Test public void onPermissionUsageResult_differentPermissionResultSet_shouldSetBarViewInfos() { final List<RuntimePermissionUsageInfo> infos1 = new ArrayList<>(); final RuntimePermissionUsageInfo info1 = new RuntimePermissionUsageInfo("permission 1", 10); infos1.add(info1); mController.displayPreference(mScreen); mController.onPermissionUsageResult(infos1); verify(mPreference).setBarViewInfos(any(BarViewInfo[].class)); final List<RuntimePermissionUsageInfo> infos2 = new ArrayList<>(); final RuntimePermissionUsageInfo info2 = new RuntimePermissionUsageInfo("permission 2", 20); infos2.add(info2); mController.onPermissionUsageResult(infos2); verify(mPreference, times(2)).setBarViewInfos(any(BarViewInfo[].class)); } @Test public void onPermissionUsageResult_samePermissionResultSet_shouldNotSetBarViewInfos() { final List<RuntimePermissionUsageInfo> mInfos = new ArrayList<>(); final RuntimePermissionUsageInfo info1 = new RuntimePermissionUsageInfo("permission 1", 10); mInfos.add(info1); mController.displayPreference(mScreen); mController.onPermissionUsageResult(mInfos); mController.onPermissionUsageResult(mInfos); verify(mPreference, times(1)).setBarViewInfos(any(BarViewInfo[].class)); } @Test public void onStart_usageInfosNotSetAndPermissionHubEnabled_shouldShowProgressBar() { DeviceConfig.setProperty(DeviceConfig.NAMESPACE_PRIVACY, Utils.PROPERTY_PERMISSIONS_HUB_ENABLED, "true", true); mController.displayPreference(mScreen); mController.onStart(); verify(mFragment).setLoadingEnabled(true /* enabled */); verify(mPreference).updateLoadingState(true /* isLoading */); } @Test public void onStart_usageInfosSetAndPermissionHubEnabled_shouldNotUpdatePrefLoadingState() { DeviceConfig.setProperty(DeviceConfig.NAMESPACE_PRIVACY, Utils.PROPERTY_PERMISSIONS_HUB_ENABLED, "true", true); final RuntimePermissionUsageInfo info1 = new RuntimePermissionUsageInfo("permission 1", 10); mController.mOldUsageInfos.add(info1); mController.displayPreference(mScreen); mController.onStart(); verify(mFragment).setLoadingEnabled(true /* enabled */); verify(mPreference).updateLoadingState(false /* isLoading */); } @Test public void onStart_permissionHubDisabled_shouldNotShowProgressBar() { DeviceConfig.setProperty(DeviceConfig.NAMESPACE_PRIVACY, Utils.PROPERTY_PERMISSIONS_HUB_ENABLED, "false", true); mController.onStart(); verify(mFragment, never()).setLoadingEnabled(true /* enabled */); verify(mPreference, never()).updateLoadingState(true /* isLoading */); } @Test public void onPermissionUsageResult_shouldHideProgressBar() { final List<RuntimePermissionUsageInfo> infos1 = new ArrayList<>(); final RuntimePermissionUsageInfo info1 = new RuntimePermissionUsageInfo("permission 1", 10); infos1.add(info1); mController.displayPreference(mScreen); mController.onPermissionUsageResult(infos1); verify(mFragment).setLoadingEnabled(false /* enabled */); verify(mPreference).updateLoadingState(false /* isLoading */); } @Test public void onPermissionUsageResult_shouldBeSorted() { final List<RuntimePermissionUsageInfo> infos = new ArrayList<>(); infos.add(new RuntimePermissionUsageInfo(PHONE, 10)); infos.add(new RuntimePermissionUsageInfo(LOCATION, 10)); infos.add(new RuntimePermissionUsageInfo(CAMERA, 10)); infos.add(new RuntimePermissionUsageInfo(SMS, 1)); infos.add(new RuntimePermissionUsageInfo(MICROPHONE, 10)); infos.add(new RuntimePermissionUsageInfo(CONTACTS, 42)); infos.add(new RuntimePermissionUsageInfo(CALENDAR, 10)); mController.displayPreference(mScreen); mController.onPermissionUsageResult(infos); assertThat(infos.get(0).getName()).isEqualTo(CONTACTS); assertThat(infos.get(1).getName()).isEqualTo(LOCATION); assertThat(infos.get(2).getName()).isEqualTo(MICROPHONE); assertThat(infos.get(3).getName()).isEqualTo(CAMERA); assertThat(infos.get(4).getName()).isEqualTo(CALENDAR); assertThat(infos.get(5).getName()).isEqualTo(PHONE); assertThat(infos.get(6).getName()).isEqualTo(SMS); } }
{ "pile_set_name": "Github" }
## DESCRIPTION ## Calculus ## ENDDESCRIPTION ## Tagged by tda2d ## DBsubject(Calculus - single variable) ## DBchapter(Techniques of integration) ## DBsection(Substitution (without trigonometric functions)) ## Institution(ASU) ## MLT(Sub_indirect) ## Level(2) ## TitleText1('Calculus: Early Transcendentals') ## AuthorText1('Stewart') ## EditionText1('6') ## Section1('5.5') ## Problem1('11 12 13 30 32 35 41 42 45 46') ## KEYWORDS('integral' 'substitution','integrals', 'substitution', 'substitution rule','Calculus', 'Riemann Integral') DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PGstandard.pl", "PGchoicemacros.pl", "PGcourse.pl" ); TEXT(beginproblem()); $showPartialCorrectAnswers = 1; $a = random(1,4,1); $b = random(2,6,2); $c = random(1,7,1); $d = random(2,6,1); $e = $b / 2; $f = $d - 1; $coeff = 1 / $f * -1/2; $funct = "$coeff * ($a * x^2 - $b * x + $c)^(-$f)"; TEXT(EV2(<<EOT)); Evaluate the indefinite integral. $BR \[ \int \frac{$a x - $e}{($a x^2 - $b x + $c)^$d} dx \] $BR $BR \{ans_rule( 30) \} $BR [NOTE: Remember to enter all necessary *, (, and ) !! $BR EOT $ans = $funct; ANS(fun_cmp($ans, mode=>"antider")); ENDDOCUMENT(); # This should be the last executable line in the problem.
{ "pile_set_name": "Github" }
// // MessageManager.h // iKnow // // Created by curer on 11-7-21. // Copyright 2011 iKnow Team. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> #import "GCDMulticastDelegate.h" #import "FileTransferEx.h" #import "XMPPiKnowStorage.h" #import <AVFoundation/AVFoundation.h> @class MessageManager; @class XMPPMessage; @class MessageCoreDataObject; @class SessionCoreDataObject; @protocol MessageDelegate <NSObject> - (void)MessageManager:(MessageManager *)sender didReceivedMessage:(MessageCoreDataObject *)message; - (void)MessageManager:(MessageManager *)sender didSendMessageIdentify:(NSString *)identify; - (void)MessageManager:(MessageManager *)sender didSendMessageIdentify:(NSString *)identify withError:(NSString *)error; @end @interface MessageManager : NSObject < NSFetchedResultsControllerDelegate > { FileTransferEx *fileTransferEx; GCDMulticastDelegate <MessageDelegate> *multicastMessageDelegate; XMPPiKnowStorage *xmppiKnowStorage; AVAudioPlayer *player; } @property (retain, readonly) XMPPiKnowStorage *xmppiKnowStorage; + (BOOL)allowToSendOrReveiveMessage:(NSString *)userID; - (id)initWithUserInfoCoreDataStorage:(XMPPiKnowStorage *)xmppiKnowStorage; - (BOOL)SendMessageToId:(NSString *)userID andText:(NSString *)text andIdentify:(NSString *)identify; - (BOOL)SendMessage:(MessageCoreDataObject *)message andProgressView:(UIProgressView *)view; - (SessionCoreDataObject *) newSessionWithId:(NSString *)userId; - (int) QueryUnReadMsgCount; - (void)handleReceivedXMPPMessage:(XMPPMessage *)message; - (void)handleDidSendMessage:(XMPPMessage *)xmppMessage; - (void)addDelegate:(id)aDelegate; - (void)removeDelegate:(id)aDelegate; @end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" > <corners android:radius="25dp" /> <solid android:color="@color/kg_blue_btn_pressed" /> </shape>
{ "pile_set_name": "Github" }
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the documentation 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 qt-info@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QtGui> class SliderPlugin : public QAccessiblePlugin { public: SliderPlugin() {} QStringList keys() const; QAccessibleInterface *create(const QString &classname, QObject *object); }; //! [0] QStringList SliderPlugin::keys() const { return QStringList() << "QSlider"; } //! [0] //! [1] QAccessibleInterface *SliderPlugin::create(const QString &classname, QObject *object) { QAccessibleInterface *interface = 0; if (classname == "QSlider" && object && object->isWidgetType()) interface = new AccessibleSlider(classname, static_cast<QWidget *>(object)); return interface; } //! [1] //! [2] Q_EXPORT_STATIC_PLUGIN(SliderPlugin) Q_EXPORT_PLUGIN2(acc_sliderplugin, SliderPlugin) //! [2]
{ "pile_set_name": "Github" }
// Verify that a connection can be closed gracefully from the server. var assert = require('assert'); var WebSocket = require('../lib/websocket').WebSocket; var WebSocketServer = require('websocket-server/ws/server').Server; var PORT = 1024 + Math.floor(Math.random() * 4096); var S_MSG = 'Server test: ' + (Math.random() * 100); var clientGotServerMessage = false; var clientGotServerClose = false; var serverGotClientClose = false; var wss = new WebSocketServer(); wss.listen(PORT, 'localhost'); wss.on('connection', function(c) { c.on('close', function() { serverGotClientClose = true; wss.close(); }); c.write(S_MSG); c.close(); }); var ws = new WebSocket('ws://localhost:' + PORT); ws.onmessage = function(m) { assert.deepEqual(m, {data: S_MSG}); clientGotServerMessage = true; }; ws.onclose = function() { assert.equal(ws.CLOSED, ws.readyState); clientGotServerClose = true; }; process.on('exit', function() { assert.ok(clientGotServerMessage); assert.ok(clientGotServerClose); assert.ok(serverGotClientClose); });
{ "pile_set_name": "Github" }
--- title: "ICorDebugModule2::ApplyChanges Method" ms.date: "03/30/2017" api_name: - "ICorDebugModule2.ApplyChanges" api_location: - "mscordbi.dll" api_type: - "COM" f1_keywords: - "ICorDebugModule2::ApplyChanges" helpviewer_keywords: - "ApplyChanges method [.NET Framework debugging]" - "ICorDebugModule2::ApplyChanges method [.NET Framework debugging]" ms.assetid: 96fa3406-6a6f-41a1-88c6-d9bc5d1a16d1 topic_type: - "apiref" --- # ICorDebugModule2::ApplyChanges Method Applies the changes in the metadata and the changes in the Microsoft intermediate language (MSIL) code to the running process. ## Syntax ```cpp HRESULT ApplyChanges ( [in] ULONG cbMetadata, [in, size_is(cbMetadata)] BYTE pbMetadata[], [in] ULONG cbIL, [in, size_is(cbIL)] BYTE pbIL[] ); ``` ## Parameters `cbMetadata` [in] Size, in bytes, of the delta metadata. `pbMetadata` [in] Buffer that contains the delta metadata. The address of the buffer is returned from the [IMetaDataEmit2::SaveDeltaToMemory](../metadata/imetadataemit2-savedeltatomemory-method.md) method. The relative virtual addresses (RVAs) in the metadata should be relative to the start of the MSIL code. `cbIL` [in] Size, in bytes, of the delta MSIL code. `pbIL` [in] Buffer that contains the updated MSIL code. ## Remarks The `pbMetadata` parameter is in a special delta metadata format (as output by [IMetaDataEmit2::SaveDeltaToMemory](../metadata/imetadataemit2-savedeltatomemory-method.md)). `pbMetadata` takes previous metadata as a base and describes individual changes to apply to that base. In contrast, the `pbIL[`] parameter contains the new MSIL for the updated method, and is meant to completely replace the previous MSIL for that method When the delta MSIL and the metadata have been created in the debugger’s memory, the debugger calls `ApplyChanges` to send the changes into the common language runtime (CLR). The runtime updates its metadata tables, places the new MSIL into the process, and sets up a just-in-time (JIT) compilation of the new MSIL. When the changes have been applied, the debugger should call [IMetaDataEmit2::ResetENCLog](../metadata/imetadataemit2-resetenclog-method.md) to prepare for the next editing session. The debugger may then continue the process. Whenever the debugger calls `ApplyChanges` on a module that has delta metadata, it should also call [IMetaDataEmit::ApplyEditAndContinue](../metadata/imetadataemit-applyeditandcontinue-method.md) with the same delta metadata on all of its copies of that module’s metadata except for the copy used to emit the changes. If a copy of the metadata somehow becomes out-of-sync with the actual metadata, the debugger can always throw away that copy and obtain a new copy. If the `ApplyChanges` method fails, the debug session is in an invalid state and must be restarted. ## Requirements **Platforms:** See [System Requirements](../../get-started/system-requirements.md). **Header:** CorDebug.idl, CorDebug.h **Library:** CorGuids.lib **.NET Framework Versions:** [!INCLUDE[net_current_v20plus](../../../../includes/net-current-v20plus-md.md)]
{ "pile_set_name": "Github" }
DROP TABLE IF EXISTS `#__finder_filters`; DROP TABLE IF EXISTS `#__finder_links`; DROP TABLE IF EXISTS `#__finder_links_terms0`; DROP TABLE IF EXISTS `#__finder_links_terms1`; DROP TABLE IF EXISTS `#__finder_links_terms2`; DROP TABLE IF EXISTS `#__finder_links_terms3`; DROP TABLE IF EXISTS `#__finder_links_terms4`; DROP TABLE IF EXISTS `#__finder_links_terms5`; DROP TABLE IF EXISTS `#__finder_links_terms6`; DROP TABLE IF EXISTS `#__finder_links_terms7`; DROP TABLE IF EXISTS `#__finder_links_terms8`; DROP TABLE IF EXISTS `#__finder_links_terms9`; DROP TABLE IF EXISTS `#__finder_links_termsa`; DROP TABLE IF EXISTS `#__finder_links_termsb`; DROP TABLE IF EXISTS `#__finder_links_termsc`; DROP TABLE IF EXISTS `#__finder_links_termsd`; DROP TABLE IF EXISTS `#__finder_links_termse`; DROP TABLE IF EXISTS `#__finder_links_termsf`; DROP TABLE IF EXISTS `#__finder_taxonomy`; DROP TABLE IF EXISTS `#__finder_taxonomy_map`; DROP TABLE IF EXISTS `#__finder_terms`; DROP TABLE IF EXISTS `#__finder_terms_common`; DROP TABLE IF EXISTS `#__finder_tokens`; DROP TABLE IF EXISTS `#__finder_tokens_aggregate`; DROP TABLE IF EXISTS `#__finder_types`;
{ "pile_set_name": "Github" }
{ "$schema": "http://json-schema.org/draft-07/schema#", "allOf": [{"$ref": "index.json"}], "title": "Application", "type": "object", "required": ["type"], "properties": { "type": { "type": "string", "const": "application" }, "driveTypes": { "type": "array", "items": { "type": "object", "required": ["id", "title"], "properties": { "id": {"type": "string"}, "title": {"type": "string"} } } } } }
{ "pile_set_name": "Github" }
sha256:7202a1ea885d5159cd97b24881c85072e2558074ced5e3ac96bf19b2bc929d43
{ "pile_set_name": "Github" }
/* * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Miscellaneous utilities which make use of the libavformat library */ #ifndef AVFILTER_LAVFUTILS_H #define AVFILTER_LAVFUTILS_H #include "libavformat/avformat.h" /** * Load image from filename and put the resulting image in data. * * @param w pointer to the width of the loaded image * @param h pointer to the height of the loaded image * @param pix_fmt pointer to the pixel format of the loaded image * @param filename the name of the image file to load * @param log_ctx log context * @return >= 0 in case of success, a negative error code otherwise. */ int ff_load_image(uint8_t *data[4], int linesize[4], int *w, int *h, enum AVPixelFormat *pix_fmt, const char *filename, void *log_ctx); #endif /* AVFILTER_LAVFUTILS_H */
{ "pile_set_name": "Github" }
/****************************************************************************** * QSkinny - Copyright (C) 2016 Uwe Rathmann * This file may be used under the terms of the QSkinny License, Version 1.0 *****************************************************************************/ #ifndef QSK_POPUP_H #define QSK_POPUP_H 1 #include "QskControl.h" class QSK_EXPORT QskPopup : public QskControl { Q_OBJECT Q_PROPERTY( bool open READ isOpen WRITE setOpen NOTIFY openChanged ) Q_PROPERTY( bool modal READ isModal WRITE setModal NOTIFY modalChanged ) Q_PROPERTY( bool overlay READ hasOverlay WRITE setOverlay NOTIFY overlayChanged ) Q_PROPERTY( bool faderEffect READ hasFaderEffect WRITE setFaderEffect NOTIFY faderEffectChanged ) Q_PROPERTY( uint priority READ priority WRITE setPriority NOTIFY priorityChanged ) using Inherited = QskControl; public: QSK_SUBCONTROLS( Overlay ) QSK_STATES( Closed ) enum PopupFlag { DeleteOnClose = 1 << 0, CloseOnPressOutside = 1 << 1 }; Q_ENUM( PopupFlag ) Q_DECLARE_FLAGS( PopupFlags, PopupFlag ) QskPopup( QQuickItem* parent = nullptr ); ~QskPopup() override; void setPopupFlags( PopupFlags ); PopupFlags popupFlags() const; void setPopupFlag( PopupFlag, bool on = true ); bool testPopupFlag( PopupFlag ) const; void setModal( bool on = true ); bool isModal() const; void setOverlay( bool on = true ); bool hasOverlay() const; // allows for stacking orders based on priorities void setPriority( uint ); uint priority() const; void setFaderEffect( bool ); bool hasFaderEffect() const; QskAspect::Aspect faderAspect() const; void setFaderAspect( QskAspect::Aspect ); virtual QRectF overlayRect() const; bool isOpen() const; bool isFading() const; public Q_SLOTS: void open(); void close(); void setOpen( bool ); Q_SIGNALS: void opened(); void closed(); void openChanged( bool ); void fadingChanged( bool ); void modalChanged( bool ); void overlayChanged( bool ); void priorityChanged( uint ); void faderEffectChanged( bool ); protected: void aboutToShow() override; bool event( QEvent* ) override; void focusInEvent( QFocusEvent* ) override; void focusOutEvent( QFocusEvent* ) override; void windowChangeEvent( QskWindowChangeEvent* ) override; void itemChange( QQuickItem::ItemChange, const QQuickItem::ItemChangeData& ) override; virtual QQuickItem* focusSuccessor() const; bool isTransitionAccepted( QskAspect::Aspect ) const override; void grabFocus( bool ); private: void show() = delete; void hide() = delete; void setVisible( bool ) = delete; void updateInputGrabber(); class PrivateData; std::unique_ptr< PrivateData > m_data; }; Q_DECLARE_OPERATORS_FOR_FLAGS( QskPopup::PopupFlags ) #endif
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>content</key> <string>after(function(){ $0 })</string> <key>name</key> <string>bdd - after</string> <key>scope</key> <string>source.js</string> <key>tabTrigger</key> <string>a</string> <key>uuid</key> <string>A49A87F9-399E-4D74-A489-C535BB06D487</string> </dict> </plist>
{ "pile_set_name": "Github" }
using System.Collections.Generic; using UnityEngine; namespace ET { public static class UnitPathComponentHelper { public static async ETTask MoveAsync(this UnitPathComponent self, List<Vector3> path) { if (path.Count == 0) { return; } // 第一个点是unit的当前位置,所以不用发送 for (int i = 1; i < path.Count; ++i) { // 每移动3个点发送下3个点给客户端 if (i % 3 == 1) { self.BroadcastPath(path, i, 3); } Vector3 v3 = path[i]; //await self.Parent.GetComponent<MoveComponent>().MoveToAsync(v3, self.CancellationToken); } } public static async ETVoid MoveTo(this UnitPathComponent self, Vector3 target) { if ((self.Target - target).magnitude < 0.1f) { return; } self.Target = target; Unit unit = self.GetParent<Unit>(); } // 从index找接下来3个点,广播 public static void BroadcastPath(this UnitPathComponent self, List<Vector3> path, int index, int offset) { Unit unit = self.GetParent<Unit>(); Vector3 unitPos = unit.Position; M2C_PathfindingResult m2CPathfindingResult = new M2C_PathfindingResult(); m2CPathfindingResult.X = unitPos.x; m2CPathfindingResult.Y = unitPos.y; m2CPathfindingResult.Z = unitPos.z; m2CPathfindingResult.Id = unit.Id; MessageHelper.Broadcast(unit, m2CPathfindingResult); } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta name="keywords" content="W3C SVG 1.1 Test Suite testsuite mobile"/> <meta name="description" content="W3C SVG 1.2 Tiny Test Suite"/> <title> SVG 1.2 Tiny test:script-handle-06-t </title> <style type="text/css"> <!-- .bodytext { font-family:verdana, helvetica, sans-serif; font-size: 12pt; line-height: 125%; text-align: Left; margin-top: 0; margin-bottom: 0 } .pageTitle { line-height: 150%; font-size: 20pt; font-weight : 900; margin-bottom: 20pt } .pageSubTitle { color : blue; line-height: 100%; font-size: 24pt; font-weight : 900 } .openChapter { color : blue; line-height: 125%; font-weight : 900 } .openSection { color : blue; line-height: 125%; font-weight : 900 } .info { color : black; line-height: 110%; font-size: 10pt; font-weight : 100 } p { margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0 } blockquote { margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0 } .opscript {margin-left: 3%; margin-right: 3%; } .opscript p { margin-top: 0.7em} .navbar {background: black; color: white; font-weight: bold} --> </style> </head> <body class="bodytext"> <div class="linkbar"> <p> <a href="script-handle-06-t.html">Tiny version</a></p> <p>Specification link: <a target="spec" href="http://www.w3.org/TR/SVGMobile12/script.html">15.6 Event handling</a></p> <p> <a href="script-handle-05-t.html">script-handle-05-t ←</a> <a href="index.html">index</a> <a href="script-handle-07-t.html">→ script-handle-07-t</a> </p></div> <table align="center" border="0" cellspacing="0" cellpadding="10"> <tr> <td align="center" colspan="3"> <table border="0" cellpadding="8"> <tr> <td align="center" colspan="2" class="pageTitle"> <h1>script-handle-06-t</h1> </td> </tr> <tr class="navbar"> <td align="center"> SVG Image </td> <td align="center"> PNG Image </td> </tr> <tr> <td align="right"> <object data="../svggen/script-handle-06-t.svg" width="480" height="360" type="image/svg+xml"><p style="font-size:300%;color:red">FAIL</p></object> </td> <td align="left"> <img alt="raster image of script-handle-06-t" src="../png/script-handle-06-t.png" width="480" height="360"/> </td> </tr> </table> </td> </tr> </table> <div class="opscript"> <p>Tests basic mouse event handlers.</p> <p>The test shows a target that can be used to generate the various kinds of mouse and keyboard events supported in SVG. Below the target, the list of events is shown with red markers next to each.</p> <p>If the test passes, all the markers should have turned to green after the events have been triggered on the target. If any event has not triggered, its marker will remain red.</p> </div> <div class="linkbar"> <p> <a href="script-handle-05-t.html">script-handle-05-t ←</a> <a href="index.html">index</a> <a href="script-handle-07-t.html">→ script-handle-07-t</a> </p></div> </body> </html>
{ "pile_set_name": "Github" }
.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.39) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "X509_SIG_GET0 3" .TH X509_SIG_GET0 3 "2019-09-10" "1.1.1d" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" X509_SIG_get0, X509_SIG_getm \- DigestInfo functions .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include <openssl/x509.h> \& \& void X509_SIG_get0(const X509_SIG *sig, const X509_ALGOR **palg, \& const ASN1_OCTET_STRING **pdigest); \& void X509_SIG_getm(X509_SIG *sig, X509_ALGOR **palg, \& ASN1_OCTET_STRING **pdigest, .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBX509_SIG_get0()\fR returns pointers to the algorithm identifier and digest value in \fBsig\fR. \fBX509_SIG_getm()\fR is identical to \fBX509_SIG_get0()\fR except the pointers returned are not constant and can be modified: for example to initialise them. .SH "RETURN VALUES" .IX Header "RETURN VALUES" \&\fBX509_SIG_get0()\fR and \fBX509_SIG_getm()\fR return no values. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBd2i_X509\fR\|(3) .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2002\-2018 The OpenSSL Project Authors. All Rights Reserved. .PP Licensed under the OpenSSL license (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.
{ "pile_set_name": "Github" }
{ "name": "Serendipity", "website": "http://s9y.org", "matches": [ { "search": "meta[Powered-By]", "regexp": "Serendipity v\\.([\\d.]+)", "offset": 1 }, { "search": "meta[generator]", "regexp": "Serendipity(?: v\\.([\\d.]+))?", "offset": 1 } ], "implies": "PHP" }
{ "pile_set_name": "Github" }
#include "core_reloc_types.h" void f(struct core_reloc_existence___err_wrong_int_sz x) {}
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> </startup> </configuration>
{ "pile_set_name": "Github" }
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ #ifndef DEF_DEADMINES_H #define DEF_DEADMINES_H enum { MAX_ENCOUNTER = 4, TYPE_RHAHKZOR = 0, TYPE_SNEED = 1, TYPE_GILNID = 2, TYPE_IRON_CLAD_DOOR = 3, INST_SAY_ALARM1 = -1036000, INST_SAY_ALARM2 = -1036001, GO_FACTORY_DOOR = 13965, // rhahk'zor GO_MAST_ROOM_DOOR = 16400, // sneed GO_FOUNDRY_DOOR = 16399, // gilnid GO_HEAVY_DOOR_1 = 17153, // to sneed GO_HEAVY_DOOR_2 = 17154, // to gilnid GO_IRON_CLAD_DOOR = 16397, GO_DEFIAS_CANNON = 16398, GO_SMITE_CHEST = 144111, // use to get correct location of mr.smites equipment changes GO_MYSTERIOUS_CHEST = 180024, // used for quest 7938; spawns in the instance only if one of the players has the quest NPC_RHAHKZOR = 644, NPC_SNEED = 643, NPC_GILNID = 1763, NPC_MR_SMITE = 646, NPC_PIRATE = 657, NPC_SQUALLSHAPER = 1732, QUEST_FORTUNE_AWAITS = 7938, }; class instance_deadmines : public ScriptedInstance { public: instance_deadmines(Map* pMap); void Initialize() override; void OnPlayerEnter(Player* pPlayer) override; void OnCreatureCreate(Creature* pCreature) override; void OnObjectCreate(GameObject* pGo) override; void OnCreatureDeath(Creature* pCreature) override; void SetData(uint32 uiType, uint32 uiData) override; uint32 GetData(uint32 uiType) const override; const char* Save() const override { return m_strInstData.c_str(); } void Load(const char* chrIn) override; void Update(uint32 uiDiff) override; private: uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string m_strInstData; uint32 m_uiIronDoorTimer; uint32 m_uiDoorStep; }; #endif
{ "pile_set_name": "Github" }
// SPDX-License-Identifier: GPL-2.0 #include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <linux/kernel.h> #include "util/dso.h" #include "util/util.h" #include "util/debug.h" #include "util/callchain.h" #include "srcline.h" #include "string2.h" #include "symbol.h" bool srcline_full_filename; static const char *dso__name(struct dso *dso) { const char *dso_name; if (dso->symsrc_filename) dso_name = dso->symsrc_filename; else dso_name = dso->long_name; if (dso_name[0] == '[') return NULL; if (!strncmp(dso_name, "/tmp/perf-", 10)) return NULL; return dso_name; } static int inline_list__append(struct symbol *symbol, char *srcline, struct inline_node *node) { struct inline_list *ilist; ilist = zalloc(sizeof(*ilist)); if (ilist == NULL) return -1; ilist->symbol = symbol; ilist->srcline = srcline; if (callchain_param.order == ORDER_CALLEE) list_add_tail(&ilist->list, &node->val); else list_add(&ilist->list, &node->val); return 0; } /* basename version that takes a const input string */ static const char *gnu_basename(const char *path) { const char *base = strrchr(path, '/'); return base ? base + 1 : path; } static char *srcline_from_fileline(const char *file, unsigned int line) { char *srcline; if (!file) return NULL; if (!srcline_full_filename) file = gnu_basename(file); if (asprintf(&srcline, "%s:%u", file, line) < 0) return NULL; return srcline; } static struct symbol *new_inline_sym(struct dso *dso, struct symbol *base_sym, const char *funcname) { struct symbol *inline_sym; char *demangled = NULL; if (!funcname) funcname = "??"; if (dso) { demangled = dso__demangle_sym(dso, 0, funcname); if (demangled) funcname = demangled; } if (base_sym && strcmp(funcname, base_sym->name) == 0) { /* reuse the real, existing symbol */ inline_sym = base_sym; /* ensure that we don't alias an inlined symbol, which could * lead to double frees in inline_node__delete */ assert(!base_sym->inlined); } else { /* create a fake symbol for the inline frame */ inline_sym = symbol__new(base_sym ? base_sym->start : 0, base_sym ? (base_sym->end - base_sym->start) : 0, base_sym ? base_sym->binding : 0, base_sym ? base_sym->type : 0, funcname); if (inline_sym) inline_sym->inlined = 1; } free(demangled); return inline_sym; } #ifdef HAVE_LIBBFD_SUPPORT /* * Implement addr2line using libbfd. */ #define PACKAGE "perf" #include <bfd.h> struct a2l_data { const char *input; u64 addr; bool found; const char *filename; const char *funcname; unsigned line; bfd *abfd; asymbol **syms; }; static int bfd_error(const char *string) { const char *errmsg; errmsg = bfd_errmsg(bfd_get_error()); fflush(stdout); if (string) pr_debug("%s: %s\n", string, errmsg); else pr_debug("%s\n", errmsg); return -1; } static int slurp_symtab(bfd *abfd, struct a2l_data *a2l) { long storage; long symcount; asymbol **syms; bfd_boolean dynamic = FALSE; if ((bfd_get_file_flags(abfd) & HAS_SYMS) == 0) return bfd_error(bfd_get_filename(abfd)); storage = bfd_get_symtab_upper_bound(abfd); if (storage == 0L) { storage = bfd_get_dynamic_symtab_upper_bound(abfd); dynamic = TRUE; } if (storage < 0L) return bfd_error(bfd_get_filename(abfd)); syms = malloc(storage); if (dynamic) symcount = bfd_canonicalize_dynamic_symtab(abfd, syms); else symcount = bfd_canonicalize_symtab(abfd, syms); if (symcount < 0) { free(syms); return bfd_error(bfd_get_filename(abfd)); } a2l->syms = syms; return 0; } static void find_address_in_section(bfd *abfd, asection *section, void *data) { bfd_vma pc, vma; bfd_size_type size; struct a2l_data *a2l = data; if (a2l->found) return; if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0) return; pc = a2l->addr; vma = bfd_get_section_vma(abfd, section); size = bfd_get_section_size(section); if (pc < vma || pc >= vma + size) return; a2l->found = bfd_find_nearest_line(abfd, section, a2l->syms, pc - vma, &a2l->filename, &a2l->funcname, &a2l->line); if (a2l->filename && !strlen(a2l->filename)) a2l->filename = NULL; } static struct a2l_data *addr2line_init(const char *path) { bfd *abfd; struct a2l_data *a2l = NULL; abfd = bfd_openr(path, NULL); if (abfd == NULL) return NULL; if (!bfd_check_format(abfd, bfd_object)) goto out; a2l = zalloc(sizeof(*a2l)); if (a2l == NULL) goto out; a2l->abfd = abfd; a2l->input = strdup(path); if (a2l->input == NULL) goto out; if (slurp_symtab(abfd, a2l)) goto out; return a2l; out: if (a2l) { zfree((char **)&a2l->input); free(a2l); } bfd_close(abfd); return NULL; } static void addr2line_cleanup(struct a2l_data *a2l) { if (a2l->abfd) bfd_close(a2l->abfd); zfree((char **)&a2l->input); zfree(&a2l->syms); free(a2l); } #define MAX_INLINE_NEST 1024 static int inline_list__append_dso_a2l(struct dso *dso, struct inline_node *node, struct symbol *sym) { struct a2l_data *a2l = dso->a2l; struct symbol *inline_sym = new_inline_sym(dso, sym, a2l->funcname); char *srcline = NULL; if (a2l->filename) srcline = srcline_from_fileline(a2l->filename, a2l->line); return inline_list__append(inline_sym, srcline, node); } static int addr2line(const char *dso_name, u64 addr, char **file, unsigned int *line, struct dso *dso, bool unwind_inlines, struct inline_node *node, struct symbol *sym) { int ret = 0; struct a2l_data *a2l = dso->a2l; if (!a2l) { dso->a2l = addr2line_init(dso_name); a2l = dso->a2l; } if (a2l == NULL) { pr_warning("addr2line_init failed for %s\n", dso_name); return 0; } a2l->addr = addr; a2l->found = false; bfd_map_over_sections(a2l->abfd, find_address_in_section, a2l); if (!a2l->found) return 0; if (unwind_inlines) { int cnt = 0; if (node && inline_list__append_dso_a2l(dso, node, sym)) return 0; while (bfd_find_inliner_info(a2l->abfd, &a2l->filename, &a2l->funcname, &a2l->line) && cnt++ < MAX_INLINE_NEST) { if (a2l->filename && !strlen(a2l->filename)) a2l->filename = NULL; if (node != NULL) { if (inline_list__append_dso_a2l(dso, node, sym)) return 0; // found at least one inline frame ret = 1; } } } if (file) { *file = a2l->filename ? strdup(a2l->filename) : NULL; ret = *file ? 1 : 0; } if (line) *line = a2l->line; return ret; } void dso__free_a2l(struct dso *dso) { struct a2l_data *a2l = dso->a2l; if (!a2l) return; addr2line_cleanup(a2l); dso->a2l = NULL; } static struct inline_node *addr2inlines(const char *dso_name, u64 addr, struct dso *dso, struct symbol *sym) { struct inline_node *node; node = zalloc(sizeof(*node)); if (node == NULL) { perror("not enough memory for the inline node"); return NULL; } INIT_LIST_HEAD(&node->val); node->addr = addr; addr2line(dso_name, addr, NULL, NULL, dso, true, node, sym); return node; } #else /* HAVE_LIBBFD_SUPPORT */ static int filename_split(char *filename, unsigned int *line_nr) { char *sep; sep = strchr(filename, '\n'); if (sep) *sep = '\0'; if (!strcmp(filename, "??:0")) return 0; sep = strchr(filename, ':'); if (sep) { *sep++ = '\0'; *line_nr = strtoul(sep, NULL, 0); return 1; } return 0; } static int addr2line(const char *dso_name, u64 addr, char **file, unsigned int *line_nr, struct dso *dso __maybe_unused, bool unwind_inlines __maybe_unused, struct inline_node *node __maybe_unused, struct symbol *sym __maybe_unused) { FILE *fp; char cmd[PATH_MAX]; char *filename = NULL; size_t len; int ret = 0; scnprintf(cmd, sizeof(cmd), "addr2line -e %s %016"PRIx64, dso_name, addr); fp = popen(cmd, "r"); if (fp == NULL) { pr_warning("popen failed for %s\n", dso_name); return 0; } if (getline(&filename, &len, fp) < 0 || !len) { pr_warning("addr2line has no output for %s\n", dso_name); goto out; } ret = filename_split(filename, line_nr); if (ret != 1) { free(filename); goto out; } *file = filename; out: pclose(fp); return ret; } void dso__free_a2l(struct dso *dso __maybe_unused) { } static struct inline_node *addr2inlines(const char *dso_name, u64 addr, struct dso *dso __maybe_unused, struct symbol *sym) { FILE *fp; char cmd[PATH_MAX]; struct inline_node *node; char *filename = NULL; char *funcname = NULL; size_t filelen, funclen; unsigned int line_nr = 0; scnprintf(cmd, sizeof(cmd), "addr2line -e %s -i -f %016"PRIx64, dso_name, addr); fp = popen(cmd, "r"); if (fp == NULL) { pr_err("popen failed for %s\n", dso_name); return NULL; } node = zalloc(sizeof(*node)); if (node == NULL) { perror("not enough memory for the inline node"); goto out; } INIT_LIST_HEAD(&node->val); node->addr = addr; /* addr2line -f generates two lines for each inlined functions */ while (getline(&funcname, &funclen, fp) != -1) { char *srcline; struct symbol *inline_sym; rtrim(funcname); if (getline(&filename, &filelen, fp) == -1) goto out; if (filename_split(filename, &line_nr) != 1) goto out; srcline = srcline_from_fileline(filename, line_nr); inline_sym = new_inline_sym(dso, sym, funcname); if (inline_list__append(inline_sym, srcline, node) != 0) { free(srcline); if (inline_sym && inline_sym->inlined) symbol__delete(inline_sym); goto out; } } out: pclose(fp); free(filename); free(funcname); return node; } #endif /* HAVE_LIBBFD_SUPPORT */ /* * Number of addr2line failures (without success) before disabling it for that * dso. */ #define A2L_FAIL_LIMIT 123 char *__get_srcline(struct dso *dso, u64 addr, struct symbol *sym, bool show_sym, bool show_addr, bool unwind_inlines, u64 ip) { char *file = NULL; unsigned line = 0; char *srcline; const char *dso_name; if (!dso->has_srcline) goto out; dso_name = dso__name(dso); if (dso_name == NULL) goto out; if (!addr2line(dso_name, addr, &file, &line, dso, unwind_inlines, NULL, sym)) goto out; srcline = srcline_from_fileline(file, line); free(file); if (!srcline) goto out; dso->a2l_fails = 0; return srcline; out: if (dso->a2l_fails && ++dso->a2l_fails > A2L_FAIL_LIMIT) { dso->has_srcline = 0; dso__free_a2l(dso); } if (!show_addr) return (show_sym && sym) ? strndup(sym->name, sym->namelen) : NULL; if (sym) { if (asprintf(&srcline, "%s+%" PRIu64, show_sym ? sym->name : "", ip - sym->start) < 0) return SRCLINE_UNKNOWN; } else if (asprintf(&srcline, "%s[%" PRIx64 "]", dso->short_name, addr) < 0) return SRCLINE_UNKNOWN; return srcline; } void free_srcline(char *srcline) { if (srcline && strcmp(srcline, SRCLINE_UNKNOWN) != 0) free(srcline); } char *get_srcline(struct dso *dso, u64 addr, struct symbol *sym, bool show_sym, bool show_addr, u64 ip) { return __get_srcline(dso, addr, sym, show_sym, show_addr, false, ip); } struct srcline_node { u64 addr; char *srcline; struct rb_node rb_node; }; void srcline__tree_insert(struct rb_root *tree, u64 addr, char *srcline) { struct rb_node **p = &tree->rb_node; struct rb_node *parent = NULL; struct srcline_node *i, *node; node = zalloc(sizeof(struct srcline_node)); if (!node) { perror("not enough memory for the srcline node"); return; } node->addr = addr; node->srcline = srcline; while (*p != NULL) { parent = *p; i = rb_entry(parent, struct srcline_node, rb_node); if (addr < i->addr) p = &(*p)->rb_left; else p = &(*p)->rb_right; } rb_link_node(&node->rb_node, parent, p); rb_insert_color(&node->rb_node, tree); } char *srcline__tree_find(struct rb_root *tree, u64 addr) { struct rb_node *n = tree->rb_node; while (n) { struct srcline_node *i = rb_entry(n, struct srcline_node, rb_node); if (addr < i->addr) n = n->rb_left; else if (addr > i->addr) n = n->rb_right; else return i->srcline; } return NULL; } void srcline__tree_delete(struct rb_root *tree) { struct srcline_node *pos; struct rb_node *next = rb_first(tree); while (next) { pos = rb_entry(next, struct srcline_node, rb_node); next = rb_next(&pos->rb_node); rb_erase(&pos->rb_node, tree); free_srcline(pos->srcline); zfree(&pos); } } struct inline_node *dso__parse_addr_inlines(struct dso *dso, u64 addr, struct symbol *sym) { const char *dso_name; dso_name = dso__name(dso); if (dso_name == NULL) return NULL; return addr2inlines(dso_name, addr, dso, sym); } void inline_node__delete(struct inline_node *node) { struct inline_list *ilist, *tmp; list_for_each_entry_safe(ilist, tmp, &node->val, list) { list_del_init(&ilist->list); free_srcline(ilist->srcline); /* only the inlined symbols are owned by the list */ if (ilist->symbol && ilist->symbol->inlined) symbol__delete(ilist->symbol); free(ilist); } free(node); } void inlines__tree_insert(struct rb_root *tree, struct inline_node *inlines) { struct rb_node **p = &tree->rb_node; struct rb_node *parent = NULL; const u64 addr = inlines->addr; struct inline_node *i; while (*p != NULL) { parent = *p; i = rb_entry(parent, struct inline_node, rb_node); if (addr < i->addr) p = &(*p)->rb_left; else p = &(*p)->rb_right; } rb_link_node(&inlines->rb_node, parent, p); rb_insert_color(&inlines->rb_node, tree); } struct inline_node *inlines__tree_find(struct rb_root *tree, u64 addr) { struct rb_node *n = tree->rb_node; while (n) { struct inline_node *i = rb_entry(n, struct inline_node, rb_node); if (addr < i->addr) n = n->rb_left; else if (addr > i->addr) n = n->rb_right; else return i; } return NULL; } void inlines__tree_delete(struct rb_root *tree) { struct inline_node *pos; struct rb_node *next = rb_first(tree); while (next) { pos = rb_entry(next, struct inline_node, rb_node); next = rb_next(&pos->rb_node); rb_erase(&pos->rb_node, tree); inline_node__delete(pos); } }
{ "pile_set_name": "Github" }
package org.diplr.cloud.deprecated.netflix.notifications.model; public class Notification { private String id; private String message; public String getId() { return id; } public Notification setId(String id) { this.id = id; return this; } public String getMessage() { return message; } public Notification setMessage(String message) { this.message = message; return this; } }
{ "pile_set_name": "Github" }
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package bidi import ( "container/list" "fmt" "sort" ) // This file contains a port of the reference implementation of the // Bidi Parentheses Algorithm: // http://www.unicode.org/Public/PROGRAMS/BidiReferenceJava/BidiPBAReference.java // // The implementation in this file covers definitions BD14-BD16 and rule N0 // of UAX#9. // // Some preprocessing is done for each rune before data is passed to this // algorithm: // - opening and closing brackets are identified // - a bracket pair type, like '(' and ')' is assigned a unique identifier that // is identical for the opening and closing bracket. It is left to do these // mappings. // - The BPA algorithm requires that bracket characters that are canonical // equivalents of each other be able to be substituted for each other. // It is the responsibility of the caller to do this canonicalization. // // In implementing BD16, this implementation departs slightly from the "logical" // algorithm defined in UAX#9. In particular, the stack referenced there // supports operations that go beyond a "basic" stack. An equivalent // implementation based on a linked list is used here. // Bidi_Paired_Bracket_Type // BD14. An opening paired bracket is a character whose // Bidi_Paired_Bracket_Type property value is Open. // // BD15. A closing paired bracket is a character whose // Bidi_Paired_Bracket_Type property value is Close. type bracketType byte const ( bpNone bracketType = iota bpOpen bpClose ) // bracketPair holds a pair of index values for opening and closing bracket // location of a bracket pair. type bracketPair struct { opener int closer int } func (b *bracketPair) String() string { return fmt.Sprintf("(%v, %v)", b.opener, b.closer) } // bracketPairs is a slice of bracketPairs with a sort.Interface implementation. type bracketPairs []bracketPair func (b bracketPairs) Len() int { return len(b) } func (b bracketPairs) Swap(i, j int) { b[i], b[j] = b[j], b[i] } func (b bracketPairs) Less(i, j int) bool { return b[i].opener < b[j].opener } // resolvePairedBrackets runs the paired bracket part of the UBA algorithm. // // For each rune, it takes the indexes into the original string, the class the // bracket type (in pairTypes) and the bracket identifier (pairValues). It also // takes the direction type for the start-of-sentence and the embedding level. // // The identifiers for bracket types are the rune of the canonicalized opening // bracket for brackets (open or close) or 0 for runes that are not brackets. func resolvePairedBrackets(s *isolatingRunSequence) { p := bracketPairer{ sos: s.sos, openers: list.New(), codesIsolatedRun: s.types, indexes: s.indexes, } dirEmbed := L if s.level&1 != 0 { dirEmbed = R } p.locateBrackets(s.p.pairTypes, s.p.pairValues) p.resolveBrackets(dirEmbed, s.p.initialTypes) } type bracketPairer struct { sos Class // direction corresponding to start of sequence // The following is a restatement of BD 16 using non-algorithmic language. // // A bracket pair is a pair of characters consisting of an opening // paired bracket and a closing paired bracket such that the // Bidi_Paired_Bracket property value of the former equals the latter, // subject to the following constraints. // - both characters of a pair occur in the same isolating run sequence // - the closing character of a pair follows the opening character // - any bracket character can belong at most to one pair, the earliest possible one // - any bracket character not part of a pair is treated like an ordinary character // - pairs may nest properly, but their spans may not overlap otherwise // Bracket characters with canonical decompositions are supposed to be // treated as if they had been normalized, to allow normalized and non- // normalized text to give the same result. In this implementation that step // is pushed out to the caller. The caller has to ensure that the pairValue // slices contain the rune of the opening bracket after normalization for // any opening or closing bracket. openers *list.List // list of positions for opening brackets // bracket pair positions sorted by location of opening bracket pairPositions bracketPairs codesIsolatedRun []Class // directional bidi codes for an isolated run indexes []int // array of index values into the original string } // matchOpener reports whether characters at given positions form a matching // bracket pair. func (p *bracketPairer) matchOpener(pairValues []rune, opener, closer int) bool { return pairValues[p.indexes[opener]] == pairValues[p.indexes[closer]] } const maxPairingDepth = 63 // locateBrackets locates matching bracket pairs according to BD16. // // This implementation uses a linked list instead of a stack, because, while // elements are added at the front (like a push) they are not generally removed // in atomic 'pop' operations, reducing the benefit of the stack archetype. func (p *bracketPairer) locateBrackets(pairTypes []bracketType, pairValues []rune) { // traverse the run // do that explicitly (not in a for-each) so we can record position for i, index := range p.indexes { // look at the bracket type for each character if pairTypes[index] == bpNone || p.codesIsolatedRun[i] != ON { // continue scanning continue } switch pairTypes[index] { case bpOpen: // check if maximum pairing depth reached if p.openers.Len() == maxPairingDepth { p.openers.Init() return } // remember opener location, most recent first p.openers.PushFront(i) case bpClose: // see if there is a match count := 0 for elem := p.openers.Front(); elem != nil; elem = elem.Next() { count++ opener := elem.Value.(int) if p.matchOpener(pairValues, opener, i) { // if the opener matches, add nested pair to the ordered list p.pairPositions = append(p.pairPositions, bracketPair{opener, i}) // remove up to and including matched opener for ; count > 0; count-- { p.openers.Remove(p.openers.Front()) } break } } sort.Sort(p.pairPositions) // if we get here, the closing bracket matched no openers // and gets ignored } } } // Bracket pairs within an isolating run sequence are processed as units so // that both the opening and the closing paired bracket in a pair resolve to // the same direction. // // N0. Process bracket pairs in an isolating run sequence sequentially in // the logical order of the text positions of the opening paired brackets // using the logic given below. Within this scope, bidirectional types EN // and AN are treated as R. // // Identify the bracket pairs in the current isolating run sequence // according to BD16. For each bracket-pair element in the list of pairs of // text positions: // // a Inspect the bidirectional types of the characters enclosed within the // bracket pair. // // b If any strong type (either L or R) matching the embedding direction is // found, set the type for both brackets in the pair to match the embedding // direction. // // o [ e ] o -> o e e e o // // o [ o e ] -> o e o e e // // o [ NI e ] -> o e NI e e // // c Otherwise, if a strong type (opposite the embedding direction) is // found, test for adjacent strong types as follows: 1 First, check // backwards before the opening paired bracket until the first strong type // (L, R, or sos) is found. If that first preceding strong type is opposite // the embedding direction, then set the type for both brackets in the pair // to that type. 2 Otherwise, set the type for both brackets in the pair to // the embedding direction. // // o [ o ] e -> o o o o e // // o [ o NI ] o -> o o o NI o o // // e [ o ] o -> e e o e o // // e [ o ] e -> e e o e e // // e ( o [ o ] NI ) e -> e e o o o o NI e e // // d Otherwise, do not set the type for the current bracket pair. Note that // if the enclosed text contains no strong types the paired brackets will // both resolve to the same level when resolved individually using rules N1 // and N2. // // e ( NI ) o -> e ( NI ) o // getStrongTypeN0 maps character's directional code to strong type as required // by rule N0. // // TODO: have separate type for "strong" directionality. func (p *bracketPairer) getStrongTypeN0(index int) Class { switch p.codesIsolatedRun[index] { // in the scope of N0, number types are treated as R case EN, AN, AL, R: return R case L: return L default: return ON } } // classifyPairContent reports the strong types contained inside a Bracket Pair, // assuming the given embedding direction. // // It returns ON if no strong type is found. If a single strong type is found, // it returns this this type. Otherwise it returns the embedding direction. // // TODO: use separate type for "strong" directionality. func (p *bracketPairer) classifyPairContent(loc bracketPair, dirEmbed Class) Class { dirOpposite := ON for i := loc.opener + 1; i < loc.closer; i++ { dir := p.getStrongTypeN0(i) if dir == ON { continue } if dir == dirEmbed { return dir // type matching embedding direction found } dirOpposite = dir } // return ON if no strong type found, or class opposite to dirEmbed return dirOpposite } // classBeforePair determines which strong types are present before a Bracket // Pair. Return R or L if strong type found, otherwise ON. func (p *bracketPairer) classBeforePair(loc bracketPair) Class { for i := loc.opener - 1; i >= 0; i-- { if dir := p.getStrongTypeN0(i); dir != ON { return dir } } // no strong types found, return sos return p.sos } // assignBracketType implements rule N0 for a single bracket pair. func (p *bracketPairer) assignBracketType(loc bracketPair, dirEmbed Class, initialTypes []Class) { // rule "N0, a", inspect contents of pair dirPair := p.classifyPairContent(loc, dirEmbed) // dirPair is now L, R, or N (no strong type found) // the following logical tests are performed out of order compared to // the statement of the rules but yield the same results if dirPair == ON { return // case "d" - nothing to do } if dirPair != dirEmbed { // case "c": strong type found, opposite - check before (c.1) dirPair = p.classBeforePair(loc) if dirPair == dirEmbed || dirPair == ON { // no strong opposite type found before - use embedding (c.2) dirPair = dirEmbed } } // else: case "b", strong type found matching embedding, // no explicit action needed, as dirPair is already set to embedding // direction // set the bracket types to the type found p.setBracketsToType(loc, dirPair, initialTypes) } func (p *bracketPairer) setBracketsToType(loc bracketPair, dirPair Class, initialTypes []Class) { p.codesIsolatedRun[loc.opener] = dirPair p.codesIsolatedRun[loc.closer] = dirPair for i := loc.opener + 1; i < loc.closer; i++ { index := p.indexes[i] if initialTypes[index] != NSM { break } p.codesIsolatedRun[i] = dirPair } for i := loc.closer + 1; i < len(p.indexes); i++ { index := p.indexes[i] if initialTypes[index] != NSM { break } p.codesIsolatedRun[i] = dirPair } } // resolveBrackets implements rule N0 for a list of pairs. func (p *bracketPairer) resolveBrackets(dirEmbed Class, initialTypes []Class) { for _, loc := range p.pairPositions { p.assignBracketType(loc, dirEmbed, initialTypes) } }
{ "pile_set_name": "Github" }
CREATE DATABASE IF NOT EXISTS `game` DEFAULT CHARACTER SET utf8; USE `game`; DROP TABLE IF EXISTS `global`; CREATE TABLE `global` ( type varchar(120) NOT NULL, value bigint(20) NOT NULL default '0', PRIMARY KEY (`type`) )ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `role`; CREATE TABLE `role` ( role_id bigint(20) NOT NULL auto_increment, role_name varchar(120) NOT NULL default '', account varchar(120) NOT NULL default '', client_ip varchar(120) NOT NULL default '', agent_num int(11) NOT NULL default '0', server_num int(11) NOT NULL default '0', level int(11) NOT NULL default '0', exp int(11) NOT NULL default '0', gender tinyint(3) NOT NULL default '0', career tinyint(3) NOT NULL default '0', create_time int(11) NOT NULL default '0', login_time int(11) NOT NULL default '0', logout_time int(11) NOT NULL default '0', vip_level int(11) NOT NULL default '0', vip_exp int(11) NOT NULL default '0', charge_gold int(11) NOT NULL default '0', guild_id bigint(20) NOT NULL default '0', guild_name varchar(120) NOT NULL default '', scene_id int(11) NOT NULL default '0', pos_x int(11) NOT NULL default '0', pos_y int(11) NOT NULL default '0', pos_z int(11) NOT NULL default '0', PRIMARY KEY (role_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `bag`; CREATE TABLE `bag` ( role_id bigint(20) NOT NULL auto_increment, copper int(11) NOT NULL default '0', gold int(11) NOT NULL default '0', item_map text NOT NULL, PRIMARY KEY (role_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `mail`; CREATE TABLE `mail` ( role_id bigint(20) NOT NULL auto_increment, total_count int(11) NOT NULL default '0', mail_map text NOT NULL, PRIMARY KEY (role_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `guild`; CREATE TABLE `guild` ( guild_id bigint(20) NOT NULL auto_increment, guild_name varchar(120) NOT NULL default '', chief_id bigint(20) NOT NULL default '0', create_time int(11) NOT NULL default '0', member_list text NOT NULL, app_list text NOT NULL, PRIMARY KEY (guild_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `rank`; CREATE TABLE `rank` ( rank_type bigint(20) NOT NULL auto_increment, min_value int(11) NOT NULL default '0', min_role_id bigint(20) NOT NULL default '0', member_map text NOT NULL, PRIMARY KEY (rank_type) )ENGINE=InnoDB DEFAULT CHARSET=utf8; DROP TABLE IF EXISTS `offline`; CREATE TABLE `offline` ( role_id bigint(20) NOT NULL auto_increment, guild_id bigint(20) NOT NULL default '0', guild_name varchar(120) NOT NULL default '', PRIMARY KEY (role_id) )ENGINE=InnoDB DEFAULT CHARSET=utf8;
{ "pile_set_name": "Github" }
``` pandoc -f latex -t native \documentclass{article} \usepackage{hyperref} \begin{document} The file id is \nolinkurl{ESP_123_5235}. \end{document} ^D [Para [Str "The",Space,Str "file",Space,Str "id",Space,Str "is",Space,Code ("",[],[]) "ESP_123_5235",Str "."]] ```
{ "pile_set_name": "Github" }
require 'spec_helper' describe "should respond_to(:sym)" do it "passes if target responds to :sym" do Object.new.should respond_to(:methods) end it "fails if target does not respond to :sym" do lambda { "this string".should respond_to(:some_method) }.should fail_with(%q|expected "this string" to respond to :some_method|) end end describe "should respond_to(:sym).with(1).argument" do it "passes if target responds to :sym with 1 arg" do obj = Object.new def obj.foo(arg); end obj.should respond_to(:foo).with(1).argument end it "fails if target does not respond to :sym" do obj = Object.new lambda { obj.should respond_to(:some_method).with(1).argument }.should fail_with(/expected .* to respond to :some_method/) end it "fails if :sym expects 0 args" do obj = Object.new def obj.foo; end lambda { obj.should respond_to(:foo).with(1).argument }.should fail_with(/expected #<Object.*> to respond to :foo with 1 argument/) end it "fails if :sym expects 2 args" do obj = Object.new def obj.foo(arg, arg2); end lambda { obj.should respond_to(:foo).with(1).argument }.should fail_with(/expected #<Object.*> to respond to :foo with 1 argument/) end end describe "should respond_to(message1, message2)" do it "passes if target responds to both messages" do Object.new.should respond_to('methods', 'inspect') end it "fails if target does not respond to first message" do lambda { Object.new.should respond_to('method_one', 'inspect') }.should fail_with(/expected #<Object:.*> to respond to "method_one"/) end it "fails if target does not respond to second message" do lambda { Object.new.should respond_to('inspect', 'method_one') }.should fail_with(/expected #<Object:.*> to respond to "method_one"/) end it "fails if target does not respond to either message" do lambda { Object.new.should respond_to('method_one', 'method_two') }.should fail_with(/expected #<Object:.*> to respond to "method_one", "method_two"/) end end describe "should respond_to(:sym).with(2).arguments" do it "passes if target responds to :sym with 2 args" do obj = Object.new def obj.foo(a1, a2); end obj.should respond_to(:foo).with(2).arguments end it "fails if target does not respond to :sym" do obj = Object.new lambda { obj.should respond_to(:some_method).with(2).arguments }.should fail_with(/expected .* to respond to :some_method/) end it "fails if :sym expects 0 args" do obj = Object.new def obj.foo; end lambda { obj.should respond_to(:foo).with(2).arguments }.should fail_with(/expected #<Object.*> to respond to :foo with 2 arguments/) end it "fails if :sym expects 2 args" do obj = Object.new def obj.foo(arg); end lambda { obj.should respond_to(:foo).with(2).arguments }.should fail_with(/expected #<Object.*> to respond to :foo with 2 arguments/) end end describe "should_not respond_to(:sym)" do it "passes if target does not respond to :sym" do Object.new.should_not respond_to(:some_method) end it "fails if target responds to :sym" do lambda { Object.new.should_not respond_to(:methods) }.should fail_with(/expected #<Object:.*> not to respond to :methods/) end end
{ "pile_set_name": "Github" }
# ComboBox requires these modules. Please include them in your /modules directory {Type} = require "Type" {SystemColor} = require "SystemColor" comboBoxWidth = 296 itemHeight = 32 class suggestItem extends Layer @define "item", get: -> if @string? then @string.text set: (value) -> if @string? then @string.text = value @define "selected", get: -> if @? then return @_selected set: (value) -> if @? then @_selected = value constructor: (options) -> super _.defaults options, backgroundColor: undefined width: comboBoxWidth height: itemHeight item: "item" _selected: false @createItemLayer() @item = options.item @selected = options.selected createItemLayer: -> @backgroundColor = @setBackgroundColor("rest") @string = new Type parent: @ name: "item string" x: 12 y: 5 uwpStyle: "body" textOverflow: "clip" text: "something" @onMouseOver -> @backgroundColor = @setBackgroundColor("over") @onMouseDown -> @backgroundColor = @setBackgroundColor("down") @onMouseUp -> @backgroundColor = @setBackgroundColor("over") @onMouseOut -> @backgroundColor = @setBackgroundColor("rest") @onTap -> @emit("itemTapped") setBackgroundColor: (state) -> switch state when "rest" if @selected then SystemColor.listAccentLow else SystemColor.transparent when "over" if @selected then SystemColor.listAccentMedium else SystemColor.listLow when "down" if @selected then SystemColor.listAccentHigh else SystemColor.listMedium class exports.ComboBox extends Layer # A default list to get our customers going # The default list contains 2 values: 'item' and 'selected' defaultItemList = [ {item:"Item 1"}, {item:"item 2", selected: true}, {item:"item 3"}, {item:"item 4"} ] listLength = defaultItemList.length @define "header", get: -> if @headerText? then return @headerText.text set: (value) -> if @headerText? then @headerText.text = value @define "itemList", get: -> if @? then return @_itemList set: (value) -> if @? then @_itemList = value constructor: (options) -> super _.defaults options, width: comboBoxWidth height: @setRootHeight() backgroundColor: SystemColor.transparent header: "Control Header" _itemList: defaultItemList @createLayers() @header = options.header @itemList = options._itemList # COMBOBOX LAYERS createLayers: -> layers = @ @headerText = new Type parent: @ name: "header" @contentWrap = new Layer parent: @ name: "content wrapper" width: comboBoxWidth height: 32 backgroundColor: SystemColor.altMediumLow borderColor: SystemColor.baseMediumLow borderColor: "red" borderWidth: 2 y: @headerText.height + 8 @contentText = new Type parent: @contentWrap name: "content string" x: 10 y: 4 width: comboBoxWidth - 44 color: SystemColor.baseHigh textOverflow: "clip" @chevron = new Type parent: @contentWrap name: "chevron" y: Align.center x: Align.right(- 9) uwpStyle: "glyph" text: "\uE0E5" fontSize: 12 color: SystemColor.baseMediumLow @itemWrapScroll = new ScrollComponent parent: @ name: "suggestion scroll" y: @contentWrap.y + (-7) width: comboBoxWidth visible: false opacity: 0.0 backgroundColor: SystemColor.chromeMedium borderColor: SystemColor.chromeHigh borderWidth: 1 scrollHorizontal: false @itemWrapScroll.states.listHidden = visible: false opacity: 0.0 height: 0 animationOptions: curve: "ease-in" time: .2 @itemWrapScroll.states.listShowed = visible: true opacity: 1.0 height: if @itemList is undefined itemHeight * listLength + 16 else itemHeight * @itemList.length + 16 animationOptions: curve: "ease-out" time: .2 @initializeList() @updateBoxVisuals() @setRootHeight() for i in @itemWrapScroll.content.children[0..@itemWrapScroll.content.children.length] i.on "itemTapped", (isOn) -> for l in layers.itemWrapScroll.content.children [0...layers.itemWrapScroll.content.children.length] l.selected = false l.backgroundColor = SystemColor.transparent this.selected = true layers.itemWrapScroll.animate("listHidden") layers.contentText.text = @string.text layers.contentText.width = @string.width # EVENTS @contentWrap.onMouseOver -> @.parent.updateBoxVisuals("over") @contentWrap.onMouseDown -> @.parent.updateBoxVisuals("down") @contentWrap.onMouseUp -> @.parent.updateBoxVisuals("up") @contentWrap.onMouseOut -> @.parent.updateBoxVisuals("out") @contentWrap.onTap -> @.parent.itemWrapScroll.states.switch("listShowed") # FUNCTIONS setRootHeight: -> if @headerText is "" then 38 else 60 initializeList: -> pos = 0 if @itemList is undefined listLength = listLength list = defaultItemList else listLength = @itemList.length list = @itemList for i in list[0..listLength] itemPos = pos++ @listItem = new suggestItem parent: @itemWrapScroll.content name: "item " + itemPos y: itemPos * itemHeight + 7 item: i.item selected: i.selected filterItem = list.filter (f) -> f.selected @contentText.text = filterItem[0].item updateBoxVisuals: (curEvent) -> switch curEvent when "over" comboBoxBackgroundColor = SystemColor.altMedium comboBoxBorderColor = SystemColor.baseMediumHigh chevronColor = SystemColor.baseMediumHigh when "down" comboBoxBackgroundColor = SystemColor.listMedium comboBoxBorderColor = SystemColor.baseMediumLow when "up" comboBoxBackgroundColor = SystemColor.altMediumLow when "out" comboBoxBackgroundColor = SystemColor.transparent comboBoxBorderColor = SystemColor.baseMediumLow when "disabled" headerTextColor = SystemColor.baseMediumLow comboBoxBackgroundColor = SystemColor.baseLow comboBoxBorderColor = SystemColor.baseLow chevronColor = SystemColor.baseMediumLow else comboBoxBorderColor = SystemColor.baseMediumLow comboBoxBackgroundColor = SystemColor.transparent @contentWrap.backgroundColor = comboBoxBackgroundColor @contentWrap.borderColor = comboBoxBorderColor @chevron.color = chevronColor @headerText.color = headerTextColor
{ "pile_set_name": "Github" }
<?xml version='1.0' encoding='UTF-8'?> <!-- /** * Copyright (c) Codice Foundation * * This 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 any later version. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. A copy of the GNU Lesser General Public License is distributed along with this program and can be found at * <http://www.gnu.org/licenses/lgpl.html>. * **/ --> <csw:GetRecordsResponse version="2.0.2" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dct="http://purl.org/dc/terms/" xmlns:ows="http://www.opengis.net/ows" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <csw:SearchStatus timestamp="2016-06-07T10:08:46.223-07:00"/> <csw:SearchResults elementSet="full" nextRecord="0" numberOfRecordsMatched="1" numberOfRecordsReturned="1" recordSchema="http://www.opengis.net/cat/csw/2.0.2"> <csw:Record> <dc:identifier>fakemetacardid</dc:identifier> <dct:bibliographicCitation>fakemetacardid</dct:bibliographicCitation> <dc:title>Michael.txt</dc:title> <dct:alternative>Michael.txt</dct:alternative> <dc:type>text/plain; charset=ISO-8859-1</dc:type> <dc:relation>$httpRoot$:$port$/services/catalog/sources/$sourceId$/fakemetacardid?transform=resource</dc:relation> <dc:date>2016-06-07T09:49:06.005-07:00</dc:date> <dct:modified>2016-06-07T09:49:06.005-07:00</dct:modified> <dct:created>2016-06-07T09:49:06.005-07:00</dct:created> <dct:dateAccepted>2016-06-07T09:49:06.005-07:00</dct:dateAccepted> <dct:dateCopyrighted>2016-06-07T09:49:06.005-07:00</dct:dateCopyrighted> <dct:dateSubmitted>2016-06-07T09:49:06.005-07:00</dct:dateSubmitted> <dct:issued>2016-06-07T09:49:06.005-07:00</dct:issued> <dc:creator/> <dc:publisher/> <dc:contributor/> <dc:source>content:fakemetacardid</dc:source> <dc:publisher>$sourceId$</dc:publisher> </csw:Record> </csw:SearchResults> </csw:GetRecordsResponse>
{ "pile_set_name": "Github" }
Xpra is an open-source multi-platform persistent remote display server and client for forwarding applications and desktop screens. It gives you remote access to individual applications or full desktops. It can also be used to forward full desktops, from X11 servers, MS Windows, or Mac OS X. Xpra also allows forwarding of sound, clipboard and printing services. Sessions can be accessed over SSH, or password protected over plain TCP sockets with or without SSL. Xpra is usable over reasonably slow links and does its best to adapt to changing network bandwidth constraints.
{ "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_Classroom_AssignmentSubmission extends Google_Collection { protected $collection_key = 'attachments'; protected $attachmentsType = 'Google_Service_Classroom_Attachment'; protected $attachmentsDataType = 'array'; /** * @param Google_Service_Classroom_Attachment */ public function setAttachments($attachments) { $this->attachments = $attachments; } /** * @return Google_Service_Classroom_Attachment */ public function getAttachments() { return $this->attachments; } }
{ "pile_set_name": "Github" }
<!-- *Copyright 2018 T Mobile, Inc. or its affiliates. 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. A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. This file is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or * implied. See the License for the specific language governing permissions and * limitations under the License. --> <div class="view-all-resources-wrapper flex flex-col"> <div class='flex flex-col relative'> <div class="resources-header"> <h1>Your AWS Apps</h1> </div> <div class="resource-categories"> <ul class="flex flex-flow-wrap"> <li (click)="filterByCategory(category)" [ngClass]="{'active' : activeFilterCategory.name == category.name}" *ngFor="let category of categories; let i = index" class="flex"> <div class="category-name">{{category.name}}</div> </li> </ul> </div> <a (click)="closeViewAllModal()" class="close-overlay"> <div> <img class="close-icon" src="../../assets/png/delete.png"> </div> </a> <div class="resource-tiles-container"> <ul class="flex flex-flow-wrap flex-start append-content"> <li *ngFor="let resource of filteredResources; let i = index" class="flex"> <app-aws-app-tile [i]=[i] class='full-width' [active]="i == activeTileIndex" [awsResource]="resource" [awsResourceName]="resource.type" [resourceInstances]="resource.count" (awsResourceSelected)="awsTileClicked($event, i)"></app-aws-app-tile> </li> </ul> <div class="no-content" *ngIf="filteredResources.length == 0">No Items Available In This Category</div> </div> <a *ngIf="filteredResources.length !== 0" (click)='saveSelectedResource()' class="save-container flex flex-row-reverse"> <app-button> SAVE </app-button> </a> </div> </div> <app-overlay (click)="closeViewAllModal()"></app-overlay>
{ "pile_set_name": "Github" }
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef METIS_SUPPORT_H #define METIS_SUPPORT_H namespace Eigen { /** * Get the fill-reducing ordering from the METIS package * * If A is the original matrix and Ap is the permuted matrix, * the fill-reducing permutation is defined as follows : * Row (column) i of A is the matperm(i) row (column) of Ap. * WARNING: As computed by METIS, this corresponds to the vector iperm (instead of perm) */ template <typename Index> class MetisOrdering { public: typedef PermutationMatrix<Dynamic,Dynamic,Index> PermutationType; typedef Matrix<Index,Dynamic,1> IndexVector; template <typename MatrixType> void get_symmetrized_graph(const MatrixType& A) { Index m = A.cols(); eigen_assert((A.rows() == A.cols()) && "ONLY FOR SQUARED MATRICES"); // Get the transpose of the input matrix MatrixType At = A.transpose(); // Get the number of nonzeros elements in each row/col of At+A Index TotNz = 0; IndexVector visited(m); visited.setConstant(-1); for (int j = 0; j < m; j++) { // Compute the union structure of of A(j,:) and At(j,:) visited(j) = j; // Do not include the diagonal element // Get the nonzeros in row/column j of A for (typename MatrixType::InnerIterator it(A, j); it; ++it) { Index idx = it.index(); // Get the row index (for column major) or column index (for row major) if (visited(idx) != j ) { visited(idx) = j; ++TotNz; } } //Get the nonzeros in row/column j of At for (typename MatrixType::InnerIterator it(At, j); it; ++it) { Index idx = it.index(); if(visited(idx) != j) { visited(idx) = j; ++TotNz; } } } // Reserve place for A + At m_indexPtr.resize(m+1); m_innerIndices.resize(TotNz); // Now compute the real adjacency list of each column/row visited.setConstant(-1); Index CurNz = 0; for (int j = 0; j < m; j++) { m_indexPtr(j) = CurNz; visited(j) = j; // Do not include the diagonal element // Add the pattern of row/column j of A to A+At for (typename MatrixType::InnerIterator it(A,j); it; ++it) { Index idx = it.index(); // Get the row index (for column major) or column index (for row major) if (visited(idx) != j ) { visited(idx) = j; m_innerIndices(CurNz) = idx; CurNz++; } } //Add the pattern of row/column j of At to A+At for (typename MatrixType::InnerIterator it(At, j); it; ++it) { Index idx = it.index(); if(visited(idx) != j) { visited(idx) = j; m_innerIndices(CurNz) = idx; ++CurNz; } } } m_indexPtr(m) = CurNz; } template <typename MatrixType> void operator() (const MatrixType& A, PermutationType& matperm) { Index m = A.cols(); IndexVector perm(m),iperm(m); // First, symmetrize the matrix graph. get_symmetrized_graph(A); int output_error; // Call the fill-reducing routine from METIS output_error = METIS_NodeND(&m, m_indexPtr.data(), m_innerIndices.data(), NULL, NULL, perm.data(), iperm.data()); if(output_error != METIS_OK) { //FIXME The ordering interface should define a class of possible errors std::cerr << "ERROR WHILE CALLING THE METIS PACKAGE \n"; return; } // Get the fill-reducing permutation //NOTE: If Ap is the permuted matrix then perm and iperm vectors are defined as follows // Row (column) i of Ap is the perm(i) row(column) of A, and row (column) i of A is the iperm(i) row(column) of Ap matperm.resize(m); for (int j = 0; j < m; j++) matperm.indices()(iperm(j)) = j; } protected: IndexVector m_indexPtr; // Pointer to the adjacenccy list of each row/column IndexVector m_innerIndices; // Adjacency list }; }// end namespace eigen #endif
{ "pile_set_name": "Github" }
#pragma once #include <Foundation/Basics.h> #include <Foundation/Logging/Log.h>
{ "pile_set_name": "Github" }
# # Module which supports allocation of ctypes objects from shared memory # # multiprocessing/sharedctypes.py # # Copyright (c) 2006-2008, R Oudkerk # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of author nor the names of any contributors may be # used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. # import sys import ctypes import weakref from multiprocessing import heap, RLock from multiprocessing.forking import assert_spawning, ForkingPickler __all__ = ['RawValue', 'RawArray', 'Value', 'Array', 'copy', 'synchronized'] # # # typecode_to_type = { 'c': ctypes.c_char, 'b': ctypes.c_byte, 'B': ctypes.c_ubyte, 'h': ctypes.c_short, 'H': ctypes.c_ushort, 'i': ctypes.c_int, 'I': ctypes.c_uint, 'l': ctypes.c_long, 'L': ctypes.c_ulong, 'f': ctypes.c_float, 'd': ctypes.c_double } try: typecode_to_type['u'] = ctypes.c_wchar except AttributeError: pass # # # def _new_value(type_): size = ctypes.sizeof(type_) wrapper = heap.BufferWrapper(size) return rebuild_ctype(type_, wrapper, None) def RawValue(typecode_or_type, *args): ''' Returns a ctypes object allocated from shared memory ''' type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) obj = _new_value(type_) ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj)) obj.__init__(*args) return obj def RawArray(typecode_or_type, size_or_initializer): ''' Returns a ctypes array allocated from shared memory ''' type_ = typecode_to_type.get(typecode_or_type, typecode_or_type) if isinstance(size_or_initializer, (int, long)): type_ = type_ * size_or_initializer obj = _new_value(type_) ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj)) return obj else: type_ = type_ * len(size_or_initializer) result = _new_value(type_) result.__init__(*size_or_initializer) return result def Value(typecode_or_type, *args, **kwds): ''' Return a synchronization wrapper for a Value ''' lock = kwds.pop('lock', None) if kwds: raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) obj = RawValue(typecode_or_type, *args) if lock is False: return obj if lock in (True, None): lock = RLock() if not hasattr(lock, 'acquire'): raise AttributeError("'%r' has no method 'acquire'" % lock) return synchronized(obj, lock) def Array(typecode_or_type, size_or_initializer, **kwds): ''' Return a synchronization wrapper for a RawArray ''' lock = kwds.pop('lock', None) if kwds: raise ValueError('unrecognized keyword argument(s): %s' % kwds.keys()) obj = RawArray(typecode_or_type, size_or_initializer) if lock is False: return obj if lock in (True, None): lock = RLock() if not hasattr(lock, 'acquire'): raise AttributeError("'%r' has no method 'acquire'" % lock) return synchronized(obj, lock) def copy(obj): new_obj = _new_value(type(obj)) ctypes.pointer(new_obj)[0] = obj return new_obj def synchronized(obj, lock=None): assert not isinstance(obj, SynchronizedBase), 'object already synchronized' if isinstance(obj, ctypes._SimpleCData): return Synchronized(obj, lock) elif isinstance(obj, ctypes.Array): if obj._type_ is ctypes.c_char: return SynchronizedString(obj, lock) return SynchronizedArray(obj, lock) else: cls = type(obj) try: scls = class_cache[cls] except KeyError: names = [field[0] for field in cls._fields_] d = dict((name, make_property(name)) for name in names) classname = 'Synchronized' + cls.__name__ scls = class_cache[cls] = type(classname, (SynchronizedBase,), d) return scls(obj, lock) # # Functions for pickling/unpickling # def reduce_ctype(obj): assert_spawning(obj) if isinstance(obj, ctypes.Array): return rebuild_ctype, (obj._type_, obj._wrapper, obj._length_) else: return rebuild_ctype, (type(obj), obj._wrapper, None) def rebuild_ctype(type_, wrapper, length): if length is not None: type_ = type_ * length ForkingPickler.register(type_, reduce_ctype) obj = type_.from_address(wrapper.get_address()) obj._wrapper = wrapper return obj # # Function to create properties # def make_property(name): try: return prop_cache[name] except KeyError: d = {} exec template % ((name,)*7) in d prop_cache[name] = d[name] return d[name] template = ''' def get%s(self): self.acquire() try: return self._obj.%s finally: self.release() def set%s(self, value): self.acquire() try: self._obj.%s = value finally: self.release() %s = property(get%s, set%s) ''' prop_cache = {} class_cache = weakref.WeakKeyDictionary() # # Synchronized wrappers # class SynchronizedBase(object): def __init__(self, obj, lock=None): self._obj = obj self._lock = lock or RLock() self.acquire = self._lock.acquire self.release = self._lock.release def __reduce__(self): assert_spawning(self) return synchronized, (self._obj, self._lock) def get_obj(self): return self._obj def get_lock(self): return self._lock def __repr__(self): return '<%s wrapper for %s>' % (type(self).__name__, self._obj) class Synchronized(SynchronizedBase): value = make_property('value') class SynchronizedArray(SynchronizedBase): def __len__(self): return len(self._obj) def __getitem__(self, i): self.acquire() try: return self._obj[i] finally: self.release() def __setitem__(self, i, value): self.acquire() try: self._obj[i] = value finally: self.release() def __getslice__(self, start, stop): self.acquire() try: return self._obj[start:stop] finally: self.release() def __setslice__(self, start, stop, values): self.acquire() try: self._obj[start:stop] = values finally: self.release() class SynchronizedString(SynchronizedArray): value = make_property('value') raw = make_property('raw')
{ "pile_set_name": "Github" }
<?php /* * (c) Kévin Dunglas <dunglas@gmail.com> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace Dunglas\AngularCsrfBundle; use Dunglas\AngularCsrfBundle\DependencyInjection\CompilerPass\CsrfCompilerPass; use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; /** * @author Kévin Dunglas <dunglas@gmail.com> */ class DunglasAngularCsrfBundle extends Bundle { /** * {@inheritdoc} */ public function build(ContainerBuilder $container) { $container->addCompilerPass(new CsrfCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1); } }
{ "pile_set_name": "Github" }
{ "personal data":"personal data" ,"name":"name" ,"age":"age" ,"son number":"son number" ,"homeland":"homeland" ,"culture":"culture" ,"religion":"religion" ,"lord":"lord" ,"current class":"current class" ,"current home": "current home" ,"personal traits":"personal traits" ,"chivalry bonus":"chivalry bonus" ,"religious bonus":"religious bonus" ,"chaste":"chaste" ,"lustful":"lustful" ,"energetic":"energetic" ,"lazy":"lazy" ,"forgiving":"forgiving" ,"vengeful":"vengeful" ,"generous":"generous" ,"selfish":"selfish" ,"honest":"honest" ,"deceitful":"deceitful" ,"just":"just" ,"arbitrary":"arbitrary" ,"merciful":"merciful" ,"cruel":"cruel" ,"modest":"modest" ,"proud":"proud" ,"prudent":"prudent" ,"reckless":"reckless" ,"spiritual":"spiritual" ,"wordly":"wordly" ,"temperate":"temperate" ,"indulgent":"indulgent" ,"trusting":"trusting" ,"suspicious":"suspicious" ,"valorous":"valorous" ,"cowardly":"cowardly" ,"directed trait":"directed trait" ,"trait":"trait" ,"Player:":"Player:" ,"personality traits":"personality traits" ,"Chivalry Bonus[*](total=80+)":"Chivalry Bonus[*](total=80+)" ,"Religious Bonus(traits all 16+)":"Religious Bonus(traits all 16+)" ,"(15)":"(15)" ,"passions": "passions" ,"loyalty lord":"loyalty (lord)" ,"love family":"love (family)" ,"hospitality":"hospitality" ,"honor":"honor" ,"passion":"passion" ,"equipment carried":"equipment carried" ,"armor type":"armor type" ,"points": "points" ,"clothing":"clothing" ,"libra value":"libra value" ,"personal gear":"personal gear" ,"travel gear":"travel gear" ,"war gear":"war gear" ,"on horse #":"on horse #" ,"equipment":"equipment" ,"attributes":"attributes" ,"(Knockdown)":"(Knockdown)" ,"size":"size" ,"siz":"siz" ,"dex":"dex" ,"dexterity":"dexterity" ,"str":"str" ,"strength":"strength" ,"(Major Wound)":"(Major Wound)" ,"(+3)":"(+3)" ,"con":"con" ,"constitution":"constitution" ,"appearance":"appearance" ,"app":"app" ,"Damage":"Damage" ,"d6":"d6" ,"damage":"damage" ,"healing rate":"healing rate" ,"movement rate":"movement rate" ,"total hit points":"total hit points" ,"unconcious":"unconcious" ,"distinctive features":"distinctive features" ,"awareness":"awareness" ,"boating":"boating" ,"compose":"compose" ,"courtesy":"courtesy" ,"dancing":"dancing" ,"faerie lore":"faerie lore" ,"falconry":"falconry" ,"first aid":"first aid" ,"flirting":"flirting" ,"folk lore":"folk lore" ,"gaming":"gaming" ,"heraldry":"heraldry" ,"hunting":"hunting" ,"intrigue":"intrigue" ,"orate":"orate" ,"play":"play" ,"read":"read" ,"recognize":"recognize" ,"romance":"romance" ,"singing":"singing" ,"stewardship":"stewardship" ,"swimming":"swimming" ,"tourney":"tourney" ,"skills":"skills" ,"squire":"squire" ,"horsemanship":"horsemanship" ,"battle":"battle" ,"chirurgery needed":"chirurgery needed" ,"current hit points":"current hit points" ,"wounds":"wounds" ,"this game":"this game" ,"glory this game":"glory this game" ,"glory":"glory" ,"skill":"skill" ,"combat skills":"combat skills" ,"glory total":"glory total" ,"weapon skills":"weapon skills" ,"dagger":"dagger" ,"lance":"lance" ,"spear":"spear" ,"sword":"sword" ,"win":"win" ,"losses":"losses" ,"other horses":"other horses" ,"horse type":"horse type" ,"horse damage":"horse damage" ,"horse move":"horse move" ,"horse armor": "horse armor" ,"horse hp":"horse hp" ,"horse con": "horse con" ,"horse siz": "horse siz" ,"horse dex": "horse dex" ,"horse breed":"horse breed" ,"riding(#2)":"riding(#2)" ,"squire(#3)":"squire(#3)" ,"(#4)":"(#4)" ,"move":"move" ,"joust score":"joust score" ,"horses":"horses" ,"best warhorse (#1)":"best warhorse (#1)" ,"type":"type" ,"hp":"hp" ,"armor":"armor" ,"breed":"breed" ,"jouse score":"jouse score" ,"knight":"knight" ,"holdings":"holdings" ,"annual glory rewards":"annual glory rewards" ,"denarii":"denarii" ,"libra":"libra" ,"old knights":"old knights" ,"middle aged knights":"middle aged knights" ,"young knights":"young knights" ,"total family knights":"total family knights" ,"vassal knights":"vassal knights" ,"other lineage men":"other lineage men" ,"levy":"levy" ,"date":"date" ,"important event":"important event" ,"new":"new" ,"new glory":"new glory" ,"total glory":"total glory" ,"event":"event" ,"born":"born" ,"squired":"squired" ,"knighted":"knighted" ,"member of the round table":"member of the round table" ,"landed":"landed" ,"titled":"titled" ,"wed":"wed" ,"died":"died" ,"father name":"father name" ,"class":"class" ,"glory to sons":"glory to sons" ,"family characteristic":"family characteristic" ,"lover":"lover" ,"children":"children" ,"will":"will" ,"traits":"traits" ,"chivalry":"chivalry" ,"equipment at home":"equipment at home" ,"character history":"character history" ,"family history and events":"family history and events" ,"army":"army" ,"coat of arms":"coat of arms" ,"motto":"motto" ,"annual glory rewards traits":"annual glory rewards traits" ,"annual glory rewards chivalry":"annual glory rewards chivalry" ,"annual glory rewards holdings":"annual glory rewards holdings" ,"annual glory rewards passions":"annual glory rewards passions" ,"annual glory rewards religion":"annual glory rewards religion" ,"annual glory rewards total":"annual glory rewards total" ,"enter warhorse damage":"enter warhorse damage" ,"shilling":"shilling" ,"select character sheet knight":"select character sheet knight" ,"select character sheet holdings":"select character sheet holdings" ,"Holdings Character Sheet":"Holdings Character Sheet" ,"horse 2":"horse 2" ,"horse 3":"horse 3" ,"horse 4":"horse 4" ,"personal religion": "personal religion" ,"play name": "play name" , "read name": "read name" ,"religion name":"religion name" ,"squire name":"squire name" ,"fashion":"fashion" ,"squire age":"squire age" ,"daughter number":"daughter number" ,"Gentle Woman Bonus[*](total=80+)":"Gentle Woman Bonus[*](total=80+)" ,"industry":"industry" ,"servant":"servant" ,"woman's gift":"woman's gift" ,"best horse (#1)":"best horse (#1)" ,"household treasures":"household treasures" ,"spouse":"spouse" ,"woman":"woman" ,"player name": "player name" ,"chirurgery":"chirurgery" ,"character":"character" ,"gear":"gear" ,"personal":"personal" ,"war":"war" ,"travel":"travel" ,"enter personal gear":"enter personal gear" ,"gamemaster":"gamemaster" ,"feast record":"feast record" ,"gamemaster characters":"gamemaster characters" ,"location":"location" ,"above the salt (high table)":"above the salt (high table)" ,"round 5":"round 5" ,"round 1":"round 1" ,"round 2":"round 2" ,"round 3":"round 3" ,"round 4":"round 4" ,"total":"total" ,"seating":"seating" ,"geniality mod.":"geniality mod." ,"accumulated geniality":"accumulated geniality" ,"near the salt (seat of honor)":"near the salt (seat of honor)" ,"notes":"notes" ,"below the salt (normal seating)":"below the salt (normal seating)" ,"on the floor (squires)":"on the floor (squires)" ,"enter name":"enter name" ,"significant gamemaster characters":"significant gamemaster characters" ,"enter glory this game":"enter glory this game" ,"knight's entourage":"knight's entourage" ,"lady's entourage":"lady's entourage" ,"position":"position" ,"cost £":"cost £" ,"value":"value" ,"entourage":"entourage" ,"mod":"mod" ,"loyalty":"loyalty" ,"squire skill":"squire skill" ,"weapon":"weapon" ,"mw":"mw" ,"horse":"horse" ,"weapon 1":"weapon 1" ,"weapon 2": "weapon 2" ,"value 1": "value 1" ,"value 2": "value 2" ,"value 3": "value 3" ,"skill 1":"skill 1" ,"skill 2":"skill 2" ,"skill 3":"skill 3" ,"cost":"cost" ,"modifier": "modifier" ,"dowry":"dowry" ,"love (family)": "love (family)" ,"number of children":"number of children" ,"wife":"wife" ,"lady skill":"lady skill" ,"dower":"dower" ,"maid-in-waiting":"maid-in-waiting" ,"loyalty lady":"loyalty (lady)" ,"hand maiden skill":"hand maiden skill" ,"skill industry":"skill industry" ,"husband":"husband" ,"knight skill":"knight skill" ,"mesnie":"mesnie" ,"improvable skill":"improvable skill" ,"feast":"feast" ,"feast location": "feast location" ,"feast type": "feast type" ,"feast date": "feast date" ,"Success": "Success" ,"Failure": "Failure" ,"Critical": "Critical" ,"Fumble": "Fumble" ,"sheet: character": "sheet: character" ,"sheet: holdings": "sheet: holdings" ,"sheet: entourage": "sheet: entourage" ,"sheet: settings":"sheet: settings" ,"sheet: gamemaster characters": "sheet: gamemaster characters" ,"sheet: feast record" : "sheet: feast record" ,"character sheet type":"character sheet type" ,"feast size": "feast size" ,"enter total glory": "enter total glory" ,"enter date": "enter date" ,"enter event": "enter event" ,"enter new glory":"enter new glory" ,"armor value": "armor value" ,"wife name": "wife name" ,"wife born": "wife born" ,"wife age": "wife age" ,"wife modifier": "wife modifier" ,"wife skill 1": "wife skill 1" ,"wife skill 2": "wife skill 2" ,"wife love": "wife love" ,"wife dower": "wife dower" ,"wife dowry": "wife dowry" ,"wife value 1": "wife value 1" ,"wife value 2": "wife value 2" ,"wife value 3": "wife value 3" ,"npc": "npc" ,"enter player name":"enter player name" ,"description":"description" ,"unconscious":"unconscious" ,"major wound":"major wound" ,"knockdown":"knockdown" ,"hit points":"hit points" ,"glory won":"glory won" ,"abilities":"abilities" ,"skills / passions":"skills / passions" }
{ "pile_set_name": "Github" }
/* * Copyright 2017-2018 47 Degrees, LLC. <http://www.47deg.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // The purpose of this test is to see if freestyle still compiles classes in _root_ package. import freestyle.free._ @free trait Logitech { def eyes(s: String): FS[Boolean] def skills(s: String): FS[Boolean] } @free trait Asia { def recycled(msg: String): FS[Unit] def rhino(prompt: String): FS[String] } @module trait Age { val logitech: Logitech val asia: Asia }
{ "pile_set_name": "Github" }
/* * Analog TV Connector driver * * Copyright (C) 2013 Texas Instruments * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> * * 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. */ #include <linux/slab.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/of.h> #include "../dss/omapdss.h" struct panel_drv_data { struct omap_dss_device dssdev; struct omap_dss_device *in; struct device *dev; struct videomode vm; }; static const struct videomode tvc_pal_vm = { .hactive = 720, .vactive = 574, .pixelclock = 13500000, .hsync_len = 64, .hfront_porch = 12, .hback_porch = 68, .vsync_len = 5, .vfront_porch = 5, .vback_porch = 41, .flags = DISPLAY_FLAGS_INTERLACED | DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW, }; static const struct of_device_id tvc_of_match[]; #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) static int tvc_connect(struct omap_dss_device *dssdev) { struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; int r; dev_dbg(ddata->dev, "connect\n"); if (omapdss_device_is_connected(dssdev)) return 0; r = in->ops.atv->connect(in, dssdev); if (r) return r; return 0; } static void tvc_disconnect(struct omap_dss_device *dssdev) { struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; dev_dbg(ddata->dev, "disconnect\n"); if (!omapdss_device_is_connected(dssdev)) return; in->ops.atv->disconnect(in, dssdev); } static int tvc_enable(struct omap_dss_device *dssdev) { struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; int r; dev_dbg(ddata->dev, "enable\n"); if (!omapdss_device_is_connected(dssdev)) return -ENODEV; if (omapdss_device_is_enabled(dssdev)) return 0; in->ops.atv->set_timings(in, &ddata->vm); r = in->ops.atv->enable(in); if (r) return r; dssdev->state = OMAP_DSS_DISPLAY_ACTIVE; return r; } static void tvc_disable(struct omap_dss_device *dssdev) { struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; dev_dbg(ddata->dev, "disable\n"); if (!omapdss_device_is_enabled(dssdev)) return; in->ops.atv->disable(in); dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } static void tvc_set_timings(struct omap_dss_device *dssdev, struct videomode *vm) { struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; ddata->vm = *vm; dssdev->panel.vm = *vm; in->ops.atv->set_timings(in, vm); } static void tvc_get_timings(struct omap_dss_device *dssdev, struct videomode *vm) { struct panel_drv_data *ddata = to_panel_data(dssdev); *vm = ddata->vm; } static int tvc_check_timings(struct omap_dss_device *dssdev, struct videomode *vm) { struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; return in->ops.atv->check_timings(in, vm); } static u32 tvc_get_wss(struct omap_dss_device *dssdev) { struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; return in->ops.atv->get_wss(in); } static int tvc_set_wss(struct omap_dss_device *dssdev, u32 wss) { struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; return in->ops.atv->set_wss(in, wss); } static struct omap_dss_driver tvc_driver = { .connect = tvc_connect, .disconnect = tvc_disconnect, .enable = tvc_enable, .disable = tvc_disable, .set_timings = tvc_set_timings, .get_timings = tvc_get_timings, .check_timings = tvc_check_timings, .get_wss = tvc_get_wss, .set_wss = tvc_set_wss, }; static int tvc_probe_of(struct platform_device *pdev) { struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct device_node *node = pdev->dev.of_node; struct omap_dss_device *in; in = omapdss_of_find_source_for_first_ep(node); if (IS_ERR(in)) { dev_err(&pdev->dev, "failed to find video source\n"); return PTR_ERR(in); } ddata->in = in; return 0; } static int tvc_probe(struct platform_device *pdev) { struct panel_drv_data *ddata; struct omap_dss_device *dssdev; int r; if (!pdev->dev.of_node) return -ENODEV; ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); if (!ddata) return -ENOMEM; platform_set_drvdata(pdev, ddata); ddata->dev = &pdev->dev; r = tvc_probe_of(pdev); if (r) return r; ddata->vm = tvc_pal_vm; dssdev = &ddata->dssdev; dssdev->driver = &tvc_driver; dssdev->dev = &pdev->dev; dssdev->type = OMAP_DISPLAY_TYPE_VENC; dssdev->owner = THIS_MODULE; dssdev->panel.vm = tvc_pal_vm; r = omapdss_register_display(dssdev); if (r) { dev_err(&pdev->dev, "Failed to register panel\n"); goto err_reg; } return 0; err_reg: omap_dss_put_device(ddata->in); return r; } static int __exit tvc_remove(struct platform_device *pdev) { struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct omap_dss_device *dssdev = &ddata->dssdev; struct omap_dss_device *in = ddata->in; omapdss_unregister_display(&ddata->dssdev); tvc_disable(dssdev); tvc_disconnect(dssdev); omap_dss_put_device(in); return 0; } static const struct of_device_id tvc_of_match[] = { { .compatible = "omapdss,svideo-connector", }, { .compatible = "omapdss,composite-video-connector", }, {}, }; MODULE_DEVICE_TABLE(of, tvc_of_match); static struct platform_driver tvc_connector_driver = { .probe = tvc_probe, .remove = __exit_p(tvc_remove), .driver = { .name = "connector-analog-tv", .of_match_table = tvc_of_match, .suppress_bind_attrs = true, }, }; module_platform_driver(tvc_connector_driver); MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@ti.com>"); MODULE_DESCRIPTION("Analog TV Connector driver"); MODULE_LICENSE("GPL");
{ "pile_set_name": "Github" }
/* * ide bus support for qdev. * * Copyright (c) 2009 Gerd Hoffmann <kraxel@redhat.com> * * 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 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, see <http://www.gnu.org/licenses/>. */ #include <hw/hw.h> #include "sysemu/dma.h" #include "qemu/error-report.h" #include <hw/ide/internal.h> #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" #include "hw/block/block.h" #include "sysemu/sysemu.h" #include "qapi/visitor.h" /* --------------------------------- */ static char *idebus_get_fw_dev_path(DeviceState *dev); static Property ide_props[] = { DEFINE_PROP_UINT32("unit", IDEDevice, unit, -1), DEFINE_PROP_END_OF_LIST(), }; static void ide_bus_class_init(ObjectClass *klass, void *data) { BusClass *k = BUS_CLASS(klass); k->get_fw_dev_path = idebus_get_fw_dev_path; } static const TypeInfo ide_bus_info = { .name = TYPE_IDE_BUS, .parent = TYPE_BUS, .instance_size = sizeof(IDEBus), .class_init = ide_bus_class_init, }; void ide_bus_new(IDEBus *idebus, size_t idebus_size, DeviceState *dev, int bus_id, int max_units) { qbus_create_inplace(idebus, idebus_size, TYPE_IDE_BUS, dev, NULL); idebus->bus_id = bus_id; idebus->max_units = max_units; } static char *idebus_get_fw_dev_path(DeviceState *dev) { char path[30]; snprintf(path, sizeof(path), "%s@%x", qdev_fw_name(dev), ((IDEBus*)dev->parent_bus)->bus_id); return g_strdup(path); } static int ide_qdev_init(DeviceState *qdev) { IDEDevice *dev = IDE_DEVICE(qdev); IDEDeviceClass *dc = IDE_DEVICE_GET_CLASS(dev); IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus); if (!dev->conf.blk) { error_report("No drive specified"); goto err; } if (dev->unit == -1) { dev->unit = bus->master ? 1 : 0; } if (dev->unit >= bus->max_units) { error_report("Can't create IDE unit %d, bus supports only %d units", dev->unit, bus->max_units); goto err; } switch (dev->unit) { case 0: if (bus->master) { error_report("IDE unit %d is in use", dev->unit); goto err; } bus->master = dev; break; case 1: if (bus->slave) { error_report("IDE unit %d is in use", dev->unit); goto err; } bus->slave = dev; break; default: error_report("Invalid IDE unit %d", dev->unit); goto err; } return dc->init(dev); err: return -1; } IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive) { DeviceState *dev; dev = qdev_create(&bus->qbus, drive->media_cd ? "ide-cd" : "ide-hd"); qdev_prop_set_uint32(dev, "unit", unit); qdev_prop_set_drive_nofail(dev, "drive", blk_by_legacy_dinfo(drive)); qdev_init_nofail(dev); return DO_UPCAST(IDEDevice, qdev, dev); } int ide_get_geometry(BusState *bus, int unit, int16_t *cyls, int8_t *heads, int8_t *secs) { IDEState *s = &DO_UPCAST(IDEBus, qbus, bus)->ifs[unit]; if (s->drive_kind != IDE_HD || !s->blk) { return -1; } *cyls = s->cylinders; *heads = s->heads; *secs = s->sectors; return 0; } int ide_get_bios_chs_trans(BusState *bus, int unit) { return DO_UPCAST(IDEBus, qbus, bus)->ifs[unit].chs_trans; } /* --------------------------------- */ typedef struct IDEDrive { IDEDevice dev; } IDEDrive; static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind) { IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus); IDEState *s = bus->ifs + dev->unit; Error *err = NULL; if (dev->conf.discard_granularity == -1) { dev->conf.discard_granularity = 512; } else if (dev->conf.discard_granularity && dev->conf.discard_granularity != 512) { error_report("discard_granularity must be 512 for ide"); return -1; } blkconf_blocksizes(&dev->conf); if (dev->conf.logical_block_size != 512) { error_report("logical_block_size must be 512 for IDE"); return -1; } blkconf_serial(&dev->conf, &dev->serial); if (kind != IDE_CD) { blkconf_geometry(&dev->conf, &dev->chs_trans, 65536, 16, 255, &err); if (err) { error_report_err(err); return -1; } } if (ide_init_drive(s, dev->conf.blk, kind, dev->version, dev->serial, dev->model, dev->wwn, dev->conf.cyls, dev->conf.heads, dev->conf.secs, dev->chs_trans) < 0) { return -1; } if (!dev->version) { dev->version = g_strdup(s->version); } if (!dev->serial) { dev->serial = g_strdup(s->drive_serial_str); } add_boot_device_path(dev->conf.bootindex, &dev->qdev, dev->unit ? "/disk@1" : "/disk@0"); return 0; } static void ide_dev_get_bootindex(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { IDEDevice *d = IDE_DEVICE(obj); visit_type_int32(v, &d->conf.bootindex, name, errp); } static void ide_dev_set_bootindex(Object *obj, Visitor *v, void *opaque, const char *name, Error **errp) { IDEDevice *d = IDE_DEVICE(obj); int32_t boot_index; Error *local_err = NULL; visit_type_int32(v, &boot_index, name, &local_err); if (local_err) { goto out; } /* check whether bootindex is present in fw_boot_order list */ check_boot_index(boot_index, &local_err); if (local_err) { goto out; } /* change bootindex to a new one */ d->conf.bootindex = boot_index; if (d->unit != -1) { add_boot_device_path(d->conf.bootindex, &d->qdev, d->unit ? "/disk@1" : "/disk@0"); } out: if (local_err) { error_propagate(errp, local_err); } } static void ide_dev_instance_init(Object *obj) { object_property_add(obj, "bootindex", "int32", ide_dev_get_bootindex, ide_dev_set_bootindex, NULL, NULL, NULL); object_property_set_int(obj, -1, "bootindex", NULL); } static int ide_hd_initfn(IDEDevice *dev) { return ide_dev_initfn(dev, IDE_HD); } static int ide_cd_initfn(IDEDevice *dev) { return ide_dev_initfn(dev, IDE_CD); } static int ide_drive_initfn(IDEDevice *dev) { DriveInfo *dinfo = blk_legacy_dinfo(dev->conf.blk); return ide_dev_initfn(dev, dinfo && dinfo->media_cd ? IDE_CD : IDE_HD); } #define DEFINE_IDE_DEV_PROPERTIES() \ DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf), \ DEFINE_PROP_STRING("ver", IDEDrive, dev.version), \ DEFINE_PROP_UINT64("wwn", IDEDrive, dev.wwn, 0), \ DEFINE_PROP_STRING("serial", IDEDrive, dev.serial),\ DEFINE_PROP_STRING("model", IDEDrive, dev.model) static Property ide_hd_properties[] = { DEFINE_IDE_DEV_PROPERTIES(), DEFINE_BLOCK_CHS_PROPERTIES(IDEDrive, dev.conf), DEFINE_PROP_BIOS_CHS_TRANS("bios-chs-trans", IDEDrive, dev.chs_trans, BIOS_ATA_TRANSLATION_AUTO), DEFINE_PROP_END_OF_LIST(), }; static void ide_hd_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); IDEDeviceClass *k = IDE_DEVICE_CLASS(klass); k->init = ide_hd_initfn; dc->fw_name = "drive"; dc->desc = "virtual IDE disk"; dc->props = ide_hd_properties; } static const TypeInfo ide_hd_info = { .name = "ide-hd", .parent = TYPE_IDE_DEVICE, .instance_size = sizeof(IDEDrive), .class_init = ide_hd_class_init, }; static Property ide_cd_properties[] = { DEFINE_IDE_DEV_PROPERTIES(), DEFINE_PROP_END_OF_LIST(), }; static void ide_cd_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); IDEDeviceClass *k = IDE_DEVICE_CLASS(klass); k->init = ide_cd_initfn; dc->fw_name = "drive"; dc->desc = "virtual IDE CD-ROM"; dc->props = ide_cd_properties; } static const TypeInfo ide_cd_info = { .name = "ide-cd", .parent = TYPE_IDE_DEVICE, .instance_size = sizeof(IDEDrive), .class_init = ide_cd_class_init, }; static Property ide_drive_properties[] = { DEFINE_IDE_DEV_PROPERTIES(), DEFINE_PROP_END_OF_LIST(), }; static void ide_drive_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); IDEDeviceClass *k = IDE_DEVICE_CLASS(klass); k->init = ide_drive_initfn; dc->fw_name = "drive"; dc->desc = "virtual IDE disk or CD-ROM (legacy)"; dc->props = ide_drive_properties; } static const TypeInfo ide_drive_info = { .name = "ide-drive", .parent = TYPE_IDE_DEVICE, .instance_size = sizeof(IDEDrive), .class_init = ide_drive_class_init, }; static void ide_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); k->init = ide_qdev_init; set_bit(DEVICE_CATEGORY_STORAGE, k->categories); k->bus_type = TYPE_IDE_BUS; k->props = ide_props; } static const TypeInfo ide_device_type_info = { .name = TYPE_IDE_DEVICE, .parent = TYPE_DEVICE, .instance_size = sizeof(IDEDevice), .abstract = true, .class_size = sizeof(IDEDeviceClass), .class_init = ide_device_class_init, .instance_init = ide_dev_instance_init, }; static void ide_register_types(void) { type_register_static(&ide_bus_info); type_register_static(&ide_hd_info); type_register_static(&ide_cd_info); type_register_static(&ide_drive_info); type_register_static(&ide_device_type_info); } type_init(ide_register_types)
{ "pile_set_name": "Github" }
CODEPAGE 20880 CPINFO 1 0x6F 0x003F MBTABLE 255 0x00 0x0000 ;Null 0x01 0x0001 ;Start Of Heading 0x02 0x0002 ;Start Of Text 0x03 0x0003 ;End Of Text 0x04 0x009C ;String Terminator 0x05 0x0009 ;Character Tabulation 0x06 0x0086 ;Start Of Selected Area 0x07 0x007F ;Delete 0x08 0x0097 ;End Of Guarded Area 0x09 0x008D ;Reverse Line Feed 0x0A 0x008E ;Single Shift Two 0x0B 0x000B ;Line Tabulation 0x0C 0x000C ;Form Feed (FF) 0x0D 0x000D ;Carriage Return (CR) 0x0E 0x000E ;Shift Out 0x0F 0x000F ;Shift In 0x10 0x0010 ;Data Link Escape 0x11 0x0011 ;Device Control One 0x12 0x0012 ;Device Control Two 0x13 0x0013 ;Device Control Three 0x14 0x009D ;Operating System Command 0x15 0x0085 ;Next Line (NEL) 0x16 0x0008 ;Backspace 0x17 0x0087 ;End Of Selected Area 0x18 0x0018 ;Cancel 0x19 0x0019 ;End Of Medium 0x1A 0x0092 ;Private Use Two 0x1B 0x008F ;Single Shift Three 0x1C 0x001C ;Information Separator Four 0x1D 0x001D ;Information Separator Three 0x1E 0x001E ;Information Separator Two 0x1F 0x001F ;Information Separator One 0x20 0x0080 ;Undefined 0x21 0x0081 ;Undefined 0x22 0x0082 ;Break Permitted Here 0x23 0x0083 ;No Break Here 0x24 0x0084 ;Undefined 0x25 0x000A ;Line Feed (LF) 0x26 0x0017 ;End Of Transmission Block 0x27 0x001B ;Escape 0x28 0x0088 ;Character Tabulation Set 0x29 0x0089 ;Character Tabulation With Justification 0x2A 0x008A ;Line Tabulation Set 0x2B 0x008B ;Partial Line Forward 0x2C 0x008C ;Partial Line Backward 0x2D 0x0005 ;Enquiry 0x2E 0x0006 ;Acknowledge 0x2F 0x0007 ;Bell 0x30 0x0090 ;Device Control String 0x31 0x0091 ;Private Use One 0x32 0x0016 ;Synchronous Idle 0x33 0x0093 ;Set Transmit State 0x34 0x0094 ;Cancel Character 0x35 0x0095 ;Message Waiting 0x36 0x0096 ;Start Of Guarded Area 0x37 0x0004 ;End Of Transmission 0x38 0x0098 ;Start Of String 0x39 0x0099 ;Undefined 0x3A 0x009A ;Single Character Introducer 0x3B 0x009B ;Control Sequence Introducer 0x3C 0x0014 ;Device Control Four 0x3D 0x0015 ;Negative Acknowledge 0x3E 0x009E ;Privacy Message 0x3F 0x001A ;Substitute 0x40 0x0020 ;Space 0x41 0x00A0 ;No-Break Space 0x42 0x0452 ;Cyrillic Small Letter Dje 0x43 0x0453 ;Cyrillic Small Letter Gje 0x44 0x0451 ;Cyrillic Small Letter Io 0x45 0x0454 ;Cyrillic Small Letter Ukrainian Ie 0x46 0x0455 ;Cyrillic Small Letter Dze 0x47 0x0456 ;Cyrillic Small Letter Byelorussian-Ukrainian I 0x48 0x0457 ;Cyrillic Small Letter Yi 0x49 0x0458 ;Cyrillic Small Letter Je 0x4A 0x005B ;Left Square Bracket 0x4B 0x002E ;Full Stop 0x4C 0x003C ;Less-Than Sign 0x4D 0x0028 ;Left Parenthesis 0x4E 0x002B ;Plus Sign 0x4F 0x0021 ;Exclamation Mark 0x50 0x0026 ;Ampersand 0x51 0x0459 ;Cyrillic Small Letter Lje 0x52 0x045A ;Cyrillic Small Letter Nje 0x53 0x045B ;Cyrillic Small Letter Tshe 0x54 0x045C ;Cyrillic Small Letter Kje 0x55 0x045E ;Cyrillic Small Letter Short U 0x56 0x045F ;Cyrillic Small Letter Dzhe 0x57 0x042A ;Cyrillic Capital Letter Hard Sign 0x58 0x2116 ;Numero Sign 0x59 0x0402 ;Cyrillic Capital Letter Dje 0x5A 0x005D ;Right Square Bracket 0x5B 0x0024 ;Dollar Sign 0x5C 0x002A ;Asterisk 0x5D 0x0029 ;Right Parenthesis 0x5E 0x003B ;Semicolon 0x5F 0x005E ;Circumflex Accent 0x60 0x002D ;Hyphen-Minus 0x61 0x002F ;Solidus 0x62 0x0403 ;Cyrillic Capital Letter Gje 0x63 0x0401 ;Cyrillic Capital Letter Io 0x64 0x0404 ;Cyrillic Capital Letter Ukrainian Ie 0x65 0x0405 ;Cyrillic Capital Letter Dze 0x66 0x0406 ;Cyrillic Capital Letter Byelorussian-Ukrainian I 0x67 0x0407 ;Cyrillic Capital Letter Yi 0x68 0x0408 ;Cyrillic Capital Letter Je 0x69 0x0409 ;Cyrillic Capital Letter Lje 0x6A 0x007C ;Vertical Line 0x6B 0x002C ;Comma 0x6C 0x0025 ;Percent Sign 0x6D 0x005F ;Low Line 0x6E 0x003E ;Greater-Than Sign 0x70 0x040A ;Cyrillic Capital Letter Nje 0x71 0x040B ;Cyrillic Capital Letter Tshe 0x72 0x040C ;Cyrillic Capital Letter Kje 0x73 0x00AD ;Soft Hyphen 0x74 0x040E ;Cyrillic Capital Letter Short U 0x75 0x040F ;Cyrillic Capital Letter Dzhe 0x76 0x044E ;Cyrillic Small Letter Yu 0x77 0x0430 ;Cyrillic Small Letter A 0x78 0x0431 ;Cyrillic Small Letter Be 0x79 0x0060 ;Grave Accent 0x7A 0x003A ;Colon 0x7B 0x0023 ;Number Sign 0x7C 0x0040 ;Commercial At 0x7D 0x0027 ;Apostrophe 0x7E 0x003D ;Equals Sign 0x7F 0x0022 ;Quotation Mark 0x80 0x0446 ;Cyrillic Small Letter Tse 0x81 0x0061 ;Latin Small Letter A 0x82 0x0062 ;Latin Small Letter B 0x83 0x0063 ;Latin Small Letter C 0x84 0x0064 ;Latin Small Letter D 0x85 0x0065 ;Latin Small Letter E 0x86 0x0066 ;Latin Small Letter F 0x87 0x0067 ;Latin Small Letter G 0x88 0x0068 ;Latin Small Letter H 0x89 0x0069 ;Latin Small Letter I 0x8A 0x0434 ;Cyrillic Small Letter De 0x8B 0x0435 ;Cyrillic Small Letter Ie 0x8C 0x0444 ;Cyrillic Small Letter Ef 0x8D 0x0433 ;Cyrillic Small Letter Ghe 0x8E 0x0445 ;Cyrillic Small Letter Ha 0x8F 0x0438 ;Cyrillic Small Letter I 0x90 0x0439 ;Cyrillic Small Letter Short I 0x91 0x006A ;Latin Small Letter J 0x92 0x006B ;Latin Small Letter K 0x93 0x006C ;Latin Small Letter L 0x94 0x006D ;Latin Small Letter M 0x95 0x006E ;Latin Small Letter N 0x96 0x006F ;Latin Small Letter O 0x97 0x0070 ;Latin Small Letter P 0x98 0x0071 ;Latin Small Letter Q 0x99 0x0072 ;Latin Small Letter R 0x9A 0x043A ;Cyrillic Small Letter Ka 0x9B 0x043B ;Cyrillic Small Letter El 0x9C 0x043C ;Cyrillic Small Letter Em 0x9D 0x043D ;Cyrillic Small Letter En 0x9E 0x043E ;Cyrillic Small Letter O 0x9F 0x043F ;Cyrillic Small Letter Pe 0xA0 0x044F ;Cyrillic Small Letter Ya 0xA1 0x007E ;Tilde 0xA2 0x0073 ;Latin Small Letter S 0xA3 0x0074 ;Latin Small Letter T 0xA4 0x0075 ;Latin Small Letter U 0xA5 0x0076 ;Latin Small Letter V 0xA6 0x0077 ;Latin Small Letter W 0xA7 0x0078 ;Latin Small Letter X 0xA8 0x0079 ;Latin Small Letter Y 0xA9 0x007A ;Latin Small Letter Z 0xAA 0x0440 ;Cyrillic Small Letter Er 0xAB 0x0441 ;Cyrillic Small Letter Es 0xAC 0x0442 ;Cyrillic Small Letter Te 0xAD 0x0443 ;Cyrillic Small Letter U 0xAE 0x0436 ;Cyrillic Small Letter Zhe 0xAF 0x0432 ;Cyrillic Small Letter Ve 0xB0 0x044C ;Cyrillic Small Letter Soft Sign 0xB1 0x044B ;Cyrillic Small Letter Yeru 0xB2 0x0437 ;Cyrillic Small Letter Ze 0xB3 0x0448 ;Cyrillic Small Letter Sha 0xB4 0x044D ;Cyrillic Small Letter E 0xB5 0x0449 ;Cyrillic Small Letter Shcha 0xB6 0x0447 ;Cyrillic Small Letter Che 0xB7 0x044A ;Cyrillic Small Letter Hard Sign 0xB8 0x042E ;Cyrillic Capital Letter Yu 0xB9 0x0410 ;Cyrillic Capital Letter A 0xBA 0x0411 ;Cyrillic Capital Letter Be 0xBB 0x0426 ;Cyrillic Capital Letter Tse 0xBC 0x0414 ;Cyrillic Capital Letter De 0xBD 0x0415 ;Cyrillic Capital Letter Ie 0xBE 0x0424 ;Cyrillic Capital Letter Ef 0xBF 0x0413 ;Cyrillic Capital Letter Ghe 0xC0 0x007B ;Left Curly Bracket 0xC1 0x0041 ;Latin Capital Letter A 0xC2 0x0042 ;Latin Capital Letter B 0xC3 0x0043 ;Latin Capital Letter C 0xC4 0x0044 ;Latin Capital Letter D 0xC5 0x0045 ;Latin Capital Letter E 0xC6 0x0046 ;Latin Capital Letter F 0xC7 0x0047 ;Latin Capital Letter G 0xC8 0x0048 ;Latin Capital Letter H 0xC9 0x0049 ;Latin Capital Letter I 0xCA 0x0425 ;Cyrillic Capital Letter Ha 0xCB 0x0418 ;Cyrillic Capital Letter I 0xCC 0x0419 ;Cyrillic Capital Letter Short I 0xCD 0x041A ;Cyrillic Capital Letter Ka 0xCE 0x041B ;Cyrillic Capital Letter El 0xCF 0x041C ;Cyrillic Capital Letter Em 0xD0 0x007D ;Right Curly Bracket 0xD1 0x004A ;Latin Capital Letter J 0xD2 0x004B ;Latin Capital Letter K 0xD3 0x004C ;Latin Capital Letter L 0xD4 0x004D ;Latin Capital Letter M 0xD5 0x004E ;Latin Capital Letter N 0xD6 0x004F ;Latin Capital Letter O 0xD7 0x0050 ;Latin Capital Letter P 0xD8 0x0051 ;Latin Capital Letter Q 0xD9 0x0052 ;Latin Capital Letter R 0xDA 0x041D ;Cyrillic Capital Letter En 0xDB 0x041E ;Cyrillic Capital Letter O 0xDC 0x041F ;Cyrillic Capital Letter Pe 0xDD 0x042F ;Cyrillic Capital Letter Ya 0xDE 0x0420 ;Cyrillic Capital Letter Er 0xDF 0x0421 ;Cyrillic Capital Letter Es 0xE0 0x005C ;Reverse Solidus 0xE1 0x00A4 ;Currency Sign 0xE2 0x0053 ;Latin Capital Letter S 0xE3 0x0054 ;Latin Capital Letter T 0xE4 0x0055 ;Latin Capital Letter U 0xE5 0x0056 ;Latin Capital Letter V 0xE6 0x0057 ;Latin Capital Letter W 0xE7 0x0058 ;Latin Capital Letter X 0xE8 0x0059 ;Latin Capital Letter Y 0xE9 0x005A ;Latin Capital Letter Z 0xEA 0x0422 ;Cyrillic Capital Letter Te 0xEB 0x0423 ;Cyrillic Capital Letter U 0xEC 0x0416 ;Cyrillic Capital Letter Zhe 0xED 0x0412 ;Cyrillic Capital Letter Ve 0xEE 0x042C ;Cyrillic Capital Letter Soft Sign 0xEF 0x042B ;Cyrillic Capital Letter Yeru 0xF0 0x0030 ;Digit Zero 0xF1 0x0031 ;Digit One 0xF2 0x0032 ;Digit Two 0xF3 0x0033 ;Digit Three 0xF4 0x0034 ;Digit Four 0xF5 0x0035 ;Digit Five 0xF6 0x0036 ;Digit Six 0xF7 0x0037 ;Digit Seven 0xF8 0x0038 ;Digit Eight 0xF9 0x0039 ;Digit Nine 0xFA 0x0417 ;Cyrillic Capital Letter Ze 0xFB 0x0428 ;Cyrillic Capital Letter Sha 0xFC 0x042D ;Cyrillic Capital Letter E 0xFD 0x0429 ;Cyrillic Capital Letter Shcha 0xFE 0x0427 ;Cyrillic Capital Letter Che 0xFF 0x009F ;Application Program Command WCTABLE 348 0x0000 0x00 ;Null 0x0001 0x01 ;Start Of Heading 0x0002 0x02 ;Start Of Text 0x0003 0x03 ;End Of Text 0x0004 0x37 ;End Of Transmission 0x0005 0x2D ;Enquiry 0x0006 0x2E ;Acknowledge 0x0007 0x2F ;Bell 0x0008 0x16 ;Backspace 0x0009 0x05 ;Character Tabulation 0x000A 0x25 ;Line Feed (LF) 0x000B 0x0B ;Line Tabulation 0x000C 0x0C ;Form Feed (FF) 0x000D 0x0D ;Carriage Return (CR) 0x000E 0x0E ;Shift Out 0x000F 0x0F ;Shift In 0x0010 0x10 ;Data Link Escape 0x0011 0x11 ;Device Control One 0x0012 0x12 ;Device Control Two 0x0013 0x13 ;Device Control Three 0x0014 0x3C ;Device Control Four 0x0015 0x3D ;Negative Acknowledge 0x0016 0x32 ;Synchronous Idle 0x0017 0x26 ;End Of Transmission Block 0x0018 0x18 ;Cancel 0x0019 0x19 ;End Of Medium 0x001A 0x3F ;Substitute 0x001B 0x27 ;Escape 0x001C 0x1C ;Information Separator Four 0x001D 0x1D ;Information Separator Three 0x001E 0x1E ;Information Separator Two 0x001F 0x1F ;Information Separator One 0x0020 0x40 ;Space 0x0021 0x4F ;Exclamation Mark 0x0022 0x7F ;Quotation Mark 0x0023 0x7B ;Number Sign 0x0024 0x5B ;Dollar Sign 0x0025 0x6C ;Percent Sign 0x0026 0x50 ;Ampersand 0x0027 0x7D ;Apostrophe 0x0028 0x4D ;Left Parenthesis 0x0029 0x5D ;Right Parenthesis 0x002A 0x5C ;Asterisk 0x002B 0x4E ;Plus Sign 0x002C 0x6B ;Comma 0x002D 0x60 ;Hyphen-Minus 0x002E 0x4B ;Full Stop 0x002F 0x61 ;Solidus 0x0030 0xF0 ;Digit Zero 0x0031 0xF1 ;Digit One 0x0032 0xF2 ;Digit Two 0x0033 0xF3 ;Digit Three 0x0034 0xF4 ;Digit Four 0x0035 0xF5 ;Digit Five 0x0036 0xF6 ;Digit Six 0x0037 0xF7 ;Digit Seven 0x0038 0xF8 ;Digit Eight 0x0039 0xF9 ;Digit Nine 0x003A 0x7A ;Colon 0x003B 0x5E ;Semicolon 0x003C 0x4C ;Less-Than Sign 0x003D 0x7E ;Equals Sign 0x003E 0x6E ;Greater-Than Sign 0x0040 0x7C ;Commercial At 0x0041 0xC1 ;Latin Capital Letter A 0x0042 0xC2 ;Latin Capital Letter B 0x0043 0xC3 ;Latin Capital Letter C 0x0044 0xC4 ;Latin Capital Letter D 0x0045 0xC5 ;Latin Capital Letter E 0x0046 0xC6 ;Latin Capital Letter F 0x0047 0xC7 ;Latin Capital Letter G 0x0048 0xC8 ;Latin Capital Letter H 0x0049 0xC9 ;Latin Capital Letter I 0x004A 0xD1 ;Latin Capital Letter J 0x004B 0xD2 ;Latin Capital Letter K 0x004C 0xD3 ;Latin Capital Letter L 0x004D 0xD4 ;Latin Capital Letter M 0x004E 0xD5 ;Latin Capital Letter N 0x004F 0xD6 ;Latin Capital Letter O 0x0050 0xD7 ;Latin Capital Letter P 0x0051 0xD8 ;Latin Capital Letter Q 0x0052 0xD9 ;Latin Capital Letter R 0x0053 0xE2 ;Latin Capital Letter S 0x0054 0xE3 ;Latin Capital Letter T 0x0055 0xE4 ;Latin Capital Letter U 0x0056 0xE5 ;Latin Capital Letter V 0x0057 0xE6 ;Latin Capital Letter W 0x0058 0xE7 ;Latin Capital Letter X 0x0059 0xE8 ;Latin Capital Letter Y 0x005A 0xE9 ;Latin Capital Letter Z 0x005B 0x4A ;Left Square Bracket 0x005C 0xE0 ;Reverse Solidus 0x005D 0x5A ;Right Square Bracket 0x005E 0x5F ;Circumflex Accent 0x005F 0x6D ;Low Line 0x0060 0x79 ;Grave Accent 0x0061 0x81 ;Latin Small Letter A 0x0062 0x82 ;Latin Small Letter B 0x0063 0x83 ;Latin Small Letter C 0x0064 0x84 ;Latin Small Letter D 0x0065 0x85 ;Latin Small Letter E 0x0066 0x86 ;Latin Small Letter F 0x0067 0x87 ;Latin Small Letter G 0x0068 0x88 ;Latin Small Letter H 0x0069 0x89 ;Latin Small Letter I 0x006A 0x91 ;Latin Small Letter J 0x006B 0x92 ;Latin Small Letter K 0x006C 0x93 ;Latin Small Letter L 0x006D 0x94 ;Latin Small Letter M 0x006E 0x95 ;Latin Small Letter N 0x006F 0x96 ;Latin Small Letter O 0x0070 0x97 ;Latin Small Letter P 0x0071 0x98 ;Latin Small Letter Q 0x0072 0x99 ;Latin Small Letter R 0x0073 0xA2 ;Latin Small Letter S 0x0074 0xA3 ;Latin Small Letter T 0x0075 0xA4 ;Latin Small Letter U 0x0076 0xA5 ;Latin Small Letter V 0x0077 0xA6 ;Latin Small Letter W 0x0078 0xA7 ;Latin Small Letter X 0x0079 0xA8 ;Latin Small Letter Y 0x007A 0xA9 ;Latin Small Letter Z 0x007B 0xC0 ;Left Curly Bracket 0x007C 0x6A ;Vertical Line 0x007D 0xD0 ;Right Curly Bracket 0x007E 0xA1 ;Tilde 0x007F 0x07 ;Delete 0x0080 0x20 ;Undefined 0x0081 0x21 ;Undefined 0x0082 0x22 ;Break Permitted Here 0x0083 0x23 ;No Break Here 0x0084 0x24 ;Undefined 0x0085 0x15 ;Next Line (NEL) 0x0086 0x06 ;Start Of Selected Area 0x0087 0x17 ;End Of Selected Area 0x0088 0x28 ;Character Tabulation Set 0x0089 0x29 ;Character Tabulation With Justification 0x008A 0x2A ;Line Tabulation Set 0x008B 0x2B ;Partial Line Forward 0x008C 0x2C ;Partial Line Backward 0x008D 0x09 ;Reverse Line Feed 0x008E 0x0A ;Single Shift Two 0x008F 0x1B ;Single Shift Three 0x0090 0x30 ;Device Control String 0x0091 0x31 ;Private Use One 0x0092 0x1A ;Private Use Two 0x0093 0x33 ;Set Transmit State 0x0094 0x34 ;Cancel Character 0x0095 0x35 ;Message Waiting 0x0096 0x36 ;Start Of Guarded Area 0x0097 0x08 ;End Of Guarded Area 0x0098 0x38 ;Start Of String 0x0099 0x39 ;Undefined 0x009A 0x3A ;Single Character Introducer 0x009B 0x3B ;Control Sequence Introducer 0x009C 0x04 ;String Terminator 0x009D 0x14 ;Operating System Command 0x009E 0x3E ;Privacy Message 0x009F 0xFF ;Application Program Command 0x00A0 0x41 ;No-Break Space 0x00A4 0xE1 ;Currency Sign 0x00AD 0x73 ;Soft Hyphen 0x0401 0x63 ;Cyrillic Capital Letter Io 0x0402 0x59 ;Cyrillic Capital Letter Dje 0x0403 0x62 ;Cyrillic Capital Letter Gje 0x0404 0x64 ;Cyrillic Capital Letter Ukrainian Ie 0x0405 0x65 ;Cyrillic Capital Letter Dze 0x0406 0x66 ;Cyrillic Capital Letter Byelorussian-Ukrainian I 0x0407 0x67 ;Cyrillic Capital Letter Yi 0x0408 0x68 ;Cyrillic Capital Letter Je 0x0409 0x69 ;Cyrillic Capital Letter Lje 0x040A 0x70 ;Cyrillic Capital Letter Nje 0x040B 0x71 ;Cyrillic Capital Letter Tshe 0x040C 0x72 ;Cyrillic Capital Letter Kje 0x040E 0x74 ;Cyrillic Capital Letter Short U 0x040F 0x75 ;Cyrillic Capital Letter Dzhe 0x0410 0xB9 ;Cyrillic Capital Letter A 0x0411 0xBA ;Cyrillic Capital Letter Be 0x0412 0xED ;Cyrillic Capital Letter Ve 0x0413 0xBF ;Cyrillic Capital Letter Ghe 0x0414 0xBC ;Cyrillic Capital Letter De 0x0415 0xBD ;Cyrillic Capital Letter Ie 0x0416 0xEC ;Cyrillic Capital Letter Zhe 0x0417 0xFA ;Cyrillic Capital Letter Ze 0x0418 0xCB ;Cyrillic Capital Letter I 0x0419 0xCC ;Cyrillic Capital Letter Short I 0x041A 0xCD ;Cyrillic Capital Letter Ka 0x041B 0xCE ;Cyrillic Capital Letter El 0x041C 0xCF ;Cyrillic Capital Letter Em 0x041D 0xDA ;Cyrillic Capital Letter En 0x041E 0xDB ;Cyrillic Capital Letter O 0x041F 0xDC ;Cyrillic Capital Letter Pe 0x0420 0xDE ;Cyrillic Capital Letter Er 0x0421 0xDF ;Cyrillic Capital Letter Es 0x0422 0xEA ;Cyrillic Capital Letter Te 0x0423 0xEB ;Cyrillic Capital Letter U 0x0424 0xBE ;Cyrillic Capital Letter Ef 0x0425 0xCA ;Cyrillic Capital Letter Ha 0x0426 0xBB ;Cyrillic Capital Letter Tse 0x0427 0xFE ;Cyrillic Capital Letter Che 0x0428 0xFB ;Cyrillic Capital Letter Sha 0x0429 0xFD ;Cyrillic Capital Letter Shcha 0x042A 0x57 ;Cyrillic Capital Letter Hard Sign 0x042B 0xEF ;Cyrillic Capital Letter Yeru 0x042C 0xEE ;Cyrillic Capital Letter Soft Sign 0x042D 0xFC ;Cyrillic Capital Letter E 0x042E 0xB8 ;Cyrillic Capital Letter Yu 0x042F 0xDD ;Cyrillic Capital Letter Ya 0x0430 0x77 ;Cyrillic Small Letter A 0x0431 0x78 ;Cyrillic Small Letter Be 0x0432 0xAF ;Cyrillic Small Letter Ve 0x0433 0x8D ;Cyrillic Small Letter Ghe 0x0434 0x8A ;Cyrillic Small Letter De 0x0435 0x8B ;Cyrillic Small Letter Ie 0x0436 0xAE ;Cyrillic Small Letter Zhe 0x0437 0xB2 ;Cyrillic Small Letter Ze 0x0438 0x8F ;Cyrillic Small Letter I 0x0439 0x90 ;Cyrillic Small Letter Short I 0x043A 0x9A ;Cyrillic Small Letter Ka 0x043B 0x9B ;Cyrillic Small Letter El 0x043C 0x9C ;Cyrillic Small Letter Em 0x043D 0x9D ;Cyrillic Small Letter En 0x043E 0x9E ;Cyrillic Small Letter O 0x043F 0x9F ;Cyrillic Small Letter Pe 0x0440 0xAA ;Cyrillic Small Letter Er 0x0441 0xAB ;Cyrillic Small Letter Es 0x0442 0xAC ;Cyrillic Small Letter Te 0x0443 0xAD ;Cyrillic Small Letter U 0x0444 0x8C ;Cyrillic Small Letter Ef 0x0445 0x8E ;Cyrillic Small Letter Ha 0x0446 0x80 ;Cyrillic Small Letter Tse 0x0447 0xB6 ;Cyrillic Small Letter Che 0x0448 0xB3 ;Cyrillic Small Letter Sha 0x0449 0xB5 ;Cyrillic Small Letter Shcha 0x044A 0xB7 ;Cyrillic Small Letter Hard Sign 0x044B 0xB1 ;Cyrillic Small Letter Yeru 0x044C 0xB0 ;Cyrillic Small Letter Soft Sign 0x044D 0xB4 ;Cyrillic Small Letter E 0x044E 0x76 ;Cyrillic Small Letter Yu 0x044F 0xA0 ;Cyrillic Small Letter Ya 0x0451 0x44 ;Cyrillic Small Letter Io 0x0452 0x42 ;Cyrillic Small Letter Dje 0x0453 0x43 ;Cyrillic Small Letter Gje 0x0454 0x45 ;Cyrillic Small Letter Ukrainian Ie 0x0455 0x46 ;Cyrillic Small Letter Dze 0x0456 0x47 ;Cyrillic Small Letter Byelorussian-Ukrainian I 0x0457 0x48 ;Cyrillic Small Letter Yi 0x0458 0x49 ;Cyrillic Small Letter Je 0x0459 0x51 ;Cyrillic Small Letter Lje 0x045A 0x52 ;Cyrillic Small Letter Nje 0x045B 0x53 ;Cyrillic Small Letter Tshe 0x045C 0x54 ;Cyrillic Small Letter Kje 0x045E 0x55 ;Cyrillic Small Letter Short U 0x045F 0x56 ;Cyrillic Small Letter Dzhe 0x2116 0x58 ;Numero Sign 0xFF01 0x4F ;Fullwidth Exclamation Mark 0xFF02 0x7F ;Fullwidth Quotation Mark 0xFF03 0x7B ;Fullwidth Number Sign 0xFF04 0x5B ;Fullwidth Dollar Sign 0xFF05 0x6C ;Fullwidth Percent Sign 0xFF06 0x50 ;Fullwidth Ampersand 0xFF07 0x7D ;Fullwidth Apostrophe 0xFF08 0x4D ;Fullwidth Left Parenthesis 0xFF09 0x5D ;Fullwidth Right Parenthesis 0xFF0A 0x5C ;Fullwidth Asterisk 0xFF0B 0x4E ;Fullwidth Plus Sign 0xFF0C 0x6B ;Fullwidth Comma 0xFF0D 0x60 ;Fullwidth Hyphen-Minus 0xFF0E 0x4B ;Fullwidth Full Stop 0xFF0F 0x61 ;Fullwidth Solidus 0xFF10 0xF0 ;Fullwidth Digit Zero 0xFF11 0xF1 ;Fullwidth Digit One 0xFF12 0xF2 ;Fullwidth Digit Two 0xFF13 0xF3 ;Fullwidth Digit Three 0xFF14 0xF4 ;Fullwidth Digit Four 0xFF15 0xF5 ;Fullwidth Digit Five 0xFF16 0xF6 ;Fullwidth Digit Six 0xFF17 0xF7 ;Fullwidth Digit Seven 0xFF18 0xF8 ;Fullwidth Digit Eight 0xFF19 0xF9 ;Fullwidth Digit Nine 0xFF1A 0x7A ;Fullwidth Colon 0xFF1B 0x5E ;Fullwidth Semicolon 0xFF1C 0x4C ;Fullwidth Less-Than Sign 0xFF1D 0x7E ;Fullwidth Equals Sign 0xFF1E 0x6E ;Fullwidth Greater-Than Sign 0xFF20 0x7C ;Fullwidth Commercial At 0xFF21 0xC1 ;Fullwidth Latin Capital Letter A 0xFF22 0xC2 ;Fullwidth Latin Capital Letter B 0xFF23 0xC3 ;Fullwidth Latin Capital Letter C 0xFF24 0xC4 ;Fullwidth Latin Capital Letter D 0xFF25 0xC5 ;Fullwidth Latin Capital Letter E 0xFF26 0xC6 ;Fullwidth Latin Capital Letter F 0xFF27 0xC7 ;Fullwidth Latin Capital Letter G 0xFF28 0xC8 ;Fullwidth Latin Capital Letter H 0xFF29 0xC9 ;Fullwidth Latin Capital Letter I 0xFF2A 0xD1 ;Fullwidth Latin Capital Letter J 0xFF2B 0xD2 ;Fullwidth Latin Capital Letter K 0xFF2C 0xD3 ;Fullwidth Latin Capital Letter L 0xFF2D 0xD4 ;Fullwidth Latin Capital Letter M 0xFF2E 0xD5 ;Fullwidth Latin Capital Letter N 0xFF2F 0xD6 ;Fullwidth Latin Capital Letter O 0xFF30 0xD7 ;Fullwidth Latin Capital Letter P 0xFF31 0xD8 ;Fullwidth Latin Capital Letter Q 0xFF32 0xD9 ;Fullwidth Latin Capital Letter R 0xFF33 0xE2 ;Fullwidth Latin Capital Letter S 0xFF34 0xE3 ;Fullwidth Latin Capital Letter T 0xFF35 0xE4 ;Fullwidth Latin Capital Letter U 0xFF36 0xE5 ;Fullwidth Latin Capital Letter V 0xFF37 0xE6 ;Fullwidth Latin Capital Letter W 0xFF38 0xE7 ;Fullwidth Latin Capital Letter X 0xFF39 0xE8 ;Fullwidth Latin Capital Letter Y 0xFF3A 0xE9 ;Fullwidth Latin Capital Letter Z 0xFF3B 0x4A ;Fullwidth Left Square Bracket 0xFF3C 0xE0 ;Fullwidth Reverse Solidus 0xFF3D 0x5A ;Fullwidth Right Square Bracket 0xFF3E 0x5F ;Fullwidth Circumflex Accent 0xFF3F 0x6D ;Fullwidth Low Line 0xFF40 0x79 ;Fullwidth Grave Accent 0xFF41 0x81 ;Fullwidth Latin Small Letter A 0xFF42 0x82 ;Fullwidth Latin Small Letter B 0xFF43 0x83 ;Fullwidth Latin Small Letter C 0xFF44 0x84 ;Fullwidth Latin Small Letter D 0xFF45 0x85 ;Fullwidth Latin Small Letter E 0xFF46 0x86 ;Fullwidth Latin Small Letter F 0xFF47 0x87 ;Fullwidth Latin Small Letter G 0xFF48 0x88 ;Fullwidth Latin Small Letter H 0xFF49 0x89 ;Fullwidth Latin Small Letter I 0xFF4A 0x91 ;Fullwidth Latin Small Letter J 0xFF4B 0x92 ;Fullwidth Latin Small Letter K 0xFF4C 0x93 ;Fullwidth Latin Small Letter L 0xFF4D 0x94 ;Fullwidth Latin Small Letter M 0xFF4E 0x95 ;Fullwidth Latin Small Letter N 0xFF4F 0x96 ;Fullwidth Latin Small Letter O 0xFF50 0x97 ;Fullwidth Latin Small Letter P 0xFF51 0x98 ;Fullwidth Latin Small Letter Q 0xFF52 0x99 ;Fullwidth Latin Small Letter R 0xFF53 0xA2 ;Fullwidth Latin Small Letter S 0xFF54 0xA3 ;Fullwidth Latin Small Letter T 0xFF55 0xA4 ;Fullwidth Latin Small Letter U 0xFF56 0xA5 ;Fullwidth Latin Small Letter V 0xFF57 0xA6 ;Fullwidth Latin Small Letter W 0xFF58 0xA7 ;Fullwidth Latin Small Letter X 0xFF59 0xA8 ;Fullwidth Latin Small Letter Y 0xFF5A 0xA9 ;Fullwidth Latin Small Letter Z 0xFF5B 0xC0 ;Fullwidth Left Curly Bracket 0xFF5C 0x6A ;Fullwidth Vertical Line 0xFF5D 0xD0 ;Fullwidth Right Curly Bracket 0xFF5E 0xA1 ;Fullwidth Tilde ENDCODEPAGE
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <!-- File created by the Android Action Bar Style Generator Copyright (C) 2011 The Android Open Source Project Copyright (C) 2012 readyState Software Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:drawable="@drawable/spinner_ab_disabled_apptheme" /> <item android:state_pressed="true" android:drawable="@drawable/spinner_ab_pressed_apptheme" /> <item android:state_pressed="false" android:state_focused="true" android:drawable="@drawable/spinner_ab_focused_apptheme" /> <item android:drawable="@drawable/spinner_ab_default_apptheme" /> </selector>
{ "pile_set_name": "Github" }
% Test file for chebtech/real.m function pass = test_real(pref) if ( nargin < 1 ) pref = chebtech.techPref(); end for n = 1:2 if ( n == 1 ) testclass = chebtech1(); else testclass = chebtech2(); end % Test a scalar-valued function: f = testclass.make(@(x) exp(1i*x) + 1i*sin(x), [], pref); g = testclass.make(@(x) cos(x), [], pref); h = real(f); pass(n, 1) = norm(h.coeffs - g.coeffs, inf) < 10*vscale(h)*eps; % Test an array-valued function: f = testclass.make(@(x) [exp(1i*x) + 1i*sin(x), -exp(1i*x)], [], pref); g = testclass.make(@(x) [cos(x), -real(exp(1i*x))], [], pref); h = real(f); pass(n, 2) = norm(h.coeffs - g.coeffs, inf) < 10*max(vscale(h)*eps); % Test a real function: f = testclass.make(@(x) 1i*cos(x), [], pref); g = real(f); pass(n, 3) = numel(g.coeffs) == 1 && g.coeffs == 0; % Test an array-valued real function: f = testclass.make(@(x) 1i*[cos(x), sin(x), exp(x)], [], pref); g = real(f); pass(n, 4) = all(size(g.coeffs) == [1, 3]) && all(g.coeffs == 0); end end
{ "pile_set_name": "Github" }
var override = require('../utils/override'); var INTEGER_PATTERN = /^\d+$/; var ALL_UNITS = ['*', 'all']; var DEFAULT_PRECISION = 'off'; // all precision changes are disabled var DIRECTIVES_SEPARATOR = ','; // e.g. *=5,px=3 var DIRECTIVE_VALUE_SEPARATOR = '='; // e.g. *=5 function roundingPrecisionFrom(source) { return override(defaults(DEFAULT_PRECISION), buildPrecisionFrom(source)); } function defaults(value) { return { 'ch': value, 'cm': value, 'em': value, 'ex': value, 'in': value, 'mm': value, 'pc': value, 'pt': value, 'px': value, 'q': value, 'rem': value, 'vh': value, 'vmax': value, 'vmin': value, 'vw': value, '%': value }; } function buildPrecisionFrom(source) { if (source === null || source === undefined) { return {}; } if (typeof source == 'boolean') { return {}; } if (typeof source == 'number' && source == -1) { return defaults(DEFAULT_PRECISION); } if (typeof source == 'number') { return defaults(source); } if (typeof source == 'string' && INTEGER_PATTERN.test(source)) { return defaults(parseInt(source)); } if (typeof source == 'string' && source == DEFAULT_PRECISION) { return defaults(DEFAULT_PRECISION); } if (typeof source == 'object') { return source; } return source .split(DIRECTIVES_SEPARATOR) .reduce(function (accumulator, directive) { var directiveParts = directive.split(DIRECTIVE_VALUE_SEPARATOR); var name = directiveParts[0]; var value = parseInt(directiveParts[1]); if (isNaN(value) || value == -1) { value = DEFAULT_PRECISION; } if (ALL_UNITS.indexOf(name) > -1) { accumulator = override(accumulator, defaults(value)); } else { accumulator[name] = value; } return accumulator; }, {}); } module.exports = { DEFAULT: DEFAULT_PRECISION, roundingPrecisionFrom: roundingPrecisionFrom };
{ "pile_set_name": "Github" }
[/ / Copyright (c) 2003 Boost.Test contributors / / Distributed under the Boost Software License, Version 1.0. (See accompanying / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) /] [section:test_unit_filtering Test unit filtering] The __UTF__ offers a number of ways to run only a subset of all test cases registered in the test tree. [#ref_default_run_status][h3 Default run status] Each test unit (either test case or test suite) has an associated ['default run status]. It can assume one of the three values: # ['true] -- this means that, unless some runtime parameters specify otherwise, the test unit is designated to be run. # ['false] -- this means that, unless some runtime parameters specify otherwise, the test unit is designated ['not] to be run. # ['inherit] -- this means that the test unit's default run status is the same as that of its immediate parent test unit. This is applied recursively. Initially, the master test suite has default run status set to ['true]. All other test units have default run status set to ['inherit]. This implies that, unless any additional configuration is applied, all tests are designated to be run. You can set a different default run status in any test unit by using [link boost_test.tests_organization.decorators decorators]: __decorator_disabled__, __decorator_enabled__ and __decorator_enable_if__. The default run status is set once, upon testing program initialization, and cannot be changed. The disabled tests are not executed by default, but are still present in the test tree, and are listed along with other tests when you use command-line argument [link boost_test.utf_reference.rt_param_reference.list_content `list_content`]. [bt_example decorator_20..default run status..run-fail] [#ref_dynamic_test_dependency][h3 Dynamic test dependencies] Additionally, it is possible to statically associate a test unit with a condition. This associated condition is evaluated immediately before executing the test unit. If the condition is met, the test unit is executed. Otherwise, the test unit is ['skipped]. It is possible to add two dependencies: # Upon another test unit. In this case the decorated test case is skipped if the test unit specified in the dependency is either failed or skipped or disabled. This can be declared with decorator __decorator_depends_on__. # Upon an arbitrary predicate. This can be declared with decorator __decorator_precondition__. [#ref_command_line_control][h3 Command-line control] Static configuration of the test-case filtering is used by default, unless command-line filtering is applied. With command-line argument __param_run_test__ it is possible to alter the static pre-set in a number of ways: # Ignore the static configuration and manually specify test cases to be run. # Augment the statically defined set by enabling the disabled test cases. # Shrink the statically defined set by disabling some of the enabled test cases. [#ref_command_line_control_absolute][h4 Absolute specification] Term 'absolute' in this context means that the default run status of the test units, which has been statically set up, is completely ignored and the tests to be run are specified manually from scratch. First, in order to learn what test units are registered in the test tree the user needs to use command-line argument [link boost_test.utf_reference.rt_param_reference.list_content `list_content`]. Next, in order to specify a set of test cases, the user needs to use command-line argument __param_run_test__ with absolute value: ``` > test_program --__param_run_test__=<test_set> ``` The format of `<test_set>` value can assume a number of forms. Given the following program: ``` #define __BOOST_TEST_MODULE__ example #include <boost/test/included/unit_test.hpp> using boost::unit_test::__decorator_label__; __BOOST_AUTO_TEST_CASE__(test_1, *label("L1")) {} BOOST_AUTO_TEST_CASE(test_2, *label("L1")) {} __BOOST_AUTO_TEST_SUITE__(suite_1) BOOST_AUTO_TEST_SUITE(suite_1) BOOST_AUTO_TEST_CASE(test_1) {} BOOST_AUTO_TEST_CASE(test_2) {} BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(suite_2) BOOST_AUTO_TEST_CASE(test_1, *label("L2")) {} BOOST_AUTO_TEST_CASE(test_2, *label("L2")) {} BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_CASE(test_1, *label("L1")) {} BOOST_AUTO_TEST_CASE(test_2) {} BOOST_AUTO_TEST_CASE(test_2A) {} BOOST_AUTO_TEST_SUITE_END() ``` The following table illustrates how different values of `<test_set>` control which test cases ware run. [table [ [Description] [Parameter value] [Test cases run] ] [ [Run single top-level test case by name] [[pre __param_run_test__=test_1]] [ [pre test_1 ] ] ] [ [Run single nested test case by name] [[pre __param_run_test__=suite_1/suite_1/test_1]] [ [pre suite_1/suite_1/test_1 ] ] ] [ [Run single test suite by name] [ [pre __param_run_test__=suite_1/suite_2 __param_run_test__=suite_1/suite_2/* ] ] [ [pre suite_1/suite_2/test_1 suite_1/suite_2/test_2 ] ] ] [ [Run multiple test units that are *siblings* of the same test suite] [[pre __param_run_test__=suite_1/test_1,suite_2]] [ [pre suite_1/suite_2/test_1 suite_1/suite_2/test_2 suite_1/test_1 ] ] ] [ [Run multiple test units that are not necessarily siblings] [[pre __param_run_test__=suite_1/test_1:test_1]] [ [pre suite_1/test_1 test_1 ] ] ] [ [Run all tests matching to a given label] [[pre __param_run_test__=@L1]] [ [pre test_1 test_2 suite_1/test_1 ] ] ] [ [Run every test case in the test tree. Note that this will also enable all disabled tests.] [[pre __param_run_test__=*]] [ [pre test_1 test_2 suite_1/suite_1/test_1 suite_1/suite_1/test_2 suite_1/suite_2/test_1 suite_1/suite_2/test_2 suite_1/test_1 suite_1/test_2 suite_1/test_2A ] ] ] [ [Run every test unit in a given suite with a given prefix] [[pre __param_run_test__=suite_1/test*]] [ [pre suite_1/test_1 suite_1/test_2 suite_1/test_2A ] ] ] [ [Run every test unit in a given suite with a given suffix] [[pre __param_run_test__=suite_1/*_1]] [ [pre suite_1/suite_1/test_1 suite_1/suite_1/test_2 suite_1/test_1 ] ] ] [ [Run every test unit in a given suite with a given infix] [[pre __param_run_test__=suite_1/\*_2\*]] [ [pre suite_1/suite_2/test_1 suite_1/suite_2/test_2 suite_1/test_2 suite_1/test_2A ] ] ] [ [Run test(s) with given name in any N-level suite] [[pre __param_run_test__=\*/\*/test_2]] [ [pre suite_1/suite_1/test_2 suite_1/suite_2/test_2 ] ] ] ] For the syntax productions describing the structure of `<test_set>` value see [link boost_test.utf_reference.rt_param_reference.run_test here]. While using manual absolute test case specification ignores the default run status, it does not ignore the dynamic test dependencies. If test unit `B` depends on test unit `A` and test `B` is specified to be run by __param_run_test__, `A` is also run, even if it is not specified, and its failure may cause the execution of `B` to be skipped. Similarly, the failed check of the __decorator_precondition__ may cause the test selected test to be skipped. [bt_example decorator_21..run_test and dynamic dependencies..run-fail] [#ref_command_line_control_enablers][h4 Relative specification] Term 'relative' in this context means that the configuration is based on either the default run status of the test units or by the command-line override specified by the ['absolute specification]; and atop of this, we additionally either enable some disabled test units or disable some enabled tests units. The relative specification is controlled by command-line argument __param_run_test__, with the value using similar syntax as in the absolute specification, but preceded with either character `'!'` for disabling enabled test units or with character `'+'` for enabling the disabled test units. This can be summarized with the following table: [table [ [command][specification type][semantics] ] [ [[pre > test_program --__param_run_test__=!<absolute_spec>]][disabler][Enabled test units that match `<absolute_spec>` become disabled.] ] [ [[pre > test_program --__param_run_test__=+<absolute_spec>]][enabler][Disabled test units that match `<absolute_spec>` as well as their upstream dependencies become enabled.] ] ] The ['enabler] specification is used to enable a set of test units which are initially disabled. [bt_example decorator_22..command-line enabler..run] Conversely, the ['disabler] specification is used to disable a set of test units which are initially enabled. [bt_example decorator_23..command-line disabler..run] If there are both an enabler and disabler on one command line that specify the same test, the test becomes disabled. I.e., the disabler takes the precedence over the enabler. [note While enabler additionally enables the upstream dependencies (introduced with decorator __decorator_depends_on__), disabler does not disable them. Therefore when you enable and then disable the same test, you do not disable its upstream dependencies.] [/----------------------------------------------] [endsect] [/ section:test_unit_filtering]
{ "pile_set_name": "Github" }
{ "pluginType": "Ak.Element", "type": "VideoFilter", "description": "Psychedelic" }
{ "pile_set_name": "Github" }
# CS_ARCH_SPARC, CS_MODE_BIG_ENDIAN, None 0x81,0xa8,0x0a,0x24 = fcmps %f0, %f4 0x81,0xa8,0x0a,0x44 = fcmpd %f0, %f4 0x81,0xa8,0x0a,0x64 = fcmpq %f0, %f4 0x81,0xa8,0x0a,0xa4 = fcmpes %f0, %f4 0x81,0xa8,0x0a,0xc4 = fcmped %f0, %f4 0x81,0xa8,0x0a,0xe4 = fcmpeq %f0, %f4
{ "pile_set_name": "Github" }
package r_kvstore //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 Alibaba Cloud SDK Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Order is a nested struct in r_kvstore response type Order struct { OriginalAmount float64 `json:"OriginalAmount" xml:"OriginalAmount"` TradeAmount float64 `json:"TradeAmount" xml:"TradeAmount"` DiscountAmount float64 `json:"DiscountAmount" xml:"DiscountAmount"` Currency string `json:"Currency" xml:"Currency"` RuleIds RuleIdsInDescribePrice `json:"RuleIds" xml:"RuleIds"` Coupons Coupons `json:"Coupons" xml:"Coupons"` }
{ "pile_set_name": "Github" }
/** * @file HD44780_SR3WSPI.cpp * @version 1.0 * * @section License * Copyright (C) 2013-2015, Mikael Patel * * 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. * * This file is part of the Arduino Che Cosa project. */ #include "HD44780.hh" HD44780::SR3WSPI::SR3WSPI(Board::DigitalPin en) : SPI::Driver(en, SPI::PULSE_HIGH), m_port() { } bool HD44780::SR3WSPI::setup() { return (false); } void HD44780::SR3WSPI::write4b(uint8_t data) { m_port.data = data; spi.acquire(this); spi.begin(); spi.transfer(m_port); spi.end(); spi.release(); } void HD44780::SR3WSPI::write8b(uint8_t data) { spi.acquire(this); spi.begin(); m_port.data = (data >> 4); spi.transfer(m_port); m_port.data = data; m_cs._toggle(); m_cs._toggle(); spi.transfer(m_port); spi.end(); spi.release(); DELAY(SHORT_EXEC_TIME); } void HD44780::SR3WSPI::set_mode(uint8_t flag) { m_port.rs = flag; } void HD44780::SR3WSPI::set_backlight(uint8_t flag) { m_port.bt = flag; }
{ "pile_set_name": "Github" }
// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec import ( "encoding" "errors" "fmt" "io" "reflect" "strconv" "sync" "time" ) // Some tagging information for error messages. const ( msgBadDesc = "unrecognized descriptor byte" msgDecCannotExpandArr = "cannot expand go array from %v to stream length: %v" ) const decDefSliceCap = 8 const decDefChanCap = 64 // should be large, as cap cannot be expanded const decScratchByteArrayLen = cacheLineSize - 8 var ( errstrOnlyMapOrArrayCanDecodeIntoStruct = "only encoded map or array can be decoded into a struct" errstrCannotDecodeIntoNil = "cannot decode into nil" errmsgExpandSliceOverflow = "expand slice: slice overflow" errmsgExpandSliceCannotChange = "expand slice: cannot change" errDecoderNotInitialized = errors.New("Decoder not initialized") errDecUnreadByteNothingToRead = errors.New("cannot unread - nothing has been read") errDecUnreadByteLastByteNotRead = errors.New("cannot unread - last byte has not been read") errDecUnreadByteUnknown = errors.New("cannot unread - reason unknown") ) // decReader abstracts the reading source, allowing implementations that can // read from an io.Reader or directly off a byte slice with zero-copying. type decReader interface { unreadn1() // readx will use the implementation scratch buffer if possible i.e. n < len(scratchbuf), OR // just return a view of the []byte being decoded from. // Ensure you call detachZeroCopyBytes later if this needs to be sent outside codec control. readx(n int) []byte readb([]byte) readn1() uint8 numread() int // number of bytes read track() stopTrack() []byte // skip will skip any byte that matches, and return the first non-matching byte skip(accept *bitset256) (token byte) // readTo will read any byte that matches, stopping once no-longer matching. readTo(in []byte, accept *bitset256) (out []byte) // readUntil will read, only stopping once it matches the 'stop' byte. readUntil(in []byte, stop byte) (out []byte) } type decDriver interface { // this will check if the next token is a break. CheckBreak() bool // Note: TryDecodeAsNil should be careful not to share any temporary []byte with // the rest of the decDriver. This is because sometimes, we optimize by holding onto // a transient []byte, and ensuring the only other call we make to the decDriver // during that time is maybe a TryDecodeAsNil() call. TryDecodeAsNil() bool // vt is one of: Bytes, String, Nil, Slice or Map. Return unSet if not known. ContainerType() (vt valueType) // IsBuiltinType(rt uintptr) bool // DecodeNaked will decode primitives (number, bool, string, []byte) and RawExt. // For maps and arrays, it will not do the decoding in-band, but will signal // the decoder, so that is done later, by setting the decNaked.valueType field. // // Note: Numbers are decoded as int64, uint64, float64 only (no smaller sized number types). // for extensions, DecodeNaked must read the tag and the []byte if it exists. // if the []byte is not read, then kInterfaceNaked will treat it as a Handle // that stores the subsequent value in-band, and complete reading the RawExt. // // extensions should also use readx to decode them, for efficiency. // kInterface will extract the detached byte slice if it has to pass it outside its realm. DecodeNaked() // Deprecated: use DecodeInt64 and DecodeUint64 instead // DecodeInt(bitsize uint8) (i int64) // DecodeUint(bitsize uint8) (ui uint64) DecodeInt64() (i int64) DecodeUint64() (ui uint64) DecodeFloat64() (f float64) DecodeBool() (b bool) // DecodeString can also decode symbols. // It looks redundant as DecodeBytes is available. // However, some codecs (e.g. binc) support symbols and can // return a pre-stored string value, meaning that it can bypass // the cost of []byte->string conversion. DecodeString() (s string) DecodeStringAsBytes() (v []byte) // DecodeBytes may be called directly, without going through reflection. // Consequently, it must be designed to handle possible nil. DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) // DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) // decodeExt will decode into a *RawExt or into an extension. DecodeExt(v interface{}, xtag uint64, ext Ext) (realxtag uint64) // decodeExt(verifyTag bool, tag byte) (xtag byte, xbs []byte) DecodeTime() (t time.Time) ReadArrayStart() int ReadArrayElem() ReadArrayEnd() ReadMapStart() int ReadMapElemKey() ReadMapElemValue() ReadMapEnd() reset() uncacheRead() } type decDriverNoopContainerReader struct{} func (x decDriverNoopContainerReader) ReadArrayStart() (v int) { return } func (x decDriverNoopContainerReader) ReadArrayElem() {} func (x decDriverNoopContainerReader) ReadArrayEnd() {} func (x decDriverNoopContainerReader) ReadMapStart() (v int) { return } func (x decDriverNoopContainerReader) ReadMapElemKey() {} func (x decDriverNoopContainerReader) ReadMapElemValue() {} func (x decDriverNoopContainerReader) ReadMapEnd() {} func (x decDriverNoopContainerReader) CheckBreak() (v bool) { return } // func (x decNoSeparator) uncacheRead() {} // DecodeOptions captures configuration options during decode. type DecodeOptions struct { // MapType specifies type to use during schema-less decoding of a map in the stream. // If nil (unset), we default to map[string]interface{} iff json handle and MapStringAsKey=true, // else map[interface{}]interface{}. MapType reflect.Type // SliceType specifies type to use during schema-less decoding of an array in the stream. // If nil (unset), we default to []interface{} for all formats. SliceType reflect.Type // MaxInitLen defines the maxinum initial length that we "make" a collection // (string, slice, map, chan). If 0 or negative, we default to a sensible value // based on the size of an element in the collection. // // For example, when decoding, a stream may say that it has 2^64 elements. // We should not auto-matically provision a slice of that size, to prevent Out-Of-Memory crash. // Instead, we provision up to MaxInitLen, fill that up, and start appending after that. MaxInitLen int // ReaderBufferSize is the size of the buffer used when reading. // // if > 0, we use a smart buffer internally for performance purposes. ReaderBufferSize int // If ErrorIfNoField, return an error when decoding a map // from a codec stream into a struct, and no matching struct field is found. ErrorIfNoField bool // If ErrorIfNoArrayExpand, return an error when decoding a slice/array that cannot be expanded. // For example, the stream contains an array of 8 items, but you are decoding into a [4]T array, // or you are decoding into a slice of length 4 which is non-addressable (and so cannot be set). ErrorIfNoArrayExpand bool // If SignedInteger, use the int64 during schema-less decoding of unsigned values (not uint64). SignedInteger bool // MapValueReset controls how we decode into a map value. // // By default, we MAY retrieve the mapping for a key, and then decode into that. // However, especially with big maps, that retrieval may be expensive and unnecessary // if the stream already contains all that is necessary to recreate the value. // // If true, we will never retrieve the previous mapping, // but rather decode into a new value and set that in the map. // // If false, we will retrieve the previous mapping if necessary e.g. // the previous mapping is a pointer, or is a struct or array with pre-set state, // or is an interface. MapValueReset bool // SliceElementReset: on decoding a slice, reset the element to a zero value first. // // concern: if the slice already contained some garbage, we will decode into that garbage. SliceElementReset bool // InterfaceReset controls how we decode into an interface. // // By default, when we see a field that is an interface{...}, // or a map with interface{...} value, we will attempt decoding into the // "contained" value. // // However, this prevents us from reading a string into an interface{} // that formerly contained a number. // // If true, we will decode into a new "blank" value, and set that in the interface. // If false, we will decode into whatever is contained in the interface. InterfaceReset bool // InternString controls interning of strings during decoding. // // Some handles, e.g. json, typically will read map keys as strings. // If the set of keys are finite, it may help reduce allocation to // look them up from a map (than to allocate them afresh). // // Note: Handles will be smart when using the intern functionality. // Every string should not be interned. // An excellent use-case for interning is struct field names, // or map keys where key type is string. InternString bool // PreferArrayOverSlice controls whether to decode to an array or a slice. // // This only impacts decoding into a nil interface{}. // Consequently, it has no effect on codecgen. // // *Note*: This only applies if using go1.5 and above, // as it requires reflect.ArrayOf support which was absent before go1.5. PreferArrayOverSlice bool // DeleteOnNilMapValue controls how to decode a nil value in the stream. // // If true, we will delete the mapping of the key. // Else, just set the mapping to the zero value of the type. DeleteOnNilMapValue bool } // ------------------------------------ type bufioDecReader struct { buf []byte r io.Reader c int // cursor n int // num read err error tr []byte trb bool b [4]byte } func (z *bufioDecReader) reset(r io.Reader) { z.r, z.c, z.n, z.err, z.trb = r, 0, 0, nil, false if z.tr != nil { z.tr = z.tr[:0] } } func (z *bufioDecReader) Read(p []byte) (n int, err error) { if z.err != nil { return 0, z.err } p0 := p n = copy(p, z.buf[z.c:]) z.c += n if z.c == len(z.buf) { z.c = 0 } z.n += n if len(p) == n { if z.c == 0 { z.buf = z.buf[:1] z.buf[0] = p[len(p)-1] z.c = 1 } if z.trb { z.tr = append(z.tr, p0[:n]...) } return } p = p[n:] var n2 int // if we are here, then z.buf is all read if len(p) > len(z.buf) { n2, err = decReadFull(z.r, p) n += n2 z.n += n2 z.err = err // don't return EOF if some bytes were read. keep for next time. if n > 0 && err == io.EOF { err = nil } // always keep last byte in z.buf z.buf = z.buf[:1] z.buf[0] = p[len(p)-1] z.c = 1 if z.trb { z.tr = append(z.tr, p0[:n]...) } return } // z.c is now 0, and len(p) <= len(z.buf) for len(p) > 0 && z.err == nil { // println("len(p) loop starting ... ") z.c = 0 z.buf = z.buf[0:cap(z.buf)] n2, err = z.r.Read(z.buf) if n2 > 0 { if err == io.EOF { err = nil } z.buf = z.buf[:n2] n2 = copy(p, z.buf) z.c = n2 n += n2 z.n += n2 p = p[n2:] } z.err = err // println("... len(p) loop done") } if z.c == 0 { z.buf = z.buf[:1] z.buf[0] = p[len(p)-1] z.c = 1 } if z.trb { z.tr = append(z.tr, p0[:n]...) } return } func (z *bufioDecReader) ReadByte() (b byte, err error) { z.b[0] = 0 _, err = z.Read(z.b[:1]) b = z.b[0] return } func (z *bufioDecReader) UnreadByte() (err error) { if z.err != nil { return z.err } if z.c > 0 { z.c-- z.n-- if z.trb { z.tr = z.tr[:len(z.tr)-1] } return } return errDecUnreadByteNothingToRead } func (z *bufioDecReader) numread() int { return z.n } func (z *bufioDecReader) readx(n int) (bs []byte) { if n <= 0 || z.err != nil { return } if z.c+n <= len(z.buf) { bs = z.buf[z.c : z.c+n] z.n += n z.c += n if z.trb { z.tr = append(z.tr, bs...) } return } bs = make([]byte, n) _, err := z.Read(bs) if err != nil { panic(err) } return } func (z *bufioDecReader) readb(bs []byte) { _, err := z.Read(bs) if err != nil { panic(err) } } // func (z *bufioDecReader) readn1eof() (b uint8, eof bool) { // b, err := z.ReadByte() // if err != nil { // if err == io.EOF { // eof = true // } else { // panic(err) // } // } // return // } func (z *bufioDecReader) readn1() (b uint8) { b, err := z.ReadByte() if err != nil { panic(err) } return } func (z *bufioDecReader) search(in []byte, accept *bitset256, stop, flag uint8) (token byte, out []byte) { // flag: 1 (skip), 2 (readTo), 4 (readUntil) if flag == 4 { for i := z.c; i < len(z.buf); i++ { if z.buf[i] == stop { token = z.buf[i] z.n = z.n + (i - z.c) - 1 i++ out = z.buf[z.c:i] if z.trb { z.tr = append(z.tr, z.buf[z.c:i]...) } z.c = i return } } } else { for i := z.c; i < len(z.buf); i++ { if !accept.isset(z.buf[i]) { token = z.buf[i] z.n = z.n + (i - z.c) - 1 if flag == 1 { i++ } else { out = z.buf[z.c:i] } if z.trb { z.tr = append(z.tr, z.buf[z.c:i]...) } z.c = i return } } } z.n += len(z.buf) - z.c if flag != 1 { out = append(in, z.buf[z.c:]...) } if z.trb { z.tr = append(z.tr, z.buf[z.c:]...) } var n2 int if z.err != nil { return } for { z.c = 0 z.buf = z.buf[0:cap(z.buf)] n2, z.err = z.r.Read(z.buf) if n2 > 0 && z.err != nil { z.err = nil } z.buf = z.buf[:n2] if flag == 4 { for i := 0; i < n2; i++ { if z.buf[i] == stop { token = z.buf[i] z.n += i - 1 i++ out = append(out, z.buf[z.c:i]...) if z.trb { z.tr = append(z.tr, z.buf[z.c:i]...) } z.c = i return } } } else { for i := 0; i < n2; i++ { if !accept.isset(z.buf[i]) { token = z.buf[i] z.n += i - 1 if flag == 1 { i++ } if flag != 1 { out = append(out, z.buf[z.c:i]...) } if z.trb { z.tr = append(z.tr, z.buf[z.c:i]...) } z.c = i return } } } if flag != 1 { out = append(out, z.buf[:n2]...) } z.n += n2 if z.err != nil { return } if z.trb { z.tr = append(z.tr, z.buf[:n2]...) } } } func (z *bufioDecReader) skip(accept *bitset256) (token byte) { token, _ = z.search(nil, accept, 0, 1) return } func (z *bufioDecReader) readTo(in []byte, accept *bitset256) (out []byte) { _, out = z.search(in, accept, 0, 2) return } func (z *bufioDecReader) readUntil(in []byte, stop byte) (out []byte) { _, out = z.search(in, nil, stop, 4) return } func (z *bufioDecReader) unreadn1() { err := z.UnreadByte() if err != nil { panic(err) } } func (z *bufioDecReader) track() { if z.tr != nil { z.tr = z.tr[:0] } z.trb = true } func (z *bufioDecReader) stopTrack() (bs []byte) { z.trb = false return z.tr } // ioDecReader is a decReader that reads off an io.Reader. // // It also has a fallback implementation of ByteScanner if needed. type ioDecReader struct { r io.Reader // the reader passed in rr io.Reader br io.ByteScanner l byte // last byte ls byte // last byte status. 0: init-canDoNothing, 1: canRead, 2: canUnread trb bool // tracking bytes turned on _ bool b [4]byte // tiny buffer for reading single bytes x [scratchByteArrayLen]byte // for: get struct field name, swallow valueTypeBytes, etc n int // num read tr []byte // tracking bytes read } func (z *ioDecReader) reset(r io.Reader) { z.r = r z.rr = r z.l, z.ls, z.n, z.trb = 0, 0, 0, false if z.tr != nil { z.tr = z.tr[:0] } var ok bool if z.br, ok = r.(io.ByteScanner); !ok { z.br = z z.rr = z } } func (z *ioDecReader) Read(p []byte) (n int, err error) { if len(p) == 0 { return } var firstByte bool if z.ls == 1 { z.ls = 2 p[0] = z.l if len(p) == 1 { n = 1 return } firstByte = true p = p[1:] } n, err = z.r.Read(p) if n > 0 { if err == io.EOF && n == len(p) { err = nil // read was successful, so postpone EOF (till next time) } z.l = p[n-1] z.ls = 2 } if firstByte { n++ } return } func (z *ioDecReader) ReadByte() (c byte, err error) { n, err := z.Read(z.b[:1]) if n == 1 { c = z.b[0] if err == io.EOF { err = nil // read was successful, so postpone EOF (till next time) } } return } func (z *ioDecReader) UnreadByte() (err error) { switch z.ls { case 2: z.ls = 1 case 0: err = errDecUnreadByteNothingToRead case 1: err = errDecUnreadByteLastByteNotRead default: err = errDecUnreadByteUnknown } return } func (z *ioDecReader) numread() int { return z.n } func (z *ioDecReader) readx(n int) (bs []byte) { if n <= 0 { return } if n < len(z.x) { bs = z.x[:n] } else { bs = make([]byte, n) } if _, err := decReadFull(z.rr, bs); err != nil { panic(err) } z.n += len(bs) if z.trb { z.tr = append(z.tr, bs...) } return } func (z *ioDecReader) readb(bs []byte) { // if len(bs) == 0 { // return // } if _, err := decReadFull(z.rr, bs); err != nil { panic(err) } z.n += len(bs) if z.trb { z.tr = append(z.tr, bs...) } } func (z *ioDecReader) readn1eof() (b uint8, eof bool) { b, err := z.br.ReadByte() if err == nil { z.n++ if z.trb { z.tr = append(z.tr, b) } } else if err == io.EOF { eof = true } else { panic(err) } return } func (z *ioDecReader) readn1() (b uint8) { var err error if b, err = z.br.ReadByte(); err == nil { z.n++ if z.trb { z.tr = append(z.tr, b) } return } panic(err) } func (z *ioDecReader) skip(accept *bitset256) (token byte) { for { var eof bool token, eof = z.readn1eof() if eof { return } if accept.isset(token) { continue } return } } func (z *ioDecReader) readTo(in []byte, accept *bitset256) (out []byte) { out = in for { token, eof := z.readn1eof() if eof { return } if accept.isset(token) { out = append(out, token) } else { z.unreadn1() return } } } func (z *ioDecReader) readUntil(in []byte, stop byte) (out []byte) { out = in for { token, eof := z.readn1eof() if eof { panic(io.EOF) } out = append(out, token) if token == stop { return } } } func (z *ioDecReader) unreadn1() { err := z.br.UnreadByte() if err != nil { panic(err) } z.n-- if z.trb { if l := len(z.tr) - 1; l >= 0 { z.tr = z.tr[:l] } } } func (z *ioDecReader) track() { if z.tr != nil { z.tr = z.tr[:0] } z.trb = true } func (z *ioDecReader) stopTrack() (bs []byte) { z.trb = false return z.tr } // ------------------------------------ var errBytesDecReaderCannotUnread = errors.New("cannot unread last byte read") // bytesDecReader is a decReader that reads off a byte slice with zero copying type bytesDecReader struct { b []byte // data c int // cursor a int // available t int // track start } func (z *bytesDecReader) reset(in []byte) { z.b = in z.a = len(in) z.c = 0 z.t = 0 } func (z *bytesDecReader) numread() int { return z.c } func (z *bytesDecReader) unreadn1() { if z.c == 0 || len(z.b) == 0 { panic(errBytesDecReaderCannotUnread) } z.c-- z.a++ return } func (z *bytesDecReader) readx(n int) (bs []byte) { // slicing from a non-constant start position is more expensive, // as more computation is required to decipher the pointer start position. // However, we do it only once, and it's better than reslicing both z.b and return value. if n <= 0 { } else if z.a == 0 { panic(io.EOF) } else if n > z.a { panic(io.ErrUnexpectedEOF) } else { c0 := z.c z.c = c0 + n z.a = z.a - n bs = z.b[c0:z.c] } return } func (z *bytesDecReader) readb(bs []byte) { copy(bs, z.readx(len(bs))) } func (z *bytesDecReader) readn1() (v uint8) { if z.a == 0 { panic(io.EOF) } v = z.b[z.c] z.c++ z.a-- return } // func (z *bytesDecReader) readn1eof() (v uint8, eof bool) { // if z.a == 0 { // eof = true // return // } // v = z.b[z.c] // z.c++ // z.a-- // return // } func (z *bytesDecReader) skip(accept *bitset256) (token byte) { if z.a == 0 { return } blen := len(z.b) for i := z.c; i < blen; i++ { if !accept.isset(z.b[i]) { token = z.b[i] i++ z.a -= (i - z.c) z.c = i return } } z.a, z.c = 0, blen return } func (z *bytesDecReader) readTo(_ []byte, accept *bitset256) (out []byte) { if z.a == 0 { return } blen := len(z.b) for i := z.c; i < blen; i++ { if !accept.isset(z.b[i]) { out = z.b[z.c:i] z.a -= (i - z.c) z.c = i return } } out = z.b[z.c:] z.a, z.c = 0, blen return } func (z *bytesDecReader) readUntil(_ []byte, stop byte) (out []byte) { if z.a == 0 { panic(io.EOF) } blen := len(z.b) for i := z.c; i < blen; i++ { if z.b[i] == stop { i++ out = z.b[z.c:i] z.a -= (i - z.c) z.c = i return } } z.a, z.c = 0, blen panic(io.EOF) } func (z *bytesDecReader) track() { z.t = z.c } func (z *bytesDecReader) stopTrack() (bs []byte) { return z.b[z.t:z.c] } // ---------------------------------------- // func (d *Decoder) builtin(f *codecFnInfo, rv reflect.Value) { // d.d.DecodeBuiltin(f.ti.rtid, rv2i(rv)) // } func (d *Decoder) rawExt(f *codecFnInfo, rv reflect.Value) { d.d.DecodeExt(rv2i(rv), 0, nil) } func (d *Decoder) ext(f *codecFnInfo, rv reflect.Value) { d.d.DecodeExt(rv2i(rv), f.xfTag, f.xfFn) } func (d *Decoder) selferUnmarshal(f *codecFnInfo, rv reflect.Value) { rv2i(rv).(Selfer).CodecDecodeSelf(d) } func (d *Decoder) binaryUnmarshal(f *codecFnInfo, rv reflect.Value) { bm := rv2i(rv).(encoding.BinaryUnmarshaler) xbs := d.d.DecodeBytes(nil, true) if fnerr := bm.UnmarshalBinary(xbs); fnerr != nil { panic(fnerr) } } func (d *Decoder) textUnmarshal(f *codecFnInfo, rv reflect.Value) { tm := rv2i(rv).(encoding.TextUnmarshaler) fnerr := tm.UnmarshalText(d.d.DecodeStringAsBytes()) if fnerr != nil { panic(fnerr) } } func (d *Decoder) jsonUnmarshal(f *codecFnInfo, rv reflect.Value) { tm := rv2i(rv).(jsonUnmarshaler) // bs := d.d.DecodeBytes(d.b[:], true, true) // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. fnerr := tm.UnmarshalJSON(d.nextValueBytes()) if fnerr != nil { panic(fnerr) } } func (d *Decoder) kErr(f *codecFnInfo, rv reflect.Value) { d.errorf("no decoding function defined for kind %v", rv.Kind()) } // var kIntfCtr uint64 func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { // nil interface: // use some hieristics to decode it appropriately // based on the detected next value in the stream. n := d.naked() d.d.DecodeNaked() if n.v == valueTypeNil { return } // We cannot decode non-nil stream value into nil interface with methods (e.g. io.Reader). if f.ti.numMeth > 0 { d.errorf("cannot decode non-nil codec value into nil %v (%v methods)", f.ti.rt, f.ti.numMeth) return } // var useRvn bool switch n.v { case valueTypeMap: // if json, default to a map type with string keys mtid := d.mtid if mtid == 0 { if d.jsms { mtid = mapStrIntfTypId } else { mtid = mapIntfIntfTypId } } if mtid == mapIntfIntfTypId { n.initContainers() if n.lm < arrayCacheLen { n.ma[n.lm] = nil rvn = n.rma[n.lm] n.lm++ d.decode(&n.ma[n.lm-1]) n.lm-- } else { var v2 map[interface{}]interface{} d.decode(&v2) rvn = reflect.ValueOf(&v2).Elem() } } else if mtid == mapStrIntfTypId { // for json performance n.initContainers() if n.ln < arrayCacheLen { n.na[n.ln] = nil rvn = n.rna[n.ln] n.ln++ d.decode(&n.na[n.ln-1]) n.ln-- } else { var v2 map[string]interface{} d.decode(&v2) rvn = reflect.ValueOf(&v2).Elem() } } else { if d.mtr { rvn = reflect.New(d.h.MapType) d.decode(rv2i(rvn)) rvn = rvn.Elem() } else { rvn = reflect.New(d.h.MapType).Elem() d.decodeValue(rvn, nil, true) } } case valueTypeArray: if d.stid == 0 || d.stid == intfSliceTypId { n.initContainers() if n.ls < arrayCacheLen { n.sa[n.ls] = nil rvn = n.rsa[n.ls] n.ls++ d.decode(&n.sa[n.ls-1]) n.ls-- } else { var v2 []interface{} d.decode(&v2) rvn = reflect.ValueOf(&v2).Elem() } if reflectArrayOfSupported && d.stid == 0 && d.h.PreferArrayOverSlice { rvn2 := reflect.New(reflectArrayOf(rvn.Len(), intfTyp)).Elem() reflect.Copy(rvn2, rvn) rvn = rvn2 } } else { if d.str { rvn = reflect.New(d.h.SliceType) d.decode(rv2i(rvn)) rvn = rvn.Elem() } else { rvn = reflect.New(d.h.SliceType).Elem() d.decodeValue(rvn, nil, true) } } case valueTypeExt: var v interface{} tag, bytes := n.u, n.l // calling decode below might taint the values if bytes == nil { n.initContainers() if n.li < arrayCacheLen { n.ia[n.li] = nil n.li++ d.decode(&n.ia[n.li-1]) // v = *(&n.ia[l]) n.li-- v = n.ia[n.li] n.ia[n.li] = nil } else { d.decode(&v) } } bfn := d.h.getExtForTag(tag) if bfn == nil { var re RawExt re.Tag = tag re.Data = detachZeroCopyBytes(d.bytes, nil, bytes) re.Value = v rvn = reflect.ValueOf(&re).Elem() } else { rvnA := reflect.New(bfn.rt) if bytes != nil { bfn.ext.ReadExt(rv2i(rvnA), bytes) } else { bfn.ext.UpdateExt(rv2i(rvnA), v) } rvn = rvnA.Elem() } case valueTypeNil: // no-op case valueTypeInt: rvn = n.ri case valueTypeUint: rvn = n.ru case valueTypeFloat: rvn = n.rf case valueTypeBool: rvn = n.rb case valueTypeString, valueTypeSymbol: rvn = n.rs case valueTypeBytes: rvn = n.rl case valueTypeTime: rvn = n.rt default: panicv.errorf("kInterfaceNaked: unexpected valueType: %d", n.v) } return } func (d *Decoder) kInterface(f *codecFnInfo, rv reflect.Value) { // Note: // A consequence of how kInterface works, is that // if an interface already contains something, we try // to decode into what was there before. // We do not replace with a generic value (as got from decodeNaked). // every interface passed here MUST be settable. var rvn reflect.Value if rv.IsNil() || d.h.InterfaceReset { // check if mapping to a type: if so, initialize it and move on rvn = d.h.intf2impl(f.ti.rtid) if rvn.IsValid() { rv.Set(rvn) } else { rvn = d.kInterfaceNaked(f) if rvn.IsValid() { rv.Set(rvn) } else if d.h.InterfaceReset { // reset to zero value based on current type in there. rv.Set(reflect.Zero(rv.Elem().Type())) } return } } else { // now we have a non-nil interface value, meaning it contains a type rvn = rv.Elem() } if d.d.TryDecodeAsNil() { rv.Set(reflect.Zero(rvn.Type())) return } // Note: interface{} is settable, but underlying type may not be. // Consequently, we MAY have to create a decodable value out of the underlying value, // decode into it, and reset the interface itself. // fmt.Printf(">>>> kInterface: rvn type: %v, rv type: %v\n", rvn.Type(), rv.Type()) rvn2, canDecode := isDecodeable(rvn) if canDecode { d.decodeValue(rvn2, nil, true) return } rvn2 = reflect.New(rvn.Type()).Elem() rvn2.Set(rvn) d.decodeValue(rvn2, nil, true) rv.Set(rvn2) } func decStructFieldKey(dd decDriver, keyType valueType, b *[decScratchByteArrayLen]byte) (rvkencname []byte) { // use if-else-if, not switch (which compiles to binary-search) // since keyType is typically valueTypeString, branch prediction is pretty good. if keyType == valueTypeString { rvkencname = dd.DecodeStringAsBytes() } else if keyType == valueTypeInt { rvkencname = strconv.AppendInt(b[:0], dd.DecodeInt64(), 10) } else if keyType == valueTypeUint { rvkencname = strconv.AppendUint(b[:0], dd.DecodeUint64(), 10) } else if keyType == valueTypeFloat { rvkencname = strconv.AppendFloat(b[:0], dd.DecodeFloat64(), 'f', -1, 64) } else { rvkencname = dd.DecodeStringAsBytes() } return rvkencname } func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { fti := f.ti dd := d.d elemsep := d.esep sfn := structFieldNode{v: rv, update: true} ctyp := dd.ContainerType() if ctyp == valueTypeMap { containerLen := dd.ReadMapStart() if containerLen == 0 { dd.ReadMapEnd() return } tisfi := fti.sfiSort hasLen := containerLen >= 0 var rvkencname []byte for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { if elemsep { dd.ReadMapElemKey() } rvkencname = decStructFieldKey(dd, fti.keyType, &d.b) if elemsep { dd.ReadMapElemValue() } if k := fti.indexForEncName(rvkencname); k > -1 { si := tisfi[k] if dd.TryDecodeAsNil() { si.setToZeroValue(rv) } else { d.decodeValue(sfn.field(si), nil, true) } } else { d.structFieldNotFound(-1, stringView(rvkencname)) } // keepAlive4StringView(rvkencnameB) // not needed, as reference is outside loop } dd.ReadMapEnd() } else if ctyp == valueTypeArray { containerLen := dd.ReadArrayStart() if containerLen == 0 { dd.ReadArrayEnd() return } // Not much gain from doing it two ways for array. // Arrays are not used as much for structs. hasLen := containerLen >= 0 for j, si := range fti.sfiSrc { if (hasLen && j == containerLen) || (!hasLen && dd.CheckBreak()) { break } if elemsep { dd.ReadArrayElem() } if dd.TryDecodeAsNil() { si.setToZeroValue(rv) } else { d.decodeValue(sfn.field(si), nil, true) } } if containerLen > len(fti.sfiSrc) { // read remaining values and throw away for j := len(fti.sfiSrc); j < containerLen; j++ { if elemsep { dd.ReadArrayElem() } d.structFieldNotFound(j, "") } } dd.ReadArrayEnd() } else { d.errorstr(errstrOnlyMapOrArrayCanDecodeIntoStruct) return } } func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { // A slice can be set from a map or array in stream. // This way, the order can be kept (as order is lost with map). ti := f.ti if f.seq == seqTypeChan && ti.chandir&uint8(reflect.SendDir) == 0 { d.errorf("receive-only channel cannot be decoded") } dd := d.d rtelem0 := ti.elem ctyp := dd.ContainerType() if ctyp == valueTypeBytes || ctyp == valueTypeString { // you can only decode bytes or string in the stream into a slice or array of bytes if !(ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) { d.errorf("bytes/string in stream must decode into slice/array of bytes, not %v", ti.rt) } if f.seq == seqTypeChan { bs2 := dd.DecodeBytes(nil, true) irv := rv2i(rv) ch, ok := irv.(chan<- byte) if !ok { ch = irv.(chan byte) } for _, b := range bs2 { ch <- b } } else { rvbs := rv.Bytes() bs2 := dd.DecodeBytes(rvbs, false) // if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) { if !(len(bs2) > 0 && len(bs2) == len(rvbs) && &bs2[0] == &rvbs[0]) { if rv.CanSet() { rv.SetBytes(bs2) } else if len(rvbs) > 0 && len(bs2) > 0 { copy(rvbs, bs2) } } } return } // array := f.seq == seqTypeChan slh, containerLenS := d.decSliceHelperStart() // only expects valueType(Array|Map) // an array can never return a nil slice. so no need to check f.array here. if containerLenS == 0 { if rv.CanSet() { if f.seq == seqTypeSlice { if rv.IsNil() { rv.Set(reflect.MakeSlice(ti.rt, 0, 0)) } else { rv.SetLen(0) } } else if f.seq == seqTypeChan { if rv.IsNil() { rv.Set(reflect.MakeChan(ti.rt, 0)) } } } slh.End() return } rtelem0Size := int(rtelem0.Size()) rtElem0Kind := rtelem0.Kind() rtelem0Mut := !isImmutableKind(rtElem0Kind) rtelem := rtelem0 rtelemkind := rtelem.Kind() for rtelemkind == reflect.Ptr { rtelem = rtelem.Elem() rtelemkind = rtelem.Kind() } var fn *codecFn var rvCanset = rv.CanSet() var rvChanged bool var rv0 = rv var rv9 reflect.Value rvlen := rv.Len() rvcap := rv.Cap() hasLen := containerLenS > 0 if hasLen && f.seq == seqTypeSlice { if containerLenS > rvcap { oldRvlenGtZero := rvlen > 0 rvlen = decInferLen(containerLenS, d.h.MaxInitLen, int(rtelem0.Size())) if rvlen <= rvcap { if rvCanset { rv.SetLen(rvlen) } } else if rvCanset { rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) rvcap = rvlen rvChanged = true } else { d.errorf("cannot decode into non-settable slice") } if rvChanged && oldRvlenGtZero && !isImmutableKind(rtelem0.Kind()) { reflect.Copy(rv, rv0) // only copy up to length NOT cap i.e. rv0.Slice(0, rvcap) } } else if containerLenS != rvlen { rvlen = containerLenS if rvCanset { rv.SetLen(rvlen) } // else { // rv = rv.Slice(0, rvlen) // rvChanged = true // d.errorf("cannot decode into non-settable slice") // } } } // consider creating new element once, and just decoding into it. var rtelem0Zero reflect.Value var rtelem0ZeroValid bool var decodeAsNil bool var j int d.cfer() for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { if j == 0 && (f.seq == seqTypeSlice || f.seq == seqTypeChan) && rv.IsNil() { if hasLen { rvlen = decInferLen(containerLenS, d.h.MaxInitLen, rtelem0Size) } else if f.seq == seqTypeSlice { rvlen = decDefSliceCap } else { rvlen = decDefChanCap } if rvCanset { if f.seq == seqTypeSlice { rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) rvChanged = true } else { // chan // xdebugf(">>>>>> haslen = %v, make chan of type '%v' with length: %v", hasLen, ti.rt, rvlen) rv = reflect.MakeChan(ti.rt, rvlen) rvChanged = true } } else { d.errorf("cannot decode into non-settable slice") } } slh.ElemContainerState(j) decodeAsNil = dd.TryDecodeAsNil() if f.seq == seqTypeChan { if decodeAsNil { rv.Send(reflect.Zero(rtelem0)) continue } if rtelem0Mut || !rv9.IsValid() { // || (rtElem0Kind == reflect.Ptr && rv9.IsNil()) { rv9 = reflect.New(rtelem0).Elem() } if fn == nil { fn = d.cf.get(rtelem, true, true) } d.decodeValue(rv9, fn, true) // xdebugf(">>>> rv9 sent on %v during decode: %v, with len=%v, cap=%v", rv.Type(), rv9, rv.Len(), rv.Cap()) rv.Send(rv9) } else { // if indefinite, etc, then expand the slice if necessary var decodeIntoBlank bool if j >= rvlen { if f.seq == seqTypeArray { d.arrayCannotExpand(rvlen, j+1) decodeIntoBlank = true } else { // if f.seq == seqTypeSlice // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // append logic + varargs var rvcap2 int var rvErrmsg2 string rv9, rvcap2, rvChanged, rvErrmsg2 = expandSliceRV(rv, ti.rt, rvCanset, rtelem0Size, 1, rvlen, rvcap) if rvErrmsg2 != "" { d.errorf(rvErrmsg2) } rvlen++ if rvChanged { rv = rv9 rvcap = rvcap2 } } } if decodeIntoBlank { if !decodeAsNil { d.swallow() } } else { rv9 = rv.Index(j) if d.h.SliceElementReset || decodeAsNil { if !rtelem0ZeroValid { rtelem0ZeroValid = true rtelem0Zero = reflect.Zero(rtelem0) } rv9.Set(rtelem0Zero) } if decodeAsNil { continue } if fn == nil { fn = d.cf.get(rtelem, true, true) } d.decodeValue(rv9, fn, true) } } } if f.seq == seqTypeSlice { if j < rvlen { if rv.CanSet() { rv.SetLen(j) } else if rvCanset { rv = rv.Slice(0, j) rvChanged = true } // else { d.errorf("kSlice: cannot change non-settable slice") } rvlen = j } else if j == 0 && rv.IsNil() { if rvCanset { rv = reflect.MakeSlice(ti.rt, 0, 0) rvChanged = true } // else { d.errorf("kSlice: cannot change non-settable slice") } } } slh.End() if rvChanged { // infers rvCanset=true, so it can be reset rv0.Set(rv) } } // func (d *Decoder) kArray(f *codecFnInfo, rv reflect.Value) { // // d.decodeValueFn(rv.Slice(0, rv.Len())) // f.kSlice(rv.Slice(0, rv.Len())) // } func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { dd := d.d containerLen := dd.ReadMapStart() elemsep := d.esep ti := f.ti if rv.IsNil() { rv.Set(makeMapReflect(ti.rt, containerLen)) } if containerLen == 0 { dd.ReadMapEnd() return } ktype, vtype := ti.key, ti.elem ktypeId := rt2id(ktype) vtypeKind := vtype.Kind() var keyFn, valFn *codecFn var ktypeLo, vtypeLo reflect.Type for ktypeLo = ktype; ktypeLo.Kind() == reflect.Ptr; ktypeLo = ktypeLo.Elem() { } for vtypeLo = vtype; vtypeLo.Kind() == reflect.Ptr; vtypeLo = vtypeLo.Elem() { } var mapGet, mapSet bool rvvImmut := isImmutableKind(vtypeKind) if !d.h.MapValueReset { // if pointer, mapGet = true // if interface, mapGet = true if !DecodeNakedAlways (else false) // if builtin, mapGet = false // else mapGet = true if vtypeKind == reflect.Ptr { mapGet = true } else if vtypeKind == reflect.Interface { if !d.h.InterfaceReset { mapGet = true } } else if !rvvImmut { mapGet = true } } var rvk, rvkp, rvv, rvz reflect.Value rvkMut := !isImmutableKind(ktype.Kind()) // if ktype is immutable, then re-use the same rvk. ktypeIsString := ktypeId == stringTypId ktypeIsIntf := ktypeId == intfTypId hasLen := containerLen > 0 var kstrbs []byte d.cfer() for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { if rvkMut || !rvkp.IsValid() { rvkp = reflect.New(ktype) rvk = rvkp.Elem() } if elemsep { dd.ReadMapElemKey() } if false && dd.TryDecodeAsNil() { // nil cannot be a map key, so disregard this block // Previously, if a nil key, we just ignored the mapped value and continued. // However, that makes the result of encoding and then decoding map[intf]intf{nil:nil} // to be an empty map. // Instead, we treat a nil key as the zero value of the type. rvk.Set(reflect.Zero(ktype)) } else if ktypeIsString { kstrbs = dd.DecodeStringAsBytes() rvk.SetString(stringView(kstrbs)) // NOTE: if doing an insert, you MUST use a real string (not stringview) } else { if keyFn == nil { keyFn = d.cf.get(ktypeLo, true, true) } d.decodeValue(rvk, keyFn, true) } // special case if a byte array. if ktypeIsIntf { if rvk2 := rvk.Elem(); rvk2.IsValid() { if rvk2.Type() == uint8SliceTyp { rvk = reflect.ValueOf(d.string(rvk2.Bytes())) } else { rvk = rvk2 } } } if elemsep { dd.ReadMapElemValue() } // Brittle, but OK per TryDecodeAsNil() contract. // i.e. TryDecodeAsNil never shares slices with other decDriver procedures if dd.TryDecodeAsNil() { if ktypeIsString { rvk.SetString(d.string(kstrbs)) } if d.h.DeleteOnNilMapValue { rv.SetMapIndex(rvk, reflect.Value{}) } else { rv.SetMapIndex(rvk, reflect.Zero(vtype)) } continue } mapSet = true // set to false if u do a get, and its a non-nil pointer if mapGet { // mapGet true only in case where kind=Ptr|Interface or kind is otherwise mutable. rvv = rv.MapIndex(rvk) if !rvv.IsValid() { rvv = reflect.New(vtype).Elem() } else if vtypeKind == reflect.Ptr { if rvv.IsNil() { rvv = reflect.New(vtype).Elem() } else { mapSet = false } } else if vtypeKind == reflect.Interface { // not addressable, and thus not settable. // e MUST create a settable/addressable variant rvv2 := reflect.New(rvv.Type()).Elem() if !rvv.IsNil() { rvv2.Set(rvv) } rvv = rvv2 } // else it is ~mutable, and we can just decode into it directly } else if rvvImmut { if !rvz.IsValid() { rvz = reflect.New(vtype).Elem() } rvv = rvz } else { rvv = reflect.New(vtype).Elem() } // We MUST be done with the stringview of the key, before decoding the value // so that we don't bastardize the reused byte array. if mapSet && ktypeIsString { rvk.SetString(d.string(kstrbs)) } if valFn == nil { valFn = d.cf.get(vtypeLo, true, true) } d.decodeValue(rvv, valFn, true) // d.decodeValueFn(rvv, valFn) if mapSet { rv.SetMapIndex(rvk, rvv) } // if ktypeIsString { // // keepAlive4StringView(kstrbs) // not needed, as reference is outside loop // } } dd.ReadMapEnd() } // decNaked is used to keep track of the primitives decoded. // Without it, we would have to decode each primitive and wrap it // in an interface{}, causing an allocation. // In this model, the primitives are decoded in a "pseudo-atomic" fashion, // so we can rest assured that no other decoding happens while these // primitives are being decoded. // // maps and arrays are not handled by this mechanism. // However, RawExt is, and we accommodate for extensions that decode // RawExt from DecodeNaked, but need to decode the value subsequently. // kInterfaceNaked and swallow, which call DecodeNaked, handle this caveat. // // However, decNaked also keeps some arrays of default maps and slices // used in DecodeNaked. This way, we can get a pointer to it // without causing a new heap allocation. // // kInterfaceNaked will ensure that there is no allocation for the common // uses. type decNakedContainers struct { // array/stacks for reducing allocation // keep arrays at the bottom? Chance is that they are not used much. ia [arrayCacheLen]interface{} ma [arrayCacheLen]map[interface{}]interface{} na [arrayCacheLen]map[string]interface{} sa [arrayCacheLen][]interface{} // ria [arrayCacheLen]reflect.Value // not needed, as we decode directly into &ia[n] rma, rna, rsa [arrayCacheLen]reflect.Value // reflect.Value mapping to above } func (n *decNakedContainers) init() { for i := 0; i < arrayCacheLen; i++ { // n.ria[i] = reflect.ValueOf(&(n.ia[i])).Elem() n.rma[i] = reflect.ValueOf(&(n.ma[i])).Elem() n.rna[i] = reflect.ValueOf(&(n.na[i])).Elem() n.rsa[i] = reflect.ValueOf(&(n.sa[i])).Elem() } } type decNaked struct { // r RawExt // used for RawExt, uint, []byte. // primitives below u uint64 i int64 f float64 l []byte s string // ---- cpu cache line boundary? t time.Time b bool // state v valueType li, lm, ln, ls int8 inited bool *decNakedContainers ru, ri, rf, rl, rs, rb, rt reflect.Value // mapping to the primitives above // _ [6]uint64 // padding // no padding - rt goes into next cache line } func (n *decNaked) init() { if n.inited { return } n.ru = reflect.ValueOf(&n.u).Elem() n.ri = reflect.ValueOf(&n.i).Elem() n.rf = reflect.ValueOf(&n.f).Elem() n.rl = reflect.ValueOf(&n.l).Elem() n.rs = reflect.ValueOf(&n.s).Elem() n.rt = reflect.ValueOf(&n.t).Elem() n.rb = reflect.ValueOf(&n.b).Elem() n.inited = true // n.rr[] = reflect.ValueOf(&n.) } func (n *decNaked) initContainers() { if n.decNakedContainers == nil { n.decNakedContainers = new(decNakedContainers) n.decNakedContainers.init() } } func (n *decNaked) reset() { if n == nil { return } n.li, n.lm, n.ln, n.ls = 0, 0, 0, 0 } type rtid2rv struct { rtid uintptr rv reflect.Value } // -------------- type decReaderSwitch struct { rb bytesDecReader // ---- cpu cache line boundary? ri *ioDecReader mtr, str bool // whether maptype or slicetype are known types be bool // is binary encoding bytes bool // is bytes reader js bool // is json handle jsms bool // is json handle, and MapKeyAsString esep bool // has elem separators } // TODO: Uncomment after mid-stack inlining enabled in go 1.11 // // func (z *decReaderSwitch) unreadn1() { // if z.bytes { // z.rb.unreadn1() // } else { // z.ri.unreadn1() // } // } // func (z *decReaderSwitch) readx(n int) []byte { // if z.bytes { // return z.rb.readx(n) // } // return z.ri.readx(n) // } // func (z *decReaderSwitch) readb(s []byte) { // if z.bytes { // z.rb.readb(s) // } else { // z.ri.readb(s) // } // } // func (z *decReaderSwitch) readn1() uint8 { // if z.bytes { // return z.rb.readn1() // } // return z.ri.readn1() // } // func (z *decReaderSwitch) numread() int { // if z.bytes { // return z.rb.numread() // } // return z.ri.numread() // } // func (z *decReaderSwitch) track() { // if z.bytes { // z.rb.track() // } else { // z.ri.track() // } // } // func (z *decReaderSwitch) stopTrack() []byte { // if z.bytes { // return z.rb.stopTrack() // } // return z.ri.stopTrack() // } // func (z *decReaderSwitch) skip(accept *bitset256) (token byte) { // if z.bytes { // return z.rb.skip(accept) // } // return z.ri.skip(accept) // } // func (z *decReaderSwitch) readTo(in []byte, accept *bitset256) (out []byte) { // if z.bytes { // return z.rb.readTo(in, accept) // } // return z.ri.readTo(in, accept) // } // func (z *decReaderSwitch) readUntil(in []byte, stop byte) (out []byte) { // if z.bytes { // return z.rb.readUntil(in, stop) // } // return z.ri.readUntil(in, stop) // } // A Decoder reads and decodes an object from an input stream in the codec format. type Decoder struct { panicHdl // hopefully, reduce derefencing cost by laying the decReader inside the Decoder. // Try to put things that go together to fit within a cache line (8 words). d decDriver // NOTE: Decoder shouldn't call it's read methods, // as the handler MAY need to do some coordination. r decReader h *BasicHandle bi *bufioDecReader // cache the mapTypeId and sliceTypeId for faster comparisons mtid uintptr stid uintptr // ---- cpu cache line boundary? decReaderSwitch // ---- cpu cache line boundary? codecFnPooler // cr containerStateRecv n *decNaked nsp *sync.Pool err error // ---- cpu cache line boundary? b [decScratchByteArrayLen]byte // scratch buffer, used by Decoder and xxxEncDrivers is map[string]string // used for interning strings // padding - false sharing help // modify 232 if Decoder struct changes. // _ [cacheLineSize - 232%cacheLineSize]byte } // NewDecoder returns a Decoder for decoding a stream of bytes from an io.Reader. // // For efficiency, Users are encouraged to pass in a memory buffered reader // (eg bufio.Reader, bytes.Buffer). func NewDecoder(r io.Reader, h Handle) *Decoder { d := newDecoder(h) d.Reset(r) return d } // NewDecoderBytes returns a Decoder which efficiently decodes directly // from a byte slice with zero copying. func NewDecoderBytes(in []byte, h Handle) *Decoder { d := newDecoder(h) d.ResetBytes(in) return d } var defaultDecNaked decNaked func newDecoder(h Handle) *Decoder { d := &Decoder{h: h.getBasicHandle(), err: errDecoderNotInitialized} d.hh = h d.be = h.isBinary() // NOTE: do not initialize d.n here. It is lazily initialized in d.naked() var jh *JsonHandle jh, d.js = h.(*JsonHandle) if d.js { d.jsms = jh.MapKeyAsString } d.esep = d.hh.hasElemSeparators() if d.h.InternString { d.is = make(map[string]string, 32) } d.d = h.newDecDriver(d) // d.cr, _ = d.d.(containerStateRecv) return d } func (d *Decoder) resetCommon() { d.n.reset() d.d.reset() d.err = nil // reset all things which were cached from the Handle, but could change d.mtid, d.stid = 0, 0 d.mtr, d.str = false, false if d.h.MapType != nil { d.mtid = rt2id(d.h.MapType) d.mtr = fastpathAV.index(d.mtid) != -1 } if d.h.SliceType != nil { d.stid = rt2id(d.h.SliceType) d.str = fastpathAV.index(d.stid) != -1 } } // Reset the Decoder with a new Reader to decode from, // clearing all state from last run(s). func (d *Decoder) Reset(r io.Reader) { if r == nil { return } if d.bi == nil { d.bi = new(bufioDecReader) } d.bytes = false if d.h.ReaderBufferSize > 0 { d.bi.buf = make([]byte, 0, d.h.ReaderBufferSize) d.bi.reset(r) d.r = d.bi } else { // d.ri.x = &d.b // d.s = d.sa[:0] if d.ri == nil { d.ri = new(ioDecReader) } d.ri.reset(r) d.r = d.ri } d.resetCommon() } // ResetBytes resets the Decoder with a new []byte to decode from, // clearing all state from last run(s). func (d *Decoder) ResetBytes(in []byte) { if in == nil { return } d.bytes = true d.rb.reset(in) d.r = &d.rb d.resetCommon() } // naked must be called before each call to .DecodeNaked, // as they will use it. func (d *Decoder) naked() *decNaked { if d.n == nil { // consider one of: // - get from sync.Pool (if GC is frequent, there's no value here) // - new alloc (safest. only init'ed if it a naked decode will be done) // - field in Decoder (makes the Decoder struct very big) // To support using a decoder where a DecodeNaked is not needed, // we prefer #1 or #2. // d.n = new(decNaked) // &d.nv // new(decNaked) // grab from a sync.Pool // d.n.init() var v interface{} d.nsp, v = pool.decNaked() d.n = v.(*decNaked) } return d.n } // Decode decodes the stream from reader and stores the result in the // value pointed to by v. v cannot be a nil pointer. v can also be // a reflect.Value of a pointer. // // Note that a pointer to a nil interface is not a nil pointer. // If you do not know what type of stream it is, pass in a pointer to a nil interface. // We will decode and store a value in that nil interface. // // Sample usages: // // Decoding into a non-nil typed value // var f float32 // err = codec.NewDecoder(r, handle).Decode(&f) // // // Decoding into nil interface // var v interface{} // dec := codec.NewDecoder(r, handle) // err = dec.Decode(&v) // // When decoding into a nil interface{}, we will decode into an appropriate value based // on the contents of the stream: // - Numbers are decoded as float64, int64 or uint64. // - Other values are decoded appropriately depending on the type: // bool, string, []byte, time.Time, etc // - Extensions are decoded as RawExt (if no ext function registered for the tag) // Configurations exist on the Handle to override defaults // (e.g. for MapType, SliceType and how to decode raw bytes). // // When decoding into a non-nil interface{} value, the mode of encoding is based on the // type of the value. When a value is seen: // - If an extension is registered for it, call that extension function // - If it implements BinaryUnmarshaler, call its UnmarshalBinary(data []byte) error // - Else decode it based on its reflect.Kind // // There are some special rules when decoding into containers (slice/array/map/struct). // Decode will typically use the stream contents to UPDATE the container. // - A map can be decoded from a stream map, by updating matching keys. // - A slice can be decoded from a stream array, // by updating the first n elements, where n is length of the stream. // - A slice can be decoded from a stream map, by decoding as if // it contains a sequence of key-value pairs. // - A struct can be decoded from a stream map, by updating matching fields. // - A struct can be decoded from a stream array, // by updating fields as they occur in the struct (by index). // // When decoding a stream map or array with length of 0 into a nil map or slice, // we reset the destination map or slice to a zero-length value. // // However, when decoding a stream nil, we reset the destination container // to its "zero" value (e.g. nil for slice/map, etc). // // Note: we allow nil values in the stream anywhere except for map keys. // A nil value in the encoded stream where a map key is expected is treated as an error. func (d *Decoder) Decode(v interface{}) (err error) { defer d.deferred(&err) d.MustDecode(v) return } // MustDecode is like Decode, but panics if unable to Decode. // This provides insight to the code location that triggered the error. func (d *Decoder) MustDecode(v interface{}) { // TODO: Top-level: ensure that v is a pointer and not nil. if d.err != nil { panic(d.err) } if d.d.TryDecodeAsNil() { setZero(v) } else { d.decode(v) } d.alwaysAtEnd() // xprintf(">>>>>>>> >>>>>>>> num decFns: %v\n", d.cf.sn) } func (d *Decoder) deferred(err1 *error) { d.alwaysAtEnd() if recoverPanicToErr { if x := recover(); x != nil { panicValToErr(d, x, err1) panicValToErr(d, x, &d.err) } } } func (d *Decoder) alwaysAtEnd() { if d.n != nil { // if n != nil, then nsp != nil (they are always set together) d.nsp.Put(d.n) d.n, d.nsp = nil, nil } d.codecFnPooler.alwaysAtEnd() } // // this is not a smart swallow, as it allocates objects and does unnecessary work. // func (d *Decoder) swallowViaHammer() { // var blank interface{} // d.decodeValueNoFn(reflect.ValueOf(&blank).Elem()) // } func (d *Decoder) swallow() { // smarter decode that just swallows the content dd := d.d if dd.TryDecodeAsNil() { return } elemsep := d.esep switch dd.ContainerType() { case valueTypeMap: containerLen := dd.ReadMapStart() hasLen := containerLen >= 0 for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { // if clenGtEqualZero {if j >= containerLen {break} } else if dd.CheckBreak() {break} if elemsep { dd.ReadMapElemKey() } d.swallow() if elemsep { dd.ReadMapElemValue() } d.swallow() } dd.ReadMapEnd() case valueTypeArray: containerLen := dd.ReadArrayStart() hasLen := containerLen >= 0 for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { if elemsep { dd.ReadArrayElem() } d.swallow() } dd.ReadArrayEnd() case valueTypeBytes: dd.DecodeBytes(d.b[:], true) case valueTypeString: dd.DecodeStringAsBytes() default: // these are all primitives, which we can get from decodeNaked // if RawExt using Value, complete the processing. n := d.naked() dd.DecodeNaked() if n.v == valueTypeExt && n.l == nil { n.initContainers() if n.li < arrayCacheLen { n.ia[n.li] = nil n.li++ d.decode(&n.ia[n.li-1]) n.ia[n.li-1] = nil n.li-- } else { var v2 interface{} d.decode(&v2) } } } } func setZero(iv interface{}) { if iv == nil || definitelyNil(iv) { return } var canDecode bool switch v := iv.(type) { case *string: *v = "" case *bool: *v = false case *int: *v = 0 case *int8: *v = 0 case *int16: *v = 0 case *int32: *v = 0 case *int64: *v = 0 case *uint: *v = 0 case *uint8: *v = 0 case *uint16: *v = 0 case *uint32: *v = 0 case *uint64: *v = 0 case *float32: *v = 0 case *float64: *v = 0 case *[]uint8: *v = nil case *Raw: *v = nil case *time.Time: *v = time.Time{} case reflect.Value: if v, canDecode = isDecodeable(v); canDecode && v.CanSet() { v.Set(reflect.Zero(v.Type())) } // TODO: else drain if chan, clear if map, set all to nil if slice??? default: if !fastpathDecodeSetZeroTypeSwitch(iv) { v := reflect.ValueOf(iv) if v, canDecode = isDecodeable(v); canDecode && v.CanSet() { v.Set(reflect.Zero(v.Type())) } // TODO: else drain if chan, clear if map, set all to nil if slice??? } } } func (d *Decoder) decode(iv interface{}) { // check nil and interfaces explicitly, // so that type switches just have a run of constant non-interface types. if iv == nil { d.errorstr(errstrCannotDecodeIntoNil) return } if v, ok := iv.(Selfer); ok { v.CodecDecodeSelf(d) return } switch v := iv.(type) { // case nil: // case Selfer: case reflect.Value: v = d.ensureDecodeable(v) d.decodeValue(v, nil, true) case *string: *v = d.d.DecodeString() case *bool: *v = d.d.DecodeBool() case *int: *v = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) case *int8: *v = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) case *int16: *v = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) case *int32: *v = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) case *int64: *v = d.d.DecodeInt64() case *uint: *v = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) case *uint8: *v = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) case *uint16: *v = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) case *uint32: *v = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) case *uint64: *v = d.d.DecodeUint64() case *float32: f64 := d.d.DecodeFloat64() if chkOvf.Float32(f64) { d.errorf("float32 overflow: %v", f64) } *v = float32(f64) case *float64: *v = d.d.DecodeFloat64() case *[]uint8: *v = d.d.DecodeBytes(*v, false) case []uint8: b := d.d.DecodeBytes(v, false) if !(len(b) > 0 && len(b) == len(v) && &b[0] == &v[0]) { copy(v, b) } case *time.Time: *v = d.d.DecodeTime() case *Raw: *v = d.rawBytes() case *interface{}: d.decodeValue(reflect.ValueOf(iv).Elem(), nil, true) // d.decodeValueNotNil(reflect.ValueOf(iv).Elem()) default: if !fastpathDecodeTypeSwitch(iv, d) { v := reflect.ValueOf(iv) v = d.ensureDecodeable(v) d.decodeValue(v, nil, false) // d.decodeValueFallback(v) } } } func (d *Decoder) decodeValue(rv reflect.Value, fn *codecFn, chkAll bool) { // If stream is not containing a nil value, then we can deref to the base // non-pointer value, and decode into that. var rvp reflect.Value var rvpValid bool if rv.Kind() == reflect.Ptr { rvpValid = true for { if rv.IsNil() { rv.Set(reflect.New(rv.Type().Elem())) } rvp = rv rv = rv.Elem() if rv.Kind() != reflect.Ptr { break } } } if fn == nil { // always pass checkCodecSelfer=true, in case T or ****T is passed, where *T is a Selfer fn = d.cfer().get(rv.Type(), chkAll, true) // chkAll, chkAll) } if fn.i.addrD { if rvpValid { fn.fd(d, &fn.i, rvp) } else if rv.CanAddr() { fn.fd(d, &fn.i, rv.Addr()) } else if !fn.i.addrF { fn.fd(d, &fn.i, rv) } else { d.errorf("cannot decode into a non-pointer value") } } else { fn.fd(d, &fn.i, rv) } // return rv } func (d *Decoder) structFieldNotFound(index int, rvkencname string) { // NOTE: rvkencname may be a stringView, so don't pass it to another function. if d.h.ErrorIfNoField { if index >= 0 { d.errorf("no matching struct field found when decoding stream array at index %v", index) return } else if rvkencname != "" { d.errorf("no matching struct field found when decoding stream map with key " + rvkencname) return } } d.swallow() } func (d *Decoder) arrayCannotExpand(sliceLen, streamLen int) { if d.h.ErrorIfNoArrayExpand { d.errorf("cannot expand array len during decode from %v to %v", sliceLen, streamLen) } } func isDecodeable(rv reflect.Value) (rv2 reflect.Value, canDecode bool) { switch rv.Kind() { case reflect.Array: return rv, true case reflect.Ptr: if !rv.IsNil() { return rv.Elem(), true } case reflect.Slice, reflect.Chan, reflect.Map: if !rv.IsNil() { return rv, true } } return } func (d *Decoder) ensureDecodeable(rv reflect.Value) (rv2 reflect.Value) { // decode can take any reflect.Value that is a inherently addressable i.e. // - array // - non-nil chan (we will SEND to it) // - non-nil slice (we will set its elements) // - non-nil map (we will put into it) // - non-nil pointer (we can "update" it) rv2, canDecode := isDecodeable(rv) if canDecode { return } if !rv.IsValid() { d.errorstr(errstrCannotDecodeIntoNil) return } if !rv.CanInterface() { d.errorf("cannot decode into a value without an interface: %v", rv) return } rvi := rv2i(rv) rvk := rv.Kind() d.errorf("cannot decode into value of kind: %v, type: %T, %v", rvk, rvi, rvi) return } // Possibly get an interned version of a string // // This should mostly be used for map keys, where the key type is string. // This is because keys of a map/struct are typically reused across many objects. func (d *Decoder) string(v []byte) (s string) { if d.is == nil { return string(v) // don't return stringView, as we need a real string here. } s, ok := d.is[string(v)] // no allocation here, per go implementation if !ok { s = string(v) // new allocation here d.is[s] = s } return s } // nextValueBytes returns the next value in the stream as a set of bytes. func (d *Decoder) nextValueBytes() (bs []byte) { d.d.uncacheRead() d.r.track() d.swallow() bs = d.r.stopTrack() return } func (d *Decoder) rawBytes() []byte { // ensure that this is not a view into the bytes // i.e. make new copy always. bs := d.nextValueBytes() bs2 := make([]byte, len(bs)) copy(bs2, bs) return bs2 } func (d *Decoder) wrapErrstr(v interface{}, err *error) { *err = fmt.Errorf("%s decode error [pos %d]: %v", d.hh.Name(), d.r.numread(), v) } // -------------------------------------------------- // decSliceHelper assists when decoding into a slice, from a map or an array in the stream. // A slice can be set from a map or array in stream. This supports the MapBySlice interface. type decSliceHelper struct { d *Decoder // ct valueType array bool } func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) { dd := d.d ctyp := dd.ContainerType() switch ctyp { case valueTypeArray: x.array = true clen = dd.ReadArrayStart() case valueTypeMap: clen = dd.ReadMapStart() * 2 default: d.errorf("only encoded map or array can be decoded into a slice (%d)", ctyp) } // x.ct = ctyp x.d = d return } func (x decSliceHelper) End() { if x.array { x.d.d.ReadArrayEnd() } else { x.d.d.ReadMapEnd() } } func (x decSliceHelper) ElemContainerState(index int) { if x.array { x.d.d.ReadArrayElem() } else if index%2 == 0 { x.d.d.ReadMapElemKey() } else { x.d.d.ReadMapElemValue() } } func decByteSlice(r decReader, clen, maxInitLen int, bs []byte) (bsOut []byte) { if clen == 0 { return zeroByteSlice } if len(bs) == clen { bsOut = bs r.readb(bsOut) } else if cap(bs) >= clen { bsOut = bs[:clen] r.readb(bsOut) } else { // bsOut = make([]byte, clen) len2 := decInferLen(clen, maxInitLen, 1) bsOut = make([]byte, len2) r.readb(bsOut) for len2 < clen { len3 := decInferLen(clen-len2, maxInitLen, 1) bs3 := bsOut bsOut = make([]byte, len2+len3) copy(bsOut, bs3) r.readb(bsOut[len2:]) len2 += len3 } } return } func detachZeroCopyBytes(isBytesReader bool, dest []byte, in []byte) (out []byte) { if xlen := len(in); xlen > 0 { if isBytesReader || xlen <= scratchByteArrayLen { if cap(dest) >= xlen { out = dest[:xlen] } else { out = make([]byte, xlen) } copy(out, in) return } } return in } // decInferLen will infer a sensible length, given the following: // - clen: length wanted. // - maxlen: max length to be returned. // if <= 0, it is unset, and we infer it based on the unit size // - unit: number of bytes for each element of the collection func decInferLen(clen, maxlen, unit int) (rvlen int) { // handle when maxlen is not set i.e. <= 0 if clen <= 0 { return } if unit == 0 { return clen } if maxlen <= 0 { // no maxlen defined. Use maximum of 256K memory, with a floor of 4K items. // maxlen = 256 * 1024 / unit // if maxlen < (4 * 1024) { // maxlen = 4 * 1024 // } if unit < (256 / 4) { maxlen = 256 * 1024 / unit } else { maxlen = 4 * 1024 } } if clen > maxlen { rvlen = maxlen } else { rvlen = clen } return } func expandSliceRV(s reflect.Value, st reflect.Type, canChange bool, stElemSize, num, slen, scap int) ( s2 reflect.Value, scap2 int, changed bool, err string) { l1 := slen + num // new slice length if l1 < slen { err = errmsgExpandSliceOverflow return } if l1 <= scap { if s.CanSet() { s.SetLen(l1) } else if canChange { s2 = s.Slice(0, l1) scap2 = scap changed = true } else { err = errmsgExpandSliceCannotChange return } return } if !canChange { err = errmsgExpandSliceCannotChange return } scap2 = growCap(scap, stElemSize, num) s2 = reflect.MakeSlice(st, l1, scap2) changed = true reflect.Copy(s2, s) return } func decReadFull(r io.Reader, bs []byte) (n int, err error) { var nn int for n < len(bs) && err == nil { nn, err = r.Read(bs[n:]) if nn > 0 { if err == io.EOF { // leave EOF for next time err = nil } n += nn } } // do not do this - it serves no purpose // if n != len(bs) && err == io.EOF { err = io.ErrUnexpectedEOF } return }
{ "pile_set_name": "Github" }
<?php /** * Exception Renderer * * Provides Exception rendering features. Which allow exceptions to be rendered * as HTML pages. * * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) * Copyright (c) Cake Software Foundation, Inc. (https://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. (https://cakefoundation.org) * @link https://cakephp.org CakePHP(tm) Project * @package Cake.Error * @since CakePHP(tm) v 2.0 * @license https://opensource.org/licenses/mit-license.php MIT License */ App::uses('Sanitize', 'Utility'); App::uses('Dispatcher', 'Routing'); App::uses('Router', 'Routing'); App::uses('Controller', 'Controller'); App::uses('CakeRequest', 'Network'); App::uses('CakeResponse', 'Network'); App::uses('CakeEvent', 'Event'); /** * Exception Renderer. * * Captures and handles all unhandled exceptions. Displays helpful framework errors when debug > 1. * When debug < 1 a CakeException will render 404 or 500 errors. If an uncaught exception is thrown * and it is a type that ExceptionHandler does not know about it will be treated as a 500 error. * * ### Implementing application specific exception rendering * * You can implement application specific exception handling in one of a few ways: * * - Create an AppController::appError(); * - Create a subclass of ExceptionRenderer and configure it to be the `Exception.renderer` * * #### Using AppController::appError(); * * This controller method is called instead of the default exception handling. It receives the * thrown exception as its only argument. You should implement your error handling in that method. * * #### Using a subclass of ExceptionRenderer * * Using a subclass of ExceptionRenderer gives you full control over how Exceptions are rendered, you * can configure your class in your core.php, with `Configure::write('Exception.renderer', 'MyClass');` * You should place any custom exception renderers in `app/Lib/Error`. * * @package Cake.Error */ class ExceptionRenderer { /** * Controller instance. * * @var Controller */ public $controller = null; /** * template to render for CakeException * * @var string */ public $template = ''; /** * The method corresponding to the Exception this object is for. * * @var string */ public $method = ''; /** * The exception being handled. * * @var Exception */ public $error = null; /** * Creates the controller to perform rendering on the error response. * If the error is a CakeException it will be converted to either a 400 or a 500 * code error depending on the code used to construct the error. * * @param Exception|ParseError $exception Exception */ public function __construct($exception) { $this->controller = $this->_getController($exception); if (method_exists($this->controller, 'appError')) { $this->controller->appError($exception); return; } $method = $template = Inflector::variable(str_replace('Exception', '', get_class($exception))); $code = $exception->getCode(); $methodExists = method_exists($this, $method); if ($exception instanceof CakeException && !$methodExists) { $method = '_cakeError'; if (empty($template) || $template === 'internalError') { $template = 'error500'; } } elseif ($exception instanceof PDOException) { $method = 'pdoError'; $template = 'pdo_error'; $code = 500; } elseif (!$methodExists) { $method = 'error500'; if ($code >= 400 && $code < 500) { $method = 'error400'; } } $isNotDebug = !Configure::read('debug'); if ($isNotDebug && $method === '_cakeError') { $method = 'error400'; } if ($isNotDebug && $code == 500) { $method = 'error500'; } $this->template = $template; $this->method = $method; $this->error = $exception; } /** * Get the controller instance to handle the exception. * Override this method in subclasses to customize the controller used. * This method returns the built in `CakeErrorController` normally, or if an error is repeated * a bare controller will be used. * * @param Exception $exception The exception to get a controller for. * @return Controller */ protected function _getController($exception) { App::uses('AppController', 'Controller'); App::uses('CakeErrorController', 'Controller'); if (!$request = Router::getRequest(true)) { $request = new CakeRequest(); } $response = new CakeResponse(); if (method_exists($exception, 'responseHeader')) { $response->header($exception->responseHeader()); } if (class_exists('AppController')) { try { $controller = new CakeErrorController($request, $response); $controller->startupProcess(); $startup = true; } catch (Exception $e) { $startup = false; } // Retry RequestHandler, as another aspect of startupProcess() // could have failed. Ignore any exceptions out of startup, as // there could be userland input data parsers. if ($startup === false && !empty($controller) && $controller->Components->enabled('RequestHandler') ) { try { $controller->RequestHandler->startup($controller); } catch (Exception $e) { } } } if (empty($controller)) { $controller = new Controller($request, $response); $controller->viewPath = 'Errors'; } return $controller; } /** * Renders the response for the exception. * * @return void */ public function render() { if ($this->method) { call_user_func_array(array($this, $this->method), array($this->error)); } } /** * Generic handler for the internal framework errors CakePHP can generate. * * @param CakeException $error The exception to render. * @return void */ protected function _cakeError(CakeException $error) { $url = $this->controller->request->here(); $code = ($error->getCode() >= 400 && $error->getCode() < 506) ? $error->getCode() : 500; $this->controller->response->statusCode($code); $this->controller->set(array( 'code' => $code, 'name' => h($error->getMessage()), 'message' => h($error->getMessage()), 'url' => h($url), 'error' => $error, '_serialize' => array('code', 'name', 'message', 'url') )); $this->controller->set($error->getAttributes()); $this->_outputMessage($this->template); } /** * Convenience method to display a 400 series page. * * @param Exception $error The exception to render. * @return void */ public function error400($error) { $message = $error->getMessage(); if (!Configure::read('debug') && $error instanceof CakeException) { $message = __d('cake', 'Not Found'); } $url = $this->controller->request->here(); $this->controller->response->statusCode($error->getCode()); $this->controller->set(array( 'name' => h($message), 'message' => h($message), 'url' => h($url), 'error' => $error, '_serialize' => array('name', 'message', 'url') )); $this->_outputMessage('error400'); } /** * Convenience method to display a 500 page. * * @param Exception $error The exception to render. * @return void */ public function error500($error) { $message = $error->getMessage(); if (!Configure::read('debug')) { $message = __d('cake', 'An Internal Error Has Occurred.'); } $url = $this->controller->request->here(); $code = ($error->getCode() > 500 && $error->getCode() < 506) ? $error->getCode() : 500; $this->controller->response->statusCode($code); $this->controller->set(array( 'name' => h($message), 'message' => h($message), 'url' => h($url), 'error' => $error, '_serialize' => array('name', 'message', 'url') )); $this->_outputMessage('error500'); } /** * Convenience method to display a PDOException. * * @param PDOException $error The exception to render. * @return void */ public function pdoError(PDOException $error) { $url = $this->controller->request->here(); $code = 500; $this->controller->response->statusCode($code); $this->controller->set(array( 'code' => $code, 'name' => h($error->getMessage()), 'message' => h($error->getMessage()), 'url' => h($url), 'error' => $error, '_serialize' => array('code', 'name', 'message', 'url', 'error') )); $this->_outputMessage($this->template); } /** * Generate the response using the controller object. * * @param string $template The template to render. * @return void */ protected function _outputMessage($template) { try { $this->controller->render($template); $this->_shutdown(); $this->controller->response->send(); } catch (MissingViewException $e) { $attributes = $e->getAttributes(); if (isset($attributes['file']) && strpos($attributes['file'], 'error500') !== false) { $this->_outputMessageSafe('error500'); } else { $this->_outputMessage('error500'); } } catch (MissingPluginException $e) { $attributes = $e->getAttributes(); if (isset($attributes['plugin']) && $attributes['plugin'] === $this->controller->plugin) { $this->controller->plugin = null; } $this->_outputMessageSafe('error500'); } catch (Exception $e) { $this->_outputMessageSafe('error500'); } } /** * A safer way to render error messages, replaces all helpers, with basics * and doesn't call component methods. * * @param string $template The template to render * @return void */ protected function _outputMessageSafe($template) { $this->controller->layoutPath = null; $this->controller->subDir = null; $this->controller->viewPath = 'Errors'; $this->controller->layout = 'error'; $this->controller->helpers = array('Form', 'Html', 'Session'); $view = new View($this->controller); $this->controller->response->body($view->render($template, 'error')); $this->controller->response->type('html'); $this->controller->response->send(); } /** * Run the shutdown events. * * Triggers the afterFilter and afterDispatch events. * * @return void */ protected function _shutdown() { $afterFilterEvent = new CakeEvent('Controller.shutdown', $this->controller); $this->controller->getEventManager()->dispatch($afterFilterEvent); $Dispatcher = new Dispatcher(); $afterDispatchEvent = new CakeEvent('Dispatcher.afterDispatch', $Dispatcher, array( 'request' => $this->controller->request, 'response' => $this->controller->response )); $Dispatcher->getEventManager()->dispatch($afterDispatchEvent); } }
{ "pile_set_name": "Github" }
#!/usr/bin/env bash ############################################################################## ## ## Gradle start up script for UN*X ## ############################################################################## # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS="" APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" warn ( ) { echo "$*" } die ( ) { echo echo "$*" echo exit 1 } # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false case "`uname`" in CYGWIN* ) cygwin=true ;; Darwin* ) darwin=true ;; MINGW* ) msys=true ;; esac # Attempt to set APP_HOME # Resolve links: $0 may be a link PRG="$0" # Need this for relative symlinks. while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG=`dirname "$PRG"`"/$link" fi done SAVED="`pwd`" cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME="`pwd -P`" cd "$SAVED" >/dev/null CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else JAVACMD="java" which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi # Increase the maximum file descriptors if we can. if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then MAX_FD="$MAX_FD_LIMIT" fi ulimit -n $MAX_FD if [ $? -ne 0 ] ; then warn "Could not set maximum file descriptor limit: $MAX_FD" fi else warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" fi fi # For Darwin, add options to specify how the application appears in the dock if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi # For Cygwin, switch paths to Windows format before running java if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` SEP="" for dir in $ROOTDIRSRAW ; do ROOTDIRS="$ROOTDIRS$SEP$dir" SEP="|" done OURCYGPATTERN="(^($ROOTDIRS))" # Add a user-defined pattern to the cygpath arguments if [ "$GRADLE_CYGPATTERN" != "" ] ; then OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" fi # Now convert the arguments - kludge to limit ourselves to /bin/sh i=0 for arg in "$@" ; do CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` else eval `echo args$i`="\"$arg\"" fi i=$((i+1)) done case $i in (0) set -- ;; (1) set -- "$args0" ;; (2) set -- "$args0" "$args1" ;; (3) set -- "$args0" "$args1" "$args2" ;; (4) set -- "$args0" "$args1" "$args2" "$args3" ;; (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules function splitJvmOpts() { JVM_OPTS=("$@") } eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
{ "pile_set_name": "Github" }
/** * Internal dependencies */ import { textContent } from '../utils'; describe( 'textContent()', () => { test( 'should get text `Hello World`', () => { const component = ( <div> <h1>Hello</h1> World </div> ); expect( textContent( component ) ).toBe( 'Hello World' ); } ); test( 'render variable', () => { const component = ( <div> <h1>Hello</h1> { 'World' + '2' } </div> ); expect( textContent( component ) ).toBe( 'Hello World2' ); } ); test( 'render variable2', () => { const component = ( <div> <h1>Hello</h1> { 1 + 1 } </div> ); expect( textContent( component ) ).toBe( 'Hello 2' ); } ); test( 'should output empty string', () => { const component = <div />; expect( textContent( component ) ).toBe( '' ); } ); test( 'array children', () => { const component = ( <div> <h1>Hello</h1> World { [ 'a', <h2 key="b">b</h2> ] } </div> ); expect( textContent( component ) ).toBe( 'Hello Worldab' ); } ); test( 'array children with null', () => { const component = ( <div> <h1>Hello</h1> World { [ 'a', null ] } </div> ); expect( textContent( component ) ).toBe( 'Hello Worlda' ); } ); test( 'array component', () => { const component = [ <h1 key="1">a</h1>, 'b', 'c', <div key="2"> <h2>x</h2>y </div>, ]; expect( textContent( component ) ).toBe( 'abcxy' ); } ); } );
{ "pile_set_name": "Github" }
uint_module!(u32, u32);
{ "pile_set_name": "Github" }
/* * Licensed to Elasticsearch B.V. under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch B.V. licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ export { AreaSeries } from './area_series'; export { Axis } from './axis'; export { BarSeries } from './bar_series'; export { BubbleSeries } from './bubble_series'; export { HistogramBarSeries } from './histogram_bar_series'; export { LineAnnotation } from './line_annotation'; export { LineSeries } from './line_series'; export { RectAnnotation } from './rect_annotation';
{ "pile_set_name": "Github" }
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <ProjectGuid>{7579E0D0-8D54-460C-8920-D633B273A12A}</ProjectGuid> <MainSource>CameraCalibrate.dpr</MainSource> <Base>True</Base> <Config Condition="'$(Config)'==''">Debug</Config> <TargetedPlatforms>3</TargetedPlatforms> <AppType>Console</AppType> <FrameworkType>None</FrameworkType> <ProjectVersion>18.2</ProjectVersion> <Platform Condition="'$(Platform)'==''">Win32</Platform> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='Android' and '$(Base)'=='true') or '$(Base_Android)'!=''"> <Base_Android>true</Base_Android> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Base)'=='true') or '$(Base_iOSDevice32)'!=''"> <Base_iOSDevice32>true</Base_iOSDevice32> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Base)'=='true') or '$(Base_iOSDevice64)'!=''"> <Base_iOSDevice64>true</Base_iOSDevice64> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Base)'=='true') or '$(Base_iOSSimulator)'!=''"> <Base_iOSSimulator>true</Base_iOSSimulator> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''"> <Base_Win32>true</Base_Win32> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''"> <Base_Win64>true</Base_Win64> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_1)'!=''"> <Cfg_1>true</Cfg_1> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''"> <Cfg_1_Win32>true</Cfg_1_Win32> <CfgParent>Cfg_1</CfgParent> <Cfg_1>true</Cfg_1> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''"> <Cfg_1_Win64>true</Cfg_1_Win64> <CfgParent>Cfg_1</CfgParent> <Cfg_1>true</Cfg_1> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_2)'!=''"> <Cfg_2>true</Cfg_2> <CfgParent>Base</CfgParent> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='iOSDevice32' and '$(Cfg_2)'=='true') or '$(Cfg_2_iOSDevice32)'!=''"> <Cfg_2_iOSDevice32>true</Cfg_2_iOSDevice32> <CfgParent>Cfg_2</CfgParent> <Cfg_2>true</Cfg_2> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='iOSDevice64' and '$(Cfg_2)'=='true') or '$(Cfg_2_iOSDevice64)'!=''"> <Cfg_2_iOSDevice64>true</Cfg_2_iOSDevice64> <CfgParent>Cfg_2</CfgParent> <Cfg_2>true</Cfg_2> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='iOSSimulator' and '$(Cfg_2)'=='true') or '$(Cfg_2_iOSSimulator)'!=''"> <Cfg_2_iOSSimulator>true</Cfg_2_iOSSimulator> <CfgParent>Cfg_2</CfgParent> <Cfg_2>true</Cfg_2> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''"> <Cfg_2_Win32>true</Cfg_2_Win32> <CfgParent>Cfg_2</CfgParent> <Cfg_2>true</Cfg_2> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''"> <Cfg_2_Win64>true</Cfg_2_Win64> <CfgParent>Cfg_2</CfgParent> <Cfg_2>true</Cfg_2> <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="'$(Base)'!=''"> <Icns_MainIcns>$(BDS)\bin\delphi_PROJECTICNS.icns</Icns_MainIcns> <Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon> <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput> <SanitizedProjectName>CameraCalibrate</SanitizedProjectName> <DCC_E>false</DCC_E> <DCC_S>false</DCC_S> <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace> <Manifest_File>None</Manifest_File> <DCC_ImageBase>00400000</DCC_ImageBase> <DCC_F>false</DCC_F> <DCC_K>false</DCC_K> <DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput> <VerInfo_Locale>1049</VerInfo_Locale> <DCC_N>false</DCC_N> <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=;CFBundleDisplayName=;CFBundleIdentifier=;CFBundleVersion=;CFBundlePackageType=;CFBundleSignature=;CFBundleAllowMixedLocalizations=;CFBundleExecutable=</VerInfo_Keys> </PropertyGroup> <PropertyGroup Condition="'$(Base_Android)'!=''"> <AUP_CAMERA>true</AUP_CAMERA> <AUP_READ_PHONE_STATE>true</AUP_READ_PHONE_STATE> <AUP_ACCESS_COARSE_LOCATION>true</AUP_ACCESS_COARSE_LOCATION> <AUP_WRITE_CALENDAR>true</AUP_WRITE_CALENDAR> <AUP_CALL_PHONE>true</AUP_CALL_PHONE> <Android_LauncherIcon144>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png</Android_LauncherIcon144> <Android_LauncherIcon96>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png</Android_LauncherIcon96> <AUP_ACCESS_FINE_LOCATION>true</AUP_ACCESS_FINE_LOCATION> <Android_SplashImage470>$(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png</Android_SplashImage470> <Android_LauncherIcon48>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png</Android_LauncherIcon48> <Android_LauncherIcon36>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png</Android_LauncherIcon36> <AUP_WRITE_EXTERNAL_STORAGE>true</AUP_WRITE_EXTERNAL_STORAGE> <AUP_READ_CALENDAR>true</AUP_READ_CALENDAR> <VerInfo_Keys>package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=</VerInfo_Keys> <EnabledSysJars>android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar</EnabledSysJars> <Android_SplashImage426>$(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png</Android_SplashImage426> <AUP_INTERNET>true</AUP_INTERNET> <BT_BuildType>Debug</BT_BuildType> <AUP_READ_EXTERNAL_STORAGE>true</AUP_READ_EXTERNAL_STORAGE> <Android_LauncherIcon72>$(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png</Android_LauncherIcon72> <Android_SplashImage640>$(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png</Android_SplashImage640> <Android_SplashImage960>$(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png</Android_SplashImage960> </PropertyGroup> <PropertyGroup Condition="'$(Base_iOSDevice32)'!=''"> <iPad_Launch768x1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png</iPad_Launch768x1024> <iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80> <iPad_Launch2048x1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png</iPad_Launch2048x1536> <iPad_Launch1536x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png</iPad_Launch1536x2048> <iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120> <iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152> <iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80> <iPad_SpotLight40>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png</iPad_SpotLight40> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> <VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone &amp; iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=</VerInfo_Keys> <iPhone_AppIcon60>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png</iPhone_AppIcon60> <iPhone_Spotlight40>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png</iPhone_Spotlight40> <iPad_AppIcon76>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png</iPad_AppIcon76> <iPad_Launch1024x768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png</iPad_Launch1024x768> <VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily> <VerInfo_BundleId>$(MSBuildProjectName)</VerInfo_BundleId> <BT_BuildType>Debug</BT_BuildType> </PropertyGroup> <PropertyGroup Condition="'$(Base_iOSDevice64)'!=''"> <iPad_Launch768x1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png</iPad_Launch768x1024> <iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80> <iPad_Launch2048x1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png</iPad_Launch2048x1536> <iPad_Launch1536x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png</iPad_Launch1536x2048> <iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120> <iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152> <iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80> <iPad_SpotLight40>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png</iPad_SpotLight40> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> <VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone &amp; iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=</VerInfo_Keys> <iPhone_AppIcon60>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png</iPhone_AppIcon60> <iPhone_Spotlight40>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png</iPhone_Spotlight40> <iPad_AppIcon76>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png</iPad_AppIcon76> <iPad_Launch1024x768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png</iPad_Launch1024x768> <VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily> <VerInfo_BundleId>$(MSBuildProjectName)</VerInfo_BundleId> <BT_BuildType>Debug</BT_BuildType> </PropertyGroup> <PropertyGroup Condition="'$(Base_iOSSimulator)'!=''"> <iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80> <iPad_Launch768x1024>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png</iPad_Launch768x1024> <iPad_Launch1536x2048>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png</iPad_Launch1536x2048> <iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80> <iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152> <iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120> <iPad_SpotLight40>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png</iPad_SpotLight40> <iPad_Launch2048x1536>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png</iPad_Launch2048x1536> <VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone &amp; iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=</VerInfo_Keys> <iPad_AppIcon76>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png</iPad_AppIcon76> <iPhone_Spotlight40>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png</iPhone_Spotlight40> <iPhone_AppIcon60>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png</iPhone_AppIcon60> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> <VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily> <iPad_Launch1024x768>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png</iPad_Launch1024x768> </PropertyGroup> <PropertyGroup Condition="'$(Base_Win32)'!=''"> <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace> <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys> <VerInfo_Locale>1033</VerInfo_Locale> </PropertyGroup> <PropertyGroup Condition="'$(Base_Win64)'!=''"> <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace> <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys> <VerInfo_Locale>1033</VerInfo_Locale> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_1)'!=''"> <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo> <DCC_DebugInformation>0</DCC_DebugInformation> <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define> <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_1_Win32)'!=''"> <DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput> <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput> <VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''"> <DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput> <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput> <VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_2)'!=''"> <DCC_GenerateStackFrames>true</DCC_GenerateStackFrames> <DCC_Optimize>false</DCC_Optimize> <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_2_iOSDevice32)'!=''"> <DCC_RemoteDebug>true</DCC_RemoteDebug> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_2_iOSDevice64)'!=''"> <DCC_RemoteDebug>true</DCC_RemoteDebug> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_2_iOSSimulator)'!=''"> <DCC_RemoteDebug>true</DCC_RemoteDebug> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_2_Win32)'!=''"> <DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput> <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput> <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys> <VerInfo_Locale>1033</VerInfo_Locale> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''"> <DCC_ExeOutput>..\..\..\bin\$(Platform)</DCC_ExeOutput> <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput> <VerInfo_Locale>1033</VerInfo_Locale> <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys> </PropertyGroup> <ItemGroup> <DelphiCompile Include="$(MainSource)"> <MainSource>MainSource</MainSource> </DelphiCompile> <BuildConfiguration Include="Debug"> <Key>Cfg_2</Key> <CfgParent>Base</CfgParent> </BuildConfiguration> <BuildConfiguration Include="Base"> <Key>Base</Key> </BuildConfiguration> <BuildConfiguration Include="Release"> <Key>Cfg_1</Key> <CfgParent>Base</CfgParent> </BuildConfiguration> </ItemGroup> <ProjectExtensions> <Borland.Personality>Delphi.Personality.12</Borland.Personality> <Borland.ProjectType/> <BorlandProject> <Delphi.Personality> <Source> <Source Name="MainSource">CameraCalibrate.dpr</Source> </Source> <VersionInfo> <VersionInfo Name="IncludeVerInfo">False</VersionInfo> <VersionInfo Name="AutoIncBuild">False</VersionInfo> <VersionInfo Name="MajorVer">1</VersionInfo> <VersionInfo Name="MinorVer">0</VersionInfo> <VersionInfo Name="Release">0</VersionInfo> <VersionInfo Name="Build">0</VersionInfo> <VersionInfo Name="Debug">False</VersionInfo> <VersionInfo Name="PreRelease">False</VersionInfo> <VersionInfo Name="Special">False</VersionInfo> <VersionInfo Name="Private">False</VersionInfo> <VersionInfo Name="DLL">False</VersionInfo> <VersionInfo Name="Locale">1049</VersionInfo> <VersionInfo Name="CodePage">1251</VersionInfo> </VersionInfo> <VersionInfoKeys> <VersionInfoKeys Name="CompanyName"/> <VersionInfoKeys Name="FileDescription"/> <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys> <VersionInfoKeys Name="InternalName"/> <VersionInfoKeys Name="LegalCopyright"/> <VersionInfoKeys Name="LegalTrademarks"/> <VersionInfoKeys Name="OriginalFilename"/> <VersionInfoKeys Name="ProductName"/> <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys> <VersionInfoKeys Name="Comments"/> <VersionInfoKeys Name="CFBundleName"/> <VersionInfoKeys Name="CFBundleDisplayName"/> <VersionInfoKeys Name="CFBundleIdentifier"/> <VersionInfoKeys Name="CFBundleVersion"/> <VersionInfoKeys Name="CFBundlePackageType"/> <VersionInfoKeys Name="CFBundleSignature"/> <VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/> <VersionInfoKeys Name="CFBundleExecutable"/> </VersionInfoKeys> <Excluded_Packages> <Excluded_Packages Name="$(BDSBIN)\dcloffice2k200.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages> <Excluded_Packages Name="$(BDSBIN)\dclofficexp200.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages> </Excluded_Packages> </Delphi.Personality> <Platforms> <Platform value="Android">False</Platform> <Platform value="iOSDevice32">False</Platform> <Platform value="iOSDevice64">False</Platform> <Platform value="iOSSimulator">False</Platform> <Platform value="Linux64">False</Platform> <Platform value="OSX32">False</Platform> <Platform value="Win32">True</Platform> <Platform value="Win64">True</Platform> </Platforms> </BorlandProject> <ProjectFileVersion>12</ProjectFileVersion> </ProjectExtensions> <Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/> <Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/> </Project>
{ "pile_set_name": "Github" }
/* Copyright (c) 2010, Carl Burch. License information is located in the * com.cburch.logisim.Main source code and at www.cburch.com/logisim/. */ package com.cburch.hex; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.Stroke; import java.awt.event.ActionEvent; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.ArrayList; import java.util.List; import javax.swing.AbstractAction; import javax.swing.ActionMap; import javax.swing.InputMap; import javax.swing.KeyStroke; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @SuppressWarnings("serial") public class Caret { private static Color SELECT_COLOR = new Color(192, 192, 255); private class Listener implements MouseListener, MouseMotionListener, KeyListener, FocusListener { @Override public void mouseClicked(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { Measures measures = hex.getMeasures(); long loc = measures.toAddress(e.getX(), e.getY()); setDot(loc, (e.getModifiers() & InputEvent.SHIFT_MASK) != 0); if (!hex.isFocusOwner()) { hex.requestFocus(); } } @Override public void mouseReleased(MouseEvent e) { mouseDragged(e); } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseDragged(MouseEvent e) { Measures measures = hex.getMeasures(); long loc = measures.toAddress(e.getX(), e.getY()); setDot(loc, true); // TODO should repeat dragged events when mouse leaves the // component } @Override public void mouseMoved(MouseEvent e) { } @Override public void keyTyped(KeyEvent e) { int mask = e.getModifiers(); if ((mask & ~InputEvent.SHIFT_MASK) != 0) { return; } char c = e.getKeyChar(); int cols = hex.getMeasures().getColumnCount(); switch (c) { case ' ': if (cursor >= 0) { setDot(cursor + 1, (mask & InputEvent.SHIFT_MASK) != 0); } break; case '\n': if (cursor >= 0) { setDot(cursor + cols, (mask & InputEvent.SHIFT_MASK) != 0); } break; case '\u0008': case '\u007f': hex.delete(); // setDot(cursor - 1, (mask & InputEvent.SHIFT_MASK) != 0); break; default: int digit = Character.digit(e.getKeyChar(), 16); if (digit >= 0) { HexModel model = hex.getModel(); if (model != null && cursor >= model.getFirstOffset() && cursor <= model.getLastOffset()) { int curValue = model.get(cursor); int newValue = 16 * curValue + digit; model.set(cursor, newValue); } } break; } } @Override public void keyPressed(KeyEvent e) { int cols = hex.getMeasures().getColumnCount(); int rows; boolean shift = (e.getModifiers() & InputEvent.SHIFT_MASK) != 0; switch (e.getKeyCode()) { case KeyEvent.VK_UP: if (cursor >= cols) { setDot(cursor - cols, shift); } break; case KeyEvent.VK_LEFT: if (cursor >= 1) { setDot(cursor - 1, shift); } break; case KeyEvent.VK_DOWN: if (cursor >= hex.getModel().getFirstOffset() && cursor <= hex.getModel().getLastOffset() - cols) { setDot(cursor + cols, shift); } break; case KeyEvent.VK_RIGHT: if (cursor >= hex.getModel().getFirstOffset() && cursor <= hex.getModel().getLastOffset() - 1) { setDot(cursor + 1, shift); } break; case KeyEvent.VK_HOME: if (cursor >= 0) { int dist = (int) (cursor % cols); if (dist == 0) { setDot(0, shift); } else { setDot(cursor - dist, shift); } break; } case KeyEvent.VK_END: if (cursor >= 0) { HexModel model = hex.getModel(); long dest = (cursor / cols * cols) + cols - 1; if (model != null) { long end = model.getLastOffset(); if (dest > end || dest == cursor) dest = end; setDot(dest, shift); } else { setDot(dest, shift); } } break; case KeyEvent.VK_PAGE_DOWN: rows = hex.getVisibleRect().height / hex.getMeasures().getCellHeight(); if (rows > 2) { rows--; } if (cursor >= 0) { long max = hex.getModel().getLastOffset(); if (cursor + rows * cols <= max) { setDot(cursor + rows * cols, shift); } else { long n = cursor; while (n + cols < max) n += cols; setDot(n, shift); } } break; case KeyEvent.VK_PAGE_UP: rows = hex.getVisibleRect().height / hex.getMeasures().getCellHeight(); if (rows > 2) { rows--; } if (cursor >= rows * cols) { setDot(cursor - rows * cols, shift); } else if (cursor >= cols) { setDot(cursor % cols, shift); } break; default: break; } } @Override public void keyReleased(KeyEvent e) { } @Override public void focusGained(FocusEvent e) { expose(cursor, false); } @Override public void focusLost(FocusEvent e) { expose(cursor, false); } } private static final Stroke CURSOR_STROKE = new BasicStroke(2.0f); private HexEditor hex; private List<ChangeListener> listeners; private long mark; private long cursor; private Object highlight; Caret(HexEditor hex) { this.hex = hex; this.listeners = new ArrayList<ChangeListener>(); this.cursor = -1; Listener l = new Listener(); hex.addMouseListener(l); hex.addMouseMotionListener(l); hex.addKeyListener(l); hex.addFocusListener(l); InputMap imap = hex.getInputMap(); ActionMap amap = hex.getActionMap(); AbstractAction nullAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { } }; String nullKey = "null"; amap.put(nullKey, nullAction); imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), nullKey); imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), nullKey); imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), nullKey); imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), nullKey); imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_DOWN, 0), nullKey); imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_PAGE_UP, 0), nullKey); imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, 0), nullKey); imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_END, 0), nullKey); imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), nullKey); } public void addChangeListener(ChangeListener l) { listeners.add(l); } public void removeChangeListener(ChangeListener l) { listeners.remove(l); } public long getMark() { return mark; } public long getDot() { return cursor; } public void setDot(long value, boolean keepMark) { HexModel model = hex.getModel(); if (model == null || value < model.getFirstOffset() || value > model.getLastOffset()) { value = -1; } if (cursor != value) { long oldValue = cursor; if (highlight != null) { hex.getHighlighter().remove(highlight); highlight = null; } if (!keepMark) { mark = value; } else if (mark != value) { highlight = hex.getHighlighter().add(mark, value, SELECT_COLOR); } cursor = value; expose(oldValue, false); expose(value, true); if (!listeners.isEmpty()) { ChangeEvent event = new ChangeEvent(this); for (ChangeListener l : listeners) { l.stateChanged(event); } } } } private void expose(long loc, boolean scrollTo) { if (loc >= 0) { Measures measures = hex.getMeasures(); int x = measures.toX(loc); int y = measures.toY(loc); int w = measures.getCellWidth(); int h = measures.getCellHeight(); hex.repaint(x - 1, y - 1, w + 2, h + 2); if (scrollTo) { hex.scrollRectToVisible(new Rectangle(x, y, w, h)); } } } void paintForeground(Graphics g, long start, long end) { if (cursor >= start && cursor < end && hex.isFocusOwner()) { Measures measures = hex.getMeasures(); int x = measures.toX(cursor); int y = measures.toY(cursor); Graphics2D g2 = (Graphics2D) g; Stroke oldStroke = g2.getStroke(); g2.setColor(hex.getForeground()); g2.setStroke(CURSOR_STROKE); g2.drawRect(x, y, measures.getCellWidth() - 1, measures.getCellHeight() - 1); g2.setStroke(oldStroke); } } }
{ "pile_set_name": "Github" }
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace WorkspaceServer.Packaging { public class ProjectAssetLoader : IPackageAssetLoader { public Task<IEnumerable<PackageAsset>> LoadAsync(Package2 package) { var assets = new List<PackageAsset>(); var directory = package.DirectoryAccessor; foreach (var csproj in directory.GetAllFilesRecursively() .Where(f => f.Extension == ".csproj")) { assets.Add(new ProjectAsset(directory.GetDirectoryAccessorForRelativePath(csproj.Directory), csproj.FileName)); } return Task.FromResult<IEnumerable<PackageAsset>>(assets); } } }
{ "pile_set_name": "Github" }
Esempi per stampe di etichette e tessere utente
{ "pile_set_name": "Github" }
// +build !go1.7 package sdkio // Copy of Go 1.7 io package's Seeker constants. const ( SeekStart = 0 // seek relative to the origin of the file SeekCurrent = 1 // seek relative to the current offset SeekEnd = 2 // seek relative to the end )
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Testing Routes - Testing - Ember Guides</title> <meta name="description" content="Unit testing methods and computed properties follows previous patterns shown in Unit Testing Basics because Ember.Route extends Ember.Object. Testing routes can be done both via acceptance or unit tests. Acceptance tests will likely provide better..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Testing Routes - Testing - Ember Guides"> <!----> <meta property="og:description" content="Unit testing methods and computed properties follows previous patterns shown in Unit Testing Basics because Ember.Route extends Ember.Object. Testing routes can be done both via acceptance or unit tests. Acceptance tests will likely provide better..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Testing Routes - Testing - Ember Guides"> <!----> <meta name="twitter:description" content="Unit testing methods and computed properties follows previous patterns shown in Unit Testing Basics because Ember.Route extends Ember.Object. Testing routes can be done both via acceptance or unit tests. Acceptance tests will likely provide better..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember257151" class="es-header ember-view" role="banner"><div id="ember257152" class="ember-view"><div class="container"> <nav id="ember257153" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember257154" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember257155" class="navbar-collapse collapse ember-view"><ul id="ember257156" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember257157" class="dropdown nav-item ember-view"> <a href="#" id="ember257158" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember257160" class="dropdown nav-item ember-view"> <a href="#" id="ember257161" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember257163" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember257164" class="dropdown nav-item ember-view"> <a href="#" id="ember257165" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember257167" class="dropdown nav-item ember-view"> <a href="#" id="ember257168" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember257170" class="nav navbar-nav ember-view"> <form> <div id="ember257171" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember257172" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember257173" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember257174" class="ember-basic-dropdown ember-view"> <div aria-label="v2.14.0" aria-owns="ember-basic-dropdown-content-ember257174" tabindex="0" data-ebd-id="ember257174-trigger" role="button" id="ember257175" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 2.14 <!----> </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember257174" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember257179" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember257182" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/getting-started" id="ember257183" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember257184" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257186" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/tutorial" id="ember257187" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember257188" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257190" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/object-model" id="ember257191" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember257192" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257194" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/routing" id="ember257195" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember257196" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257198" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/templates" id="ember257199" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember257200" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257202" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/components" id="ember257203" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember257204" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257206" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/controllers" id="ember257207" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember257208" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257210" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/models" id="ember257211" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember257212" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257214" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/applications" id="ember257215" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember257216" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257218" class="cp-Panel cp-is-open ember-view"><a href="/v2.14.0/testing" id="ember257219" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember257220" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember257221" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/index" id="ember257223" class="ember-view"> Introduction </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/acceptance" id="ember257225" class="ember-view"> Acceptance Tests </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/unit-testing-basics" id="ember257227" class="ember-view"> Unit Testing Basics </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/testing-components" id="ember257229" class="ember-view"> Testing Components </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/testing-helpers" id="ember257231" class="ember-view"> Testing Helpers </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/testing-controllers" id="ember257233" class="ember-view"> Testing Controllers </a> </li> <li class="toc-link toc-level-1 selected"> <a href="/v2.14.0/testing/testing-routes" id="ember257235" class="selected ember-view"> Testing Routes </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/testing-models" id="ember257237" class="ember-view"> Testing Models </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257239" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/ember-inspector" id="ember257240" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember257241" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257243" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/addons-and-dependencies" id="ember257244" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember257245" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257247" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/configuring-ember" id="ember257248" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember257249" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257251" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/contributing" id="ember257252" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember257253" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257255" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/glossary" id="ember257256" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember257257" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember257258" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v2.14.0. <a href="/release/testing/testing-routes" id="ember257259" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v2.14.0/testing/testing-routes.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Testing Routes </h1> <hr> <div id="ember257260" class="ember-view"><p><em>Unit testing methods and computed properties follows previous patterns shown in <a href="../unit-testing-basics/">Unit Testing Basics</a> because Ember.Route extends Ember.Object.</em></p> <p>Testing routes can be done both via acceptance or unit tests. Acceptance tests will likely provide better coverage for routes because routes are typically used to perform transitions and load data, both of which are tested more easily in full context rather than isolation.</p> <p>That being said, sometimes it is important to unit test your routes. For example, let's say we'd like to have an alert that can be triggered from anywhere within our application. The alert function <code>displayAlert</code> should be put into the <code>ApplicationRoute</code> because all actions and events bubble up to it from sub-routes and controllers.</p> <blockquote> <p>By default, Ember CLI does not generate a file for its application route. To extend the behavior of the ember application route we will run the command <code>ember generate route application</code>. Ember CLI does however generate an application template, so when asked whether we want to overwrite <code>app/templates/application.hbs</code> we will answer 'n'.</p> </blockquote> <pre><code class="javascript language-javascript"data-filename=app/routes/application.js>import Ember from 'ember'; export default Ember.Route.extend({ actions: { displayAlert(text) { this._displayAlert(text); } }, _displayAlert(text) { alert(text); } }); </code></pre> <p>In this route we've <a href="http://en.wikipedia.org/wiki/Separation_of_concerns">separated our concerns</a>: The action <code>displayAlert</code> contains the code that is called when the action is received, and the private function <code>_displayAlert</code> performs the work. While not necessarily obvious here because of the small size of the functions, separating code into smaller chunks (or "concerns"), allows it to be more readily isolated for testing, which in turn allows you to catch bugs more easily.</p> <p>Here is an example of how to unit test this route:</p> <pre><code class="javascript language-javascript"data-filename=tests/unit/routes/application-test.js>import { moduleFor, test } from 'ember-qunit'; let originalAlert; moduleFor('route:application', 'Unit | Route | application', { beforeEach() { originalAlert = window.alert; // store a reference to window.alert }, afterEach() { window.alert = originalAlert; // restore window.alert } }); test('should display an alert', function(assert) { assert.expect(2); // with moduleFor, the subject returns an instance of the route let route = this.subject(); // stub window.alert to perform a qunit test const expectedTextFoo = 'foo'; window.alert = (text) =&gt; { assert.equal(text, expectedTextFoo, `expect alert to display ${expectedTextFoo}`); }; // call the _displayAlert function which triggers the qunit test above route._displayAlert(expectedTextFoo); // set up a second stub to perform a test with the actual action const expectedTextBar = 'bar'; window.alert = (text) =&gt; { assert.equal(text, expectedTextBar, `expected alert to display ${expectedTextBar}`); }; // Now use the routes send method to test the actual action route.send('displayAlert', expectedTextBar); }); </code></pre> </div> <footer id="ember257261" class="ember-view"> <a href="/v2.14.0/testing/testing-controllers" id="ember257262" class="previous-guide ember-view">Testing Controllers</a> <a href="/v2.14.0/testing/testing-models" id="ember257263" class="next-guide ember-view"> Testing Models </a></footer> </article> </main> <footer id="ember257264" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember257265" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember257266" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember257267" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
namespace org.apache.http.conn.@params { }
{ "pile_set_name": "Github" }
hello goodbye
{ "pile_set_name": "Github" }
/* * Copyright 2013 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.grafika; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.util.Log; import android.view.InflateException; import android.view.View; /** * Creates and displays an "about" box. */ public class AboutBox { private static final String TAG = MainActivity.TAG; /** * Retrieves the application's version info. */ private static String getVersionString(Context context) { PackageManager pman = context.getPackageManager(); String packageName = context.getPackageName(); try { PackageInfo pinfo = pman.getPackageInfo(packageName, 0); Log.d(TAG, "Found version " + pinfo.versionName + " for " + packageName); return pinfo.versionName + " [" + pinfo.versionCode + "]"; } catch (NameNotFoundException nnfe) { Log.w(TAG, "Unable to retrieve package info for " + packageName); return "(unknown)"; } } /** * Displays the About box. An AlertDialog is created in the calling activity's context. * <p> * The box will disappear if the "OK" button is touched, if an area outside the box is * touched, if the screen is rotated ... doing just about anything makes it disappear. */ public static void display(Activity caller) { String versionStr = getVersionString(caller); String aboutHeader = caller.getString(R.string.app_name) + " v" + versionStr; // Manually inflate the view that will form the body of the dialog. View aboutView; try { aboutView = caller.getLayoutInflater().inflate(R.layout.about_dialog, null); } catch (InflateException ie) { Log.e(TAG, "Exception while inflating about box: " + ie.getMessage()); return; } AlertDialog.Builder builder = new AlertDialog.Builder(caller); builder.setTitle(aboutHeader); builder.setIcon(R.drawable.ic_launcher); builder.setCancelable(true); // implies setCanceledOnTouchOutside builder.setPositiveButton(R.string.ok, null); builder.setView(aboutView); builder.show(); } }
{ "pile_set_name": "Github" }
#include<stdio.h> #include<iostream> #include<cmath> #include<algorithm> #include<cstring> #include<map> #include<set> #include<vector> #include<utility> #include<math.h> #define sd(x) scanf("%d",&x); #define sd2(x,y) scanf("%d%d",&x,&y); #define sd3(x,y,z) scanf("%d%d%d",&x,&y,&z); using namespace std; int t, type, n, b, g, cost1, cost2; vector<int> boys, girls; string s; int main(){ sd(t); while(t--){ sd(type); cin>>s; n = s.length(); b = g = 0; for(int i = 0; i < n; i++){ if(s[i] == 'B') b++; else g++; } if(abs(b-g) > 1){ cout<< -1 <<endl; continue; } if(type == 0){ //BGBG or GBGB int indx = 0; cost1 = 0; cost2 = 0; for(int i = 0; i < n; i++){ if(indx == 0 and s[i] == 'G') cost1++; else if(indx == 1 and s[i] == 'B') cost1++; indx = 1 - indx; } indx = 1; for(int i = 0; i < n; i++){ if(indx == 0 and s[i] == 'G') cost2++; else if(indx == 1 and s[i] == 'B') cost2++; indx = 1 - indx; } if(cost1%2 == 1) cout<< cost2/2 <<endl; else if(cost2%2 == 1) cout<< cost1/2 <<endl; else cout<< (min(cost1, cost2)/2) <<endl; } else{ long long ans = 0, ans2 = 0; b = g = 0; for(int i = 0; i < n; i++){ if(s[i] == 'B'){ ans += abs(i - (2*b)); b++; } else{ ans += abs(i - (2*g + 1)); g++; } } b = g = 0; for(int i = 0; i < n; i++){ if(s[i] == 'G'){ ans2 += abs(i - (2*g)); g++; } else{ ans2 += abs(i - (2*b + 1)); b++; } } if(ans%2 == 1){ cout<< ans2/2 << endl; } else if(ans2%2 == 1){ cout<< ans/2 <<endl; } else{ cout<< (min(ans, ans2)/2) <<endl; } } } return 0; }
{ "pile_set_name": "Github" }
file(GLOB FILES testout* *_GRAY_*.bmp *_GRAY_*.png *_GRAY_*.ppm *_GRAY_*.jpg *_GRAY.yuv *_420_*.bmp *_420_*.png *_420_*.ppm *_420_*.jpg *_420.yuv *_422_*.bmp *_422_*.png *_422_*.ppm *_422_*.jpg *_422.yuv *_444_*.bmp *_444_*.png *_444_*.ppm *_444_*.jpg *_444.yuv *_440_*.bmp *_440_*.png *_440_*.ppm *_440_*.jpg *_440.yuv *_411_*.bmp *_411_*.png *_411_*.ppm *_411_*.jpg *_411.yuv tjbenchtest*.log tjexampletest*.log) if(NOT FILES STREQUAL "") message(STATUS "Removing test files") file(REMOVE ${FILES}) else() message(STATUS "No files to remove") endif()
{ "pile_set_name": "Github" }
/* * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * $Id: URIReference.java,v 1.4 2005/05/10 15:47:42 mullan Exp $ */ package javax.xml.crypto; /** * Identifies a data object via a URI-Reference, as specified by * <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>. * * <p>Note that some subclasses may not have a <code>type</code> attribute * and for objects of those types, the {@link #getType} method always returns * <code>null</code>. * * @author Sean Mullan * @author JSR 105 Expert Group * @since 1.6 * @see URIDereferencer */ public interface URIReference { /** * Returns the URI of the referenced data object. * * @return the URI of the data object in RFC 2396 format (may be * <code>null</code> if not specified) */ String getURI(); /** * Returns the type of data referenced by this URI. * * @return the type (a URI) of the data object (may be <code>null</code> * if not specified) */ String getType(); }
{ "pile_set_name": "Github" }
/* This file is part of p4est. p4est is a C library to manage a collection (a forest) of multiple connected adaptive quadtrees or octrees in parallel. Copyright (C) 2010 The University of Texas System Additional copyright (C) 2011 individual authors Written by Carsten Burstedde, Lucas C. Wilcox, and Tobin Isaac p4est is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. p4est 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 p4est; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /** \file p8est_spheres.h * Functions to create a random distribution of spheres in the unit cube. * These spheres can be intersected with quadrants. * This file ignores vertex coordinates in a \ref p8est_connectivity_t, * and neither does transformations using \ref p8est_geometry_t. */ #ifndef P8EST_SPHERES_H #define P8EST_SPHERES_H #include <p8est.h> SC_EXTERN_C_BEGIN; /** The cube diagonal in 3D is sqrt (3.). */ #define P8EST_CUBE_DIAG (1.7320508075688772) typedef struct p8est_sphere { double center[P8EST_DIM]; double radius; } p8est_sphere_t; typedef struct p8est_spheres { p8est_t *p4est; } p8est_spheres_t; /** Use quadrant coordinates to represent it with a sphere type. * \param [in] quadrant Valid quadrant. * \param [out] sph On output, contains quadrant dimensions. */ void p8est_quadrant_sphere_box (const p8est_quadrant_t * quadrant, p8est_sphere_t * sph); /** Optimistically check for intersection of sphere surface and cube volume. * \param [in] box We use the sphere data structure to define a box * by its center and half width, the latter stored as radius. * \param [in] sph Sphere whose surface is checked against the box volume. * \param [in] t Factor wrt. the sphere's radius for thickness of surface. * \return True if there might be an intersection, false if not. */ int p8est_sphere_match_approx (const p8est_sphere_t * box, const p8est_sphere_t * sph, double t); /** Exactly check for intersection of sphere surface and cube volume. * \param [in] box We use the sphere data structure to define a box * by its center and half width, the latter stored as radius. * \param [in] sph Sphere whose surface is checked against the box volume. * \param [in] t Factor wrt. the sphere's radius for thickness of surface. * \return True if and only if sphere surface intersects box volume. */ int p8est_sphere_match_exact (const p8est_sphere_t * box, const p8est_sphere_t * sph, double t); SC_EXTERN_C_END; #endif /* !P8EST_SPHERES_H */
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <Workspace version = "1.0"> <FileRef location = "self:"> </FileRef> </Workspace>
{ "pile_set_name": "Github" }
<?php /** * This file is part of amfPHP * * LICENSE * * This source file is subject to the license that is bundled * with this package in the file license.txt. */ /** * Amf dates will be converted to and from this class. The PHP DateTime class is for PHP >= 5.2.0, and setTimestamp for PHP >= 5.3.0, so it can't be used in amfPHP * Of course feel free to use it yourself if your host supports it. * * @package Amfphp_Core_Amf_Types * @author Danny Kopping */ class Amfphp_Core_Amf_Types_Date { /** * number of ms since 1st Jan 1970 * @var integer */ public $timeStamp; /** * time stamp * @param integer $timeStamp */ public function __construct($timeStamp) { $this->timeStamp = $timeStamp; } } ?>
{ "pile_set_name": "Github" }
gfm tests: ``` % pandoc -f gfm -t native | Fruit | Price | | ----- | ----: | | apple | 0.13 | | orange|1.12| ^D [Table ("",[],[]) (Caption Nothing []) [(AlignDefault,ColWidthDefault) ,(AlignRight,ColWidthDefault)] (TableHead ("",[],[]) [Row ("",[],[]) [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "Fruit"]] ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "Price"]]]]) [(TableBody ("",[],[]) (RowHeadColumns 0) [] [Row ("",[],[]) [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "apple"]] ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "0.13"]]] ,Row ("",[],[]) [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "orange"]] ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "1.12"]]]])] (TableFoot ("",[],[]) [])] ``` ``` % pandoc -f gfm -t native ~~stricken out~~ ^D [Para [Strikeout [Str "stricken",Space,Str "out"]]] ``` ``` % pandoc -f gfm -t native # Header ## Header # -foo-bar_baz ^D [Header 1 ("header",[],[]) [Str "Header"] ,Header 2 ("header-1",[],[]) [Str "Header"] ,Header 1 ("-foo-bar_baz",[],[]) [Str "-foo-bar_baz"]] ``` ``` % pandoc -f gfm -t native My:thumbsup:emoji:heart: ^D [Para [Str "My",Span ("",["emoji"],[("data-emoji","thumbsup")]) [Str "\128077"],Str "emoji",Span ("",["emoji"],[("data-emoji","heart")]) [Str "\10084\65039"]]] ``` ``` % pandoc -f gfm -t native "hi" ^D [Para [Str "\"hi\""]] ``` ``` % pandoc -f gfm+smart -t native "hi" ^D [Para [Quoted DoubleQuote [Str "hi"]]] ``` ``` % pandoc -t gfm -f native [Table ("",[],[]) (Caption Nothing [Plain [Str "The",Space,Str "caption."]]) [(AlignDefault,ColWidthDefault) ,(AlignRight,ColWidthDefault)] (TableHead ("",[],[]) [Row ("",[],[]) [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "Fruit"]] ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "Price"]]]]) [(TableBody ("",[],[]) (RowHeadColumns 0) [] [Row ("",[],[]) [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "apple"]] ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "0.13"]]] ,Row ("",[],[]) [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "orange"]] ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1) [Plain [Str "1.12"]]]])] (TableFoot ("",[],[]) [])] ^D | Fruit | Price | |--------|------:| | apple | 0.13 | | orange | 1.12 | The caption. ``` ``` % pandoc -f gfm-smart -t gfm+smart “hi” ^D "hi" ``` ``` % pandoc -f gfm+smart -t gfm-smart "hi" ^D “hi” ``` ``` % pandoc -f gfm+smart -t gfm+smart "hi" ^D "hi" ``` ``` % pandoc -f gfm+hard_line_breaks -t native hi hi ^D [Para [Str "hi",LineBreak,Str "hi"]] ``` ``` % pandoc -f gfm -t native - [ ] foo - [x] bar ^D [BulletList [[Plain [Str "\9744",Space,Str "foo"]] ,[Plain [Str "\9746",Space,Str "bar"]]]] ``` ``` % pandoc -f gfm-task_lists -t native - [ ] foo - [x] bar ^D [BulletList [[Plain [Str "[",Space,Str "]",Space,Str "foo"]] ,[Plain [Str "[x]",Space,Str "bar"]]]] ``` ``` % pandoc -f gfm -t gfm - [ ] foo - [x] bar ^D - [ ] foo - [x] bar ```
{ "pile_set_name": "Github" }
package com.eveningoutpost.dexdrip.tidepool; // jamorham // lightweight class entry point import com.eveningoutpost.dexdrip.Models.JoH; import com.eveningoutpost.dexdrip.UtilityModels.Pref; import static com.eveningoutpost.dexdrip.Models.JoH.isLANConnected; import static com.eveningoutpost.dexdrip.utils.PowerStateReceiver.is_power_connected; public class TidepoolEntry { public static boolean enabled() { return Pref.getBooleanDefaultFalse("cloud_storage_tidepool_enable"); } public static void newData() { if (enabled() && (!Pref.getBooleanDefaultFalse("tidepool_only_while_charging") || is_power_connected()) && (!Pref.getBooleanDefaultFalse("tidepool_only_while_unmetered") || isLANConnected()) && JoH.pratelimit("tidepool-new-data-upload", 1200)) { TidepoolUploader.doLogin(false); } } }
{ "pile_set_name": "Github" }
package sarama type ListGroupsResponse struct { Err KError Groups map[string]string } func (r *ListGroupsResponse) encode(pe packetEncoder) error { pe.putInt16(int16(r.Err)) if err := pe.putArrayLength(len(r.Groups)); err != nil { return err } for groupId, protocolType := range r.Groups { if err := pe.putString(groupId); err != nil { return err } if err := pe.putString(protocolType); err != nil { return err } } return nil } func (r *ListGroupsResponse) decode(pd packetDecoder, version int16) error { kerr, err := pd.getInt16() if err != nil { return err } r.Err = KError(kerr) n, err := pd.getArrayLength() if err != nil { return err } if n == 0 { return nil } r.Groups = make(map[string]string) for i := 0; i < n; i++ { groupId, err := pd.getString() if err != nil { return err } protocolType, err := pd.getString() if err != nil { return err } r.Groups[groupId] = protocolType } return nil } func (r *ListGroupsResponse) key() int16 { return 16 } func (r *ListGroupsResponse) version() int16 { return 0 } func (r *ListGroupsResponse) requiredVersion() KafkaVersion { return V0_9_0_0 }
{ "pile_set_name": "Github" }
/** * Light-themed version: * uses light theme by default but switches to dark theme * if a system-wide theme preference is set on the user's device. * * Variables will remain uncompiled so the theme can update dynamically * at runtime in the browser. */ :root { --background-body: #ffffff; --background: #efefef; --background-alt: #f7f7f7; --selection: #9e9e9e; --text-main: #363636; --text-bright: #000000; --text-muted: #999999; --links: #0076d1; --focus: #0096bfab; --border: #dbdbdb; --code: #000000; --animation-duration: 0.1s; --button-hover: #dddddd; --scrollbar-thumb: rgb(213, 213, 213); --scrollbar-thumb-hover: rgb(196, 196, 196); --form-placeholder: #949494; --form-text: #000000; --variable: #39a33c; --highlight: #ffff00; --select-arrow: url("data:image/svg+xml;charset=utf-8,%3C?xml version='1.0' encoding='utf-8'?%3E %3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='62.5' width='116.9' fill='%23161f27'%3E %3Cpath d='M115.3,1.6 C113.7,0 111.1,0 109.5,1.6 L58.5,52.7 L7.4,1.6 C5.8,0 3.2,0 1.6,1.6 C0,3.2 0,5.8 1.6,7.4 L55.5,61.3 C56.3,62.1 57.3,62.5 58.4,62.5 C59.4,62.5 60.5,62.1 61.3,61.3 L115.2,7.4 C116.9,5.8 116.9,3.2 115.3,1.6Z'/%3E %3C/svg%3E"); } @media (prefers-color-scheme: dark) { :root { --background-body: #202b38; --background: #161f27; --background-alt: #1a242f; --selection: #161f27; --text-main: #dbdbdb; --text-bright: #ffffff; --text-muted: #717880; --links: #41adff; --focus: #0096bfab; --border: #dbdbdb; --code: #ffbe85; --animation-duration: 0.1s; --button-hover: #324759; --scrollbar-thumb: var(--button-hover); --scrollbar-thumb-hover: rgb(20, 20, 20); --form-placeholder: #a9a9a9; --form-text: #ffffff; --variable: #d941e2; --highlight: #efdb43; --select-arrow: url("data:image/svg+xml;charset=utf-8,%3C?xml version='1.0' encoding='utf-8'?%3E %3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' height='62.5' width='116.9' fill='%23efefef'%3E %3Cpath d='M115.3,1.6 C113.7,0 111.1,0 109.5,1.6 L58.5,52.7 L7.4,1.6 C5.8,0 3.2,0 1.6,1.6 C0,3.2 0,5.8 1.6,7.4 L55.5,61.3 C56.3,62.1 57.3,62.5 58.4,62.5 C59.4,62.5 60.5,62.1 61.3,61.3 L115.2,7.4 C116.9,5.8 116.9,3.2 115.3,1.6Z'/%3E %3C/svg%3E"); } } body { font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; line-height: 1.4; max-width: 800px; margin: 20px auto; padding: 0 10px; color: var(--text-main); background: var(--background-body); text-rendering: optimizeLegibility; } button, input, textarea { transition: background-color var(--animation-duration) linear, border-color var(--animation-duration) linear, color var(--animation-duration) linear, box-shadow var(--animation-duration) linear, transform var(--animation-duration) ease; } h1 { font-size: 2.2em; margin-top: 0; } h1, h2, h3, h4, h5, h6 { margin-bottom: 12px; } h1, h2, h3, h4, h5, h6, strong { color: var(--text-bright); } h1, h2, h3, h4, h5, h6, b, strong, th { font-weight: 600; } q:before { content: none; } q:after { content: none; } blockquote , q{ border-left: 4px solid var(--focus); margin: 1.5em 0em; padding: 0.5em 1em; font-style: italic; } blockquote > footer { font-style: normal; border: 0; } blockquote cite { font-style: normal; } address { font-style: normal; } a[href^='mailto']::before { content: '📧 '; } a[href^='tel']::before { content: '📞 '; } a[href^='sms']::before { content: '💬 '; } mark { background-color: var(--highlight); border-radius: 2px; padding: 0px 2px 0px 2px; color: #000000; } button, select, input[type='submit'], input[type='button'], input[type='checkbox'], input[type='range'], input[type='radio'] { cursor: pointer; } input:not([type='checkbox']):not([type='radio']), select { display: block; } input, button, textarea, select { color: var(--form-text); background-color: var(--background); font-family: inherit; font-size: inherit; margin-right: 6px; margin-bottom: 6px; padding: 10px; border: none; border-radius: 6px; outline: none; } input, select, button, textarea { -webkit-appearance: none; } textarea { margin-right: 0; width: 100%; box-sizing: border-box; resize: vertical; } select { background: var(--background) var(--select-arrow) calc(100% - 12px) 50% / 12px no-repeat; padding-right: 35px; } select::-ms-expand { display: none; } select[multiple] { padding-right: 10px; background-image: none; overflow-y: auto; } button, input[type='submit'], input[type='button'] { padding-right: 30px; padding-left: 30px; } button:hover, input[type='submit']:hover, input[type='button']:hover { background: var(--button-hover); } input:focus, select:focus, button:focus, textarea:focus { box-shadow: 0 0 0 2px var(--focus); } input[type='checkbox'], input[type='radio'] { position: relative; width: 14px; height: 14px; display: inline-block; vertical-align: middle; margin: 0; margin-right: 2px; } input[type='radio'] { border-radius: 50%; } input[type='checkbox']:checked, input[type='radio']:checked { background: var(--button-hover); } input[type='checkbox']:checked::before, input[type='radio']:checked::before { content: '•'; display: block; position: absolute; left: 50%; top: 50%; transform: translateX(-50%) translateY(-50%); } input[type='checkbox']:checked::before { content: '✔'; transform: translateY(-50%) translateY(0.5px) translateX(-6px); } input[type='checkbox']:active, input[type='radio']:active, input[type='submit']:active, input[type='button']:active, input[type='range']:active, button:active { transform: translateY(2px); } input:disabled, select:disabled, button:disabled, textarea:disabled { cursor: not-allowed; opacity: 0.5; } ::-webkit-input-placeholder { color: var(--form-placeholder); } ::-moz-placeholder { color: var(--form-placeholder); } ::-ms-input-placeholder { color: var(--form-placeholder); } ::placeholder { color: var(--form-placeholder); } fieldset { border: 1px var(--focus) solid; border-radius: 6px; margin: 0; margin-bottom: 6px; padding: 10px; } legend { font-size: 0.9em; font-weight: 600; } input[type='range'] { margin: 10px 0; padding: 10px 0; background: transparent; } input[type='range']:focus { outline: none; } input[type='range']::-webkit-slider-runnable-track { width: 100%; height: 9.5px; transition: 0.2s; background: var(--background); border-radius: 3px; } input[type='range']::-webkit-slider-thumb { box-shadow: 0px 1px 1px #000000, 0px 0px 1px #0d0d0d; height: 20px; width: 20px; border-radius: 50%; background: var(--border); -webkit-appearance: none; margin-top: -7px; } input[type='range']:focus::-webkit-slider-runnable-track { background: var(--background); } input[type='range']::-moz-range-track { width: 100%; height: 9.5px; transition: 0.2s; background: var(--background); border-radius: 3px; } input[type='range']::-moz-range-thumb { box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d; height: 20px; width: 20px; border-radius: 50%; background: var(--border); } input[type='range']::-ms-track { width: 100%; height: 9.5px; background: transparent; border-color: transparent; border-width: 16px 0; color: transparent; } input[type='range']::-ms-fill-lower { background: var(--background); border: 0.2px solid #010101; border-radius: 3px; box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d; } input[type='range']::-ms-fill-upper { background: var(--background); border: 0.2px solid #010101; border-radius: 3px; box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d; } input[type='range']::-ms-thumb { box-shadow: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d; border: 1px solid #000000; height: 20px; width: 20px; border-radius: 50%; background: var(--border); } input[type='range']:focus::-ms-fill-lower { background: var(--background); } input[type='range']:focus::-ms-fill-upper { background: var(--background); } a { text-decoration: none; color: var(--links); } a:hover { text-decoration: underline; } code, samp, time { background: var(--background); color: var(--code); padding: 2.5px 5px; border-radius: 6px; font-size: 1em; } pre > code { padding: 10px; display: block; overflow-x: auto; } var { color: var(--variable); font-style: normal; font-family: monospace; } kbd { background: var(--background); border: 1px solid var(--border); border-radius: 2px; color: var(--text-main); padding: 2px 4px 2px 4px; } img { max-width: 100%; height: auto; } hr { border: none; border-top: 1px solid var(--border); } table { border-collapse: collapse; margin-bottom: 10px; width: 100%; } td, th { padding: 6px; text-align: left; } thead { border-bottom: 1px solid var(--border); } tfoot { border-top: 1px solid var(--border); } tbody tr:nth-child(even) { background-color: var(--background-alt); } ::-webkit-scrollbar { height: 10px; width: 10px; } ::-webkit-scrollbar-track { background: var(--background); border-radius: 6px; } ::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 6px; } ::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); } ::-moz-selection { background-color: var(--selection); } ::selection { background-color: var(--selection); } details { display: flex; flex-direction: column; align-items: flex-start; background-color: var(--background-alt); padding: 10px 10px 0; margin: 1em 0; border-radius: 6px; overflow: hidden; } details[open] { padding: 10px; } details > :last-child { margin-bottom: 0; } details[open] summary { margin-bottom: 10px; } summary { display: list-item; background-color: var(--background); padding: 10px; margin: -10px -10px 0; } details > :not(summary) { margin-top: 0; } summary::-webkit-details-marker { color: var(--text-main); } footer { border-top: 1px solid var(--background); padding-top: 10px; font-size: 0.8em; color: var(--text-muted); } /*# sourceMappingURL=light.css.map */
{ "pile_set_name": "Github" }
//This file was originally part of: //https://github.com/brandur/sorg/blob/master/pool/pool.go //It has the following license: // //MIT License // //Copyright (c) 2017 Brandur Leach // //Permission is hereby granted, free of charge, to any person obtaining a copy //of this software and associated documentation files (the "Software"), to deal //in the Software without restriction, including without limitation the rights //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //copies of the Software, and to permit persons to whom the Software is //furnished to do so, subject to the following conditions: // //The above copyright notice and this permission notice shall be included in all //copies or substantial portions of the Software. // //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE //SOFTWARE. package pool import ( "sync" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) type TaskResult interface{} // Task encapsulates a work item that should go in a work pool. type Task struct { // Err holds an error that occurred during a task. Its result is only // meaningful after Run has been called for the pool that holds it. Err error Result TaskResult f func() (TaskResult, error) } // NewTask initializes a new task based on a given work function. func NewTask(f func() (TaskResult, error)) *Task { return &Task{f: f} } // Run runs a Task and does appropriate accounting via a given sync.WorkGroup. func (t *Task) Run(wg *sync.WaitGroup) { t.Result, t.Err = t.f() wg.Done() } // Pool is a worker group that runs a number of tasks at a configured // concurrency. type Pool struct { Tasks []*Task concurrency int tasksChan chan *Task wg sync.WaitGroup } // NewPool initializes a new pool with the given tasks and at the given // concurrency. func NewPool(tasks []*Task, concurrency int) *Pool { return &Pool{ Tasks: tasks, concurrency: concurrency, tasksChan: make(chan *Task), } } // HasErrors indicates whether there were any errors from tasks run. Its result // is only meaningful after Run has been called. func (p *Pool) HasErrors() bool { for _, task := range p.Tasks { if task.Err != nil { return true } } return false } // GetErrors returns all errors from tasks run. Its result // is only meaningful after Run has been called. func (p *Pool) GetErrors() error { var err error for _, task := range p.Tasks { if task.Err != nil { err = errors.Wrap(err, "pool task error") } } return err } // Run runs all work within the pool and blocks until it's finished. func (p *Pool) Run() { log.Debugf("Running %v task(s) at concurrency %v.", len(p.Tasks), p.concurrency) for i := 0; i < p.concurrency; i++ { go p.work() } p.wg.Add(len(p.Tasks)) for _, task := range p.Tasks { p.tasksChan <- task } // all workers return close(p.tasksChan) p.wg.Wait() } // The work loop for any single goroutine. func (p *Pool) work() { for task := range p.tasksChan { task.Run(&p.wg) } }
{ "pile_set_name": "Github" }
/* * env.js: Commands related to environment variables for Nodejitsu applications. * * (C) 2010, Nodejitsu Inc. * */ var winston = require('winston'), jitsu = require('../../jitsu'); var env = exports; env.usage = [ '`jitsu env *` commands allow you to set local environment', 'variables for your application. Valid commands are:', '', 'jitsu env list', 'jitsu env list <app>', 'jitsu env set <key> <value>', 'jitsu env get <key>', 'jitsu env delete <key>', 'jitsu env clear' ]; // // ### function set (key, value, callback) // #### @key {string} Key to set in jitsu config. // #### @value {string} Value to set the key to. // #### @callback {function} Continuation to pass control to when complete // Sets the specified `key` in the environment variables to `value` for // the application in the current directory. // env.set = function (key, value, callback) { var args = Array.prototype.slice.call(arguments); callback = args.pop(); if (args.length !== 2) { winston.error('You must pass both <key> and <value>'); return callback(true, true); } viewApp(callback, function (err, app) { app.env = app.env || {}; app.env[key] = value; jitsu.apps.update(app.name, { env: app.env }, callback); }); }; // // Usage for `jitsu env set <key> <value>` // env.set.usage = [ 'Sets the specified `key` in the environment variables to `value`', 'for the application in the current directory.', '', 'jitsu env set <key> <value>' ]; // // ### function get (key, callback) // #### @key {string} Key to get in jitsu config. // #### @callback {function} Continuation to pass control to when complete // Gets the specified `key` in the environment variables for the // application in the current directory. // env.get = function (key, callback) { if (!callback) { callback = key; winston.error('No environment variables for ' + 'undefined'.yellow); return callback(new Error(), true, true); } viewApp(callback, function (err, app) { if (!app.env[key]) { winston.warn('No environment variables for ' + key.yellow); return callback(); } winston.data([key.yellow, app.env[key].toString().magenta].join(' ')); callback(); }); }; // // Usage for `jitsu config get <key>` // env.get.usage = [ 'Gets the specified `key` in the environment variables for the', 'application in the current directory.', '', 'jitsu env get <key>' ]; // // ### function delete (key, callback) // #### @key {string} Key to delete, in jitsu config. // #### @callback {function} Continuation to pass control to when complete // Deletes the specified `key` in the environment variables for the // application in the current directory. // env.delete = function (key, callback) { if (!callback) { callback = key; winston.warn('No configuration for ' + 'undefined'.magenta); return callback(); } var value = jitsu.config.get(key); if (!value) { winston.warn('No configuration value for ' + key.yellow); return callback(); } viewApp(callback, function (err, app) { if (!app.env[key]) { winston.warn('No environment variables for ' + key.yellow); return callback(); } delete app.env[key]; jitsu.apps.update(app.name, { env: app.env }, callback); }); }; // // Usage for `jitsu env delete <key>` // env.delete.usage = [ 'Deletes the specified `key` in the environment variables for the', 'application in the current directory.', '', 'jitsu env delete <key>' ]; // // ### function list (callback) // #### @callback {function} Continuation to pass control to when complete // Lists all environment variables for the application in the // current directory. // env.list = function (appName, callback) { if (typeof appName === 'function') { callback = appName; appName = null; viewApp(callback, success); } else { viewAppByName(appName, callback, success); } function success(err, app) { if (!app.env || Object.keys(app.env).length === 0) { winston.warn('No environment variables for ' + app.name.magenta); return callback(); } winston.info('Listing all environment variables for: ' + app.name.magenta); jitsu.log.putObject(app.env); callback(); } }; // // Usage for `jitsu env list` // env.list.usage = [ 'Lists all environment variables for the application in the', 'current directory.', '', 'jitsu env list' ]; env.clear = function (callback) { viewApp(callback, function (err, app) { if (!app.env || Object.keys(app.env).length === 0) { winston.warn('No environment variables for ' + app.name.magenta); return callback(); } winston.warn('All environment variables for ' + app.name.magenta + ' will be deleted.'); jitsu.prompt.get(['yesno'], function (err, result) { return err ? callback(err) : jitsu.apps.update(app.name, { env: {} }, callback); }); }); }; // // ### @private viewApp (callback, success) // #### @callback {function} Continuation to respond to on error. // #### @success {function} Continuation to respond to on success. // Attempts to read the package.json for the current directory // and retrieve it from Nodejitsu. // function viewApp (callback, success) { jitsu.package.tryRead(process.cwd(), callback, function (pkg) { jitsu.apps.view(pkg.name, function (err, app) { return err ? callback(err) : success(null, app); }); }); } // // ### @private viewAppByName (appName, callback, success) // #### @callback {function} Continuation to respond to on error. // #### @success {function} Continuation to respond to on success. // Attempts to retrieve the application from Nodejitsu with the given name. // function viewAppByName (appName, callback, success) { jitsu.apps.view(appName, function (err, app) { return err ? callback(err) : success(null, app); }); }
{ "pile_set_name": "Github" }
#ifdef EnableAikoDeviceLux int luxValue = 0; #endif void luxHandler(void) { luxValue = analogRead(PIN_LUX_SENSOR); }
{ "pile_set_name": "Github" }
require("long-stack-traces"); var fs=require("fs") _ = require("underscore"); window = null; suite("tests suite", function () { test("define suites", function (done) { this.timeout(15000); var jsdom = require("jsdom"); jsdom.env( "some.html", [], function (errors, domWindow) { function fakeWorkerProcess() { window.self = domWindow; window.workerDispatch = function () { }; } //region fakes window = domWindow; fakeWorkerProcess(); Modernizr = {}; Modernizr['websocketsbinary'] = true; WebSocket = require("websocket").client; //endregion fakes //region test-environment sinon = require("sinon"); assert = require("chai").assert; require("../lib/base64"), Canvas = require('canvas'), Image = Canvas.Image, BigInteger = require("../lib/biginteger").BigInteger, window.$=require("../lib/jquery-2.0.3"), window.bowser = require("../lib/bowser"), require("../lib/virtualjoystick"), require("../lib/utils"), require("../lib/CollisionDetector.js"), require("../lib/GlobalPool"), require("../lib/GenericObjectPool"), require("../spiceobjects/spiceobjects"), require("../spiceobjects/generated/protocol"), require("../lib/graphicdebug"), require("../lib/images/lz"), require("../lib/images/bitmap"), require("../lib/images/png"), require("../lib/runqueue"), require("../lib/queue"), require("../lib/ImageUncompressor"), require("../lib/SyncAsyncHandler"), require("../lib/stuckkeyshandler"), require("../lib/timelapsedetector"), require("../lib/displayRouter"), require("../lib/rasterEngine"), require("../lib/DataLogger"), require("../network/socket"), require("../network/socketqueue"), require("../network/packetlinkfactory"), require("../network/packetcontroller"), require("../network/packetextractor"), require("../network/packetreassembler"), require("../network/reassemblerfactory"), require("../network/sizedefiner"), require("../network/packetlinkfactory"), require("../network/spicechannel"), require("../network/busconnection"), require("../network/clusternodechooser"), require("../network/websocketwrapper"), require("../network/connectioncontrol"), require("../application/agent"), require("../application/spiceconnection"), require("../application/spiceconnection"), require("../application/clientgui"), require("../application/packetprocess"), require("../application/packetfilter"), require("../application/packetfactory"), require("../application/application"), require("../application/virtualmouse"), require("../application/imagecache"), require("../application/rasteroperation"), require("../application/stream"), require("../application/inputmanager"), require("../process/displayprocess"), require("../process/displaypreprocess"), require("../process/inputprocess"), require("../process/cursorprocess"), require("../process/mainprocess"), require("../process/busprocess"), require("../keymaps/keymapes"), require("../keymaps/keymapus"), require("../keymaps/keymap"), require("../testlibs/fakewebsocket"), require("../node_modules/mocha/mocha"); wdi.GlobalPool.createCanvas = function () { return new Canvas(200, 200); } var files = fs.readdirSync(__dirname); _.each(files, function(item) { if (!item.match(/\.test\.js/g)||item.match(/graphic.*test/g)) { return; } require("./"+item.slice(0, -3)); }); wdi.exceptionHandling = false; wdi.GlobalPool.init(); //endregion test-environment done(); } ); }); });
{ "pile_set_name": "Github" }
from default_arg_values import * d = Display() if d.draw1() != 0: raise RuntimeError if d.draw1(12) != 12: raise RuntimeError p = createPtr(123) if d.draw2() != 0: raise RuntimeError if d.draw2(p) != 123: raise RuntimeError if d.bool0() != False or type(d.bool0()) != type(False): raise RuntimeError if d.bool1() != True or type(d.bool1()) != type(True): raise RuntimeError if d.mybool0() != False or type(d.mybool0()) != type(False): raise RuntimeError if d.mybool1() != True or type(d.mybool1()) != type(True): raise RuntimeError
{ "pile_set_name": "Github" }
apiVersion: v1 kind: Pod metadata: name: security-context-demo spec: securityContext: runAsUser: 1000 runAsGroup: 3000 fsGroup: 2000 volumes: - name: sec-ctx-vol emptyDir: {} containers: - name: sec-ctx-demo image: busybox command: [ "sh", "-c", "sleep 1h" ] volumeMounts: - name: sec-ctx-vol mountPath: /data/demo securityContext: allowPrivilegeEscalation: false
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Jun 9 2015 22:53:21). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2014 by Steve Nygard. // #import <Foundation/NSObject.h> #import "NSXPCListenerDelegate-Protocol.h" @class NSString; @interface SPListenerDelegate : NSObject <NSXPCListenerDelegate> { } - (BOOL)listener:(id)arg1 shouldAcceptNewConnection:(id)arg2; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
{ "pile_set_name": "Github" }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Security.Claims; using Newtonsoft.Json.Linq; namespace Microsoft.AspNetCore.Authentication.OAuth.Claims { /// <summary> /// A ClaimAction that selects the value from the json user data by running the given Func resolver. /// </summary> public class CustomJsonClaimAction : ClaimAction { /// <summary> /// Creates a new CustomJsonClaimAction. /// </summary> /// <param name="claimType">The value to use for Claim.Type when creating a Claim.</param> /// <param name="valueType">The value to use for Claim.ValueType when creating a Claim.</param> /// <param name="resolver">The Func that will be called to select value from the given json user data.</param> public CustomJsonClaimAction(string claimType, string valueType, Func<JObject, string> resolver) : base(claimType, valueType) { Resolver = resolver; } /// <summary> /// The Func that will be called to select value from the given json user data. /// </summary> public Func<JObject, string> Resolver { get; } /// <inheritdoc /> public override void Run(JObject userData, ClaimsIdentity identity, string issuer) { if (userData == null) { return; } var value = Resolver(userData); if (!string.IsNullOrEmpty(value)) { identity.AddClaim(new Claim(ClaimType, value, ValueType, issuer)); } } } }
{ "pile_set_name": "Github" }
version: 1 dn: m-oid=1.3.6.1.4.1.2312.4.2.3,ou=objectClasses,cn=autofs,ou=schema creatorsname: uid=admin,ou=system objectclass: metaObjectClass objectclass: metaTop objectclass: top m-oid: 1.3.6.1.4.1.2312.4.2.3 m-name: automount m-description: An entry in an automounter map m-obsolete: FALSE m-supobjectclass: top m-must: cn m-must: automountInformation entryUUID: f8de9218-08ad-493c-8b33-fbac6e26561d m-may: description m-typeobjectclass: STRUCTURAL entryCSN: 20130919065344.979000Z#000000#000#000000 entryParentId: afb5737a-e5aa-4e45-950c-fed678d48626 createTimestamp: 20130919065353.245Z
{ "pile_set_name": "Github" }
import * as p from "@bokehjs/core/properties" import {Markup} from "@bokehjs/models/widgets/markup" import JSONFormatter from "json-formatter-js" import {PanelMarkupView} from "./layout" export class JSONView extends PanelMarkupView { model: JSON connect_signals(): void { super.connect_signals() const {depth, hover_preview, theme} = this.model.properties this.on_change([depth, hover_preview, theme], () => this.render()) } render(): void { super.render(); const text = this.model.text.replace(/(\r\n|\n|\r)/gm, "").replace("'", '"') let json; try { json = window.JSON.parse(text) } catch(err) { this.markup_el.innerHTML = "<b>Invalid JSON:</b> " + err.toString() return } const config = {hoverPreviewEnabled: this.model.hover_preview, theme: this.model.theme} const depth = this.model.depth == null ? Infinity : this.model.depth const formatter = new JSONFormatter(json, depth, config) const rendered = formatter.render() let style = "border-radius: 5px; padding: 10px;"; if (this.model.theme == "dark") rendered.style.cssText = "background-color: rgb(30, 30, 30);" + style; else rendered.style.cssText = style; this.markup_el.append(rendered) } } type Theme = "light" | "dark" const Theme: Theme[] = ["dark", "light"] export namespace JSON { export type Attrs = p.AttrsOf<Props> export type Props = Markup.Props & { depth: p.Property<number> hover_preview: p.Property<boolean> theme: p.Property<"light" | "dark"> } } export interface JSON extends JSON.Attrs {} export class JSON extends Markup { properties: JSON.Props constructor(attrs?: Partial<JSON.Attrs>) { super(attrs) } static __module__ = "panel.models.markup" static init_JSON(): void { this.prototype.default_view = JSONView this.define<JSON.Props>({ depth: [p.Number, 1], hover_preview: [p.Boolean, false], theme: [p.Enum(Theme), "dark"], }) } }
{ "pile_set_name": "Github" }
/* Copyright (C) 2001-2004 Aurelien Jarno <aurelien@aurel32.net> Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with the help of Jean Delvare <khali@linux-fr.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/i2c.h> #include <linux/mutex.h> /* Addresses to scan */ static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, I2C_CLIENT_END }; /* Insmod parameters */ static int input_mode; module_param(input_mode, int, 0); MODULE_PARM_DESC(input_mode, "Analog input mode:\n" " 0 = four single ended inputs\n" " 1 = three differential inputs\n" " 2 = single ended and differential mixed\n" " 3 = two differential inputs\n"); /* The PCF8591 control byte 7 6 5 4 3 2 1 0 | 0 |AOEF| AIP | 0 |AINC| AICH | */ /* Analog Output Enable Flag (analog output active if 1) */ #define PCF8591_CONTROL_AOEF 0x40 /* Analog Input Programming 0x00 = four single ended inputs 0x10 = three differential inputs 0x20 = single ended and differential mixed 0x30 = two differential inputs */ #define PCF8591_CONTROL_AIP_MASK 0x30 /* Autoincrement Flag (switch on if 1) */ #define PCF8591_CONTROL_AINC 0x04 /* Channel selection 0x00 = channel 0 0x01 = channel 1 0x02 = channel 2 0x03 = channel 3 */ #define PCF8591_CONTROL_AICH_MASK 0x03 /* Initial values */ #define PCF8591_INIT_CONTROL ((input_mode << 4) | PCF8591_CONTROL_AOEF) #define PCF8591_INIT_AOUT 0 /* DAC out = 0 */ /* Conversions */ #define REG_TO_SIGNED(reg) (((reg) & 0x80)?((reg) - 256):(reg)) struct pcf8591_data { struct mutex update_lock; u8 control; u8 aout; }; static void pcf8591_init_client(struct i2c_client *client); static int pcf8591_read_channel(struct device *dev, int channel); /* following are the sysfs callback functions */ #define show_in_channel(channel) \ static ssize_t show_in##channel##_input(struct device *dev, struct device_attribute *attr, char *buf) \ { \ return sprintf(buf, "%d\n", pcf8591_read_channel(dev, channel));\ } \ static DEVICE_ATTR(in##channel##_input, S_IRUGO, \ show_in##channel##_input, NULL); show_in_channel(0); show_in_channel(1); show_in_channel(2); show_in_channel(3); static ssize_t show_out0_ouput(struct device *dev, struct device_attribute *attr, char *buf) { struct pcf8591_data *data = i2c_get_clientdata(to_i2c_client(dev)); return sprintf(buf, "%d\n", data->aout * 10); } static ssize_t set_out0_output(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned int value; struct i2c_client *client = to_i2c_client(dev); struct pcf8591_data *data = i2c_get_clientdata(client); if ((value = (simple_strtoul(buf, NULL, 10) + 5) / 10) <= 255) { data->aout = value; i2c_smbus_write_byte_data(client, data->control, data->aout); return count; } return -EINVAL; } static DEVICE_ATTR(out0_output, S_IWUSR | S_IRUGO, show_out0_ouput, set_out0_output); static ssize_t show_out0_enable(struct device *dev, struct device_attribute *attr, char *buf) { struct pcf8591_data *data = i2c_get_clientdata(to_i2c_client(dev)); return sprintf(buf, "%u\n", !(!(data->control & PCF8591_CONTROL_AOEF))); } static ssize_t set_out0_enable(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); struct pcf8591_data *data = i2c_get_clientdata(client); unsigned long val = simple_strtoul(buf, NULL, 10); mutex_lock(&data->update_lock); if (val) data->control |= PCF8591_CONTROL_AOEF; else data->control &= ~PCF8591_CONTROL_AOEF; i2c_smbus_write_byte(client, data->control); mutex_unlock(&data->update_lock); return count; } static DEVICE_ATTR(out0_enable, S_IWUSR | S_IRUGO, show_out0_enable, set_out0_enable); static struct attribute *pcf8591_attributes[] = { &dev_attr_out0_enable.attr, &dev_attr_out0_output.attr, &dev_attr_in0_input.attr, &dev_attr_in1_input.attr, NULL }; static const struct attribute_group pcf8591_attr_group = { .attrs = pcf8591_attributes, }; static struct attribute *pcf8591_attributes_opt[] = { &dev_attr_in2_input.attr, &dev_attr_in3_input.attr, NULL }; static const struct attribute_group pcf8591_attr_group_opt = { .attrs = pcf8591_attributes_opt, }; /* * Real code */ /* Return 0 if detection is successful, -ENODEV otherwise */ static int pcf8591_detect(struct i2c_client *client, struct i2c_board_info *info) { struct i2c_adapter *adapter = client->adapter; if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) return -ENODEV; /* Now, we would do the remaining detection. But the PCF8591 is plainly impossible to detect! Stupid chip. */ strlcpy(info->type, "pcf8591", I2C_NAME_SIZE); return 0; } static int pcf8591_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct pcf8591_data *data; int err; if (!(data = kzalloc(sizeof(struct pcf8591_data), GFP_KERNEL))) { err = -ENOMEM; goto exit; } i2c_set_clientdata(client, data); mutex_init(&data->update_lock); /* Initialize the PCF8591 chip */ pcf8591_init_client(client); /* Register sysfs hooks */ err = sysfs_create_group(&client->dev.kobj, &pcf8591_attr_group); if (err) goto exit_kfree; /* Register input2 if not in "two differential inputs" mode */ if (input_mode != 3) { if ((err = device_create_file(&client->dev, &dev_attr_in2_input))) goto exit_sysfs_remove; } /* Register input3 only in "four single ended inputs" mode */ if (input_mode == 0) { if ((err = device_create_file(&client->dev, &dev_attr_in3_input))) goto exit_sysfs_remove; } return 0; exit_sysfs_remove: sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group_opt); sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group); exit_kfree: kfree(data); exit: return err; } static int pcf8591_remove(struct i2c_client *client) { sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group_opt); sysfs_remove_group(&client->dev.kobj, &pcf8591_attr_group); kfree(i2c_get_clientdata(client)); return 0; } /* Called when we have found a new PCF8591. */ static void pcf8591_init_client(struct i2c_client *client) { struct pcf8591_data *data = i2c_get_clientdata(client); data->control = PCF8591_INIT_CONTROL; data->aout = PCF8591_INIT_AOUT; i2c_smbus_write_byte_data(client, data->control, data->aout); /* The first byte transmitted contains the conversion code of the previous read cycle. FLUSH IT! */ i2c_smbus_read_byte(client); } static int pcf8591_read_channel(struct device *dev, int channel) { u8 value; struct i2c_client *client = to_i2c_client(dev); struct pcf8591_data *data = i2c_get_clientdata(client); mutex_lock(&data->update_lock); if ((data->control & PCF8591_CONTROL_AICH_MASK) != channel) { data->control = (data->control & ~PCF8591_CONTROL_AICH_MASK) | channel; i2c_smbus_write_byte(client, data->control); /* The first byte transmitted contains the conversion code of the previous read cycle. FLUSH IT! */ i2c_smbus_read_byte(client); } value = i2c_smbus_read_byte(client); mutex_unlock(&data->update_lock); if ((channel == 2 && input_mode == 2) || (channel != 3 && (input_mode == 1 || input_mode == 3))) return (10 * REG_TO_SIGNED(value)); else return (10 * value); } static const struct i2c_device_id pcf8591_id[] = { { "pcf8591", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, pcf8591_id); static struct i2c_driver pcf8591_driver = { .driver = { .name = "pcf8591", }, .probe = pcf8591_probe, .remove = pcf8591_remove, .id_table = pcf8591_id, .class = I2C_CLASS_HWMON, /* Nearest choice */ .detect = pcf8591_detect, .address_list = normal_i2c, }; static int __init pcf8591_init(void) { if (input_mode < 0 || input_mode > 3) { printk(KERN_WARNING "pcf8591: invalid input_mode (%d)\n", input_mode); input_mode = 0; } return i2c_add_driver(&pcf8591_driver); } static void __exit pcf8591_exit(void) { i2c_del_driver(&pcf8591_driver); } MODULE_AUTHOR("Aurelien Jarno <aurelien@aurel32.net>"); MODULE_DESCRIPTION("PCF8591 driver"); MODULE_LICENSE("GPL"); module_init(pcf8591_init); module_exit(pcf8591_exit);
{ "pile_set_name": "Github" }
/** * Marlin 3D Printer Firmware * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ #pragma once /** * MRR ESPA pin assignments * MRR ESPA is a 3D printer control board based on the ESP32 microcontroller. * Supports 4 stepper drivers, heated bed, single hotend. */ #ifndef ARDUINO_ARCH_ESP32 #error "Oops! Select an ESP32 board in 'Tools > Board.'" #elif EXTRUDERS > 1 || E_STEPPERS > 1 #error "MRR ESPA only supports one E Stepper. Comment out this line to continue." #elif HOTENDS > 1 #error "MRR ESPA currently supports only one hotend. Comment out this line to continue." #endif #define BOARD_INFO_NAME "MRR ESPA" #define BOARD_WEBSITE_URL "github.com/maplerainresearch/MRR_ESPA" #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME // // Disable I2S stepper stream // #ifdef I2S_STEPPER_STREAM #undef I2S_STEPPER_STREAM #endif #define I2S_WS -1 #define I2S_BCK -1 #define I2S_DATA -1 // // Limit Switches // #define X_STOP_PIN 34 #define Y_STOP_PIN 35 #define Z_STOP_PIN 15 // // Steppers // #define X_STEP_PIN 27 #define X_DIR_PIN 26 #define X_ENABLE_PIN 25 //#define X_CS_PIN 21 #define Y_STEP_PIN 33 #define Y_DIR_PIN 32 #define Y_ENABLE_PIN X_ENABLE_PIN //#define Y_CS_PIN 22 #define Z_STEP_PIN 14 #define Z_DIR_PIN 12 #define Z_ENABLE_PIN X_ENABLE_PIN //#define Z_CS_PIN 5 // SS_PIN #define E0_STEP_PIN 16 #define E0_DIR_PIN 17 #define E0_ENABLE_PIN X_ENABLE_PIN //#define E0_CS_PIN 21 // // Temperature Sensors // #define TEMP_0_PIN 36 // Analog Input #define TEMP_BED_PIN 39 // Analog Input // // Heaters / Fans // #define HEATER_0_PIN 2 #define FAN_PIN 13 #define HEATER_BED_PIN 4 // // MicroSD card // #define MOSI_PIN 23 #define MISO_PIN 19 #define SCK_PIN 18 #define SDSS 5 #define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers // Hardware serial pins // Add the following to Configuration.h or Configuration_adv.h to assign // specific pins to hardware Serial1. // Note: Serial2 can be defined using HARDWARE_SERIAL2_RX and HARDWARE_SERIAL2_TX but // MRR ESPA does not have enough spare pins for such reassignment. //#define HARDWARE_SERIAL1_RX 21 //#define HARDWARE_SERIAL1_TX 22
{ "pile_set_name": "Github" }