text
stringlengths
2
100k
meta
dict
from cqlengine import operators from cqlengine.named import NamedKeyspace from cqlengine.operators import EqualsOperator, GreaterThanOrEqualOperator from cqlengine.query import ResultObject from cqlengine.tests.query.test_queryset import BaseQuerySetUsage from cqlengine.tests.base import BaseCassEngTestCase class TestQuerySetOperation(BaseCassEngTestCase): @classmethod def setUpClass(cls): super(TestQuerySetOperation, cls).setUpClass() cls.keyspace = NamedKeyspace('cqlengine_test') cls.table = cls.keyspace.table('test_model') def test_query_filter_parsing(self): """ Tests the queryset filter method parses it's kwargs properly """ query1 = self.table.objects(test_id=5) assert len(query1._where) == 1 op = query1._where[0] assert isinstance(op.operator, operators.EqualsOperator) assert op.value == 5 query2 = query1.filter(expected_result__gte=1) assert len(query2._where) == 2 op = query2._where[1] assert isinstance(op.operator, operators.GreaterThanOrEqualOperator) assert op.value == 1 def test_query_expression_parsing(self): """ Tests that query experessions are evaluated properly """ query1 = self.table.filter(self.table.column('test_id') == 5) assert len(query1._where) == 1 op = query1._where[0] assert isinstance(op.operator, operators.EqualsOperator) assert op.value == 5 query2 = query1.filter(self.table.column('expected_result') >= 1) assert len(query2._where) == 2 op = query2._where[1] assert isinstance(op.operator, operators.GreaterThanOrEqualOperator) assert op.value == 1 def test_filter_method_where_clause_generation(self): """ Tests the where clause creation """ query1 = self.table.objects(test_id=5) self.assertEqual(len(query1._where), 1) where = query1._where[0] self.assertEqual(where.field, 'test_id') self.assertEqual(where.value, 5) query2 = query1.filter(expected_result__gte=1) self.assertEqual(len(query2._where), 2) where = query2._where[0] self.assertEqual(where.field, 'test_id') self.assertIsInstance(where.operator, EqualsOperator) self.assertEqual(where.value, 5) where = query2._where[1] self.assertEqual(where.field, 'expected_result') self.assertIsInstance(where.operator, GreaterThanOrEqualOperator) self.assertEqual(where.value, 1) def test_query_expression_where_clause_generation(self): """ Tests the where clause creation """ query1 = self.table.objects(self.table.column('test_id') == 5) self.assertEqual(len(query1._where), 1) where = query1._where[0] self.assertEqual(where.field, 'test_id') self.assertEqual(where.value, 5) query2 = query1.filter(self.table.column('expected_result') >= 1) self.assertEqual(len(query2._where), 2) where = query2._where[0] self.assertEqual(where.field, 'test_id') self.assertIsInstance(where.operator, EqualsOperator) self.assertEqual(where.value, 5) where = query2._where[1] self.assertEqual(where.field, 'expected_result') self.assertIsInstance(where.operator, GreaterThanOrEqualOperator) self.assertEqual(where.value, 1) class TestQuerySetCountSelectionAndIteration(BaseQuerySetUsage): @classmethod def setUpClass(cls): super(TestQuerySetCountSelectionAndIteration, cls).setUpClass() from cqlengine.tests.query.test_queryset import TestModel ks,tn = TestModel.column_family_name().split('.') cls.keyspace = NamedKeyspace(ks) cls.table = cls.keyspace.table(tn) def test_count(self): """ Tests that adding filtering statements affects the count query as expected """ assert self.table.objects.count() == 12 q = self.table.objects(test_id=0) assert q.count() == 4 def test_query_expression_count(self): """ Tests that adding query statements affects the count query as expected """ assert self.table.objects.count() == 12 q = self.table.objects(self.table.column('test_id') == 0) assert q.count() == 4 def test_iteration(self): """ Tests that iterating over a query set pulls back all of the expected results """ q = self.table.objects(test_id=0) #tuple of expected attempt_id, expected_result values compare_set = set([(0,5), (1,10), (2,15), (3,20)]) for t in q: val = t.attempt_id, t.expected_result assert val in compare_set compare_set.remove(val) assert len(compare_set) == 0 # test with regular filtering q = self.table.objects(attempt_id=3).allow_filtering() assert len(q) == 3 #tuple of expected test_id, expected_result values compare_set = set([(0,20), (1,20), (2,75)]) for t in q: val = t.test_id, t.expected_result assert val in compare_set compare_set.remove(val) assert len(compare_set) == 0 # test with query method q = self.table.objects(self.table.column('attempt_id') == 3).allow_filtering() assert len(q) == 3 #tuple of expected test_id, expected_result values compare_set = set([(0,20), (1,20), (2,75)]) for t in q: val = t.test_id, t.expected_result assert val in compare_set compare_set.remove(val) assert len(compare_set) == 0 def test_multiple_iterations_work_properly(self): """ Tests that iterating over a query set more than once works """ # test with both the filtering method and the query method for q in (self.table.objects(test_id=0), self.table.objects(self.table.column('test_id') == 0)): #tuple of expected attempt_id, expected_result values compare_set = set([(0,5), (1,10), (2,15), (3,20)]) for t in q: val = t.attempt_id, t.expected_result assert val in compare_set compare_set.remove(val) assert len(compare_set) == 0 #try it again compare_set = set([(0,5), (1,10), (2,15), (3,20)]) for t in q: val = t.attempt_id, t.expected_result assert val in compare_set compare_set.remove(val) assert len(compare_set) == 0 def test_multiple_iterators_are_isolated(self): """ tests that the use of one iterator does not affect the behavior of another """ for q in (self.table.objects(test_id=0), self.table.objects(self.table.column('test_id') == 0)): q = q.order_by('attempt_id') expected_order = [0,1,2,3] iter1 = iter(q) iter2 = iter(q) for attempt_id in expected_order: assert next(iter1).attempt_id == attempt_id assert next(iter2).attempt_id == attempt_id def test_get_success_case(self): """ Tests that the .get() method works on new and existing querysets """ m = self.table.objects.get(test_id=0, attempt_id=0) assert isinstance(m, ResultObject) assert m.test_id == 0 assert m.attempt_id == 0 q = self.table.objects(test_id=0, attempt_id=0) m = q.get() assert isinstance(m, ResultObject) assert m.test_id == 0 assert m.attempt_id == 0 q = self.table.objects(test_id=0) m = q.get(attempt_id=0) assert isinstance(m, ResultObject) assert m.test_id == 0 assert m.attempt_id == 0 def test_query_expression_get_success_case(self): """ Tests that the .get() method works on new and existing querysets """ m = self.table.get(self.table.column('test_id') == 0, self.table.column('attempt_id') == 0) assert isinstance(m, ResultObject) assert m.test_id == 0 assert m.attempt_id == 0 q = self.table.objects(self.table.column('test_id') == 0, self.table.column('attempt_id') == 0) m = q.get() assert isinstance(m, ResultObject) assert m.test_id == 0 assert m.attempt_id == 0 q = self.table.objects(self.table.column('test_id') == 0) m = q.get(self.table.column('attempt_id') == 0) assert isinstance(m, ResultObject) assert m.test_id == 0 assert m.attempt_id == 0 def test_get_doesnotexist_exception(self): """ Tests that get calls that don't return a result raises a DoesNotExist error """ with self.assertRaises(self.table.DoesNotExist): self.table.objects.get(test_id=100) def test_get_multipleobjects_exception(self): """ Tests that get calls that return multiple results raise a MultipleObjectsReturned error """ with self.assertRaises(self.table.MultipleObjectsReturned): self.table.objects.get(test_id=1)
{ "pile_set_name": "Github" }
import {get,post} from './request'; //登陆 export const login= (login)=>post('/api/post/user/login',login) //上传 export const upload=(upload)=>get('/api/get/upload',upload)
{ "pile_set_name": "Github" }
<template> <div class="celebrity-list"> <ul> <li class="celebrity-item" v-for="item in celebrities" @click="selectItem(item.id,$event)"> <div class="image"> <img v-lazy="item.image" class="" height="100" width="70"> </div> <div class="desc"> <p class="title">{{item.name}}</p> <div class="works">代表作: {{item.works}}</div> </div> </li> </ul> </div> </template> <script type="text/ecmascript-6"> export default { props: { celebrities: { type: Array, default: [] } }, methods: { selectItem(id) { this.$emit('select', id); } } }; </script> <style scoped lang="stylus" rel="stylesheet/stylus"> @import "../../common/stylus/variable.styl" @import "../../common/stylus/mixin.styl" .celebrity-item display: flex align-items: top box-sizing: border-box height: 130px padding: 15px border-bottom-1px($color-line) background: $color-background .image flex: 70px 0 0 margin-right: 10px .desc flex: 1 box-sizing: border-box .title font-size: $font-size-medium-x color: $color-text-f .works margin-top: 10px font-size: $font-size-medium line-height: 20px </style>
{ "pile_set_name": "Github" }
# Blender MTL File: 'None' # Material Count: 1 newmtl Standard Ns 96.078431 Ka 0.000000 0.000000 0.000000 Kd 0.690196 0.690196 0.690196 Ks 0.012549 0.012549 0.012549 Ni 1.000000 d 1.000000 illum 2 map_Kd grid_fabric.jpg
{ "pile_set_name": "Github" }
activeContentFilterList=*.makefile,makefile,*.Makefile,Makefile,Makefile.*,*.mk,MANIFEST.MF addNewLine=true convertActionOnSaave=AnyEdit.CnvrtSpacesToTabs eclipse.preferences.version=1 ignoreBlankLinesWhenTrimming=false inActiveContentFilterList= javaTabWidthForJava=true org.eclipse.jdt.ui.editor.tab.width=2 projectPropsEnabled=true removeTrailingSpaces=true replaceAllSpaces=false replaceAllTabs=false saveAndAddLine=false saveAndConvert=true saveAndTrim=true useModulo4Tabs=false
{ "pile_set_name": "Github" }
/* Soot - a J*va Optimization Framework * Copyright (C) 1997-1999 Raja Vallee-Rai * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /* * Modified by the Sable Research Group and others 1997-1999. * See the 'credits' file distributed with Soot for the complete list of * contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot) */ package soot.jimple; import soot.*; import soot.util.*; public interface CastExpr extends Expr { public Value getOp(); public void setOp(Value op); public ValueBox getOpBox(); public Type getCastType(); public void setCastType(Type castType); public Type getType(); public void apply(Switch sw); }
{ "pile_set_name": "Github" }
/* This file is part of the OWL API. * The contents of this file are subject to the LGPL License, Version 3.0. * Copyright 2014, The University of Manchester * * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. * * Alternatively, the contents of this file may be used under the terms of the Apache License, Version 2.0 in which case, the provisions of the Apache License Version 2.0 are applicable instead of those above. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.semanticweb.owlapi.io; import static org.semanticweb.owlapi.util.OWLAPIPreconditions.checkNotNull; import static org.semanticweb.owlapi.util.OWLAPIPreconditions.emptyOptional; import static org.semanticweb.owlapi.util.OWLAPIPreconditions.optional; import java.io.BufferedOutputStream; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStream; import java.io.Writer; import java.util.Optional; import org.semanticweb.owlapi.model.IRI; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * An {@code OWLOntologyDocumentTarget} that supports writing out to a * {@code File}. * * @author Matthew Horridge, The University of Manchester, Bio-Health Informatics Group * @since 3.2.0 */ public class FileDocumentTarget implements OWLOntologyDocumentTarget { private static final Logger LOGGER = LoggerFactory.getLogger(FileDocumentTarget.class); private final File file; /** * Constructs the document target, with the target being the specified file. * * @param file The file that is the target. */ public FileDocumentTarget(File file) { this.file = checkNotNull(file, "file cannot be null"); } @Override public Optional<Writer> getWriter() { try { return optional(new BufferedWriter(new FileWriter(file))); } catch (IOException e) { LOGGER.error("Writer cannot be created", e); return emptyOptional(); } } @Override public Optional<OutputStream> getOutputStream() { try { return optional(new BufferedOutputStream(new FileOutputStream(file))); } catch (IOException e) { LOGGER.error("Input stream cannot be created", e); return emptyOptional(); } } @Override public Optional<IRI> getDocumentIRI() { return optional(IRI.create(file)); } }
{ "pile_set_name": "Github" }
// Learn more about F# at http://fsharp.net // See the 'F# Tutorial' project for more help. open ServiceStack.Common open ServiceStack.WebHost.Endpoints open ServiceStack.Logging open ServiceStack.Logging.Support.Logging open HelloService open System type AppHost() = inherit AppHostHttpListenerBase("Hello F# Service", typeof<HelloService>.Assembly) override this.Configure container = ignore() [<EntryPoint>] let main argv = LogManager.LogFactory <- new ConsoleLogFactory() printfn "%A" argv let host = "http://localhost:8080/" printfn "listening on %s ..." host let appHost = new AppHost() appHost.Init() appHost.Start host while true do Console.ReadLine() |> ignore 0 // return an integer exit code
{ "pile_set_name": "Github" }
export interface Size { width: number; height: number; };
{ "pile_set_name": "Github" }
'use strict'; module.exports = function(Chart) { Chart.Radar = function(context, config) { config.type = 'radar'; return new Chart(context, config); }; };
{ "pile_set_name": "Github" }
$NetBSD: patch-Rakefile,v 1.3 2017/06/05 16:06:57 taca Exp $ * Require modern task rule from rdoc. * Drop task for release. --- Rakefile.orig 2007-03-23 11:32:09.000000000 +0000 +++ Rakefile @@ -1,13 +1,11 @@ require "rbconfig" require "rake/clean" require "rake/testtask" -require "rake/rdoctask" +require "rdoc/task" require "rake/packagetask" -require "rake/contrib/compositepublisher" -require "rake/contrib/sshpublisher" -require "rake/configuretask" -require "rake/extensiontask" +require_relative "rake/configuretask" +require_relative "rake/extensiontask" PKG_NAME = "ruby-eet" PKG_VERSION = File.read("lib/eet.rb"). @@ -43,6 +41,9 @@ task :pre_ext => [:configure] do cflags = [ ext.env[:cflags], + "-I#{RbConfig::CONFIG["rubyhdrdir"]}", + "-I#{RbConfig::CONFIG["rubyhdrdir"]}/ruby", + "-I#{RbConfig::CONFIG["rubyhdrdir"]}/#{RbConfig::CONFIG["arch"]}", config.eet.cflags ] @@ -52,11 +53,11 @@ end task :install => [:ext] do |t| destdir = ENV["DESTDIR"] || "" - ddir = destdir + Config::CONFIG["sitearchdir"] + ddir = destdir + RbConfig::CONFIG["sitearchdir"] FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir) FileUtils::Verbose.install(ext.lib_name, ddir, :mode => 0755) - ddir = destdir + Config::CONFIG["sitelibdir"] + ddir = destdir + RbConfig::CONFIG["sitelibdir"] FileUtils::Verbose.mkdir_p(ddir) unless File.directory?(ddir) FileUtils::Verbose.install("lib/eet.rb", ddir, :mode => 0644) end @@ -87,14 +88,3 @@ Rake::PackageTask.new(PKG_NAME, PKG_VERS t.need_tar_gz = true t.package_files = PKG_FILES end - -task :publish => [:rdoc, :package] do - p = Rake::CompositePublisher.new - p.add(Rake::SshFreshDirPublisher.new("code-monkey.de", - "public_docs/" + - PKG_NAME, "doc")) - p.add(Rake::SshFilePublisher.new("code-monkey.de", - ".", "pkg", - "#{PKG_NAME}-#{PKG_VERSION}.tar.gz")) - p.upload -end
{ "pile_set_name": "Github" }
#Updated at Fri Sep 21 12:24:06 EDT 2012 #Fri Sep 21 12:24:06 EDT 2012 application_version=1.0 com.jd.survey.domain.settings.department_label=Dipartimento com.jd.survey.domain.settings.department_label_short=Dipartimento com.jd.survey.domain.settings.department_label_plural=Dipartimenti com.jd.survey.domain.settings.department.id_label=ID com.jd.survey.domain.settings.department.version_label=Versione com.jd.survey.domain.settings.department.name_label=Nome com.jd.survey.domain.settings.department.description_label=Descrizione com.jd.survey.domain.settings.department.surveys_label=Nome sondaggio com.jd.survey.domain.settings.department_menu=Dipartimenti com.jd.survey.domain.settings.department_list_menu=Dipartimenti com.jd.survey.domain.settings.department_new_menu=Dipartimento com.jd.survey.domain.settings.department.surveydefinition.name_label=Nome della definizione di sondaggio com.jd.survey.domain.settings.department.surveydefinition.file_label=File di definizione di sondaggio #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.surveydefinition_label=Sondaggio com.jd.survey.domain.settings.surveydefinition_label_short=Sondaggio com.jd.survey.domain.settings.surveydefinition_label_plural=Sondaggi com.jd.survey.domain.settings.surveydefinition.id_label=ID com.jd.survey.domain.settings.surveydefinition.version_label=Versione com.jd.survey.domain.settings.surveydefinition.name_label=Nome com.jd.survey.domain.settings.surveydefinition.logo_label=Immagine del logo com.jd.survey.domain.settings.surveydefinition.description_label=Descrizione com.jd.survey.domain.settings.surveydefinition.department_label=Nome del reparto com.jd.survey.domain.settings.surveydefinition.pages_label=Pagine com.jd.survey.domain.settings.surveydefinition_menu=Sondaggi com.jd.survey.domain.settings.surveydefinition_list_menu=Sondaggi com.jd.survey.domain.settings.surveydefinition_new_menu=Sondaggio com.jd.survey.domain.settings.surveydefinition.ispublic_label=Disponibile al pubblico com.jd.survey.domain.settings.surveydefinition.status_label=Status com.jd.survey.domain.settings.surveydefinition.allowmultiplesubmissions_label=Permettono molte osservazioni com.jd.survey.domain.settings.surveydefinition.isavailabletopublic_label=Public com.jd.survey.domain.settings.surveydefinition.surveytheme_label=Tema com.jd.survey.domain.settings.surveydefinition.emailinvitationtemplate_label=Modello invito e-mail com.jd.survey.domain.settings.surveydefinition.completedsurveytemplate_label=Sondaggio completato template\t\t #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.questionoption_label=Opzione di domanda com.jd.survey.domain.settings.questionoption_label_short=Opzione di domanda com.jd.survey.domain.settings.questionoption_label_plural=Opzioni di interrogazione com.jd.survey.domain.settings.questionoption.id_label=ID com.jd.survey.domain.settings.questionoption.version_label=Versione com.jd.survey.domain.settings.questionoption.order_label=Elemento ordine com.jd.survey.domain.settings.questionoption.value_label=Valore dell'elemento com.jd.survey.domain.settings.questionoption.value_tip=Immettere un massimo di 3 personaggi qui com.jd.survey.domain.settings.questionoption.text_label=Testo di un elemento com.jd.survey.domain.settings.questionoption.question_label=Domanda com.jd.survey.domain.settings.questionoption_menu=Opzioni di interrogazione com.jd.survey.domain.settings.questionoption_list_menu=Opzioni di interrogazione com.jd.survey.domain.settings.questionoption_new_menu=Opzione di domanda #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.questionrowlabel_label=Etichetta di riga com.jd.survey.domain.settings.questionrowlabel_label_short=Etichetta di riga com.jd.survey.domain.settings.questionrowlabel_label_plural=Etichette di riga com.jd.survey.domain.settings.questionrowlabel.id_label=ID com.jd.survey.domain.settings.questionrowlabel.version_label=Versione com.jd.survey.domain.settings.questionrowlabel.order_label=Ordine delle righe com.jd.survey.domain.settings.questionrowlabel.label_tip=Immettere un massimo di 75 caratteri qui com.jd.survey.domain.settings.questionrowlabel.label_label=Etichetta di riga com.jd.survey.domain.settings.questionrowlabel.question_label=Domanda #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.questioncolumnlabel_label=Etichetta di colonna com.jd.survey.domain.settings.questioncolumnlabel_label_short=Etichetta di colonna com.jd.survey.domain.settings.questioncolumnlabel_label_plural=Etichette di colonna com.jd.survey.domain.settings.questioncolumnlabel.id_label=ID com.jd.survey.domain.settings.questioncolumnlabel.version_label=Versione com.jd.survey.domain.settings.questioncolumnlabel.order_label=Ordine delle colonne com.jd.survey.domain.settings.questioncolumnlabel.label_tip=Immettere un massimo di 75 caratteri qui com.jd.survey.domain.settings.questioncolumnlabel.label_label=Etichetta di colonna com.jd.survey.domain.settings.questioncolumnlabel.question_label=Domanda #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.surveydefinitionpage_label=Pagina sondaggio com.jd.survey.domain.settings.surveydefinitionpage_label_short=Pagina com.jd.survey.domain.settings.surveydefinitionpage_label_plural=Pagine di indagine com.jd.survey.domain.settings.surveydefinitionpage.id_label=ID com.jd.survey.domain.settings.surveydefinitionpage.version_label=Versione com.jd.survey.domain.settings.surveydefinitionpage.instructions_label=Istruzioni com.jd.survey.domain.settings.surveydefinitionpage.order_label=Ordine com.jd.survey.domain.settings.surveydefinitionpage.title_label=Titolo com.jd.survey.domain.settings.surveydefinitionpage.department.name_label=Nome del reparto com.jd.survey.domain.settings.surveydefinitionpage.surveydefinition.name_label=Nome sondaggio com.jd.survey.domain.settings.surveydefinitionpage.surveydefinition.description_label=Sondaggio Descrizione com.jd.survey.domain.settings.surveydefinitionpage.questions_label=Domande com.jd.survey.domain.settings.surveydefinitionpage.visibilityexpression_tip=MVEL espressione che restituisce true o false. utilizzare questo per ramificazione avanzato e che si biforcano. com.jd.survey.domain.settings.surveydefinitionpage.visibilityexpression_label=Espressione di visibilità com.jd.survey.domain.settings.surveydefinitionpage_menu=Pagine di indagine com.jd.survey.domain.settings.surveydefinitionpage_list_menu=Pagine di indagine com.jd.survey.domain.settings.surveydefinitionpage_new_menu=Pagina com.jd.survey.domain.settings.surveydefinitionpage.randomizequestions_label=Domande in modo casuale #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- #com.jd.survey.domain.settings.questiontype_label=Question Type #com.jd.survey.domain.settings.questiontype_label_short=Page #com.jd.survey.domain.settings.questiontype_label_plural=Question Types #com.jd.survey.domain.settings.questiontype.id_label=Id #com.jd.survey.domain.settings.questiontype.version_label=Version #com.jd.survey.domain.settings.questiontype.name_label=Name #com.jd.survey.domain.settings.questiontype.text_label=Text #com.jd.survey.domain.settings.questiontype.description_label=Description #com.jd.survey.domain.settings.questiontype_menu=Question Types #com.jd.survey.domain.settings.questiontype_list_menu=Question Types #com.jd.survey.domain.settings.questiontype_new_menu=Question Type #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.datasetitem_label=Elemento DataSet com.jd.survey.domain.settings.datasetitem_label_short=Elemento DataSet com.jd.survey.domain.settings.datasetitem_label_plural=Oggetti DataSet com.jd.survey.domain.settings.datasetitem.id_label=ID com.jd.survey.domain.settings.datasetitem.version_label=Versione com.jd.survey.domain.settings.datasetitem.order_label=Ordine com.jd.survey.domain.settings.datasetitem.value_label=Valore com.jd.survey.domain.settings.datasetitem.value_tip=Immettere un massimo di 10 caratteri qui com.jd.survey.domain.settings.datasetitem.text_label=Testo com.jd.survey.domain.settings.datasetitem.question_label=Domanda com.jd.survey.domain.settings.datasetitem_menu=Oggetti DataSet com.jd.survey.domain.settings.datasetitem_list_menu=Oggetti DataSet com.jd.survey.domain.settings.datasetitem_new_menu=Elemento DataSet #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.question_header_label=Informazioni domanda com.jd.survey.domain.settings.question_validation_label=Informazioni di convalida com.jd.survey.domain.settings.question_label=Domanda com.jd.survey.domain.settings.question_label_short=Domanda com.jd.survey.domain.settings.question_label_plural=Domande com.jd.survey.domain.settings.question.id_label=ID com.jd.survey.domain.settings.question.version_label=Versione com.jd.survey.domain.settings.question.page_label=Pagina com.jd.survey.domain.settings.question.type_label=Tipo di domanda com.jd.survey.domain.settings.question.direction_label=Direzione com.jd.survey.domain.settings.question.allowothertextbox_label=Consentire l'altro com.jd.survey.domain.settings.question.visible_label=Visibile com.jd.survey.domain.settings.question.order_label= Ordine di domande com.jd.survey.domain.settings.question.datasetcode_label=DataSet com.jd.survey.domain.settings.question.questiontext_label=Testo della domanda com.jd.survey.domain.settings.question.tip_label=Punta com.jd.survey.domain.settings.question.regularexpresion_label=Espressione regolare com.jd.survey.domain.settings.question.options_label=Opzioni com.jd.survey.domain.settings.question_menu=Domanda com.jd.survey.domain.settings.question_list_menu=Domande com.jd.survey.domain.settings.question_new_menu=Domanda com.jd.survey.domain.settings.question.required_label=Obbligatorio com.jd.survey.domain.settings.question.integerminimum_label=Valore integer minimo com.jd.survey.domain.settings.question.integermaximum_label=Integer massimo com.jd.survey.domain.settings.question.longminimum_label=Lunghezza minima com.jd.survey.domain.settings.question.longmaximum_label=Lunghezza massima com.jd.survey.domain.settings.question.doubleminimum_label=Doppio minimo com.jd.survey.domain.settings.question.doublemaximum_label=Doppio massimo com.jd.survey.domain.settings.question.dateminimum_label=Data minima com.jd.survey.domain.settings.question.datemaximum_label=Data massima com.jd.survey.domain.settings.question.decimalminimum_label=Decimal minimo com.jd.survey.domain.settings.question.decimalmaximum_label=Massimo decimale com.jd.survey.domain.settings.question.multimedialink_label=Link a file multimediali com.jd.survey.domain.settings.question.height_label=Altezza com.jd.survey.domain.settings.question.width_label=Larghezza com.jd.survey.domain.settings.question.randomize_label=Le opzioni in modo casuale #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.security.group_label=Gruppo com.jd.survey.domain.security.group.internal_label=Gruppo interno com.jd.survey.domain.security.group.external_label=Gruppo esterno com.jd.survey.domain.security.group_label_short=Gruppo com.jd.survey.domain.security.group_label_plural=Gruppi com.jd.survey.domain.security.group.id_label=ID com.jd.survey.domain.security.group.version_label=Versione com.jd.survey.domain.security.group.type_label=Tipo com.jd.survey.domain.security.group.name_label=Nome com.jd.survey.domain.security.group.description_label=Descrizione com.jd.survey.domain.security.group.authorities_label=Autorita  com.jd.survey.domain.security.group_menu=Gruppi com.jd.survey.domain.security.group_list_menu=Gruppi com.jd.survey.domain.security.group_new_menu=Gruppo #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.security.user_label=Utente com.jd.survey.domain.security.user.internal_label=Utente interno com.jd.survey.domain.security.user.external_label=Utente esterno com.jd.survey.domain.security.user_label_short=Utente com.jd.survey.domain.security.user_label_plural=Utenti com.jd.survey.domain.security.user_internal_label_plural=Utenti interni com.jd.survey.domain.security.user_external_label_plural=Utenti esterni com.jd.survey.domain.security.user.id_label=ID com.jd.survey.domain.security.user.version_label=Versione com.jd.survey.domain.security.user.type_label=Tipo com.jd.survey.domain.security.user.login_label=Login (indirizzo e-mail) com.jd.survey.domain.security.user.firstname_label=Primo Nome com.jd.survey.domain.security.user.middlename_label=Middle name com.jd.survey.domain.security.user.lastname_label=Cognome #### com.jd.survey.domain.security.user.search_label=Ricerca per: com.jd.survey.domain.security.user.name_label=Nome com.jd.survey.domain.security.user.dateofbirth_label=Data di nascita com.jd.survey.domain.security.user.email_label=Posta elettronica com.jd.survey.domain.security.user.password_label=Password com.jd.survey.domain.security.user.cofirmpassword_label=Conferma password com.jd.survey.domain.security.user.enabled_label=Abilitato com.jd.survey.domain.security.user_menu=Utenti com.jd.survey.domain.security.user_list_menu=Utenti com.jd.survey.domain.security.user_new_menu=Utente #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.security.authority_label=Ruolo com.jd.survey.domain.security.authority_label_short=Ruolo com.jd.survey.domain.security.authority_label_plural= Ruoli di sistema com.jd.survey.domain.security.authority.version_label=Versione com.jd.survey.domain.security.authority.name_label=Nome com.jd.survey.domain.security.authority.type_label=Tipo com.jd.survey.domain.security.authority.description_label=Descrizione com.jd.survey.domain.security.authority.id=Identificazione del ruolo com.jd.survey.domain.security.authority_menu=Ruoli com.jd.survey.domain.security.authority_list_menu=Ruoli com.jd.survey.domain.security.authority_new_menu=Ruolo #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.velocitytemplate_label=Modello com.jd.survey.domain.settings.velocitytemplate_label_short=Modello com.jd.survey.domain.settings.velocitytemplate_label_plural=Modelli com.jd.survey.domain.settings.velocitytemplate.id_label=ID com.jd.survey.domain.settings.velocitytemplate.version_label=Versione com.jd.survey.domain.settings.velocitytemplate.name_label=Nome com.jd.survey.domain.settings.velocitytemplate.definition_label=Definizione com.jd.survey.domain.settings.velocitytemplate_menu=Modelli com.jd.survey.domain.settings.velocitytemplate_list_menu=Modelli com.jd.survey.domain.settings.velocitytemplate_new_menu=Modello #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.dataset_label=DataSet com.jd.survey.domain.settings.dataset_label_short=DataSet com.jd.survey.domain.settings.dataset_label_plural=DataSet com.jd.survey.domain.settings.dataset.id_label=ID com.jd.survey.domain.settings.dataset.version_label=Versione com.jd.survey.domain.settings.dataset.code_label=Identificatore univoco (codice) com.jd.survey.domain.settings.dataset.name_label=Nome com.jd.survey.domain.settings.dataset.description_label=Descrizione com.jd.survey.domain.settings.dataset.items_label=Elementi com.jd.survey.domain.settings.dataset_menu=DataSet com.jd.survey.domain.settings.dataset_list_menu=DataSet com.jd.survey.domain.settings.dataset_new_menu=DataSet com.jd.survey.domain.settings.datasetitem.dataset_label=DataSet #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.surveygroup_menu=Menu gruppo di indagine #-------------------------------------------------------------------------------------------------- #added on 11-19-2012 #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.surveystatistic_label=Statistica di indagine com.jd.survey.domain.settings.surveystatistic_label_short=Statistica di indagine com.jd.survey.domain.settings.surveystatistic_label_plural=Indagine statistica com.jd.survey.domain.survey.surveystatistic.surveydefinitionid_label=Id di indagine com.jd.survey.domain.survey.surveystatistic.departmentname_label=Nome del reparto com.jd.survey.domain.survey.surveystatistic.surveyname_label=Nome sondaggio com.jd.survey.domain.survey.surveystatistic.icompletedcount_label=Incompleta com.jd.survey.domain.survey.surveystatistic.submittedcount_label=Completato com.jd.survey.domain.survey.surveystatistic.deletedcount_label=Eliminato com.jd.survey.domain.survey.surveystatistic.totalcount_label=Totale #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.questionstatistic_label=Statistiche di domanda com.jd.survey.domain.settings.questionstatistic_label_short=Statistiche com.jd.survey.domain.settings.questionstatistic_label_plural=Statistiche di domanda com.jd.survey.domain.survey.questionstatistic.entry_label=Voce com.jd.survey.domain.survey.questionstatistic.count_label=Conte com.jd.survey.domain.survey.questionstatistic.min_label=Minimo com.jd.survey.domain.survey.questionstatistic.max_label=Massimo com.jd.survey.domain.survey.questionstatistic.average_label=Media com.jd.survey.domain.survey.questionstatistic.frequency_label=Frequenza com.jd.survey.domain.survey.questionstatistic.samplestandarddeviation_label=Deviazione STD com.jd.survey.domain.survey.questionstatistic.values_label=Valori com.jd.survey.domain.survey.surveystatistic.answer_label=Opzioni com.jd.survey.domain.survey.questionstatistic.chart_label=Grafico com.jd.survey.domain.surveyentry_label=Sondaggio voce informazioni com.jd.survey.domain.surveyentry.surveyid_label=Id di indagine com.jd.survey.domain.surveyentry.surveydefinitionid_label=Id della definizione di sondaggio com.jd.survey.domain.surveyentry.departmentname_label=Nome del reparto com.jd.survey.domain.surveyentry.surveyname_label=Nome sondaggio com.jd.survey.domain.surveyentry.createdbylogin_label=Creato da login com.jd.survey.domain.surveyentry.createdbyipaddress_label=Indirizzo IP com.jd.survey.domain.surveyentry.createdbyfullname_label=Creato da com.jd.survey.domain.surveyentry.createdbyfirstname_label=Creato da Nome com.jd.survey.domain.surveyentry.createdbymiddlename_label=Creato da middle name com.jd.survey.domain.surveyentry.createdbylastname_label=Creato da cognome com.jd.survey.domain.surveyentry.creationdate_label=Data di creazione com.jd.survey.domain.surveyentry.lastupdatedate_label=Data ultimo aggiornamento com.jd.survey.domain.surveyentry.submissiondate_label=Data di completamento com.jd.survey.domain.surveyentry.status_label=Status #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.survey_label_short=Sondaggio com.jd.survey.domain.survey_label=Sondaggio com.jd.survey.domain.survey_label_plural=Sondaggi com.jd.survey.domain.survey.id_label=ID com.jd.survey.domain.survey.version_label=Versione com.jd.survey.domain.survey.typename_label=Nome sondaggio com.jd.survey.domain.survey.ipaddress_label=Indirizzo IP com.jd.survey.domain.survey.creationdate_label=Data di creazione com.jd.survey.domain.survey.lastupdatedate_label=Data ultimo aggiornamento com.jd.survey.domain.survey.submissiondate_label=Data di presentazione com.jd.survey.domain.survey.status_label=Status com.jd.survey.domain.survey.pages_label=Pagine #-------------------------------------------------------------------------------------------------- #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.survey.surveypage_label=Pagina sondaggio com.jd.survey.domain.survey.surveypage_label_short=Pagina com.jd.survey.domain.survey.surveypage_label_plural=Pagine di indagine com.jd.survey.domain.survey.surveypage.id_label=ID com.jd.survey.domain.survey.surveypage.version_label=Versione com.jd.survey.domain.survey.surveypage.order_label=Ordine com.jd.survey.domain.survey.surveypage.title_label=Titolo com.jd.survey.domain.survey.surveypage.instructions_label=Istruzioni #-------------------------------------------------------------------------------------------------- com.jd.survey.domain.survey_new_menu = Nuovo #------------------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.regularexpression_label=Maschera com.jd.survey.domain.settings.regularexpression_label_short=Maschera com.jd.survey.domain.settings.regularexpression_label_plural=Maschere com.jd.survey.domain.settings.regularexpression.id_label=ID com.jd.survey.domain.settings.regularexpression.version_label= Versione com.jd.survey.domain.settings.regularexpression.name_label=Nome com.jd.survey.domain.settings.regularexpression.regex_label=Regex com.jd.survey.domain.settings.regularexpression.description_label=Descrizione com.jd.survey.domain.settings.regularexpression_new_menu=Maschera com.jd.survey.domain.settings.question.regularexpression_label=Maschera #------------------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.invitation_label=Sondaggio invito com.jd.survey.domain.settings.invitation_label_short=Invito com.jd.survey.domain.settings.invitation_label_plural=Inviti com.jd.survey.domain.settings.invitation.id_label=ID com.jd.survey.domain.settings.invitation.version_label=Versione com.jd.survey.domain.settings.invitation.invitationemailsentdate_label=Data email inviata com.jd.survey.domain.settings.invitation.invitationemailopeneddate_label=e-mail open data com.jd.survey.domain.settings.invitation.firstname_label=Primo Nome com.jd.survey.domain.settings.invitation.middlename_label=Middle name com.jd.survey.domain.settings.invitation.lastname_label=Cognome com.jd.survey.domain.settings.invitation.fullname_label=Nome e cognome com.jd.survey.domain.settings.invitation.email_label=Posta elettronica com.jd.survey.domain.settings.invitation.surveydefinition_label=Sondaggio com.jd.survey.domain.settings.invitation.totalsent_label=Email totale inviti inviati com.jd.survey.domain.settings.invitation.totalopened_label=Totali inviti e-mail aperto #----------------------------------------------Password reset com.jd.survey.domain.security.user.confirmnewpassword_label=Conferma password com.jd.survey.domain.security.user.oldpassword_label=password corrente #--------------------------------------------------------------------- com.jd.survey.domain.security.myaccount_update_label=aggiornare il mio account com.jd.survey.domain.security.myaccount_show_label=Visualizza il mio account #Sector--------------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.sector_label=Settore com.jd.survey.domain.settings.sector_label_short=Settore com.jd.survey.domain.settings.sector_label_plural=Settori com.jd.survey.domain.settings.sector.id_label=ID com.jd.survey.domain.settings.sector.version_label=Versione com.jd.survey.domain.settings.sector.name_label=Nome com.jd.survey.domain.settings.sector.description_label=Descrizione com.jd.survey.domain.settings.sector_menu=Settori com.jd.survey.domain.settings.sector_list_menu=Settori com.jd.survey.domain.settings.sector_new_menu=Settore com.jd.survey.domain.settings.sector.title_label=Selezionare Modello com.jd.survey.domain.settings.sector.surveytemplate_label_plural=Modelli di indagine #SurveyTemplate-------------------------------------------------------------------------------------------- com.jd.survey.domain.settings.surveytemplate_label=Modello di indagine com.jd.survey.domain.settings.surveytemplate_label_short=Modello di indagine com.jd.survey.domain.settings.surveytemplate_label_plural=Modelli di indagine com.jd.survey.domain.settings.surveytemplate.id_label=ID com.jd.survey.domain.settings.surveytemplate.version_label=Versione com.jd.survey.domain.settings.surveytemplate.name_label=Nome com.jd.survey.domain.settings.surveytemplate.description_label=Descrizione com.jd.survey.domain.settings.surveytemplate_menu=Modelli di indagine com.jd.survey.domain.settings.surveytemplate_list_menu=Modelli di indagine com.jd.survey.domain.settings.surveytemplate_new_menu=Modello di indagine com.jd.survey.domain.settings.surveytemplate.title_label=Importare da Modello di indagine com.jd.survey.domain.settings.surveytemplate.saveTemplate_label=Salvare come Modello di indagine
{ "pile_set_name": "Github" }
# normalize-url [![Build Status](https://travis-ci.org/sindresorhus/normalize-url.svg?branch=master)](https://travis-ci.org/sindresorhus/normalize-url) > [Normalize](http://en.wikipedia.org/wiki/URL_normalization) a URL Useful when you need to display, store, deduplicate, sort, compare, etc, URLs. ## Install ``` $ npm install --save normalize-url ``` ## Usage ```js const normalizeUrl = require('normalize-url'); normalizeUrl('sindresorhus.com'); //=> 'http://sindresorhus.com' normalizeUrl('HTTP://xn--xample-hva.com:80/?b=bar&a=foo'); //=> 'http://êxample.com/?a=foo&b=bar' ``` ## API ### normalizeUrl(url, [options]) #### url Type: `String` URL to normalize. #### options ##### normalizeProtocol Type: `Boolean`<br> Default: `true` Prepend `http:` to the URL if it's protocol-relative. ```js normalizeUrl('//sindresorhus.com:80/'); //=> 'http://sindresorhus.com' normalizeUrl('//sindresorhus.com:80/', {normalizeProtocol: false}); //=> '//sindresorhus.com' ``` ##### stripFragment Type: `Boolean`<br> Default: `true` Remove the fragment at the end of the URL. ```js normalizeUrl('sindresorhus.com/about.html#contact'); //=> 'http://sindresorhus.com/about.html' normalizeUrl('sindresorhus.com/about.html#contact', {stripFragment: false}); //=> 'http://sindresorhus.com/about.html#contact' ``` ##### stripWWW Type: `Boolean`<br> Default: `true` Remove `www.` from the URL. ```js normalizeUrl('http://www.sindresorhus.com/about.html#contact'); //=> 'http://sindresorhus.com/about.html#contact' normalizeUrl('http://www.sindresorhus.com/about.html#contact', {stripWWW: false}); //=> 'http://www.sindresorhus.com/about.html#contact' ``` ##### removeQueryParameters Type: `Array<RegExp|String>`<br> Default: `[/^utm_\w+/i]` Remove query parameters that matches any of the provided strings or regexes. ```js normalizeUrl('www.sindresorhus.com?foo=bar&ref=test_ref', { ignoredQueryParameters: ['ref'] }); //=> 'http://sindresorhus.com/?foo=bar' ``` ## Related - [compare-urls](https://github.com/sindresorhus/compare-urls) - Compare URLs by first normalizing them ## License MIT © [Sindre Sorhus](https://sindresorhus.com)
{ "pile_set_name": "Github" }
# Lines starting with '#' and sections without content # are not displayed by a call to 'details' # [Website] http://news.inews24.com/php/news_view.php?g_menu=020800&g_serial=659627 [filters] http://news.inews24.com/php/ad/rolling/ifr_right_jshopbox_k123.php http://news.inews24.com/php/ad/rolling/news/news_260_1th.html http://news.inews24.com/php/ad/rolling/news/news_260_2nd.html http://www.inews24.com/images/adpresso/446.gif [other] # Any other details [comments] fanboy
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- * Scicos * * Copyright (C) INRIA - METALAU Project <[email protected]> (HTML version) * Copyright (C) DIGITEO - Scilab Consortium (XML Docbook version) * * 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. * * See the file ./license.txt --> <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="GENERAL_f" xml:lang="en_US"> <refnamediv> <refname>GENERAL_f</refname> <refpurpose>GENERAL_f title</refpurpose> </refnamediv> <refsection> <title>Block Screenshot</title> <inlinemediaobject> <imageobject> <imagedata fileref="../../../../images/palettes/GENERAL_f.png" align="center"/> </imageobject> </inlinemediaobject> </refsection> <refsection id="Contents_GENERAL_f"> <title>Contents</title> <itemizedlist> <listitem> <xref linkend="Description_GENERAL_f">Description</xref> </listitem> <listitem> <xref linkend="Dialogbox_GENERAL_f">Parameters</xref> </listitem> <listitem> <xref linkend="Defaultproperties_GENERAL_f">Default properties</xref> </listitem> <listitem> <xref linkend="Interfacingfunction_GENERAL_f">Interfacing function</xref> </listitem> <listitem> <xref linkend="Computationalfunction_GENERAL_f">Computational function</xref> </listitem> </itemizedlist> </refsection> <refsection id="Description_GENERAL_f"> <title>Description</title> <para> Add here a paragraph of the function description </para> </refsection> <refsection id="Dialogbox_GENERAL_f"> <title>Parameters</title> <inlinemediaobject> <imageobject> <imagedata fileref="../../../../images/gui/GENERAL_f_gui.gif" align="center" style="float:right"/> <!-- align => Javahelp, style => Online -->/> </imageobject> </inlinemediaobject> <itemizedlist> <listitem> <para> <emphasis role="bold">Input size</emphasis> </para> <para> The parameter description 1.</para> <para> Properties : Type 'vec' of size 1. </para> </listitem> <listitem> <para> <emphasis role="bold">Number of event output</emphasis> </para> <para> The parameter description 2.</para> <para> Properties : Type 'vec' of size 1.</para> </listitem> </itemizedlist> </refsection> <refsection id="Defaultproperties_GENERAL_f"> <title>Default properties</title> <itemizedlist> <listitem> <para> <emphasis role="bold">always active:</emphasis> no </para> </listitem> <listitem> <para> <emphasis role="bold">direct-feedthrough:</emphasis> yes </para> </listitem> <listitem> <para> <emphasis role="bold">zero-crossing:</emphasis> yes </para> </listitem> <listitem> <para> <emphasis role="bold">mode:</emphasis> no </para> </listitem> <listitem> <para> <emphasis role="bold">regular inputs:</emphasis> </para> <para> <emphasis role="bold">- port 1 : size [1,1] / type 1</emphasis> </para> </listitem> <listitem> <para> <emphasis role="bold">number/sizes of activation inputs:</emphasis> 0 </para> </listitem> <listitem> <para> <emphasis role="bold">number/sizes of activation outputs:</emphasis> 1 </para> </listitem> <listitem> <para> <emphasis role="bold">continuous-time state:</emphasis> no </para> </listitem> <listitem> <para> <emphasis role="bold">discrete-time state:</emphasis> no </para> </listitem> <listitem> <para> <emphasis role="bold">object discrete-time state:</emphasis> no </para> </listitem> <listitem> <para> <emphasis role="bold">name of computational function:</emphasis> <emphasis role="italic">zcross</emphasis> </para> </listitem> </itemizedlist> <para/> </refsection> <refsection id="Interfacingfunction_GENERAL_f"> <title>Interfacing function</title> <itemizedlist> <listitem> <para> SCI/modules/scicos_blocks/macros/Threshold/GENERAL_f.sci</para> </listitem> </itemizedlist> </refsection> <refsection id="Computationalfunction_GENERAL_f"> <title>Computational function</title> <itemizedlist> <listitem> <para> SCI/modules/scicos_blocks/src/fortran/zcross.f (Type 1)</para> </listitem> </itemizedlist> </refsection> </refentry>
{ "pile_set_name": "Github" }
// Copyright 2010 Todd Ditchendorf // // 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. #import "TDJsonParserTest.h" #import "TDJsonParser.h" #import "TDFastJsonParser.h" @implementation TDJsonParserTest - (void)setUp { p = (TDJsonParser *)[TDJsonParser parser]; } - (void)testForAppleBossResultTokenization { NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"json"]; s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; PKTokenizer *t = [[[PKTokenizer alloc] initWithString:s] autorelease]; PKToken *eof = [PKToken EOFToken]; PKToken *tok = nil; while (eof != (tok = [t nextToken])) { //NSLog(@"tok: %@", tok); } } - (void)testForAppleBossResult { NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"json"]; s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; @try { result = [p parse:s]; } @catch (NSException *e) { //NSLog(@"\n\n\nexception:\n\n %@", [e reason]); } //NSLog(@"result %@", result); } - (void)testEmptyString { s = @""; a = [PKTokenAssembly assemblyWithString:s]; result = [p bestMatchFor:a]; TDNil(result); } - (void)testNum { s = @"456"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p numberParser] bestMatchFor:a]; TDNotNil(result); TDEqualObjects(@"[456]456^", [result description]); id obj = [result pop]; TDNotNil(obj); TDEqualObjects([NSNumber numberWithFloat:456], obj); s = @"-3.47"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p numberParser] bestMatchFor:a]; TDNotNil(result); TDEqualObjects(@"[-3.47]-3.47^", [result description]); obj = [result pop]; TDNotNil(obj); TDEqualObjects([NSNumber numberWithFloat:-3.47], obj); } - (void)testString { s = @"'foobar'"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p stringParser] bestMatchFor:a]; TDNotNil(result); TDEqualObjects(@"[foobar]'foobar'^", [result description]); id obj = [result pop]; TDNotNil(obj); TDEqualObjects(@"foobar", obj); s = @"\"baz boo boo\""; a = [PKTokenAssembly assemblyWithString:s]; result = [[p stringParser] bestMatchFor:a]; TDNotNil(result); TDEqualObjects(@"[baz boo boo]\"baz boo boo\"^", [result description]); obj = [result pop]; TDNotNil(obj); TDEqualObjects(@"baz boo boo", obj); } - (void)testBoolean { s = @"true"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p booleanParser] bestMatchFor:a]; TDNotNil(result); TDEqualObjects(@"[1]true^", [result description]); id obj = [result pop]; TDNotNil(obj); TDEqualObjects([NSNumber numberWithBool:YES], obj); s = @"false"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p booleanParser] bestMatchFor:a]; TDNotNil(result); TDEqualObjects(@"[0]false^", [result description]); obj = [result pop]; TDNotNil(obj); TDEqualObjects([NSNumber numberWithBool:NO], obj); } - (void)testArray { s = @"[1, 2, 3]"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p arrayParser] bestMatchFor:a]; // NSLog(@"result: %@", result); TDNotNil(result); id obj = [result pop]; TDEquals((int)3, (int)[obj count]); TDEqualObjects([NSNumber numberWithInteger:1], [obj objectAtIndex:0]); TDEqualObjects([NSNumber numberWithInteger:2], [obj objectAtIndex:1]); TDEqualObjects([NSNumber numberWithInteger:3], [obj objectAtIndex:2]); TDEqualObjects(@"[][/1/,/2/,/3/]^", [result description]); s = @"[true, 'garlic jazz!', .888]"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p arrayParser] bestMatchFor:a]; TDNotNil(result); //TDEqualObjects(@"[true, 'garlic jazz!', .888]true/'garlic jazz!'/.888^", [result description]); obj = [result pop]; TDEqualObjects([NSNumber numberWithBool:YES], [obj objectAtIndex:0]); TDEqualObjects(@"garlic jazz!", [obj objectAtIndex:1]); TDEqualObjects([NSNumber numberWithFloat:.888], [obj objectAtIndex:2]); s = @"[1, [2, [3, 4]]]"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p arrayParser] bestMatchFor:a]; TDNotNil(result); //NSLog(@"result: %@", [a stack]); TDEqualObjects([NSNumber numberWithInteger:1], [obj objectAtIndex:0]); } - (void)testObject { s = @"{'key': 'value'}"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p objectParser] bestMatchFor:a]; TDNotNil(result); id obj = [result pop]; TDEqualObjects([obj objectForKey:@"key"], @"value"); s = @"{'foo': false, 'bar': true, \"baz\": -9.457}"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p objectParser] bestMatchFor:a]; TDNotNil(result); obj = [result pop]; TDEqualObjects([obj objectForKey:@"foo"], [NSNumber numberWithBool:NO]); TDEqualObjects([obj objectForKey:@"bar"], [NSNumber numberWithBool:YES]); TDEqualObjects([obj objectForKey:@"baz"], [NSNumber numberWithFloat:-9.457]); s = @"{'baz': {'foo': [1,2]}}"; a = [PKTokenAssembly assemblyWithString:s]; result = [[p objectParser] bestMatchFor:a]; TDNotNil(result); obj = [result pop]; NSDictionary *dict = [obj objectForKey:@"baz"]; TDTrue([dict isKindOfClass:[NSDictionary class]]); NSArray *arr = [dict objectForKey:@"foo"]; TDTrue([arr isKindOfClass:[NSArray class]]); TDEqualObjects([NSNumber numberWithInteger:1], [arr objectAtIndex:0]); // TDEqualObjects(@"['baz', 'foo', 1, 2]'baz'/'foo'/1/2^", [result description]); } - (void)testCrunchBaseJsonParser { NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; TDJsonParser *parser = [[[TDJsonParser alloc] init] autorelease]; [parser parse:s]; // id res = [parser parse:s]; //NSLog(@"res %@", res); } - (void)testCrunchBaseJsonParserTokenization { NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; PKTokenizer *t = [[[PKTokenizer alloc] initWithString:s] autorelease]; PKToken *eof = [PKToken EOFToken]; PKToken *tok = nil; while (eof != (tok = [t nextToken])) { //NSLog(@"tok: %@", tok); } } - (void)testCrunchBaseJsonTokenParser { NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; TDFastJsonParser *parser = [[[TDFastJsonParser alloc] init] autorelease]; [parser parse:s]; // id res = [parser parse:s]; //NSLog(@"res %@", res); } - (void)testYahoo1 { s = @"{" @"\"name\": \"Yahoo!\"," @"\"permalink\": \"yahoo\"," @"\"homepage_url\": \"http://www.yahoo.com\"," @"\"blog_url\": \"http://yodel.yahoo.com/\"," @"\"blog_feed_url\": \"http://ycorpblog.com/feed/\"," @"\"category_code\": \"web\"," @"\"number_of_employees\": 13600," @"\"founded_year\": 1994," @"\"founded_month\": null," @"\"founded_day\": null," @"\"deadpooled_year\": null," @"\"deadpooled_month\": null," @"\"deadpooled_day\": null," @"\"deadpooled_url\": null," @"\"tag_list\": \"search, portal, webmail, photos\"," @"\"email_address\": \"\"," @"\"phone_number\": \"(408) 349-3300\"" @"}"; result = [p parse:s]; //NSLog(@"result %@", result); TDNotNil(result); id d = result; TDNotNil(d); TDTrue([d isKindOfClass:[NSDictionary class]]); TDEqualObjects([d objectForKey:@"name"], @"Yahoo!"); TDEqualObjects([d objectForKey:@"permalink"], @"yahoo"); TDEqualObjects([d objectForKey:@"homepage_url"], @"http://www.yahoo.com"); TDEqualObjects([d objectForKey:@"blog_url"], @"http://yodel.yahoo.com/"); TDEqualObjects([d objectForKey:@"blog_feed_url"], @"http://ycorpblog.com/feed/"); TDEqualObjects([d objectForKey:@"category_code"], @"web"); TDEqualObjects([d objectForKey:@"number_of_employees"], [NSNumber numberWithInteger:13600]); TDEqualObjects([d objectForKey:@"founded_year"], [NSNumber numberWithInteger:1994]); TDEqualObjects([d objectForKey:@"founded_month"], [NSNull null]); TDEqualObjects([d objectForKey:@"founded_day"], [NSNull null]); TDEqualObjects([d objectForKey:@"deadpooled_year"], [NSNull null]); TDEqualObjects([d objectForKey:@"deadpooled_month"], [NSNull null]); TDEqualObjects([d objectForKey:@"deadpooled_day"], [NSNull null]); TDEqualObjects([d objectForKey:@"deadpooled_url"], [NSNull null]); TDEqualObjects([d objectForKey:@"tag_list"], @"search, portal, webmail, photos"); TDEqualObjects([d objectForKey:@"email_address"], @""); TDEqualObjects([d objectForKey:@"phone_number"], @"(408) 349-3300"); } - (void)testYahoo2 { s = @"{\"image\":" @" {\"available_sizes\":" @" [[[150, 37]," @" \"assets/images/resized/0001/0836/10836v1-max-250x150.png\"]," @" [[200, 50]," @" \"assets/images/resized/0001/0836/10836v1-max-250x250.png\"]," @" [[200, 50]," @" \"assets/images/resized/0001/0836/10836v1-max-450x450.png\"]]," @" \"attribution\": null}" @"}"; result = [p parse:s]; //NSLog(@"result %@", result); TDNotNil(result); id d = result; TDNotNil(d); TDTrue([d isKindOfClass:[NSDictionary class]]); id image = [d objectForKey:@"image"]; TDNotNil(image); TDTrue([image isKindOfClass:[NSDictionary class]]); NSArray *sizes = [image objectForKey:@"available_sizes"]; TDNotNil(sizes); TDTrue([sizes isKindOfClass:[NSArray class]]); TDEquals(3, (int)[sizes count]); NSArray *first = [sizes objectAtIndex:0]; TDNotNil(first); TDTrue([first isKindOfClass:[NSArray class]]); TDEquals(2, (int)[first count]); NSArray *firstKey = [first objectAtIndex:0]; TDNotNil(firstKey); TDTrue([firstKey isKindOfClass:[NSArray class]]); TDEquals(2, (int)[firstKey count]); TDEqualObjects([NSNumber numberWithInteger:150], [firstKey objectAtIndex:0]); TDEqualObjects([NSNumber numberWithInteger:37], [firstKey objectAtIndex:1]); NSArray *second = [sizes objectAtIndex:1]; TDNotNil(second); TDTrue([second isKindOfClass:[NSArray class]]); TDEquals(2, (int)[second count]); NSArray *secondKey = [second objectAtIndex:0]; TDNotNil(secondKey); TDTrue([secondKey isKindOfClass:[NSArray class]]); TDEquals(2, (int)[secondKey count]); TDEqualObjects([NSNumber numberWithInteger:200], [secondKey objectAtIndex:0]); TDEqualObjects([NSNumber numberWithInteger:50], [secondKey objectAtIndex:1]); NSArray *third = [sizes objectAtIndex:2]; TDNotNil(third); TDTrue([third isKindOfClass:[NSArray class]]); TDEquals(2, (int)[third count]); NSArray *thirdKey = [third objectAtIndex:0]; TDNotNil(thirdKey); TDTrue([thirdKey isKindOfClass:[NSArray class]]); TDEquals(2, (int)[thirdKey count]); TDEqualObjects([NSNumber numberWithInteger:200], [thirdKey objectAtIndex:0]); TDEqualObjects([NSNumber numberWithInteger:50], [thirdKey objectAtIndex:1]); // TDEqualObjects([d objectForKey:@"name"], @"Yahoo!"); } - (void)testYahoo3 { s = @"{\"products\":" @"[" @"{\"name\": \"Yahoo.com\", \"permalink\": \"yahoo-com\"}," @"{\"name\": \"Yahoo! Mail\", \"permalink\": \"yahoo-mail\"}," @"{\"name\": \"Yahoo! Search\", \"permalink\": \"yahoo-search\"}," @"{\"name\": \"Yahoo! Directory\", \"permalink\": \"yahoo-directory\"}," @"{\"name\": \"Yahoo! Finance\", \"permalink\": \"yahoo-finance\"}," @"{\"name\": \"My Yahoo\", \"permalink\": \"my-yahoo\"}," @"{\"name\": \"Yahoo! News\", \"permalink\": \"yahoo-news\"}," @"{\"name\": \"Yahoo! Groups\", \"permalink\": \"yahoo-groups\"}," @"{\"name\": \"Yahoo! Messenger\", \"permalink\": \"yahoo-messenger\"}," @"{\"name\": \"Yahoo! Games\", \"permalink\": \"yahoo-games\"}," @"{\"name\": \"Yahoo! People Search\", \"permalink\": \"yahoo-people-search\"}," @"{\"name\": \"Yahoo! Movies\", \"permalink\": \"yahoo-movies\"}," @"{\"name\": \"Yahoo! Weather\", \"permalink\": \"yahoo-weather\"}," @"{\"name\": \"Yahoo! Video\", \"permalink\": \"yahoo-video\"}," @"{\"name\": \"Yahoo! Music\", \"permalink\": \"yahoo-music\"}," @"{\"name\": \"Yahoo! Sports\", \"permalink\": \"yahoo-sports\"}," @"{\"name\": \"Yahoo! Maps\", \"permalink\": \"yahoo-maps\"}," @"{\"name\": \"Yahoo! Auctions\", \"permalink\": \"yahoo-auctions\"}," @"{\"name\": \"Yahoo! Widgets\", \"permalink\": \"yahoo-widgets\"}," @"{\"name\": \"Yahoo! Shopping\", \"permalink\": \"yahoo-shopping\"}," @"{\"name\": \"Yahoo! Real Estate\", \"permalink\": \"yahoo-real-estate\"}," @"{\"name\": \"Yahoo! Travel\", \"permalink\": \"yahoo-travel\"}," @"{\"name\": \"Yahoo! Classifieds\", \"permalink\": \"yahoo-classifieds\"}," @"{\"name\": \"Yahoo! Answers\", \"permalink\": \"yahoo-answers\"}," @"{\"name\": \"Yahoo! Mobile\", \"permalink\": \"yahoo-mobile\"}," @"{\"name\": \"Yahoo! Buzz\", \"permalink\": \"yahoo-buzz\"}," @"{\"name\": \"Yahoo! Open Search Platform\", \"permalink\": \"yahoo-open-search-platform\"}," @"{\"name\": \"Fire Eagle\", \"permalink\": \"fireeagle\"}," @"{\"name\": \"Shine\", \"permalink\": \"shine\"}," @"{\"name\": \"Yahoo! Shortcuts\", \"permalink\": \"yahoo-shortcuts\"}" @"]" @"}"; result = [p parse:s]; //NSLog(@"result %@", result); TDNotNil(result); id d = result; TDNotNil(d); TDTrue([d isKindOfClass:[NSDictionary class]]); NSArray *products = [d objectForKey:@"products"]; TDNotNil(products); TDTrue([products isKindOfClass:[NSArray class]]); } - (void)testYahoo4 { s = @"[" @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" @"]"; p = (id)[[[TDFastJsonParser alloc] init] autorelease]; result = [p parse:s]; //NSLog(@"result %@", result); TDNotNil(result); id d = result; TDNotNil(d); TDTrue([d isKindOfClass:[NSArray class]]); // NSArray *products = [d objectForKey:@"products"]; // TDNotNil(products); // TDTrue([products isKindOfClass:[NSArray class]]); } @end
{ "pile_set_name": "Github" }
/*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer * Science Department. * * 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. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. */ #if defined(LIBC_SCCS) && !defined(lint) .asciz "@(#)divsi3.s 8.1 (Berkeley) 6/4/93" #endif /* LIBC_SCCS and not lint */ #include "DEFS.h" /* int / int */ ENTRY(__divsi3) movel sp@(4),d0 divsl sp@(8),d0 rts
{ "pile_set_name": "Github" }
[wheel] universal = 0
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8" ?> <routes xmlns="http://symfony.com/schema/routing" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing https://symfony.com/schema/routing/routing-1.0.xsd"> <route id="localized"> <default key="_controller">MyBundle:Blog:show</default> <path locale="en">/path</path> <path locale="fr">/route</path> </route> </routes>
{ "pile_set_name": "Github" }
Content-language: cs Content-type: text/html; charset=UTF-8 Body:----------cs-- <!--#set var="CONTENT_LANGUAGE" value="cs" --><!--#set var="TITLE" value="Varianta má sama více variant!" --><!--#include virtual="include/top.html" --> Varianta požadované entity má sama více variant. Přístup není možný. <!--#include virtual="include/bottom.html" --> ----------cs-- Content-language: de Content-type: text/html; charset=UTF-8 Body:----------de-- <!--#set var="CONTENT_LANGUAGE" value="de" --><!--#set var="TITLE" value="Variante ebenfalls ver&auml;nderlich!" --><!--#include virtual="include/top.html" --> Ein Zugriff auf das angeforderte Objekt bzw. einer Variante dieses Objektes ist nicht m&ouml;glich, da es ebenfalls ein variables Objekt darstellt. <!--#include virtual="include/bottom.html" --> ----------de-- Content-language: en Content-type: text/html; charset=UTF-8 Body:----------en-- <!--#set var="TITLE" value="Variant also varies!" --><!--#include virtual="include/top.html" --> A variant for the requested entity is itself a negotiable resource. Access not possible. <!--#include virtual="include/bottom.html" --> ----------en-- Content-language: es Content-type: text/html Body:----------es-- <!--#set var="TITLE" value="La variante tambi&eacute;n varia!" --> <!--#include virtual="include/top.html" --> Una variante de la entidad solicitada es por si misma un recurso negociable. No es posible tener acceso a la entidad. <!--#include virtual="include/bottom.html" --> ----------es-- Content-language: fr Content-type: text/html; charset=UTF-8 Body:----------fr-- <!--#set var="CONTENT_LANGUAGE" value="fr" --><!--#set var="TITLE" value="La variante varie elle-m&ecirc;me!" --><!--#include virtual="include/top.html" --> Une variante pour l'entit&eacute; demand&eacute;e est elle-m&ecirc;me une ressource n&eacute;gociable. L'acc&egrave;s est impossible. <!--#include virtual="include/bottom.html" --> ----------fr-- Content-language: ga Content-type: text/html; charset=UTF-8 Body:----------ga-- <!--#set var="TITLE" value="Athraitheach intr&aacute;chta!" --><!--#include virtual="include/top.html" --> Is &eacute; ceann de na athraitha&iacute; don aon&aacute;n iarraithe acmhainn intr&aacute;chta f&eacute;in. Rochtain dodh&eacute;anta. <!--#include virtual="include/bottom.html" --> ----------ga-- Content-language: it Content-type: text/html; charset=UTF-8 Body:----------it-- <!--#set var="CONTENT_LANGUAGE" value="it" --><!--#set var="TITLE" value="La versione variante varia essa stessa!" --><!--#include virtual="include/top.html" --> Non &egrave; possibile accedere all'entit&agrave; richiesta perch&eacute; &egrave; essa stessa una risorsa negoziabile. <!--#include virtual="include/bottom.html" --> ----------it-- Content-language: ja Content-type: text/html; charset=UTF-8 Body:----------ja-- <!--#set var="CONTENT_LANGUAGE" value="ja" --><!--#set var="TITLE" value="Variant also varies!" --><!--#include virtual="include/top.html" --> リクエストされたものの variant はそれ自体もまた、ネゴシエーション可能なリソースです。 アクセスできませんでした。 <!--#include virtual="include/bottom.html" --> ----------ja-- Content-language: ko Content-type: text/html; charset=UTF-8 Body:----------ko-- <!--#set var="CONTENT_LANGUAGE" value="ko" --><!--#set var="TITLE" value="형태를 결정할 수 없음!" --><!--#include virtual="include/top.html" --> 요청한 객체의 형태 또한 여러 형태를 가지고 있어서 접근이 불가능합니다. <!--#include virtual="include/bottom.html" --> ----------ko-- Content-language: nl Content-type: text/html; charset=UTF-8 Body:----------nl-- <!--#set var="CONTENT_LANGUAGE" value="nl" --><!--#set var="TITLE" value="Variant varieert ook!" --><!--#include virtual="include/top.html" --> Een variant van het gevraagde object is op zich ook een te onderhandelen variant. Toegang is niet mogelijk. <!--#include virtual="include/bottom.html" --> ----------nl-- Content-language: nb Content-type: text/html; charset=UTF-8 Body:----------nb-- <!--#set var="CONTENT_LANGUAGE" value="nb" --><!--#set var="TITLE" value="Variant varierer også!" --><!--#include virtual="include/top.html" --> En variant av den forespurte enheten er i seg selv en forhandelbar ressurs. Tilgang ikke mulig. <!--#include virtual="include/bottom.html" --> ----------nb-- Content-language: pl Content-type: text/html; charset=UTF-8 Body:----------pl-- <!--#set var="CONTENT_LANGUAGE" value="pl" --><!--#set var="TITLE" value="Wariant jest wariantowy!" --><!--#include virtual="include/top.html" --> Wariant &#380;&#261;danego zasobu jest r&#243;wnie&#380; zasobem negocjowalnym. Dost&#281;p jest niemo&#380;liwy. <!--#include virtual="include/bottom.html" --> ----------pl-- Content-language: pt-br Content-type: text/html; charset=UTF-8 Body:-------pt-br-- <!--#set var="CONTENT_LANGUAGE" value="pt-br" --><!--#set var="TITLE" value="Variante auto-negoci&aacute;vel!" --><!--#include virtual="include/top.html" --> Uma variante da entidade de requisi&ccedil;&atilde;o &eacute; por si mesma um recurso negoci&aacute;vel. Acesso n&atilde;o &eacute; poss&iacute;vel. <!--#include virtual="include/bottom.html" --> -------pt-br-- Content-language: pt Content-type: text/html; charset=ISO-8859-1 Body:----------pt-- <!--#set var="TITLE" value="Variante tamb&eacute;m varia!" --><!--#include virtual="include/top.html" --> A variante relativa &agrave; entidade pedida &eacute; ela mesma um recurso negoci&aacute;vel. N&atilde;o &eacute; poss&iacute;vel ter acesso. <!--#include virtual="include/bottom.html" --> ----------pt-- Content-language: ro Content-type: text/html; charset=UTF-8 Body:----------ro-- <!--#set var="CONTENT_LANGUAGE" value="ro" --><!--#set var="TITLE" value="Varianta deasemenea variaza!" --><!--#include virtual="include/top.html" --> O varianta pentru entitatea ceruta este ea insasi o resursa negociabila. Accesul nu este posibil. <!--#include virtual="include/bottom.html" --> ----------ro-- Content-language: sr Content-type: text/html; charset=UTF-8 Body:----------sr-- <!--#set var="CONTENT_LANGUAGE" value="sr" --><!--#set var="TITLE" value="Варијанта такође варира!" --><!--#include virtual="include/top.html" --> Варијанта захтеваног ентитета је и сама ресурс који постоји у више варијанти. Приступ није могућ. <!--#include virtual="include/bottom.html" --> ----------sr-- Content-language: sv Content-type: text/html; charset=UTF-8 Body:----------sv-- <!--#set var="CONTENT_LANGUAGE" value="sv" --><!--#set var="TITLE" value="Variant also varies!" --><!--#include virtual="include/top.html" --> En variant av den f&ouml;rfr&aring;gade enheten &auml;r i sig sj&auml;lv en giltig resurs. &Aring;tkomst &auml;r inte m&ouml;jlig. <!--#include virtual="include/bottom.html" --> ----------sv-- Content-language: tr Content-type: text/html; charset=UTF-8 Body:----------tr-- <!--#set var="CONTENT_LANGUAGE" value="tr" --><!--#set var="TITLE" value="Gösterim çeşitleri de çeşitli!" --><!--#include virtual="include/top.html" --> İstenen gösterim çeşidinin kendisi zaten kendi içinde uzlaşımlı. Erişim mümkün değil. <!--#include virtual="include/bottom.html" --> ----------tr--
{ "pile_set_name": "Github" }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % This file is part of VivoMind Prolog Unicode Resources % % VivoMind Prolog Unicode Resources is free software distributed using the % Creative Commons CC0 1.0 Universal (CC0 1.0) - Public Domain Dedication % license % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Last modified: March 13, 2012 unicode_name(0x0024, 'DOLLAR SIGN'). unicode_name(0x00A2, 'CENT SIGN'). unicode_name(0x00A3, 'POUND SIGN'). unicode_name(0x00A4, 'CURRENCY SIGN'). unicode_name(0x00A5, 'YEN SIGN'). unicode_name(0x058F, 'ARMENIAN DRAM SIGN'). unicode_name(0x060B, 'AFGHANI SIGN'). unicode_name(0x09F2, 'BENGALI RUPEE MARK'). unicode_name(0x09F3, 'BENGALI RUPEE SIGN'). unicode_name(0x09FB, 'BENGALI GANDA MARK'). unicode_name(0x0AF1, 'GUJARATI RUPEE SIGN'). unicode_name(0x0BF9, 'TAMIL RUPEE SIGN'). unicode_name(0x0E3F, 'THAI CURRENCY SYMBOL BAHT'). unicode_name(0x17DB, 'KHMER CURRENCY SYMBOL RIEL'). unicode_name(0x20A0, 'EURO-CURRENCY SIGN'). unicode_name(0x20A1, 'COLON SIGN'). unicode_name(0x20A2, 'CRUZEIRO SIGN'). unicode_name(0x20A3, 'FRENCH FRANC SIGN'). unicode_name(0x20A4, 'LIRA SIGN'). unicode_name(0x20A5, 'MILL SIGN'). unicode_name(0x20A6, 'NAIRA SIGN'). unicode_name(0x20A7, 'PESETA SIGN'). unicode_name(0x20A8, 'RUPEE SIGN'). unicode_name(0x20A9, 'WON SIGN'). unicode_name(0x20AA, 'NEW SHEQEL SIGN'). unicode_name(0x20AB, 'DONG SIGN'). unicode_name(0x20AC, 'EURO SIGN'). unicode_name(0x20AD, 'KIP SIGN'). unicode_name(0x20AE, 'TUGRIK SIGN'). unicode_name(0x20AF, 'DRACHMA SIGN'). unicode_name(0x20B0, 'GERMAN PENNY SIGN'). unicode_name(0x20B1, 'PESO SIGN'). unicode_name(0x20B2, 'GUARANI SIGN'). unicode_name(0x20B3, 'AUSTRAL SIGN'). unicode_name(0x20B4, 'HRYVNIA SIGN'). unicode_name(0x20B5, 'CEDI SIGN'). unicode_name(0x20B6, 'LIVRE TOURNOIS SIGN'). unicode_name(0x20B7, 'SPESMILO SIGN'). unicode_name(0x20B8, 'TENGE SIGN'). unicode_name(0x20B9, 'INDIAN RUPEE SIGN'). unicode_name(0x20BA, 'TURKISH LIRA SIGN'). unicode_name(0xA838, 'NORTH INDIC RUPEE MARK'). unicode_name(0xFDFC, 'RIAL SIGN'). unicode_name(0xFE69, 'SMALL DOLLAR SIGN'). unicode_name(0xFF04, 'FULLWIDTH DOLLAR SIGN'). unicode_name(0xFFE0, 'FULLWIDTH CENT SIGN'). unicode_name(0xFFE1, 'FULLWIDTH POUND SIGN'). unicode_name(0xFFE5, 'FULLWIDTH YEN SIGN'). unicode_name(0xFFE6, 'FULLWIDTH WON SIGN').
{ "pile_set_name": "Github" }
--- title: Miras actions: ['cevapKontrol', 'ipuçları'] material: editor: language: sol startingCode: | pragma solidity ^0.4.19; contract ZombieFactory { event NewZombie(uint zombieId, string name, uint dna); uint dnaDigits = 16; uint dnaModulus = 10 ** dnaDigits; struct Zombie { string name; uint dna; } Zombie[] public zombies; mapping (uint => address) public zombieToOwner; mapping (address => uint) ownerZombieCount; function _createZombie(string _name, uint _dna) private { uint id = zombies.push(Zombie(_name, _dna)) - 1; zombieToOwner[id] = msg.sender; ownerZombieCount[msg.sender]++; NewZombie(id, _name, _dna); } function _generateRandomDna(string _str) private view returns (uint) { uint rand = uint(keccak256(_str)); return rand % dnaModulus; } function createRandomZombie(string _name) public { require(ownerZombieCount[msg.sender] == 0); uint randDna = _generateRandomDna(_name); _createZombie(_name, randDna); } } // Buradan başlayın answer: > pragma solidity ^0.4.19; contract ZombieFactory { event NewZombie(uint zombieId, string name, uint dna); uint dnaDigits = 16; uint dnaModulus = 10 ** dnaDigits; struct Zombie { string name; uint dna; } Zombie[] public zombies; mapping (uint => address) public zombieToOwner; mapping (address => uint) ownerZombieCount; function _createZombie(string _name, uint _dna) private { uint id = zombies.push(Zombie(_name, _dna)) - 1; zombieToOwner[id] = msg.sender; ownerZombieCount[msg.sender]++; NewZombie(id, _name, _dna); } function _generateRandomDna(string _str) private view returns (uint) { uint rand = uint(keccak256(_str)); return rand % dnaModulus; } function createRandomZombie(string _name) public { require(ownerZombieCount[msg.sender] == 0); uint randDna = _generateRandomDna(_name); _createZombie(_name, randDna); } } contract ZombieFeeding is ZombieFactory { } --- Oyun kodumuz oldukça uzun. Son derece uzun bir kontrat yapmaktansa, bazen kodu organize etmek için kod mantığınızı çoğlu kontratlara bölmek onu anlamlı yapar. Bunu daha yönetilebilir yapan Solidity'nin bir özelliği de kontrat **_mirası_**: ``` contract Doge { function catchphrase() public returns (string) { return "So Wow CryptoDoge"; } } contract BabyDoge is Doge { function anotherCatchphrase() public returns (string) { return "Such Moon BabyDoge"; } } ``` `Doge`'den `BabyDoge` **_mirasları_**. Bu, `BabyDoge`'u derleyip açarsanız hem `catchphrase()` hem de `anotherCatchphrase()` erişimine sahip olacağı anlamına gelir (ve `Doge`'da belirtebileceğimiz her bir diğer genel fonksiyonlar). Bu mantıklı miras için kullanılılabilir (bir alt sınıfla olduğu gibi, bir `Cat` bir `Animal`'dır). Fakat ayrıca farklı sınıflar içine benzer mantığı birlikte gruplayarak kodunuzu organize etmek için basitçe kullanılabilir. # Teste koy Sonraki bölümlerde, zombilerimizi besleyip çoğaltmak için işlevselliği uyguluyor olacağız. Hadi `ZombieFactory`'den tüm yöntemleri miras alan kendi sahip olduğu sınıf içine bu mantığı koyalım. 1. `ZombieFactory` altında `ZombieFeeding` denilen bir kontrat yapın. Bu kontrat `ZombieFactory` kontratımızdan miras alıyor olmalı.
{ "pile_set_name": "Github" }
--TEST-- Check for EOL-CR --SKIPIF-- <?php if (!extension_loaded("sundown")) print "skip"; ?> <?php if (!extension_loaded("tidy")) print "skip"; ?> --FILE-- <?php $data = <<< DATA These lines all end with end of line (EOL) sequences. Seriously, they really do. If you don't believe me: HEX EDIT! DATA; $md = new Sundown($data); $result = $md->toHtml(); $tidy = new tidy; $tidy->parseString($result, array("show-body-only"=>1)); $tidy->cleanRepair(); echo (string)$tidy; --EXPECT-- <p>These lines all end with end of line (EOL) sequences.</p> <p>Seriously, they really do.</p> <p>If you don't believe me: HEX EDIT!</p>
{ "pile_set_name": "Github" }
/***************************************************************** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. ****************************************************************/ package org.apache.cayenne.testdo.java8; import org.apache.cayenne.testdo.java8.auto._LocalTimeTestEntity; public class LocalTimeTestEntity extends _LocalTimeTestEntity { private static final long serialVersionUID = 1L; }
{ "pile_set_name": "Github" }
<?xml version="1.0"?> <ZopeData> <record id="1" aka="AAAAAAAAAAE="> <pickle> <global name="StateDefinition" module="Products.DCWorkflow.States"/> </pickle> <pickle> <dictionary> <item> <key> <string>description</string> </key> <value> <string>A document which is released and and alive. It is accessible to its associates (team, project, members, partners, etc.) based on the security definition. It is modifiable by it assignees (ex. team, project, etc. for colloaborative documents) and by its assignor (ex. knowledge manager).</string> </value> </item> <item> <key> <string>id</string> </key> <value> <string>released_alive</string> </value> </item> <item> <key> <string>permission_roles</string> </key> <value> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> </value> </item> <item> <key> <string>title</string> </key> <value> <string>Released Alive</string> </value> </item> <item> <key> <string>transitions</string> </key> <value> <tuple> <string>archive</string> <string>archive_action</string> <string>hide</string> <string>hide_action</string> <string>publish</string> <string>publish_action</string> <string>publish_alive</string> <string>publish_alive_action</string> <string>reject</string> <string>reject_action</string> </tuple> </value> </item> <item> <key> <string>type_list</string> </key> <value> <tuple/> </value> </item> </dictionary> </pickle> </record> <record id="2" aka="AAAAAAAAAAI="> <pickle> <global name="PersistentMapping" module="Persistence.mapping"/> </pickle> <pickle> <dictionary> <item> <key> <string>data</string> </key> <value> <dictionary> <item> <key> <string>Access contents information</string> </key> <value> <tuple> <string>Assignee</string> <string>Assignor</string> <string>Associate</string> <string>Auditor</string> <string>Manager</string> </tuple> </value> </item> <item> <key> <string>Add portal content</string> </key> <value> <tuple> <string>Assignee</string> <string>Assignor</string> <string>Manager</string> </tuple> </value> </item> <item> <key> <string>Change local roles</string> </key> <value> <tuple> <string>Assignor</string> <string>Manager</string> </tuple> </value> </item> <item> <key> <string>Modify portal content</string> </key> <value> <tuple> <string>Assignee</string> <string>Assignor</string> <string>Manager</string> </tuple> </value> </item> <item> <key> <string>View</string> </key> <value> <tuple> <string>Assignee</string> <string>Assignor</string> <string>Associate</string> <string>Auditor</string> <string>Manager</string> </tuple> </value> </item> </dictionary> </value> </item> </dictionary> </pickle> </record> </ZopeData>
{ "pile_set_name": "Github" }
// The MIT License (MIT) // // Copyright (c) 2017 Firebase // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. import { expect } from 'chai'; import * as _ from 'lodash'; import { Change, Event, EventContext, makeCloudFunction, MakeCloudFunctionArgs, } from '../src/cloud-functions'; describe('makeCloudFunction', () => { const cloudFunctionArgs: MakeCloudFunctionArgs<any> = { provider: 'mock.provider', eventType: 'mock.event', service: 'service', triggerResource: () => 'resource', handler: () => null, legacyEventType: 'providers/provider/eventTypes/event', }; it('should put a __trigger on the returned CloudFunction', () => { const cf = makeCloudFunction({ provider: 'mock.provider', eventType: 'mock.event', service: 'service', triggerResource: () => 'resource', handler: () => null, }); expect(cf.__trigger).to.deep.equal({ eventTrigger: { eventType: 'mock.provider.mock.event', resource: 'resource', service: 'service', }, }); }); it('should have legacy event type in __trigger if provided', () => { const cf = makeCloudFunction(cloudFunctionArgs); expect(cf.__trigger).to.deep.equal({ eventTrigger: { eventType: 'providers/provider/eventTypes/event', resource: 'resource', service: 'service', }, }); }); it('should construct the right context for event', () => { const args: any = _.assign({}, cloudFunctionArgs, { handler: (data: any, context: EventContext) => context, }); const cf = makeCloudFunction(args); const test: Event = { context: { eventId: '00000', timestamp: '2016-11-04T21:29:03.496Z', eventType: 'provider.event', resource: { service: 'provider', name: 'resource', }, }, data: 'data', }; return expect(cf(test.data, test.context)).to.eventually.deep.equal({ eventId: '00000', timestamp: '2016-11-04T21:29:03.496Z', eventType: 'provider.event', resource: { service: 'provider', name: 'resource', }, params: {}, }); }); it('should throw error when context.params accessed in handler environment', () => { const args: any = _.assign({}, cloudFunctionArgs, { handler: (data: any, context: EventContext) => context, triggerResource: () => null, }); const cf = makeCloudFunction(args); const test: Event = { context: { eventId: '00000', timestamp: '2016-11-04T21:29:03.496Z', eventType: 'provider.event', resource: { service: 'provider', name: 'resource', }, }, data: 'test data', }; return cf(test.data, test.context).then((result) => { expect(result).to.deep.equal({ eventId: '00000', timestamp: '2016-11-04T21:29:03.496Z', eventType: 'provider.event', resource: { service: 'provider', name: 'resource', }, }); expect(() => result.params).to.throw(Error); }); }); }); describe('makeParams', () => { const args: MakeCloudFunctionArgs<any> = { provider: 'provider', eventType: 'event', service: 'service', triggerResource: () => 'projects/_/instances/pid/ref/{foo}/nested/{bar}', handler: (data, context) => context.params, legacyEventType: 'legacyEvent', }; const cf = makeCloudFunction(args); it('should construct params from the event resource of events', () => { const testEvent: Event = { context: { eventId: '111', timestamp: '2016-11-04T21:29:03.496Z', resource: { service: 'service', name: 'projects/_/instances/pid/ref/a/nested/b', }, eventType: 'event', }, data: 'data', }; return expect( cf(testEvent.data, testEvent.context) ).to.eventually.deep.equal({ foo: 'a', bar: 'b', }); }); }); describe('makeAuth and makeAuthType', () => { const args: MakeCloudFunctionArgs<any> = { provider: 'google.firebase.database', eventType: 'event', service: 'service', triggerResource: () => 'projects/_/instances/pid/ref/{foo}/nested/{bar}', handler: (data, context) => { return { auth: context.auth, authType: context.authType, }; }, }; const cf = makeCloudFunction(args); it('should construct correct auth and authType for admin user', () => { const testEvent = { data: 'data', context: { auth: { admin: true, }, }, }; return expect( cf(testEvent.data, testEvent.context) ).to.eventually.deep.equal({ auth: undefined, authType: 'ADMIN', }); }); it('should construct correct auth and authType for unauthenticated user', () => { const testEvent = { data: 'data', context: { auth: { admin: false, }, }, }; return expect( cf(testEvent.data, testEvent.context) ).to.eventually.deep.equal({ auth: null, authType: 'UNAUTHENTICATED', }); }); it('should construct correct auth and authType for a user', () => { const testEvent = { data: 'data', context: { auth: { admin: false, variable: { uid: 'user', provider: 'google', token: { sub: 'user', }, }, }, }, }; return expect( cf(testEvent.data, testEvent.context) ).to.eventually.deep.equal({ auth: { uid: 'user', token: { sub: 'user', }, }, authType: 'USER', }); }); }); describe('Change', () => { describe('applyFieldMask', () => { const after = { foo: 'bar', num: 2, obj: { a: 1, b: 2, }, }; it('should handle deleted values', () => { const sparseBefore = { baz: 'qux' }; const fieldMask = 'baz'; expect( Change.applyFieldMask(sparseBefore, after, fieldMask) ).to.deep.equal({ foo: 'bar', num: 2, obj: { a: 1, b: 2, }, baz: 'qux', }); }); it('should handle created values', () => { const sparseBefore = {}; const fieldMask = 'num,obj.a'; expect( Change.applyFieldMask(sparseBefore, after, fieldMask) ).to.deep.equal({ foo: 'bar', obj: { b: 2, }, }); }); it('should handle mutated values', () => { const sparseBefore = { num: 3, obj: { a: 3, }, }; const fieldMask = 'num,obj.a'; expect( Change.applyFieldMask(sparseBefore, after, fieldMask) ).to.deep.equal({ foo: 'bar', num: 3, obj: { a: 3, b: 2, }, }); }); }); describe('fromJSON', () => { it('should create a Change object with a `before` and `after`', () => { const created = Change.fromJSON<any>({ before: { foo: 'bar' }, after: { foo: 'faz' }, }); expect(created instanceof Change).to.equal(true); expect(created.before).to.deep.equal({ foo: 'bar' }); expect(created.after).to.deep.equal({ foo: 'faz' }); }); it('should apply the customizer function to `before` and `after`', () => { function customizer<T>(input: any) { _.set(input, 'another', 'value'); return input as T; } const created = Change.fromJSON<object>( { before: { foo: 'bar' }, after: { foo: 'faz' }, }, customizer ); expect(created.before).to.deep.equal({ foo: 'bar', another: 'value', }); expect(created.after).to.deep.equal({ foo: 'faz', another: 'value', }); }); }); });
{ "pile_set_name": "Github" }
const util = require('../../../packages/etherlime/cli-commands/util'); const colors = require('../../../packages/etherlime-utils/utils/colors') const assert = require('assert'); const sinon = require('sinon'); describe('Print report table test', function() { it('should return readable status with fail', () => { let colorSpy = sinon.spy(colors, "colorFailure") util.getReadableStatus(1) sinon.assert.calledWithExactly(colorSpy, 'Fail') }) })
{ "pile_set_name": "Github" }
.nh .TH restic backup(1)Jan 2017 generated by \fB\fCrestic generate\fR .SH NAME .PP restic\-cache \- Operate on local cache directories .SH SYNOPSIS .PP \fBrestic cache [flags]\fP .SH DESCRIPTION .PP The "cache" command allows listing and cleaning local cache directories. .SH EXIT STATUS .PP Exit status is 0 if the command was successful, and non\-zero if there was any error. .SH OPTIONS .PP \fB\-\-cleanup\fP[=false] remove old cache directories .PP \fB\-h\fP, \fB\-\-help\fP[=false] help for cache .PP \fB\-\-max\-age\fP=30 max age in \fB\fCdays\fR for cache directories to be considered old .PP \fB\-\-no\-size\fP[=false] do not output the size of the cache directories .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB\-\-cacert\fP=[] \fB\fCfile\fR to load root certificates from (default: use system certificates) .PP \fB\-\-cache\-dir\fP="" set the cache \fB\fCdirectory\fR\&. (default: use system default cache directory) .PP \fB\-\-cleanup\-cache\fP[=false] auto remove old cache directories .PP \fB\-\-json\fP[=false] set output mode to JSON for commands that support it .PP \fB\-\-key\-hint\fP="" \fB\fCkey\fR ID of key to try decrypting first (default: $RESTIC\_KEY\_HINT) .PP \fB\-\-limit\-download\fP=0 limits downloads to a maximum rate in KiB/s. (default: unlimited) .PP \fB\-\-limit\-upload\fP=0 limits uploads to a maximum rate in KiB/s. (default: unlimited) .PP \fB\-\-no\-cache\fP[=false] do not use a local cache .PP \fB\-\-no\-lock\fP[=false] do not lock the repo, this allows some operations on read\-only repos .PP \fB\-o\fP, \fB\-\-option\fP=[] set extended option (\fB\fCkey=value\fR, can be specified multiple times) .PP \fB\-\-password\-command\fP="" shell \fB\fCcommand\fR to obtain the repository password from (default: $RESTIC\_PASSWORD\_COMMAND) .PP \fB\-p\fP, \fB\-\-password\-file\fP="" \fB\fCfile\fR to read the repository password from (default: $RESTIC\_PASSWORD\_FILE) .PP \fB\-q\fP, \fB\-\-quiet\fP[=false] do not output comprehensive progress report .PP \fB\-r\fP, \fB\-\-repo\fP="" \fB\fCrepository\fR to backup to or restore from (default: $RESTIC\_REPOSITORY) .PP \fB\-\-tls\-client\-cert\fP="" path to a \fB\fCfile\fR containing PEM encoded TLS client certificate and private key .PP \fB\-v\fP, \fB\-\-verbose\fP[=0] be verbose (specify \-\-verbose multiple times or level \-\-verbose=\fB\fCn\fR) .SH SEE ALSO .PP \fBrestic(1)\fP
{ "pile_set_name": "Github" }
{ "lib_version" : "v0.3-106-g6f8837d", "first_frame" : 1, "last_frame" : 100, "buffer_frames" : 1, "merger" : { "type" : "gradient" }, "output" : { "type" : "png", "filename" : "ff_stereo_hfov_45_0-v2" }, "pano" : { "width" : 2048, "height" : 1024, "pad_top" : 0, "pad_bottom" : 0, "hfov" : 45, "blend_zenith" : true, "blend_nadir" : true, "proj" : "stereographic", "global_yaw" : 0, "global_pitch" : 0, "global_roll" : 0, "inputs" : [ { "width" : 1920, "height" : 1080, "hfov" : 275.871, "filename" : "procedural:checker(size=120,color1=000000,color2=ee2222,color3=222222)", "proj" : "ff_fisheye", "yaw" : 0, "pitch" : 7.03159, "roll" : -50.4692, "crop_left" : 341, "crop_right" : 1547, "crop_top" : -60, "crop_bottom" : 1142, "viewpoint_model" : "hugin", "translation_x" : 0, "translation_y" : 0, "translation_z" : 0, "viewpoint_pan" : 0, "viewpoint_tilt" : 0, "ev" : 0, "red_corr" : 1, "blue_corr" : 1, "response" : "emor", "emor_a" : 0, "emor_b" : 0, "emor_c" : 0, "emor_d" : 0, "emor_e" : 0, "gamma" : 1, "relative_to_cropped_area" : false, "lens_dist_a" : 0, "lens_dist_b" : -0.0899085, "lens_dist_c" : 0, "dist_center_x" : -15.7932, "dist_center_y" : 3.3929, "vign_a" : 1, "vign_b" : 0, "vign_c" : 0, "vign_d" : 0, "vign_x" : 0, "vign_y" : 0, "frame_offset" : 0 }, { "width" : 1920, "height" : 1080, "hfov" : 275.871, "filename" : "procedural:checker(size=120,color1=000000,color2=33ee33,color3=333333)", "proj" : "ff_fisheye", "yaw" : 120.996, "pitch" : 9.37486, "roll" : -47.1854, "crop_left" : 341, "crop_right" : 1547, "crop_top" : -60, "crop_bottom" : 1142, "viewpoint_model" : "hugin", "translation_x" : 0, "translation_y" : 0, "translation_z" : 0, "viewpoint_pan" : 0, "viewpoint_tilt" : 0, "ev" : 0, "red_corr" : 1, "blue_corr" : 1, "response" : "emor", "emor_a" : 0, "emor_b" : 0, "emor_c" : 0, "emor_d" : 0, "emor_e" : 0, "gamma" : 1, "relative_to_cropped_area" : false, "lens_dist_a" : 0, "lens_dist_b" : -0.0899085, "lens_dist_c" : 0, "dist_center_x" : -15.7932, "dist_center_y" : 3.3929, "vign_a" : 1, "vign_b" : 0, "vign_c" : 0, "vign_d" : 0, "vign_x" : 0, "vign_y" : 0, "frame_offset" : 0 }, { "width" : 1920, "height" : 1080, "hfov" : 275.871, "filename" : "procedural:checker(size=120,color1=000000,color2=4444dd,color3=444444)", "proj" : "ff_fisheye", "yaw" : 61.0095, "pitch" : 174.595, "roll" : 133.23, "crop_left" : 341, "crop_right" : 1547, "crop_top" : -60, "crop_bottom" : 1142, "viewpoint_model" : "hugin", "translation_x" : 0, "translation_y" : 0, "translation_z" : 0, "viewpoint_pan" : 0, "viewpoint_tilt" : 0, "ev" : 0, "red_corr" : 1, "blue_corr" : 1, "response" : "emor", "emor_a" : 0, "emor_b" : 0, "emor_c" : 0, "emor_d" : 0, "emor_e" : 0, "gamma" : 1, "relative_to_cropped_area" : false, "lens_dist_a" : 0, "lens_dist_b" : -0.0899085, "lens_dist_c" : 0, "dist_center_x" : -15.7932, "dist_center_y" : 3.3929, "vign_a" : 1, "vign_b" : 0, "vign_c" : 0, "vign_d" : 0, "vign_x" : 0, "vign_y" : 0, "frame_offset" : 0 } ] } }
{ "pile_set_name": "Github" }
# What is @nteract/core? @nteract/core is where the magic happens. The package, by itself, is nothing special. It encapsulates five other nteract packages that are designed to be used together. - `@nteract/actions` - `@nteract/reducers` - `@nteract/epics` - `@nteract/types` - `@nteract/selectors` Instead of installing and importing from each individual package above, it is recommend that you install `@nteract/core` and use each module like so. ```js import { actions } from "@nteract/core"; // For actions import { reducers } from "@nteract/core"; // For reducers import { epics } from "@nteract/core"; // For epics import { state } from "@nteract/core"; // For types import { selectors } from "@nteract/core"; // For selectors ``` You can also import individually exported elements from `@nteract/core`. For example, if you want to use the `createContentRef` function from the `@nteract/types` package, you can import it like so from the core package. ```js import { createContentRef } from "@nteract/core"; ``` ## Key Principles Behind @nteract/core The `@nteract/core` package is heavily dependent on the underlying technologies powering nteract, namely Redux and RxJS. Each module exported from the core package is designed to work with the other. Here's how it all flows. 1. One of the key principles behind nteract is the existence of a client-side state model. This client-side model makes it easy to manage the state of the nteract client and to synchronize it with a back-end system. You can learn more about the state in the documentation for the `@nteract/types` package. 2. Redux actions are dispatched from nteract clients. Function creators and type definitions for these actions are exported from the `actions` module. For example, if we wanted to focus a particularly cell in a notebook, we can dispatch a `FocusCell` action. 3. Reducers are functions that make immutable changes to the state. Reducers take a base state and an action as inputs. Depending on the action, the base state will be copied and modified in a particular way. For example, a `FocusCell` action will update the `cellFocused` property for a particular content model in the state. 4. Epics bring RxJS and Redux together. They allow developers to implement functions that listen to actions and dispatch async requests or execute side-effects. For example, epics exported from the `epics` module handle cell execution targeting a Jupyter kernel and content fetching from a Jupyter server. 5. The state model has several useful properties, like the currently focused cell or the filepath of a content. The `selectors` module exports a set of selectors, functions that take an input state and return a particular state property. ### More Information For more information on each component of the core SDK, visit the documentation pages for each module.
{ "pile_set_name": "Github" }
/* * * Copyright 2019 gRPC 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 attributes defines a generic key/value store used in various gRPC // components. // // All APIs in this package are EXPERIMENTAL. package attributes import "fmt" // Attributes is an immutable struct for storing and retrieving generic // key/value pairs. Keys must be hashable, and users should define their own // types for keys. type Attributes struct { m map[interface{}]interface{} } // New returns a new Attributes containing all key/value pairs in kvs. If the // same key appears multiple times, the last value overwrites all previous // values for that key. Panics if len(kvs) is not even. func New(kvs ...interface{}) *Attributes { if len(kvs)%2 != 0 { panic(fmt.Sprintf("attributes.New called with unexpected input: len(kvs) = %v", len(kvs))) } a := &Attributes{m: make(map[interface{}]interface{}, len(kvs)/2)} for i := 0; i < len(kvs)/2; i++ { a.m[kvs[i*2]] = kvs[i*2+1] } return a } // WithValues returns a new Attributes containing all key/value pairs in a and // kvs. Panics if len(kvs) is not even. If the same key appears multiple // times, the last value overwrites all previous values for that key. To // remove an existing key, use a nil value. func (a *Attributes) WithValues(kvs ...interface{}) *Attributes { if a == nil { return New(kvs...) } if len(kvs)%2 != 0 { panic(fmt.Sprintf("attributes.New called with unexpected input: len(kvs) = %v", len(kvs))) } n := &Attributes{m: make(map[interface{}]interface{}, len(a.m)+len(kvs)/2)} for k, v := range a.m { n.m[k] = v } for i := 0; i < len(kvs)/2; i++ { n.m[kvs[i*2]] = kvs[i*2+1] } return n } // Value returns the value associated with these attributes for key, or nil if // no value is associated with key. func (a *Attributes) Value(key interface{}) interface{} { if a == nil { return nil } return a.m[key] }
{ "pile_set_name": "Github" }
<?php namespace oasis\names\specification\ubl\schema\xsd\CommonAggregateComponents_2; /** * @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2 * @xmlType PeriodType * @xmlName InvoicePeriod * @var oasis\names\specification\ubl\schema\xsd\CommonAggregateComponents_2\InvoicePeriod */ class InvoicePeriod extends PeriodType { } // end class InvoicePeriod
{ "pile_set_name": "Github" }
/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV. 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. */ describe("vec2", function() { var vec2 = require("../../src/gl-matrix/vec2.js"); var out, vecA, vecB, result; beforeEach(function() { vecA = [1, 2]; vecB = [3, 4]; out = [0, 0]; }); describe("create", function() { beforeEach(function() { result = vec2.create(); }); it("should return a 2 element array initialized to 0s", function() { expect(result).toBeEqualish([0, 0]); }); }); describe("clone", function() { beforeEach(function() { result = vec2.clone(vecA); }); it("should return a 2 element array initialized to the values in vecA", function() { expect(result).toBeEqualish(vecA); }); }); describe("fromValues", function() { beforeEach(function() { result = vec2.fromValues(1, 2); }); it("should return a 2 element array initialized to the values passed", function() { expect(result).toBeEqualish([1, 2]); }); }); describe("copy", function() { beforeEach(function() { result = vec2.copy(out, vecA); }); it("should place values into out", function() { expect(out).toBeEqualish([1, 2]); }); it("should return out", function() { expect(result).toBe(out); }); }); describe("set", function() { beforeEach(function() { result = vec2.set(out, 1, 2); }); it("should place values into out", function() { expect(out).toBeEqualish([1, 2]); }); it("should return out", function() { expect(result).toBe(out); }); }); describe("add", function() { describe("with a separate output vector", function() { beforeEach(function() { result = vec2.add(out, vecA, vecB); }); it("should place values into out", function() { expect(out).toBeEqualish([4, 6]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.add(vecA, vecA, vecB); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([4, 6]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecB is the output vector", function() { beforeEach(function() { result = vec2.add(vecB, vecA, vecB); }); it("should place values into vecB", function() { expect(vecB).toBeEqualish([4, 6]); }); it("should return vecB", function() { expect(result).toBe(vecB); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); }); describe("subtract", function() { it("should have an alias called 'sub'", function() { expect(vec2.sub).toEqual(vec2.subtract); }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.subtract(out, vecA, vecB); }); it("should place values into out", function() { expect(out).toBeEqualish([-2, -2]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.subtract(vecA, vecA, vecB); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([-2, -2]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecB is the output vector", function() { beforeEach(function() { result = vec2.subtract(vecB, vecA, vecB); }); it("should place values into vecB", function() { expect(vecB).toBeEqualish([-2, -2]); }); it("should return vecB", function() { expect(result).toBe(vecB); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); }); describe("multiply", function() { it("should have an alias called 'mul'", function() { expect(vec2.mul).toEqual(vec2.multiply); }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.multiply(out, vecA, vecB); }); it("should place values into out", function() { expect(out).toBeEqualish([3, 8]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.multiply(vecA, vecA, vecB); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([3, 8]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecB is the output vector", function() { beforeEach(function() { result = vec2.multiply(vecB, vecA, vecB); }); it("should place values into vecB", function() { expect(vecB).toBeEqualish([3, 8]); }); it("should return vecB", function() { expect(result).toBe(vecB); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); }); describe("divide", function() { it("should have an alias called 'div'", function() { expect(vec2.div).toEqual(vec2.divide); }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.divide(out, vecA, vecB); }); it("should place values into out", function() { expect(out).toBeEqualish([0.3333333, 0.5]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.divide(vecA, vecA, vecB); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([0.3333333, 0.5]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecB is the output vector", function() { beforeEach(function() { result = vec2.divide(vecB, vecA, vecB); }); it("should place values into vecB", function() { expect(vecB).toBeEqualish([0.3333333, 0.5]); }); it("should return vecB", function() { expect(result).toBe(vecB); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); }); describe("ceil", function() { beforeEach(function() { vecA = [Math.E, Math.PI]; }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.ceil(out, vecA); }); it("should place values into out", function() { expect(out).toBeEqualish([3, 4]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([Math.E, Math.PI]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.ceil(vecA, vecA); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([3, 4]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); }); }); describe("floor", function() { beforeEach(function() { vecA = [Math.E, Math.PI]; }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.floor(out, vecA); }); it("should place values into out", function() { expect(out).toBeEqualish([2, 3]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([Math.E, Math.PI]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.floor(vecA, vecA); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([2, 3]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); }); }); describe("min", function() { beforeEach(function() { vecA = [1, 4]; vecB = [3, 2]; }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.min(out, vecA, vecB); }); it("should place values into out", function() { expect(out).toBeEqualish([1, 2]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 4]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 2]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.min(vecA, vecA, vecB); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 2]); }); }); describe("when vecB is the output vector", function() { beforeEach(function() { result = vec2.min(vecB, vecA, vecB); }); it("should place values into vecB", function() { expect(vecB).toBeEqualish([1, 2]); }); it("should return vecB", function() { expect(result).toBe(vecB); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 4]); }); }); }); describe("max", function() { beforeEach(function() { vecA = [1, 4]; vecB = [3, 2]; }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.max(out, vecA, vecB); }); it("should place values into out", function() { expect(out).toBeEqualish([3, 4]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 4]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 2]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.max(vecA, vecA, vecB); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([3, 4]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 2]); }); }); describe("when vecB is the output vector", function() { beforeEach(function() { result = vec2.max(vecB, vecA, vecB); }); it("should place values into vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); it("should return vecB", function() { expect(result).toBe(vecB); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 4]); }); }); }); describe("round", function() { beforeEach(function() { vecA = [Math.E, Math.PI]; }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.round(out, vecA); }); it("should place values into out", function() { expect(out).toBeEqualish([3, 3]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([Math.E, Math.PI]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.round(vecA, vecA); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([3, 3]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); }); }); describe("scale", function() { describe("with a separate output vector", function() { beforeEach(function() { result = vec2.scale(out, vecA, 2); }); it("should place values into out", function() { expect(out).toBeEqualish([2, 4]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.scale(vecA, vecA, 2); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([2, 4]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); }); }); describe("scaleAndAdd", function() { describe("with a separate output vector", function() { beforeEach(function() { result = vec2.scaleAndAdd(out, vecA, vecB, 0.5); }); it("should place values into out", function() { expect(out).toBeEqualish([2.5, 4]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.scaleAndAdd(vecA, vecA, vecB, 0.5); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([2.5, 4]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecB is the output vector", function() { beforeEach(function() { result = vec2.scaleAndAdd(vecB, vecA, vecB, 0.5); }); it("should place values into vecB", function() { expect(vecB).toBeEqualish([2.5, 4]); }); it("should return vecB", function() { expect(result).toBe(vecB); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); }); describe("distance", function() { it("should have an alias called 'dist'", function() { expect(vec2.dist).toEqual(vec2.distance); }); beforeEach(function() { result = vec2.distance(vecA, vecB); }); it("should return the distance", function() { expect(result).toBeCloseTo(2.828427); }); }); describe("squaredDistance", function() { it("should have an alias called 'sqrDist'", function() { expect(vec2.sqrDist).toEqual(vec2.squaredDistance); }); beforeEach(function() { result = vec2.squaredDistance(vecA, vecB); }); it("should return the squared distance", function() { expect(result).toEqual(8); }); }); describe("length", function() { it("should have an alias called 'len'", function() { expect(vec2.len).toEqual(vec2.length); }); beforeEach(function() { result = vec2.length(vecA); }); it("should return the length", function() { expect(result).toBeCloseTo(2.236067); }); }); describe("squaredLength", function() { it("should have an alias called 'sqrLen'", function() { expect(vec2.sqrLen).toEqual(vec2.squaredLength); }); beforeEach(function() { result = vec2.squaredLength(vecA); }); it("should return the squared length", function() { expect(result).toEqual(5); }); }); describe("negate", function() { describe("with a separate output vector", function() { beforeEach(function() { result = vec2.negate(out, vecA); }); it("should place values into out", function() { expect(out).toBeEqualish([-1, -2]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.negate(vecA, vecA); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([-1, -2]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); }); }); describe("normalize", function() { beforeEach(function() { vecA = [5, 0]; }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.normalize(out, vecA); }); it("should place values into out", function() { expect(out).toBeEqualish([1, 0]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([5, 0]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.normalize(vecA, vecA); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([1, 0]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); }); }); describe("dot", function() { beforeEach(function() { result = vec2.dot(vecA, vecB); }); it("should return the dot product", function() { expect(result).toEqual(11); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("cross", function() { var out3; beforeEach(function() { out3 = [0, 0, 0]; result = vec2.cross(out3, vecA, vecB); }); it("should place values into out", function() { expect(out3).toBeEqualish([0, 0, -2]); }); it("should return out", function() { expect(result).toBe(out3); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("lerp", function() { describe("with a separate output vector", function() { beforeEach(function() { result = vec2.lerp(out, vecA, vecB, 0.5); }); it("should place values into out", function() { expect(out).toBeEqualish([2, 3]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.lerp(vecA, vecA, vecB, 0.5); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([2, 3]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); }); }); describe("when vecB is the output vector", function() { beforeEach(function() { result = vec2.lerp(vecB, vecA, vecB, 0.5); }); it("should place values into vecB", function() { expect(vecB).toBeEqualish([2, 3]); }); it("should return vecB", function() { expect(result).toBe(vecB); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); }); describe("random", function() { describe("with no scale", function() { beforeEach(function() { result = vec2.random(out); }); it("should result in a unit length vector", function() { expect(vec2.length(out)).toBeCloseTo(1.0); }); it("should return out", function() { expect(result).toBe(out); }); }); describe("with a scale", function() { beforeEach(function() { result = vec2.random(out, 5.0); }); it("should result in a unit length vector", function() { expect(vec2.length(out)).toBeCloseTo(5.0); }); it("should return out", function() { expect(result).toBe(out); }); }); }); describe("transformMat2", function() { var matA; beforeEach(function() { matA = [1, 2, 3, 4]; }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.transformMat2(out, vecA, matA); }); it("should place values into out", function() { expect(out).toBeEqualish([7, 10]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.transformMat2(vecA, vecA, matA); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([7, 10]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); }); }); }); describe("transformMat2d", function() { var matA; beforeEach(function() { matA = [1, 2, 3, 4, 5, 6]; }); describe("with a separate output vector", function() { beforeEach(function() { result = vec2.transformMat2d(out, vecA, matA); }); it("should place values into out", function() { expect(out).toBeEqualish([12, 16]); }); it("should return out", function() { expect(result).toBe(out); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4, 5, 6]); }); }); describe("when vecA is the output vector", function() { beforeEach(function() { result = vec2.transformMat2d(vecA, vecA, matA); }); it("should place values into vecA", function() { expect(vecA).toBeEqualish([12, 16]); }); it("should return vecA", function() { expect(result).toBe(vecA); }); it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4, 5, 6]); }); }); }); describe("forEach", function() { var vecArray; beforeEach(function() { vecArray = [ 1, 2, 3, 4, 0, 0 ]; }); describe("when performing operations that take no extra arguments", function() { beforeEach(function() { result = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize); }); it("should update all values", function() { expect(vecArray).toBeEqualish([ 0.447214, 0.894427, 0.6, 0.8, 0, 0 ]); }); it("should return vecArray", function() { expect(result).toBe(vecArray); }); }); describe("when performing operations that takes one extra arguments", function() { beforeEach(function() { result = vec2.forEach(vecArray, 0, 0, 0, vec2.add, vecA); }); it("should update all values", function() { expect(vecArray).toBeEqualish([ 2, 4, 4, 6, 1, 2 ]); }); it("should return vecArray", function() { expect(result).toBe(vecArray); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); describe("when specifying an offset", function() { beforeEach(function() { result = vec2.forEach(vecArray, 0, 2, 0, vec2.add, vecA); }); it("should update all values except the first vector", function() { expect(vecArray).toBeEqualish([ 1, 2, 4, 6, 1, 2 ]); }); it("should return vecArray", function() { expect(result).toBe(vecArray); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); describe("when specifying a count", function() { beforeEach(function() { result = vec2.forEach(vecArray, 0, 0, 2, vec2.add, vecA); }); it("should update all values except the last vector", function() { expect(vecArray).toBeEqualish([ 2, 4, 4, 6, 0, 0 ]); }); it("should return vecArray", function() { expect(result).toBe(vecArray); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); describe("when specifying a stride", function() { beforeEach(function() { result = vec2.forEach(vecArray, 4, 0, 0, vec2.add, vecA); }); it("should update all values except the second vector", function() { expect(vecArray).toBeEqualish([ 2, 4, 3, 4, 1, 2 ]); }); it("should return vecArray", function() { expect(result).toBe(vecArray); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); }); }); describe("when calling a function that does not modify the out variable", function() { beforeEach(function() { result = vec2.forEach(vecArray, 0, 0, 0, function(out, vec) {}); }); it("values should remain unchanged", function() { expect(vecArray).toBeEqualish([ 1, 2, 3, 4, 0, 0, ]); }); it("should return vecArray", function() { expect(result).toBe(vecArray); }); }); }); describe("str", function() { beforeEach(function() { result = vec2.str(vecA); }); it("should return a string representation of the vector", function() { expect(result).toEqual("vec2(1, 2)"); }); }); describe("exactEquals", function() { var vecC, r0, r1; beforeEach(function() { vecA = [0, 1]; vecB = [0, 1]; vecC = [1, 2]; r0 = vec2.exactEquals(vecA, vecB); r1 = vec2.exactEquals(vecA, vecC); }); it("should return true for identical vectors", function() { expect(r0).toBe(true); }); it("should return false for different vectors", function() { expect(r1).toBe(false); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([0, 1]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([0, 1]); }); }); describe("equals", function() { var vecC, vecD, r0, r1, r2; beforeEach(function() { vecA = [0, 1]; vecB = [0, 1]; vecC = [1, 2]; vecD = [1e-16, 1]; r0 = vec2.equals(vecA, vecB); r1 = vec2.equals(vecA, vecC); r2 = vec2.equals(vecA, vecD); }); it("should return true for identical vectors", function() { expect(r0).toBe(true); }); it("should return false for different vectors", function() { expect(r1).toBe(false); }); it("should return true for close but not identical vectors", function() { expect(r2).toBe(true); }); it("should not modify vecA", function() { expect(vecA).toBeEqualish([0, 1]); }); it("should not modify vecB", function() { expect(vecB).toBeEqualish([0, 1]); }); }); });
{ "pile_set_name": "Github" }
"use strict"; // Manually added data to be used by sbcs codec in addition to generated one. module.exports = { // Not supported by iconv, not sure why. "10029": "maccenteuro", "maccenteuro": { "type": "_sbcs", "chars": "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ" }, "808": "cp808", "ibm808": "cp808", "cp808": { "type": "_sbcs", "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ " }, "mik": { "type": "_sbcs", "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " }, // Aliases of generated encodings. "ascii8bit": "ascii", "usascii": "ascii", "ansix34": "ascii", "ansix341968": "ascii", "ansix341986": "ascii", "csascii": "ascii", "cp367": "ascii", "ibm367": "ascii", "isoir6": "ascii", "iso646us": "ascii", "iso646irv": "ascii", "us": "ascii", "latin1": "iso88591", "latin2": "iso88592", "latin3": "iso88593", "latin4": "iso88594", "latin5": "iso88599", "latin6": "iso885910", "latin7": "iso885913", "latin8": "iso885914", "latin9": "iso885915", "latin10": "iso885916", "csisolatin1": "iso88591", "csisolatin2": "iso88592", "csisolatin3": "iso88593", "csisolatin4": "iso88594", "csisolatincyrillic": "iso88595", "csisolatinarabic": "iso88596", "csisolatingreek": "iso88597", "csisolatinhebrew": "iso88598", "csisolatin5": "iso88599", "csisolatin6": "iso885910", "l1": "iso88591", "l2": "iso88592", "l3": "iso88593", "l4": "iso88594", "l5": "iso88599", "l6": "iso885910", "l7": "iso885913", "l8": "iso885914", "l9": "iso885915", "l10": "iso885916", "isoir14": "iso646jp", "isoir57": "iso646cn", "isoir100": "iso88591", "isoir101": "iso88592", "isoir109": "iso88593", "isoir110": "iso88594", "isoir144": "iso88595", "isoir127": "iso88596", "isoir126": "iso88597", "isoir138": "iso88598", "isoir148": "iso88599", "isoir157": "iso885910", "isoir166": "tis620", "isoir179": "iso885913", "isoir199": "iso885914", "isoir203": "iso885915", "isoir226": "iso885916", "cp819": "iso88591", "ibm819": "iso88591", "cyrillic": "iso88595", "arabic": "iso88596", "arabic8": "iso88596", "ecma114": "iso88596", "asmo708": "iso88596", "greek": "iso88597", "greek8": "iso88597", "ecma118": "iso88597", "elot928": "iso88597", "hebrew": "iso88598", "hebrew8": "iso88598", "turkish": "iso88599", "turkish8": "iso88599", "thai": "iso885911", "thai8": "iso885911", "celtic": "iso885914", "celtic8": "iso885914", "isoceltic": "iso885914", "tis6200": "tis620", "tis62025291": "tis620", "tis62025330": "tis620", "10000": "macroman", "10006": "macgreek", "10007": "maccyrillic", "10079": "maciceland", "10081": "macturkish", "cspc8codepage437": "cp437", "cspc775baltic": "cp775", "cspc850multilingual": "cp850", "cspcp852": "cp852", "cspc862latinhebrew": "cp862", "cpgr": "cp869", "msee": "cp1250", "mscyrl": "cp1251", "msansi": "cp1252", "msgreek": "cp1253", "msturk": "cp1254", "mshebr": "cp1255", "msarab": "cp1256", "winbaltrim": "cp1257", "cp20866": "koi8r", "20866": "koi8r", "ibm878": "koi8r", "cskoi8r": "koi8r", "cp21866": "koi8u", "21866": "koi8u", "ibm1168": "koi8u", "strk10482002": "rk1048", "tcvn5712": "tcvn", "tcvn57121": "tcvn", "gb198880": "iso646cn", "cn": "iso646cn", "csiso14jisc6220ro": "iso646jp", "jisc62201969ro": "iso646jp", "jp": "iso646jp", "cshproman8": "hproman8", "r8": "hproman8", "roman8": "hproman8", "xroman8": "hproman8", "ibm1051": "hproman8", "mac": "macintosh", "csmacintosh": "macintosh", };
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * $Id$ */ #if !defined(XERCESC_INCLUDE_GUARD_KEYVALUEPAIR_HPP) #define XERCESC_INCLUDE_GUARD_KEYVALUEPAIR_HPP #include <xercesc/util/XMemory.hpp> XERCES_CPP_NAMESPACE_BEGIN template <class TKey, class TValue> class KeyValuePair : public XMemory { public : // ------------------------------------------------------------------- // Constructors and Destructor // ------------------------------------------------------------------- KeyValuePair(); KeyValuePair(const TKey& key, const TValue& value); KeyValuePair(const KeyValuePair<TKey,TValue>& toCopy); ~KeyValuePair(); // ------------------------------------------------------------------- // Getters // ------------------------------------------------------------------- const TKey& getKey() const; TKey& getKey(); const TValue& getValue() const; TValue& getValue(); // ------------------------------------------------------------------- // Setters // ------------------------------------------------------------------- TKey& setKey(const TKey& newKey); TValue& setValue(const TValue& newValue); private : // unimplemented: KeyValuePair<TKey,TValue>& operator=(const KeyValuePair<TKey,TValue>&); // ------------------------------------------------------------------- // Private data members // // fKey // The object that represents the key of the pair // // fValue // The object that represents the value of the pair // ------------------------------------------------------------------- TKey fKey; TValue fValue; }; XERCES_CPP_NAMESPACE_END #if !defined(XERCES_TMPLSINC) #include <xercesc/util/KeyValuePair.c> #endif #endif
{ "pile_set_name": "Github" }
/** * Author......: See docs/credits.txt * License.....: MIT */ #define NEW_SIMD_CODE #include "inc_vendor.cl" #include "inc_hash_constants.h" #include "inc_hash_functions.cl" #include "inc_types.cl" #include "inc_common.cl" #include "inc_simd.cl" __kernel void m01000_m04 (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const comb_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) { /** * modifier */ const u32 lid = get_local_id (0); /** * base */ const u32 gid = get_global_id (0); if (gid >= gid_max) return; u32 pw_buf0[4]; u32 pw_buf1[4]; pw_buf0[0] = pws[gid].i[0]; pw_buf0[1] = pws[gid].i[1]; pw_buf0[2] = pws[gid].i[2]; pw_buf0[3] = pws[gid].i[3]; pw_buf1[0] = pws[gid].i[4]; pw_buf1[1] = pws[gid].i[5]; pw_buf1[2] = pws[gid].i[6]; pw_buf1[3] = pws[gid].i[7]; const u32 pw_l_len = pws[gid].pw_len; /** * loop */ for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) { const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos); const u32x pw_len = pw_l_len + pw_r_len; /** * concat password candidate */ u32x wordl0[4] = { 0 }; u32x wordl1[4] = { 0 }; u32x wordl2[4] = { 0 }; u32x wordl3[4] = { 0 }; wordl0[0] = pw_buf0[0]; wordl0[1] = pw_buf0[1]; wordl0[2] = pw_buf0[2]; wordl0[3] = pw_buf0[3]; wordl1[0] = pw_buf1[0]; wordl1[1] = pw_buf1[1]; wordl1[2] = pw_buf1[2]; wordl1[3] = pw_buf1[3]; u32x wordr0[4] = { 0 }; u32x wordr1[4] = { 0 }; u32x wordr2[4] = { 0 }; u32x wordr3[4] = { 0 }; wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); if (combs_mode == COMBINATOR_MODE_BASE_LEFT) { switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); } else { switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); } u32x w0[4]; u32x w1[4]; u32x w2[4]; u32x w3[4]; w0[0] = wordl0[0] | wordr0[0]; w0[1] = wordl0[1] | wordr0[1]; w0[2] = wordl0[2] | wordr0[2]; w0[3] = wordl0[3] | wordr0[3]; w1[0] = wordl1[0] | wordr1[0]; w1[1] = wordl1[1] | wordr1[1]; w1[2] = wordl1[2] | wordr1[2]; w1[3] = wordl1[3] | wordr1[3]; w2[0] = wordl2[0] | wordr2[0]; w2[1] = wordl2[1] | wordr2[1]; w2[2] = wordl2[2] | wordr2[2]; w2[3] = wordl2[3] | wordr2[3]; w3[0] = wordl3[0] | wordr3[0]; w3[1] = wordl3[1] | wordr3[1]; w3[2] = wordl3[2] | wordr3[2]; w3[3] = wordl3[3] | wordr3[3]; make_utf16le (w1, w2, w3); make_utf16le (w0, w0, w1); w3[2] = pw_len * 8 * 2; w3[3] = 0; /** * md4 */ u32x a = MD4M_A; u32x b = MD4M_B; u32x c = MD4M_C; u32x d = MD4M_D; MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00); MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01); MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02); MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03); MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00); MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01); MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02); MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03); MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00); MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01); MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02); MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03); MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00); MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01); MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02); MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03); MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10); MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11); MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12); MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13); MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10); MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11); MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12); MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13); MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10); MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11); MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12); MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13); MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10); MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11); MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12); MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13); MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20); MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21); MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22); MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23); MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20); MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21); MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22); MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23); MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20); MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21); MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22); MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23); MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20); MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21); MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22); MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23); COMPARE_M_SIMD (a, d, c, b); } } __kernel void m01000_m08 (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const comb_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) { } __kernel void m01000_m16 (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const comb_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) { } __kernel void m01000_s04 (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const comb_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) { /** * modifier */ const u32 lid = get_local_id (0); /** * base */ const u32 gid = get_global_id (0); if (gid >= gid_max) return; u32 pw_buf0[4]; u32 pw_buf1[4]; pw_buf0[0] = pws[gid].i[0]; pw_buf0[1] = pws[gid].i[1]; pw_buf0[2] = pws[gid].i[2]; pw_buf0[3] = pws[gid].i[3]; pw_buf1[0] = pws[gid].i[4]; pw_buf1[1] = pws[gid].i[5]; pw_buf1[2] = pws[gid].i[6]; pw_buf1[3] = pws[gid].i[7]; const u32 pw_l_len = pws[gid].pw_len; /** * digest */ const u32 search[4] = { digests_buf[digests_offset].digest_buf[DGST_R0], digests_buf[digests_offset].digest_buf[DGST_R1], digests_buf[digests_offset].digest_buf[DGST_R2], digests_buf[digests_offset].digest_buf[DGST_R3] }; /** * loop */ for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE) { const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos); const u32x pw_len = pw_l_len + pw_r_len; /** * concat password candidate */ u32x wordl0[4] = { 0 }; u32x wordl1[4] = { 0 }; u32x wordl2[4] = { 0 }; u32x wordl3[4] = { 0 }; wordl0[0] = pw_buf0[0]; wordl0[1] = pw_buf0[1]; wordl0[2] = pw_buf0[2]; wordl0[3] = pw_buf0[3]; wordl1[0] = pw_buf1[0]; wordl1[1] = pw_buf1[1]; wordl1[2] = pw_buf1[2]; wordl1[3] = pw_buf1[3]; u32x wordr0[4] = { 0 }; u32x wordr1[4] = { 0 }; u32x wordr2[4] = { 0 }; u32x wordr3[4] = { 0 }; wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); if (combs_mode == COMBINATOR_MODE_BASE_LEFT) { switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); } else { switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); } u32x w0[4]; u32x w1[4]; u32x w2[4]; u32x w3[4]; w0[0] = wordl0[0] | wordr0[0]; w0[1] = wordl0[1] | wordr0[1]; w0[2] = wordl0[2] | wordr0[2]; w0[3] = wordl0[3] | wordr0[3]; w1[0] = wordl1[0] | wordr1[0]; w1[1] = wordl1[1] | wordr1[1]; w1[2] = wordl1[2] | wordr1[2]; w1[3] = wordl1[3] | wordr1[3]; w2[0] = wordl2[0] | wordr2[0]; w2[1] = wordl2[1] | wordr2[1]; w2[2] = wordl2[2] | wordr2[2]; w2[3] = wordl2[3] | wordr2[3]; w3[0] = wordl3[0] | wordr3[0]; w3[1] = wordl3[1] | wordr3[1]; w3[2] = wordl3[2] | wordr3[2]; w3[3] = wordl3[3] | wordr3[3]; make_utf16le (w1, w2, w3); make_utf16le (w0, w0, w1); w3[2] = pw_len * 8 * 2; w3[3] = 0; /** * md4 */ u32x a = MD4M_A; u32x b = MD4M_B; u32x c = MD4M_C; u32x d = MD4M_D; MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00); MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01); MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02); MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03); MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00); MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01); MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02); MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03); MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00); MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01); MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02); MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03); MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00); MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01); MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02); MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03); MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10); MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11); MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12); MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13); MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10); MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11); MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12); MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13); MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10); MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11); MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12); MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13); MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10); MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11); MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12); MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13); MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20); MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21); MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22); MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23); MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20); MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21); MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22); MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23); MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20); MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21); MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22); MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23); MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20); if (MATCHES_NONE_VS (a, search[0])) continue; MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21); MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22); MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23); COMPARE_S_SIMD (a, d, c, b); } } __kernel void m01000_s08 (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const comb_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) { } __kernel void m01000_s16 (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const comb_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) { }
{ "pile_set_name": "Github" }
#!/usr/bin/env perl #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | # / __| | | | |_) | | # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # # Copyright (C) 1998 - 2010, Daniel Stenberg, <[email protected]>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at https://curl.haxx.se/docs/copyright.html. # # You may opt to use, copy, modify, merge, publish, distribute and/or sell # copies of the Software, and permit persons to whom the Software is # furnished to do so, under the terms of the COPYING file. # # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY # KIND, either express or implied. # ########################################################################### # This script accepts a source file as input on the command line. # # It first loads the 'symbols-in-versions' document and stores a lookup # table for all known symbols for which version they were introduced. # # It then scans the given source file to dig up all symbols starting with CURL. # Finally, it sorts the internal list of found symbols (using the version # number as sort key) and then it outputs the most recent version number and # the symbols from that version that are used. # # Usage: # # version-check.pl [source file] # open(S, "<../libcurl/symbols-in-versions") || die; my %doc; my %rem; while(<S>) { if(/(^CURL[^ \n]*) *(.*)/) { my ($sym, $rest)=($1, $2); my @a=split(/ +/, $rest); $doc{$sym}=$a[0]; # when it was introduced if($a[2]) { # this symbol is documented to have been present the last time # in this release $rem{$sym}=$a[2]; } } } close(S); sub age { my ($ver)=@_; my @s=split(/\./, $ver); return $s[0]*10000+$s[1]*100+$s[2]; } my %used; open(C, "<$ARGV[0]") || die; while(<C>) { if(/\W(CURL[_A-Z0-9v]+)\W/) { #print "$1\n"; $used{$1}++; } } close(C); sub sortversions { my $r = age($doc{$a}) <=> age($doc{$b}); if(!$r) { $r = $a cmp $b; } return $r; } my @recent = reverse sort sortversions keys %used; # the most recent symbol my $newsym = $recent[0]; # the most recent version my $newver = $doc{$newsym}; print "The scanned source uses these symbols introduced in $newver:\n"; for my $w (@recent) { if($doc{$w} eq $newver) { printf " $w\n"; next; } last; }
{ "pile_set_name": "Github" }
/* * Copyright 2007-2008 the original author or 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 org.gradle.api; /** * <p>A {@code Rule} represents some action to perform when an unknown domain object is referenced. The rule can use the * domain object name to add an implicit domain object.</p> */ public interface Rule { /** * Returns the description of the rule. This is used for reporting purposes. * * @return the description. should not return null. */ String getDescription(); /** * Applies this rule for the given unknown domain object. The rule can choose to ignore this name, or add a domain * object with the given name. * * @param domainObjectName The name of the unknown domain object. */ void apply(String domainObjectName); }
{ "pile_set_name": "Github" }
/* ============================================================================= FILE: UKFileWatcher.h PROJECT: Filie COPYRIGHT: (c) 2005 M. Uli Kusterer, all rights reserved. AUTHORS: M. Uli Kusterer - UK LICENSES: MIT License REVISIONS: 2006-03-13 UK Moved notification constants to .m file. 2005-02-25 UK Created. ========================================================================== */ /* This is a protocol that file change notification classes should adopt. That way, no matter whether you use Carbon's FNNotify/FNSubscribe, BSD's kqueue or whatever, the object being notified can react to change notifications the same way, and you can easily swap one out for the other to cater to different OS versions, target volumes etc. */ // ----------------------------------------------------------------------------- // Protocol: // ----------------------------------------------------------------------------- @protocol JournlerFileWatcher // +(id) sharedFileWatcher; // Singleton accessor. Not officially part of the protocol, but use this name if you provide a singleton. -(void) addPath: (NSString*)path; -(void) removePath: (NSString*)path; -(id) delegate; -(void) setDelegate: (id)newDelegate; @end // ----------------------------------------------------------------------------- // Methods delegates need to provide: // ----------------------------------------------------------------------------- @interface NSObject (JournlerFileWatcherDelegate) -(void) watcher: (id<JournlerFileWatcher>)kq receivedNotification: (NSString*)nm forPath: (NSString*)fpath; @end // Notifications this sends: /* object = the file watcher object userInfo.path = file path watched These notifications are sent via the NSWorkspace notification center */ extern NSString* UKFileWatcherRenameNotification; extern NSString* UKFileWatcherWriteNotification; extern NSString* UKFileWatcherDeleteNotification; extern NSString* UKFileWatcherAttributeChangeNotification; extern NSString* UKFileWatcherSizeIncreaseNotification; extern NSString* UKFileWatcherLinkCountChangeNotification; extern NSString* UKFileWatcherAccessRevocationNotification;
{ "pile_set_name": "Github" }
--TEST-- get_parent_class() tests --FILE-- <?php interface i { function test(); } class foo implements i { function test() { var_dump(get_parent_class()); } } class bar extends foo { function test_bar() { var_dump(get_parent_class()); } } $bar = new bar; $foo = new foo; $foo->test(); $bar->test(); $bar->test_bar(); var_dump(get_parent_class($bar)); var_dump(get_parent_class($foo)); var_dump(get_parent_class("bar")); var_dump(get_parent_class("foo")); var_dump(get_parent_class("i")); var_dump(get_parent_class("")); var_dump(get_parent_class("[[[[")); var_dump(get_parent_class(" ")); var_dump(get_parent_class(new stdclass)); var_dump(get_parent_class(array())); var_dump(get_parent_class(1)); echo "Done\n"; ?> --EXPECTF-- bool(false) bool(false) string(3) "foo" string(3) "foo" bool(false) string(3) "foo" bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) Done
{ "pile_set_name": "Github" }
#ifndef CAFFE_UTIL_NCCL_H_ #define CAFFE_UTIL_NCCL_H_ #ifdef USE_NCCL #include <nccl.h> #include "caffe/common.hpp" #define NCCL_CHECK(condition) \ { \ ncclResult_t result = condition; \ CHECK_EQ(result, ncclSuccess) << " " \ << ncclGetErrorString(result); \ } namespace caffe { namespace nccl { template <typename Dtype> class dataType; template<> class dataType<float> { public: static const ncclDataType_t type = ncclFloat; }; template<> class dataType<double> { public: static const ncclDataType_t type = ncclDouble; }; } // namespace nccl } // namespace caffe #endif // end USE_NCCL #endif // CAFFE_UTIL_NCCL_H_
{ "pile_set_name": "Github" }
library built_redux; export 'src/action.dart'; export 'src/reducer_builder.dart'; export 'src/middleware.dart'; export 'src/store.dart'; export 'src/store_change.dart'; export 'src/typedefs.dart';
{ "pile_set_name": "Github" }
## ## Copyright (C) by Argonne National Laboratory ## See COPYRIGHT in top-level directory ## mpi_sources += \ src/mpi/attr/attr_delete.c \ src/mpi/attr/attr_get.c \ src/mpi/attr/attr_put.c \ src/mpi/attr/comm_create_keyval.c \ src/mpi/attr/comm_delete_attr.c \ src/mpi/attr/comm_free_keyval.c \ src/mpi/attr/comm_get_attr.c \ src/mpi/attr/comm_set_attr.c \ src/mpi/attr/keyval_create.c \ src/mpi/attr/keyval_free.c \ src/mpi/attr/type_create_keyval.c \ src/mpi/attr/type_delete_attr.c \ src/mpi/attr/type_free_keyval.c \ src/mpi/attr/type_get_attr.c \ src/mpi/attr/type_set_attr.c \ src/mpi/attr/win_create_keyval.c \ src/mpi/attr/win_delete_attr.c \ src/mpi/attr/win_free_keyval.c \ src/mpi/attr/win_get_attr.c \ src/mpi/attr/win_set_attr.c noinst_HEADERS += src/mpi/attr/attr.h mpi_core_sources += \ src/mpi/attr/attrutil.c \ src/mpi/attr/dup_fn.c
{ "pile_set_name": "Github" }
require('../../modules/es6.object.prevent-extensions'); module.exports = require('../../modules/_core').Object.preventExtensions;
{ "pile_set_name": "Github" }
resource_registry: OS::TripleO::DeployedServerEnvironment: ../deployed-server/deployed-server-environment-output.yaml
{ "pile_set_name": "Github" }
# -*- mode: snippet -*- # name: LaTeX header # key: lhe # condition: (= (current-column) 3) # contributor: Rafael Villarroel ([email protected]) # -- #+LATEX_HEADER: ${1:\usepackage{$2}}
{ "pile_set_name": "Github" }
[ 1; 2; 3; 4; 5; 6 ] |> List.groupBy (fun i -> i / 2) |> List.map (fun (group, xs) -> xs.Length) |> List.toSeq
{ "pile_set_name": "Github" }
/****************************************************************************** * Copyright (C) Ultraleap, Inc. 2011-2020. * * * * Use subject to the terms of the Apache License 2.0 available at * * http://www.apache.org/licenses/LICENSE-2.0, or another agreement * * between Ultraleap and you, your company or other organization. * ******************************************************************************/ using System.Collections.Generic; using UnityEngine; #if UNITY_2017_2_OR_NEWER using UnityEngine.XR; #else using UnityEngine.VR; #endif namespace Leap.Unity { /// <summary> /// Wraps various (but not all) "XR" calls with Unity 5.6-supporting "VR" calls /// via #ifdefs. /// </summary> public static class XRSupportUtil { #if UNITY_2019_2_OR_NEWER private static System.Collections.Generic.List<XRNodeState> nodeStates = new System.Collections.Generic.List<XRNodeState>(); #endif public static bool IsXREnabled() { #if UNITY_2017_2_OR_NEWER return XRSettings.enabled; #else return VRSettings.enabled; #endif } public static bool IsXRDevicePresent() { #if UNITY_2020_1_OR_NEWER return XRSettings.isDeviceActive; #elif UNITY_2017_2_OR_NEWER return XRDevice.isPresent; #else return VRDevice.isPresent; #endif } static bool outputPresenceWarning = false; public static bool IsUserPresent(bool defaultPresence = true) { #if UNITY_2019_3_OR_NEWER var devices = new List<InputDevice>(); InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.HeadMounted, devices); if (devices.Count == 0 && !outputPresenceWarning) { Debug.LogWarning("No head-mounted devices found. Possibly no HMD is available to the XR system."); outputPresenceWarning = true; } if (devices.Count != 0) { var device = devices[0]; if (device.TryGetFeatureValue(CommonUsages.userPresence, out var userPresent)) { return userPresent; } } #elif UNITY_2017_2_OR_NEWER var userPresence = XRDevice.userPresence; if (userPresence == UserPresenceState.Present) { return true; } else if (!outputPresenceWarning && userPresence == UserPresenceState.Unsupported) { Debug.LogWarning("XR UserPresenceState unsupported (XR support is probably disabled)."); outputPresenceWarning = true; } #else if (!outputPresenceWarning){ Debug.LogWarning("XR UserPresenceState is only supported in 2017.2 and newer."); outputPresenceWarning = true; } #endif return defaultPresence; } public static Vector3 GetXRNodeCenterEyeLocalPosition() { #if UNITY_2019_2_OR_NEWER InputTracking.GetNodeStates(nodeStates); Vector3 position; foreach(XRNodeState state in nodeStates) { if(state.nodeType == XRNode.CenterEye && state.TryGetPosition(out position)) { return position; } } return Vector3.zero; #elif UNITY_2017_2_OR_NEWER return InputTracking.GetLocalPosition(XRNode.CenterEye); #else return InputTracking.GetLocalPosition(VRNode.CenterEye); #endif } public static Quaternion GetXRNodeCenterEyeLocalRotation() { #if UNITY_2019_2_OR_NEWER InputTracking.GetNodeStates(nodeStates); Quaternion rotation; foreach (XRNodeState state in nodeStates) { if (state.nodeType == XRNode.CenterEye && state.TryGetRotation(out rotation)) { return rotation; } } return Quaternion.identity; #elif UNITY_2017_2_OR_NEWER return InputTracking.GetLocalRotation(XRNode.CenterEye); #else return InputTracking.GetLocalRotation(VRNode.CenterEye); #endif } public static Vector3 GetXRNodeHeadLocalPosition() { #if UNITY_2019_2_OR_NEWER InputTracking.GetNodeStates(nodeStates); Vector3 position; foreach(XRNodeState state in nodeStates) { if(state.nodeType == XRNode.Head && state.TryGetPosition(out position)) { return position; } } return Vector3.zero; #elif UNITY_2017_2_OR_NEWER return InputTracking.GetLocalPosition(XRNode.Head); #else return InputTracking.GetLocalPosition(VRNode.Head); #endif } public static Quaternion GetXRNodeHeadLocalRotation() { #if UNITY_2019_2_OR_NEWER InputTracking.GetNodeStates(nodeStates); Quaternion rotation; foreach (XRNodeState state in nodeStates) { if (state.nodeType == XRNode.Head && state.TryGetRotation(out rotation)) { return rotation; } } return Quaternion.identity; #elif UNITY_2017_2_OR_NEWER return InputTracking.GetLocalRotation(XRNode.Head); #else return InputTracking.GetLocalRotation(VRNode.Head); #endif } public static Vector3 GetXRNodeLocalPosition(int node) { #if UNITY_2019_2_OR_NEWER InputTracking.GetNodeStates(nodeStates); Vector3 position; foreach(XRNodeState state in nodeStates) { if(state.nodeType == (XRNode)node && state.TryGetPosition(out position)) { return position; } } return Vector3.zero; #elif UNITY_2017_2_OR_NEWER return InputTracking.GetLocalPosition((XRNode)node); #else return InputTracking.GetLocalPosition((VRNode)node); #endif } public static Quaternion GetXRNodeLocalRotation(int node) { #if UNITY_2019_2_OR_NEWER InputTracking.GetNodeStates(nodeStates); Quaternion rotation; foreach (XRNodeState state in nodeStates) { if (state.nodeType == (XRNode)node && state.TryGetRotation(out rotation)) { return rotation; } } return Quaternion.identity; #elif UNITY_2017_2_OR_NEWER return InputTracking.GetLocalRotation((XRNode)node); #else return InputTracking.GetLocalRotation((VRNode)node); #endif } public static void Recenter() { #if UNITY_2019_3_OR_NEWER var devices = new List<InputDevice>(); InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.HeadMounted, devices); if (devices.Count == 0) return; var hmdDevice = devices[0]; hmdDevice.subsystem.TryRecenter(); #else InputTracking.Recenter(); #endif } public static string GetLoadedDeviceName() { #if UNITY_2017_2_OR_NEWER return XRSettings.loadedDeviceName; #else return VRSettings.loadedDeviceName; #endif } /// <summary> Returns whether there's a floor available. </summary> public static bool IsRoomScale() { #if UNITY_2019_3_OR_NEWER var devices = new List<InputDevice>(); InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.HeadMounted, devices); if (devices.Count == 0) return false; var hmdDevice = devices[0]; return hmdDevice.subsystem.GetTrackingOriginMode().HasFlag(TrackingOriginModeFlags.Floor); #elif UNITY_2017_2_OR_NEWER return XRDevice.GetTrackingSpaceType() == TrackingSpaceType.RoomScale; #else return VRDevice.GetTrackingSpaceType() == TrackingSpaceType.RoomScale; #endif } static List<Vector3> _boundaryPoints = new List<Vector3>(); /// <summary> Returns whether the playspace is larger than 1m on its shortest side. </summary> public static bool IsLargePlayspace() { #if UNITY_2020_1_OR_NEWER // Oculus reports a floor centered space now... var devices = new List<InputDevice>(); InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.HeadMounted, devices); if (devices.Count == 0) return false; var hmdDevice = devices[0]; hmdDevice.subsystem.TryGetBoundaryPoints(_boundaryPoints); Bounds playspaceSize = new Bounds(); foreach(Vector3 boundaryPoint in _boundaryPoints) { playspaceSize.Encapsulate(boundaryPoint); } return playspaceSize.size.magnitude > 1f; // Playspace is greater than 1m on its shortest axis #else return IsRoomScale(); #endif } public static float GetGPUTime() { float gpuTime = 0f; #if UNITY_5_6_OR_NEWER #if UNITY_2017_2_OR_NEWER UnityEngine.XR.XRStats.TryGetGPUTimeLastFrame(out gpuTime); #else UnityEngine.VR.VRStats.TryGetGPUTimeLastFrame(out gpuTime); #endif #else gpuTime = UnityEngine.VR.VRStats.gpuTimeLastFrame; #endif return gpuTime; } } }
{ "pile_set_name": "Github" }
#region snippetALL // Unused usings removed. using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using RazorPagesMovie.Models; using System; using System.Threading.Tasks; namespace RazorPagesMovie.Pages.Movies { public class CreateModel : PageModel { private readonly RazorPagesMovie.Models.RazorPagesMovieContext _context; public CreateModel(RazorPagesMovie.Models.RazorPagesMovieContext context) { _context = context; } public IActionResult OnGet() { return Page(); } [BindProperty] public Movie Movie { get; set; } #region snippetPost public async Task<IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return Page(); } _context.Movie.Add(Movie); await _context.SaveChangesAsync(); return RedirectToPage("./Index"); } #endregion } } #endregion
{ "pile_set_name": "Github" }
#import <Foundation/Foundation.h> @interface EXPUnsupportedObject : NSObject { NSString *_type; } @property (nonatomic, retain) NSString *type; - (instancetype)initWithType:(NSString *)type NS_DESIGNATED_INITIALIZER; @end
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.30729</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{F3D05B12-5F2F-489B-A634-3B3BD44F85A2}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>com.esri.gpt.csw</RootNamespace> <AssemblyName>CswClient</AssemblyName> <SccProjectName>SAK</SccProjectName> <SccLocalPath>SAK</SccLocalPath> <SccAuxPath>SAK</SccAuxPath> <SccProvider>SAK</SccProvider> <FileUpgradeFlags> </FileUpgradeFlags> <OldToolsVersion>3.5</OldToolsVersion> <UpgradeBackupLocation> </UpgradeBackupLocation> <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> <PublishUrl>http://localhost/CswClient/</PublishUrl> <Install>true</Install> <InstallFrom>Web</InstallFrom> <UpdateEnabled>true</UpdateEnabled> <UpdateMode>Foreground</UpdateMode> <UpdateInterval>7</UpdateInterval> <UpdateIntervalUnits>Days</UpdateIntervalUnits> <UpdatePeriodically>false</UpdatePeriodically> <UpdateRequired>false</UpdateRequired> <MapFileExtensions>true</MapFileExtensions> <ApplicationRevision>0</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> <IsWebBootstrapper>true</IsWebBootstrapper> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>..\..\Bin\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <DocumentationFile>..\..\Bin\CswClient.XML</DocumentationFile> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> <OutputPath>..\..\Bin\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <DocumentationFile>..\..\Bin\CswClient.XML</DocumentationFile> <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> </ItemGroup> <ItemGroup> <Compile Include="BoundingBox.cs" /> <Compile Include="CswCatalog.cs" /> <Compile Include="CswCatalogCapabilities.cs" /> <Compile Include="CswCatalogs.cs" /> <Compile Include="CswClient.cs" /> <Compile Include="CswManager.cs" /> <Compile Include="CswObjects.cs" /> <Compile Include="CswProfile.cs" /> <Compile Include="CswProfiles.cs" /> <Compile Include="CswRecord.cs" /> <Compile Include="CswRecords.cs" /> <Compile Include="CswSearchCriteria.cs" /> <Compile Include="CswSearchRequest.cs" /> <Compile Include="CswSearchResponse.cs" /> <Compile Include="DcList.cs" /> <Compile Include="Envelope.cs" /> <Compile Include="MapServiceInfo.cs" /> <Compile Include="PromptCredentials.cs"> <SubType>Form</SubType> </Compile> <Compile Include="PromptCredentials.Designer.cs"> <DependentUpon>PromptCredentials.cs</DependentUpon> </Compile> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Resources.Designer.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>Resources.resx</DependentUpon> </Compile> <Compile Include="Utils.cs" /> </ItemGroup> <ItemGroup> <EmbeddedResource Include="PromptCredentials.resx"> <DependentUpon>PromptCredentials.cs</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="Resources.resx"> <Generator>ResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.cs</LastGenOutput> </EmbeddedResource> </ItemGroup> <ItemGroup> <None Include="CswClient.properties" /> </ItemGroup> <ItemGroup> <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> <Visible>False</Visible> <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> <Install>false</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> <Visible>False</Visible> <ProductName>.NET Framework 3.5 SP1</ProductName> <Install>true</Install> </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> <Visible>False</Visible> <ProductName>Windows Installer 3.1</ProductName> <Install>true</Install> </BootstrapperPackage> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\AppLogger\trunk\src\AppLogger.csproj"> <Project>{2FFDEA64-1BC3-4FBF-BFEB-44C09499036C}</Project> <Name>AppLogger</Name> </ProjectReference> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. <Target Name="BeforeBuild"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>
{ "pile_set_name": "Github" }
/* * Copyright (C) 2015 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <gtkmm/widget.h> _DEFS(gtkmm,gtk) _PINCLUDE(gtkmm/private/widget_p.h) #include <gdkmm/glcontext.h> namespace Gtk { /** A widget used for drawing with OpenGL. * @newin{3,18} * @ingroup Widgets */ class GTKMM_API GLArea : public Widget { _CLASS_GTKOBJECT(GLArea,GtkGLArea,GTK_GL_AREA,Gtk::Widget,GtkWidget, , , GTKMM_API) public: _CTOR_DEFAULT _WRAP_METHOD(Glib::RefPtr<Gdk::GLContext> get_context(), gtk_gl_area_get_context, refreturn, newin "3,18") _WRAP_METHOD(Glib::RefPtr<const Gdk::GLContext> get_context() const, gtk_gl_area_get_context, refreturn, constversion, newin "3,18") _WRAP_METHOD(void make_current(), gtk_gl_area_make_current, newin "3,18") _WRAP_METHOD(void queue_render(), gtk_gl_area_queue_render, newin "3,18") _WRAP_METHOD(void attach_buffers(), gtk_gl_area_attach_buffers, newin "3,18") /** Check if any error is currently set on this <i>area</i>. * * The error may be obtained by using throw_if_error() and * set using set_error(). * * @newin{3,18} * * @return true if an error is currently set. */ bool has_error() const; _IGNORE(gtk_gl_area_get_error) /** Will throw the correct Glib::Error subclass if * any is currently set on this <i>area</i>. * * @newin{3,18} * * @throw Throws any currently set error (e.g. Gdk::GLError). */ void throw_if_error() const; #m4 _CONVERSION(`const Glib::Error&', `const GError*', __FR2P) /** Sets an error on the <i>area</i> which will be shown * instead of GL rendering. * * This is useful in the signal_create_context() handler * if GL context creation fails. * * @newin{3,18} * * @param error The error to set on the <i>area</i>. */ _WRAP_METHOD(void set_error(const Glib::Error& error), gtk_gl_area_set_error) /** Clears any previous set error on this <i>area</i> made with set_error(). * * @newin{3,18} */ void unset_error(); _WRAP_METHOD(bool get_has_depth_buffer() const, gtk_gl_area_get_has_depth_buffer, newin "3,18") _WRAP_METHOD(void set_has_depth_buffer(bool has_depth_buffer = true), gtk_gl_area_set_has_depth_buffer, newin "3,18") _WRAP_METHOD(bool get_has_stencil_buffer() const, gtk_gl_area_get_has_stencil_buffer, newin "3,18") _WRAP_METHOD(void set_has_stencil_buffer(bool has_stencil_buffer = true), gtk_gl_area_set_has_stencil_buffer, newin "3,18") _WRAP_METHOD(bool get_auto_render() const, gtk_gl_area_get_auto_render, newin "3,18") _WRAP_METHOD(void set_auto_render(bool auto_render = true), gtk_gl_area_set_auto_render, newin "3,18") _WRAP_METHOD(void get_required_version(int& major, int& minor) const, gtk_gl_area_get_required_version, newin "3,18") _WRAP_METHOD(void set_required_version(int major, int minor), gtk_gl_area_set_required_version, newin "3,18") _WRAP_METHOD(bool get_use_es() const, gtk_gl_area_get_use_es) _WRAP_METHOD(void set_use_es(bool use_es = true), gtk_gl_area_set_use_es) _WRAP_PROPERTY("auto-render", bool, newin "3,18") _WRAP_PROPERTY("context", Glib::RefPtr<Gdk::GLContext>, newin "3,18") _WRAP_PROPERTY("has-depth-buffer", bool, newin "3,18") _WRAP_PROPERTY("has-stencil-buffer", bool, newin "3,18") _WRAP_PROPERTY("use-es", bool) #m4 _CONVERSION(`Glib::RefPtr<Gdk::GLContext>', `GdkGLContext*', Glib::unwrap_copy($3)) _WRAP_SIGNAL(Glib::RefPtr<Gdk::GLContext> create_context(), "create_context", newin "3,18") #m4 _CONVERSION(`GdkGLContext*', `const Glib::RefPtr<Gdk::GLContext>&', Glib::wrap($3, true)) _WRAP_SIGNAL(bool render(const Glib::RefPtr<Gdk::GLContext>& context), "render", newin "3,18") _WRAP_SIGNAL(void resize(int width, int height), "resize", newin "3,18") }; } //namespace Gtk
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <MySubMain>true</MySubMain> <MainForm>Form1</MainForm> <SingleInstance>false</SingleInstance> <ShutdownMode>0</ShutdownMode> <EnableVisualStyles>true</EnableVisualStyles> <AuthenticationMode>0</AuthenticationMode> <SaveMySettingsOnExit>true</SaveMySettingsOnExit> </MyApplicationData>
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.accumulo.core.client; import static com.google.common.base.Preconditions.checkArgument; import java.io.File; import java.io.StringReader; import java.io.StringWriter; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.UUID; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.conf.PropertyType; import org.apache.commons.configuration2.CompositeConfiguration; import org.apache.commons.configuration2.Configuration; import org.apache.commons.configuration2.MapConfiguration; import org.apache.commons.configuration2.PropertiesConfiguration; import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; import org.apache.commons.configuration2.builder.fluent.Parameters; import org.apache.commons.configuration2.ex.ConfigurationException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; /** * Contains a list of property keys recognized by the Accumulo client and convenience methods for * setting them. * * @since 1.6.0 * @deprecated since 2.0.0, replaced by {@link Accumulo#newClient()} */ @Deprecated(since = "2.0.0") public class ClientConfiguration { private static final Logger log = LoggerFactory.getLogger(ClientConfiguration.class); public static final String USER_ACCUMULO_DIR_NAME = ".accumulo"; public static final String USER_CONF_FILENAME = "config"; public static final String GLOBAL_CONF_FILENAME = "client.conf"; private final CompositeConfiguration compositeConfig; public enum ClientProperty { // SSL RPC_SSL_TRUSTSTORE_PATH(Property.RPC_SSL_TRUSTSTORE_PATH), RPC_SSL_TRUSTSTORE_PASSWORD(Property.RPC_SSL_TRUSTSTORE_PASSWORD), RPC_SSL_TRUSTSTORE_TYPE(Property.RPC_SSL_TRUSTSTORE_TYPE), RPC_SSL_KEYSTORE_PATH(Property.RPC_SSL_KEYSTORE_PATH), RPC_SSL_KEYSTORE_PASSWORD(Property.RPC_SSL_KEYSTORE_PASSWORD), RPC_SSL_KEYSTORE_TYPE(Property.RPC_SSL_KEYSTORE_TYPE), RPC_USE_JSSE(Property.RPC_USE_JSSE), GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS(Property.GENERAL_SECURITY_CREDENTIAL_PROVIDER_PATHS), INSTANCE_RPC_SSL_CLIENT_AUTH(Property.INSTANCE_RPC_SSL_CLIENT_AUTH), INSTANCE_RPC_SSL_ENABLED(Property.INSTANCE_RPC_SSL_ENABLED), // ZooKeeper INSTANCE_ZK_HOST(Property.INSTANCE_ZK_HOST), INSTANCE_ZK_TIMEOUT(Property.INSTANCE_ZK_TIMEOUT), // Instance information INSTANCE_NAME("instance.name", null, PropertyType.STRING, "Name of Accumulo instance to connect to"), INSTANCE_ID("instance.id", null, PropertyType.STRING, "UUID of Accumulo instance to connect to"), // Tracing TRACE_SPAN_RECEIVERS(Property.TRACE_SPAN_RECEIVERS), TRACE_SPAN_RECEIVER_PREFIX(Property.TRACE_SPAN_RECEIVER_PREFIX), TRACE_ZK_PATH(Property.TRACE_ZK_PATH), // SASL / GSSAPI(Kerberos) /** * @since 1.7.0 */ INSTANCE_RPC_SASL_ENABLED(Property.INSTANCE_RPC_SASL_ENABLED), /** * @since 1.7.0 */ RPC_SASL_QOP(Property.RPC_SASL_QOP), /** * @since 1.7.0 */ KERBEROS_SERVER_PRIMARY("kerberos.server.primary", "accumulo", PropertyType.STRING, "The first component of the Kerberos principal, the 'primary', " + "that Accumulo servers use to login"); private String key; private String defaultValue; private PropertyType type; private String description; private ClientProperty(Property prop) { this(prop.getKey(), prop.getDefaultValue(), prop.getType(), prop.getDescription()); } private ClientProperty(String key, String defaultValue, PropertyType type, String description) { this.key = key; this.defaultValue = defaultValue; this.type = type; this.description = description; } public String getKey() { return key; } public String getDefaultValue() { return defaultValue; } private PropertyType getType() { return type; } public String getDescription() { return description; } public static ClientProperty getPropertyByKey(String key) { for (ClientProperty prop : ClientProperty.values()) if (prop.getKey().equals(key)) return prop; return null; } } private ClientConfiguration(List<? extends Configuration> configs) { compositeConfig = new CompositeConfiguration(configs); } /** * Attempts to load a configuration file from the system using the default search paths. Uses the * <em>ACCUMULO_CLIENT_CONF_PATH</em> environment variable, split on <em>File.pathSeparator</em>, * for a list of target files. * <p> * If <em>ACCUMULO_CLIENT_CONF_PATH</em> is not set, uses the following in this order: * <ul> * <li>~/.accumulo/config * <li><em>$ACCUMULO_CONF_DIR</em>/client.conf, if <em>$ACCUMULO_CONF_DIR</em> is defined. * <li>/etc/accumulo/client.conf * <li>/etc/accumulo/conf/client.conf * </ul> * <p> * A client configuration will then be read from each location using * <em>PropertiesConfiguration</em> to construct a configuration. That means the latest item will * be the one in the configuration. * * @see PropertiesConfiguration * @see File#pathSeparator */ public static ClientConfiguration loadDefault() { return loadFromSearchPath(getDefaultSearchPath()); } /** * Initializes an empty configuration object to be further configured with other methods on the * class. * * @since 1.9.0 */ public static ClientConfiguration create() { return new ClientConfiguration(Collections.emptyList()); } /** * Initializes a configuration object from the contents of a configuration file. Currently * supports Java "properties" files. The returned object can be further configured with subsequent * calls to other methods on this class. * * @param file * the path to the configuration file * @since 1.9.0 */ public static ClientConfiguration fromFile(File file) { FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder = new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class) .configure(new Parameters().properties().setFile(file)); try { return new ClientConfiguration(Collections.singletonList(propsBuilder.getConfiguration())); } catch (ConfigurationException e) { throw new IllegalArgumentException("Bad configuration file: " + file, e); } } /** * Initializes a configuration object from the contents of a map. The returned object can be * further configured with subsequent calls to other methods on this class. * * @param properties * a map containing the configuration properties to use * @since 1.9.0 */ public static ClientConfiguration fromMap(Map<String,String> properties) { MapConfiguration mapConf = new MapConfiguration(properties); return new ClientConfiguration(Collections.singletonList(mapConf)); } @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "process runs in same security context as user who provided path") private static ClientConfiguration loadFromSearchPath(List<String> paths) { List<Configuration> configs = new LinkedList<>(); for (String path : paths) { File conf = new File(path); if (conf.isFile() && conf.canRead()) { FileBasedConfigurationBuilder<PropertiesConfiguration> propsBuilder = new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class) .configure(new Parameters().properties().setFile(conf)); try { configs.add(propsBuilder.getConfiguration()); log.info("Loaded client configuration file {}", conf); } catch (ConfigurationException e) { throw new IllegalStateException("Error loading client configuration file " + conf, e); } } } // We couldn't find the client configuration anywhere if (configs.isEmpty()) { log.debug( "Found no client.conf in default paths. Using default client configuration values."); } return new ClientConfiguration(configs); } public static ClientConfiguration deserialize(String serializedConfig) { PropertiesConfiguration propConfig = new PropertiesConfiguration(); try { propConfig.getLayout().load(propConfig, new StringReader(serializedConfig)); } catch (ConfigurationException e) { throw new IllegalArgumentException( "Error deserializing client configuration: " + serializedConfig, e); } return new ClientConfiguration(Collections.singletonList(propConfig)); } /** * Muck the value of {@code clientConfPath} if it points to a directory by appending * {@code client.conf} to the end of the file path. This is a no-op if the value is not a * directory on the filesystem. * * @param clientConfPath * The value of ACCUMULO_CLIENT_CONF_PATH. */ @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "process runs in same security context as user who provided path") static String getClientConfPath(String clientConfPath) { if (clientConfPath == null) { return null; } File filePath = new File(clientConfPath); // If clientConfPath is a directory, tack on the default client.conf file name. if (filePath.exists() && filePath.isDirectory()) { return new File(filePath, "client.conf").toString(); } return clientConfPath; } private static List<String> getDefaultSearchPath() { String clientConfSearchPath = getClientConfPath(System.getenv("ACCUMULO_CLIENT_CONF_PATH")); List<String> clientConfPaths; if (clientConfSearchPath != null) { clientConfPaths = Arrays.asList(clientConfSearchPath.split(File.pathSeparator)); } else { // if $ACCUMULO_CLIENT_CONF_PATH env isn't set, priority from top to bottom is: // ~/.accumulo/config // $ACCUMULO_CONF_DIR/client.conf // /etc/accumulo/client.conf // /etc/accumulo/conf/client.conf clientConfPaths = new LinkedList<>(); clientConfPaths.add(System.getProperty("user.home") + File.separator + USER_ACCUMULO_DIR_NAME + File.separator + USER_CONF_FILENAME); if (System.getenv("ACCUMULO_CONF_DIR") != null) { clientConfPaths .add(System.getenv("ACCUMULO_CONF_DIR") + File.separator + GLOBAL_CONF_FILENAME); } clientConfPaths.add("/etc/accumulo/" + GLOBAL_CONF_FILENAME); clientConfPaths.add("/etc/accumulo/conf/" + GLOBAL_CONF_FILENAME); } return clientConfPaths; } public String serialize() { PropertiesConfiguration propConfig = new PropertiesConfiguration(); propConfig.copy(compositeConfig); StringWriter writer = new StringWriter(); try { propConfig.getLayout().save(propConfig, writer); } catch (ConfigurationException e) { // this should never happen throw new IllegalStateException(e); } return writer.toString(); } /** * Returns the value for prop, the default value if not present. * */ public String get(ClientProperty prop) { if (compositeConfig.containsKey(prop.getKey())) return compositeConfig.getString(prop.getKey()); else return prop.getDefaultValue(); } private void checkType(ClientProperty property, PropertyType type) { if (!property.getType().equals(type)) { String msg = "Configuration method intended for type " + type + " called with a " + property.getType() + " argument (" + property.getKey() + ")"; throw new IllegalArgumentException(msg); } } /** * Gets all properties under the given prefix in this configuration. * * @param property * prefix property, must be of type PropertyType.PREFIX * @return a map of property keys to values * @throws IllegalArgumentException * if property is not a prefix */ public Map<String,String> getAllPropertiesWithPrefix(ClientProperty property) { checkType(property, PropertyType.PREFIX); Map<String,String> propMap = new HashMap<>(); String prefix = property.getKey(); if (prefix.endsWith(".")) { prefix = prefix.substring(0, prefix.length() - 1); } Iterator<?> iter = compositeConfig.getKeys(prefix); while (iter.hasNext()) { String p = (String) iter.next(); propMap.put(p, compositeConfig.getString(p)); } return propMap; } /** * Sets the value of property to value * */ public void setProperty(ClientProperty prop, String value) { with(prop, value); } /** * Same as {@link #setProperty(ClientProperty, String)} but returns the ClientConfiguration for * chaining purposes */ public ClientConfiguration with(ClientProperty prop, String value) { return with(prop.getKey(), value); } /** * Sets the value of property to value * * @since 1.9.0 */ public void setProperty(String prop, String value) { with(prop, value); } /** * Same as {@link #setProperty(String, String)} but returns the ClientConfiguration for chaining * purposes * * @since 1.9.0 */ public ClientConfiguration with(String prop, String value) { compositeConfig.setProperty(prop, value); return this; } /** * Same as {@link #with(ClientProperty, String)} for ClientProperty.INSTANCE_NAME * */ public ClientConfiguration withInstance(String instanceName) { checkArgument(instanceName != null, "instanceName is null"); return with(ClientProperty.INSTANCE_NAME, instanceName); } /** * Same as {@link #with(ClientProperty, String)} for ClientProperty.INSTANCE_ID * */ public ClientConfiguration withInstance(UUID instanceId) { checkArgument(instanceId != null, "instanceId is null"); return with(ClientProperty.INSTANCE_ID, instanceId.toString()); } /** * Same as {@link #with(ClientProperty, String)} for ClientProperty.INSTANCE_ZK_HOST * */ public ClientConfiguration withZkHosts(String zooKeepers) { checkArgument(zooKeepers != null, "zooKeepers is null"); return with(ClientProperty.INSTANCE_ZK_HOST, zooKeepers); } /** * Same as {@link #with(ClientProperty, String)} for ClientProperty.INSTANCE_ZK_TIMEOUT * */ public ClientConfiguration withZkTimeout(int timeout) { return with(ClientProperty.INSTANCE_ZK_TIMEOUT, String.valueOf(timeout)); } /** * Same as {@link #withSsl(boolean, boolean)} with useJsseConfig set to false * */ public ClientConfiguration withSsl(boolean sslEnabled) { return withSsl(sslEnabled, false); } /** * Same as {@link #with(ClientProperty, String)} for ClientProperty.INSTANCE_RPC_SSL_ENABLED and * ClientProperty.RPC_USE_JSSE * */ public ClientConfiguration withSsl(boolean sslEnabled, boolean useJsseConfig) { return with(ClientProperty.INSTANCE_RPC_SSL_ENABLED, String.valueOf(sslEnabled)) .with(ClientProperty.RPC_USE_JSSE, String.valueOf(useJsseConfig)); } /** * Same as {@link #withTruststore(String, String, String)} with password null and type null * */ public ClientConfiguration withTruststore(String path) { return withTruststore(path, null, null); } /** * Same as {@link #with(ClientProperty, String)} for ClientProperty.RPC_SSL_TRUSTORE_PATH, * ClientProperty.RPC_SSL_TRUSTORE_PASSWORD, and ClientProperty.RPC_SSL_TRUSTORE_TYPE * */ public ClientConfiguration withTruststore(String path, String password, String type) { checkArgument(path != null, "path is null"); setProperty(ClientProperty.RPC_SSL_TRUSTSTORE_PATH, path); if (password != null) setProperty(ClientProperty.RPC_SSL_TRUSTSTORE_PASSWORD, password); if (type != null) setProperty(ClientProperty.RPC_SSL_TRUSTSTORE_TYPE, type); return this; } /** * Same as {@link #withKeystore(String, String, String)} with password null and type null * */ public ClientConfiguration withKeystore(String path) { return withKeystore(path, null, null); } /** * Same as {@link #with(ClientProperty, String)} for ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH, * ClientProperty.RPC_SSL_KEYSTORE_PATH, ClientProperty.RPC_SSL_KEYSTORE_PASSWORD, and * ClientProperty.RPC_SSL_KEYSTORE_TYPE * */ public ClientConfiguration withKeystore(String path, String password, String type) { checkArgument(path != null, "path is null"); setProperty(ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH, "true"); setProperty(ClientProperty.RPC_SSL_KEYSTORE_PATH, path); if (password != null) setProperty(ClientProperty.RPC_SSL_KEYSTORE_PASSWORD, password); if (type != null) setProperty(ClientProperty.RPC_SSL_KEYSTORE_TYPE, type); return this; } /** * Same as {@link #with(ClientProperty, String)} for ClientProperty.INSTANCE_RPC_SASL_ENABLED. * * @since 1.7.0 */ public ClientConfiguration withSasl(boolean saslEnabled) { return with(ClientProperty.INSTANCE_RPC_SASL_ENABLED, String.valueOf(saslEnabled)); } /** * Show whether SASL has been set on this configuration. * * @since 1.9.0 */ public boolean hasSasl() { return compositeConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), Boolean.parseBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getDefaultValue())); } /** * Same as {@link #with(ClientProperty, String)} for ClientProperty.INSTANCE_RPC_SASL_ENABLED and * ClientProperty.GENERAL_KERBEROS_PRINCIPAL. * * @param saslEnabled * Should SASL(kerberos) be enabled * @param kerberosServerPrimary * The 'primary' component of the Kerberos principal Accumulo servers use to login (e.g. * 'accumulo' in 'accumulo/_HOST@REALM') * @since 1.7.0 */ public ClientConfiguration withSasl(boolean saslEnabled, String kerberosServerPrimary) { return withSasl(saslEnabled).with(ClientProperty.KERBEROS_SERVER_PRIMARY, kerberosServerPrimary); } public boolean containsKey(String key) { return compositeConfig.containsKey(key); } public Iterator<String> getKeys() { return compositeConfig.getKeys(); } public String getString(String key) { return compositeConfig.getString(key); } }
{ "pile_set_name": "Github" }
// Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved. // This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license. // Code generated. DO NOT EDIT. // Object Storage Service API // // Common set of Object Storage and Archive Storage APIs for managing buckets, objects, and related resources. // For more information, see Overview of Object Storage (https://docs.cloud.oracle.com/Content/Object/Concepts/objectstorageoverview.htm) and // Overview of Archive Storage (https://docs.cloud.oracle.com/Content/Archive/Concepts/archivestorageoverview.htm). // package objectstorage import ( "github.com/oracle/oci-go-sdk/v25/common" ) // SseCustomerKeyDetails Specifies the details of the customer-provided encryption key (SSE-C) associated with an object. type SseCustomerKeyDetails struct { // Specifies the encryption algorithm. The only supported value is "AES256". Algorithm SseCustomerKeyDetailsAlgorithmEnum `mandatory:"true" json:"algorithm"` // Specifies the base64-encoded 256-bit encryption key to use to encrypt or decrypt the object data. Key *string `mandatory:"true" json:"key"` // Specifies the base64-encoded SHA256 hash of the encryption key. This value is used to check the integrity // of the encryption key. KeySha256 *string `mandatory:"true" json:"keySha256"` } func (m SseCustomerKeyDetails) String() string { return common.PointerString(m) } // SseCustomerKeyDetailsAlgorithmEnum Enum with underlying type: string type SseCustomerKeyDetailsAlgorithmEnum string // Set of constants representing the allowable values for SseCustomerKeyDetailsAlgorithmEnum const ( SseCustomerKeyDetailsAlgorithmAes256 SseCustomerKeyDetailsAlgorithmEnum = "AES256" ) var mappingSseCustomerKeyDetailsAlgorithm = map[string]SseCustomerKeyDetailsAlgorithmEnum{ "AES256": SseCustomerKeyDetailsAlgorithmAes256, } // GetSseCustomerKeyDetailsAlgorithmEnumValues Enumerates the set of values for SseCustomerKeyDetailsAlgorithmEnum func GetSseCustomerKeyDetailsAlgorithmEnumValues() []SseCustomerKeyDetailsAlgorithmEnum { values := make([]SseCustomerKeyDetailsAlgorithmEnum, 0) for _, v := range mappingSseCustomerKeyDetailsAlgorithm { values = append(values, v) } return values }
{ "pile_set_name": "Github" }
gen_mipmaps=false
{ "pile_set_name": "Github" }
/* Copyright 2017 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package v1 import ( meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" scheme "k8s.io/client-go/kubernetes/scheme" v1 "k8s.io/client-go/pkg/apis/networking/v1" rest "k8s.io/client-go/rest" ) // NetworkPoliciesGetter has a method to return a NetworkPolicyInterface. // A group's client should implement this interface. type NetworkPoliciesGetter interface { NetworkPolicies(namespace string) NetworkPolicyInterface } // NetworkPolicyInterface has methods to work with NetworkPolicy resources. type NetworkPolicyInterface interface { Create(*v1.NetworkPolicy) (*v1.NetworkPolicy, error) Update(*v1.NetworkPolicy) (*v1.NetworkPolicy, error) Delete(name string, options *meta_v1.DeleteOptions) error DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error Get(name string, options meta_v1.GetOptions) (*v1.NetworkPolicy, error) List(opts meta_v1.ListOptions) (*v1.NetworkPolicyList, error) Watch(opts meta_v1.ListOptions) (watch.Interface, error) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.NetworkPolicy, err error) NetworkPolicyExpansion } // networkPolicies implements NetworkPolicyInterface type networkPolicies struct { client rest.Interface ns string } // newNetworkPolicies returns a NetworkPolicies func newNetworkPolicies(c *NetworkingV1Client, namespace string) *networkPolicies { return &networkPolicies{ client: c.RESTClient(), ns: namespace, } } // Create takes the representation of a networkPolicy and creates it. Returns the server's representation of the networkPolicy, and an error, if there is any. func (c *networkPolicies) Create(networkPolicy *v1.NetworkPolicy) (result *v1.NetworkPolicy, err error) { result = &v1.NetworkPolicy{} err = c.client.Post(). Namespace(c.ns). Resource("networkpolicies"). Body(networkPolicy). Do(). Into(result) return } // Update takes the representation of a networkPolicy and updates it. Returns the server's representation of the networkPolicy, and an error, if there is any. func (c *networkPolicies) Update(networkPolicy *v1.NetworkPolicy) (result *v1.NetworkPolicy, err error) { result = &v1.NetworkPolicy{} err = c.client.Put(). Namespace(c.ns). Resource("networkpolicies"). Name(networkPolicy.Name). Body(networkPolicy). Do(). Into(result) return } // Delete takes name of the networkPolicy and deletes it. Returns an error if one occurs. func (c *networkPolicies) Delete(name string, options *meta_v1.DeleteOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("networkpolicies"). Name(name). Body(options). Do(). Error() } // DeleteCollection deletes a collection of objects. func (c *networkPolicies) DeleteCollection(options *meta_v1.DeleteOptions, listOptions meta_v1.ListOptions) error { return c.client.Delete(). Namespace(c.ns). Resource("networkpolicies"). VersionedParams(&listOptions, scheme.ParameterCodec). Body(options). Do(). Error() } // Get takes name of the networkPolicy, and returns the corresponding networkPolicy object, and an error if there is any. func (c *networkPolicies) Get(name string, options meta_v1.GetOptions) (result *v1.NetworkPolicy, err error) { result = &v1.NetworkPolicy{} err = c.client.Get(). Namespace(c.ns). Resource("networkpolicies"). Name(name). VersionedParams(&options, scheme.ParameterCodec). Do(). Into(result) return } // List takes label and field selectors, and returns the list of NetworkPolicies that match those selectors. func (c *networkPolicies) List(opts meta_v1.ListOptions) (result *v1.NetworkPolicyList, err error) { result = &v1.NetworkPolicyList{} err = c.client.Get(). Namespace(c.ns). Resource("networkpolicies"). VersionedParams(&opts, scheme.ParameterCodec). Do(). Into(result) return } // Watch returns a watch.Interface that watches the requested networkPolicies. func (c *networkPolicies) Watch(opts meta_v1.ListOptions) (watch.Interface, error) { opts.Watch = true return c.client.Get(). Namespace(c.ns). Resource("networkpolicies"). VersionedParams(&opts, scheme.ParameterCodec). Watch() } // Patch applies the patch and returns the patched networkPolicy. func (c *networkPolicies) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.NetworkPolicy, err error) { result = &v1.NetworkPolicy{} err = c.client.Patch(pt). Namespace(c.ns). Resource("networkpolicies"). SubResource(subresources...). Name(name). Body(data). Do(). Into(result) return }
{ "pile_set_name": "Github" }
using UnityEngine; using System.Collections; using System.Collections.Generic; namespace UnityEditor.XCodeEditor { public class PBXSortedDictionary : SortedDictionary<string, object> { public void Append( PBXDictionary dictionary ) { foreach( var item in dictionary) { this.Add( item.Key, item.Value ); } } public void Append<T>( PBXDictionary<T> dictionary ) where T : PBXObject { foreach( var item in dictionary) { this.Add( item.Key, item.Value ); } } } public class PBXSortedDictionary<T> : SortedDictionary<string, T> where T : PBXObject { public PBXSortedDictionary() { } public PBXSortedDictionary( PBXDictionary genericDictionary ) { foreach( KeyValuePair<string, object> currentItem in genericDictionary ) { if( ((string)((PBXDictionary)currentItem.Value)[ "isa" ]).CompareTo( typeof(T).Name ) == 0 ) { T instance = (T)System.Activator.CreateInstance( typeof(T), currentItem.Key, (PBXDictionary)currentItem.Value ); this.Add( currentItem.Key, instance ); } } } public void Add( T newObject ) { this.Add( newObject.guid, newObject ); } public void Append( PBXDictionary<T> dictionary ) { foreach( KeyValuePair<string, T> item in dictionary) { this.Add( item.Key, (T)item.Value ); } } } }
{ "pile_set_name": "Github" }
<!-- ~ Copyright (c) 2018 Martin Denham, Tuomas Airaksinen and the And Bible contributors. ~ ~ This file is part of And Bible (http://github.com/AndBible/and-bible). ~ ~ And Bible 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. ~ ~ And Bible 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 And Bible. ~ If not, see http://www.gnu.org/licenses/. ~ --> <vector android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> <path android:fillColor="#FF000000" android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/> </vector>
{ "pile_set_name": "Github" }
using Xamarin.Forms.CustomAttributes; using Xamarin.Forms.Internals; namespace Xamarin.Forms.Controls.Issues { #if UITEST [NUnit.Framework.Category(Core.UITests.UITestCategories.Bugzilla)] #endif [Preserve(AllMembers = true)] [Issue(IssueTracker.Bugzilla, 33890, "Setting CancelButtonColor does not have any effect", PlatformAffected.iOS)] public class Bugzilla33890 : TestContentPage { protected override void Init() { Label header = new Label { Text = "Search Bar", FontAttributes = FontAttributes.Bold, FontSize = 50, HorizontalOptions = LayoutOptions.Center }; SearchBar searchBar = new SearchBar { Placeholder = "Enter anything", CancelButtonColor = Color.Red }; Label reproSteps = new Label { Text = "Tap on the search bar and enter some text. The 'Cancel' button should appear. If the 'Cancel' button is not red, this is broken.", HorizontalOptions = LayoutOptions.Center }; Content = new StackLayout { Children = { header, searchBar, reproSteps } }; } } }
{ "pile_set_name": "Github" }
/*------------------------------------------------------------------------- * * buffile.c * Management of large buffered temporary files. * * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION * src/backend/storage/file/buffile.c * * NOTES: * * BufFiles provide a very incomplete emulation of stdio atop virtual Files * (as managed by fd.c). Currently, we only support the buffered-I/O * aspect of stdio: a read or write of the low-level File occurs only * when the buffer is filled or emptied. This is an even bigger win * for virtual Files than for ordinary kernel files, since reducing the * frequency with which a virtual File is touched reduces "thrashing" * of opening/closing file descriptors. * * Note that BufFile structs are allocated with palloc(), and therefore * will go away automatically at query/transaction end. Since the underlying * virtual Files are made with OpenTemporaryFile, all resources for * the file are certain to be cleaned up even if processing is aborted * by ereport(ERROR). The data structures required are made in the * palloc context that was current when the BufFile was created, and * any external resources such as temp files are owned by the ResourceOwner * that was current at that time. * * BufFile also supports temporary files that exceed the OS file size limit * (by opening multiple fd.c temporary files). This is an essential feature * for sorts and hashjoins on large amounts of data. * * BufFile supports temporary files that can be shared with other backends, as * infrastructure for parallel execution. Such files need to be created as a * member of a SharedFileSet that all participants are attached to. * * BufFile also supports temporary files that can be used by the single backend * when the corresponding files need to be survived across the transaction and * need to be opened and closed multiple times. Such files need to be created * as a member of a SharedFileSet. *------------------------------------------------------------------------- */ #include "postgres.h" #include "commands/tablespace.h" #include "executor/instrument.h" #include "miscadmin.h" #include "pgstat.h" #include "storage/buf_internals.h" #include "storage/buffile.h" #include "storage/fd.h" #include "utils/resowner.h" /* * We break BufFiles into gigabyte-sized segments, regardless of RELSEG_SIZE. * The reason is that we'd like large BufFiles to be spread across multiple * tablespaces when available. */ #define MAX_PHYSICAL_FILESIZE 0x40000000 #define BUFFILE_SEG_SIZE (MAX_PHYSICAL_FILESIZE / BLCKSZ) /* * This data structure represents a buffered file that consists of one or * more physical files (each accessed through a virtual file descriptor * managed by fd.c). */ struct BufFile { int numFiles; /* number of physical files in set */ /* all files except the last have length exactly MAX_PHYSICAL_FILESIZE */ File *files; /* palloc'd array with numFiles entries */ bool isInterXact; /* keep open over transactions? */ bool dirty; /* does buffer need to be written? */ bool readOnly; /* has the file been set to read only? */ SharedFileSet *fileset; /* space for segment files if shared */ const char *name; /* name of this BufFile if shared */ /* * resowner is the ResourceOwner to use for underlying temp files. (We * don't need to remember the memory context we're using explicitly, * because after creation we only repalloc our arrays larger.) */ ResourceOwner resowner; /* * "current pos" is position of start of buffer within the logical file. * Position as seen by user of BufFile is (curFile, curOffset + pos). */ int curFile; /* file index (0..n) part of current pos */ off_t curOffset; /* offset part of current pos */ int pos; /* next read/write position in buffer */ int nbytes; /* total # of valid bytes in buffer */ PGAlignedBlock buffer; }; static BufFile *makeBufFileCommon(int nfiles); static BufFile *makeBufFile(File firstfile); static void extendBufFile(BufFile *file); static void BufFileLoadBuffer(BufFile *file); static void BufFileDumpBuffer(BufFile *file); static void BufFileFlush(BufFile *file); static File MakeNewSharedSegment(BufFile *file, int segment); /* * Create BufFile and perform the common initialization. */ static BufFile * makeBufFileCommon(int nfiles) { BufFile *file = (BufFile *) palloc(sizeof(BufFile)); file->numFiles = nfiles; file->isInterXact = false; file->dirty = false; file->resowner = CurrentResourceOwner; file->curFile = 0; file->curOffset = 0L; file->pos = 0; file->nbytes = 0; return file; } /* * Create a BufFile given the first underlying physical file. * NOTE: caller must set isInterXact if appropriate. */ static BufFile * makeBufFile(File firstfile) { BufFile *file = makeBufFileCommon(1); file->files = (File *) palloc(sizeof(File)); file->files[0] = firstfile; file->readOnly = false; file->fileset = NULL; file->name = NULL; return file; } /* * Add another component temp file. */ static void extendBufFile(BufFile *file) { File pfile; ResourceOwner oldowner; /* Be sure to associate the file with the BufFile's resource owner */ oldowner = CurrentResourceOwner; CurrentResourceOwner = file->resowner; if (file->fileset == NULL) pfile = OpenTemporaryFile(file->isInterXact); else pfile = MakeNewSharedSegment(file, file->numFiles); Assert(pfile >= 0); CurrentResourceOwner = oldowner; file->files = (File *) repalloc(file->files, (file->numFiles + 1) * sizeof(File)); file->files[file->numFiles] = pfile; file->numFiles++; } /* * Create a BufFile for a new temporary file (which will expand to become * multiple temporary files if more than MAX_PHYSICAL_FILESIZE bytes are * written to it). * * If interXact is true, the temp file will not be automatically deleted * at end of transaction. * * Note: if interXact is true, the caller had better be calling us in a * memory context, and with a resource owner, that will survive across * transaction boundaries. */ BufFile * BufFileCreateTemp(bool interXact) { BufFile *file; File pfile; /* * Ensure that temp tablespaces are set up for OpenTemporaryFile to use. * Possibly the caller will have done this already, but it seems useful to * double-check here. Failure to do this at all would result in the temp * files always getting placed in the default tablespace, which is a * pretty hard-to-detect bug. Callers may prefer to do it earlier if they * want to be sure that any required catalog access is done in some other * resource context. */ PrepareTempTablespaces(); pfile = OpenTemporaryFile(interXact); Assert(pfile >= 0); file = makeBufFile(pfile); file->isInterXact = interXact; return file; } /* * Build the name for a given segment of a given BufFile. */ static void SharedSegmentName(char *name, const char *buffile_name, int segment) { snprintf(name, MAXPGPATH, "%s.%d", buffile_name, segment); } /* * Create a new segment file backing a shared BufFile. */ static File MakeNewSharedSegment(BufFile *buffile, int segment) { char name[MAXPGPATH]; File file; /* * It is possible that there are files left over from before a crash * restart with the same name. In order for BufFileOpenShared() not to * get confused about how many segments there are, we'll unlink the next * segment number if it already exists. */ SharedSegmentName(name, buffile->name, segment + 1); SharedFileSetDelete(buffile->fileset, name, true); /* Create the new segment. */ SharedSegmentName(name, buffile->name, segment); file = SharedFileSetCreate(buffile->fileset, name); /* SharedFileSetCreate would've errored out */ Assert(file > 0); return file; } /* * Create a BufFile that can be discovered and opened read-only by other * backends that are attached to the same SharedFileSet using the same name. * * The naming scheme for shared BufFiles is left up to the calling code. The * name will appear as part of one or more filenames on disk, and might * provide clues to administrators about which subsystem is generating * temporary file data. Since each SharedFileSet object is backed by one or * more uniquely named temporary directory, names don't conflict with * unrelated SharedFileSet objects. */ BufFile * BufFileCreateShared(SharedFileSet *fileset, const char *name) { BufFile *file; file = makeBufFileCommon(1); file->fileset = fileset; file->name = pstrdup(name); file->files = (File *) palloc(sizeof(File)); file->files[0] = MakeNewSharedSegment(file, 0); file->readOnly = false; return file; } /* * Open a file that was previously created in another backend (or this one) * with BufFileCreateShared in the same SharedFileSet using the same name. * The backend that created the file must have called BufFileClose() or * BufFileExportShared() to make sure that it is ready to be opened by other * backends and render it read-only. */ BufFile * BufFileOpenShared(SharedFileSet *fileset, const char *name, int mode) { BufFile *file; char segment_name[MAXPGPATH]; Size capacity = 16; File *files; int nfiles = 0; files = palloc(sizeof(File) * capacity); /* * We don't know how many segments there are, so we'll probe the * filesystem to find out. */ for (;;) { /* See if we need to expand our file segment array. */ if (nfiles + 1 > capacity) { capacity *= 2; files = repalloc(files, sizeof(File) * capacity); } /* Try to load a segment. */ SharedSegmentName(segment_name, name, nfiles); files[nfiles] = SharedFileSetOpen(fileset, segment_name, mode); if (files[nfiles] <= 0) break; ++nfiles; CHECK_FOR_INTERRUPTS(); } /* * If we didn't find any files at all, then no BufFile exists with this * name. */ if (nfiles == 0) ereport(ERROR, (errcode_for_file_access(), errmsg("could not open temporary file \"%s\" from BufFile \"%s\": %m", segment_name, name))); file = makeBufFileCommon(nfiles); file->files = files; file->readOnly = (mode == O_RDONLY) ? true : false; file->fileset = fileset; file->name = pstrdup(name); return file; } /* * Delete a BufFile that was created by BufFileCreateShared in the given * SharedFileSet using the given name. * * It is not necessary to delete files explicitly with this function. It is * provided only as a way to delete files proactively, rather than waiting for * the SharedFileSet to be cleaned up. * * Only one backend should attempt to delete a given name, and should know * that it exists and has been exported or closed. */ void BufFileDeleteShared(SharedFileSet *fileset, const char *name) { char segment_name[MAXPGPATH]; int segment = 0; bool found = false; /* * We don't know how many segments the file has. We'll keep deleting * until we run out. If we don't manage to find even an initial segment, * raise an error. */ for (;;) { SharedSegmentName(segment_name, name, segment); if (!SharedFileSetDelete(fileset, segment_name, true)) break; found = true; ++segment; CHECK_FOR_INTERRUPTS(); } if (!found) elog(ERROR, "could not delete unknown shared BufFile \"%s\"", name); } /* * BufFileExportShared --- flush and make read-only, in preparation for sharing. */ void BufFileExportShared(BufFile *file) { /* Must be a file belonging to a SharedFileSet. */ Assert(file->fileset != NULL); /* It's probably a bug if someone calls this twice. */ Assert(!file->readOnly); BufFileFlush(file); file->readOnly = true; } /* * Close a BufFile * * Like fclose(), this also implicitly FileCloses the underlying File. */ void BufFileClose(BufFile *file) { int i; /* flush any unwritten data */ BufFileFlush(file); /* close and delete the underlying file(s) */ for (i = 0; i < file->numFiles; i++) FileClose(file->files[i]); /* release the buffer space */ pfree(file->files); pfree(file); } /* * BufFileLoadBuffer * * Load some data into buffer, if possible, starting from curOffset. * At call, must have dirty = false, pos and nbytes = 0. * On exit, nbytes is number of bytes loaded. */ static void BufFileLoadBuffer(BufFile *file) { File thisfile; /* * Advance to next component file if necessary and possible. */ if (file->curOffset >= MAX_PHYSICAL_FILESIZE && file->curFile + 1 < file->numFiles) { file->curFile++; file->curOffset = 0L; } /* * Read whatever we can get, up to a full bufferload. */ thisfile = file->files[file->curFile]; file->nbytes = FileRead(thisfile, file->buffer.data, sizeof(file->buffer), file->curOffset, WAIT_EVENT_BUFFILE_READ); if (file->nbytes < 0) { file->nbytes = 0; ereport(ERROR, (errcode_for_file_access(), errmsg("could not read file \"%s\": %m", FilePathName(thisfile)))); } /* we choose not to advance curOffset here */ if (file->nbytes > 0) pgBufferUsage.temp_blks_read++; } /* * BufFileDumpBuffer * * Dump buffer contents starting at curOffset. * At call, should have dirty = true, nbytes > 0. * On exit, dirty is cleared if successful write, and curOffset is advanced. */ static void BufFileDumpBuffer(BufFile *file) { int wpos = 0; int bytestowrite; File thisfile; /* * Unlike BufFileLoadBuffer, we must dump the whole buffer even if it * crosses a component-file boundary; so we need a loop. */ while (wpos < file->nbytes) { off_t availbytes; /* * Advance to next component file if necessary and possible. */ if (file->curOffset >= MAX_PHYSICAL_FILESIZE) { while (file->curFile + 1 >= file->numFiles) extendBufFile(file); file->curFile++; file->curOffset = 0L; } /* * Determine how much we need to write into this file. */ bytestowrite = file->nbytes - wpos; availbytes = MAX_PHYSICAL_FILESIZE - file->curOffset; if ((off_t) bytestowrite > availbytes) bytestowrite = (int) availbytes; thisfile = file->files[file->curFile]; bytestowrite = FileWrite(thisfile, file->buffer.data + wpos, bytestowrite, file->curOffset, WAIT_EVENT_BUFFILE_WRITE); if (bytestowrite <= 0) ereport(ERROR, (errcode_for_file_access(), errmsg("could not write to file \"%s\": %m", FilePathName(thisfile)))); file->curOffset += bytestowrite; wpos += bytestowrite; pgBufferUsage.temp_blks_written++; } file->dirty = false; /* * At this point, curOffset has been advanced to the end of the buffer, * ie, its original value + nbytes. We need to make it point to the * logical file position, ie, original value + pos, in case that is less * (as could happen due to a small backwards seek in a dirty buffer!) */ file->curOffset -= (file->nbytes - file->pos); if (file->curOffset < 0) /* handle possible segment crossing */ { file->curFile--; Assert(file->curFile >= 0); file->curOffset += MAX_PHYSICAL_FILESIZE; } /* * Now we can set the buffer empty without changing the logical position */ file->pos = 0; file->nbytes = 0; } /* * BufFileRead * * Like fread() except we assume 1-byte element size and report I/O errors via * ereport(). */ size_t BufFileRead(BufFile *file, void *ptr, size_t size) { size_t nread = 0; size_t nthistime; BufFileFlush(file); while (size > 0) { if (file->pos >= file->nbytes) { /* Try to load more data into buffer. */ file->curOffset += file->pos; file->pos = 0; file->nbytes = 0; BufFileLoadBuffer(file); if (file->nbytes <= 0) break; /* no more data available */ } nthistime = file->nbytes - file->pos; if (nthistime > size) nthistime = size; Assert(nthistime > 0); memcpy(ptr, file->buffer.data + file->pos, nthistime); file->pos += nthistime; ptr = (void *) ((char *) ptr + nthistime); size -= nthistime; nread += nthistime; } return nread; } /* * BufFileWrite * * Like fwrite() except we assume 1-byte element size and report errors via * ereport(). */ void BufFileWrite(BufFile *file, void *ptr, size_t size) { size_t nthistime; Assert(!file->readOnly); while (size > 0) { if (file->pos >= BLCKSZ) { /* Buffer full, dump it out */ if (file->dirty) BufFileDumpBuffer(file); else { /* Hmm, went directly from reading to writing? */ file->curOffset += file->pos; file->pos = 0; file->nbytes = 0; } } nthistime = BLCKSZ - file->pos; if (nthistime > size) nthistime = size; Assert(nthistime > 0); memcpy(file->buffer.data + file->pos, ptr, nthistime); file->dirty = true; file->pos += nthistime; if (file->nbytes < file->pos) file->nbytes = file->pos; ptr = (void *) ((char *) ptr + nthistime); size -= nthistime; } } /* * BufFileFlush * * Like fflush(), except that I/O errors are reported with ereport(). */ static void BufFileFlush(BufFile *file) { if (file->dirty) BufFileDumpBuffer(file); Assert(!file->dirty); } /* * BufFileSeek * * Like fseek(), except that target position needs two values in order to * work when logical filesize exceeds maximum value representable by off_t. * We do not support relative seeks across more than that, however. * I/O errors are reported by ereport(). * * Result is 0 if OK, EOF if not. Logical position is not moved if an * impossible seek is attempted. */ int BufFileSeek(BufFile *file, int fileno, off_t offset, int whence) { int newFile; off_t newOffset; switch (whence) { case SEEK_SET: if (fileno < 0) return EOF; newFile = fileno; newOffset = offset; break; case SEEK_CUR: /* * Relative seek considers only the signed offset, ignoring * fileno. Note that large offsets (> 1 GB) risk overflow in this * add, unless we have 64-bit off_t. */ newFile = file->curFile; newOffset = (file->curOffset + file->pos) + offset; break; case SEEK_END: /* * The file size of the last file gives us the end offset of that * file. */ newFile = file->numFiles - 1; newOffset = FileSize(file->files[file->numFiles - 1]); if (newOffset < 0) ereport(ERROR, (errcode_for_file_access(), errmsg("could not determine size of temporary file \"%s\" from BufFile \"%s\": %m", FilePathName(file->files[file->numFiles - 1]), file->name))); break; default: elog(ERROR, "invalid whence: %d", whence); return EOF; } while (newOffset < 0) { if (--newFile < 0) return EOF; newOffset += MAX_PHYSICAL_FILESIZE; } if (newFile == file->curFile && newOffset >= file->curOffset && newOffset <= file->curOffset + file->nbytes) { /* * Seek is to a point within existing buffer; we can just adjust * pos-within-buffer, without flushing buffer. Note this is OK * whether reading or writing, but buffer remains dirty if we were * writing. */ file->pos = (int) (newOffset - file->curOffset); return 0; } /* Otherwise, must reposition buffer, so flush any dirty data */ BufFileFlush(file); /* * At this point and no sooner, check for seek past last segment. The * above flush could have created a new segment, so checking sooner would * not work (at least not with this code). */ /* convert seek to "start of next seg" to "end of last seg" */ if (newFile == file->numFiles && newOffset == 0) { newFile--; newOffset = MAX_PHYSICAL_FILESIZE; } while (newOffset > MAX_PHYSICAL_FILESIZE) { if (++newFile >= file->numFiles) return EOF; newOffset -= MAX_PHYSICAL_FILESIZE; } if (newFile >= file->numFiles) return EOF; /* Seek is OK! */ file->curFile = newFile; file->curOffset = newOffset; file->pos = 0; file->nbytes = 0; return 0; } void BufFileTell(BufFile *file, int *fileno, off_t *offset) { *fileno = file->curFile; *offset = file->curOffset + file->pos; } /* * BufFileSeekBlock --- block-oriented seek * * Performs absolute seek to the start of the n'th BLCKSZ-sized block of * the file. Note that users of this interface will fail if their files * exceed BLCKSZ * LONG_MAX bytes, but that is quite a lot; we don't work * with tables bigger than that, either... * * Result is 0 if OK, EOF if not. Logical position is not moved if an * impossible seek is attempted. */ int BufFileSeekBlock(BufFile *file, long blknum) { return BufFileSeek(file, (int) (blknum / BUFFILE_SEG_SIZE), (off_t) (blknum % BUFFILE_SEG_SIZE) * BLCKSZ, SEEK_SET); } #ifdef NOT_USED /* * BufFileTellBlock --- block-oriented tell * * Any fractional part of a block in the current seek position is ignored. */ long BufFileTellBlock(BufFile *file) { long blknum; blknum = (file->curOffset + file->pos) / BLCKSZ; blknum += file->curFile * BUFFILE_SEG_SIZE; return blknum; } #endif /* * Return the current shared BufFile size. * * Counts any holes left behind by BufFileAppend as part of the size. * ereport()s on failure. */ int64 BufFileSize(BufFile *file) { int64 lastFileSize; Assert(file->fileset != NULL); /* Get the size of the last physical file. */ lastFileSize = FileSize(file->files[file->numFiles - 1]); if (lastFileSize < 0) ereport(ERROR, (errcode_for_file_access(), errmsg("could not determine size of temporary file \"%s\" from BufFile \"%s\": %m", FilePathName(file->files[file->numFiles - 1]), file->name))); return ((file->numFiles - 1) * (int64) MAX_PHYSICAL_FILESIZE) + lastFileSize; } /* * Append the contents of source file (managed within shared fileset) to * end of target file (managed within same shared fileset). * * Note that operation subsumes ownership of underlying resources from * "source". Caller should never call BufFileClose against source having * called here first. Resource owners for source and target must match, * too. * * This operation works by manipulating lists of segment files, so the * file content is always appended at a MAX_PHYSICAL_FILESIZE-aligned * boundary, typically creating empty holes before the boundary. These * areas do not contain any interesting data, and cannot be read from by * caller. * * Returns the block number within target where the contents of source * begins. Caller should apply this as an offset when working off block * positions that are in terms of the original BufFile space. */ long BufFileAppend(BufFile *target, BufFile *source) { long startBlock = target->numFiles * BUFFILE_SEG_SIZE; int newNumFiles = target->numFiles + source->numFiles; int i; Assert(target->fileset != NULL); Assert(source->readOnly); Assert(!source->dirty); Assert(source->fileset != NULL); if (target->resowner != source->resowner) elog(ERROR, "could not append BufFile with non-matching resource owner"); target->files = (File *) repalloc(target->files, sizeof(File) * newNumFiles); for (i = target->numFiles; i < newNumFiles; i++) target->files[i] = source->files[i - target->numFiles]; target->numFiles = newNumFiles; return startBlock; } /* * Truncate a BufFile created by BufFileCreateShared up to the given fileno and * the offset. */ void BufFileTruncateShared(BufFile *file, int fileno, off_t offset) { int numFiles = file->numFiles; int newFile = fileno; off_t newOffset = file->curOffset; char segment_name[MAXPGPATH]; int i; /* * Loop over all the files up to the given fileno and remove the files * that are greater than the fileno and truncate the given file up to the * offset. Note that we also remove the given fileno if the offset is 0 * provided it is not the first file in which we truncate it. */ for (i = file->numFiles - 1; i >= fileno; i--) { if ((i != fileno || offset == 0) && i != 0) { SharedSegmentName(segment_name, file->name, i); FileClose(file->files[i]); if (!SharedFileSetDelete(file->fileset, segment_name, true)) ereport(ERROR, (errcode_for_file_access(), errmsg("could not delete shared fileset \"%s\": %m", segment_name))); numFiles--; newOffset = MAX_PHYSICAL_FILESIZE; /* * This is required to indicate that we have deleted the given * fileno. */ if (i == fileno) newFile--; } else { if (FileTruncate(file->files[i], offset, WAIT_EVENT_BUFFILE_TRUNCATE) < 0) ereport(ERROR, (errcode_for_file_access(), errmsg("could not truncate file \"%s\": %m", FilePathName(file->files[i])))); newOffset = offset; } } file->numFiles = numFiles; /* * If the truncate point is within existing buffer then we can just adjust * pos within buffer. */ if (newFile == file->curFile && newOffset >= file->curOffset && newOffset <= file->curOffset + file->nbytes) { /* No need to reset the current pos if the new pos is greater. */ if (newOffset <= file->curOffset + file->pos) file->pos = (int) (newOffset - file->curOffset); /* Adjust the nbytes for the current buffer. */ file->nbytes = (int) (newOffset - file->curOffset); } else if (newFile == file->curFile && newOffset < file->curOffset) { /* * The truncate point is within the existing file but prior to the * current position, so we can forget the current buffer and reset the * current position. */ file->curOffset = newOffset; file->pos = 0; file->nbytes = 0; } else if (newFile < file->curFile) { /* * The truncate point is prior to the current file, so need to reset * the current position accordingly. */ file->curFile = newFile; file->curOffset = newOffset; file->pos = 0; file->nbytes = 0; } /* Nothing to do, if the truncate point is beyond current file. */ }
{ "pile_set_name": "Github" }
/* * $Id$ * * SARL is an general-purpose agent programming language. * More details on http://www.sarl.io * * Copyright (C) 2014-2020 the original authors or 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 io.sarl.lang.tests.modules.actionprototype; import static io.sarl.tests.api.tools.TestAssertions.assertContainsStrings; import static io.sarl.tests.api.tools.TestEObjects.file; import static io.sarl.tests.api.tools.TestEObjects.getType; import static io.sarl.tests.api.tools.TestMockito.mock; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import com.google.inject.Inject; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.ECollections; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.xtend.core.xtend.XtendParameter; import org.eclipse.xtext.common.types.JvmAnnotationReference; import org.eclipse.xtext.common.types.JvmAnnotationType; import org.eclipse.xtext.common.types.JvmFormalParameter; import org.eclipse.xtext.common.types.JvmIdentifiableElement; import org.eclipse.xtext.common.types.JvmTypeReference; import org.eclipse.xtext.common.types.TypesPackage; import org.eclipse.xtext.xbase.XExpression; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.mockito.ArgumentMatchers; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.opentest4j.AssertionFailedError; import io.sarl.lang.annotation.DefaultValue; import io.sarl.lang.sarl.SarlAction; import io.sarl.lang.sarl.SarlAgent; import io.sarl.lang.sarl.SarlFormalParameter; import io.sarl.lang.sarl.SarlScript; import io.sarl.lang.sarl.actionprototype.ActionParameterTypes; import io.sarl.lang.sarl.actionprototype.ActionPrototype; import io.sarl.lang.sarl.actionprototype.DefaultActionPrototypeProvider; import io.sarl.lang.sarl.actionprototype.FormalParameterProvider; import io.sarl.lang.sarl.actionprototype.IActionPrototypeContext; import io.sarl.lang.sarl.actionprototype.InferredPrototype; import io.sarl.lang.sarl.actionprototype.InferredStandardParameter; import io.sarl.lang.sarl.actionprototype.InferredValuedParameter; import io.sarl.lang.sarl.actionprototype.QualifiedActionName; import io.sarl.tests.api.AbstractSarlTest; import io.sarl.tests.api.Nullable; /** * @author $Author: sgalland$ * @version $FullVersion$ * @mavengroupid $GroupId$ * @mavenartifactid $ArtifactId$ */ @SuppressWarnings({"javadoc", "nls", "incomplete-switch"}) @DisplayName("DefaultActionPrototypeProvider") @Tag("core") @Tag("unit") public class DefaultActionPrototypeProviderTest extends AbstractSarlTest { static int index; static JvmIdentifiableElement createJvmIdentifiableElementStub() { ++index; Resource resource = mock(Resource.class); when(resource.getURI()).thenReturn(URI.createFileURI("/path/to/io/sarl/tests/Stub" + index + ".sarl")); JvmIdentifiableElement container = mock(JvmIdentifiableElement.class); when(container.eResource()).thenReturn(resource); when(container.getQualifiedName()).thenReturn("io.sarl.tests.Stub" + index); return container; } static void assertSameFormalParameters(List<? extends XtendParameter> expected, FormalParameterProvider actual) { assertEquals(expected.size(), actual.getFormalParameterCount()); for (int i = 0; i < expected.size(); ++i) { assertEquals(expected.get(i).getName(), actual.getFormalParameterName(i)); assertEquals(expected.get(i).getParameterType().getQualifiedName(), actual.getFormalParameterType(i, false)); if (expected.get(i) instanceof SarlFormalParameter) { assertSame(((SarlFormalParameter) expected.get(i)).getDefaultValue(), actual.getFormalParameterDefaultValue(i)); } else { assertNull(actual.getFormalParameterDefaultValue(i)); } } } static void assertSameJvmFormalParameters(List<? extends JvmFormalParameter> expected, FormalParameterProvider actual) { assertEquals(expected.size(), actual.getFormalParameterCount()); for (int i = 0; i < expected.size(); ++i) { assertEquals(expected.get(i).getName(), actual.getFormalParameterName(i)); assertEquals(expected.get(i).getParameterType().getQualifiedName(), actual.getFormalParameterType(i, false)); } } private static boolean matchPrototype(List<InferredStandardParameter> parameters, Object[] expected) { int i = 0; for (InferredStandardParameter parameter : parameters) { if (i >= expected.length || !((Class<?>) expected[i]).isInstance(parameter)) { return false; } ++i; if (i >= expected.length || !parameter.getType().getIdentifier().equals(expected[i])) { return false; } ++i; if (i >= expected.length || !parameter.getName().equals(expected[i])) { return false; } ++i; if (parameter instanceof InferredValuedParameter) { String arg = ((InferredValuedParameter) parameter).getCallingArgument(); if (i >= expected.length || !arg.equals(expected[i])) { return false; } ++i; } } return true; } private static void assertPrototypes( List<InferredStandardParameter> parameters, Collection<Object[]> expected, Object[][] originalExpected) { Iterator<Object[]> iterator = expected.iterator(); while (iterator.hasNext()) { if (matchPrototype(parameters, iterator.next())) { iterator.remove(); return; } } throw new AssertionFailedError("Not same parameter prototype.", parameters.toString(), toString(originalExpected)); } private static String toString(Object[][] array) { StringBuilder b = new StringBuilder(); b.append("[\n"); boolean addcoma = false; for (Object[] d : array) { if (addcoma) { b.append(",\n"); } else { addcoma = true; } b.append(toString(d)); } b.append("]"); return b.toString(); } private static String toString(Object[] array) { StringBuilder b = new StringBuilder(); b.append(" [ "); boolean addcoma = false; for (Object o : array) { if (addcoma) { b.append(",\n "); } else { addcoma = true; } b.append(o==null ? "null" : o.toString()); } b.append(" ]"); return b.toString(); } static void assertPrototypes( Map<ActionParameterTypes, List<InferredStandardParameter>> elements, Object[]... expected) { Collection<Object[]> expectedElements = new ArrayList<>(); for (int i = 0; i < expected.length; ++i) { expectedElements.add(expected[i]); } for (List<InferredStandardParameter> parameters : elements.values()) { assertPrototypes(parameters, expectedElements, expected); } if (!expectedElements.isEmpty()) { throw new AssertionFailedError( "Not same prototypes", expectedElements.toString(), elements.toString()); } } static void assertPrototypes( List<InferredStandardParameter> elements, Object... expected) { if (!matchPrototype(elements, expected)) { fail("Expected elements: " + toString(expected) + "; but is: " + elements.toString()); } } /** * @author $Author: sgalland$ * @version $FullVersion$ * @mavengroupid $GroupId$ * @mavenartifactid $ArtifactId$ */ @Nested @DisplayName("DefaultActionPrototypeProvider without default values") public class NoDefaultValues extends AbstractSarlTest { @Inject private DefaultActionPrototypeProvider provider; @Nullable private IActionPrototypeContext context; @Nullable private FormalParameterProvider parameterProvider; @Nullable private EList<SarlFormalParameter> sarlParameters; @Nullable private EList<JvmFormalParameter> jvmParameters; @BeforeEach public void setUp() throws Exception { this.context = this.provider.createContext(); this.parameterProvider = mock(FormalParameterProvider.class); when(this.parameterProvider.getFormalParameterCount()).thenReturn(3); when(this.parameterProvider.getFormalParameterName(ArgumentMatchers.anyInt())).thenAnswer(new Answer<String>() { @Override public String answer(InvocationOnMock invocation) throws Throwable { switch(((Integer) invocation.getArguments()[0]).intValue()) { case 0: return "firstarg"; case 1: return "secondarg"; case 2: return "thirdarg"; } return null; } }); when(this.parameterProvider.getFormalParameterType(ArgumentMatchers.anyInt(), ArgumentMatchers.anyBoolean())).thenAnswer(new Answer<String>() { @Override public String answer(InvocationOnMock invocation) throws Throwable { switch(((Integer) invocation.getArguments()[0]).intValue()) { case 0: return "java.lang.String"; case 1: return "float"; case 2: return "java.lang.Object[]"; } return null; } }); // SarlFormalParameter p; this.sarlParameters = new BasicEList<>(); p = mock(SarlFormalParameter.class); when(p.getName()).thenReturn("firstarg"); JvmTypeReference ref = getType(getParseHelper(), "java.lang.String"); when(p.getParameterType()).thenReturn(ref); this.sarlParameters.add(p); p = mock(SarlFormalParameter.class); when(p.getName()).thenReturn("secondarg"); ref = getType(getParseHelper(), "float"); when(p.getParameterType()).thenReturn(ref); this.sarlParameters.add(p); p = mock(SarlFormalParameter.class); when(p.getName()).thenReturn("thirdarg"); ref = getType(getParseHelper(), "java.lang.Object"); when(p.getParameterType()).thenReturn(ref); this.sarlParameters.add(p); // JvmFormalParameter jp; this.jvmParameters = new BasicEList<>(); jp = mock(JvmFormalParameter.class); when(jp.getName()).thenReturn("firstarg"); ref = getType(getParseHelper(), "java.lang.String"); when(jp.getParameterType()).thenReturn(ref); when(jp.getAnnotations()).thenReturn(new BasicEList<JvmAnnotationReference>()); this.jvmParameters.add(jp); jp = mock(JvmFormalParameter.class); when(jp.getName()).thenReturn("secondarg"); ref = getType(getParseHelper(), "float"); when(jp.getParameterType()).thenReturn(ref); when(jp.getAnnotations()).thenReturn(new BasicEList<JvmAnnotationReference>()); this.jvmParameters.add(jp); jp = mock(JvmFormalParameter.class); when(jp.getName()).thenReturn("thirdarg"); ref = getType(getParseHelper(), "java.lang.Object[]"); when(jp.getParameterType()).thenReturn(ref); when(jp.getAnnotations()).thenReturn(new BasicEList<JvmAnnotationReference>()); this.jvmParameters.add(jp); } @Test public void validateTypeOfVarArgInSarl() throws Exception { SarlScript s = file(getParseHelper(), "agent Foo { def fooFct(a : float, b : Object*) {} }"); SarlFormalParameter param = (SarlFormalParameter) ((SarlAction) ((SarlAgent) s.getXtendTypes().get(0)) .getMembers().get(0)).getParameters().get(1); assertNotNull(param); assertEquals("java.lang.Object", param.getParameterType().getIdentifier()); } @Test public void createQualifiedActionName() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); final String xtextResourceID = container.eResource().getURI().toString(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); assertNotNull(qn); assertEquals("myfct", qn.getActionName()); // xtextResourceID == "file:/path/to/io/sarl/tests/Stub"+index+".sarl" assertEquals(xtextResourceID + "/io.sarl.tests.Stub"+index, qn.getContainerID()); assertEquals(xtextResourceID + "/io.sarl.tests.Stub"+index+"#myfct", qn.toString()); } @Test public void createConstructorQualifiedName() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); final String xtextResourceID = container.eResource().getURI().toString(); QualifiedActionName qn = this.provider.createConstructorQualifiedName(container); assertNotNull(qn); assertEquals("new", qn.getActionName()); // xtextResourceID == "file:/path/to/io/sarl/tests/Stub"+index+".sarl" assertEquals(xtextResourceID + "/io.sarl.tests.Stub"+index, qn.getContainerID()); assertEquals(xtextResourceID + "/io.sarl.tests.Stub"+index+"#new", qn.toString()); } @Test public void createParameterTypesForVoid() { ActionParameterTypes key = this.provider.createParameterTypesForVoid(); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertEquals("", key.toString()); assertTrue(key.isEmpty()); } @Test public void createParameterTypes_varArgs() { ActionParameterTypes key = this.provider.createParameterTypes(true, this.parameterProvider); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object*", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object[]", key.get(2)); } @Test public void createParameterTypes_noVarArgs() { ActionParameterTypes key = this.provider.createParameterTypes(false, this.parameterProvider); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object[]", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object[]", key.get(2)); } @Test public void createParameterTypesFromString_empty() { ActionParameterTypes key = this.provider.createParameterTypesFromString(""); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertEquals("", key.toString()); assertTrue(key.isEmpty()); } @Test public void createParameterTypesFromString_void() { ActionParameterTypes key = this.provider.createParameterTypesFromString("void"); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertEquals("", key.toString()); assertTrue(key.isEmpty()); } @Test public void createParameterTypesFromString_Void() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.Void"); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertEquals("", key.toString()); assertTrue(key.isEmpty()); } @Test public void createParameterTypesFromString_String_noVargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String", key.toString()); assertEquals(1, key.size()); assertEquals("java.lang.String", key.get(0)); } @Test public void createParameterTypesFromString_StringFloat_noVargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float", key.toString()); assertEquals(2, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); } @Test public void createParameterTypesFromString_StringFloatObject_noVargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float,java.lang.Object"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object", key.get(2)); } @Test public void createParameterTypesFromString_String_vargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String*"); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String*", key.toString()); assertEquals(1, key.size()); assertEquals("java.lang.String[]", key.get(0)); } @Test public void createParameterTypesFromString_StringFloat_vargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float*"); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float*", key.toString()); assertEquals(2, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float[]", key.get(1)); } @Test public void createParameterTypesFromString_StringFloatObject_vargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float,java.lang.Object*"); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object*", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object[]", key.get(2)); } @Test public void createParameterTypesFromString_String_noVargArg_array() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String[]"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String[]", key.toString()); assertEquals(1, key.size()); assertEquals("java.lang.String[]", key.get(0)); } @Test public void createParameterTypesFromString_StringFloat_noVargArg_array() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float[]"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float[]", key.toString()); assertEquals(2, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float[]", key.get(1)); } @Test public void createParameterTypesFromString_StringFloatObject_noVargArg_array() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float,java.lang.Object[]"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object[]", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object[]", key.get(2)); } @Test public void createParameterTypesFromSarlModell_void() { ActionParameterTypes key = this.provider.createParameterTypesFromSarlModel(false, new BasicEList<SarlFormalParameter>()); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertTrue(key.isEmpty()); } @Test public void createParameterTypesFromSarlModel_noVarArg() { ActionParameterTypes key = this.provider.createParameterTypesFromSarlModel(false, this.sarlParameters); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object", key.get(2)); } @Test public void createParameterTypesFromSarlModel_varArg() { ActionParameterTypes key = this.provider.createParameterTypesFromSarlModel(true, this.sarlParameters); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object*", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object[]", key.get(2)); } @Test public void createParameterTypesFromJvmModel_void() { ActionParameterTypes key = this.provider.createParameterTypesFromJvmModel(false, new BasicEList<JvmFormalParameter>()); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertTrue(key.isEmpty()); } @Test public void createParameterTypesFromJvmModel_noVarArg() { ActionParameterTypes key = this.provider.createParameterTypesFromJvmModel(false, this.jvmParameters); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object[]", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object[]", key.get(2)); } @Test public void createParameterTypesFromJvmModel_varArg() { ActionParameterTypes key = this.provider.createParameterTypesFromJvmModel(true, this.jvmParameters); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object*", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object[]", key.get(2)); } @Test public void createActionPrototype_void() { ActionParameterTypes params = this.provider.createParameterTypesFromJvmModel(true, new BasicEList<JvmFormalParameter>()); ActionPrototype prototype = this.provider.createActionPrototype("myfct", params); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName()); assertSame(params, prototype.getParametersTypes()); } @Test public void createActionPrototype_noVarArg() { ActionParameterTypes params = this.provider.createParameterTypesFromJvmModel(false, this.jvmParameters); ActionPrototype prototype = this.provider.createActionPrototype("myfct", params); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName()); assertSame(params, prototype.getParametersTypes()); } @Test public void createActionPrototype_varArg() { ActionParameterTypes params = this.provider.createParameterTypesFromJvmModel(true, this.jvmParameters); ActionPrototype prototype = this.provider.createActionPrototype("myfct", params); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName()); assertSame(params, prototype.getParametersTypes()); } @Test public void createPrototypeFromSarlModel_void() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); EList<SarlFormalParameter> params = new BasicEList<>(); // InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, false, params); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameFormalParameters(params, prototype.getFormalParameters()); assertEquals("", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), ""); assertTrue(prototype.getInferredParameterTypes().isEmpty()); } @Test public void createPrototypeFromSarlModel_noVarArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); // InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, false, this.sarlParameters); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameFormalParameters(this.sarlParameters, prototype.getFormalParameters()); assertEquals( "java.lang.String,float,java.lang.Object", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), "java.lang.String,float,java.lang.Object"); assertTrue(prototype.getInferredParameterTypes().isEmpty()); } @Test public void createPrototypeFromSarlModel_varArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); // InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, true, this.sarlParameters); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameFormalParameters(this.sarlParameters, prototype.getFormalParameters()); assertEquals("java.lang.String,float,java.lang.Object*", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), "java.lang.String,float,java.lang.Object*"); assertTrue(prototype.getInferredParameterTypes().isEmpty()); } @Test public void createPrototypeFromJvmModel_void() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); EList<JvmFormalParameter> params = new BasicEList<>(); // InferredPrototype prototype = this.provider.createPrototypeFromJvmModel(this.context, qn, false, params); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameJvmFormalParameters(params, prototype.getFormalParameters()); assertEquals("", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), ""); assertTrue(prototype.getInferredParameterTypes().isEmpty()); } @Test public void createPrototypeFromJvmModel_noVarArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); // InferredPrototype prototype = this.provider.createPrototypeFromJvmModel(this.context, qn, false, this.jvmParameters); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameJvmFormalParameters(this.jvmParameters, prototype.getFormalParameters()); assertEquals( "java.lang.String,float,java.lang.Object[]", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), "java.lang.String,float,java.lang.Object[]"); assertTrue(prototype.getInferredParameterTypes().isEmpty()); } @Test public void createPrototypeFromJvmModel_varArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); // InferredPrototype prototype = this.provider.createPrototypeFromJvmModel(this.context, qn, true, this.jvmParameters); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameJvmFormalParameters(this.jvmParameters, prototype.getFormalParameters()); assertEquals("java.lang.String,float,java.lang.Object*", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), "java.lang.String,float,java.lang.Object*"); assertTrue(prototype.getInferredParameterTypes().isEmpty()); } @Test public void getPrototypesQualifiedActionName_noCreatedPrototype() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); // Iterable<InferredPrototype> iterable = this.provider.getPrototypes(this.context, qn); assertNotNull(iterable); assertFalse(iterable.iterator().hasNext()); } @Test public void getPrototypesQualifiedActionName_createdPrototype_noVarArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); InferredPrototype expected = this.provider.createPrototypeFromSarlModel(this.context, qn, false, this.sarlParameters); // Iterable<InferredPrototype> iterable = this.provider.getPrototypes(this.context, qn); assertNotNull(iterable); Iterator<InferredPrototype> iterator = iterable.iterator(); assertTrue(iterator.hasNext()); InferredPrototype prototype = iterator.next(); assertSame(expected, prototype); assertFalse(iterator.hasNext()); } @Test public void getPrototypesQualifiedActionName_createdPrototype_varArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); InferredPrototype expected = this.provider.createPrototypeFromSarlModel(this.context, qn, true, this.sarlParameters); // Iterable<InferredPrototype> iterable = this.provider.getPrototypes(this.context, qn); assertNotNull(iterable); Iterator<InferredPrototype> iterator = iterable.iterator(); assertTrue(iterator.hasNext()); InferredPrototype prototype = iterator.next(); assertSame(expected, prototype); assertFalse(iterator.hasNext()); } @Test public void getPrototypesQualifiedActionNameActionParameterTypes_noCreatedPrototype() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(false, this.sarlParameters); // InferredPrototype prototype = this.provider.getPrototypes(this.context, qn, types); assertNull(prototype); } @Test public void getPrototypesQualifiedActionNameActionParameterTypes_createdPrototype_noVarArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(false, this.sarlParameters); InferredPrototype expected = this.provider.createPrototypeFromSarlModel(this.context, qn, false, this.sarlParameters); // InferredPrototype prototype = this.provider.getPrototypes(this.context, qn, types); assertNotNull(prototype); assertSame(expected, prototype); } @Test public void getPrototypesQualifiedActionNameActionParameterTypes_createdPrototype_varArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(true, this.sarlParameters); InferredPrototype expected = this.provider.createPrototypeFromSarlModel(this.context, qn, true, this.sarlParameters); // InferredPrototype prototype = this.provider.getPrototypes(this.context, qn, types); assertNotNull(prototype); assertSame(expected, prototype); } @Test public void resetPrototypes_noCreatedProtype() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(false, this.sarlParameters); assertNotNull(types); // assertFalse(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); this.context.release(); assertFalse(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); } @Test public void resetPrototypes_createdProtype_noVarArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(false, this.sarlParameters); assertNotNull(types); InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, false, this.sarlParameters); assertNotNull(prototype); // assertTrue(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); this.context.release(); assertFalse(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); } @Test public void resetPrototypes_createdProtype_varArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(true, this.sarlParameters); assertNotNull(types); InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, true, this.sarlParameters); assertNotNull(prototype); // assertTrue(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); this.context.release(); assertFalse(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); } } /** * @author $Author: sgalland$ * @version $FullVersion$ * @mavengroupid $GroupId$ * @mavenartifactid $ArtifactId$ */ @Nested @DisplayName("DefaultActionPrototypeProvider with default values") public class DefaultValues extends AbstractSarlTest { @Inject private DefaultActionPrototypeProvider provider; @Nullable private IActionPrototypeContext context; @Nullable private FormalParameterProvider parameterProvider; @Nullable private EList<SarlFormalParameter> sarlParameters; @Nullable private EList<JvmFormalParameter> jvmParameters; @BeforeEach public void setUp() throws Exception { this.context = this.provider.createContext(); this.parameterProvider = mock(FormalParameterProvider.class); when(this.parameterProvider.getFormalParameterCount()).thenReturn(4); when(this.parameterProvider.getFormalParameterName(ArgumentMatchers.anyInt())).thenAnswer((invocation) -> { switch(((Integer) invocation.getArguments()[0]).intValue()) { case 0: return "firstarg"; case 1: return "secondarg"; case 2: return "thirdarg"; case 3: return "fourtharg"; } return null; }); when(this.parameterProvider.getFormalParameterType(ArgumentMatchers.anyInt(), ArgumentMatchers.anyBoolean())).thenAnswer((invocation) -> { switch(((Integer) invocation.getArguments()[0]).intValue()) { case 0: return "java.lang.String"; case 1: return "int"; case 2: return "float"; case 3: return "java.lang.Object[]"; } return null; }); when(this.parameterProvider.hasFormalParameterDefaultValue(ArgumentMatchers.anyInt())).thenAnswer((invocation) -> { switch(((Integer) invocation.getArguments()[0]).intValue()) { case 0: case 2: return Boolean.TRUE; } return Boolean.FALSE; }); // SarlFormalParameter p; this.sarlParameters = new BasicEList<>(); p = mock(SarlFormalParameter.class); when(p.getName()).thenReturn("firstarg"); JvmTypeReference ref = getType(getParseHelper(), "java.lang.String"); when(p.getParameterType()).thenReturn(ref); when(p.getDefaultValue()).thenReturn(mock(XExpression.class)); this.sarlParameters.add(p); p = mock(SarlFormalParameter.class); when(p.getName()).thenReturn("secondarg"); ref = getType(getParseHelper(), "int"); when(p.getParameterType()).thenReturn(ref); this.sarlParameters.add(p); p = mock(SarlFormalParameter.class); when(p.getName()).thenReturn("thirdarg"); ref = getType(getParseHelper(), "float"); when(p.getParameterType()).thenReturn(ref); when(p.getDefaultValue()).thenReturn(mock(XExpression.class)); this.sarlParameters.add(p); p = mock(SarlFormalParameter.class); when(p.getName()).thenReturn("fourtharg"); ref = getType(getParseHelper(), "java.lang.Object"); when(p.getParameterType()).thenReturn(ref); this.sarlParameters.add(p); // JvmFormalParameter jp; this.jvmParameters = new BasicEList<>(); jp = mock(JvmFormalParameter.class); when(jp.getName()).thenReturn("firstarg"); ref = getType(getParseHelper(), "java.lang.String"); when(jp.getParameterType()).thenReturn(ref); JvmAnnotationType annotationType = mock(JvmAnnotationType.class); when(annotationType.getQualifiedName()).thenReturn(DefaultValue.class.getName()); JvmAnnotationReference annotationRef = mock(JvmAnnotationReference.class); when(annotationRef.getAnnotation()).thenReturn(annotationType); when(jp.getAnnotations()).thenReturn(ECollections.singletonEList(annotationRef)); when(jp.eIsSet(ArgumentMatchers.any())).thenAnswer((invocation) -> { if (Objects.equals(TypesPackage.Literals.JVM_ANNOTATION_TARGET__ANNOTATIONS, invocation.getArguments()[0])) { return Boolean.TRUE; } return Boolean.FALSE; }); this.jvmParameters.add(jp); jp = mock(JvmFormalParameter.class); when(jp.getName()).thenReturn("secondarg"); ref = getType(getParseHelper(), "int"); when(jp.getParameterType()).thenReturn(ref); when(jp.getAnnotations()).thenReturn(ECollections.<JvmAnnotationReference>emptyEList()); this.jvmParameters.add(jp); jp = mock(JvmFormalParameter.class); when(jp.getName()).thenReturn("thirdarg"); ref = getType(getParseHelper(), "float"); when(jp.getParameterType()).thenReturn(ref); annotationType = mock(JvmAnnotationType.class); when(annotationType.getQualifiedName()).thenReturn(DefaultValue.class.getName()); annotationRef = mock(JvmAnnotationReference.class); when(annotationRef.getAnnotation()).thenReturn(annotationType); when(jp.getAnnotations()).thenReturn(ECollections.singletonEList(annotationRef)); when(jp.eIsSet(ArgumentMatchers.any())).thenAnswer((invocation) -> { if (Objects.equals(TypesPackage.Literals.JVM_ANNOTATION_TARGET__ANNOTATIONS, invocation.getArguments()[0])) { return Boolean.TRUE; } return Boolean.FALSE; }); this.jvmParameters.add(jp); jp = mock(JvmFormalParameter.class); when(jp.getName()).thenReturn("fourtharg"); ref = getType(getParseHelper(), "java.lang.Object[]"); when(jp.getParameterType()).thenReturn(ref); when(jp.getAnnotations()).thenReturn(ECollections.<JvmAnnotationReference>emptyEList()); this.jvmParameters.add(jp); } @Test public void validateTypeOfVarArgInSarl() throws Exception { SarlScript s = file(getParseHelper(), "agent Foo { def fooFct(a : float, b : Object*) {} }"); SarlFormalParameter param = (SarlFormalParameter) ((SarlAction) ((SarlAgent) s.getXtendTypes().get(0)) .getMembers().get(0)).getParameters().get(1); assertNotNull(param); assertEquals("java.lang.Object", param.getParameterType().getIdentifier()); } @Test public void createQualifiedActionName() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); final String xtextResourceID = container.eResource().getURI().toString(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); assertNotNull(qn); assertEquals("myfct", qn.getActionName()); //xtextResourceID == "file:/path/to/io/sarl/tests/Stub"+index+".sarl" assertEquals(xtextResourceID + "/io.sarl.tests.Stub"+index, qn.getContainerID()); assertEquals(xtextResourceID + "/io.sarl.tests.Stub"+index+"#myfct", qn.toString()); } @Test public void createConstructorQualifiedName() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); final String xtextResourceID = container.eResource().getURI().toString(); QualifiedActionName qn = this.provider.createConstructorQualifiedName(container); assertNotNull(qn); assertEquals("new", qn.getActionName()); //xtextResourceID == "file:/path/to/io/sarl/tests/Stub"+index+".sarl" assertEquals(xtextResourceID + "/io.sarl.tests.Stub"+index, qn.getContainerID()); assertEquals(xtextResourceID + "/io.sarl.tests.Stub"+index+"#new", qn.toString()); } @Test public void createParameterTypesForVoid() { ActionParameterTypes key = this.provider.createParameterTypesForVoid(); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertEquals("", key.toString()); assertTrue(key.isEmpty()); } @Test public void createParameterTypes_varArgs() { ActionParameterTypes key = this.provider.createParameterTypes(true, this.parameterProvider); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,int,float,java.lang.Object*", key.toString()); assertEquals(4, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("int", key.get(1)); assertEquals("float", key.get(2)); assertEquals("java.lang.Object[]", key.get(3)); } @Test public void createParameterTypes_noVarArgs() { ActionParameterTypes key = this.provider.createParameterTypes(false, this.parameterProvider); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,int,float,java.lang.Object[]", key.toString()); assertEquals(4, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("int", key.get(1)); assertEquals("float", key.get(2)); assertEquals("java.lang.Object[]", key.get(3)); } @Test public void createParameterTypesFromString_empty() { ActionParameterTypes key = this.provider.createParameterTypesFromString(""); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertEquals("", key.toString()); assertTrue(key.isEmpty()); } @Test public void createParameterTypesFromString_void() { ActionParameterTypes key = this.provider.createParameterTypesFromString("void"); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertEquals("", key.toString()); assertTrue(key.isEmpty()); } @Test public void createParameterTypesFromString_Void() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.Void"); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertEquals("", key.toString()); assertTrue(key.isEmpty()); } @Test public void createParameterTypesFromString_String_noVargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String", key.toString()); assertEquals(1, key.size()); assertEquals("java.lang.String", key.get(0)); } @Test public void createParameterTypesFromString_StringFloat_noVargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float", key.toString()); assertEquals(2, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); } @Test public void createParameterTypesFromString_StringFloatObject_noVargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float,java.lang.Object"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object", key.get(2)); } @Test public void createParameterTypesFromString_String_vargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String*"); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String*", key.toString()); assertEquals(1, key.size()); assertEquals("java.lang.String[]", key.get(0)); } @Test public void createParameterTypesFromString_StringFloat_vargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float*"); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float*", key.toString()); assertEquals(2, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float[]", key.get(1)); } @Test public void createParameterTypesFromString_StringFloatObject_vargArg() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float,java.lang.Object*"); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object*", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object[]", key.get(2)); } @Test public void createParameterTypesFromString_String_noVargArg_array() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String[]"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String[]", key.toString()); assertEquals(1, key.size()); assertEquals("java.lang.String[]", key.get(0)); } @Test public void createParameterTypesFromString_StringFloat_noVargArg_array() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float[]"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float[]", key.toString()); assertEquals(2, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float[]", key.get(1)); } @Test public void createParameterTypesFromString_StringFloatObject_noVargArg_array() { ActionParameterTypes key = this.provider.createParameterTypesFromString("java.lang.String,float,java.lang.Object[]"); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,float,java.lang.Object[]", key.toString()); assertEquals(3, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("float", key.get(1)); assertEquals("java.lang.Object[]", key.get(2)); } @Test public void createParameterTypesFromSarlModell_void() { ActionParameterTypes key = this.provider.createParameterTypesFromSarlModel(false, new BasicEList<SarlFormalParameter>()); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertTrue(key.isEmpty()); } @Test public void createParameterTypesFromSarlModel_noVarArg() { ActionParameterTypes key = this.provider.createParameterTypesFromSarlModel(false, this.sarlParameters); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,int,float,java.lang.Object", key.toString()); assertEquals(4, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("int", key.get(1)); assertEquals("float", key.get(2)); assertEquals("java.lang.Object", key.get(3)); } @Test public void createParameterTypesFromSarlModel_varArg() { ActionParameterTypes key = this.provider.createParameterTypesFromSarlModel(true, this.sarlParameters); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,int,float,java.lang.Object*", key.toString()); assertEquals(4, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("int", key.get(1)); assertEquals("float", key.get(2)); assertEquals("java.lang.Object[]", key.get(3)); } @Test public void createParameterTypesFromJvmModel_void() { ActionParameterTypes key = this.provider.createParameterTypesFromJvmModel(false, new BasicEList<JvmFormalParameter>()); assertNotNull(key); assertFalse(key.isVarArg()); assertTrue(key.isVoid()); assertTrue(key.isEmpty()); } @Test public void createParameterTypesFromJvmModel_noVarArg() { ActionParameterTypes key = this.provider.createParameterTypesFromJvmModel(false, this.jvmParameters); assertNotNull(key); assertFalse(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,int,float,java.lang.Object[]", key.toString()); assertEquals(4, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("int", key.get(1)); assertEquals("float", key.get(2)); assertEquals("java.lang.Object[]", key.get(3)); } @Test public void createParameterTypesFromJvmModel_varArg() { ActionParameterTypes key = this.provider.createParameterTypesFromJvmModel(true, this.jvmParameters); assertNotNull(key); assertTrue(key.isVarArg()); assertFalse(key.isVoid()); assertEquals("java.lang.String,int,float,java.lang.Object*", key.toString()); assertEquals(4, key.size()); assertEquals("java.lang.String", key.get(0)); assertEquals("int", key.get(1)); assertEquals("float", key.get(2)); assertEquals("java.lang.Object[]", key.get(3)); } @Test public void createActionPrototype_void() { ActionParameterTypes params = this.provider.createParameterTypesFromJvmModel(true, new BasicEList<JvmFormalParameter>()); ActionPrototype prototype = this.provider.createActionPrototype("myfct", params); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName()); assertSame(params, prototype.getParametersTypes()); } @Test public void createActionPrototype_noVarArg() { ActionParameterTypes params = this.provider.createParameterTypesFromJvmModel(false, this.jvmParameters); ActionPrototype prototype = this.provider.createActionPrototype("myfct", params); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName()); assertSame(params, prototype.getParametersTypes()); } @Test public void createActionPrototype_varArg() { ActionParameterTypes params = this.provider.createParameterTypesFromJvmModel(true, this.jvmParameters); ActionPrototype prototype = this.provider.createActionPrototype("myfct", params); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName()); assertSame(params, prototype.getParametersTypes()); } @Test public void createPrototypeFromSarlModel_void() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); EList<SarlFormalParameter> params = new BasicEList<>(); // InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, false, params); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameFormalParameters(params, prototype.getFormalParameters()); assertEquals("", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), ""); assertTrue(prototype.getInferredParameterTypes().isEmpty()); } @Test public void createPrototypeFromSarlModel_noVarArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); // InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, false, this.sarlParameters); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameFormalParameters(this.sarlParameters, prototype.getFormalParameters()); assertEquals( "java.lang.String,int,float,java.lang.Object", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), "java.lang.String,int,float,java.lang.Object", "java.lang.String,int,java.lang.Object", "int,float,java.lang.Object", "int,java.lang.Object"); assertPrototypes(prototype.getOriginalParameterTypes(), InferredStandardParameter.class, "java.lang.String", "firstarg", InferredStandardParameter.class, "int", "secondarg", InferredStandardParameter.class, "float", "thirdarg", InferredStandardParameter.class, "java.lang.Object", "fourtharg"); assertPrototypes(prototype.getInferredParameterTypes(), new Object[] { InferredStandardParameter.class, "java.lang.String", "firstarg", InferredStandardParameter.class, "int", "secondarg", InferredValuedParameter.class, "float", "thirdarg", "io.sarl.tests.Stub" + index + "#MYFCT_1", InferredStandardParameter.class, "java.lang.Object", "fourtharg", }, new Object[] { InferredValuedParameter.class, "java.lang.String", "firstarg", "io.sarl.tests.Stub" + index + "#MYFCT_0", InferredStandardParameter.class, "int", "secondarg", InferredStandardParameter.class, "float", "thirdarg", InferredStandardParameter.class, "java.lang.Object", "fourtharg", }, new Object[] { InferredValuedParameter.class, "java.lang.String", "firstarg", "io.sarl.tests.Stub" + index + "#MYFCT_0", InferredStandardParameter.class, "int", "secondarg", InferredValuedParameter.class, "float", "thirdarg", "io.sarl.tests.Stub" + index + "#MYFCT_1", InferredStandardParameter.class, "java.lang.Object", "fourtharg", }); } @Test public void createPrototypeFromSarlModel_varArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); // InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, true, this.sarlParameters); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameFormalParameters(this.sarlParameters, prototype.getFormalParameters()); assertEquals("java.lang.String,int,float,java.lang.Object*", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), "java.lang.String,int,float,java.lang.Object*", "java.lang.String,int,java.lang.Object*", "int,float,java.lang.Object*", "int,java.lang.Object*"); assertPrototypes(prototype.getOriginalParameterTypes(), InferredStandardParameter.class, "java.lang.String", "firstarg", InferredStandardParameter.class, "int", "secondarg", InferredStandardParameter.class, "float", "thirdarg", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg"); assertPrototypes(prototype.getInferredParameterTypes(), new Object[] { InferredStandardParameter.class, "java.lang.String", "firstarg", InferredStandardParameter.class, "int", "secondarg", InferredValuedParameter.class, "float", "thirdarg", "io.sarl.tests.Stub" + index + "#MYFCT_1", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg", }, new Object[] { InferredValuedParameter.class, "java.lang.String", "firstarg", "io.sarl.tests.Stub" + index + "#MYFCT_0", InferredStandardParameter.class, "int", "secondarg", InferredStandardParameter.class, "float", "thirdarg", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg", }, new Object[] { InferredValuedParameter.class, "java.lang.String", "firstarg", "io.sarl.tests.Stub" + index + "#MYFCT_0", InferredStandardParameter.class, "int", "secondarg", InferredValuedParameter.class, "float", "thirdarg", "io.sarl.tests.Stub" + index + "#MYFCT_1", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg", }); } @Test public void createPrototypeFromJvmModel_void() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); EList<JvmFormalParameter> params = new BasicEList<>(); // InferredPrototype prototype = this.provider.createPrototypeFromJvmModel(this.context, qn, false, params); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameJvmFormalParameters(params, prototype.getFormalParameters()); assertEquals("", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), ""); assertTrue(prototype.getInferredParameterTypes().isEmpty()); } @Test public void createPrototypeFromJvmModel_noVarArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); // InferredPrototype prototype = this.provider.createPrototypeFromJvmModel(this.context, qn, false, this.jvmParameters); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameJvmFormalParameters(this.jvmParameters, prototype.getFormalParameters()); assertEquals( "java.lang.String,int,float,java.lang.Object[]", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), "java.lang.String,int,float,java.lang.Object[]", "java.lang.String,int,java.lang.Object[]", "int,float,java.lang.Object[]", "int,java.lang.Object[]"); assertPrototypes(prototype.getOriginalParameterTypes(), InferredStandardParameter.class, "java.lang.String", "firstarg", InferredStandardParameter.class, "int", "secondarg", InferredStandardParameter.class, "float", "thirdarg", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg"); assertPrototypes(prototype.getInferredParameterTypes(), new Object[] { InferredStandardParameter.class, "java.lang.String", "firstarg", InferredStandardParameter.class, "int", "secondarg", InferredValuedParameter.class, "float", "thirdarg", "io.sarl.tests.Stub" + index + "#MYFCT_1", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg", }, new Object[] { InferredValuedParameter.class, "java.lang.String", "firstarg", "io.sarl.tests.Stub" + index + "#MYFCT_0", InferredStandardParameter.class, "int", "secondarg", InferredStandardParameter.class, "float", "thirdarg", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg", }, new Object[] { InferredValuedParameter.class, "java.lang.String", "firstarg", "io.sarl.tests.Stub" + index + "#MYFCT_0", InferredStandardParameter.class, "int", "secondarg", InferredValuedParameter.class, "float", "thirdarg", "io.sarl.tests.Stub" + index + "#MYFCT_1", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg", }); } @Test public void createPrototypeFromJvmModel_varArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); // InferredPrototype prototype = this.provider.createPrototypeFromJvmModel(this.context, qn, true, this.jvmParameters); assertNotNull(prototype); assertEquals("myfct", prototype.getActionName().getActionName()); assertSameJvmFormalParameters(this.jvmParameters, prototype.getFormalParameters()); assertEquals( "java.lang.String,int,float,java.lang.Object*", prototype.getFormalParameterTypes().toString()); assertContainsStrings( prototype.getParameterTypeAlternatives(), "java.lang.String,int,float,java.lang.Object*", "java.lang.String,int,java.lang.Object*", "int,float,java.lang.Object*", "int,java.lang.Object*"); assertPrototypes(prototype.getOriginalParameterTypes(), InferredStandardParameter.class, "java.lang.String", "firstarg", InferredStandardParameter.class, "int", "secondarg", InferredStandardParameter.class, "float", "thirdarg", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg"); assertPrototypes(prototype.getInferredParameterTypes(), new Object[] { InferredStandardParameter.class, "java.lang.String", "firstarg", InferredStandardParameter.class, "int", "secondarg", InferredValuedParameter.class, "float", "thirdarg", "io.sarl.tests.Stub" + index + "#MYFCT_1", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg", }, new Object[] { InferredValuedParameter.class, "java.lang.String", "firstarg", "io.sarl.tests.Stub" + index + "#MYFCT_0", InferredStandardParameter.class, "int", "secondarg", InferredStandardParameter.class, "float", "thirdarg", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg", }, new Object[] { InferredValuedParameter.class, "java.lang.String", "firstarg", "io.sarl.tests.Stub" + index + "#MYFCT_0", InferredStandardParameter.class, "int", "secondarg", InferredValuedParameter.class, "float", "thirdarg", "io.sarl.tests.Stub" + index + "#MYFCT_1", InferredStandardParameter.class, "java.lang.Object[]", "fourtharg", }); } @Test public void getPrototypesQualifiedActionName_noCreatedPrototype() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); // Iterable<InferredPrototype> iterable = this.provider.getPrototypes(this.context, qn); assertNotNull(iterable); assertFalse(iterable.iterator().hasNext()); } @Test public void getPrototypesQualifiedActionName_createdPrototype_noVarArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); InferredPrototype expected = this.provider.createPrototypeFromSarlModel(this.context, qn, false, this.sarlParameters); // Iterable<InferredPrototype> iterable = this.provider.getPrototypes(this.context, qn); assertNotNull(iterable); Iterator<InferredPrototype> iterator = iterable.iterator(); assertTrue(iterator.hasNext()); InferredPrototype prototype = iterator.next(); assertSame(expected, prototype); assertFalse(iterator.hasNext()); } @Test public void getPrototypesQualifiedActionName_createdPrototype_varArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); InferredPrototype expected = this.provider.createPrototypeFromSarlModel(this.context, qn, true, this.sarlParameters); // Iterable<InferredPrototype> iterable = this.provider.getPrototypes(this.context, qn); assertNotNull(iterable); Iterator<InferredPrototype> iterator = iterable.iterator(); assertTrue(iterator.hasNext()); InferredPrototype prototype = iterator.next(); assertSame(expected, prototype); assertFalse(iterator.hasNext()); } @Test public void getPrototypesQualifiedActionNameActionParameterTypes_noCreatedPrototype() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(false, this.sarlParameters); // InferredPrototype prototype = this.provider.getPrototypes(this.context, qn, types); assertNull(prototype); } @Test public void getPrototypesQualifiedActionNameActionParameterTypes_createdPrototype_noVarArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(false, this.sarlParameters); InferredPrototype expected = this.provider.createPrototypeFromSarlModel(this.context, qn, false, this.sarlParameters); // InferredPrototype prototype = this.provider.getPrototypes(this.context, qn, types); assertNotNull(prototype); assertSame(expected, prototype); } @Test public void getPrototypesQualifiedActionNameActionParameterTypes_createdPrototype_varArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(true, this.sarlParameters); InferredPrototype expected = this.provider.createPrototypeFromSarlModel(this.context, qn, true, this.sarlParameters); // InferredPrototype prototype = this.provider.getPrototypes(this.context, qn, types); assertNotNull(prototype); assertSame(expected, prototype); } @Test public void resetPrototypes_noCreatedProtype() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(false, this.sarlParameters); assertNotNull(types); // assertFalse(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); this.context.release(); assertFalse(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); } @Test public void resetPrototypes_createdProtype_noVarArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(false, this.sarlParameters); assertNotNull(types); InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, false, this.sarlParameters); assertNotNull(prototype); // assertTrue(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); this.context.release(); assertFalse(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); } @Test public void resetPrototypes_createdProtype_varArg() { JvmIdentifiableElement container = createJvmIdentifiableElementStub(); QualifiedActionName qn = this.provider.createQualifiedActionName(container, "myfct"); ActionParameterTypes types = this.provider.createParameterTypesFromSarlModel(true, this.sarlParameters); assertNotNull(types); InferredPrototype prototype = this.provider.createPrototypeFromSarlModel(this.context, qn, true, this.sarlParameters); assertNotNull(prototype); // assertTrue(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); this.context.release(); assertFalse(this.provider.getPrototypes(this.context, qn).iterator().hasNext()); } } }
{ "pile_set_name": "Github" }
#include "MasterPlayer.h" #include "Chat.h" #include "Language.h" #include "World.h" #include "Channel.h" #include "ChannelMgr.h" #include "Player.h" // ######################## CHAT SYSTEM ########################### void MasterPlayer::UpdateSpeakTime() { // ignore chat spam protection for GMs in any mode if (GetSession()->GetSecurity() > SEC_PLAYER) return; time_t current = time(NULL); if (m_speakTime > current) { uint32 max_count = sWorld.getConfig(CONFIG_UINT32_CHATFLOOD_MESSAGE_COUNT); if (!max_count) return; ++m_speakCount; if (m_speakCount >= max_count) { // prevent overwrite mute time, if message send just before mutes set, for example. time_t new_mute = current + sWorld.getConfig(CONFIG_UINT32_CHATFLOOD_MUTE_TIME); if (GetSession()->m_muteTime < new_mute) GetSession()->m_muteTime = new_mute; m_speakCount = 0; } } else m_speakCount = 0; m_speakTime = current + sWorld.getConfig(CONFIG_UINT32_CHATFLOOD_MESSAGE_DELAY); } void MasterPlayer::Whisper(const std::string& text, uint32 language, MasterPlayer* receiver) { if (language != LANG_ADDON) // if not addon data language = LANG_UNIVERSAL; // whispers should always be readable WorldPacket data(SMSG_MESSAGECHAT, 100); Player::BuildPlayerChat(GetObjectGuid(), chatTag(), &data, CHAT_MSG_WHISPER, text, language); receiver->GetSession()->SendPacket(&data); // not send confirmation for addon messages if (language != LANG_ADDON) { data.Initialize(SMSG_MESSAGECHAT, 100); Player::BuildPlayerChat(receiver->GetObjectGuid(), receiver->chatTag(), &data, CHAT_MSG_WHISPER_INFORM, text, language); GetSession()->SendPacket(&data); } ALL_SESSION_SCRIPTS(receiver->GetSession(), OnWhispered(GetObjectGuid())); if (receiver->isDND()) { data.Initialize(SMSG_MESSAGECHAT, 100); Player::BuildPlayerChat(receiver->GetObjectGuid(), receiver->chatTag(), &data, CHAT_MSG_DND, receiver->dndMsg, language); GetSession()->SendPacket(&data); } else if (receiver->isAFK()) { data.Initialize(SMSG_MESSAGECHAT, 100); Player::BuildPlayerChat(receiver->GetObjectGuid(), receiver->chatTag(), &data, CHAT_MSG_AFK, receiver->afkMsg, language); GetSession()->SendPacket(&data); } if (!IsAcceptWhispers()) AddAllowedWhisperer(receiver->GetObjectGuid()); } void MasterPlayer::ToggleDND() { if (m_chatTag == 2) m_chatTag = 0; else m_chatTag = 2; } void MasterPlayer::ToggleAFK() { if (m_chatTag == 1) m_chatTag = 0; else m_chatTag = 1; } void MasterPlayer::JoinedChannel(Channel *c) { m_channels.push_back(c); } void MasterPlayer::LeftChannel(Channel *c) { m_channels.remove(c); } void MasterPlayer::CleanupChannels() { while (!m_channels.empty()) { Channel* ch = *m_channels.begin(); m_channels.erase(m_channels.begin()); // remove from player's channel list ch->Leave(GetObjectGuid(), false); // not send to client, not remove from player's channel list if (ChannelMgr* cMgr = channelMgr(GetTeam())) cMgr->LeftChannel(ch->GetName()); // deleted channel if empty } }
{ "pile_set_name": "Github" }
# Installation See http://caffe.berkeleyvision.org/installation.html for the latest installation instructions. Check the users group in case you need help: https://groups.google.com/forum/#!forum/caffe-users
{ "pile_set_name": "Github" }
#!@BASH_SHELL@ # # Copyright (C) 1997-2003 Sistina Software, Inc. All rights reserved. # Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # # File system common functions # LC_ALL=C LANG=C PATH=/bin:/sbin:/usr/bin:/usr/sbin export LC_ALL LANG PATH # Define this value to 0 by default, bind-mount.sh or any other agent # that uses this value will alter it after sourcing fs-lib.sh export IS_BIND_MOUNT=0 # Private return codes FAIL=2 NO=1 YES=0 YES_STR="yes" [ -z "$OCF_RESOURCE_INSTANCE" ] && export OCF_RESOURCE_INSTANCE="filesystem:$OCF_RESKEY_name" # # Using a global to contain the return value saves # clone() operations. This is important to reduce # resource consumption during status checks. # # There is no way to return a string from a function # in bash without cloning the process, which is exactly # what we are trying to avoid. So, we have to resort # to using a dedicated global variables. declare REAL_DEVICE declare STRIP_SLASHES="" declare FINDMNT_OUTPUT="" # # Stub ocf_log function for when we are using # quick_status, since ocf_log generally forks (and # sourcing ocf-shellfuncs forks -a lot-). # ocf_log() { echo $* } # # Assume NFS_TRICKS are not available until we are # proved otherwise. # export NFS_TRICKS=1 # # Quick status doesn't fork() or clone() when using # device files directly. (i.e. not symlinks, LABEL= or # UUID= # if [ "$1" = "status" -o "$1" = "monitor" ] && [ "$OCF_RESKEY_quick_status" = "1" ]; then echo Using Quick Status # XXX maybe we can make ocf-shellfuncs have a 'quick' mode too? export OCF_SUCCESS=0 export OCF_ERR_GENERIC=1 else # # Grab nfs lock tricks if available # if [ -f "$(dirname $0)/svclib_nfslock" ]; then . $(dirname $0)/svclib_nfslock NFS_TRICKS=0 fi . $(dirname $0)/ocf-shellfuncs fi verify_name() { if [ -z "$OCF_RESKEY_name" ]; then ocf_log err "No file system name specified." return $OCF_ERR_ARGS fi return $OCF_SUCCESS } verify_mountpoint() { if [ -z "$OCF_RESKEY_mountpoint" ]; then ocf_log err "No mount point specified." return $OCF_ERR_ARGS fi if ! [ -e "$OCF_RESKEY_mountpoint" ]; then ocf_log info "Mount point $OCF_RESKEY_mountpoint will be "\ "created at mount time." return $OCF_SUCCESS fi [ -d "$OCF_RESKEY_mountpoint" ] && return $OCF_SUCCESS ocf_log err "$OCF_RESKEY_mountpoint exists but is not a directory." return $OCF_ERR_ARGS } # # This used to be called using $(...), but doing this causes bash # to set up a pipe and clone(). So, the output of this function is # stored in the global variable REAL_DEVICE, declared previously. # real_device() { declare dev="$1" declare realdev if [ $IS_BIND_MOUNT -eq 1 ]; then REAL_DEVICE="$dev" return $OCF_SUCCESS fi REAL_DEVICE="" [ -z "$dev" ] && return $OCF_ERR_ARGS # Oops, we have a link. Sorry, this is going to fork. if [ -h "$dev" ]; then realdev=$(readlink -f $dev) if [ $? -ne 0 ]; then return $OCF_ERR_ARGS fi REAL_DEVICE="$realdev" return $OCF_SUCCESS fi # If our provided blockdev is a device, we are done if [ -b "$dev" ]; then REAL_DEVICE="$dev" return $OCF_SUCCESS fi # It's not a link, it's not a block device. If it also # does not match UUID= or LABEL=, then findfs is not # going to find anything useful, so we should quit now. if [ "${dev/UUID=/}" = "$dev" ] && [ "${dev/LABEL=/}" = "$dev" ]; then return $OCF_ERR_GENERIC fi # When using LABEL= or UUID=, we can't save a fork. realdev=$(findfs "$dev" 2> /dev/null) if [ -n "$realdev" ] && [ -b "$realdev" ]; then REAL_DEVICE="$realdev" return $OCF_SUCCESS fi return $OCF_ERR_GENERIC } verify_device() { declare realdev if [ -z "$OCF_RESKEY_device" ]; then ocf_log err "No device or label specified." return $OCF_ERR_ARGS fi real_device "$OCF_RESKEY_device" realdev="$REAL_DEVICE" if [ -n "$realdev" ]; then if [ "$realdev" != "$OCF_RESKEY_device" ]; then ocf_log info "Specified $OCF_RESKEY_device maps to $realdev" fi return $OCF_SUCCESS fi ocf_log err "Device or label \"$OCF_RESKEY_device\" not valid" return $OCF_ERR_ARGS } list_mounts() { if [ $IS_BIND_MOUNT -eq 1 ]; then cat /etc/mtab else cat /proc/mounts fi } ## # Tries to use findmnt util to return list # of mountpoints for a device # # Global variables are used to reduce forking when capturing stdout. # # Return values # 0 - device mount points found, mountpoint list returned to FINDMNT_OUTPUT global variable # 1 - device mount not found # 2 - findmnt tool isn't found or can not be used # ## try_findmnt() { FINDMNT_OUTPUT="" case $OCF_RESKEY_use_findmnt in 0|false|no|off) return 2 ;; *) : ;; esac which findmnt > /dev/null 2>&1 if [ $? -eq 0 ]; then FINDMNT_OUTPUT="$(findmnt -o TARGET --noheadings $1)" if [ $? -ne 0 ]; then # workaround mount helpers inconsistency that still # add / on the device entry in /proc/mounts FINDMNT_OUTPUT="$(findmnt -o TARGET --noheadings $1/)" if [ $? -ne 0 ]; then return 1 else return 0 fi else return 0 fi fi return 2 } ## # Returns result in global variable to reduce forking ## strip_trailing_slashes() { local tmp=$1 while [ "${tmp#${tmp%?}}" = "/" ] do tmp="${tmp%/}" done STRIP_SLASHES="$tmp" } # # kill_procs_using_mount mount_point [signal] # # Kill any processes using the specified mountpoint, using the optional # specified signal. This is used in place of fuser to avoid it becoming # blocked while following symlinks to an unresponsive file system. # Defaults to SIGKILL if no signal specified. # kill_procs_using_mount () { declare mp declare procs declare mmap_procs if [ $# -lt 1 -o -z "$1" ]; then ocf_log err "Usage: kill_procs_using_mount mount_point [signal]" return $FAIL fi strip_trailing_slashes "$1" mp="$STRIP_SLASHES" if [ -z "$mp" ]; then ocf_log err "Usage: kill_procs_using_mount mount_point [signal]" return $FAIL fi # anything held open in mount point after the slash procs=$(find /proc/[0-9]*/ -type l -lname "${mp}/*" -or -lname "${mp}" 2>/dev/null | awk -F/ '{print $3}' | uniq) # anything with memory mapping to something in the mountpoint mmap_procs=$(grep " ${mp}" /proc/[0-9]*/maps | awk -F/ '{print $3}' | uniq) procs=$(echo -e "${procs}\n${mmap_procs}" | sort | uniq) for pid in $procs; do if [ -n "$2" ]; then kill -s $2 $pid else kill -s KILL $pid fi done return $SUCCESS } # # mount_in_use device mount_point # # Check to see if either the device or mount point are in use anywhere on # the system. It is not required that the device be mounted on the named # moint point, just if either are in use. # mount_in_use () { declare mp tmp_mp declare tmp_type declare dev tmp_dev declare junkb junkc junkd declare res=$FAIL declare findmnt_res=2 if [ $# -ne 2 ]; then ocf_log err "Usage: mount_in_use device mount_point". return $FAIL fi dev="$1" mp="$2" # First try and find out if the device has a mount point by # attempting to use the findmnt tool. It is much faster than # iterating through /proc/mounts try_findmnt $dev findmnt_res=$? if [ $findmnt_res -eq 0 ]; then case $OCF_RESKEY_fstype in cifs|nfs|nfs4) # -r means to include '/' character and not treat it as escape character while read -r tmp_mp do if [ "$tmp_mp" = "$mp" ]; then return $YES fi done < <(echo "$FINDMNT_OUTPUT") ;; *) return $YES ;; esac fi while read -r tmp_dev tmp_mp tmp_type junkb junkc junkd; do if [ "$tmp_type" = "autofs" ]; then continue fi # Does the device match? We might have already tried findmnt # which is why this could get skipped if [ $findmnt_res -eq 2 ]; then if [ "${tmp_dev:0:1}" != "-" ]; then # XXX fork/clone warning XXX tmp_dev="$(printf "$tmp_dev")" fi strip_trailing_slashes "$tmp_dev" tmp_dev="$STRIP_SLASHES" if [ -n "$tmp_dev" -a "$tmp_dev" = "$dev" ]; then case $OCF_RESKEY_fstype in cifs|nfs|nfs4) ;; *) return $YES ;; esac fi fi # Mountpoint from /proc/mounts containing spaces will # have spaces represented in octal. printf takes care # of this for us. tmp_mp="$(printf "$tmp_mp")" if [ -n "$tmp_mp" -a "$tmp_mp" = "$mp" ]; then return $YES fi done < <(list_mounts) return $NO } ## # Returns whether or not the device is mounted. # If the mountpoint does not match the one provided, the # mount point found is printed to stdout. ## real_mountpoint() { declare dev=$1 declare mp=$2 declare ret=$NO declare tmp_mp declare tmp_dev declare tmp_type declare found=1 declare poss_mp="" try_findmnt $dev case $? in 0) #findmnt found mount points, loop through them to find a match # -r means to include '/' character and not treat it as escape character while read -r tmp_mp do ret=$YES if [ "$tmp_mp" != "$mp" ]; then poss_mp=$tmp_mp else found=0 break fi done < <(echo "$FINDMNT_OUTPUT") ;; 1) # findmnt found no mount points for the device return $NO ;; 2) # findmnt tool could not be used. # Using slow method reading /proc/mounts dir. while read -r tmp_dev tmp_mp tmp_type junk_b junk_c junk_d do if [ "$tmp_type" = "autofs" ]; then continue fi if [ "${tmp_dev:0:1}" != "-" ]; then # XXX fork/clone warning XXX tmp_dev="$(printf "$tmp_dev")" fi # CIFS mounts can sometimes have trailing slashes # in their first field in /proc/mounts, so strip them. strip_trailing_slashes "$tmp_dev" tmp_dev="$STRIP_SLASHES" real_device "$tmp_dev" tmp_dev="$REAL_DEVICE" # XXX fork/clone warning XXX # Mountpoint from /proc/mounts containing spaces will # have spaces represented in octal. printf takes care # of this for us. tmp_mp="$(printf "$tmp_mp")" if [ -n "$tmp_dev" -a "$tmp_dev" = "$dev" ]; then ret=$YES # # Check to see if its mounted in the right # place # if [ -n "$tmp_mp" ]; then if [ "$tmp_mp" != "$mp" ]; then poss_mp=$tmp_mp else found=0 break fi fi fi done < <(list_mounts) esac if [ $found -ne 0 ]; then echo "$poss_mp" fi return $ret } # # is_mounted device mount_point # # Check to see if the device is mounted. Print a warning if its not # mounted on the directory we expect it to be mounted on. # is_mounted () { declare mp declare dev declare ret=$FAIL declare poss_mp if [ $# -ne 2 ]; then ocf_log err "Usage: is_mounted device mount_point" return $FAIL fi real_device "$1" dev="$REAL_DEVICE" if [ -z "$dev" ]; then ocf_log err "$OCF_RESOURCE_INSTANCE: is_mounted: Could not match $1 with a real device" return $OCF_ERR_ARGS fi if [ -h "$2" ]; then mp="$(readlink -f $2)" else mp="$2" fi # This bash glyph simply removes a trailing slash # if one exists. /a/b/ -> /a/b; /a/b -> /a/b. mp="${mp%/}" poss_mp=$(real_mountpoint "$dev" "$mp") ret=$? if [ $ret -eq $YES ] && [ -n "$poss_mp" ]; then # if we made it here, then the device is mounted, but not where # we expected it to be case $OCF_RESKEY_fstype in cifs|nfs|nfs4) ret=$NO ;; *) ocf_log warn "Device $dev is mounted on $poss_mp instead of $mp" ;; esac fi return $ret } # # is_alive mount_point # # Check to see if mount_point is alive (testing read/write) # is_alive() { declare errcode declare mount_point="$1" declare file declare rw if [ $# -ne 1 ]; then ocf_log err "Usage: is_alive mount_point" return $FAIL fi [ -z "$OCF_CHECK_LEVEL" ] && export OCF_CHECK_LEVEL=0 test -d "$mount_point" if [ $? -ne 0 ]; then ocf_log err "${OCF_RESOURCE_INSTANCE}: is_alive: $mount_point is not a directory" return $FAIL fi [ $OCF_CHECK_LEVEL -lt 10 ] && return $YES # depth 10 test (read test) ls "$mount_point" > /dev/null 2> /dev/null errcode=$? if [ $errcode -ne 0 ]; then ocf_log err "${OCF_RESOURCE_INSTANCE}: is_alive: failed read test on [$mount_point]. Return code: $errcode" return $NO fi [ $OCF_CHECK_LEVEL -lt 20 ] && return $YES # depth 20 check (write test) rw=$YES for o in `echo $OCF_RESKEY_options | sed -e s/,/\ /g`; do if [ "$o" = "ro" ]; then rw=$NO fi done if [ $rw -eq $YES ]; then file=$(mktemp "$mount_point/.check_writable.$(hostname).XXXXXX") if [ ! -e "$file" ]; then ocf_log err "${OCF_RESOURCE_INSTANCE}: is_alive: failed write test on [$mount_point]. Return code: $errcode" return $NO fi rm -f $file > /dev/null 2> /dev/null fi return $YES } # # Decide which quota options are enabled and return a string # which we can pass to quotaon # quota_opts() { declare quotaopts="" declare opts="$1" declare mopt for mopt in `echo $opts | sed -e s/,/\ /g`; do case $mopt in quota) quotaopts="gu" break ;; usrquota) quotaopts="u$quotaopts" continue ;; grpquota) quotaopts="g$quotaopts" continue ;; noquota) quotaopts="" return 0 ;; esac done echo $quotaopts return 0 } # # Enable quotas on the mount point if the user requested them # enable_fs_quotas() { declare -i need_check=0 declare -i rv declare quotaopts="" declare mopt declare opts="$1" declare mp="$2" if ! type quotaon &> /dev/null; then ocf_log err "quotaon not found in $PATH" return $OCF_ERR_GENERIC fi quotaopts=$(quota_opts $opts) [ -z "$quotaopts" ] && return 0 ocf_log debug "quotaopts = $quotaopts" # Ok, create quota files if they don't exist for f in quota.user aquota.user quota.group aquota.group; do if ! [ -f "$mp/$f" ]; then ocf_log info "$mp/$f was missing - creating" touch "$mp/$f" chmod 600 "$mp/$f" need_check=1 fi done if [ $need_check -eq 1 ]; then ocf_log info "Checking quota info in $mp" quotacheck -$quotaopts "$mp" fi ocf_log info "Enabling Quotas on $mp" ocf_log debug "quotaon -$quotaopts \"$mp\"" quotaon -$quotaopts "$mp" rv=$? if [ $rv -ne 0 ]; then # Just a warning ocf_log warn "Unable to turn on quotas for $mp; return = $rv" fi return $rv } # Agent-specific actions to take before mounting # (if required). Typically things like fsck. do_pre_mount() { return 0 } # Default mount handler - for block devices # do_mount() { declare dev="$1" declare mp="$2" declare mount_options="" declare fstype_option="" declare fstype # # Get the filesystem type, if specified. # fstype_option="" fstype=${OCF_RESKEY_fstype} case "$fstype" in ""|"[ ]*") fstype="" ;; *) # found it fstype_option="-t $fstype" ;; esac # # Get the mount options, if they exist. # mount_options="" opts=${OCF_RESKEY_options} case "$opts" in ""|"[ ]*") opts="" ;; *) # found it mount_options="-o $opts" ;; esac # # Mount the device # ocf_log info "mounting $dev on $mp" ocf_log err "mount $fstype_option $mount_options $dev $mp" mount $fstype_option $mount_options "$dev" "$mp" ret_val=$? if [ $ret_val -ne 0 ]; then ocf_log err "\ 'mount $fstype_option $mount_options $dev $mp' failed, error=$ret_val" return 1 fi return 0 } # Agent-specific actions to take after mounting # (if required). do_post_mount() { return 0 } # Agent-specific actions to take before unmounting # (if required) do_pre_unmount() { return 0 } # Agent-specific actions to take after umount succeeds # (if required) do_post_unmount() { return 0 } # Agent-specific force unmount logic, if required # return = 0 if successful, or nonzero if unsuccessful # (unsuccessful = try harder) do_force_unmount() { return 1 } # # start_filesystem # start_filesystem() { declare -i ret_val=$OCF_SUCCESS declare mp="${OCF_RESKEY_mountpoint}" declare dev="" # device declare fstype="" declare opts="" declare mount_options="" # # Check if fstype is supported # verify_fstype case $? in $OCF_ERR_ARGS) ocf_log err "File system type $OCF_RESKEY_fstype not supported" return $OCF_ERR_ARGS ;; *) ;; esac # # Check if mount point was specified. If not, no need to continue. # case "$mp" in ""|"[ ]*") # nothing to mount return $OCF_SUCCESS ;; /*) # found it ;; *) # invalid format ocf_log err \ "start_filesystem: Invalid mount point format (must begin with a '/'): \'$mp\'" return $OCF_ERR_ARGS ;; esac # # Get the device # real_device "$OCF_RESKEY_device" dev="$REAL_DEVICE" if [ -z "$dev" ]; then ocf_log err "\ start_filesystem: Could not match $OCF_RESKEY_device with a real device" return $OCF_ERR_ARGS fi # # Ensure we've got a valid directory # if [ -e "$mp" ]; then if ! [ -d "$mp" ]; then ocf_log err"\ start_filesystem: Mount point $mp exists but is not a directory" return $OCF_ERR_ARGS fi else ocf_log err "\ start_filesystem: Creating mount point $mp for device $dev" mkdir -p "$mp" ret_val=$? if [ $ret_val -ne 0 ]; then ocf_log err "\ start_filesystem: Unable to create $mp. Error code: $ret_val" return $OCF_ERR_GENERIC fi fi # # See if the device is already mounted. # is_mounted "$dev" "$mp" case $? in $YES) # already mounted ocf_log debug "$dev already mounted" return $OCF_SUCCESS ;; $NO) # not mounted, continue ;; *) return $FAIL ;; esac # # Make sure that neither the device nor the mount point are mounted # (i.e. they may be mounted in a different location). The'mount_in_use' # function checks to see if either the device or mount point are in # use somewhere else on the system. # mount_in_use "$dev" "$mp" case $? in $YES) # uh oh, someone is using the device or mount point ocf_log err "\ Cannot mount $dev on $mp, the device or mount point is already in use!" return $FAIL ;; $NO) # good, no one else is using it ;; $FAIL) return $FAIL ;; *) ocf_log err "Unknown return from mount_in_use" return $FAIL ;; esac do_pre_mount case $? in 0) ;; 1) return $OCF_ERR_GENERIC ;; 2) return $OCF_SUCCESS ;; esac do_mount "$dev" "$mp" case $? in 0) ;; 1) return $OCF_ERR_GENERIC ;; 2) return $OCF_SUCCESS ;; esac do_post_mount case $? in 0) ;; 1) return $OCF_ERR_GENERIC ;; 2) return $OCF_SUCCESS ;; esac enable_fs_quotas "$opts" "$mp" return $OCF_SUCCESS } # # stop_filesystem - unmount a file system; calls out to # stop_filesystem() { declare -i ret_val=0 declare -i try declare -i sleep_time=5 # time between each umount failure declare umount_failed="" declare force_umount="" declare self_fence="" declare quotaopts="" # # Get the mount point, if it exists. If not, no need to continue. # mp=${OCF_RESKEY_mountpoint} case "$mp" in ""|"[ ]*") # nothing to mount return $OCF_SUCCESS ;; /*) # found it ;; *) # invalid format ocf_log err \ "stop_filesystem: Invalid mount point format (must begin with a '/'): \'$mp\'" return $FAIL ;; esac # # Get the device # real_device "$OCF_RESKEY_device" dev="$REAL_DEVICE" if [ -z "$dev" ]; then ocf_log err "\ stop: Could not match $OCF_RESKEY_device with a real device" return $OCF_ERR_INSTALLED fi # # Get the force unmount setting if there is a mount point. # case ${OCF_RESKEY_force_unmount} in $YES_STR) force_umount=$YES ;; on) force_umount=$YES ;; true) force_umount=$YES ;; 1) force_umount=$YES ;; *) force_umount="" ;; esac # # self_fence _MUST_ be initialized before calling do_pre_unmount # The netfs agent depends on the self_fence variable. # case ${OCF_RESKEY_self_fence} in $YES_STR) self_fence=$YES ;; on) self_fence=$YES ;; true) self_fence=$YES ;; 1) self_fence=$YES ;; *) self_fence="" ;; esac do_pre_unmount case $? in 0) ;; 1) return $OCF_ERR_GENERIC ;; 2) return $OCF_SUCCESS ;; esac # # Preparations: sync, turn off quotas # sync quotaopts=$(quota_opts $OCF_RESKEY_options) if [ -n "$quotaopts" ]; then ocf_log debug "Turning off quotas for $mp" quotaoff -$quotaopts "$mp" &> /dev/null fi # # Unmount the device. # for try in 1 2 3; do if [ $try -ne 1 ]; then sleep $sleep_time fi is_mounted "$dev" "$mp" case $? in $NO) ocf_log info "$dev is not mounted" umount_failed= break ;; $YES) # fallthrough ;; *) return $FAIL ;; esac case ${OCF_RESKEY_no_unmount} in yes|YES|true|TRUE|YES|on|ON|1) ocf_log debug "Skipping umount on stop because of 'no_unmount' option" return $OCF_SUCCESS ;; *) : ;; esac ocf_log info "unmounting $mp" umount "$mp" ret_val=$? # some versions of umount will exit with status 16 iff # the umount(2) succeeded but /etc/mtab could not be written. if [ $ret_val -eq 0 -o $ret_val -eq 16 ]; then umount_failed= break fi ocf_log debug "umount failed: $ret_val" umount_failed=yes if [ -z "$force_umount" ]; then continue fi # Force unmount: try #1: send SIGTERM if [ $try -eq 1 ]; then # Try fs-specific force unmount, if provided do_force_unmount if [ $? -eq 0 ]; then # if this succeeds, we should be done continue fi ocf_log warning "Sending SIGTERM to processes on $mp" kill_procs_using_mount "$mp" "TERM" continue else ocf_log warning "Sending SIGKILL to processes on $mp" kill_procs_using_mount "$mp" if [ $? -eq 0 ]; then # someone is still accessing the mount, We've already sent # SIGTERM, now we've sent SIGKILL and are trying umount again. continue fi # mount has failed, and no one is accessing it. There's # nothing left for us to try. break fi done # for do_post_unmount case $? in 0) ;; 1) return $OCF_ERR_GENERIC ;; 2) return $OCF_SUCCESS ;; esac if [ -n "$umount_failed" ]; then ocf_log err "'umount $mp' failed, error=$ret_val" if [ "$self_fence" ]; then ocf_log alert "umount failed - REBOOTING" sync reboot -fn fi return $OCF_ERR_GENERIC fi return $OCF_SUCCESS } do_start() { declare tries=0 declare rv while [ $tries -lt 3 ]; do start_filesystem rv=$? if [ $rv -eq 0 ]; then return 0 fi ((tries++)) sleep 3 done return $rv } do_stop() { stop_filesystem return $? } do_monitor() { ocf_log debug "Checking fs \"$OCF_RESKEY_name\", Level $OCF_CHECK_LEVEL" # # Get the device # real_device "$OCF_RESKEY_device" dev="$REAL_DEVICE" if [ -z "$dev" ]; then ocf_log err "\ start_filesystem: Could not match $OCF_RESKEY_device with a real device" return $OCF_NOT_RUNNING fi is_mounted "$dev" "${OCF_RESKEY_mountpoint}" if [ $? -ne $YES ]; then ocf_log err "${OCF_RESOURCE_INSTANCE}: ${OCF_RESKEY_device} is not mounted on ${OCF_RESKEY_mountpoint}" return $OCF_NOT_RUNNING fi if [ "$OCF_RESKEY_quick_status" = "1" ]; then return 0 fi is_alive "${OCF_RESKEY_mountpoint}" [ $? -eq $YES ] && return 0 ocf_log err "fs:${OCF_RESKEY_name}: Mount point is not accessible!" return $OCF_ERR_GENERIC } do_restart() { stop_filesystem if [ $? -ne 0 ]; then return $OCF_ERR_GENERIC fi start_filesystem if [ $? -ne 0 ]; then return $OCF_ERR_GENERIC fi return 0 } # MUST BE OVERRIDDEN do_metadata() { return 1 } do_validate() { return 1 } main() { case $1 in start) do_start exit $? ;; stop) do_stop exit $? ;; status|monitor) do_monitor exit $? ;; restart) do_restart exit $? ;; meta-data) do_metadata exit $? ;; validate-all) do_validate ;; *) echo "usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}" exit $OCF_ERR_UNIMPLEMENTED ;; esac exit 0 }
{ "pile_set_name": "Github" }
package de.fhpotsdam.unfolding.geo; import processing.core.PApplet; import processing.core.PVector; import de.fhpotsdam.unfolding.core.Coordinate; public abstract class AbstractProjection { public float zoom; public Transformation transformation; public AbstractProjection() { this(0); } public AbstractProjection(float zoom) { this(zoom, new Transformation(1, 0, 0, 0, 1, 0)); } public AbstractProjection(float zoom, Transformation transformation) { this.zoom = zoom; this.transformation = transformation; } public abstract PVector rawProject(PVector point); public abstract PVector rawUnproject(PVector point); public PVector project(PVector point) { point = this.rawProject(point); if (this.transformation != null) { point = this.transformation.transform(point); } return point; } public PVector unproject(PVector point) { if (this.transformation != null) { point = this.transformation.untransform(point); } point = this.rawUnproject(point); return point; } public Coordinate locationCoordinate(Location location) { PVector point = new PVector(PApplet.PI * location.y / 180.0f, PApplet.PI * location.x / 180.0f); point = this.project(point); return new Coordinate(point.y, point.x, this.zoom); } public Location coordinateLocation(Coordinate coordinate) { coordinate = coordinate.zoomTo(this.zoom); PVector point = new PVector(coordinate.column, coordinate.row); point = this.unproject(point); return new Location(180.0f * point.y / PApplet.PI, 180.0f * point.x / PApplet.PI); } }
{ "pile_set_name": "Github" }
package org.chat21.android.core.chat_groups.listeners; import org.chat21.android.core.exception.ChatRuntimeException; import org.chat21.android.core.chat_groups.models.ChatGroup; /** * Created by stefanodp91 on 24/01/18. */ public interface ChatGroupsListener { void onGroupAdded(ChatGroup chatGroup, ChatRuntimeException e); void onGroupChanged(ChatGroup chatGroup, ChatRuntimeException e); void onGroupRemoved(ChatRuntimeException e); }
{ "pile_set_name": "Github" }
import merge from 'webpack-merge' import font from './font' import html from './html' import image from './image' import javaScript from './javascript' import style from './style' import txt from './txt' import video from './video' import yaml from './yaml' const loaders = [ font, html, image, javaScript, style, txt, video, yaml ] export default (saguiConfig) => { const disableLoaders = saguiConfig.disableLoaders || [] return loaders.filter((loader) => disableLoaders.indexOf(loader.name) === -1) .reduce((webpackConfig, loader) => ( merge.smart(webpackConfig, loader.configure(saguiConfig)) ), {}) }
{ "pile_set_name": "Github" }
--- title: Starting and Pausing a Miniport Adapter Overview description: Starting and Pausing a Miniport Adapter Overview ms.assetid: d278b331-90d9-4d19-bf00-732981962522 keywords: - miniport adapters WDK networking , starting - adapters WDK networking , starting - miniport adapters WDK networking , pausing - adapters WDK networking , pausing ms.date: 04/20/2017 ms.localizationpriority: medium --- # Starting and Pausing a Miniport Adapter Overview NDIS pauses an adapter to stop data flow that could interfere with Plug and Play operations, such as adding or removing a filter driver, or requests, such as setting a packet filter or multicast address list on the NIC. For more information about how to modify a running driver stack, see [Modifying a Running Driver Stack](modifying-a-running-driver-stack.md). NDIS restarts an adapter from the Paused state. The adapter enters the Paused start after adapter initialization is complete or after a pause operation is complete. The following topics provide more information about starting and pausing and adapter: - [Starting an Adapter](starting-an-adapter.md) - [Pausing an Adapter](pausing-an-adapter.md)
{ "pile_set_name": "Github" }
//Microsoft Developer Studio generated resource script. // #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 #ifndef _MAC ///////////////////////////////////////////////////////////////////////////// // // Version // #include "common/my_version.h" VS_VERSION_INFO VERSIONINFO FILEVERSION MY_VERSION_BINARY PRODUCTVERSION MY_VERSION_BINARY FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L #else FILEFLAGS 0x0L #endif FILEOS 0x40004L FILETYPE 0x2L FILESUBTYPE 0x0L BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904b0" BEGIN VALUE "Comments", "\0" VALUE "CompanyName", MY_COMPANY_NAME_STRING "\0" VALUE "FileDescription", MY_PRODUCT_NAME_STRING " Service\0" VALUE "FileVersion", MY_VERSION_STRING "\0" OPTIONAL_VALUE("InternalName", "SbieSvc\0") VALUE "LegalCopyright", MY_COPYRIGHT_STRING "\0" VALUE "LegalTrademarks", "\0" OPTIONAL_VALUE("OriginalFilename", "SbieSvc.exe\0") VALUE "PrivateBuild", "\0" VALUE "ProductName", MY_PRODUCT_NAME_STRING "\0" VALUE "ProductVersion", MY_VERSION_STRING "\0" VALUE "SpecialBuild", "\0" END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1200 END END #endif // !_MAC #endif // English (U.S.) resources /////////////////////////////////////////////////////////////////////////////
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGUID>{59D12AB8-F55F-4EE4-99CC-76A51ACB3036}</ProjectGUID> <Keyword>Win32Proj</Keyword> <Platform>Win32</Platform> <ProjectName>rdjpgcom</ProjectName> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseOfMfc>false</UseOfMfc> <CharacterSet>MultiByte</CharacterSet> <PlatformToolset>v140</PlatformToolset> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>10.0.20506.1</_ProjectFileVersion> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Esenthel\ThirdPartyLibs\JpegTurbo\Windows32\Release\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">rdjpgcom.dir\Release\</IntDir> <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">rdjpgcom</TargetName> <TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.exe</TargetExt> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> <GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</GenerateManifest> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <AdditionalIncludeDirectories>C:\Esenthel\ThirdPartyLibs\JpegTurbo\Windows32;C:\Esenthel\ThirdPartyLibs\JpegTurbo\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AssemblerListingLocation>Release/</AssemblerListingLocation> <CompileAs>CompileAsC</CompileAs> <DisableSpecificWarnings>4996</DisableSpecificWarnings> <ExceptionHandling> </ExceptionHandling> <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> <Optimization>MaxSpeed</Optimization> <PrecompiledHeader>NotUsing</PrecompiledHeader> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <WarningLevel>Level3</WarningLevel> <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;WITH_SIMD;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)</PreprocessorDefinitions> <ObjectFileName>$(IntDir)</ObjectFileName> <DebugInformationFormat></DebugInformationFormat> </ClCompile> <ResourceCompile> <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;WITH_SIMD;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)</PreprocessorDefinitions> <AdditionalIncludeDirectories>C:\Esenthel\ThirdPartyLibs\JpegTurbo\Windows32;C:\Esenthel\ThirdPartyLibs\JpegTurbo\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ResourceCompile> <Midl> <AdditionalIncludeDirectories>C:\Esenthel\ThirdPartyLibs\JpegTurbo\Windows32;C:\Esenthel\ThirdPartyLibs\JpegTurbo\lib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <OutputDirectory>$(ProjectDir)/$(IntDir)</OutputDirectory> <HeaderFileName>%(Filename).h</HeaderFileName> <TypeLibraryName>%(Filename).tlb</TypeLibraryName> <InterfaceIdentifierFileName>%(Filename)_i.c</InterfaceIdentifierFileName> <ProxyFileName>%(Filename)_p.c</ProxyFileName> </Midl> <Link> <AdditionalOptions> /machine:X86 %(AdditionalOptions)</AdditionalOptions> <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib</AdditionalDependencies> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>false</GenerateDebugInformation> <IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <ImportLibrary>C:/Esenthel/ThirdPartyLibs/JpegTurbo/Windows32/Release/rdjpgcom.lib</ImportLibrary> <ProgramDataBaseFile>C:/Esenthel/ThirdPartyLibs/JpegTurbo/Windows32/Release/rdjpgcom.pdb</ProgramDataBaseFile> <SubSystem>Console</SubSystem> <Version></Version> </Link> <ProjectReference> <LinkLibraryDependencies>false</LinkLibraryDependencies> </ProjectReference> </ItemDefinitionGroup> <ItemGroup> <CustomBuild Include="C:\Esenthel\ThirdPartyLibs\JpegTurbo\lib\CMakeLists.txt"> <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Building Custom Rule C:/Esenthel/ThirdPartyLibs/JpegTurbo/lib/CMakeLists.txt</Message> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">setlocal "C:\Program Files (x86)\CMake\bin\cmake.exe" -HC:/Esenthel/ThirdPartyLibs/JpegTurbo/lib -BC:/Esenthel/ThirdPartyLibs/JpegTurbo/Windows32 --check-stamp-file C:\Esenthel\ThirdPartyLibs\JpegTurbo\Windows32\CMakeFiles\generate.stamp if %errorlevel% neq 0 goto :cmEnd :cmEnd endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone :cmErrorLevel exit /b %1 :cmDone if %errorlevel% neq 0 goto :VCEnd</Command> <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:/Esenthel/ThirdPartyLibs/JpegTurbo/lib/CMakeLists.txt;C:\Esenthel\ThirdPartyLibs\JpegTurbo\lib\CMakeLists.txt;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeDetermineSystem.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeSystem.cmake.in;C:\Esenthel\ThirdPartyLibs\JpegTurbo\Windows32\CMakeFiles\3.3.1\CMakeSystem.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeSystemSpecificInitialize.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeDetermineCCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeDetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeDetermineCompilerId.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeCompilerIdDetection.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeParseArguments.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\ADSP-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\AppleClang-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\Clang-DetermineCompilerInternal.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\Borland-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\Clang-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\Clang-DetermineCompilerInternal.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\Compaq-C-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\Cray-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\Embarcadero-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\Fujitsu-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\GHS-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\GNU-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\HP-C-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\IAR-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\Intel-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\MIPSpro-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\MSVC-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\OpenWatcom-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\PathScale-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\PGI-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\SCO-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\SDCC-C-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\SunPro-C-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\TI-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\TinyCC-C-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\VisualAge-C-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\IBMCPP-C-DetermineVersionInternal.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\Watcom-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\XL-C-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\IBMCPP-C-DetermineVersionInternal.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\zOS-C-DetermineCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Compiler\IBMCPP-C-DetermineVersionInternal.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CompilerId\VS-10.vcxproj.in;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeFindBinUtils.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeClDeps.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeCCompiler.cmake.in;C:\Esenthel\ThirdPartyLibs\JpegTurbo\Windows32\CMakeFiles\3.3.1\CMakeCCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeSystemSpecificInformation.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeGenericSystem.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Platform\Windows.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Platform\WindowsPaths.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeCInformation.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Platform\Windows-MSVC-C.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\Platform\Windows-MSVC.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeDetermineRCCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeRCCompiler.cmake.in;C:\Esenthel\ThirdPartyLibs\JpegTurbo\Windows32\CMakeFiles\3.3.1\CMakeRCCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeRCInformation.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeTestRCCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeCommonLanguageInclude.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeTestCCompiler.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeTestCompilerCommon.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeDetermineCompilerABI.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeParseImplicitLinkInfo.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeCCompilerABI.c;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeDetermineCompileFeatures.cmake;C:\Program Files (x86)\CMake\share\cmake-3.3\Modules\CMakeCCompiler.cmake.in;C:\Esenthel\ThirdPartyLibs\JpegTurbo\Windows32\CMakeFiles\3.3.1\CMakeCCompiler.cmake;C:\Esenthel\ThirdPartyLibs\JpegTurbo\lib\win\jconfig.h.in;C:\Esenthel\ThirdPartyLibs\JpegTurbo\lib\win\jconfigint.h.in;C:\Esenthel\ThirdPartyLibs\JpegTurbo\lib\release\libjpeg-turbo.nsi.in;C:\Esenthel\ThirdPartyLibs\JpegTurbo\lib\CMakeLists.txt;%(AdditionalInputs)</AdditionalInputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Esenthel\ThirdPartyLibs\JpegTurbo\Windows32\CMakeFiles\generate.stamp</Outputs> <LinkObjects Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkObjects> </CustomBuild> </ItemGroup> <ItemGroup> <ClCompile Include="C:\Esenthel\ThirdPartyLibs\JpegTurbo\lib\rdjpgcom.c" /> </ItemGroup> <ItemGroup> <ProjectReference Include="C:/Esenthel/ThirdPartyLibs/JpegTurbo/Windows32/ZERO_CHECK.vcxproj"> <Project>587E5B54-BB39-4360-AD84-20B5A83F62AD</Project> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> </Project>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="theme-color" content="#000000" /> <meta name="description" content="Web site created using create-react-app" /> <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> <!-- manifest.json provides metadata used when your web app is installed on a user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ --> <link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> <!-- Notice the use of %PUBLIC_URL% in the tags above. It will be replaced with the URL of the `public` folder during the build. Only files inside the `public` folder can be referenced from the HTML. Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> <title>React Spinner</title> </head> <body> <noscript>You need to enable JavaScript to run this app.</noscript> <div id="root"></div> <!-- This HTML file is a template. If you open it directly in the browser, you will see an empty page. You can add webfonts, meta tags, or analytics to this file. The build step will place the bundled scripts into the <body> tag. To begin the development, run `npm start` or `yarn start`. To create a production bundle, use `npm run build` or `yarn build`. --> </body> </html>
{ "pile_set_name": "Github" }
crlf crlf lf crlf crlf
{ "pile_set_name": "Github" }
{ "name": "data-generator", "version": "0.1.0", "description": "Demonstrates how to use basic dataset API, including fitting a model", "main": "index.js", "license": "Apache-2.0", "dependencies": { "@babel/plugin-transform-runtime": "^7.2.0", "@tensorflow/tfjs": "^1.3.2", "@tensorflow/tfjs-vis": "^1.0.3" }, "scripts": { "link-local": "yalc link", "watch": "cross-env NODE_ENV=development parcel index.html --no-hmr --open", "build": "cross-env NODE_ENV=production parcel build index.html --no-minify --public-url ./" }, "devDependencies": { "babel-core": "^6.26.3", "babel-plugin-transform-runtime": "^6.23.0", "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.7.0", "clang-format": "^1.2.4", "cross-env": "^5.2.0", "parcel-bundler": "^1.11.0", "ts-node": "^7.0.1", "tslint": "^5.12.0", "typescript": "^3.2.2", "yalc": "^1.0.0-pre.27" } }
{ "pile_set_name": "Github" }
{ "created_at": "2015-02-27T22:28:57.552454", "description": "File/Directory Generator inspired by rails generators", "fork": false, "full_name": "lightsofapollo/file-generator", "language": "JavaScript", "updated_at": "2015-02-27T23:43:41.803770" }
{ "pile_set_name": "Github" }
/* * Copyright 2000-2016 JetBrains s.r.o. * * 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.intellij.openapi.fileEditor.impl; import com.intellij.ide.highlighter.HighlighterFactory; import consulo.disposer.Disposable; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.fileEditor.ex.FileEditorWithProvider; import consulo.logging.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.LogicalPosition; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.highlighter.EditorHighlighter; import com.intellij.openapi.fileEditor.*; import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; import com.intellij.openapi.fileEditor.impl.text.TextEditorPsiDataProvider; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.project.ProjectManagerAdapter; import com.intellij.openapi.util.*; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; import com.intellij.testFramework.LightVirtualFile; import com.intellij.util.IncorrectOperationException; import com.intellij.util.containers.HashMap; import consulo.fileEditor.impl.EditorComposite; import consulo.fileEditor.impl.EditorWindow; import consulo.fileEditor.impl.EditorsSplitters; import consulo.fileEditor.impl.text.TextEditorProvider; import consulo.ui.annotation.RequiredUIAccess; import consulo.ui.UIAccess; import org.jdom.Element; import javax.annotation.Nonnull; import javax.swing.*; import java.awt.*; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.Map; final class TestEditorManagerImpl extends FileEditorManagerEx implements Disposable { private static final Logger LOG = Logger.getInstance(TestEditorManagerImpl.class); private final TestEditorSplitter myTestEditorSplitter = new TestEditorSplitter(); private final Project myProject; private int counter = 0; private final Map<VirtualFile, Editor> myVirtualFile2Editor = new HashMap<>(); private VirtualFile myActiveFile; private static final LightVirtualFile LIGHT_VIRTUAL_FILE = new LightVirtualFile("Dummy.java"); public TestEditorManagerImpl(@Nonnull Project project) { myProject = project; registerExtraEditorDataProvider(new TextEditorPsiDataProvider(), null); project.getMessageBus().connect().subscribe(ProjectManager.TOPIC, new ProjectManagerAdapter() { @Override public void projectClosed(Project project, UIAccess uiAccess) { if (project == myProject) { closeAllFiles(); } } }); } @Override @Nonnull public Pair<FileEditor[], FileEditorProvider[]> openFileWithProviders(@Nonnull final VirtualFile file, final boolean focusEditor, boolean searchForSplitter) { final Ref<Pair<FileEditor[], FileEditorProvider[]>> result = new Ref<>(); CommandProcessor.getInstance().executeCommand(myProject, () -> result.set(openFileImpl3(file, focusEditor)), "", null); return result.get(); } private Pair<FileEditor[], FileEditorProvider[]> openFileImpl3(final VirtualFile file, boolean focusEditor) { // for non-text editors. uml, etc final FileEditorProvider provider = file.getUserData(FileEditorProvider.KEY); if (provider != null && provider.accept(getProject(), file)) { return Pair.create(new FileEditor[]{provider.createEditor(getProject(), file)}, new FileEditorProvider[]{provider}); } //text editor Editor editor = openTextEditor(new OpenFileDescriptor(myProject, file), focusEditor); assert editor != null; final FileEditor fileEditor = TextEditorProvider.getInstance().getTextEditor(editor); final FileEditorProvider fileEditorProvider = getProvider(); Pair<FileEditor[], FileEditorProvider[]> result = Pair.create(new FileEditor[]{fileEditor}, new FileEditorProvider[]{fileEditorProvider}); modifyTabWell(new Runnable() { @Override public void run() { myTestEditorSplitter.openAndFocusTab(file, fileEditor, fileEditorProvider); } }); return result; } private void modifyTabWell(Runnable tabWellModification) { FileEditor lastFocusedEditor = myTestEditorSplitter.getFocusedFileEditor(); VirtualFile lastFocusedFile = myTestEditorSplitter.getFocusedFile(); FileEditorProvider oldProvider = myTestEditorSplitter.getProviderFromFocused(); tabWellModification.run(); FileEditor currentlyFocusedEditor = myTestEditorSplitter.getFocusedFileEditor(); VirtualFile currentlyFocusedFile = myTestEditorSplitter.getFocusedFile(); FileEditorProvider newProvider = myTestEditorSplitter.getProviderFromFocused(); final FileEditorManagerEvent event = new FileEditorManagerEvent(this, lastFocusedFile, lastFocusedEditor, oldProvider, currentlyFocusedFile, currentlyFocusedEditor, newProvider); final FileEditorManagerListener publisher = getProject().getMessageBus().syncPublisher(FileEditorManagerListener.FILE_EDITOR_MANAGER); notifyPublisher(new Runnable() { @Override public void run() { publisher.selectionChanged(event); } }); } @RequiredUIAccess @Nonnull @Override public Pair<FileEditor[], FileEditorProvider[]> openFileWithProviders(@Nonnull VirtualFile file, boolean focusEditor, @Nonnull EditorWindow window) { return openFileWithProviders(file, focusEditor, false); } @Override public boolean isInsideChange() { return false; } @Nonnull @Override public ActionCallback notifyPublisher(@Nonnull Runnable runnable) { runnable.run(); return ActionCallback.DONE; } @Override public EditorsSplitters getSplittersFor(Component c) { return null; } @Override public void createSplitter(int orientation, EditorWindow window) { String containerName = createNewTabbedContainerName(); myTestEditorSplitter.setActiveTabGroup(containerName); } private String createNewTabbedContainerName() { counter++; return "SplitTabContainer" + ((Object) counter).toString(); } @Override public void changeSplitterOrientation() { } @Override public void flipTabs() { } @Override public boolean tabsMode() { return false; } @Override public boolean isInSplitter() { return false; } @Override public boolean hasOpenedFile() { return false; } @Override public VirtualFile getCurrentFile() { return myActiveFile; } @Override public FileEditorWithProvider getSelectedEditorWithProvider(@Nonnull VirtualFile file) { return null; } @Override public boolean isChanged(@Nonnull EditorComposite editor) { return false; } @Override public EditorWindow getNextWindow(@Nonnull EditorWindow window) { return null; } @Override public EditorWindow getPrevWindow(@Nonnull EditorWindow window) { return null; } @Override public void addTopComponent(@Nonnull final FileEditor editor, @Nonnull final JComponent component) { } @Override public void removeTopComponent(@Nonnull final FileEditor editor, @Nonnull final JComponent component) { } @Override public void addBottomComponent(@Nonnull final FileEditor editor, @Nonnull final JComponent component) { } @Override public void removeBottomComponent(@Nonnull final FileEditor editor, @Nonnull final JComponent component) { } @Override public void closeAllFiles() { for (VirtualFile file : new LinkedList<VirtualFile>(myVirtualFile2Editor.keySet())) { closeFile(file); } } private static FileEditorProvider getProvider() { return new FileEditorProvider() { @Override public boolean accept(@Nonnull Project project, @Nonnull VirtualFile file) { return false; } @Override @Nonnull public FileEditor createEditor(@Nonnull Project project, @Nonnull VirtualFile file) { throw new IncorrectOperationException(); } @Override public void disposeEditor(@Nonnull FileEditor editor) { } @Override @Nonnull public FileEditorState readState(@Nonnull Element sourceElement, @Nonnull Project project, @Nonnull VirtualFile file) { throw new IncorrectOperationException(); } @Override @Nonnull public String getEditorTypeId() { return ""; } @Override @Nonnull public FileEditorPolicy getPolicy() { throw new IncorrectOperationException(); } }; } @Override public EditorWindow getCurrentWindow() { return null; } @Nonnull @Override public AsyncResult<EditorWindow> getActiveWindow() { return AsyncResult.done(null); } @Override public void setCurrentWindow(EditorWindow window) { } @Override public VirtualFile getFile(@Nonnull FileEditor editor) { return LIGHT_VIRTUAL_FILE; } @Override public void updateFilePresentation(@Nonnull VirtualFile file) { } @Override public void unsplitWindow() { } @Override public void unsplitAllWindow() { } @Override @Nonnull public EditorWindow[] getWindows() { return new EditorWindow[0]; //To change body of implemented methods use File | Settings | File Templates. } @Override public FileEditor getSelectedEditor(@Nonnull VirtualFile file) { final Editor editor = getEditor(file); return editor == null ? null : TextEditorProvider.getInstance().getTextEditor(editor); } @Override public boolean isFileOpen(@Nonnull VirtualFile file) { return getEditor(file) != null; } @Override @Nonnull public FileEditor[] getEditors(@Nonnull VirtualFile file) { FileEditor e = getSelectedEditor(file); if (e == null) return new FileEditor[0]; return new FileEditor[] {e}; } @Nonnull @Override public FileEditor[] getAllEditors(@Nonnull VirtualFile file) { return getEditors(file); } @Override @Nonnull public VirtualFile[] getSiblings(@Nonnull VirtualFile file) { throw new UnsupportedOperationException(); } @Override public void dispose() { closeAllFiles(); } @Override public void closeFile(@Nonnull final VirtualFile file) { Editor editor = myVirtualFile2Editor.remove(file); if (editor != null){ TextEditorProvider editorProvider = TextEditorProvider.getInstance(); editorProvider.disposeEditor(editorProvider.getTextEditor(editor)); EditorFactory.getInstance().releaseEditor(editor); } if (Comparing.equal(file, myActiveFile)) { myActiveFile = null; } modifyTabWell(new Runnable() { @Override public void run() { myTestEditorSplitter.closeFile(file); } }); } @Override public void closeFile(@Nonnull VirtualFile file, @Nonnull EditorWindow window) { closeFile(file); } @Override @Nonnull public VirtualFile[] getSelectedFiles() { return myActiveFile == null ? VirtualFile.EMPTY_ARRAY : new VirtualFile[]{myActiveFile}; } @Override @Nonnull public FileEditor[] getSelectedEditors() { return new FileEditor[0]; } @Override public Editor getSelectedTextEditor() { return myActiveFile != null ? getEditor(myActiveFile) : null; } @Nonnull @Override public JComponent getComponent() { return new JLabel(); } @Override @Nonnull public VirtualFile[] getOpenFiles() { return VfsUtilCore.toVirtualFileArray(myVirtualFile2Editor.keySet()); } public Editor getEditor(VirtualFile file) { return myVirtualFile2Editor.get(file); } @Override @Nonnull public FileEditor[] getAllEditors() { FileEditor[] result = new FileEditor[myVirtualFile2Editor.size()]; int i = 0; for (Map.Entry<VirtualFile, Editor> entry : myVirtualFile2Editor.entrySet()) { TextEditor textEditor = TextEditorProvider.getInstance().getTextEditor(entry.getValue()); result[i++] = textEditor; } return result; } @Override public void showEditorAnnotation(@Nonnull FileEditor editor, @Nonnull JComponent annotationComponent) { } @Override public void removeEditorAnnotation(@Nonnull FileEditor editor, @Nonnull JComponent annotationComponent) { } @Override public Editor openTextEditor(@Nonnull OpenFileDescriptor descriptor, boolean focusEditor) { final VirtualFile file = descriptor.getFile(); Editor editor = myVirtualFile2Editor.get(file); if (editor == null) { PsiFile psiFile = PsiManager.getInstance(myProject).findFile(file); LOG.assertTrue(psiFile != null, file); Document document = PsiDocumentManager.getInstance(myProject).getDocument(psiFile); LOG.assertTrue(document != null, psiFile); editor = EditorFactory.getInstance().createEditor(document, myProject); final EditorHighlighter highlighter = HighlighterFactory.createHighlighter(myProject, file); ((EditorEx) editor).setHighlighter(highlighter); ((EditorEx) editor).setFile(file); myVirtualFile2Editor.put(file, editor); } if (descriptor.getOffset() >= 0){ editor.getCaretModel().moveToOffset(descriptor.getOffset()); } else if (descriptor.getLine() >= 0 && descriptor.getColumn() >= 0){ editor.getCaretModel().moveToLogicalPosition(new LogicalPosition(descriptor.getLine(), descriptor.getColumn())); } editor.getSelectionModel().removeSelection(); myActiveFile = file; return editor; } @Override public void addFileEditorManagerListener(@Nonnull FileEditorManagerListener listener) { } @Override public void addFileEditorManagerListener(@Nonnull FileEditorManagerListener listener, @Nonnull Disposable parentDisposable) { } @Override public void removeFileEditorManagerListener(@Nonnull FileEditorManagerListener listener) { } @Override @Nonnull public List<FileEditor> openEditor(@Nonnull OpenFileDescriptor descriptor, boolean focusEditor) { return Collections.emptyList(); } @Override @Nonnull public Project getProject() { return myProject; } @Override public JComponent getPreferredFocusedComponent() { throw new UnsupportedOperationException(); } @Override @Nonnull public Pair<FileEditor[], FileEditorProvider[]> getEditorsWithProviders(@Nonnull VirtualFile file) { Pair<FileEditor, FileEditorProvider> editorAndProvider = myTestEditorSplitter.getEditorAndProvider(file); FileEditor[] fileEditor = new FileEditor[0]; FileEditorProvider[] fileEditorProvider= new FileEditorProvider[0]; if (editorAndProvider != null) { fileEditor = new FileEditor[] {editorAndProvider.first}; fileEditorProvider = new FileEditorProvider[]{editorAndProvider.second}; } return Pair.create(fileEditor, fileEditorProvider); } @Override public int getWindowSplitCount() { return 0; } @Override public boolean hasSplitOrUndockedWindows() { return false; } @Nonnull @Override public EditorsSplitters getSplitters() { throw new IncorrectOperationException(); } @Nonnull @Override public AsyncResult<Void> getReady(@Nonnull Object requestor) { return AsyncResult.resolved(); } @Override public void setSelectedEditor(@Nonnull VirtualFile file, @Nonnull String fileEditorProviderId) { } }
{ "pile_set_name": "Github" }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("ModalNavigation.UWP")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ModalNavigation.UWP")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ComVisible(false)]
{ "pile_set_name": "Github" }
# -*- coding: utf-8; mode: snippet -*- # name: if(boolean-condition-from-kill-ring) { debugger; } # key: d # contributor: Chen Bin <chenbin DOT sh AT gmail> # -- if(${1:`(car kill-ring)`}) { console.clear(); debugger; }
{ "pile_set_name": "Github" }
![logo](indy-logo.png) * [Plenum Byzantine Fault Tolerant Protocol](#plenum-byzantine-fault-tolerant-protocol) * [Technical Overview of Indy Plenum](#technical-overview-of-indy-plenum) * [Other Documentation](#other-documentation) * [Indy Plenum Repository Structure](#indy-plenum-repository-structure) * [Dependencies](#dependencies) * [Contact Us](#contact-us) * [How to Contribute](#how-to-contribute) * [How to Start Working with the Code](#how-to-start-working-with-the-code) * [Try Plenum Locally](#try-plenum-locally) ## Plenum Byzantine Fault Tolerant Protocol Plenum is the heart of the distributed ledger technology inside Hyperledger Indy. As such, it provides features somewhat similar in scope to those found in Fabric. However, it is special-purposed for use in an identity system, whereas Fabric is general purpose. ## Technical Overview of Indy Plenum Refer to our documentation site at [indy.readthedocs.io](https://hyperledger-indy.readthedocs.io/projects/plenum/en/latest/index.html) for the most current documentation and walkthroughs. Please find the general overview of the system in [Overview of the system](docs/source/main.md). Plenum's consensus protocol which is based on [RBFT](https://pakupaku.me/plaublin/rbft/5000a297.pdf) is described in [consensus protocol diagram](docs/source/diagrams/consensus-protocol.png). More documentation can be found in [docs](docs). ## Other Documentation - Please have a look at aggregated documentation at [indy-node-documentation](https://github.com/hyperledger/indy-node/blob/master/README.md) which describes workflows and setup scripts common for both projects. ## Indy Plenum Repository Structure - plenum: - the main codebase for plenum including Byzantine Fault Tolerant Protocol based on [RBFT](https://pakupaku.me/plaublin/rbft/5000a297.pdf) - common: - common and utility code - crypto: - basic crypto-related code (in particular, [indy-crypto](https://github.com/hyperledger/indy-crypto) wrappers) - ledger: - Provides a simple, python-based, immutable, ordered log of transactions backed by a merkle tree. - This is an efficient way to generate verifiable proofs of presence and data consistency. - The scope of concerns here is fairly narrow; it is not a full-blown distributed ledger technology like Fabric, but simply the persistence mechanism that Plenum needs. - state: - state storage using python 3 version of Ethereum's Patricia Trie - stp: - secure transport abstraction - it has [ZeroMQ](http://zeromq.org/) implementations - storage: - key-value storage abstractions - contains [leveldb](http://leveldb.org/) implementation as the main key-valued storage used in Plenum (for ledger, state, etc.) ## Dependencies - Plenum makes extensive use of coroutines and the async/await keywords in Python, and as such, requires Python version 3.5.0 or later. - Plenum also depends on [libsodium](https://download.libsodium.org/doc/), an awesome crypto library. These need to be installed separately. - Plenum uses [ZeroMQ](http://zeromq.org/) as a secure transport - [indy-crypto](https://github.com/hyperledger/indy-crypto) - A shared crypto library - It's based on [AMCL](https://github.com/milagro-crypto/amcl) - In particular, it contains BLS multi-signature crypto needed for state proofs support in Indy. ## Contact Us - Bugs, stories, and backlog for this codebase are managed in [Hyperledger's Jira](https://jira.hyperledger.org). Use project name `INDY`. - Join us on [Jira's Rocket.Chat](https://chat.hyperledger.org/channel/indy) at `#indy` and/or `#indy-node` channels to discuss. ## How to Contribute - We'd love your help; see these [instructions on how to contribute](https://wiki.hyperledger.org/display/indy/How+to+Contribute). - You may also want to read this info about [maintainers](https://github.com/hyperledger/indy-node/blob/stable/MAINTAINERS.md). ## How to Start Working with the Code Please have a look at [Dev Setup](https://github.com/hyperledger/indy-node/blob/master/docs/setup-dev.md) in indy-node repo. It contains common setup for both indy-plenum and indy-node.
{ "pile_set_name": "Github" }
<!-- HTML header for doxygen 1.8.3.1--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.3.1"/> <title>AngelScript: Deprecated List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <script type="test/javascript" src="touch.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); $(window).load(resizeHeight); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="aslogo_small.png"/></td> <td style="padding-left: 0.5em;"> <div id="projectname">AngelScript </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.3.1 --> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('deprecated.html','');}); </script> <div id="doc-content"> <div class="header"> <div class="headertitle"> <div class="title">Deprecated List </div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><dl class="reflist"> <dt><a class="anchor" id="_deprecated000001"></a>Member <a class="el" href="classas_i_script_function.html#af75544f2e9216b5ee611cefe4cfa7672">asIScriptFunction::GetParamTypeId</a> (asUINT index, asDWORD *flags=0) const =0</dt> <dd>Since 2.29.0. Use <a class="el" href="classas_i_script_function.html#a2b3000b9fc5d3f2cfeea490d8c0c062a">asIScriptFunction::GetParam</a> instead. </dd> </dl> </div></div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="footer">Generated on Tue Oct 21 2014 22:29:17 for AngelScript by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.3.1 </li> </ul> </div> </body> </html>
{ "pile_set_name": "Github" }
// Copyright 2015 CoreOS, 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. package initialize import ( "fmt" "github.com/coreos/coreos-cloudinit/system" ) func SSHImportGithubUser(system_user string, github_user string) error { url := fmt.Sprintf("https://api.github.com/users/%s/keys", github_user) keys, err := fetchUserKeys(url) if err != nil { return err } key_name := fmt.Sprintf("github-%s", github_user) return system.AuthorizeSSHKeys(system_user, key_name, keys) }
{ "pile_set_name": "Github" }
package org.openrndr.math import org.amshove.kluent.`should be in range` import org.amshove.kluent.`should equal` import org.spekframework.spek2.Spek import org.spekframework.spek2.style.specification.describe object TestQuaternion : Spek({ describe("a quaternion") { it("IDENTITY times IDENTITY should result in IDENTITY") { val q0 = Quaternion.IDENTITY val q1 = Quaternion.IDENTITY val qm = q0 * q1 qm.x `should equal` 0.0 qm.y `should equal` 0.0 qm.z `should equal` 0.0 qm.w `should equal` 1.0 } it ("matrix to quaternion to matrix") { val q0 = Quaternion.fromMatrix(Matrix33.IDENTITY) val m0 = q0.matrix m0 `should equal` Matrix33.IDENTITY } it ("quaternion look +Z") { val q0 = Quaternion.fromLookAt(Vector3.ZERO, Vector3(0.0, 0.0, 1.0), Vector3.UNIT_Y) val v0 = q0 * Vector3.UNIT_Z v0.x.`should be in range` (-0.0001, 0.0001) v0.y.`should be in range` (-0.0001, 0.0001) v0.z.`should be in range` (1-0.0001,1+ 0.0001) } it ("quaternion look -Z") { val q0 = Quaternion.fromLookAt(Vector3.ZERO, Vector3(0.0, 0.0, -1.0), Vector3.UNIT_Y) val v0 = q0 * Vector3.UNIT_Z v0.x.`should be in range` (-0.0001, 0.0001) v0.y.`should be in range` (-0.0001, 0.0001) v0.z.`should be in range` (-1-0.0001,-1+ 0.0001) } it ("quaternion look +X") { val q0 = Quaternion.fromLookAt(Vector3.ZERO, Vector3(1.0, 0.0, 0.0), Vector3.UNIT_Y) val v0 = q0 * Vector3.UNIT_Z v0.x.`should be in range` (1-0.0001,1+ 0.0001) v0.y.`should be in range` (-0.0001, 0.0001) v0.z.`should be in range` (-0.0001, 0.0001) } it ("quaternion look -X") { val q0 = Quaternion.fromLookAt(Vector3.ZERO, Vector3(-1.0, 0.0, 0.0), Vector3.UNIT_Y) val v0 = q0 * Vector3.UNIT_Z v0.x.`should be in range` (-1-0.0001,-1+ 0.0001) v0.y.`should be in range` (-0.0001, 0.0001) v0.z.`should be in range` (-0.0001, 0.0001) } it("quaternion.identity * vector3") { Quaternion.IDENTITY * Vector3.UNIT_X `should equal` Vector3.UNIT_X Quaternion.IDENTITY * Vector3.UNIT_Y `should equal` Vector3.UNIT_Y Quaternion.IDENTITY * Vector3.UNIT_Z `should equal` Vector3.UNIT_Z } } })
{ "pile_set_name": "Github" }
package dev.lucasnlm.antimine.common.level.database.models import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.PrimaryKey @Entity data class Stats( @PrimaryKey(autoGenerate = true) val uid: Int, @ColumnInfo(name = "duration") val duration: Long, @ColumnInfo(name = "mines") val mines: Int, @ColumnInfo(name = "victory") val victory: Int, @ColumnInfo(name = "width") val width: Int, @ColumnInfo(name = "height") val height: Int, @ColumnInfo(name = "openArea") val openArea: Int, )
{ "pile_set_name": "Github" }
test Label : GLOBAL 5 Label : DEFINITION 5 Label : DEFINITION 5 Label : PROJECT 1 Label : DEFINITION 5 Label : DEFINITION 5 Label : FILE 3 Label : EXPRESSION 4 Label : CODE 3 Label : EXPRESSION 7 Label : LEFT 5 Label : RIGHT 8 Label : ARGUMENT 10 Label : INDEX 9 Label : VALUE 11
{ "pile_set_name": "Github" }
/* * /MathJax/jax/output/HTML-CSS/fonts/STIX/General/Regular/SupplementalArrowsA.js * * Copyright (c) 2009-2018 The MathJax Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ MathJax.Hub.Insert(MathJax.OutputJax["HTML-CSS"].FONTDATA.FONTS.STIXGeneral,{10224:[662,156,1033,69,965],10225:[662,156,1033,69,965],10226:[626,116,974,54,882],10227:[626,116,974,92,920],10228:[569,61,1200,52,1147],10237:[551,45,1574,55,1519],10238:[551,45,1574,55,1519],10239:[449,-58,1574,55,1519]});MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir+"/General/Regular/SupplementalArrowsA.js");
{ "pile_set_name": "Github" }
// mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. // +build amd64,darwin // Created by cgo -godefs - DO NOT EDIT // cgo -godefs -- -m64 _const.go package unix import "syscall" const ( AF_APPLETALK = 0x10 AF_CCITT = 0xa AF_CHAOS = 0x5 AF_CNT = 0x15 AF_COIP = 0x14 AF_DATAKIT = 0x9 AF_DECnet = 0xc AF_DLI = 0xd AF_E164 = 0x1c AF_ECMA = 0x8 AF_HYLINK = 0xf AF_IEEE80211 = 0x25 AF_IMPLINK = 0x3 AF_INET = 0x2 AF_INET6 = 0x1e AF_IPX = 0x17 AF_ISDN = 0x1c AF_ISO = 0x7 AF_LAT = 0xe AF_LINK = 0x12 AF_LOCAL = 0x1 AF_MAX = 0x28 AF_NATM = 0x1f AF_NDRV = 0x1b AF_NETBIOS = 0x21 AF_NS = 0x6 AF_OSI = 0x7 AF_PPP = 0x22 AF_PUP = 0x4 AF_RESERVED_36 = 0x24 AF_ROUTE = 0x11 AF_SIP = 0x18 AF_SNA = 0xb AF_SYSTEM = 0x20 AF_UNIX = 0x1 AF_UNSPEC = 0x0 AF_UTUN = 0x26 ALTWERASE = 0x200 ATTR_BIT_MAP_COUNT = 0x5 ATTR_CMN_ACCESSMASK = 0x20000 ATTR_CMN_ACCTIME = 0x1000 ATTR_CMN_ADDEDTIME = 0x10000000 ATTR_CMN_BKUPTIME = 0x2000 ATTR_CMN_CHGTIME = 0x800 ATTR_CMN_CRTIME = 0x200 ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 ATTR_CMN_DEVID = 0x2 ATTR_CMN_DOCUMENT_ID = 0x100000 ATTR_CMN_ERROR = 0x20000000 ATTR_CMN_EXTENDED_SECURITY = 0x400000 ATTR_CMN_FILEID = 0x2000000 ATTR_CMN_FLAGS = 0x40000 ATTR_CMN_FNDRINFO = 0x4000 ATTR_CMN_FSID = 0x4 ATTR_CMN_FULLPATH = 0x8000000 ATTR_CMN_GEN_COUNT = 0x80000 ATTR_CMN_GRPID = 0x10000 ATTR_CMN_GRPUUID = 0x1000000 ATTR_CMN_MODTIME = 0x400 ATTR_CMN_NAME = 0x1 ATTR_CMN_NAMEDATTRCOUNT = 0x80000 ATTR_CMN_NAMEDATTRLIST = 0x100000 ATTR_CMN_OBJID = 0x20 ATTR_CMN_OBJPERMANENTID = 0x40 ATTR_CMN_OBJTAG = 0x10 ATTR_CMN_OBJTYPE = 0x8 ATTR_CMN_OWNERID = 0x8000 ATTR_CMN_PARENTID = 0x4000000 ATTR_CMN_PAROBJID = 0x80 ATTR_CMN_RETURNED_ATTRS = 0x80000000 ATTR_CMN_SCRIPT = 0x100 ATTR_CMN_SETMASK = 0x41c7ff00 ATTR_CMN_USERACCESS = 0x200000 ATTR_CMN_UUID = 0x800000 ATTR_CMN_VALIDMASK = 0xffffffff ATTR_CMN_VOLSETMASK = 0x6700 ATTR_FILE_ALLOCSIZE = 0x4 ATTR_FILE_CLUMPSIZE = 0x10 ATTR_FILE_DATAALLOCSIZE = 0x400 ATTR_FILE_DATAEXTENTS = 0x800 ATTR_FILE_DATALENGTH = 0x200 ATTR_FILE_DEVTYPE = 0x20 ATTR_FILE_FILETYPE = 0x40 ATTR_FILE_FORKCOUNT = 0x80 ATTR_FILE_FORKLIST = 0x100 ATTR_FILE_IOBLOCKSIZE = 0x8 ATTR_FILE_LINKCOUNT = 0x1 ATTR_FILE_RSRCALLOCSIZE = 0x2000 ATTR_FILE_RSRCEXTENTS = 0x4000 ATTR_FILE_RSRCLENGTH = 0x1000 ATTR_FILE_SETMASK = 0x20 ATTR_FILE_TOTALSIZE = 0x2 ATTR_FILE_VALIDMASK = 0x37ff ATTR_VOL_ALLOCATIONCLUMP = 0x40 ATTR_VOL_ATTRIBUTES = 0x40000000 ATTR_VOL_CAPABILITIES = 0x20000 ATTR_VOL_DIRCOUNT = 0x400 ATTR_VOL_ENCODINGSUSED = 0x10000 ATTR_VOL_FILECOUNT = 0x200 ATTR_VOL_FSTYPE = 0x1 ATTR_VOL_INFO = 0x80000000 ATTR_VOL_IOBLOCKSIZE = 0x80 ATTR_VOL_MAXOBJCOUNT = 0x800 ATTR_VOL_MINALLOCATION = 0x20 ATTR_VOL_MOUNTEDDEVICE = 0x8000 ATTR_VOL_MOUNTFLAGS = 0x4000 ATTR_VOL_MOUNTPOINT = 0x1000 ATTR_VOL_NAME = 0x2000 ATTR_VOL_OBJCOUNT = 0x100 ATTR_VOL_QUOTA_SIZE = 0x10000000 ATTR_VOL_RESERVED_SIZE = 0x20000000 ATTR_VOL_SETMASK = 0x80002000 ATTR_VOL_SIGNATURE = 0x2 ATTR_VOL_SIZE = 0x4 ATTR_VOL_SPACEAVAIL = 0x10 ATTR_VOL_SPACEFREE = 0x8 ATTR_VOL_UUID = 0x40000 ATTR_VOL_VALIDMASK = 0xf007ffff B0 = 0x0 B110 = 0x6e B115200 = 0x1c200 B1200 = 0x4b0 B134 = 0x86 B14400 = 0x3840 B150 = 0x96 B1800 = 0x708 B19200 = 0x4b00 B200 = 0xc8 B230400 = 0x38400 B2400 = 0x960 B28800 = 0x7080 B300 = 0x12c B38400 = 0x9600 B4800 = 0x12c0 B50 = 0x32 B57600 = 0xe100 B600 = 0x258 B7200 = 0x1c20 B75 = 0x4b B76800 = 0x12c00 B9600 = 0x2580 BIOCFLUSH = 0x20004268 BIOCGBLEN = 0x40044266 BIOCGDLT = 0x4004426a BIOCGDLTLIST = 0xc00c4279 BIOCGETIF = 0x4020426b BIOCGHDRCMPLT = 0x40044274 BIOCGRSIG = 0x40044272 BIOCGRTIMEOUT = 0x4010426e BIOCGSEESENT = 0x40044276 BIOCGSTATS = 0x4008426f BIOCIMMEDIATE = 0x80044270 BIOCPROMISC = 0x20004269 BIOCSBLEN = 0xc0044266 BIOCSDLT = 0x80044278 BIOCSETF = 0x80104267 BIOCSETFNR = 0x8010427e BIOCSETIF = 0x8020426c BIOCSHDRCMPLT = 0x80044275 BIOCSRSIG = 0x80044273 BIOCSRTIMEOUT = 0x8010426d BIOCSSEESENT = 0x80044277 BIOCVERSION = 0x40044271 BPF_A = 0x10 BPF_ABS = 0x20 BPF_ADD = 0x0 BPF_ALIGNMENT = 0x4 BPF_ALU = 0x4 BPF_AND = 0x50 BPF_B = 0x10 BPF_DIV = 0x30 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 BPF_JA = 0x0 BPF_JEQ = 0x10 BPF_JGE = 0x30 BPF_JGT = 0x20 BPF_JMP = 0x5 BPF_JSET = 0x40 BPF_K = 0x0 BPF_LD = 0x0 BPF_LDX = 0x1 BPF_LEN = 0x80 BPF_LSH = 0x60 BPF_MAJOR_VERSION = 0x1 BPF_MAXBUFSIZE = 0x80000 BPF_MAXINSNS = 0x200 BPF_MEM = 0x60 BPF_MEMWORDS = 0x10 BPF_MINBUFSIZE = 0x20 BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 BPF_OR = 0x40 BPF_RELEASE = 0x30bb6 BPF_RET = 0x6 BPF_RSH = 0x70 BPF_ST = 0x2 BPF_STX = 0x3 BPF_SUB = 0x10 BPF_TAX = 0x0 BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 BRKINT = 0x2 BS0 = 0x0 BS1 = 0x8000 BSDLY = 0x8000 CFLUSH = 0xf CLOCAL = 0x8000 CLOCK_MONOTONIC = 0x6 CLOCK_MONOTONIC_RAW = 0x4 CLOCK_MONOTONIC_RAW_APPROX = 0x5 CLOCK_PROCESS_CPUTIME_ID = 0xc CLOCK_REALTIME = 0x0 CLOCK_THREAD_CPUTIME_ID = 0x10 CLOCK_UPTIME_RAW = 0x8 CLOCK_UPTIME_RAW_APPROX = 0x9 CR0 = 0x0 CR1 = 0x1000 CR2 = 0x2000 CR3 = 0x3000 CRDLY = 0x3000 CREAD = 0x800 CRTSCTS = 0x30000 CS5 = 0x0 CS6 = 0x100 CS7 = 0x200 CS8 = 0x300 CSIZE = 0x300 CSTART = 0x11 CSTATUS = 0x14 CSTOP = 0x13 CSTOPB = 0x400 CSUSP = 0x1a CTL_HW = 0x6 CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 DLT_A429 = 0xb8 DLT_A653_ICM = 0xb9 DLT_AIRONET_HEADER = 0x78 DLT_AOS = 0xde DLT_APPLE_IP_OVER_IEEE1394 = 0x8a DLT_ARCNET = 0x7 DLT_ARCNET_LINUX = 0x81 DLT_ATM_CLIP = 0x13 DLT_ATM_RFC1483 = 0xb DLT_AURORA = 0x7e DLT_AX25 = 0x3 DLT_AX25_KISS = 0xca DLT_BACNET_MS_TP = 0xa5 DLT_BLUETOOTH_HCI_H4 = 0xbb DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 DLT_CAN20B = 0xbe DLT_CAN_SOCKETCAN = 0xe3 DLT_CHAOS = 0x5 DLT_CHDLC = 0x68 DLT_CISCO_IOS = 0x76 DLT_C_HDLC = 0x68 DLT_C_HDLC_WITH_DIR = 0xcd DLT_DBUS = 0xe7 DLT_DECT = 0xdd DLT_DOCSIS = 0x8f DLT_DVB_CI = 0xeb DLT_ECONET = 0x73 DLT_EN10MB = 0x1 DLT_EN3MB = 0x2 DLT_ENC = 0x6d DLT_ERF = 0xc5 DLT_ERF_ETH = 0xaf DLT_ERF_POS = 0xb0 DLT_FC_2 = 0xe0 DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 DLT_FDDI = 0xa DLT_FLEXRAY = 0xd2 DLT_FRELAY = 0x6b DLT_FRELAY_WITH_DIR = 0xce DLT_GCOM_SERIAL = 0xad DLT_GCOM_T1E1 = 0xac DLT_GPF_F = 0xab DLT_GPF_T = 0xaa DLT_GPRS_LLC = 0xa9 DLT_GSMTAP_ABIS = 0xda DLT_GSMTAP_UM = 0xd9 DLT_HHDLC = 0x79 DLT_IBM_SN = 0x92 DLT_IBM_SP = 0x91 DLT_IEEE802 = 0x6 DLT_IEEE802_11 = 0x69 DLT_IEEE802_11_RADIO = 0x7f DLT_IEEE802_11_RADIO_AVS = 0xa3 DLT_IEEE802_15_4 = 0xc3 DLT_IEEE802_15_4_LINUX = 0xbf DLT_IEEE802_15_4_NOFCS = 0xe6 DLT_IEEE802_15_4_NONASK_PHY = 0xd7 DLT_IEEE802_16_MAC_CPS = 0xbc DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 DLT_IPFILTER = 0x74 DLT_IPMB = 0xc7 DLT_IPMB_LINUX = 0xd1 DLT_IPNET = 0xe2 DLT_IPOIB = 0xf2 DLT_IPV4 = 0xe4 DLT_IPV6 = 0xe5 DLT_IP_OVER_FC = 0x7a DLT_JUNIPER_ATM1 = 0x89 DLT_JUNIPER_ATM2 = 0x87 DLT_JUNIPER_ATM_CEMIC = 0xee DLT_JUNIPER_CHDLC = 0xb5 DLT_JUNIPER_ES = 0x84 DLT_JUNIPER_ETHER = 0xb2 DLT_JUNIPER_FIBRECHANNEL = 0xea DLT_JUNIPER_FRELAY = 0xb4 DLT_JUNIPER_GGSN = 0x85 DLT_JUNIPER_ISM = 0xc2 DLT_JUNIPER_MFR = 0x86 DLT_JUNIPER_MLFR = 0x83 DLT_JUNIPER_MLPPP = 0x82 DLT_JUNIPER_MONITOR = 0xa4 DLT_JUNIPER_PIC_PEER = 0xae DLT_JUNIPER_PPP = 0xb3 DLT_JUNIPER_PPPOE = 0xa7 DLT_JUNIPER_PPPOE_ATM = 0xa8 DLT_JUNIPER_SERVICES = 0x88 DLT_JUNIPER_SRX_E2E = 0xe9 DLT_JUNIPER_ST = 0xc8 DLT_JUNIPER_VP = 0xb7 DLT_JUNIPER_VS = 0xe8 DLT_LAPB_WITH_DIR = 0xcf DLT_LAPD = 0xcb DLT_LIN = 0xd4 DLT_LINUX_EVDEV = 0xd8 DLT_LINUX_IRDA = 0x90 DLT_LINUX_LAPD = 0xb1 DLT_LINUX_PPP_WITHDIRECTION = 0xa6 DLT_LINUX_SLL = 0x71 DLT_LOOP = 0x6c DLT_LTALK = 0x72 DLT_MATCHING_MAX = 0xf5 DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 DLT_MPEG_2_TS = 0xf3 DLT_MPLS = 0xdb DLT_MTP2 = 0x8c DLT_MTP2_WITH_PHDR = 0x8b DLT_MTP3 = 0x8d DLT_MUX27010 = 0xec DLT_NETANALYZER = 0xf0 DLT_NETANALYZER_TRANSPARENT = 0xf1 DLT_NFC_LLCP = 0xf5 DLT_NFLOG = 0xef DLT_NG40 = 0xf4 DLT_NULL = 0x0 DLT_PCI_EXP = 0x7d DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 DLT_PPI = 0xc0 DLT_PPP = 0x9 DLT_PPP_BSDOS = 0x10 DLT_PPP_ETHER = 0x33 DLT_PPP_PPPD = 0xa6 DLT_PPP_SERIAL = 0x32 DLT_PPP_WITH_DIR = 0xcc DLT_PPP_WITH_DIRECTION = 0xa6 DLT_PRISM_HEADER = 0x77 DLT_PRONET = 0x4 DLT_RAIF1 = 0xc6 DLT_RAW = 0xc DLT_RIO = 0x7c DLT_SCCP = 0x8e DLT_SITA = 0xc4 DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xf DLT_STANAG_5066_D_PDU = 0xed DLT_SUNATM = 0x7b DLT_SYMANTEC_FIREWALL = 0x63 DLT_TZSP = 0x80 DLT_USB = 0xba DLT_USB_LINUX = 0xbd DLT_USB_LINUX_MMAPPED = 0xdc DLT_USER0 = 0x93 DLT_USER1 = 0x94 DLT_USER10 = 0x9d DLT_USER11 = 0x9e DLT_USER12 = 0x9f DLT_USER13 = 0xa0 DLT_USER14 = 0xa1 DLT_USER15 = 0xa2 DLT_USER2 = 0x95 DLT_USER3 = 0x96 DLT_USER4 = 0x97 DLT_USER5 = 0x98 DLT_USER6 = 0x99 DLT_USER7 = 0x9a DLT_USER8 = 0x9b DLT_USER9 = 0x9c DLT_WIHART = 0xdf DLT_X2E_SERIAL = 0xd5 DLT_X2E_XORAYA = 0xd6 DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 DT_FIFO = 0x1 DT_LNK = 0xa DT_REG = 0x8 DT_SOCK = 0xc DT_UNKNOWN = 0x0 DT_WHT = 0xe ECHO = 0x8 ECHOCTL = 0x40 ECHOE = 0x2 ECHOK = 0x4 ECHOKE = 0x1 ECHONL = 0x10 ECHOPRT = 0x20 EVFILT_AIO = -0x3 EVFILT_EXCEPT = -0xf EVFILT_FS = -0x9 EVFILT_MACHPORT = -0x8 EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 EVFILT_SYSCOUNT = 0xf EVFILT_THREADMARKER = 0xf EVFILT_TIMER = -0x7 EVFILT_USER = -0xa EVFILT_VM = -0xc EVFILT_VNODE = -0x4 EVFILT_WRITE = -0x2 EV_ADD = 0x1 EV_CLEAR = 0x20 EV_DELETE = 0x2 EV_DISABLE = 0x8 EV_DISPATCH = 0x80 EV_DISPATCH2 = 0x180 EV_ENABLE = 0x4 EV_EOF = 0x8000 EV_ERROR = 0x4000 EV_FLAG0 = 0x1000 EV_FLAG1 = 0x2000 EV_ONESHOT = 0x10 EV_OOBAND = 0x2000 EV_POLL = 0x1000 EV_RECEIPT = 0x40 EV_SYSFLAGS = 0xf000 EV_UDATA_SPECIFIC = 0x100 EV_VANISHED = 0x200 EXTA = 0x4b00 EXTB = 0x9600 EXTPROC = 0x800 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 FF1 = 0x4000 FFDLY = 0x4000 FLUSHO = 0x800000 FSOPT_ATTR_CMN_EXTENDED = 0x20 FSOPT_NOFOLLOW = 0x1 FSOPT_NOINMEMUPDATE = 0x2 FSOPT_PACK_INVAL_ATTRS = 0x8 FSOPT_REPORT_FULLSIZE = 0x4 F_ADDFILESIGS = 0x3d F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 F_ADDFILESIGS_RETURN = 0x61 F_ADDSIGS = 0x3b F_ALLOCATEALL = 0x4 F_ALLOCATECONTIG = 0x2 F_BARRIERFSYNC = 0x55 F_CHECK_LV = 0x62 F_CHKCLEAN = 0x29 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x43 F_FINDSIGS = 0x4e F_FLUSH_DATA = 0x28 F_FREEZE_FS = 0x35 F_FULLFSYNC = 0x33 F_GETCODEDIR = 0x48 F_GETFD = 0x1 F_GETFL = 0x3 F_GETLK = 0x7 F_GETLKPID = 0x42 F_GETNOSIGPIPE = 0x4a F_GETOWN = 0x5 F_GETPATH = 0x32 F_GETPATH_MTMINFO = 0x47 F_GETPROTECTIONCLASS = 0x3f F_GETPROTECTIONLEVEL = 0x4d F_GLOBAL_NOCACHE = 0x37 F_LOG2PHYS = 0x31 F_LOG2PHYS_EXT = 0x41 F_NOCACHE = 0x30 F_NODIRECT = 0x3e F_OK = 0x0 F_PATHPKG_CHECK = 0x34 F_PEOFPOSMODE = 0x3 F_PREALLOCATE = 0x2a F_PUNCHHOLE = 0x63 F_RDADVISE = 0x2c F_RDAHEAD = 0x2d F_RDLCK = 0x1 F_SETBACKINGSTORE = 0x46 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLK = 0x8 F_SETLKW = 0x9 F_SETLKWTIMEOUT = 0xa F_SETNOSIGPIPE = 0x49 F_SETOWN = 0x6 F_SETPROTECTIONCLASS = 0x40 F_SETSIZE = 0x2b F_SINGLE_WRITER = 0x4c F_THAW_FS = 0x36 F_TRANSCODEKEY = 0x4b F_TRIM_ACTIVE_FILE = 0x64 F_UNLCK = 0x2 F_VOLPOSMODE = 0x4 F_WRLCK = 0x3 HUPCL = 0x4000 HW_MACHINE = 0x1 ICANON = 0x100 ICMP6_FILTER = 0x12 ICRNL = 0x100 IEXTEN = 0x400 IFF_ALLMULTI = 0x200 IFF_ALTPHYS = 0x4000 IFF_BROADCAST = 0x2 IFF_DEBUG = 0x4 IFF_LINK0 = 0x1000 IFF_LINK1 = 0x2000 IFF_LINK2 = 0x4000 IFF_LOOPBACK = 0x8 IFF_MULTICAST = 0x8000 IFF_NOARP = 0x80 IFF_NOTRAILERS = 0x20 IFF_OACTIVE = 0x400 IFF_POINTOPOINT = 0x10 IFF_PROMISC = 0x100 IFF_RUNNING = 0x40 IFF_SIMPLEX = 0x800 IFF_UP = 0x1 IFNAMSIZ = 0x10 IFT_1822 = 0x2 IFT_AAL5 = 0x31 IFT_ARCNET = 0x23 IFT_ARCNETPLUS = 0x24 IFT_ATM = 0x25 IFT_BRIDGE = 0xd1 IFT_CARP = 0xf8 IFT_CELLULAR = 0xff IFT_CEPT = 0x13 IFT_DS3 = 0x1e IFT_ENC = 0xf4 IFT_EON = 0x19 IFT_ETHER = 0x6 IFT_FAITH = 0x38 IFT_FDDI = 0xf IFT_FRELAY = 0x20 IFT_FRELAYDCE = 0x2c IFT_GIF = 0x37 IFT_HDH1822 = 0x3 IFT_HIPPI = 0x2f IFT_HSSI = 0x2e IFT_HY = 0xe IFT_IEEE1394 = 0x90 IFT_IEEE8023ADLAG = 0x88 IFT_ISDNBASIC = 0x14 IFT_ISDNPRIMARY = 0x15 IFT_ISO88022LLC = 0x29 IFT_ISO88023 = 0x7 IFT_ISO88024 = 0x8 IFT_ISO88025 = 0x9 IFT_ISO88026 = 0xa IFT_L2VLAN = 0x87 IFT_LAPB = 0x10 IFT_LOCALTALK = 0x2a IFT_LOOP = 0x18 IFT_MIOX25 = 0x26 IFT_MODEM = 0x30 IFT_NSIP = 0x1b IFT_OTHER = 0x1 IFT_P10 = 0xc IFT_P80 = 0xd IFT_PARA = 0x22 IFT_PDP = 0xff IFT_PFLOG = 0xf5 IFT_PFSYNC = 0xf6 IFT_PKTAP = 0xfe IFT_PPP = 0x17 IFT_PROPMUX = 0x36 IFT_PROPVIRTUAL = 0x35 IFT_PTPSERIAL = 0x16 IFT_RS232 = 0x21 IFT_SDLC = 0x11 IFT_SIP = 0x1f IFT_SLIP = 0x1c IFT_SMDSDXI = 0x2b IFT_SMDSICIP = 0x34 IFT_SONET = 0x27 IFT_SONETPATH = 0x32 IFT_SONETVT = 0x33 IFT_STARLAN = 0xb IFT_STF = 0x39 IFT_T1 = 0x12 IFT_ULTRA = 0x1d IFT_V35 = 0x2d IFT_X25 = 0x5 IFT_X25DDN = 0x4 IFT_X25PLE = 0x28 IFT_XETHER = 0x1a IGNBRK = 0x1 IGNCR = 0x80 IGNPAR = 0x4 IMAXBEL = 0x2000 INLCR = 0x40 INPCK = 0x10 IN_CLASSA_HOST = 0xffffff IN_CLASSA_MAX = 0x80 IN_CLASSA_NET = 0xff000000 IN_CLASSA_NSHIFT = 0x18 IN_CLASSB_HOST = 0xffff IN_CLASSB_MAX = 0x10000 IN_CLASSB_NET = 0xffff0000 IN_CLASSB_NSHIFT = 0x10 IN_CLASSC_HOST = 0xff IN_CLASSC_NET = 0xffffff00 IN_CLASSC_NSHIFT = 0x8 IN_CLASSD_HOST = 0xfffffff IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 0x1c IN_LINKLOCALNETNUM = 0xa9fe0000 IN_LOOPBACKNET = 0x7f IPPROTO_3PC = 0x22 IPPROTO_ADFS = 0x44 IPPROTO_AH = 0x33 IPPROTO_AHIP = 0x3d IPPROTO_APES = 0x63 IPPROTO_ARGUS = 0xd IPPROTO_AX25 = 0x5d IPPROTO_BHA = 0x31 IPPROTO_BLT = 0x1e IPPROTO_BRSATMON = 0x4c IPPROTO_CFTP = 0x3e IPPROTO_CHAOS = 0x10 IPPROTO_CMTP = 0x26 IPPROTO_CPHB = 0x49 IPPROTO_CPNX = 0x48 IPPROTO_DDP = 0x25 IPPROTO_DGP = 0x56 IPPROTO_DIVERT = 0xfe IPPROTO_DONE = 0x101 IPPROTO_DSTOPTS = 0x3c IPPROTO_EGP = 0x8 IPPROTO_EMCON = 0xe IPPROTO_ENCAP = 0x62 IPPROTO_EON = 0x50 IPPROTO_ESP = 0x32 IPPROTO_ETHERIP = 0x61 IPPROTO_FRAGMENT = 0x2c IPPROTO_GGP = 0x3 IPPROTO_GMTP = 0x64 IPPROTO_GRE = 0x2f IPPROTO_HELLO = 0x3f IPPROTO_HMP = 0x14 IPPROTO_HOPOPTS = 0x0 IPPROTO_ICMP = 0x1 IPPROTO_ICMPV6 = 0x3a IPPROTO_IDP = 0x16 IPPROTO_IDPR = 0x23 IPPROTO_IDRP = 0x2d IPPROTO_IGMP = 0x2 IPPROTO_IGP = 0x55 IPPROTO_IGRP = 0x58 IPPROTO_IL = 0x28 IPPROTO_INLSP = 0x34 IPPROTO_INP = 0x20 IPPROTO_IP = 0x0 IPPROTO_IPCOMP = 0x6c IPPROTO_IPCV = 0x47 IPPROTO_IPEIP = 0x5e IPPROTO_IPIP = 0x4 IPPROTO_IPPC = 0x43 IPPROTO_IPV4 = 0x4 IPPROTO_IPV6 = 0x29 IPPROTO_IRTP = 0x1c IPPROTO_KRYPTOLAN = 0x41 IPPROTO_LARP = 0x5b IPPROTO_LEAF1 = 0x19 IPPROTO_LEAF2 = 0x1a IPPROTO_MAX = 0x100 IPPROTO_MAXID = 0x34 IPPROTO_MEAS = 0x13 IPPROTO_MHRP = 0x30 IPPROTO_MICP = 0x5f IPPROTO_MTP = 0x5c IPPROTO_MUX = 0x12 IPPROTO_ND = 0x4d IPPROTO_NHRP = 0x36 IPPROTO_NONE = 0x3b IPPROTO_NSP = 0x1f IPPROTO_NVPII = 0xb IPPROTO_OSPFIGP = 0x59 IPPROTO_PGM = 0x71 IPPROTO_PIGP = 0x9 IPPROTO_PIM = 0x67 IPPROTO_PRM = 0x15 IPPROTO_PUP = 0xc IPPROTO_PVP = 0x4b IPPROTO_RAW = 0xff IPPROTO_RCCMON = 0xa IPPROTO_RDP = 0x1b IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e IPPROTO_RVD = 0x42 IPPROTO_SATEXPAK = 0x40 IPPROTO_SATMON = 0x45 IPPROTO_SCCSP = 0x60 IPPROTO_SCTP = 0x84 IPPROTO_SDRP = 0x2a IPPROTO_SEP = 0x21 IPPROTO_SRPC = 0x5a IPPROTO_ST = 0x7 IPPROTO_SVMTP = 0x52 IPPROTO_SWIPE = 0x35 IPPROTO_TCF = 0x57 IPPROTO_TCP = 0x6 IPPROTO_TP = 0x1d IPPROTO_TPXX = 0x27 IPPROTO_TRUNK1 = 0x17 IPPROTO_TRUNK2 = 0x18 IPPROTO_TTP = 0x54 IPPROTO_UDP = 0x11 IPPROTO_VINES = 0x53 IPPROTO_VISA = 0x46 IPPROTO_VMTP = 0x51 IPPROTO_WBEXPAK = 0x4f IPPROTO_WBMON = 0x4e IPPROTO_WSN = 0x4a IPPROTO_XNET = 0xf IPPROTO_XTP = 0x24 IPV6_2292DSTOPTS = 0x17 IPV6_2292HOPLIMIT = 0x14 IPV6_2292HOPOPTS = 0x16 IPV6_2292NEXTHOP = 0x15 IPV6_2292PKTINFO = 0x13 IPV6_2292PKTOPTIONS = 0x19 IPV6_2292RTHDR = 0x18 IPV6_BINDV6ONLY = 0x1b IPV6_BOUND_IF = 0x7d IPV6_CHECKSUM = 0x1a IPV6_DEFAULT_MULTICAST_HOPS = 0x1 IPV6_DEFAULT_MULTICAST_LOOP = 0x1 IPV6_DEFHLIM = 0x40 IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FLOW_ECN_MASK = 0x300 IPV6_FRAGTTL = 0x3c IPV6_FW_ADD = 0x1e IPV6_FW_DEL = 0x1f IPV6_FW_FLUSH = 0x20 IPV6_FW_GET = 0x22 IPV6_FW_ZERO = 0x21 IPV6_HLIMDEC = 0x1 IPV6_IPSEC_POLICY = 0x1c IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd IPV6_MAXHLIM = 0xff IPV6_MAXOPTHDR = 0x800 IPV6_MAXPACKET = 0xffff IPV6_MAX_GROUP_SRC_FILTER = 0x200 IPV6_MAX_MEMBERSHIPS = 0xfff IPV6_MAX_SOCK_SRC_FILTER = 0x80 IPV6_MIN_MEMBERSHIPS = 0x1f IPV6_MMTU = 0x500 IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 IPV6_MULTICAST_LOOP = 0xb IPV6_PORTRANGE = 0xe IPV6_PORTRANGE_DEFAULT = 0x0 IPV6_PORTRANGE_HIGH = 0x1 IPV6_PORTRANGE_LOW = 0x2 IPV6_RECVTCLASS = 0x23 IPV6_RTHDR_LOOSE = 0x0 IPV6_RTHDR_STRICT = 0x1 IPV6_RTHDR_TYPE_0 = 0x0 IPV6_SOCKOPT_RESERVED1 = 0x3 IPV6_TCLASS = 0x24 IPV6_UNICAST_HOPS = 0x4 IPV6_V6ONLY = 0x1b IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 IP_ADD_MEMBERSHIP = 0xc IP_ADD_SOURCE_MEMBERSHIP = 0x46 IP_BLOCK_SOURCE = 0x48 IP_BOUND_IF = 0x19 IP_DEFAULT_MULTICAST_LOOP = 0x1 IP_DEFAULT_MULTICAST_TTL = 0x1 IP_DF = 0x4000 IP_DROP_MEMBERSHIP = 0xd IP_DROP_SOURCE_MEMBERSHIP = 0x47 IP_DUMMYNET_CONFIGURE = 0x3c IP_DUMMYNET_DEL = 0x3d IP_DUMMYNET_FLUSH = 0x3e IP_DUMMYNET_GET = 0x40 IP_FAITH = 0x16 IP_FW_ADD = 0x28 IP_FW_DEL = 0x29 IP_FW_FLUSH = 0x2a IP_FW_GET = 0x2c IP_FW_RESETLOG = 0x2d IP_FW_ZERO = 0x2b IP_HDRINCL = 0x2 IP_IPSEC_POLICY = 0x15 IP_MAXPACKET = 0xffff IP_MAX_GROUP_SRC_FILTER = 0x200 IP_MAX_MEMBERSHIPS = 0xfff IP_MAX_SOCK_MUTE_FILTER = 0x80 IP_MAX_SOCK_SRC_FILTER = 0x80 IP_MF = 0x2000 IP_MIN_MEMBERSHIPS = 0x1f IP_MSFILTER = 0x4a IP_MSS = 0x240 IP_MULTICAST_IF = 0x9 IP_MULTICAST_IFINDEX = 0x42 IP_MULTICAST_LOOP = 0xb IP_MULTICAST_TTL = 0xa IP_MULTICAST_VIF = 0xe IP_NAT__XXX = 0x37 IP_OFFMASK = 0x1fff IP_OLD_FW_ADD = 0x32 IP_OLD_FW_DEL = 0x33 IP_OLD_FW_FLUSH = 0x34 IP_OLD_FW_GET = 0x36 IP_OLD_FW_RESETLOG = 0x38 IP_OLD_FW_ZERO = 0x35 IP_OPTIONS = 0x1 IP_PKTINFO = 0x1a IP_PORTRANGE = 0x13 IP_PORTRANGE_DEFAULT = 0x0 IP_PORTRANGE_HIGH = 0x1 IP_PORTRANGE_LOW = 0x2 IP_RECVDSTADDR = 0x7 IP_RECVIF = 0x14 IP_RECVOPTS = 0x5 IP_RECVPKTINFO = 0x1a IP_RECVRETOPTS = 0x6 IP_RECVTOS = 0x1b IP_RECVTTL = 0x18 IP_RETOPTS = 0x8 IP_RF = 0x8000 IP_RSVP_OFF = 0x10 IP_RSVP_ON = 0xf IP_RSVP_VIF_OFF = 0x12 IP_RSVP_VIF_ON = 0x11 IP_STRIPHDR = 0x17 IP_TOS = 0x3 IP_TRAFFIC_MGT_BACKGROUND = 0x41 IP_TTL = 0x4 IP_UNBLOCK_SOURCE = 0x49 ISIG = 0x80 ISTRIP = 0x20 IUTF8 = 0x4000 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 KERN_HOSTNAME = 0xa KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 MADV_CAN_REUSE = 0x9 MADV_DONTNEED = 0x4 MADV_FREE = 0x5 MADV_FREE_REUSABLE = 0x7 MADV_FREE_REUSE = 0x8 MADV_NORMAL = 0x0 MADV_PAGEOUT = 0xa MADV_RANDOM = 0x1 MADV_SEQUENTIAL = 0x2 MADV_WILLNEED = 0x3 MADV_ZERO_WIRED_PAGES = 0x6 MAP_ANON = 0x1000 MAP_ANONYMOUS = 0x1000 MAP_COPY = 0x2 MAP_FILE = 0x0 MAP_FIXED = 0x10 MAP_HASSEMAPHORE = 0x200 MAP_JIT = 0x800 MAP_NOCACHE = 0x400 MAP_NOEXTEND = 0x100 MAP_NORESERVE = 0x40 MAP_PRIVATE = 0x2 MAP_RENAME = 0x20 MAP_RESERVED0080 = 0x80 MAP_RESILIENT_CODESIGN = 0x2000 MAP_RESILIENT_MEDIA = 0x4000 MAP_SHARED = 0x1 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MNT_ASYNC = 0x40 MNT_AUTOMOUNTED = 0x400000 MNT_CMDFLAGS = 0xf0000 MNT_CPROTECT = 0x80 MNT_DEFWRITE = 0x2000000 MNT_DONTBROWSE = 0x100000 MNT_DOVOLFS = 0x8000 MNT_DWAIT = 0x4 MNT_EXPORTED = 0x100 MNT_FORCE = 0x80000 MNT_IGNORE_OWNERSHIP = 0x200000 MNT_JOURNALED = 0x800000 MNT_LOCAL = 0x1000 MNT_MULTILABEL = 0x4000000 MNT_NOATIME = 0x10000000 MNT_NOBLOCK = 0x20000 MNT_NODEV = 0x10 MNT_NOEXEC = 0x4 MNT_NOSUID = 0x8 MNT_NOUSERXATTR = 0x1000000 MNT_NOWAIT = 0x2 MNT_QUARANTINE = 0x400 MNT_QUOTA = 0x2000 MNT_RDONLY = 0x1 MNT_RELOAD = 0x40000 MNT_ROOTFS = 0x4000 MNT_SYNCHRONOUS = 0x2 MNT_UNION = 0x20 MNT_UNKNOWNPERMISSIONS = 0x200000 MNT_UPDATE = 0x10000 MNT_VISFLAGMASK = 0x17f0f5ff MNT_WAIT = 0x1 MSG_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 MSG_DONTWAIT = 0x80 MSG_EOF = 0x100 MSG_EOR = 0x8 MSG_FLUSH = 0x400 MSG_HAVEMORE = 0x2000 MSG_HOLD = 0x800 MSG_NEEDSA = 0x10000 MSG_OOB = 0x1 MSG_PEEK = 0x2 MSG_RCVMORE = 0x4000 MSG_SEND = 0x1000 MSG_TRUNC = 0x10 MSG_WAITALL = 0x40 MSG_WAITSTREAM = 0x200 MS_ASYNC = 0x1 MS_DEACTIVATE = 0x8 MS_INVALIDATE = 0x2 MS_KILLPAGES = 0x4 MS_SYNC = 0x10 NAME_MAX = 0xff NET_RT_DUMP = 0x1 NET_RT_DUMP2 = 0x7 NET_RT_FLAGS = 0x2 NET_RT_IFLIST = 0x3 NET_RT_IFLIST2 = 0x6 NET_RT_MAXID = 0xa NET_RT_STAT = 0x4 NET_RT_TRASH = 0x5 NL0 = 0x0 NL1 = 0x100 NL2 = 0x200 NL3 = 0x300 NLDLY = 0x300 NOFLSH = 0x80000000 NOKERNINFO = 0x2000000 NOTE_ABSOLUTE = 0x8 NOTE_ATTRIB = 0x8 NOTE_BACKGROUND = 0x40 NOTE_CHILD = 0x4 NOTE_CRITICAL = 0x20 NOTE_DELETE = 0x1 NOTE_EXEC = 0x20000000 NOTE_EXIT = 0x80000000 NOTE_EXITSTATUS = 0x4000000 NOTE_EXIT_CSERROR = 0x40000 NOTE_EXIT_DECRYPTFAIL = 0x10000 NOTE_EXIT_DETAIL = 0x2000000 NOTE_EXIT_DETAIL_MASK = 0x70000 NOTE_EXIT_MEMORY = 0x20000 NOTE_EXIT_REPARENTED = 0x80000 NOTE_EXTEND = 0x4 NOTE_FFAND = 0x40000000 NOTE_FFCOPY = 0xc0000000 NOTE_FFCTRLMASK = 0xc0000000 NOTE_FFLAGSMASK = 0xffffff NOTE_FFNOP = 0x0 NOTE_FFOR = 0x80000000 NOTE_FORK = 0x40000000 NOTE_FUNLOCK = 0x100 NOTE_LEEWAY = 0x10 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 NOTE_MACH_CONTINUOUS_TIME = 0x80 NOTE_NONE = 0x80 NOTE_NSECONDS = 0x4 NOTE_OOB = 0x2 NOTE_PCTRLMASK = -0x100000 NOTE_PDATAMASK = 0xfffff NOTE_REAP = 0x10000000 NOTE_RENAME = 0x20 NOTE_REVOKE = 0x40 NOTE_SECONDS = 0x1 NOTE_SIGNAL = 0x8000000 NOTE_TRACK = 0x1 NOTE_TRACKERR = 0x2 NOTE_TRIGGER = 0x1000000 NOTE_USECONDS = 0x2 NOTE_VM_ERROR = 0x10000000 NOTE_VM_PRESSURE = 0x80000000 NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 NOTE_VM_PRESSURE_TERMINATE = 0x40000000 NOTE_WRITE = 0x2 OCRNL = 0x10 OFDEL = 0x20000 OFILL = 0x80 ONLCR = 0x2 ONLRET = 0x40 ONOCR = 0x20 ONOEOT = 0x8 OPOST = 0x1 OXTABS = 0x4 O_ACCMODE = 0x3 O_ALERT = 0x20000000 O_APPEND = 0x8 O_ASYNC = 0x40 O_CLOEXEC = 0x1000000 O_CREAT = 0x200 O_DIRECTORY = 0x100000 O_DP_GETRAWENCRYPTED = 0x1 O_DP_GETRAWUNENCRYPTED = 0x2 O_DSYNC = 0x400000 O_EVTONLY = 0x8000 O_EXCL = 0x800 O_EXLOCK = 0x20 O_FSYNC = 0x80 O_NDELAY = 0x4 O_NOCTTY = 0x20000 O_NOFOLLOW = 0x100 O_NONBLOCK = 0x4 O_POPUP = 0x80000000 O_RDONLY = 0x0 O_RDWR = 0x2 O_SHLOCK = 0x10 O_SYMLINK = 0x200000 O_SYNC = 0x80 O_TRUNC = 0x400 O_WRONLY = 0x1 PARENB = 0x1000 PARMRK = 0x8 PARODD = 0x2000 PENDIN = 0x20000000 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 PROT_EXEC = 0x4 PROT_NONE = 0x0 PROT_READ = 0x1 PROT_WRITE = 0x2 PT_ATTACH = 0xa PT_ATTACHEXC = 0xe PT_CONTINUE = 0x7 PT_DENY_ATTACH = 0x1f PT_DETACH = 0xb PT_FIRSTMACH = 0x20 PT_FORCEQUOTA = 0x1e PT_KILL = 0x8 PT_READ_D = 0x2 PT_READ_I = 0x1 PT_READ_U = 0x3 PT_SIGEXC = 0xc PT_STEP = 0x9 PT_THUPDATE = 0xd PT_TRACE_ME = 0x0 PT_WRITE_D = 0x5 PT_WRITE_I = 0x4 PT_WRITE_U = 0x6 RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 RLIMIT_CPU_USAGE_MONITOR = 0x2 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 RLIMIT_NPROC = 0x7 RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 RTAX_BRD = 0x7 RTAX_DST = 0x0 RTAX_GATEWAY = 0x1 RTAX_GENMASK = 0x3 RTAX_IFA = 0x5 RTAX_IFP = 0x4 RTAX_MAX = 0x8 RTAX_NETMASK = 0x2 RTA_AUTHOR = 0x40 RTA_BRD = 0x80 RTA_DST = 0x1 RTA_GATEWAY = 0x2 RTA_GENMASK = 0x8 RTA_IFA = 0x20 RTA_IFP = 0x10 RTA_NETMASK = 0x4 RTF_BLACKHOLE = 0x1000 RTF_BROADCAST = 0x400000 RTF_CLONING = 0x100 RTF_CONDEMNED = 0x2000000 RTF_DELCLONE = 0x80 RTF_DONE = 0x40 RTF_DYNAMIC = 0x10 RTF_GATEWAY = 0x2 RTF_HOST = 0x4 RTF_IFREF = 0x4000000 RTF_IFSCOPE = 0x1000000 RTF_LLINFO = 0x400 RTF_LOCAL = 0x200000 RTF_MODIFIED = 0x20 RTF_MULTICAST = 0x800000 RTF_NOIFREF = 0x2000 RTF_PINNED = 0x100000 RTF_PRCLONING = 0x10000 RTF_PROTO1 = 0x8000 RTF_PROTO2 = 0x4000 RTF_PROTO3 = 0x40000 RTF_PROXY = 0x8000000 RTF_REJECT = 0x8 RTF_ROUTER = 0x10000000 RTF_STATIC = 0x800 RTF_UP = 0x1 RTF_WASCLONED = 0x20000 RTF_XRESOLVE = 0x200 RTM_ADD = 0x1 RTM_CHANGE = 0x3 RTM_DELADDR = 0xd RTM_DELETE = 0x2 RTM_DELMADDR = 0x10 RTM_GET = 0x4 RTM_GET2 = 0x14 RTM_IFINFO = 0xe RTM_IFINFO2 = 0x12 RTM_LOCK = 0x8 RTM_LOSING = 0x5 RTM_MISS = 0x7 RTM_NEWADDR = 0xc RTM_NEWMADDR = 0xf RTM_NEWMADDR2 = 0x13 RTM_OLDADD = 0x9 RTM_OLDDEL = 0xa RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb RTM_RTTUNIT = 0xf4240 RTM_VERSION = 0x5 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 RTV_MTU = 0x1 RTV_RPIPE = 0x8 RTV_RTT = 0x40 RTV_RTTVAR = 0x80 RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 SCM_CREDS = 0x3 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIMESTAMP_MONOTONIC = 0x4 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 SIOCADDMULTI = 0x80206931 SIOCAIFADDR = 0x8040691a SIOCARPIPLL = 0xc0206928 SIOCATMARK = 0x40047307 SIOCAUTOADDR = 0xc0206926 SIOCAUTONETMASK = 0x80206927 SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 SIOCDIFPHYADDR = 0x80206941 SIOCGDRVSPEC = 0xc028697b SIOCGETVLAN = 0xc020697f SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0206921 SIOCGIFALTMTU = 0xc0206948 SIOCGIFASYNCMAP = 0xc020697c SIOCGIFBOND = 0xc0206947 SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCAP = 0xc020695b SIOCGIFCONF = 0xc00c6924 SIOCGIFDEVMTU = 0xc0206944 SIOCGIFDSTADDR = 0xc0206922 SIOCGIFFLAGS = 0xc0206911 SIOCGIFGENERIC = 0xc020693a SIOCGIFKPI = 0xc0206987 SIOCGIFMAC = 0xc0206982 SIOCGIFMEDIA = 0xc02c6938 SIOCGIFMETRIC = 0xc0206917 SIOCGIFMTU = 0xc0206933 SIOCGIFNETMASK = 0xc0206925 SIOCGIFPDSTADDR = 0xc0206940 SIOCGIFPHYS = 0xc0206935 SIOCGIFPSRCADDR = 0xc020693f SIOCGIFSTATUS = 0xc331693d SIOCGIFVLAN = 0xc020697f SIOCGIFWAKEFLAGS = 0xc0206988 SIOCGLOWAT = 0x40047303 SIOCGPGRP = 0x40047309 SIOCIFCREATE = 0xc0206978 SIOCIFCREATE2 = 0xc020697a SIOCIFDESTROY = 0x80206979 SIOCIFGCLONERS = 0xc0106981 SIOCRSLVMULTI = 0xc010693b SIOCSDRVSPEC = 0x8028697b SIOCSETVLAN = 0x8020697e SIOCSHIWAT = 0x80047300 SIOCSIFADDR = 0x8020690c SIOCSIFALTMTU = 0x80206945 SIOCSIFASYNCMAP = 0x8020697d SIOCSIFBOND = 0x80206946 SIOCSIFBRDADDR = 0x80206913 SIOCSIFCAP = 0x8020695a SIOCSIFDSTADDR = 0x8020690e SIOCSIFFLAGS = 0x80206910 SIOCSIFGENERIC = 0x80206939 SIOCSIFKPI = 0x80206986 SIOCSIFLLADDR = 0x8020693c SIOCSIFMAC = 0x80206983 SIOCSIFMEDIA = 0xc0206937 SIOCSIFMETRIC = 0x80206918 SIOCSIFMTU = 0x80206934 SIOCSIFNETMASK = 0x80206916 SIOCSIFPHYADDR = 0x8040693e SIOCSIFPHYS = 0x80206936 SIOCSIFVLAN = 0x8020697e SIOCSLOWAT = 0x80047302 SIOCSPGRP = 0x80047308 SOCK_DGRAM = 0x2 SOCK_MAXADDRLEN = 0xff SOCK_RAW = 0x3 SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 SO_BROADCAST = 0x20 SO_DEBUG = 0x1 SO_DONTROUTE = 0x10 SO_DONTTRUNC = 0x2000 SO_ERROR = 0x1007 SO_KEEPALIVE = 0x8 SO_LABEL = 0x1010 SO_LINGER = 0x80 SO_LINGER_SEC = 0x1080 SO_NETSVC_MARKING_LEVEL = 0x1119 SO_NET_SERVICE_TYPE = 0x1116 SO_NKE = 0x1021 SO_NOADDRERR = 0x1023 SO_NOSIGPIPE = 0x1022 SO_NOTIFYCONFLICT = 0x1026 SO_NP_EXTENSIONS = 0x1083 SO_NREAD = 0x1020 SO_NUMRCVPKT = 0x1112 SO_NWRITE = 0x1024 SO_OOBINLINE = 0x100 SO_PEERLABEL = 0x1011 SO_RANDOMPORT = 0x1082 SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_REUSESHAREUID = 0x1025 SO_SNDBUF = 0x1001 SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 SO_TIMESTAMP = 0x400 SO_TIMESTAMP_MONOTONIC = 0x800 SO_TYPE = 0x1008 SO_UPCALLCLOSEWAIT = 0x1027 SO_USELOOPBACK = 0x40 SO_WANTMORE = 0x4000 SO_WANTOOBFLAG = 0x8000 S_IEXEC = 0x40 S_IFBLK = 0x6000 S_IFCHR = 0x2000 S_IFDIR = 0x4000 S_IFIFO = 0x1000 S_IFLNK = 0xa000 S_IFMT = 0xf000 S_IFREG = 0x8000 S_IFSOCK = 0xc000 S_IFWHT = 0xe000 S_IREAD = 0x100 S_IRGRP = 0x20 S_IROTH = 0x4 S_IRUSR = 0x100 S_IRWXG = 0x38 S_IRWXO = 0x7 S_IRWXU = 0x1c0 S_ISGID = 0x400 S_ISTXT = 0x200 S_ISUID = 0x800 S_ISVTX = 0x200 S_IWGRP = 0x10 S_IWOTH = 0x2 S_IWRITE = 0x80 S_IWUSR = 0x80 S_IXGRP = 0x8 S_IXOTH = 0x1 S_IXUSR = 0x40 TAB0 = 0x0 TAB1 = 0x400 TAB2 = 0x800 TAB3 = 0x4 TABDLY = 0xc04 TCIFLUSH = 0x1 TCIOFF = 0x3 TCIOFLUSH = 0x3 TCION = 0x4 TCOFLUSH = 0x2 TCOOFF = 0x1 TCOON = 0x2 TCP_CONNECTIONTIMEOUT = 0x20 TCP_CONNECTION_INFO = 0x106 TCP_ENABLE_ECN = 0x104 TCP_FASTOPEN = 0x105 TCP_KEEPALIVE = 0x10 TCP_KEEPCNT = 0x102 TCP_KEEPINTVL = 0x101 TCP_MAXHLEN = 0x3c TCP_MAXOLEN = 0x28 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff TCP_MAX_SACK = 0x4 TCP_MAX_WINSHIFT = 0xe TCP_MINMSS = 0xd8 TCP_MSS = 0x200 TCP_NODELAY = 0x1 TCP_NOOPT = 0x8 TCP_NOPUSH = 0x4 TCP_NOTSENT_LOWAT = 0x201 TCP_RXT_CONNDROPTIME = 0x80 TCP_RXT_FINDROP = 0x100 TCP_SENDMOREACKS = 0x103 TCSAFLUSH = 0x2 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 TIOCCONS = 0x80047462 TIOCDCDTIMESTAMP = 0x40107458 TIOCDRAIN = 0x2000745e TIOCDSIMICROCODE = 0x20007455 TIOCEXCL = 0x2000740d TIOCEXT = 0x80047460 TIOCFLUSH = 0x80047410 TIOCGDRAINWAIT = 0x40047456 TIOCGETA = 0x40487413 TIOCGETD = 0x4004741a TIOCGPGRP = 0x40047477 TIOCGWINSZ = 0x40087468 TIOCIXOFF = 0x20007480 TIOCIXON = 0x20007481 TIOCMBIC = 0x8004746b TIOCMBIS = 0x8004746c TIOCMGDTRWAIT = 0x4004745a TIOCMGET = 0x4004746a TIOCMODG = 0x40047403 TIOCMODS = 0x80047404 TIOCMSDTRWAIT = 0x8004745b TIOCMSET = 0x8004746d TIOCM_CAR = 0x40 TIOCM_CD = 0x40 TIOCM_CTS = 0x20 TIOCM_DSR = 0x100 TIOCM_DTR = 0x2 TIOCM_LE = 0x1 TIOCM_RI = 0x80 TIOCM_RNG = 0x80 TIOCM_RTS = 0x4 TIOCM_SR = 0x10 TIOCM_ST = 0x8 TIOCNOTTY = 0x20007471 TIOCNXCL = 0x2000740e TIOCOUTQ = 0x40047473 TIOCPKT = 0x80047470 TIOCPKT_DATA = 0x0 TIOCPKT_DOSTOP = 0x20 TIOCPKT_FLUSHREAD = 0x1 TIOCPKT_FLUSHWRITE = 0x2 TIOCPKT_IOCTL = 0x40 TIOCPKT_NOSTOP = 0x10 TIOCPKT_START = 0x8 TIOCPKT_STOP = 0x4 TIOCPTYGNAME = 0x40807453 TIOCPTYGRANT = 0x20007454 TIOCPTYUNLK = 0x20007452 TIOCREMOTE = 0x80047469 TIOCSBRK = 0x2000747b TIOCSCONS = 0x20007463 TIOCSCTTY = 0x20007461 TIOCSDRAINWAIT = 0x80047457 TIOCSDTR = 0x20007479 TIOCSETA = 0x80487414 TIOCSETAF = 0x80487416 TIOCSETAW = 0x80487415 TIOCSETD = 0x8004741b TIOCSIG = 0x2000745f TIOCSPGRP = 0x80047476 TIOCSTART = 0x2000746e TIOCSTAT = 0x20007465 TIOCSTI = 0x80017472 TIOCSTOP = 0x2000746f TIOCSWINSZ = 0x80087467 TIOCTIMESTAMP = 0x40107459 TIOCUCNTL = 0x80047466 TOSTOP = 0x400000 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 VEOL = 0x1 VEOL2 = 0x2 VERASE = 0x3 VINTR = 0x8 VKILL = 0x5 VLNEXT = 0xe VMIN = 0x10 VM_LOADAVG = 0x2 VM_MACHFACTOR = 0x4 VM_MAXID = 0x6 VM_METER = 0x1 VM_SWAPUSAGE = 0x5 VQUIT = 0x9 VREPRINT = 0x6 VSTART = 0xc VSTATUS = 0x12 VSTOP = 0xd VSUSP = 0xa VT0 = 0x0 VT1 = 0x10000 VTDLY = 0x10000 VTIME = 0x11 VWERASE = 0x4 WCONTINUED = 0x10 WCOREFLAG = 0x80 WEXITED = 0x4 WNOHANG = 0x1 WNOWAIT = 0x20 WORDSIZE = 0x40 WSTOPPED = 0x8 WUNTRACED = 0x2 XATTR_CREATE = 0x2 XATTR_NODEFAULT = 0x10 XATTR_NOFOLLOW = 0x1 XATTR_NOSECURITY = 0x8 XATTR_REPLACE = 0x4 XATTR_SHOWCOMPRESSION = 0x20 ) // Errors const ( E2BIG = syscall.Errno(0x7) EACCES = syscall.Errno(0xd) EADDRINUSE = syscall.Errno(0x30) EADDRNOTAVAIL = syscall.Errno(0x31) EAFNOSUPPORT = syscall.Errno(0x2f) EAGAIN = syscall.Errno(0x23) EALREADY = syscall.Errno(0x25) EAUTH = syscall.Errno(0x50) EBADARCH = syscall.Errno(0x56) EBADEXEC = syscall.Errno(0x55) EBADF = syscall.Errno(0x9) EBADMACHO = syscall.Errno(0x58) EBADMSG = syscall.Errno(0x5e) EBADRPC = syscall.Errno(0x48) EBUSY = syscall.Errno(0x10) ECANCELED = syscall.Errno(0x59) ECHILD = syscall.Errno(0xa) ECONNABORTED = syscall.Errno(0x35) ECONNREFUSED = syscall.Errno(0x3d) ECONNRESET = syscall.Errno(0x36) EDEADLK = syscall.Errno(0xb) EDESTADDRREQ = syscall.Errno(0x27) EDEVERR = syscall.Errno(0x53) EDOM = syscall.Errno(0x21) EDQUOT = syscall.Errno(0x45) EEXIST = syscall.Errno(0x11) EFAULT = syscall.Errno(0xe) EFBIG = syscall.Errno(0x1b) EFTYPE = syscall.Errno(0x4f) EHOSTDOWN = syscall.Errno(0x40) EHOSTUNREACH = syscall.Errno(0x41) EIDRM = syscall.Errno(0x5a) EILSEQ = syscall.Errno(0x5c) EINPROGRESS = syscall.Errno(0x24) EINTR = syscall.Errno(0x4) EINVAL = syscall.Errno(0x16) EIO = syscall.Errno(0x5) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) ELAST = syscall.Errno(0x6a) ELOOP = syscall.Errno(0x3e) EMFILE = syscall.Errno(0x18) EMLINK = syscall.Errno(0x1f) EMSGSIZE = syscall.Errno(0x28) EMULTIHOP = syscall.Errno(0x5f) ENAMETOOLONG = syscall.Errno(0x3f) ENEEDAUTH = syscall.Errno(0x51) ENETDOWN = syscall.Errno(0x32) ENETRESET = syscall.Errno(0x34) ENETUNREACH = syscall.Errno(0x33) ENFILE = syscall.Errno(0x17) ENOATTR = syscall.Errno(0x5d) ENOBUFS = syscall.Errno(0x37) ENODATA = syscall.Errno(0x60) ENODEV = syscall.Errno(0x13) ENOENT = syscall.Errno(0x2) ENOEXEC = syscall.Errno(0x8) ENOLCK = syscall.Errno(0x4d) ENOLINK = syscall.Errno(0x61) ENOMEM = syscall.Errno(0xc) ENOMSG = syscall.Errno(0x5b) ENOPOLICY = syscall.Errno(0x67) ENOPROTOOPT = syscall.Errno(0x2a) ENOSPC = syscall.Errno(0x1c) ENOSR = syscall.Errno(0x62) ENOSTR = syscall.Errno(0x63) ENOSYS = syscall.Errno(0x4e) ENOTBLK = syscall.Errno(0xf) ENOTCONN = syscall.Errno(0x39) ENOTDIR = syscall.Errno(0x14) ENOTEMPTY = syscall.Errno(0x42) ENOTRECOVERABLE = syscall.Errno(0x68) ENOTSOCK = syscall.Errno(0x26) ENOTSUP = syscall.Errno(0x2d) ENOTTY = syscall.Errno(0x19) ENXIO = syscall.Errno(0x6) EOPNOTSUPP = syscall.Errno(0x66) EOVERFLOW = syscall.Errno(0x54) EOWNERDEAD = syscall.Errno(0x69) EPERM = syscall.Errno(0x1) EPFNOSUPPORT = syscall.Errno(0x2e) EPIPE = syscall.Errno(0x20) EPROCLIM = syscall.Errno(0x43) EPROCUNAVAIL = syscall.Errno(0x4c) EPROGMISMATCH = syscall.Errno(0x4b) EPROGUNAVAIL = syscall.Errno(0x4a) EPROTO = syscall.Errno(0x64) EPROTONOSUPPORT = syscall.Errno(0x2b) EPROTOTYPE = syscall.Errno(0x29) EPWROFF = syscall.Errno(0x52) EQFULL = syscall.Errno(0x6a) ERANGE = syscall.Errno(0x22) EREMOTE = syscall.Errno(0x47) EROFS = syscall.Errno(0x1e) ERPCMISMATCH = syscall.Errno(0x49) ESHLIBVERS = syscall.Errno(0x57) ESHUTDOWN = syscall.Errno(0x3a) ESOCKTNOSUPPORT = syscall.Errno(0x2c) ESPIPE = syscall.Errno(0x1d) ESRCH = syscall.Errno(0x3) ESTALE = syscall.Errno(0x46) ETIME = syscall.Errno(0x65) ETIMEDOUT = syscall.Errno(0x3c) ETOOMANYREFS = syscall.Errno(0x3b) ETXTBSY = syscall.Errno(0x1a) EUSERS = syscall.Errno(0x44) EWOULDBLOCK = syscall.Errno(0x23) EXDEV = syscall.Errno(0x12) ) // Signals const ( SIGABRT = syscall.Signal(0x6) SIGALRM = syscall.Signal(0xe) SIGBUS = syscall.Signal(0xa) SIGCHLD = syscall.Signal(0x14) SIGCONT = syscall.Signal(0x13) SIGEMT = syscall.Signal(0x7) SIGFPE = syscall.Signal(0x8) SIGHUP = syscall.Signal(0x1) SIGILL = syscall.Signal(0x4) SIGINFO = syscall.Signal(0x1d) SIGINT = syscall.Signal(0x2) SIGIO = syscall.Signal(0x17) SIGIOT = syscall.Signal(0x6) SIGKILL = syscall.Signal(0x9) SIGPIPE = syscall.Signal(0xd) SIGPROF = syscall.Signal(0x1b) SIGQUIT = syscall.Signal(0x3) SIGSEGV = syscall.Signal(0xb) SIGSTOP = syscall.Signal(0x11) SIGSYS = syscall.Signal(0xc) SIGTERM = syscall.Signal(0xf) SIGTRAP = syscall.Signal(0x5) SIGTSTP = syscall.Signal(0x12) SIGTTIN = syscall.Signal(0x15) SIGTTOU = syscall.Signal(0x16) SIGURG = syscall.Signal(0x10) SIGUSR1 = syscall.Signal(0x1e) SIGUSR2 = syscall.Signal(0x1f) SIGVTALRM = syscall.Signal(0x1a) SIGWINCH = syscall.Signal(0x1c) SIGXCPU = syscall.Signal(0x18) SIGXFSZ = syscall.Signal(0x19) ) // Error table var errorList = [...]struct { num syscall.Errno name string desc string }{ {1, "EPERM", "operation not permitted"}, {2, "ENOENT", "no such file or directory"}, {3, "ESRCH", "no such process"}, {4, "EINTR", "interrupted system call"}, {5, "EIO", "input/output error"}, {6, "ENXIO", "device not configured"}, {7, "E2BIG", "argument list too long"}, {8, "ENOEXEC", "exec format error"}, {9, "EBADF", "bad file descriptor"}, {10, "ECHILD", "no child processes"}, {11, "EDEADLK", "resource deadlock avoided"}, {12, "ENOMEM", "cannot allocate memory"}, {13, "EACCES", "permission denied"}, {14, "EFAULT", "bad address"}, {15, "ENOTBLK", "block device required"}, {16, "EBUSY", "resource busy"}, {17, "EEXIST", "file exists"}, {18, "EXDEV", "cross-device link"}, {19, "ENODEV", "operation not supported by device"}, {20, "ENOTDIR", "not a directory"}, {21, "EISDIR", "is a directory"}, {22, "EINVAL", "invalid argument"}, {23, "ENFILE", "too many open files in system"}, {24, "EMFILE", "too many open files"}, {25, "ENOTTY", "inappropriate ioctl for device"}, {26, "ETXTBSY", "text file busy"}, {27, "EFBIG", "file too large"}, {28, "ENOSPC", "no space left on device"}, {29, "ESPIPE", "illegal seek"}, {30, "EROFS", "read-only file system"}, {31, "EMLINK", "too many links"}, {32, "EPIPE", "broken pipe"}, {33, "EDOM", "numerical argument out of domain"}, {34, "ERANGE", "result too large"}, {35, "EAGAIN", "resource temporarily unavailable"}, {36, "EINPROGRESS", "operation now in progress"}, {37, "EALREADY", "operation already in progress"}, {38, "ENOTSOCK", "socket operation on non-socket"}, {39, "EDESTADDRREQ", "destination address required"}, {40, "EMSGSIZE", "message too long"}, {41, "EPROTOTYPE", "protocol wrong type for socket"}, {42, "ENOPROTOOPT", "protocol not available"}, {43, "EPROTONOSUPPORT", "protocol not supported"}, {44, "ESOCKTNOSUPPORT", "socket type not supported"}, {45, "ENOTSUP", "operation not supported"}, {46, "EPFNOSUPPORT", "protocol family not supported"}, {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, {48, "EADDRINUSE", "address already in use"}, {49, "EADDRNOTAVAIL", "can't assign requested address"}, {50, "ENETDOWN", "network is down"}, {51, "ENETUNREACH", "network is unreachable"}, {52, "ENETRESET", "network dropped connection on reset"}, {53, "ECONNABORTED", "software caused connection abort"}, {54, "ECONNRESET", "connection reset by peer"}, {55, "ENOBUFS", "no buffer space available"}, {56, "EISCONN", "socket is already connected"}, {57, "ENOTCONN", "socket is not connected"}, {58, "ESHUTDOWN", "can't send after socket shutdown"}, {59, "ETOOMANYREFS", "too many references: can't splice"}, {60, "ETIMEDOUT", "operation timed out"}, {61, "ECONNREFUSED", "connection refused"}, {62, "ELOOP", "too many levels of symbolic links"}, {63, "ENAMETOOLONG", "file name too long"}, {64, "EHOSTDOWN", "host is down"}, {65, "EHOSTUNREACH", "no route to host"}, {66, "ENOTEMPTY", "directory not empty"}, {67, "EPROCLIM", "too many processes"}, {68, "EUSERS", "too many users"}, {69, "EDQUOT", "disc quota exceeded"}, {70, "ESTALE", "stale NFS file handle"}, {71, "EREMOTE", "too many levels of remote in path"}, {72, "EBADRPC", "RPC struct is bad"}, {73, "ERPCMISMATCH", "RPC version wrong"}, {74, "EPROGUNAVAIL", "RPC prog. not avail"}, {75, "EPROGMISMATCH", "program version wrong"}, {76, "EPROCUNAVAIL", "bad procedure for program"}, {77, "ENOLCK", "no locks available"}, {78, "ENOSYS", "function not implemented"}, {79, "EFTYPE", "inappropriate file type or format"}, {80, "EAUTH", "authentication error"}, {81, "ENEEDAUTH", "need authenticator"}, {82, "EPWROFF", "device power is off"}, {83, "EDEVERR", "device error"}, {84, "EOVERFLOW", "value too large to be stored in data type"}, {85, "EBADEXEC", "bad executable (or shared library)"}, {86, "EBADARCH", "bad CPU type in executable"}, {87, "ESHLIBVERS", "shared library version mismatch"}, {88, "EBADMACHO", "malformed Mach-o file"}, {89, "ECANCELED", "operation canceled"}, {90, "EIDRM", "identifier removed"}, {91, "ENOMSG", "no message of desired type"}, {92, "EILSEQ", "illegal byte sequence"}, {93, "ENOATTR", "attribute not found"}, {94, "EBADMSG", "bad message"}, {95, "EMULTIHOP", "EMULTIHOP (Reserved)"}, {96, "ENODATA", "no message available on STREAM"}, {97, "ENOLINK", "ENOLINK (Reserved)"}, {98, "ENOSR", "no STREAM resources"}, {99, "ENOSTR", "not a STREAM"}, {100, "EPROTO", "protocol error"}, {101, "ETIME", "STREAM ioctl timeout"}, {102, "EOPNOTSUPP", "operation not supported on socket"}, {103, "ENOPOLICY", "policy not found"}, {104, "ENOTRECOVERABLE", "state not recoverable"}, {105, "EOWNERDEAD", "previous owner died"}, {106, "EQFULL", "interface output queue is full"}, } // Signal table var signalList = [...]struct { num syscall.Signal name string desc string }{ {1, "SIGHUP", "hangup"}, {2, "SIGINT", "interrupt"}, {3, "SIGQUIT", "quit"}, {4, "SIGILL", "illegal instruction"}, {5, "SIGTRAP", "trace/BPT trap"}, {6, "SIGABRT", "abort trap"}, {7, "SIGEMT", "EMT trap"}, {8, "SIGFPE", "floating point exception"}, {9, "SIGKILL", "killed"}, {10, "SIGBUS", "bus error"}, {11, "SIGSEGV", "segmentation fault"}, {12, "SIGSYS", "bad system call"}, {13, "SIGPIPE", "broken pipe"}, {14, "SIGALRM", "alarm clock"}, {15, "SIGTERM", "terminated"}, {16, "SIGURG", "urgent I/O condition"}, {17, "SIGSTOP", "suspended (signal)"}, {18, "SIGTSTP", "suspended"}, {19, "SIGCONT", "continued"}, {20, "SIGCHLD", "child exited"}, {21, "SIGTTIN", "stopped (tty input)"}, {22, "SIGTTOU", "stopped (tty output)"}, {23, "SIGIO", "I/O possible"}, {24, "SIGXCPU", "cputime limit exceeded"}, {25, "SIGXFSZ", "filesize limit exceeded"}, {26, "SIGVTALRM", "virtual timer expired"}, {27, "SIGPROF", "profiling timer expired"}, {28, "SIGWINCH", "window size changes"}, {29, "SIGINFO", "information request"}, {30, "SIGUSR1", "user defined signal 1"}, {31, "SIGUSR2", "user defined signal 2"}, }
{ "pile_set_name": "Github" }
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2019 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #if defined(HAVE_CONFIG_H) #include <config/bitcoin-config.h> #endif #include <randomenv.h> #include <clientversion.h> #include <compat/cpuid.h> #include <support/cleanse.h> #include <util/time.h> // for GetTime() #ifdef WIN32 #include <compat.h> // for Windows API #endif #include <algorithm> #include <atomic> #include <chrono> #include <climits> #include <thread> #include <vector> #include <cstdint> #include <cstring> #ifndef WIN32 #include <sys/types.h> // must go before a number of other headers #include <fcntl.h> #include <netinet/in.h> #include <sys/resource.h> #include <sys/socket.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/utsname.h> #include <unistd.h> #endif #ifdef __MACH__ #include <mach/clock.h> #include <mach/mach.h> #include <mach/mach_time.h> #endif #if HAVE_DECL_GETIFADDRS #include <ifaddrs.h> #endif #if HAVE_SYSCTL #include <sys/sysctl.h> #if HAVE_VM_VM_PARAM_H #include <vm/vm_param.h> #endif #if HAVE_SYS_RESOURCES_H #include <sys/resources.h> #endif #if HAVE_SYS_VMMETER_H #include <sys/vmmeter.h> #endif #endif #ifdef __linux__ #include <sys/auxv.h> #endif //! Necessary on some platforms extern char **environ; namespace { void RandAddSeedPerfmon(CSHA512 &hasher) { #ifdef WIN32 // Seed with the entire set of perfmon data // This can take up to 2 seconds, so only do it every 10 minutes static std::atomic<std::chrono::seconds> last_perfmon{ std::chrono::seconds{0}}; auto last_time = last_perfmon.load(); auto current_time = GetTime<std::chrono::seconds>(); if (current_time < last_time + std::chrono::minutes{10}) { return; } last_perfmon = current_time; std::vector<uint8_t> vData(250000, 0); long ret = 0; unsigned long nSize = 0; // Bail out at more than 10MB of performance data const size_t nMaxSize = 10000000; while (true) { nSize = vData.size(); ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", nullptr, nullptr, vData.data(), &nSize); if (ret != ERROR_MORE_DATA || vData.size() >= nMaxSize) { break; } // Grow size of buffer exponentially vData.resize(std::max((vData.size() * 3) / 2, nMaxSize)); } RegCloseKey(HKEY_PERFORMANCE_DATA); if (ret == ERROR_SUCCESS) { hasher.Write(vData.data(), nSize); memory_cleanse(vData.data(), nSize); } else { // Performance data is only a best-effort attempt at improving the // situation when the OS randomness (and other sources) aren't // adequate. As a result, failure to read it is isn't considered // critical, so we don't call RandFailure(). // TODO: Add logging when the logger is made functional before global // constructors have been invoked. } #endif } /** Helper to easily feed data into a CSHA512. * * Note that this does not serialize the passed object (like stream.h's << * operators do). Its raw memory representation is used directly. */ template <typename T> CSHA512 &operator<<(CSHA512 &hasher, const T &data) { static_assert( !std::is_same<typename std::decay<T>::type, char *>::value, "Calling operator<<(CSHA512, char*) is probably not what you want"); static_assert( !std::is_same<typename std::decay<T>::type, uint8_t *>::value, "Calling operator<<(CSHA512, uint8_t*) is probably not what you " "want"); static_assert( !std::is_same<typename std::decay<T>::type, const char *>::value, "Calling operator<<(CSHA512, const char*) is probably not what you " "want"); static_assert( !std::is_same<typename std::decay<T>::type, const uint8_t *>::value, "Calling operator<<(CSHA512, const uint8_t*) is " "probably not what you want"); hasher.Write((const uint8_t *)&data, sizeof(data)); return hasher; } #ifndef WIN32 void AddSockaddr(CSHA512 &hasher, const struct sockaddr *addr) { if (addr == nullptr) { return; } switch (addr->sa_family) { case AF_INET: hasher.Write((const uint8_t *)addr, sizeof(sockaddr_in)); break; case AF_INET6: hasher.Write((const uint8_t *)addr, sizeof(sockaddr_in6)); break; default: hasher.Write((const uint8_t *)&addr->sa_family, sizeof(addr->sa_family)); } } void AddFile(CSHA512 &hasher, const char *path) { struct stat sb = {}; int f = open(path, O_RDONLY); size_t total = 0; if (f != -1) { uint8_t fbuf[4096]; int n; hasher.Write((const uint8_t *)&f, sizeof(f)); if (fstat(f, &sb) == 0) { hasher << sb; } do { n = read(f, fbuf, sizeof(fbuf)); if (n > 0) { hasher.Write(fbuf, n); } total += n; /* not bothering with EINTR handling. */ } while (n == sizeof(fbuf) && total < 1048576); // Read only the first 1 Mbyte close(f); } } void AddPath(CSHA512 &hasher, const char *path) { struct stat sb = {}; if (stat(path, &sb) == 0) { hasher.Write((const uint8_t *)path, strlen(path) + 1); hasher << sb; } } #endif #if HAVE_SYSCTL template <int... S> void AddSysctl(CSHA512 &hasher) { int CTL[sizeof...(S)] = {S...}; uint8_t buffer[65536]; size_t siz = 65536; int ret = sysctl(CTL, sizeof...(S), buffer, &siz, nullptr, 0); if (ret == 0 || (ret == -1 && errno == ENOMEM)) { hasher << sizeof(CTL); hasher.Write((const uint8_t *)CTL, sizeof(CTL)); if (siz > sizeof(buffer)) { siz = sizeof(buffer); } hasher << siz; hasher.Write(buffer, siz); } } #endif #ifdef HAVE_GETCPUID void inline AddCPUID(CSHA512 &hasher, uint32_t leaf, uint32_t subleaf, uint32_t &ax, uint32_t &bx, uint32_t &cx, uint32_t &dx) { GetCPUID(leaf, subleaf, ax, bx, cx, dx); hasher << leaf << subleaf << ax << bx << cx << dx; } void AddAllCPUID(CSHA512 &hasher) { uint32_t ax, bx, cx, dx; // Iterate over all standard leaves // Returns max leaf in ax AddCPUID(hasher, 0, 0, ax, bx, cx, dx); uint32_t max = ax; for (uint32_t leaf = 1; leaf <= max && leaf <= 0xFF; ++leaf) { uint32_t maxsub = 0; for (uint32_t subleaf = 0; subleaf <= 0xFF; ++subleaf) { AddCPUID(hasher, leaf, subleaf, ax, bx, cx, dx); // Iterate subleafs for leaf values 4, 7, 11, 13 if (leaf == 4) { if ((ax & 0x1f) == 0) { break; } } else if (leaf == 7) { if (subleaf == 0) { maxsub = ax; } if (subleaf == maxsub) { break; } } else if (leaf == 11) { if ((cx & 0xff00) == 0) { break; } } else if (leaf == 13) { if (ax == 0 && bx == 0 && cx == 0 && dx == 0) { break; } } else { // For any other leaf, stop after subleaf 0. break; } } } // Iterate over all extended leaves // Returns max extended leaf in ax AddCPUID(hasher, 0x80000000, 0, ax, bx, cx, dx); uint32_t ext_max = ax; for (uint32_t leaf = 0x80000001; leaf <= ext_max && leaf <= 0x800000FF; ++leaf) { AddCPUID(hasher, leaf, 0, ax, bx, cx, dx); } } #endif } // namespace void RandAddDynamicEnv(CSHA512 &hasher) { RandAddSeedPerfmon(hasher); // Various clocks #ifdef WIN32 FILETIME ftime; GetSystemTimeAsFileTime(&ftime); hasher << ftime; #else #ifndef __MACH__ // On non-MacOS systems, use various clock_gettime() calls. struct timespec ts = {}; #ifdef CLOCK_MONOTONIC clock_gettime(CLOCK_MONOTONIC, &ts); hasher << ts; #endif #ifdef CLOCK_REALTIME clock_gettime(CLOCK_REALTIME, &ts); hasher << ts; #endif #ifdef CLOCK_BOOTTIME clock_gettime(CLOCK_BOOTTIME, &ts); hasher << ts.tv_sec << ts.tv_nsec; #endif #else // On MacOS use mach_absolute_time (number of CPU ticks since boot) as a // replacement for CLOCK_MONOTONIC, and clock_get_time for CALENDAR_CLOCK as // a replacement for CLOCK_REALTIME. hasher << mach_absolute_time(); // From https://gist.github.com/jbenet/1087739 clock_serv_t cclock; mach_timespec_t mts = {}; if (host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock) == KERN_SUCCESS && clock_get_time(cclock, &mts) == KERN_SUCCESS) { hasher << mts; mach_port_deallocate(mach_task_self(), cclock); } #endif // gettimeofday is available on all UNIX systems, but only has microsecond // precision. struct timeval tv = {}; gettimeofday(&tv, nullptr); hasher << tv; #endif // Probably redundant, but also use all the clocks C++11 provides: hasher << std::chrono::system_clock::now().time_since_epoch().count(); hasher << std::chrono::steady_clock::now().time_since_epoch().count(); hasher << std::chrono::high_resolution_clock::now().time_since_epoch().count(); #ifndef WIN32 // Current resource usage. struct rusage usage = {}; if (getrusage(RUSAGE_SELF, &usage) == 0) { hasher << usage; } #endif #ifdef __linux__ AddFile(hasher, "/proc/diskstats"); AddFile(hasher, "/proc/vmstat"); AddFile(hasher, "/proc/schedstat"); AddFile(hasher, "/proc/zoneinfo"); AddFile(hasher, "/proc/meminfo"); AddFile(hasher, "/proc/softirqs"); AddFile(hasher, "/proc/stat"); AddFile(hasher, "/proc/self/schedstat"); AddFile(hasher, "/proc/self/status"); #endif #if HAVE_SYSCTL #ifdef CTL_KERN #if defined(KERN_PROC) && defined(KERN_PROC_ALL) AddSysctl<CTL_KERN, KERN_PROC, KERN_PROC_ALL>(hasher); #endif #endif #ifdef CTL_HW #ifdef HW_DISKSTATS AddSysctl<CTL_HW, HW_DISKSTATS>(hasher); #endif #endif #ifdef CTL_VM #ifdef VM_LOADAVG AddSysctl<CTL_VM, VM_LOADAVG>(hasher); #endif #ifdef VM_TOTAL AddSysctl<CTL_VM, VM_TOTAL>(hasher); #endif #ifdef VM_METER AddSysctl<CTL_VM, VM_METER>(hasher); #endif #endif #endif // Stack and heap location void *addr = malloc(4097); hasher << &addr << addr; free(addr); } void RandAddStaticEnv(CSHA512 &hasher) { // Some compile-time static properties hasher << (CHAR_MIN < 0) << sizeof(void *) << sizeof(long) << sizeof(int); #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) hasher << __GNUC__ << __GNUC_MINOR__ << __GNUC_PATCHLEVEL__; #endif #ifdef _MSC_VER hasher << _MSC_VER; #endif hasher << __cplusplus; #ifdef _XOPEN_VERSION hasher << _XOPEN_VERSION; #endif #ifdef __VERSION__ const char *COMPILER_VERSION = __VERSION__; hasher.Write((const uint8_t *)COMPILER_VERSION, strlen(COMPILER_VERSION) + 1); #endif // Bitcoin client version hasher << CLIENT_VERSION; #ifdef __linux__ // Information available through getauxval() #ifdef AT_HWCAP hasher << getauxval(AT_HWCAP); #endif #ifdef AT_HWCAP2 hasher << getauxval(AT_HWCAP2); #endif #ifdef AT_RANDOM const uint8_t *random_aux = (const uint8_t *)getauxval(AT_RANDOM); if (random_aux) { hasher.Write(random_aux, 16); } #endif #ifdef AT_PLATFORM const char *platform_str = (const char *)getauxval(AT_PLATFORM); if (platform_str) { hasher.Write((const uint8_t *)platform_str, strlen(platform_str) + 1); } #endif #ifdef AT_EXECFN const char *exec_str = (const char *)getauxval(AT_EXECFN); if (exec_str) { hasher.Write((const uint8_t *)exec_str, strlen(exec_str) + 1); } #endif #endif // __linux__ #ifdef HAVE_GETCPUID AddAllCPUID(hasher); #endif // Memory locations hasher << &hasher << &RandAddStaticEnv << &malloc << &errno << &environ; // Hostname char hname[256]; if (gethostname(hname, 256) == 0) { hasher.Write((const uint8_t *)hname, strnlen(hname, 256)); } #if HAVE_DECL_GETIFADDRS // Network interfaces struct ifaddrs *ifad = NULL; getifaddrs(&ifad); struct ifaddrs *ifit = ifad; while (ifit != NULL) { hasher.Write((const uint8_t *)&ifit, sizeof(ifit)); hasher.Write((const uint8_t *)ifit->ifa_name, strlen(ifit->ifa_name) + 1); hasher.Write((const uint8_t *)&ifit->ifa_flags, sizeof(ifit->ifa_flags)); AddSockaddr(hasher, ifit->ifa_addr); AddSockaddr(hasher, ifit->ifa_netmask); AddSockaddr(hasher, ifit->ifa_dstaddr); ifit = ifit->ifa_next; } freeifaddrs(ifad); #endif #ifndef WIN32 // UNIX kernel information struct utsname name; if (uname(&name) != -1) { hasher.Write((const uint8_t *)&name.sysname, strlen(name.sysname) + 1); hasher.Write((const uint8_t *)&name.nodename, strlen(name.nodename) + 1); hasher.Write((const uint8_t *)&name.release, strlen(name.release) + 1); hasher.Write((const uint8_t *)&name.version, strlen(name.version) + 1); hasher.Write((const uint8_t *)&name.machine, strlen(name.machine) + 1); } /* Path and filesystem provided data */ AddPath(hasher, "/"); AddPath(hasher, "."); AddPath(hasher, "/tmp"); AddPath(hasher, "/home"); AddPath(hasher, "/proc"); #ifdef __linux__ AddFile(hasher, "/proc/cmdline"); AddFile(hasher, "/proc/cpuinfo"); AddFile(hasher, "/proc/version"); #endif AddFile(hasher, "/etc/passwd"); AddFile(hasher, "/etc/group"); AddFile(hasher, "/etc/hosts"); AddFile(hasher, "/etc/resolv.conf"); AddFile(hasher, "/etc/timezone"); AddFile(hasher, "/etc/localtime"); #endif // For MacOS/BSDs, gather data through sysctl instead of /proc. Not all of // these will exist on every system. #if HAVE_SYSCTL #ifdef CTL_HW #ifdef HW_MACHINE AddSysctl<CTL_HW, HW_MACHINE>(hasher); #endif #ifdef HW_MODEL AddSysctl<CTL_HW, HW_MODEL>(hasher); #endif #ifdef HW_NCPU AddSysctl<CTL_HW, HW_NCPU>(hasher); #endif #ifdef HW_PHYSMEM AddSysctl<CTL_HW, HW_PHYSMEM>(hasher); #endif #ifdef HW_USERMEM AddSysctl<CTL_HW, HW_USERMEM>(hasher); #endif #ifdef HW_MACHINE_ARCH AddSysctl<CTL_HW, HW_MACHINE_ARCH>(hasher); #endif #ifdef HW_REALMEM AddSysctl<CTL_HW, HW_REALMEM>(hasher); #endif #ifdef HW_CPU_FREQ AddSysctl<CTL_HW, HW_CPU_FREQ>(hasher); #endif #ifdef HW_BUS_FREQ AddSysctl<CTL_HW, HW_BUS_FREQ>(hasher); #endif #ifdef HW_CACHELINE AddSysctl<CTL_HW, HW_CACHELINE>(hasher); #endif #endif #ifdef CTL_KERN #ifdef KERN_BOOTFILE AddSysctl<CTL_KERN, KERN_BOOTFILE>(hasher); #endif #ifdef KERN_BOOTTIME AddSysctl<CTL_KERN, KERN_BOOTTIME>(hasher); #endif #ifdef KERN_CLOCKRATE AddSysctl<CTL_KERN, KERN_CLOCKRATE>(hasher); #endif #ifdef KERN_HOSTID AddSysctl<CTL_KERN, KERN_HOSTID>(hasher); #endif #ifdef KERN_HOSTUUID AddSysctl<CTL_KERN, KERN_HOSTUUID>(hasher); #endif #ifdef KERN_HOSTNAME AddSysctl<CTL_KERN, KERN_HOSTNAME>(hasher); #endif #ifdef KERN_OSRELDATE AddSysctl<CTL_KERN, KERN_OSRELDATE>(hasher); #endif #ifdef KERN_OSRELEASE AddSysctl<CTL_KERN, KERN_OSRELEASE>(hasher); #endif #ifdef KERN_OSREV AddSysctl<CTL_KERN, KERN_OSREV>(hasher); #endif #ifdef KERN_OSTYPE AddSysctl<CTL_KERN, KERN_OSTYPE>(hasher); #endif #ifdef KERN_POSIX1 AddSysctl<CTL_KERN, KERN_OSREV>(hasher); #endif #ifdef KERN_VERSION AddSysctl<CTL_KERN, KERN_VERSION>(hasher); #endif #endif #endif // Env variables if (environ) { for (size_t i = 0; environ[i]; ++i) { hasher.Write((const uint8_t *)environ[i], strlen(environ[i])); } } // Process, thread, user, session, group, ... ids. #ifdef WIN32 hasher << GetCurrentProcessId() << GetCurrentThreadId(); #else hasher << getpid() << getppid() << getsid(0) << getpgid(0) << getuid() << geteuid() << getgid() << getegid(); #endif hasher << std::this_thread::get_id(); }
{ "pile_set_name": "Github" }
/* * Copyright 2016, Joyent, Inc. All rights reserved. * Author: Alex Wilson <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ module.exports = { getPass: getPass }; const mod_tty = require('tty'); const mod_fs = require('fs'); const mod_assert = require('assert-plus'); var BACKSPACE = String.fromCharCode(127); var CTRLC = '\u0003'; var CTRLD = '\u0004'; function getPass(opts, cb) { if (typeof (opts) === 'function' && cb === undefined) { cb = opts; opts = {}; } mod_assert.object(opts, 'options'); mod_assert.func(cb, 'callback'); mod_assert.optionalString(opts.prompt, 'options.prompt'); if (opts.prompt === undefined) opts.prompt = 'Password'; openTTY(function (err, rfd, wfd, rtty, wtty) { if (err) { cb(err); return; } wtty.write(opts.prompt + ':'); rtty.resume(); rtty.setRawMode(true); rtty.resume(); rtty.setEncoding('utf8'); var pw = ''; rtty.on('data', onData); function onData(data) { var str = data.toString('utf8'); for (var i = 0; i < str.length; ++i) { var ch = str[i]; switch (ch) { case '\r': case '\n': case CTRLD: cleanup(); cb(null, pw); return; case CTRLC: cleanup(); cb(new Error('Aborted')); return; case BACKSPACE: pw = pw.slice(0, pw.length - 1); break; default: pw += ch; break; } } } function cleanup() { wtty.write('\r\n'); rtty.setRawMode(false); rtty.pause(); rtty.removeListener('data', onData); if (wfd !== undefined && wfd !== rfd) { wtty.end(); mod_fs.closeSync(wfd); } if (rfd !== undefined) { rtty.end(); mod_fs.closeSync(rfd); } } }); } function openTTY(cb) { mod_fs.open('/dev/tty', 'r+', function (err, rttyfd) { if ((err && (err.code === 'ENOENT' || err.code === 'EACCES')) || (process.version.match(/^v0[.][0-8][.]/))) { cb(null, undefined, undefined, process.stdin, process.stdout); return; } var rtty = new mod_tty.ReadStream(rttyfd); mod_fs.open('/dev/tty', 'w+', function (err3, wttyfd) { var wtty = new mod_tty.WriteStream(wttyfd); if (err3) { cb(err3); return; } cb(null, rttyfd, wttyfd, rtty, wtty); }); }); }
{ "pile_set_name": "Github" }
using System.Collections.Generic; using System.Text.Json.Serialization; namespace Essensoft.AspNetCore.Payment.Alipay.Domain { /// <summary> /// MybankCreditLoantradePayAssetConsultModel Data Structure. /// </summary> public class MybankCreditLoantradePayAssetConsultModel : AlipayObject { /// <summary> /// 支付宝合作伙伴id /// </summary> [JsonPropertyName("alipay_partner_id")] public string AlipayPartnerId { get; set; } /// <summary> /// 申请金额,最小1元钱 /// </summary> [JsonPropertyName("apply_amt")] public CreditPayMoneyVO ApplyAmt { get; set; } /// <summary> /// 业务场景 /// </summary> [JsonPropertyName("biz_scene")] public string BizScene { get; set; } /// <summary> /// 咨询资产类型,LOAN_INSTALLMENT或者BILL /// </summary> [JsonPropertyName("credit_asset_types")] public List<string> CreditAssetTypes { get; set; } /// <summary> /// 交易订单信息,JSON数组格式的***字符串***,用于描述交易订单详情。再次强调,该字段是字符串形式,用于当做订单扩展使用。序列化整个请求的时候,这个字段一定要是字符串类型,只不过该字段产生,需要将订单List额外进行一次json序列化 /// </summary> [JsonPropertyName("order_infos")] public string OrderInfos { get; set; } /// <summary> /// 收单产品码 /// </summary> [JsonPropertyName("payment_sale_pd_code")] public string PaymentSalePdCode { get; set; } /// <summary> /// 平台类型 /// </summary> [JsonPropertyName("platform_type")] public string PlatformType { get; set; } /// <summary> /// 子业务类型 /// </summary> [JsonPropertyName("sub_biz_scene")] public string SubBizScene { get; set; } /// <summary> /// 子平台类型 /// </summary> [JsonPropertyName("sub_platform_type")] public string SubPlatformType { get; set; } /// <summary> /// 咨询用户信息 /// </summary> [JsonPropertyName("user")] public CreditPayUserVO User { get; set; } } }
{ "pile_set_name": "Github" }
'use strict'; // modified from https://github.com/es-shims/es5-shim var has = Object.prototype.hasOwnProperty; var toStr = Object.prototype.toString; var slice = Array.prototype.slice; var isArgs = require('./isArguments'); var isEnumerable = Object.prototype.propertyIsEnumerable; var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString'); var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype'); var dontEnums = [ 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' ]; var equalsConstructorPrototype = function (o) { var ctor = o.constructor; return ctor && ctor.prototype === o; }; var excludedKeys = { $console: true, $external: true, $frame: true, $frameElement: true, $frames: true, $innerHeight: true, $innerWidth: true, $outerHeight: true, $outerWidth: true, $pageXOffset: true, $pageYOffset: true, $parent: true, $scrollLeft: true, $scrollTop: true, $scrollX: true, $scrollY: true, $self: true, $webkitIndexedDB: true, $webkitStorageInfo: true, $window: true }; var hasAutomationEqualityBug = (function () { /* global window */ if (typeof window === 'undefined') { return false; } for (var k in window) { try { if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') { try { equalsConstructorPrototype(window[k]); } catch (e) { return true; } } } catch (e) { return true; } } return false; }()); var equalsConstructorPrototypeIfNotBuggy = function (o) { /* global window */ if (typeof window === 'undefined' || !hasAutomationEqualityBug) { return equalsConstructorPrototype(o); } try { return equalsConstructorPrototype(o); } catch (e) { return false; } }; var keysShim = function keys(object) { var isObject = object !== null && typeof object === 'object'; var isFunction = toStr.call(object) === '[object Function]'; var isArguments = isArgs(object); var isString = isObject && toStr.call(object) === '[object String]'; var theKeys = []; if (!isObject && !isFunction && !isArguments) { throw new TypeError('Object.keys called on a non-object'); } var skipProto = hasProtoEnumBug && isFunction; if (isString && object.length > 0 && !has.call(object, 0)) { for (var i = 0; i < object.length; ++i) { theKeys.push(String(i)); } } if (isArguments && object.length > 0) { for (var j = 0; j < object.length; ++j) { theKeys.push(String(j)); } } else { for (var name in object) { if (!(skipProto && name === 'prototype') && has.call(object, name)) { theKeys.push(String(name)); } } } if (hasDontEnumBug) { var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object); for (var k = 0; k < dontEnums.length; ++k) { if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) { theKeys.push(dontEnums[k]); } } } return theKeys; }; keysShim.shim = function shimObjectKeys() { if (Object.keys) { var keysWorksWithArguments = (function () { // Safari 5.0 bug return (Object.keys(arguments) || '').length === 2; }(1, 2)); if (!keysWorksWithArguments) { var originalKeys = Object.keys; Object.keys = function keys(object) { if (isArgs(object)) { return originalKeys(slice.call(object)); } else { return originalKeys(object); } }; } } else { Object.keys = keysShim; } return Object.keys || keysShim; }; module.exports = keysShim;
{ "pile_set_name": "Github" }
es { teststring:string { "Hola Mundo!" } testint:int { 2 } testvector:intvector { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 } testbin:bin { a1b2c3d4e5f67890 } testtable:table { major:int { 3 } minor:int { 4 } patch:int { 7 } } testarray:array { "cadena 1", "cadena 2", "cadena 3" } }
{ "pile_set_name": "Github" }
/** * Copyright (c) 2009 Ma Can <[email protected]> * <[email protected]> * * Armed with EMACS. * Time-stamp: <2011-10-11 07:19:00 macan> * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "mds.h" #include "xnet.h" #include "branch.h" #define FORMAT_STRING "type:bdb;schema:default_db:default" /* this default trigger work following the rules bellow: * * TRIG on post-CREATE operation * Construct a file creation time string and send it to a selected BP site. */ int dt_main(u16 where, struct itb *itb, struct ite *ite, struct hvfs_index *hi, int status, void *arg) { struct dir_trigger __attribute__((unused)) *dt = (struct dir_trigger *)arg; struct branch_ops *bo; struct branch_entry *be; char branch_name[256]; char tag[256], kvs[256], *p; int err = 0; if (status) goto out; if (where == DIR_TRIG_POST_CREATE) { memset(tag, 0, sizeof(tag)); memset(kvs, 0, sizeof(kvs)); p = tag; p += sprintf(p, "%lx:", itb->h.puuid); if (hi->flag & INDEX_BY_NAME) { memcpy(p, hi->name, hi->namelen); p += hi->namelen; } p += sprintf(p, ":%lx:%lx", hi->uuid, hi->hash); p = kvs; p += sprintf(p, "@ctime=%ld", ite->s.mdu.ctime); /* Step 1: try to load the branch 'default-puuid' */ memset(branch_name, 0, sizeof(branch_name)); sprintf(branch_name, "default-%lx", hi->puuid); be = branch_lookup_load(branch_name); if (PTR_ERR(be) == -ENOENT) { /* create it now */ bo = alloca(sizeof(*bo) + sizeof(struct branch_op)); if (!bo) { goto out; } bo->nr = 1; bo->ops[0].op = BRANCH_OP_INDEXER; bo->ops[0].len = strlen(FORMAT_STRING); bo->ops[0].id = 1; bo->ops[0].rid = 0; bo->ops[0].lor = 0; bo->ops[0].data = FORMAT_STRING; err = branch_create(hi->puuid, hi->uuid, branch_name, "default", 1, bo); if (err) { hvfs_err(xnet, "branch_create(%s) failed w/ %d\n", branch_name, err); goto out; } } else if (IS_ERR(be)) { hvfs_err(xnet, "branch_load(%s) failed w/ %ld\n", branch_name, PTR_ERR(be)); goto out; } else { branch_put(be); } /* Step 2: publish the string to the branch */ err = branch_publish(hi->puuid, hi->uuid, branch_name, tag, 1, kvs, p - kvs); if (err) { hvfs_err(xnet, "branch_publish(%s) to B'%s' failed w/ %d\n", tag, branch_name, err); goto out; } } else if (where == DIR_TRIG_POST_UNLINK) { memset(tag, 0, sizeof(tag)); memset(kvs, 0, sizeof(kvs)); p = tag; p += sprintf(p, "-%lx:", itb->h.puuid); if (hi->flag & INDEX_BY_NAME) { memcpy(p, hi->name, hi->namelen); p += hi->namelen; } p += sprintf(p, ":%lx:%lx", hi->uuid, hi->hash); p = kvs; p += sprintf(p, "@ctime=%ld", ite->s.mdu.ctime); /* Step 1: try to load the branch 'default-puuid' */ memset(branch_name, 0, sizeof(branch_name)); sprintf(branch_name, "default-%lx", hi->puuid); be = branch_lookup_load(branch_name); if (PTR_ERR(be) == -ENOENT) { /* create it now */ bo = alloca(sizeof(*bo) + sizeof(struct branch_op)); if (!bo) { goto out; } bo->nr = 1; bo->ops[0].op = BRANCH_OP_INDEXER; bo->ops[0].len = strlen(FORMAT_STRING); bo->ops[0].id = 1; bo->ops[0].rid = 0; bo->ops[0].lor = 0; bo->ops[0].data = FORMAT_STRING; err = branch_create(hi->puuid, hi->uuid, branch_name, "default", 1, bo); if (err) { hvfs_err(xnet, "branch_create(%s) failed w/ %d\n", branch_name, err); goto out; } } else if (IS_ERR(be)) { hvfs_err(xnet, "branch_load(%s) failed w/ %ld\n", branch_name, PTR_ERR(be)); goto out; } else { branch_put(be); } /* Step 2: publish the string to the branch */ err = branch_publish(hi->puuid, hi->uuid, branch_name, tag, 1, kvs, p - kvs); if (err) { hvfs_err(xnet, "branch_publish(%s) to B'%s' failed w/ %d\n", tag, branch_name, err); goto out; } } out: return TRIG_CONTINUE; }
{ "pile_set_name": "Github" }
#pragma once #include "guiBaseObject.h" #include "guiTypeGroup.h" #include "guiColor.h" #include "simpleColor.h" #include "guiValue.h" #define LOCK_WIDTH 10 #define LOCK_HEIGHT 10 #define LOCK_BORDER 3 #define panelSpacing 10 #define tabWidth 25.f #define tabHeight 10.f #define tabPadding 2.0f class guiTypePanel : public guiBaseObject{ public: //------------------------------------------------ //override because of tab void updateBoundingBox(){ hitArea.y = (int)boundingBox.y + tabHeight; boundingBox.height = hitArea.height; } //------------------------------------------------ guiTypePanel(){ currentXPos = panelSpacing; currentYPos = panelSpacing; spacingAmntX = panelSpacing; spacingAmntY = panelSpacing; columns.clear(); columns.push_back(ofRectangle(20, 20, 30, 20)); col = 0; bDrawLock = false; tabRect.x = 0; tabRect.y = 0; tabRect.width = tabWidth; tabRect.height = tabHeight; bSelected = false; setGroupBgColor(255,255,255,255); } //------------------------------------------------ void setup(string panelName, float defaultX = 20, float defaultY = 10){ name = panelName; columns[0] = ofRectangle(defaultX, defaultY, 50, 20); //we don't want our panel flashing when we click :) bgColor.selected = bgColor.color; outlineColor.selected = outlineColor.color; updateText(); tabRect.width = displayText.getTextWidth() + tabPadding*2; tabRect.height = displayText.getTextSingleLineHeight()*1.5f; groupBg.x = panelSpacing; groupBg.width = getWidth() - panelSpacing*2; groupBg.y = panelSpacing; } //----------------------------------------------- void addColumn(float minWidth){ float colX = columns.back().x + columns.back().width + spacingAmntX; columns.push_back(ofRectangle(colX, 20, minWidth, 20)); } //----------------------------------------------- bool selectColumn(int which){ col = ofClamp(which, 0, columns.size()-1); return true; } //----------------------------------------------- void setElementSpacing(float spacingX, float spacingY){ spacingAmntX = spacingX; spacingAmntY = spacingY; } //----------------------------------------------- void setTabPosition(float tabX, float tabY){ tabRect.x = tabX; tabRect.y = tabY; } //----------------------------------------------- ofRectangle getTabRect(){ return tabRect; } //-----------------------------------------------. virtual bool checkHit(float x, float y, bool isRelative){ if(readOnly)return false; if( x >= hitArea.x && x <= hitArea.x + hitArea.width && y >= hitArea.y && y <= hitArea.y + hitArea.height){ state = SG_STATE_SELECTED; float xx = x - boundingBox.x; float yy = y - boundingBox.y; if( xx > lockRect.x && xx < lockRect.x + lockRect.width && yy > lockRect.y && yy < lockRect.y + lockRect.height ){ locked = !locked; } setSelected(); updateGui(x, y, true, isRelative); if( !locked ){ float offsetX = x - hitArea.x; float offsetY = y - hitArea.y; for(int i = 0; i < children.size(); i++){ children[i]->bTextEnterMode = false; children[i]->release(); } bTextEnterMode = false; for(int i = 0; i < children.size(); i++){ children[i]->bTextEnterMode = bTextEnterMode; children[i]->checkHit(offsetX, offsetY, isRelative); if (children[i]->bTextEnterMode){ bTextEnterMode = true; } } } else { resetChildren(); } return true; } return false; } //-----------------------------------------------. virtual void keyPressed(int key){ if( !locked ){ for(int i = 0; i < children.size(); i++){ //if (children[i]->state == SG_STATE_SELECTED) children[i]->keyPressed(key); children[i]->keyPressed(key); } } } //-----------------------------------------------. void updateGui(float x, float y, bool firstHit, bool isRelative){ if( state == SG_STATE_SELECTED){ float offsetX = 0; float offsetY = 0; if( isRelative ){ offsetX = x; offsetY = y; }else{ offsetX = x - hitArea.x; offsetY = y - hitArea.y; } if( !locked ){ for(int i = 0; i < children.size(); i++){ children[i]->updateGui(offsetX, offsetY, firstHit, isRelative); } } } } //we should actually be checking our child heights //every frame to see if the panel needs to adjust layout //for now we only check heights when elements are first added //---------------------------------------------- virtual void update(){ updateText(); lockRect.x = boundingBox.width - (LOCK_WIDTH + spacingAmntX + LOCK_BORDER); lockRect.y = spacingAmntY - LOCK_BORDER; lockRect.width = LOCK_WIDTH + LOCK_BORDER * 2; lockRect.height = LOCK_HEIGHT + LOCK_BORDER * 2; for(int i = 0; i < children.size(); i++){ children[i]->update(); } for(int i = 0; i < whichColumn.size(); i++){ if( children[i]->boundingBox.x != columns[whichColumn[i]].x ){ float amntToShiftX = columns[whichColumn[i]].x - children[i]->boundingBox.x; children[i]->hitArea.x += amntToShiftX; children[i]->boundingBox.x += amntToShiftX; } } //reset y positions (if elements are added / dimensions changed) currentYPos = panelSpacing; for(int i = 0; i < children.size(); i++){ children[i]->boundingBox.y = (int) currentYPos; currentYPos += children[i]->getHeight() + spacingAmntY; } //update group bg groupBg.height = 0; groupBg.width = getWidth() - panelSpacing*2; if (groups.size() > 0) groupBg.height = panelSpacing + groups[groups.size()-1]->boundingBox.y + groups[groups.size()-1]->getHeight(); } //----------------------------------------------- void addElement( guiBaseObject * element ){ element->updateText(); //currentYPos = 0; currentYPos = panelSpacing; for(int i = 0; i < children.size(); i++){ children[i]->setPosition((int)children[i]->getPosX(), (int)currentYPos); currentYPos += children[i]->getHeight() + spacingAmntY; } element->setPosition((int)columns[col].x, (int)currentYPos); whichColumn.push_back(col); //add the element to the panel list children.push_back( element ); //update the current position for the next element columns[col].y += element->getHeight() + spacingAmntY; float checkWidth = element->getWidth(); if(checkWidth >= columns[col].width ){ float amnt = checkWidth - columns[col].width; columns[col].width += amnt; for(int i = col+1; i < columns.size(); i++){ columns[i].x += amnt; } } //see if we need to resize! //checkResize(element); } //-----------------------------------------------. void drawLocked(){ ofPushMatrix(); ofFill(); ofTranslate(lockRect.x, lockRect.y, 0); ofSetColor(200, 0, 0); ofDrawRectangle(0, 0, lockRect.width, lockRect.height); ofTranslate(LOCK_BORDER, LOCK_BORDER, 0); ofSetColor(255, 255, 255); ofDrawEllipse(LOCK_WIDTH/2, LOCK_HEIGHT/2, LOCK_WIDTH * 0.8, LOCK_HEIGHT * 0.9); ofSetColor(200, 0, 0); ofDrawEllipse(LOCK_WIDTH/2, LOCK_HEIGHT/2, LOCK_WIDTH * 0.8 * 0.6, LOCK_HEIGHT * 0.9 * 0.6); ofSetColor(255, 255, 255); ofDrawRectangle(0, LOCK_HEIGHT/2, LOCK_WIDTH, LOCK_HEIGHT/2); ofPopMatrix(); } //-----------------------------------------------. void drawUnlocked(){ ofPushMatrix(); ofFill(); ofTranslate(lockRect.x, lockRect.y, 0); ofSetColor(0, 0, 0); ofDrawRectangle(0, 0, lockRect.width, lockRect.height); ofTranslate(LOCK_BORDER, LOCK_BORDER, 0); ofSetColor(255, 255, 255); ofDrawEllipse(LOCK_WIDTH/2, LOCK_HEIGHT * 0.4, LOCK_WIDTH * 0.8, LOCK_HEIGHT * 0.9); ofSetColor(0, 0, 0); ofDrawEllipse(LOCK_WIDTH/2, LOCK_HEIGHT * 0.44, LOCK_WIDTH * 0.8 * 0.6, LOCK_HEIGHT * 0.9 * 0.6); ofSetColor(255, 255, 255); ofDrawRectangle(0, LOCK_HEIGHT/2, LOCK_WIDTH, LOCK_HEIGHT/2); ofSetColor(0, 0, 0); ofDrawRectangle(0, LOCK_HEIGHT * 0.5 - LOCK_HEIGHT * 0.25 , LOCK_WIDTH * 0.35, LOCK_HEIGHT * 0.25); ofPopMatrix(); } //-----------------------------------------------. void setDrawLock( bool _bDrawLock ){ bDrawLock = _bDrawLock; } //-----------------------------------------------. void render(){ if (!enabled) return; ofPushStyle();{ ofPushMatrix();{ ofTranslate(boundingBox.x, boundingBox.y, 0); //draw the background ofFill(); ofSetColor(bgColor.getColor().r, bgColor.getColor().g, bgColor.getColor().b, bgColor.getColor().a); ofDrawRectangle(0, 0, boundingBox.width, boundingBox.height); //draw the outline ofNoFill(); ofSetColor(outlineColor.getColor().r, outlineColor.getColor().g, outlineColor.getColor().b, outlineColor.getColor().a); ofBeginShape(); ofVertex(tabRect.x-boundingBox.x, 0); ofVertex(0, 0); ofVertex(0, boundingBox.height); ofVertex(boundingBox.width, boundingBox.height); ofVertex(boundingBox.width, 0); ofVertex(tabRect.x-boundingBox.x+tabRect.width, 0); ofEndShape(false); if (groups.size() > 0){ ofFill(); ofSetColor(groupBgColor.getColor().r, groupBgColor.getColor().g, groupBgColor.getColor().b, groupBgColor.getColor().a); ofDrawRectangle(groupBg.x, groupBg.y, groupBg.width, groupBg.height); } if (bDrawLock){ if( locked ){ drawLocked(); } else { drawUnlocked(); } } }ofPopMatrix(); ofPushMatrix();{ ofTranslate(hitArea.x, hitArea.y, 0); for(int i = 0; i < children.size(); i++){ children[i]->render(); } } glPopMatrix(); } ofPopStyle(); renderTab(); } //-----------------------------------------------. void renderTab(){ ofPushStyle(); //draw tab ofPushMatrix(); ofTranslate(tabRect.x, tabRect.y); ofFill(); if (bSelected){ ofSetColor(bgColor.getColor().r, bgColor.getColor().g, bgColor.getColor().b, bgColor.getColor().a); ofBeginShape(); ofVertex(0, tabRect.height); ofVertex(0, 0); ofVertex(tabRect.width, 0); ofVertex(tabRect.width, tabRect.height); ofEndShape(false); } else { ofSetColor(bgColor.getColor().r, bgColor.getColor().g, bgColor.getColor().b, bgColor.getColor().a); ofDrawRectangle(0,0,tabRect.width, tabRect.height-1); } //ofDrawRectangle(0,0,tabRect.width, tabRect.height); ofNoFill(); ofSetColor(outlineColor.getColor().r, outlineColor.getColor().g, outlineColor.getColor().b, outlineColor.getColor().a); ofBeginShape(); ofVertex(0, tabRect.height); ofVertex(0, 0); ofVertex(tabRect.width, 0); ofVertex(tabRect.width, tabRect.height); ofEndShape(false); ofPopMatrix(); renderText(tabRect.x + tabPadding, tabRect.y); ofPopStyle(); }; //-----------------------------------------------. void setGroupBgColor( int r, int g, int b, int a ){ groupBgColor.setColor(r,g,b,a); } bool bSelected; bool bDrawLock; ofRectangle lockRect; ofRectangle tabRect; float currentXPos; float currentYPos; float spacingAmntX; float spacingAmntY; vector <ofRectangle> columns; vector <guiTypeGroup *> groups; ofRectangle groupBg; guiColor groupBgColor; vector <int> whichColumn; int col; };
{ "pile_set_name": "Github" }
import generateGlobalActions from '../../../src/internals/actions/generateGlobalActions'; describe('generateGlobalActions', () => { test('only path', () => { expect(generateGlobalActions()).toMatchSnapshot(); }); });
{ "pile_set_name": "Github" }
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.serialization import Model class ExtractedKeyValuePair(Model): """Representation of a key-value pair as a list of key and value tokens. :param key: List of tokens for the extracted key in a key-value pair. :type key: list[~azure.cognitiveservices.formrecognizer.models.ExtractedToken] :param value: List of tokens for the extracted value in a key-value pair. :type value: list[~azure.cognitiveservices.formrecognizer.models.ExtractedToken] """ _attribute_map = { 'key': {'key': 'key', 'type': '[ExtractedToken]'}, 'value': {'key': 'value', 'type': '[ExtractedToken]'}, } def __init__(self, *, key=None, value=None, **kwargs) -> None: super(ExtractedKeyValuePair, self).__init__(**kwargs) self.key = key self.value = value
{ "pile_set_name": "Github" }
Below is the original copyright notice from libxml2. Files in this directory are highly-modified parts of libxml2 library and its python bindings. Except where otherwise noted in the source code (trio files, hash.c and list.c) covered by a similar licence but with different Copyright notices: Copyright (C) 1998-2002 Daniel Veillard. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is fur- nished 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, FIT- NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON- NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of Daniel Veillard shall not be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from him.
{ "pile_set_name": "Github" }
world
{ "pile_set_name": "Github" }
/* * Copyright 2016 LinkedIn Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ import Ember from 'ember'; export default Ember.Component.extend({ });
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>SFML - Simple and Fast Multimedia Library</title> <meta http-equiv="Content-Type" content="text/html;"/> <meta charset="utf-8"/> <!--<link rel='stylesheet' type='text/css' href="http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>--> <link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" /> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> </head> <body> <div id="banner-container"> <div id="banner"> <span id="sfml">SFML 2.4.2</span> </div> </div> <div id="content"> <!-- Generated by Doxygen 1.8.8 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="pages.html"><span>Related&#160;Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><b>sf</b></li><li class="navelem"><a class="el" href="classsf_1_1AlResource.html">AlResource</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">sf::AlResource Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="classsf_1_1AlResource.html">sf::AlResource</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="classsf_1_1AlResource.html#a51b4f3a825c5d68386f8683e3e1053d7">AlResource</a>()</td><td class="entry"><a class="el" href="classsf_1_1AlResource.html">sf::AlResource</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> <tr><td class="entry"><a class="el" href="classsf_1_1AlResource.html#a74ad78198cddcb6e5d847177364049db">~AlResource</a>()</td><td class="entry"><a class="el" href="classsf_1_1AlResource.html">sf::AlResource</a></td><td class="entry"><span class="mlabel">protected</span></td></tr> </table></div><!-- contents --> </div> <div id="footer-container"> <div id="footer"> SFML is licensed under the terms and conditions of the <a href="http://www.sfml-dev.org/license.php">zlib/png license</a>.<br> Copyright &copy; Laurent Gomila &nbsp;::&nbsp; Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> &nbsp;::&nbsp; </div> </div> </body> </html>
{ "pile_set_name": "Github" }
.. # .. # @BEGIN LICENSE .. # .. # Psi4: an open-source quantum chemistry software package .. # .. # Copyright (c) 2007-2019 The Psi4 Developers. .. # .. # The copyrights for code used from other parties are included in .. # the corresponding files. .. # .. # This file is part of Psi4. .. # .. # Psi4 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, version 3. .. # .. # Psi4 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 Psi4; if not, write to the Free Software Foundation, Inc., .. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. .. # .. # @END LICENSE .. # .. include:: autodoc_abbr_options_c.rst .. index:: adcc, ADC .. _`sec:adcc`: Interface to adcc by M. F. Herbst and M. Scheurer ================================================= .. codeauthor:: Michael F. Herbst .. sectionauthor:: Michael F. Herbst *Module:* :ref:`Keywords <apdx:adc>`, :ref:`PSI Variables <apdx:adc_psivar>` .. image:: https://img.shields.io/badge/home-adcc-informational.svg :target: https://code.adc-connect.org .. raw:: html <br> .. image:: https://img.shields.io/badge/docs-latest-5077AB.svg :target: http://adc-connect.org/latest |PSIfour| contains code to interface to the adcc python module developed by M. F. Herbst *et. al.*. No additional licence or configuration is required to use adcc. The module serves as the backend for most algebraic-diagrammatic construction methods for correlated excited states in |PSIfour|. For more details on ADC methods, see :req:`sec:adc`. Installation ~~~~~~~~~~~~ For up to date information and more details, see the `adcc documentation <https://adc-connect.org/latest/installation.html>`_. **Binary** * .. image:: https://anaconda.org/adcc/adcc/badges/version.svg :target: https://anaconda.org/adcc/adcc * .. image:: https://img.shields.io/pypi/v/adcc :target: https://pypi.org/project/adcc * adcc is available as a conda package for Linux and macOS and on pypi. .. * If using the |PSIfour| binary, adcc has already been installed alongside. .. .. * If using |PSIfour| built from source, and anaconda or miniconda has .. already been installed (instructions at :ref:`sec:quickconda`), .. adcc can be obtained through ``conda install adcc -c adcc``. .. Then enable it as a feature with :makevar:`ENABLE_adcc` .. and rebuild |PSIfour| to detect adcc and activate dependent code. .. .. * Previous bullet had details. To build |PSIfour| from source and use .. adcc from conda without thinking, consult :ref:`sec:condapsi4dev`. * To remove a conda installation, ``conda remove adcc``. **Source** * .. image:: https://img.shields.io/github/tag-date/adc-connect/adcc.svg?maxAge=2592000 :target: https://github.com/adc-connect/adcc * If using |PSIfour| built from source and you want adcc installed as well, enable it as a feature with :makevar:`ENABLE_adcc`, and let the build system fetch and install it. Keywords for adcc ~~~~~~~~~~~~~~~~~ .. include:: autodir_options_c/adc__cutoff_amps_print.rst .. include:: autodir_options_c/adc__kind.rst .. include:: autodir_options_c/adc__max_num_vecs.rst .. include:: autodir_options_c/adc__maxiter.rst .. include:: autodir_options_c/adc__num_core_orbitals.rst .. include:: autodir_options_c/adc__num_guesses.rst .. include:: autodir_options_c/adc__r_convergence.rst .. include:: autodir_options_c/adc__reference.rst .. include:: autodir_options_c/adc__roots_per_irrep.rst .. _`cmake:adcc`: How to configure adcc for building Psi4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ **Role and Dependencies** * Role |w---w| In |PSIfour|, adcc provides additional quantum-chemical methods (a wide range of ADC methods). In turn adcc can use |PSIfour| as the backend for self-consistent field calculations and required integrals. * Downstream Dependencies |w---w| |PSIfour| (\ |dr| optional) adcc * Upstream Dependencies |w---w| adcc (\ |dr| optional) |PSIfour| **CMake Variables** * :makevar:`ENABLE_adcc` |w---w| CMake variable toggling whether Psi4 automatically installs adcc **Examples** A. Build and install adcc if needed .. code-block:: bash >>> cmake -DENABLE_adcc=ON B. Build *without* adcc .. code-block:: bash >>> cmake
{ "pile_set_name": "Github" }