text stringlengths 2 99k | meta dict |
|---|---|
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0" />
<link rel="stylesheet" href="http://<%=cfg.ip%>:<%=cfg.port%>/static/animation.css">
<link rel="stylesheet" href="http://<%=cfg.ip%>:<%=cfg.port%>/static/show.css">
<!--page-->
<div id="contain" class="container">
<% if(designInfos.music){%>
<div id="musicIcon" class="music-icon rotate"></div>
<% } %>
<div class="arrow">
<img src="http://<%=cfg.ip%>:<%=cfg.port%>/static/arrow.png"></img>
</div>
<% for(var i=0;i<designInfos.pages.length;i++){ %>
<div class="pages page-hide" style="z-index: <%=designInfos.pages.length-i%>;background-color: <%=designInfos.pages[i].backgroundColor%>">
<!--text begin-->
<% for(var j=0;j<designInfos.pages[i].text.length;j++){ %>
<div class="block" id="<%=designInfos.pages[i].text[j].id%>" style="
<%for(var s in designInfos.pages[i].text[j].style){%>
<%=s%>:<%=designInfos.pages[i].text[j].style[s]%>;
<% } %>
display:none;
">
<%=designInfos.pages[i].text[j].text %>
</div>
<% } %>
<!--text end-->
<!--image begin-->
<% for(var j=0;j<designInfos.pages[i].image.length;j++){ %>
<image class="block" id="<%=designInfos.pages[i].image[j].id%>" style="
<%for(var s in designInfos.pages[i].image[j].style){%>
<%=s%>:<%=designInfos.pages[i].image[j].style[s]%>;
<% } %>
display:none;
" src="http://<%=cfg.ip%>:<%=cfg.port%>/H5/image?id=<%=designInfos.pages[i].image[j].imageID %>">
</image>
<% } %>
<!--image end-->
</div>
<% } %>
</div>
<% if(designInfos.music){%>
<!--music-->
<audio id="musicAudio" src="http://<%=cfg.ip%>:<%=cfg.port%>/H5/PlayMusic?id=<%=designInfos.music%>" controls="controls" autoplay="autoplay" style="display:none;" >
<% } %>
<script type="text/javascript">
window.infoData = {};
window.infoData.designInfos = <%- JSON.stringify(designInfos) %>
</script>
<script src="http://<%=cfg.ip%>:<%=cfg.port%>/static/jquery-3.0.0.js"></script>
<script src="http://<%=cfg.ip%>:<%=cfg.port%>/static/toucher.js"></script>
<script src="http://<%=cfg.ip%>:<%=cfg.port%>/static/show.js"></script> | {
"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.geode.internal.cache.execute;
import static org.apache.geode.cache.RegionShortcut.PARTITION;
import static org.apache.geode.cache.RegionShortcut.REPLICATE;
import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
import static org.apache.geode.distributed.ConfigurationProperties.SERIALIZABLE_OBJECT_FILTER;
import static org.apache.geode.util.internal.UncheckedUtils.uncheckedCast;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.Collection;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import java.util.function.Function;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.apache.geode.cache.CacheFactory;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.execute.FunctionContext;
import org.apache.geode.cache.execute.RegionFunctionContext;
import org.apache.geode.cache.execute.ResultCollector;
import org.apache.geode.cache.partition.PartitionRegionHelper;
import org.apache.geode.distributed.internal.DistributionManager;
import org.apache.geode.distributed.internal.LonerDistributionManager;
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.execute.util.TypedFunctionService;
import org.apache.geode.test.junit.categories.FunctionServiceTest;
/**
* This tests make sure that, in case of LonerDistributedSystem we don't get ClassCast Exception.
* Just making sure that the function executed on lonerDistributedSystem.
*
* <p>
* Regression test for bug: If invoked from LonerDistributedSystem, FunctionService.onMembers()
* throws ClassCastException
*/
@Category(FunctionServiceTest.class)
@SuppressWarnings("serial")
public class FunctionExecutionOnLonerRegressionTest {
private InternalCache cache;
private Set<String> keysForGet;
private Set<String> expectedValues;
@Before
public void setUp() {
cache = (InternalCache) new CacheFactory(getDistributedSystemProperties()).create();
}
@After
public void tearDown() {
cache.close();
}
@Test
public void precondition_isLonerDistributionManager() {
DistributionManager distributionManager = cache.getDistributionManager();
assertThat(distributionManager).isInstanceOf(LonerDistributionManager.class);
}
@Test
public void executeFunctionOnLonerWithPartitionedRegionShouldNotThrowClassCastException() {
Region<String, String> region = cache
.<String, String>createRegionFactory(PARTITION)
.create("region");
populateRegion(region);
ResultCollector<Collection<String>, Collection<String>> resultCollector = TypedFunctionService
.<Void, Collection<String>, Collection<String>>onRegion(region)
.withFilter(keysForGet)
.execute(new TestFunction(DataSetSupplier.PARTITIONED));
assertThat(resultCollector.getResult())
.containsExactlyInAnyOrder(expectedValues.toArray(new String[0]));
}
@Test
public void executeFunctionOnLonerWithReplicateRegionShouldNotThrowClassCastException() {
Region<String, String> region = cache
.<String, String>createRegionFactory(REPLICATE)
.create("region");
populateRegion(region);
ResultCollector<Collection<String>, Collection<String>> resultCollector = TypedFunctionService
.<Void, Collection<String>, Collection<String>>onRegion(region)
.withFilter(keysForGet)
.execute(new TestFunction(DataSetSupplier.REPLICATE));
assertThat(resultCollector.getResult())
.containsExactlyInAnyOrder(expectedValues.toArray(new String[0]));
}
private Properties getDistributedSystemProperties() {
Properties config = new Properties();
config.setProperty(MCAST_PORT, "0");
config.setProperty(LOCATORS, "");
config.setProperty(SERIALIZABLE_OBJECT_FILTER,
"org.apache.geode.test.junit.rules.**;org.apache.geode.internal.cache.execute.**;org.apache.geode.internal.cache.functions.**;org.apache.geode.test.dunit.**");
return config;
}
private void populateRegion(Region<String, String> region) {
keysForGet = new HashSet<>();
expectedValues = new HashSet<>();
for (int i = 0; i < 20; i++) {
String key = "KEY_" + i;
String value = "VALUE_" + i;
region.put(key, value);
if (i == 4 || i == 7 || i == 9) {
keysForGet.add(key);
expectedValues.add(value);
}
}
}
private enum DataSetSupplier {
PARTITIONED(PartitionRegionHelper::getLocalDataForContext),
REPLICATE(RegionFunctionContext::getDataSet);
private final Function<RegionFunctionContext, Region<String, String>> dataSet;
DataSetSupplier(Function<RegionFunctionContext, Region<String, String>> dataSet) {
this.dataSet = dataSet;
}
Region<String, String> dataSet(RegionFunctionContext context) {
return dataSet.apply(context);
}
}
private static class TestFunction implements org.apache.geode.cache.execute.Function<String> {
private final DataSetSupplier dataSetSupplier;
private TestFunction(DataSetSupplier dataSetSupplier) {
this.dataSetSupplier = dataSetSupplier;
}
@Override
public void execute(FunctionContext<String> context) {
RegionFunctionContext regionFunctionContext = (RegionFunctionContext) context;
Set<String> keys = uncheckedCast(regionFunctionContext.getFilter());
String lastKey = keys.iterator().next();
keys.remove(lastKey);
Region<String, String> region = dataSetSupplier.dataSet(regionFunctionContext);
for (String key : keys) {
context.getResultSender().sendResult(region.get(key));
}
context.getResultSender().lastResult(region.get(lastKey));
}
@Override
public String getId() {
return getClass().getName();
}
}
}
| {
"pile_set_name": "Github"
} |
-,http://data.semanticweb.org/person/sam-chapman,http://data.semanticweb.org/person/vitaveska-lanfranchi,0.0
+,http://data.semanticweb.org/person/elena-paslaru-bontas-simperl,http://data.semanticweb.org/person/elena-simperl,0.0
+,http://data.semanticweb.org/person/francesca-lisi,http://data.semanticweb.org/person/francesca-alessandra-lisi,0.0
+,http://data.semanticweb.org/person/carlos-damasio,http://data.semanticweb.org/person/carlos-viegas-damasio,0.0
+,http://data.semanticweb.org/person/brian-d-davison,http://data.semanticweb.org/person/brian-davison,0.0
+,http://data.semanticweb.org/person/grigorios-antoniou,http://data.semanticweb.org/person/grigoris-antoniou,0.0
+,http://data.semanticweb.org/person/bin-zhu,http://data.semanticweb.org/person/zhu-bin,0.0
+,http://data.semanticweb.org/person/uli-sattler,http://data.semanticweb.org/person/ulrike-sattler,0.0
+,http://data.semanticweb.org/person/gerd-groener,http://data.semanticweb.org/person/gerd-groner,0.0
+,http://data.semanticweb.org/person/gerhard-weikum,http://data.semanticweb.org/person/gehard-weikum,0.0
+,http://data.semanticweb.org/person/peter-yeh,http://data.semanticweb.org/person/peter-z-yeh,0.0
+,http://data.semanticweb.org/person/david-lewis,http://data.semanticweb.org/person/dave-lewis,0.0
+,http://data.semanticweb.org/person/johanna-voelker,http://data.semanticweb.org/person/johanna-volker,0.0
+,http://data.semanticweb.org/person/juri-luca-de-coi,http://data.semanticweb.org/person/juri-de-coi,0.0
+,http://data.semanticweb.org/person/vanesa-lopez,http://data.semanticweb.org/person/vanessa-lopez,0.0
+,http://data.semanticweb.org/person/elisa-f-kendall,http://data.semanticweb.org/person/elisa-kendall,0.0
+,http://data.semanticweb.org/person/alfio-massimiliano-gliozzo,http://data.semanticweb.org/person/alfio-gliozzo,0.0
+,http://data.semanticweb.org/person/amr-el-abaddi,http://data.semanticweb.org/person/amr-el-abbadi,0.0
+,http://data.semanticweb.org/person/praveen-paritosh,http://data.semanticweb.org/person/praveen-k-paritosh,0.0
+,http://data.semanticweb.org/person/kieron-ohara,http://data.semanticweb.org/person/kieron-o'hara,0.0
+,http://data.semanticweb.org/person/helena-pinto,http://data.semanticweb.org/person/helena-sofia-pinto,0.0
+,http://data.semanticweb.org/person/nigel-r-shadbolt,http://data.semanticweb.org/person/nigel-shadbolt,0.0
+,http://data.semanticweb.org/person/chihung-chi,http://data.semanticweb.org/person/chi-hung-chi,0.0
+,http://data.semanticweb.org/person/ansgar-scherp,http://data.semanticweb.org/person/ansgar-schrep,0.0
+,http://data.semanticweb.org/person/bernardo-cuenca-grau,http://data.semanticweb.org/person/bernardo-cuencagrau,0.0
+,http://data.semanticweb.org/person/bernhard-krueepl,http://data.semanticweb.org/person/bernhard-kruepl,0.0
+,http://data.semanticweb.org/person/bin-b-zhu,http://data.semanticweb.org/person/bin-zhu,0.0
-,http://data.semanticweb.org/person/cartic-ramakrishnan,http://data.semanticweb.org/person/c-r-ramakrishnan,0.0
+,http://data.semanticweb.org/person/carole-a-goble,http://data.semanticweb.org/person/carole-goble,0.0
+,http://data.semanticweb.org/person/vita-lanfranchi,http://data.semanticweb.org/person/vitaveska-lanfranchi,0.0
+,http://data.semanticweb.org/person/dan-weld,http://data.semanticweb.org/person/daniel-weld,0.0
+,http://data.semanticweb.org/person/nicholas-gibbins,http://data.semanticweb.org/person/nick-gibbins,0.0
+,http://data.semanticweb.org/person/bob-schloss,http://data.semanticweb.org/person/robert-schloss,0.0
+,http://data.semanticweb.org/person/ryen-w-white,http://data.semanticweb.org/person/ryen-white,0.0
+,http://data.semanticweb.org/person/antoine-issac,http://data.semanticweb.org/person/antoine-isaac,0.0
+,http://data.semanticweb.org/person/duncan-watts,http://data.semanticweb.org/person/duncan-j-watts,0.0
-,http://data.semanticweb.org/person/lei-zhang,http://data.semanticweb.org/person/lei-zhang-2,0.0
-,http://data.semanticweb.org/person/lei-zhang-1,http://data.semanticweb.org/person/lei-zhang-2,0.0
-,http://data.semanticweb.org/person/lei-zhang,http://data.semanticweb.org/person/lei-zhang-1,0.0
-,http://data.semanticweb.org/person/tobias-berger,http://data.semanticweb.org/person/tobias-buerger,0.0
+,http://data.semanticweb.org/person/shengping-liu,http://data.semanticweb.org/person/sheng-ping-liu,0.0
+,http://data.semanticweb.org/person/hussein-a-alzoubi,http://data.semanticweb.org/person/hussein-alzoubi,0.0
+,http://data.semanticweb.org/person/krysta-m-svore,http://data.semanticweb.org/person/krysta-svore,0.0
+,http://data.semanticweb.org/person/kaimin-zhang,http://data.semanticweb.org/person/zhang-kaimin,0.0
+,http://data.semanticweb.org/person/gang-lu,http://data.semanticweb.org/person/lu-gang,0.0
+,http://data.semanticweb.org/person/juan-sequeda,http://data.semanticweb.org/person/juan-f-sequeda,0.0
+,http://data.semanticweb.org/person/winter-mason,http://data.semanticweb.org/person/winter-a-mason,0.0
+,http://data.semanticweb.org/person/uuangui-lei,http://data.semanticweb.org/person/yuangui-lei,0.0
+,http://data.semanticweb.org/person/jaewook-ahn,http://data.semanticweb.org/person/jae-wook-ahn,0.0
-,http://data.semanticweb.org/person/andreas-hartl,http://data.semanticweb.org/person/andreas-harth,0.0
-,http://data.semanticweb.org/person/tao-li,http://data.semanticweb.org/person/tao-qin,0.0
-,http://data.semanticweb.org/person/yang-wang,http://data.semanticweb.org/person/gang-wang,0.0
-,http://data.semanticweb.org/person/jonathan-grady,http://data.semanticweb.org/person/jonathan-gray,0.0
+,http://data.semanticweb.org/person/bernhard-haslhofer,http://data.semanticweb.org/person/bernard-haslhofer,0.0
+,http://data.semanticweb.org/person/reto-krummenancher,http://data.semanticweb.org/person/reto-krummenacher,0.0
+,http://data.semanticweb.org/person/zhaomin-qiu,http://data.semanticweb.org/person/zhaoming-qiu,0.0
+,http://data.semanticweb.org/person/li-zhang,http://data.semanticweb.org/person/zhang-li,0.0
+,http://data.semanticweb.org/person/ondrej-svab,http://data.semanticweb.org/person/ondrej-svab-zamazal,0.0
-,http://data.semanticweb.org/person/yiming-liu,http://data.semanticweb.org/person/yi-ming-liu,0.0
+,http://data.semanticweb.org/person/jeonghee-yi,http://data.semanticweb.org/person/jeonghe-yi,0.0
+,http://data.semanticweb.org/person/joerg-hoffman,http://data.semanticweb.org/person/joerg-hoffmann,0.0
-,http://data.semanticweb.org/person/haitao-zheng,http://data.semanticweb.org/person/hai-tao-zheng,0.0
+,http://data.semanticweb.org/person/haixun-wang,http://data.semanticweb.org/person/hai-xun-wang,0.0
+,http://data.semanticweb.org/person/suzanne-embury,http://data.semanticweb.org/person/suzanne-m-embury,0.0
+,http://data.semanticweb.org/person/vahab-mirrokni,http://data.semanticweb.org/person/vahab-s-mirrokni,0.0
+,http://data.semanticweb.org/person/dionisis-kehagias,http://data.semanticweb.org/person/dionysios-kehagias,0.0
+,http://data.semanticweb.org/person/rafael-berlanga,http://data.semanticweb.org/person/rafael-berlanga-llavori,0.0
+,http://data.semanticweb.org/person/j-william-murdock,http://data.semanticweb.org/person/william-murdock,0.0
+,http://data.semanticweb.org/person/panagiotis-g-ipeirotis,http://data.semanticweb.org/person/panos-ipeirotis,0.0
+,http://data.semanticweb.org/person/mariano-rodriguez,http://data.semanticweb.org/person/mariano-rodriguez-muro,0.0
+,http://data.semanticweb.org/person/peter-patel-schneider,http://data.semanticweb.org/person/peter-f-patel-schneider,0.0
+,http://data.semanticweb.org/person/jacobus-van-der-merwe,http://data.semanticweb.org/person/kobus-van-der-merwe,0.0
+,http://data.semanticweb.org/person/rob-miller,http://data.semanticweb.org/person/robert-miller,0.0
-,http://data.semanticweb.org/person/lei-duan,http://data.semanticweb.org/person/lei-guo,0.0
+,http://data.semanticweb.org/person/edward-chang,http://data.semanticweb.org/person/edward-y-chang,0.0
+,http://data.semanticweb.org/person/han-yu-li,http://data.semanticweb.org/person/hanyu-li,0.0
+,http://data.semanticweb.org/person/thanh-tran,http://data.semanticweb.org/person/tran-duc-thanh,0.0
+,http://data.semanticweb.org/person/alexander-j-smola,http://data.semanticweb.org/person/alex-smola,0.0
+,http://data.semanticweb.org/person/kyung-il-lee,http://data.semanticweb.org/person/tony-lee,0.0
+,http://data.semanticweb.org/person/stanley-park,http://data.semanticweb.org/person/hyun-geun-park,0.0
+,http://data.semanticweb.org/person/zhu-bin,http://data.semanticweb.org/person/bin-b-zhu,0.0
+,http://data.semanticweb.org/person/helena-sofia-pinto,http://data.semanticweb.org/person/sofia-pinto,0.0
+,http://data.semanticweb.org/person/christopher-welty,http://data.semanticweb.org/person/chris-welty,0.0
+,http://data.semanticweb.org/person/meghan-lammie-glenn,http://data.semanticweb.org/person/meghan-glenn,0.0
+,http://data.semanticweb.org/person/gregory-sanders,http://data.semanticweb.org/person/greg-sanders,0.0
-,http://data.semanticweb.org/person/jie-han,http://data.semanticweb.org/person/jie-zhang,0.0
+,http://data.semanticweb.org/person/benjamin-grosof-grosof,http://data.semanticweb.org/person/benjamin-grosof,0.0
+,http://data.semanticweb.org/person/christopher-g-chute,http://data.semanticweb.org/person/christopher-chute,0.0
+,http://data.semanticweb.org/person/grigoris-antoniou,http://data.semanticweb.org/person/gregoris-antoniou,0.0
+,http://data.semanticweb.org/person/gregoris-antoniou,http://data.semanticweb.org/person/grigoris-antoniou,0.0
-,http://data.semanticweb.org/person/zhaohui-wu,http://data.semanticweb.org/person/hao-wu,0.0
+,http://data.semanticweb.org/person/ching-man-au-yeung,http://data.semanticweb.org/person/au-yeung-ching-man,0.0
+,http://data.semanticweb.org/person/martin-j-oconnor,http://data.semanticweb.org/person/martin-oconnor,0.0
+,http://data.semanticweb.org/person/d-osullivan,http://data.semanticweb.org/person/declan-osullivan,0.0
+,http://data.semanticweb.org/person/gregory-williams,http://data.semanticweb.org/person/gregory-todd-williams,0.0
-,http://data.semanticweb.org/person/zhe-wang,http://data.semanticweb.org/person/kewen-wang,0.0
+,http://data.semanticweb.org/person/jin-zheng,http://data.semanticweb.org/person/jin-guang-zheng,0.0
+,http://data.semanticweb.org/person/christian-bizer,http://data.semanticweb.org/person/christian-bizer-,0.0
+,http://data.semanticweb.org/person/inma-hernaez,http://data.semanticweb.org/person/inmaculada-hernaez,0.0
+,http://data.semanticweb.org/person/satya-sahoo,http://data.semanticweb.org/person/satya-s-sahoo,0.0
-,http://data.semanticweb.org/person/hao-wu,http://data.semanticweb.org/person/zhaohui-wu,0.0
-,http://data.semanticweb.org/person/kewen-wang,http://data.semanticweb.org/person/zhe-wang,0.0
+,http://data.semanticweb.org/person/piotr-banski,http://data.semanticweb.org/person/piotr-ba%C5%84ski,0.0
+,http://data.semanticweb.org/person/lorenz-buehmann,http://data.semanticweb.org/person/lorenz-buhmann,0.0
+,http://data.semanticweb.org/person/york-sure,http://data.semanticweb.org/person/york-sure-vetter,0.0
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- 3.2.3 : 2.1
One of ref or name must be present, but not both.
-->
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://foo" xmlns:foo="http://foo">
<element name="bar" type="string"/>
<element name="foo">
<complexType>
<sequence>
<element name="bar" ref="foo:bar"/>
</sequence>
</complexType>
</element>
</schema>
| {
"pile_set_name": "Github"
} |
#ifndef SList_h
#define SList_h
/*
* SList.h
*
* SOFTWARE RIGHTS
*
* We reserve no LEGAL rights to SORCERER -- SORCERER is in the public
* domain. An individual or company may do whatever they wish with
* source code distributed with SORCERER or the code generated by
* SORCERER, including the incorporation of SORCERER, or its output, into
* commerical software.
*
* We encourage users to develop software with SORCERER. However, we do
* ask that credit is given to us for developing SORCERER. By "credit",
* we mean that if you incorporate our source code into one of your
* programs (commercial product, research project, or otherwise) that you
* acknowledge this fact somewhere in the documentation, research report,
* etc... If you like SORCERER and have developed a nice tool with the
* output, please mention that you developed it using SORCERER. In
* addition, we ask that this header remain intact in our source code.
* As long as these guidelines are kept, we expect to continue enhancing
* this system and expect to make other tools available as they are
* completed.
*
* PCCTS 1.33
* Terence Parr
* Parr Research Corporation
* with Purdue University and AHPCRC, University of Minnesota
* 1992-2000
*/
#include "pcctscfg.h"
#include "pccts_stdio.h"
#include "pccts_stdlib.h"
PCCTS_NAMESPACE_STD
#include "PCCTSAST.h"
class PCCTS_AST;
class SListNode {
protected:
void *_elem; /* pointer to any kind of element */
SListNode *_next;
public:
SListNode() {_elem=_next=NULL;}
virtual ~SListNode() {_elem=_next=NULL;}
void *elem() { return _elem; }
void setElem(void *e) { _elem = e; }
void setNext(SListNode *t) { _next = t; }
SListNode *next() { return _next; }
};
class SList {
SListNode *head, *tail;
public:
SList() {head=tail=NULL;}
virtual ~SList() {head=tail=NULL;}
virtual void *iterate(SListNode **);
virtual void add(void *e);
virtual void lfree();
virtual PCCTS_AST *to_ast(SList list);
virtual void require(int e,char *err){ if ( !e ) panic(err); }
virtual void panic(char *err){ /* MR23 */ printMessage(stderr, "SList panic: %s\n", err); exit(PCCTS_EXIT_FAILURE); }
virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23
};
#endif
| {
"pile_set_name": "Github"
} |
* {{ start }}
{{# middle }}
* {{ foo }}
* {{ bar }}
{{/ middle }}
* {{ final }} | {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 54e42528ce3ee414288ef0f0905042a5
folderAsset: yes
timeCreated: 1476912298
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
#!/bin/bash
# description: system-wide syscall counts, by pid
# args: [comm]
if [ $# -gt 0 ] ; then
if ! expr match "$1" "-" > /dev/null ; then
comm=$1
shift
fi
fi
perf script $@ -s "$PERF_EXEC_PATH"/scripts/python/syscall-counts-by-pid.py $comm
| {
"pile_set_name": "Github"
} |
dependencies:
- name: d3
version: 3.3.8
src: htmlwidgets/lib/d3
script: d3.min.js
- name: dagre
version: 0.4.0
src: "htmlwidgets/lib/dagre-d3"
script: "dagre-d3.min.js"
- name: mermaid
version: 0.3.0
src: htmlwidgets/lib/mermaid
script: dist/mermaid.slim.min.js
stylesheet: dist/mermaid.css
- name: DiagrammeR-styles
version: 0.2
src: htmlwidgets/lib/styles
stylesheet: styles.css
- name: chromatography
version: 0.1
src: htmlwidgets/lib/chromatography
script: chromatography.js
| {
"pile_set_name": "Github"
} |
//
// AppDelegate.swift
// Demo
//
// Created by Andrea Mazzini on 05/03/16.
// Copyright © 2016 Fancy Pixel. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}
| {
"pile_set_name": "Github"
} |
; RUN: opt -basicaa -gvn -S < %s | FileCheck %s
define i32 @test1(i32* %p) {
; CHECK: @test1(i32* %p)
; CHECK: %a = load i32* %p, !range !0
; CHECK: %c = add i32 %a, %a
%a = load i32* %p, !range !0
%b = load i32* %p, !range !0
%c = add i32 %a, %b
ret i32 %c
}
define i32 @test2(i32* %p) {
; CHECK: @test2(i32* %p)
; CHECK: %a = load i32* %p
; CHECK-NOT: range
; CHECK: %c = add i32 %a, %a
%a = load i32* %p, !range !0
%b = load i32* %p
%c = add i32 %a, %b
ret i32 %c
}
define i32 @test3(i32* %p) {
; CHECK: @test3(i32* %p)
; CHECK: %a = load i32* %p, !range ![[DISJOINT_RANGE:[0-9]+]]
; CHECK: %c = add i32 %a, %a
%a = load i32* %p, !range !0
%b = load i32* %p, !range !1
%c = add i32 %a, %b
ret i32 %c
}
define i32 @test4(i32* %p) {
; CHECK: @test4(i32* %p)
; CHECK: %a = load i32* %p, !range ![[MERGED_RANGE:[0-9]+]]
; CHECK: %c = add i32 %a, %a
%a = load i32* %p, !range !0
%b = load i32* %p, !range !2
%c = add i32 %a, %b
ret i32 %c
}
define i32 @test5(i32* %p) {
; CHECK: @test5(i32* %p)
; CHECK: %a = load i32* %p, !range ![[MERGED_SIGNED_RANGE:[0-9]+]]
; CHECK: %c = add i32 %a, %a
%a = load i32* %p, !range !3
%b = load i32* %p, !range !4
%c = add i32 %a, %b
ret i32 %c
}
define i32 @test6(i32* %p) {
; CHECK: @test6(i32* %p)
; CHECK: %a = load i32* %p, !range ![[MERGED_TEST6:[0-9]+]]
; CHECK: %c = add i32 %a, %a
%a = load i32* %p, !range !5
%b = load i32* %p, !range !6
%c = add i32 %a, %b
ret i32 %c
}
define i32 @test7(i32* %p) {
; CHECK: @test7(i32* %p)
; CHECK: %a = load i32* %p, !range ![[MERGED_TEST7:[0-9]+]]
; CHECK: %c = add i32 %a, %a
%a = load i32* %p, !range !7
%b = load i32* %p, !range !8
%c = add i32 %a, %b
ret i32 %c
}
define i32 @test8(i32* %p) {
; CHECK: @test8(i32* %p)
; CHECK: %a = load i32* %p
; CHECK-NOT: range
; CHECK: %c = add i32 %a, %a
%a = load i32* %p, !range !9
%b = load i32* %p, !range !10
%c = add i32 %a, %b
ret i32 %c
}
; CHECK: ![[DISJOINT_RANGE]] = !{i32 0, i32 2, i32 3, i32 5}
; CHECK: ![[MERGED_RANGE]] = !{i32 0, i32 5}
; CHECK: ![[MERGED_SIGNED_RANGE]] = !{i32 -3, i32 -2, i32 1, i32 2}
; CHECK: ![[MERGED_TEST6]] = !{i32 10, i32 1}
; CHECK: ![[MERGED_TEST7]] = !{i32 3, i32 4, i32 5, i32 2}
!0 = !{i32 0, i32 2}
!1 = !{i32 3, i32 5}
!2 = !{i32 2, i32 5}
!3 = !{i32 -3, i32 -2}
!4 = !{i32 1, i32 2}
!5 = !{i32 10, i32 1}
!6 = !{i32 12, i32 13}
!7 = !{i32 1, i32 2, i32 3, i32 4}
!8 = !{i32 5, i32 1}
!9 = !{i32 1, i32 5}
!10 = !{i32 5, i32 1}
| {
"pile_set_name": "Github"
} |
web: tugboat server
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
<behaviors />
<bindings>
<binding digest="System.ServiceModel.Configuration.BasicHttpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data name="BasicHttpsBinding_ILicensingService1"><security mode="Transport" /></Data>" bindingType="basicHttpBinding" name="BasicHttpsBinding_ILicensingService1" />
</bindings>
<endpoints>
<endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="https://cshtml5myaccount.azurewebsites.net/LicensingService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpsBinding_ILicensingService1" contract="LicensingServiceReference.ILicensingService" name="BasicHttpsBinding_ILicensingService" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="https://cshtml5myaccount.azurewebsites.net/LicensingService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpsBinding_ILicensingService1" contract="LicensingServiceReference.ILicensingService" name="BasicHttpsBinding_ILicensingService" />" contractName="LicensingServiceReference.ILicensingService" name="BasicHttpsBinding_ILicensingService" />
</endpoints>
</configurationSnapshot> | {
"pile_set_name": "Github"
} |
/*
* Copyright 2003, 2004, 2005 Martin Fuchs
*
* 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
*/
//
// Explorer clone
//
// shellbrowser.h
//
// Martin Fuchs, 23.07.2003
//
#include "../utility/treedroptarget.h"
#include "../utility/shellbrowserimpl.h"
#include <memory>
/// information structure to hold current shell folder information
struct ShellPathInfo
{
ShellPathInfo(int mode=0) : _open_mode(mode) {}
ShellPathInfo(const ShellChildWndInfo& info)
: _shell_path(info._shell_path),
_root_shell_path(info._root_shell_path),
_open_mode(info._open_mode)
{
}
ShellPath _shell_path;
ShellPath _root_shell_path;
int _open_mode; //OPEN_WINDOW_MODE
};
struct BrowserCallback
{
virtual ~BrowserCallback() {}
virtual void entry_selected(Entry* entry) = 0;
};
/// Implementation of IShellBrowserImpl interface in explorer child windows
struct ShellBrowser : public IShellBrowserImpl,
public IComSrvBase<IShellFolderViewCB, ShellBrowser>, public SimpleComObject
{
ShellBrowser(HWND hwnd, HWND hwndFrame, HWND left_hwnd, WindowHandle& right_hwnd, ShellPathInfo& create_info,
BrowserCallback* cb, CtxMenuInterfaces& cm_ifs);
virtual ~ShellBrowser();
//IOleWindow
virtual HRESULT STDMETHODCALLTYPE GetWindow(HWND* lphwnd)
{
*lphwnd = _hwnd;
return S_OK;
}
//IShellBrowser
virtual HRESULT STDMETHODCALLTYPE QueryActiveShellView(IShellView** ppshv)
{
_pShellView->AddRef();
*ppshv = _pShellView;
return S_OK;
}
virtual HRESULT STDMETHODCALLTYPE GetControlWindow(UINT id, HWND* lphwnd)
{
if (!lphwnd)
return E_POINTER;
if (id == FCW_TREE) {
*lphwnd = _left_hwnd;
return S_OK;
}
HWND hwnd = (HWND)SendMessage(_hwndFrame, PM_GET_CONTROLWINDOW, id, 0);
if (hwnd) {
*lphwnd = hwnd;
return S_OK;
}
return E_NOTIMPL;
}
virtual HRESULT STDMETHODCALLTYPE SendControlMsg(UINT id, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pret)
{
if (!pret)
return E_POINTER;
HWND hstatusbar = (HWND)SendMessage(_hwndFrame, PM_GET_CONTROLWINDOW, id, 0);
if (hstatusbar) {
*pret = ::SendMessage(hstatusbar, uMsg, wParam, lParam);
return S_OK;
}
return E_NOTIMPL;
}
const Root& get_root() const {return _root;}
void OnTreeGetDispInfo(int idCtrl, LPNMHDR pnmh);
void OnTreeItemExpanding(int idCtrl, LPNMTREEVIEW pnmtv);
void OnTreeItemRClick(int idCtrl, LPNMHDR pnmh);
void OnTreeItemSelected(int idCtrl, LPNMTREEVIEW pnmtv);
void Init();
int InsertSubitems(HTREEITEM hParentItem, Entry* entry, IShellFolder* pParentFolder);
bool jump_to_pidl(LPCITEMIDLIST pidl);
HRESULT OnDefaultCommand(LPIDA pida);
void UpdateFolderView(IShellFolder* folder);
HTREEITEM select_entry(HTREEITEM hitem, Entry* entry, bool expand=true);
bool select_folder(Entry* entry, bool expand);
// for SDIMainFrame
void jump_to(LPCITEMIDLIST pidl);
void invalidate_cache();
bool TranslateAccelerator(LPMSG lpmsg);
protected:
HWND _hwnd;
HWND _hwndFrame;
HWND _left_hwnd;
WindowHandle& _right_hwnd;
ShellPathInfo& _create_info;
HIMAGELIST _himl;
HIMAGELIST _himl_old;
BrowserCallback* _callback;
ShellFolder _folder;
IShellView* _pShellView; // current hosted shellview
TreeDropTarget* _pDropTarget;
HTREEITEM _last_sel;
Root _root;
ShellDirectory* _cur_dir;
CtxMenuInterfaces& _cm_ifs;
void InitializeTree();
bool InitDragDrop();
typedef IComSrvBase<IShellFolderViewCB, ShellBrowser> super;
// IShellFolderViewCB
virtual HRESULT STDMETHODCALLTYPE MessageSFVCB(UINT uMsg, WPARAM wParam, LPARAM lParam);
map<int, int> _image_map;
int get_image_idx(int icon_id);
void refresh();
};
#define C_DRIVE_STR TEXT("C:\\")
// work around GCC's wide string constant bug
#ifdef __GNUC__
extern const LPCTSTR C_DRIVE;
#else
#define C_DRIVE C_DRIVE_STR
#endif
template<typename BASE> struct ShellBrowserChildT
: public BASE, public BrowserCallback
{
typedef BASE super;
// constructor for SDIMainFrame
ShellBrowserChildT(HWND hwnd)
: super(hwnd)
{
}
// constructor for MDIShellBrowserChild
ShellBrowserChildT(HWND hwnd, const ShellChildWndInfo& info)
: super(hwnd, info)
{
}
protected:
auto_ptr<ShellBrowser> _shellBrowser;
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam)
{
switch(nmsg) {
case PM_GET_SHELLBROWSER_PTR:
return (LRESULT)&*_shellBrowser;
case WM_GETISHELLBROWSER: // for Registry Explorer Plugin
return (LRESULT)static_cast<IShellBrowser*>(&*_shellBrowser);
default:
return super::WndProc(nmsg, wparam, lparam);
}
return 0;
}
int Notify(int id, NMHDR* pnmh)
{
if (_shellBrowser.get())
switch(pnmh->code) {
case TVN_GETDISPINFO: _shellBrowser->OnTreeGetDispInfo(id, pnmh); break;
case TVN_SELCHANGED: _shellBrowser->OnTreeItemSelected(id, (LPNMTREEVIEW)pnmh); break;
case TVN_ITEMEXPANDING: _shellBrowser->OnTreeItemExpanding(id, (LPNMTREEVIEW)pnmh); break;
case NM_RCLICK: _shellBrowser->OnTreeItemRClick(id, pnmh); break;
default: return super::Notify(id, pnmh);
}
else
return super::Notify(id, pnmh);
return 0;
}
};
#ifndef _NO_MDI
struct MDIShellBrowserChild : public ExtContextMenuHandlerT<
ShellBrowserChildT<ChildWindow>
>
{
typedef ExtContextMenuHandlerT<
ShellBrowserChildT<ChildWindow>
> super;
MDIShellBrowserChild(HWND hwnd, const ShellChildWndInfo& info);
static MDIShellBrowserChild* create(const ShellChildWndInfo& info);
LRESULT Init(LPCREATESTRUCT);
virtual String jump_to_int(LPCTSTR url);
protected:
ShellChildWndInfo _create_info;
ShellPathInfo _shellpath_info;
LRESULT WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam);
void update_shell_browser();
// interface BrowserCallback
virtual void entry_selected(Entry* entry);
};
#endif
| {
"pile_set_name": "Github"
} |
{
"images": [
{
"filename": "ic_filter_1_white.png",
"idiom": "universal",
"scale": "1x"
},
{
"filename": "ic_filter_1_white_2x.png",
"idiom": "universal",
"scale": "2x"
},
{
"filename": "ic_filter_1_white_3x.png",
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
| {
"pile_set_name": "Github"
} |
package install
import "fmt"
// (un)install in zsh
// basically adds/remove from .zshrc:
//
// autoload -U +X bashcompinit && bashcompinit"
// complete -C </path/to/completion/command> <command>
type zsh struct {
rc string
}
func (z zsh) IsInstalled(cmd, bin string) bool {
completeCmd := z.cmd(cmd, bin)
return lineInFile(z.rc, completeCmd)
}
func (z zsh) Install(cmd, bin string) error {
if z.IsInstalled(cmd, bin) {
return fmt.Errorf("already installed in %s", z.rc)
}
completeCmd := z.cmd(cmd, bin)
bashCompInit := "autoload -U +X bashcompinit && bashcompinit"
if !lineInFile(z.rc, bashCompInit) {
completeCmd = bashCompInit + "\n" + completeCmd
}
return appendToFile(z.rc, completeCmd)
}
func (z zsh) Uninstall(cmd, bin string) error {
if !z.IsInstalled(cmd, bin) {
return fmt.Errorf("does not installed in %s", z.rc)
}
completeCmd := z.cmd(cmd, bin)
return removeFromFile(z.rc, completeCmd)
}
func (zsh) cmd(cmd, bin string) string {
return fmt.Sprintf("complete -o nospace -C %s %s", bin, cmd)
}
| {
"pile_set_name": "Github"
} |
"
I'm an signed short type.
"
Class {
#name : #FFIInt16,
#superclass : #FFIUInt16,
#category : #'UnifiedFFI-Types'
}
{ #category : #accessing }
FFIInt16 class >> externalType [
^ ExternalType short
]
{ #category : #private }
FFIInt16 >> basicHandle: aHandle at: index [
^ aHandle signedShortAt: index
]
{ #category : #private }
FFIInt16 >> basicHandle: aHandle at: index put: value [
^ aHandle signedShortAt: index put: value
]
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
from pyscf.pbc.tdscf import rks
from pyscf.pbc.tdscf import rhf
| {
"pile_set_name": "Github"
} |
from mock import patch
import storage.common
class MockStorage:
PATCH_METHODS = ("get", "set", "delete")
def __init__(self):
self.namespace = {}
self.patches = [
patch(storage.common, method, getattr(self, method))
for method in self.PATCH_METHODS
]
def set(self, app: int, key: int, data: bytes, public: bool = False) -> None:
self.namespace.setdefault(app, {})
self.namespace[app][key] = data
def get(self, app: int, key: int, public: bool = False) -> Optional[bytes]:
self.namespace.setdefault(app, {})
return self.namespace[app].get(key)
def delete(self, app: int, key: int, public: bool = False) -> None:
self.namespace.setdefault(app, {})
self.namespace[app].pop(key, None)
def __enter__(self):
for patch in self.patches:
patch.__enter__()
return self
def __exit__(self, exc_type, exc_value, tb):
for patch in self.patches:
patch.__exit__(exc_type, exc_value, tb)
def mock_storage(func):
def inner(*args, **kwargs):
with MockStorage():
return func(*args, **kwargs)
return inner
| {
"pile_set_name": "Github"
} |
# FreeType 2 src/sfnt Jamfile
#
# Copyright 2001, 2002, 2004, 2005 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = sfobjs sfdriver ttcmap ttmtx ttpost ttload ttsbit ttkern ttbdf sfntpic ;
}
else
{
_sources = sfnt ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/sfnt Jamfile
| {
"pile_set_name": "Github"
} |
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* Conditionals_adv.h
* Defines that depend on advanced configuration.
*/
#if !defined(__AVR__) || !defined(USBCON)
// Define constants and variables for buffering serial data.
// Use only 0 or powers of 2 greater than 1
// : [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
#ifndef RX_BUFFER_SIZE
#define RX_BUFFER_SIZE 128
#endif
// 256 is the max TX buffer limit due to uint8_t head and tail
// : [0, 4, 8, 16, 32, 64, 128, 256]
#ifndef TX_BUFFER_SIZE
#define TX_BUFFER_SIZE 32
#endif
#else
// SERIAL_XON_XOFF not supported on USB-native devices
#undef SERIAL_XON_XOFF
#endif
#if ENABLED(HOST_ACTION_COMMANDS)
#ifndef ACTION_ON_PAUSE
#define ACTION_ON_PAUSE "pause"
#endif
#ifndef ACTION_ON_PAUSED
#define ACTION_ON_PAUSED "paused"
#endif
#ifndef ACTION_ON_RESUME
#define ACTION_ON_RESUME "resume"
#endif
#ifndef ACTION_ON_RESUMED
#define ACTION_ON_RESUMED "resumed"
#endif
#ifndef ACTION_ON_CANCEL
#define ACTION_ON_CANCEL "cancel"
#endif
#ifndef ACTION_ON_KILL
#define ACTION_ON_KILL "poweroff"
#endif
#if HAS_FILAMENT_SENSOR
#ifndef ACTION_ON_FILAMENT_RUNOUT
#define ACTION_ON_FILAMENT_RUNOUT "filament_runout"
#endif
#ifndef ACTION_REASON_ON_FILAMENT_RUNOUT
#define ACTION_REASON_ON_FILAMENT_RUNOUT "filament_runout"
#endif
#endif
#if ENABLED(G29_RETRY_AND_RECOVER)
#ifndef ACTION_ON_G29_RECOVER
#define ACTION_ON_G29_RECOVER "probe_rewipe"
#endif
#ifndef ACTION_ON_G29_FAILURE
#define ACTION_ON_G29_FAILURE "probe_failed"
#endif
#endif
#endif
| {
"pile_set_name": "Github"
} |
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = Mapchete
SOURCEDIR = source
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GlobusTumblerLib.Tumblr.Core.UserMethods
{
class UsersUnlike
{
}
}
| {
"pile_set_name": "Github"
} |
2015-02-23 Pete Williamson <petewil0@googlemail.com> (tiny change)
Use ${EXEEXT} more uniformly in makefiles
When porting Emacs to run on NaCl, we need to make sure that we always
call it with the proper extension (.nexe in this case) during the build.
* Makefile.in (EMACS): Append ${EXEEXT}.
2015-01-04 Paul Eggert <eggert@cs.ucla.edu>
Less 'make' chatter for leim
* Makefile.in (AM_DEFAULT_VERBOSITY, AM_V_GEN, am__v_GEN_)
(am__v_GEN_0, am__v_GEN_1, AM_V_at, am__v_at_, am__v_at_0)
(am__v_at_1): New macros, from src/Makefile.in.
(${leimdir}/quail/%.el, misc_convert, ${leimdir}/leim-list.el)
(${leimdir}/ja-dic/ja-dic.el): Use them.
2014-12-14 Paul Eggert <eggert@cs.ucla.edu>
* SKK-DIC/SKK-JISYO.L: Update to version 1.1216.
2014-10-20 Glenn Morris <rgm@gnu.org>
* Merge in all changes up to 24.4 release.
2014-06-10 Glenn Morris <rgm@gnu.org>
Use GNU Make features to simplify and parallelize.
* Makefile.in (CHINESE_TIT, TIT_SOURCES, MISC_SOURCES, changed.tit)
(changed.misc): Remove.
(${leimdir}/quail, ${leimdir}/ja-dic): Create using order-only prereq.
(misc_convert): New.
(${leimdir}/quail/%.el, ${leimdir}/quail/CT%.el)
(${leimdir}/quail/PY.el, ${leimdir}/quail/ZIRANMA.el)
(${leimdir}/quail/tsang-%.el, ${leimdir}/quail/quick-%.el):
Use pattern rules.
(${leimdir}/leim-list.el, ${leimdir}/ja-dic/ja-dic.el):
Use automatic variables.
(bootstrap-clean): No changed.* files to delete any more.
2014-04-11 Glenn Morris <rgm@gnu.org>
* Makefile.in (EMACSDATA, EMACSDOC, EMACSPATH): Unexport.
2014-01-20 Paul Eggert <eggert@cs.ucla.edu>
Revert some of the CANNOT_DUMP fix (Bug#16494).
* Makefile.in (RUN_EMACS): Keep EMACSLOADPATH empty.
2013-12-27 Paul Eggert <eggert@cs.ucla.edu>
Sync better from sources.
* CXTERM-DIC/ARRAY30.tit, CXTERM-DIC/4Corner.tit:
* CXTERM-DIC/QJ.tit, CXTERM-DIC/QJ-b5.tit:
Omit blank lines not present in the original.
* CXTERM-DIC/CCDOSPY.tit:
* CXTERM-DIC/PY-b5.tit:
* CXTERM-DIC/SW.tit, CXTERM-DIC/TONEPY.tit:
* MISC-DIC/pinyin.map, MISC-DIC/ziranma.cin:
Clarify which header lines were added for Emacs.
* CXTERM-DIC/README:
Clarify what changes we made, and where the files came from.
* MISC-DIC/README, MISC-DIC/pinyin.map, MISC-DIC/ziranma.cin:
Update URLs.
* SKK-DIC/SKK-JISYO.L: Update from upstream.
2013-12-16 Paul Eggert <eggert@cs.ucla.edu>
Fix problems with CANNOT_DUMP and EMACSLOADPATH.
* Makefile.in (RUN_EMACS): Add lisp src to EMACSLOADPATH.
2013-11-28 Glenn Morris <rgm@gnu.org>
* Makefile.in (${leimdir}/leim-list.el):
* leim-ext.el: Change method for getting comments in the output
to one that does not fool lisp/compile-main's no-byte-compile test.
2013-11-27 Glenn Morris <rgm@gnu.org>
* Makefile.in (bootstrap-clean): No need to delete .elc,
lisp/ rules will do that.
* Makefile.in (extraclean): New.
(bootstrap-clean): Move ja-dic deletion to extraclean.
Move ja-dic, quail, leim-list.el to ../lisp/leim.
* Makefile.in (leimdir): New variable.
(TIT_GB, TIT_BIG5, MISC, changed.tit, changed.misc)
(${leimdir}/leim-list.el, ${leimdir}/ja-dic/ja-dic.el):
Generate in $leimdir.
(all): Remove compilation, add ja-dic.
(leim-list.el): Now PHONY.
(setwins, compile-targets, compile-main, clean, mostlyclean)
(extraclean): Remove.
(bootstrap-clean): Delete all generated files.
* README: Update for moved leim/ directory.
* leim-ext.el (ucs-input-activate, hangul-input-method-activate):
Remove manual autoloads; now in loaddefs.el.
Disable byte-compile, version-control, autoloads in the output.
* quail: Move to ../lisp/leim.
2013-11-23 Glenn Morris <rgm@gnu.org>
* Makefile.in (RUN_EMACS): Empty EMACSLOADPATH rather than unsetting.
2013-11-04 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (RUN_EMACS): Don't set LC_ALL=C. (Bug#15260)
2013-11-03 Glenn Morris <rgm@gnu.org>
* Makefile.in (abs_srcdir): Remove.
(RUN_EMACS): Unset EMACSLOADPATH.
2013-11-02 Glenn Morris <rgm@gnu.org>
* Makefile.in (buildlisppath): Remove.
(RUN_EMACS): Use abs_srcdir directly.
2013-10-24 Glenn Morris <rgm@gnu.org>
* Makefile.in (.el.elc, changed.tit, changed.misc, leim-list.el)
($(srcdir)/ja-dic/ja-dic.el, check-declare): Remove unnecessary
path in -l argument (RUN_EMACS sets EMACSLOADPATH).
2013-10-23 Glenn Morris <rgm@gnu.org>
* Makefile.in (abs_srcdir): New, set by configure.
(buildlisppath): Use abs_srcdir.
(RUN_EMACS, .el.elc, changed.tit, changed.misc, leim-list.el)
($(srcdir)/ja-dic/ja-dic.el, setwins, distclean, check-declare):
Quote entities that might contain whitespace.
2013-09-05 Jean Haidouk <haidouk@yandex.com> (tiny change)
* quail/latin-alt.el ("french-alt-postfix", "latin-alt-postfix"):
* quail/latin-pre.el ("french-prefix"):
* quail/latin-post.el ("french-postfix"): Add `œ' and `Œ'.
2013-08-28 Paul Eggert <eggert@cs.ucla.edu>
* Makefile.in (SHELL): Now @SHELL@, not /bin/sh,
for portability to hosts where /bin/sh has problems.
2013-06-21 Juanma Barranquero <lekktu@gmail.com>
* quail/croatian.el ("croatian-prefix"):
* quail/czech.el ("czech", "czech-qwerty"):
* quail/ipa-praat.el ("ipa-praat"):
* quail/ipa.el ("ipa-x-sampa"):
* quail/tibetan.el ("tibetan-wylie", "tibetan-tibkey"):
* quail/uni-input.el (ucs-input-activate): Fix typos in docstrings.
2013-05-25 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (leim-list.el, check-declare):
Replace reveal-filename with unmsys--file-name.
2013-05-16 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (leim-list.el, check-declare): Use reveal-filename.
2013-04-01 Paul Eggert <eggert@cs.ucla.edu>
Use UTF-8 for most files with non-ASCII characters (Bug#13936).
* quail/cyrillic.el, quail/czech.el, quail/ethiopic.el:
* quail/greek.el, quail/hanja.el, quail/hanja3.el, quail/hebrew.el:
* quail/lao.el, quail/lrt.el, quail/slovak.el, quail/symbol-ksc.el:
* quail/thai.el, quail/tibetan.el, quail/viqr.el, quail/vntelex.el:
* quail/vnvni.el, quail/welsh.el:
Switch from iso-2022-7bit to utf-8 or (if needed) utf-8-emacs.
2013-03-18 Paul Eggert <eggert@cs.ucla.edu>
* Makefile.in ($(srcdir)/ja-dic/ja-dic.el): Use batch-skkdic-convert.
2013-03-18 Eli Zaretskii <eliz@gnu.org>
* makefile.w32-in ($(srcdir)/ja-dic/ja-dic.el): New target.
2013-03-18 Paul Eggert <eggert@cs.ucla.edu>
Automate the build of ja-dic.el (Bug#13984).
ja-dic.el no longer needs to be in the repository: it's now
generated as part of the build from bzr. Also, update SKK-JISYO.L to
match the upstream source exactly.
* ja-dic/ja-dic.el: Remove from repository. It is still distributed
as part of the Emacs tarball.
* Makefile.in ($(srcdir)/ja-dic/ja-dic.el): New rule.
(compile-main): Depend on it.
* SKK-DIC/README: Update to reflect new build procedure.
* SKK-DIC/SKK-JISYO.L: Update to match source exactly.
This is now the annotated version, to match the upstream file name;
the unannotated one is built from it automatically.
2013-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/latin-ltx.el: Resolve conflicts (bug#13950).
(latin-ltx--mark-map, latin-ltx--mark-re): New constants.
(latin-ltx--define-rules): Check for conflicts. Eval `re's.
(rules): Use tighter regexps to avoid conflicts.
Consolidate the various rules for combining marks.
2013-02-08 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/latin-ltx.el: Add greek superscripts.
2012-12-04 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/latin-ltx.el: Avoid deprecated chars for \langle and \rangle.
Remove \rightparengtr and \leftparengtr for lack of consensus.
Suggested by Mattias Engdegård <mattiase@bredband.net> (bug#12948).
2012-09-05 Eli Zaretskii <eliz@gnu.org>
* quail/hebrew.el ("yiddish-royal"): Fix several bogus entries.
2012-08-17 Daniel Bergey <bergey@alum.mit.edu> (tiny change)
* quail/indian.el (quail-define-inscript-package):
Set kbd-translate for all Inscript layouts. It's a positional
layout: vowels should be on the left hand regardless of the
underlying characters produced by those keys. (Bug#12072)
2012-08-06 Mohsen BANAN <libre@mohsen.1.banan.byname.net>
* quail/persian.el: Add some mappings. (Bug#11812)
(farsi-isiri-9147, farsi-transliterate-banan): Doc fixes.
2012-07-30 Paul Eggert <eggert@cs.ucla.edu>
Update .PHONY listings in makefiles.
* Makefile.in (.PHONY): Add all, compile-main, clean, mostlyclean,
bootstrap-clean, distclean, maintainer-clean, extraclean.
2012-07-29 Paul Eggert <eggert@cs.ucla.edu>
deactive->inactive, inactivate->deactivate spelling fixes (Bug#10150)
* quail/uni-input.el (ucs-input-deactivate):
Rename from ucs-input-inactivate.
* quail/hangul.el (hangul-input-method-deactivate):
Rename from hangul-input-method-inactivate.
2012-07-10 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/ipa.el: Use cl-lib.
* quail/hangul.el: Don't require CL.
2012-06-12 Nguyen Thai Ngoc Duy <pclouds@gmail.com>
* quail/vnvni.el: New file (Bug#4747).
2012-05-22 Glenn Morris <rgm@gnu.org>
* Makefile.in (SUBDIRS): Remove variable and rule.
(MKDIR_P): Add it back.
(all, changed.tit, changed.misc, leim-list.el):
Don't depend on SUBDIRS.
(changed.tit, changed.misc): Ensure output directory exists.
(distclean): Don't use SUBDIRS.
2012-05-21 Glenn Morris <rgm@gnu.org>
* Makefile.in (install): Remove, let top-level do it.
(version, prefix, datarootdir, datadir, ns_appresdir, leimdir):
(MKDIR_P, GZIP_PROG): Remove, no longer used.
* Makefile.in (install_prefix): Remove.
(LEIM_INSTALLDIR): Rename to leimdir.
(install): Update for this change.
* Makefile.in (leim-list.el, install): Scrap superfluous subshells.
2012-05-12 Glenn Morris <rgm@gnu.org>
* Makefile.in (MKDIR_P): New, set by configure.
(install): Use $MKDIR_P.
2012-05-10 Glenn Morris <rgm@gnu.org>
* Makefile.in: Install self-contained ns files directly to
their final destination.
(install_prefix): New.
(LEIM_INSTALLDIR): New, set by configure.
(install): Use LEIM_INSTALLDIR.
* Makefile.in (MV_DIRS): Remove.
(install): Simplify the --with-ns case.
2012-04-09 Glenn Morris <rgm@gnu.org>
* Makefile.in (EMACS): Rename from BUILT_EMACS.
(RUN_EMACS, compile-main): Update for this change.
* Makefile.in (../src/emacs): Remove this rule, no longer relevant
since leim distributed with Emacs (eg lisp/ has no such rule).
(all): Remove $BUILT_EMACS dependence.
2012-04-09 Eli Zaretskii <eliz@gnu.org>
* quail/latin-ltx.el (latin-ltx--define-rules): Comment out
debugging messages.
2012-04-09 Glenn Morris <rgm@gnu.org>
* Makefile.in: Compute list of .el files to be compiled dynamically,
as the lisp/ directory does, rather than hard-coding it.
Also, separate leim-list generation from byte-compilation.
(TIT_GB, TIT_BIG5, CHINESE_TIT, MISC, TIT_MISC):
Make them store the .el files rather than the .elc files.
(NON_TIT_GB, NON_TIT_BIG5, CHINESE_NON_TIT, CHINESE_GB)
(CHINESE_GB, CHINESE_BIG5, JAPANESE, KOREAN, THAI, VIETNAMESE)
(LAO, INDIAN, TIBETAN, LATIN, UNICODE, SLAVIC, GREEK, RUSSIAN)
(OTHERS, CHINESE, EASTASIA, ASIA, EUROPEAN, WORLD, NON_TIT_MISC):
Remove variables listing the non-generated .el files.
(.el.elc): Add explicit load-path for quail.
(all): Depend on compile-main rule rather than $WORLD.
(changed.tit, changed.misc): Also depend on $SUBDIRS.
(leim-list.el): Don't depend on changed.tit or changed.misc.
Remove unnecessary compilation check.
(setwins, compile-targets, compile-main): New.
(clean, mostlyclean): Update for change in TIT_MISC contents.
(bootstrap-clean): Use a glob match to delete .elc, not a fixed list.
2012-04-09 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/latin-ltx.el: Auto-generate some of the entries.
(latin-ltx--ascii-p): New function.
(latin-ltx--define-rules): New macro.
(define-rules): Use it.
2012-03-25 Eli Zaretskii <eliz@gnu.org>
* makefile.w32-in (install): Use $(DIRNAME)_same-dir.tst instead
of same-dir.tst, to avoid stepping on other (parallel) Make job's
toes.
2012-03-21 Kenichi Handa <handa@m17n.org>
* quail/indian.el ("devanagari-itrans"): Add a few more useful
keys (Bug#10935).
2012-03-16 Kenichi Handa <handa@m17n.org>
* quail/indian.el (telugu-inscript): Fix typo. (Bug#10936)
2012-03-13 Йордан Миладинов <jordanmiladinov@gmail.com> (tiny change)
* quail/cyrillic.el (bulgarian-alt-phonetic):
New input method. (Bug#10893)
2012-03-09 Mohsen BANAN <libre@mohsen.1.banan.byname.net>
* quail/persian.el: Update which includes: (1) full compliance to
ISIRI-6219, forbidden characters were eliminated and missing
characters were added; (2) layer 3 of ISIRI-9147 is now
implemented with a '\' prefix; (3) double entry of characters
which were postfixed with 'h' is now supported; (4) lots of
comment and additional pointers have been added.
2011-12-15 Kenichi Handa <handa@m17n.org>
* quail/ethiopic.el ("ethiopic"): Do not refer to
ethio-prefer-ascii-punctuation.
2011-11-20 Juanma Barranquero <lekktu@gmail.com>
* quail/hangul.el (hangul-character): Fix typo.
2011-09-27 Jambunathan K <kjambunathan@gmail.com>
* quail/indian.el (quail-tamil-itrans-misc-table): Delete it.
(quail-tamil-itrans-numerics-and-symbols-table)
(quail-tamil-itrans-various-signs-and-digits-table): New variables.
("tamil-itrans"): Show the values of above variables (Bug#9336).
2011-09-22 Kenichi Handa <handa@m17n.org>
* quail/indian.el (quail-tamil-itrans-syllable-table)
(quail-tamil-itrans-misc-table): New variables.
("tamil-itrans"): Improve the docstring by showing the values of
above variables (Bug#9336).
2011-09-06 Paul Eggert <eggert@cs.ucla.edu>
* Makefile.in (install): install-sh is now in build-aux (Bug#9169).
2011-08-29 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/latin-ltx.el: Complete the super and subscript letters.
2011-08-20 Glenn Morris <rgm@gnu.org>
* Makefile.in (OTHERS):
* makefile.w32-in (MISC): Add ipa-praat.elc.
2011-07-23 Yair F <yair.f.lists@gmail.com>
* quail/hebrew.el ("hebrew"): Additional key mappings.
("hebrew-new", "hebrew-lyx", "hebrew-full")
("hebrew-biblical-tiro", "hebrew-biblical-sil", "yiddish-royal")
("yiddish-keyman"): New input methods.
2011-06-12 Andreas Schwab <schwab@linux-m68k.org>
* SKK-DIC/SKK-JISYO.L: Add proper coding tag.
* CXTERM-DIC/4Corner.tit, CXTERM-DIC/ARRAY30.tit,
* CXTERM-DIC/CCDOSPY.tit, CXTERM-DIC/ECDICT.tit,
* CXTERM-DIC/ETZY.tit, CXTERM-DIC/PY-b5.tit,
* CXTERM-DIC/Punct-b5.tit, CXTERM-DIC/Punct.tit,
* CXTERM-DIC/QJ-b5.tit, CXTERM-DIC/QJ.tit, CXTERM-DIC/SW.tit,
* CXTERM-DIC/TONEPY.tit, CXTERM-DIC/ZOZY.tit: Likewise.
* MISC-DIC/cangjie-table.b5, MISC-DIC/cangjie-table.cns,
* MISC-DIC/pinyin.map, MISC-DIC/ziranma.cin: Likewise.
* Makefile.in (TIT_BIG5): Rename from TIT-BIG5.
2011-05-30 Oliver Scholz <epameinondas@gmx.de>
* quail/ipa-praat.el: New input method.
2011-05-16 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (OTHERS): Add $(srcdir)/quail/persian.elc.
* makefile.w32-in (MISC): Add $(srcdir)/quail/persian.elc.
2011-05-16 Mohsen BANAN <libre@mohsen.banan.1.byname.net>
* quail/persian.el: New file.
2011-05-05 Eli Zaretskii <eliz@gnu.org>
* quail/latin-ltx.el <\beth, \gimel, \daleth>: Produce
corresponding symbols rather than Hebrew letters. (Bug#8563)
* quail/latin-ltx.el <\aleph>: Produce ALEF SYMBOL instead of
HEBREW LETTER ALEF. (Bug#8563)
2011-03-23 Glenn Morris <rgm@gnu.org>
* Makefile.in (install): Use `install-sh -d' rather than mkinstalldirs.
2011-03-07 Chong Yidong <cyd@stupidchicken.com>
* Version 23.3 released.
2011-02-28 Juanma Barranquero <lekktu@gmail.com>
* quail/ethiopic.el ("ethiopic"): Fix tpo in docstring.
2011-01-28 Paul Eggert <eggert@cs.ucla.edu>
Redo spelling of Makefile variables to conform to POSIX.
POSIX does not allow "-" in Makefile variable names.
Reported by Bruno Haible in
<https://lists.gnu.org/r/emacs-devel/2011-01/msg00990.html>.
* Makefile.in (BUILT_EMACS): Rename from BUILT-EMACS.
(TIT_GB): Rename from TIT-GB.
(CHINESE_TIT): Rename from CHINESE-TIT.
(NON_TIT_GB): Rename from NON-TIT-GB.
(NON_TIT_BIG5): Rename from NON-TIT-BIG5.
(CHINESE_NON_TIT): Rename from CHINESE-NON-TIT.
(CHINESE_GB): Rename from CHINESE-GB.
(CHINESE_BIG5): Rename from CHINESE-BIG5.
(TIT_MISC): Rename from TIT-MISC.
(NON_TIT_MISC): Rename from NON-TIT-MISC.
(TIT_SOURCES): Rename from TIT-SOURCES.
(MISC_SOURCES): Rename from MISC-SOURCES.
2011-01-08 Glenn Morris <rgm@gnu.org>
* makefile.w32-in (RUN_EMACS):
* Makefile.in (RUN-EMACS): Add --no-site-lisp.
* makefile.w32-in (RUN_EMACS):
* Makefile.in (RUN-EMACS): -batch implies --no-init-file.
2010-08-28 Kenichi Handa <handa@m17n.org>
* quail/japanese.el (quail-japanese-update-translation):
Fix handling of invalid key.
2010-08-15 Andreas Schwab <schwab@linux-m68k.org>
* quail/vntelex.el ("vietnamese-telex"): Doc fix.
* quail/georgian.el: Remove extra backslashes.
2010-08-14 Andreas Schwab <schwab@linux-m68k.org>
* quail/arabic.el: Quote [ and ].
* quail/latin-ltx.el: Likewise.
* quail/greek.el ("greek", "greek-postfix"): Change string to
character.
2010-08-13 Kenichi Handa <handa@m17n.org>
* quail/greek.el ("greek-postfix"): Add rules for Greek style quotes.
2010-08-09 Kenichi Handa <handa@m17n.org>
* quail/greek.el ("greek"): Add rules for Greek style quotes.
2010-05-15 Glenn Morris <rgm@gnu.org>
* Makefile.in (install): Remove references to CVS-related files.
2010-05-07 Chong Yidong <cyd@stupidchicken.com>
* Version 23.2 released.
2010-04-06 Chong Yidong <cyd@stupidchicken.com>
* quail/vntelex.el: Fix "af" rule (Bug#5836).
2010-03-27 Eli Zaretskii <eliz@gnu.org>
* makefile.w32-in ($(TIT), $(MISC_DIC), leim-list.el): Enclose the
argument of "-l" in $(ARGQUOTE), in case it includes blanks or
other special characters.
2010-03-18 Glenn Morris <rgm@gnu.org>
* Makefile.in (maintainer-clean): Use bootstrap-clean.
(extraclean): Fix deletion patterns.
* Makefile.in (dot): Remove, since ../ is used throughout the
other Makefiles.
2010-03-10 Chong Yidong <cyd@stupidchicken.com>
* Branch for 23.2.
2010-02-16 Kenichi Handa <handa@m17n.org>
* SKK-DIC/SKK-JISYO.L: Updated to the latest version.
2009-12-05 Vasily Korytov <vasily@korytov.pp.ru>
* quail/cyrillic.el (russian-typewriter): Change keyboard layout.
(Bug#904)
2009-09-09 Glenn Morris <rgm@gnu.org>
* Makefile.in (install): Set umask to world-readable before creating
directories.
2009-08-31 Juri Linkov <juri@jurta.org>
* quail/ipa.el ("ipa"): Set `forget-last-selection' to nil.
("ipa-x-sampa"): Set `forget-last-selection' to nil.
Set `deterministic' to nil.
("ipa"): Bind "g" to U+0261, and "tsh" to a list of "U+02A7",
"U+0074 U+0283", "U+0074 U+2040 U+0283".
("ipa-kirshenbaum", ipa-x-sampa"): Bind "g" to U+0261, and "tS"
to a list of "U+02A7", "U+0074 U+0283", "U+0074 U+2040 U+0283".
Fix comments.
2009-08-31 Juri Linkov <juri@jurta.org>
* quail/ipa.el ("ipa-kirshenbaum"): Rename from "kirshenbaum-ipa".
("ipa-x-sampa"): Rename from "x-sampa-ipa".
(ipa-x-sampa-implosive-submap): Rename from
x-sampa-implosive-submap.
(ipa-x-sampa-prepend-to-keymap-entry): Rename from
x-sampa-prepend-to-keymap-entry.
(ipa-x-sampa-underscore-implosive): Rename from
x-sampa-underscore-implosive.
(ipa-x-sampa-implosive-submap): Move before first use.
2009-08-30 Aidan Kehoe <kehoea@parhasard.net>
* quail/ipa.el ("kirshenbaum-ipa", "x-sampa-ipa"):
Two new input methods, both following widely-used Usenet
conventions for mapping ASCII to the IPA. Kirshenbaum is common in
sci.lang and alt.usage.english, X-SAMPA in various (mostly
European) non-English language fora. X-SAMPA is slightly more
complex to support in Quail that Kirshenbaum, whence the two extra
function and one extra submap to support it.
(x-sampa-prepend-to-keymap-entry): New function.
(x-sampa-underscore-implosive): New function.
(x-sampa-implosive-submap): New Quail submap.
2009-08-30 Aidan Kehoe <kehoea@parhasard.net>
* quail/ipa.el: Recode the file as UTF-8, for better
interoperability with other applications.
2009-08-29 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/latin-ltx.el (\circ): Use the `ring operator' rather than
`white circle'.
* Makefile.in (leim-list.el, install): Don't use -r to remove files.
2009-08-25 Glenn Morris <rgm@gnu.org>
* quail/hangul.el (top-level): Don't require cl at run-time.
2009-08-21 Thamer Mahmoud <thamer.mahmoud@gmail.com> (tiny change)
* quail/arabic.el: Add missing keys that exist on the Arabic X
keyboard. Don't insert Lam-alef ligatures from the Arabic
Presentation Forms ranges; instead, separate Lam-Alef ligatures
into a list of two letters (Lam and a suitable Alef).
2009-06-23 Kenichi Handa <handa@m17n.org>
* quail/hangul.el (hangul-to-hanja-conversion): When it is called
while korean input method is off, convert the following character.
2009-06-21 Chong Yidong <cyd@stupidchicken.com>
* Branch for 23.1.
2009-06-18 Kenichi Handa <handa@m17n.org>
* quail/hangul.el (hangul-im-keymap): Add binding of key
Hangul_Hanja.
2009-05-04 Simon Leinen <simon.leinen@switch.ch> (tiny change)
* Makefile.in (install): Avoid using $$(..) construct, for Solaris
compatibility.
2009-04-12 Andreas Schwab <schwab@linux-m68k.org>
* Makefile.in (install): Remove .gitignore files.
2009-03-19 Kenichi Handa <handa@m17n.org>
* leim-ext.el: Change the encoding to utf-8.
2008-12-30 Jan Djärv <jan.h.d@swipnet.se>
* Makefile.in (install): Remove old directories in ns_appresdir before
moving new directories there.
2008-11-11 Juanma Barranquero <lekktu@gmail.com>
* quail/hangul.el (hangul-im-keymap, hangul-insert-character)
(hangul-djamo, hangul2-input-method-moum, hangul3-input-method-cho)
(hangul3-input-method-jung, hangul3-input-method-jong):
Fix typos in docstrings.
2008-11-07 Vasily Korytov <vasily@korytov.pp.ru> (tiny change)
* quail/cyrillic.el: Handle backslash key (bug#839).
2008-10-20 Kenichi Handa <handa@m17n.org>
* quail/indian.el (inscript-mlm-keytable): New variable.
(malayalam-inscript): Use inscript-mlm-keytable.
2008-09-11 Magnus Henoch <mange@freemail.hu>
* quail/cyrillic.el ("cyrillic-translit"): Add g' for Ukrainian G
with upturn.
2008-09-02 Carsten Bormann <cabo@tzi.org>
* quail/latin-post.el ("german-postfix"): Do not translate ue to
\"u after a, e or q, because that would be extremely uncommon
compared to aue, eue or que. The only exception is the prefix
"ge", after which, according to corpus statistics, a \"u can be
expected.
2008-08-10 Jihyun Cho <jihyun.jo@gmail.com>
* quail/hangul.el (hangul3-input-method-jong): Fix array indexing bug.
2008-07-19 Juri Linkov <juri@jurta.org>
* quail/cyrillic.el ("cyrillic-translit"): Add two rules "//'" and
"//`" for combining accents as a separate character. Keep two
rules "i`" and "I`" for characters where accent is not a separate
character. Revert changes that added postfix combining accents.
2008-07-17 Adrian Robert <Adrian.B.Robert@gmail.com>
* Makefile.in (install): Perform post-install cleanup inside NS app
bundle.
2008-07-12 Juri Linkov <juri@jurta.org>
* quail/rfc1345.el: Replace non-printable control characters with
equivalent text-only notations.
* quail/cyrillic.el ("cyrillic-translit"): Fix rules with
combining acute accent. Add rules ("e\\" ?э) ("E\\" ?Э).
Change conflicting rules ("u'" ?ў) to ("u~" ?ў), and ("U'" ?Ў)
to ("U~" ?Ў). Doc fix. Put combining accent rules into one group.
2008-07-10 Teodor Zlatanov <tzz@lifelogs.com>
* quail/cyrillic.el: Add more rules to cyrillic-translit, make
everything postfix. Adjust to eliminate conflicts.
2008-06-30 Juanma Barranquero <lekktu@gmail.com>
* quail/hangul3.el: Remove (unneeded since 2008-06-03).
2008-06-27 Glenn Morris <rgm@gnu.org>
* Makefile.in (.el.elc): Copy the echo behavior of lisp/Makefile.in.
2008-06-24 Juanma Barranquero <lekktu@gmail.com>
* makefile.w32-in (MISC): Add $(srcdir)/quail/arabic.elc.
2008-06-20 Eli Zaretskii <eliz@gnu.org>
* makefile.w32-in (distclean): Don't delete `quail' subdir: if we
are building in the sandbox, there are precious files there.
(clean mostlyclean): Delete leim-list.el~.
(distclean): Delete makefile.
2008-06-13 Teodor Zlatanov <tzz@lifelogs.com>
* quail/cyrillic.el: Add quotation marks, paragraph symbol, angled
brackets, number symbol, and accented aeio to cyrillic-translit.
2008-06-03 Jihyun Cho <jihyun.jo@gmail.com>
* quail/hangul.el: Completely re-written.
2008-06-03 Kenichi Handa <handa@m17n.org>
* makefile.w32-in (KOREAN): Remove ${srcdir}/quail/hangul3.elc.
(leim-list.el): Remove leim-list.el at first.
* Makefile.in (KOREAN): Remove ${srcdir}/quail/hangul3.elc.
(leim-list.el): Remove leim-list.el at first.
* leim-ext.el: Register input methods "korean-hangul",
"korean-hangul3f", "korean-hangul390", and "korean-hangul3".
2008-03-26 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/latin-ltx.el: Don't use single-char mapping from ~ to NBSP.
2008-02-21 Kenichi Handa <handa@ni.aist.go.jp>
* quail/indian.el: Don't require devan-util.
2008-02-01 James Cloos <cloos@jhcloos.com>
* quail/arabic.el: Update (sync with xkeyboard-config keyboard).
2008-02-01 Kenichi Handa <handa@m17n.org>
* Makefile.in (OTHERS): Add arabic.elc.
2008-02-01 James Cloos <cloos@jhcloos.com>
* quail/arabic.el: New file.
2008-02-01 Kenichi Handa <handa@m17n.org>
* MISC-DIC/pinyin.map: Fix encoding to that of the original file.
2008-02-01 KAWABATA, Taichi <kawabata@m17n.org>
* quail/indian.el (quail-indian-flatten-list): Delete it.
(quail-define-inscript-package): Pay attention to `nil' values of
char/key-table.
(inscript-tml-keytable): New variable. Use it for Tamil inscript.
2008-02-01 Dave Love <fx@gnu.org>
* quail/latin-post.el ("turkish-latin-3-postfix"): Make it
just an alias for turkish-postfix.
* quail/latin-alt.el ("turkish-latin-3-alt-postfix"): Make it
just an alias for turkish-alt-postfix.
* quail/cyrillic.el (ukrainian-computer): Fix duplicate `\'.
2008-02-01 Kenichi Handa <handa@m17n.org>
* quail/thai.el: Don't require thai-util.
(quail-thai-update-translation): Delete function.
(thai-generate-quail-map): Change to a macro that directly calls
quail-define-rules.
("thai-kesmanee", "thai-pattachote"): Don't use
UPDATE-TRANSLATION-FUNCTION.
* quail/indian.el (quail-indian-preceding-char-position):
Delete function.
(quail-indian-update-preceding-char): Delete variable.
(quail-indian-update-translation): Delete function.
(quail-define-indian-trans-package): Don't call
quail-define-package with quail-indian-update-translation.
(quail-define-inscript-package): Likewise.
2008-02-01 Dave Love <fx@gnu.org>
* quail/indian.el (quail-indian-preceding-char-position)
(quail-indian-update-translation, quail-define-inscript-package):
Use characterp, not char-valid-p.
2008-02-01 Dave Love <fx@gnu.org>
* quail/welsh.el ("welsh"): Doc fix.
* quail/cyrillic.el: Reinstate some commented-out redundancies.
("russian-typewriter"): Rename from cyrillic-typewriter.
Make cyrillic-jcuken effectively an alias for it.
("russian-computer"): New.
("bulgarian-phonetic"): Rename from bulgarian-pho.
("bulgarian-bds"): Rename from bulgarian-standard.
2008-02-01 Dave Love <fx@gnu.org>
* ja-dic/ja-dic.el: Add coding tag.
2008-02-01 Dave Love <fx@gnu.org>
* quail/latin-post.el: Recode to utf-8.
("latin-postfix"): New method.
* quail/latin-alt.el: Recode to utf-8.
("latin-alt-postfix"): New method.
* quail/latin-pre.el: Recode to utf-8.
("latin-1-prefix", "latin-8-prefix", "latin-9-prefix"): Add nbsp.
("latin-3-prefix"): Remove bogus Latin-3 characters and ~o -> ġ,
~O -> Ġ.
("latin-prefix"): New method.
* quail/uni-input.el (utf-8-ccl-encode): Delete.
(ucs-input-method): Modify.
2008-02-01 Kenichi Handa <handa@etl.go.jp>
* Makefile.in (RUN-EMACS): Add LC_ALL=C.
2008-01-14 Aidan Kehoe <kehoea@parhasard.net> (tiny change)
* quail/latin-ltx.el ("TeX"): Correct the mappings for \v{k} and \vk.
2008-01-06 Dan Nicolaescu <dann@ics.uci.edu>
* makefile.w32-in:
* Makefile.in: Remove references to Xenix.
2007-12-15 Richard Stallman <rms@gnu.org>
* quail/latin-post.el ("scandinavian-postfix"): Doc fix.
* quail/latin-alt.el: Many doc fixes.
("danish-alt-postfix")
("esperanto-alt-postfix", "finnish-alt-postfix")
("german-alt-postfix", "icelandic-alt-postfix")
("norwegian-alt-postfix", "scandinavian-alt-postfix")
("spanish-alt-postfix", "swedish-alt-postfix"):
Delete; they were identical to the non-alt versions.
2007-12-07 Kenichi Handa <handa@ni.aist.go.jp>
* quail/lao.el (quail-map-from-table): Allow a tone just after a
consonant.
2007-11-17 Glenn Morris <rgm@gnu.org>
* Makefile.in (check-declare): New target.
2007-10-31 Glenn Morris <rgm@gnu.org>
* Makefile.in (install): Change ownership of installed files.
2007-10-20 Theresa O'Connor <hober0@gmail.com> (tiny change)
* quail/latin-ltx.el ("\\qed"): Add this rule.
2007-10-24 Juanma Barranquero <lekktu@gmail.com>
* quail/indian.el (quail-indian-update-preceding-char):
Don't mark the variable as frame-local; it wasn't used as such.
2007-07-25 Glenn Morris <rgm@gnu.org>
* Relicense all FSF files to GPLv3 or later.
* COPYING: Switch to GPLv3.
2007-07-16 Eli Zaretskii <eliz@gnu.org>
* makefile.w32-in (extraclean): Don't delete *~.
2007-06-02 Chong Yidong <cyd@stupidchicken.com>
* Version 22.1 released.
2007-01-30 Kenichi Handa <handa@m17n.org>
* CXTERM-DIC/CCDOSPY.tit, CXTERM-DIC/PY-b5.tit, CXTERM-DIC/SW.tit,
* CXTERM-DIC/TONEPY.tit: Add copyright and license notices.
* MISC-DIC/pinyin.map, MISC-DIC/ziranma.cin: Add copyright and
license notices.
2007-01-24 Kenichi Handa <handa@m17n.org>
* MISC-DIC/README: New file.
* CXTERM-DIC/README: New file.
* CXTERM-DIC/4Corner.tit, CXTERM-DIC/CCDOSPY.tit,
* CXTERM-DIC/PY-b5.tit, CXTERM-DIC/QJ-b5.tit, CXTERM-DIC/QJ.tit,
* CXTERM-DIC/SW.tit, CXTERM-DIC/TONEPY.tit: Updated from
X11R6/contrib/programs/cxterm.
* ja-dic/ja-dic.el: Regenerated.
2007-01-12 Kenichi Handa <handa@m17n.org>
* quail/uni-input.el (ucs-input-method): Signal an error for a
Unicode character that is not yet supported.
2006-12-26 Andreas Schwab <schwab@suse.de>
* Makefile.in (datarootdir): Define.
2006-12-20 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (leim-list.el): Depend on ${TIT-MISC}, not
${NON-TIT-MISC}.
2006-12-09 Juanma Barranquero <lekktu@gmail.com>
* quail/latin-alt.el ("scandinavian-alt-postfix"): Fix typo.
* quail/uni-input.el (ucs-input-help): Fix title of ucs input method.
2006-12-09 Eli Zaretskii <eliz@gnu.org>
* makefile.w32-in (leim-list.el): Depend on leim-ext.el as well.
Run Emacs to append non-empty non-comment lines in leim-ext.el
to leim-list.el.
2006-12-05 Juanma Barranquero <lekktu@gmail.com>
* makefile.w32-in (MISC): Add $(srcdir)/quail/sisheng.elc.
2006-11-29 Juanma Barranquero <lekktu@gmail.com>
* quail/greek.el ("greek-mizuochi"): Remove spurious initial newline
in docstring.
2006-11-04 Romain Francoise <romain@orebokech.com>
* Makefile.in (bootstrap-clean): New target.
2006-10-12 Kenichi Handa <handa@m17n.org>
* Makefile.in (install): Be sure to make ${INSTALLDIR} before `cd'
to it.
2006-10-05 Chong Yidong <cyd@stupidchicken.com>
* quail/latin-ltx.el: Fix typo in previous change.
2006-10-05 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/latin-ltx.el: Remove rules that start with { since they are
redundant and hence impact the { key for no good reason.
2006-10-02 Kenichi Handa <handa@m17n.org>
* Makefile.in (install): Fix previous change.
2006-09-28 Kenichi Handa <handa@m17n.org>
* Makefile.in (install): Be sure to make ${INSTALLDIR}.
2006-09-15 Jay Belanger <belanger@truman.edu>
* COPYING: Replace "Library Public License" by "Lesser Public
License" throughout.
2006-09-06 Michaël Cadilhac <michael.cadilhac@lrde.org>
* quail/uni-input.el (ucs-input-method): Don't make the action of
a key not in [0-9a-zA-Z] when it was expected to be. Let the Emacs
mechanism do it.
2006-07-12 David Kastrup <dak@gnu.org>
* quail/greek.el: Change iota subscriptum transliteration in
Ibycus4 encoding's capitals from "i" to "|".
2006-03-03 Claudio Fontana <claudio@gnu.org>
* Makefile.in (install): Add DESTDIR variable to support staged
installations.
2005-12-17 Eli Zaretskii <eliz@gnu.org>
* makefile.w32-in ($(TIT), leim-list.el): Warn that parts of
commands enclosed in $(ARGQUOTE)s should not be split between two
lines, as that will break with GNU Make >3.80, when sh.exe is used
and arg quoting is with '..'.
2005-11-03 Andreas Schwab <schwab@suse.de>
* Makefile.in (GZIP_PROG): Rename from GZIP.
(install): Adjust.
2005-11-01 Romain Francoise <romain@orebokech.com>
* Makefile.in (install): Compress source files.
2005-10-28 Juri Linkov <juri@jurta.org>
* quail/symbol-ksc.el: Add missing characters from 1st pos of
every table of [korean-ksc5601], and swap incorrectly ordered
characters at pos 91 and 90.
2005-10-26 Torsten Bronger <bronger@physik.rwth-aachen.de> (tiny change)
* quail/latin-ltx.el ("TeX"): Change "\," mapping to U+202F (not
U+2006). Add more mappings from TeX's textcomp package.
2005-10-25 Juri Linkov <juri@jurta.org>
* quail/cyrillic.el ("cyrillic-translit"): Set 4th arg `guidance'
to t for this multi-key input method.
2005-10-24 Kenichi Handa <handa@m17n.org>
* quail/uni-input.el (ucs-input-activate): Don't add
quail-kill-guidance-buf to kill-buffer-hook.
2005-07-08 Kenichi Handa <handa@m17n.org>
* quail/japanese.el (quail-japanese-kanji-kkc): Fix order of
insertion and deletion.
2005-07-04 Lute Kamstra <lute@gnu.org>
Update FSF's address in GPL notices.
2005-06-28 Kenichi Handa <handa@m17n.org>
* leim-ext.el: Add rules for inserting full-width space for
quail/Punct and quail/Punct-b5.
2005-06-04 Eli Zaretskii <eliz@gnu.org>
* makefile.w32-in (distclean): Fix a typo (colon was after "clean").
(extraclean): New target, emulates Makefile.in.
2005-04-06 Kenichi Handa <handa@m17n.org>
* quail/sgml-input.el ("sgml"): Enable quail-completion by typing TAB.
2005-03-26 Kenichi Handa <handa@m17n.org>
* quail/latin-ltx.el ("TeX"): Enable quail-completion by typing TAB.
2005-03-18 Kenichi Handa <handa@m17n.org>
* quail/thai.el (quail-thai-update-translation): Delete it.
(thai-generate-quail-map): Generate a simpler map.
("thai-kesmanee"): Don't use quail-thai-update-translation.
(thai-generate-quail-map): Likewise.
2005-03-15 Kenichi Handa <handa@m17n.org>
* quail/thai.el (thai-generate-quail-map): Fix the kesmanee layout.
2005-03-08 Kenichi Handa <handa@m17n.org>
* quail/latin-pre.el ("latin-1-prefix"): Add rule "__"->"_".
("latin-9-prefix"): Add rules "__"->"_", "_ "->NBSP.
2004-12-04 Kenichi Handa <handa@m17n.org>
* quail/lao.el (lao-key-alist): Declare it by defvar.
(lao-key-alist-vector): New variable.
(lao-consonant-key-alist, lao-semivowel-key-alist)
(lao-vowel-key-alist, lao-voweltone-key-alist)
(lao-tone-key-alist, lao-other-key-alist): Initialize them from
lao-key-alist-vector.
2004-09-25 Kenichi Handa <handa@m17n.org>
* quail/uni-input.el (ucs-input-method): Add error clause to
condition-case.
2004-09-21 Kenichi Handa <handa@m17n.org>
* quail/uni-input.el: Move the call of register-input-method to
leim-ext.el.
(ucs-input-insert-char): New function.
(ucs-input-method): Use ucs-input-insert-char.
(ucs-input-activate): Call quail-hide-guidance instead of
quail-hide-guidance-buf.
* leim-ext.el: Add autoload for 'ucs-input-activate and
register-input-method for "ucs".
2004-08-21 David Kastrup <dak@gnu.org>
* quail/greek.el ("greek-babel"): Add accent/breathing/uppercase
combinations.
2004-08-16 Kenichi Handa <handa@m17n.org>
* quail/georgian.el ("georgian"): Call quail-define-package with
the show-layout arg t.
2004-08-06 Andreas Schwab <schwab@suse.de>
* Makefile.in (install): Remove .arch-inventory files.
2004-07-01 David Kastrup <dak@gnu.org>
* quail/greek.el ("((") ("))"): Add quotation mark shorthands.
2004-06-30 Andreas Schwab <schwab@suse.de>
* Makefile.in (${CHINESE-TIT:.elc=.el}): Depend on changed.tit to
serialize parallel builds.
(${MISC:.elc=.el}): Depend on changed.misc.
2004-06-05 Kenichi Handa <handa@m17n.org>
* Makefile.in (leim-list.el): Depend on leim-ext.el. Append the
contents of leim-ext.el to leim-list.el.
* leim-ext.el: New file.
2004-05-17 Werner Lemberg <wl@gnu.org>
* quail/sisheng.el: New file.
2004-05-17 Kenichi Handa <handa@m17n.org>
* Makefile.in (OTHERS): Add ${srcdir}/quail/sisheng.elc.
2004-05-11 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (leim-list.el): Move commands to convert TIT and
MISC dictionaries from here...
(changed.tit, changed.misc): ...to here. Remove the (now
unneeded) test of the contents of changed.* files.
2004-05-10 Andreas Schwab <schwab@suse.de>
* Makefile.in (all): Re-add dependency on ${WORLD} so that lisp
files are compiled when bootstrapping.
2004-05-07 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/latin-ltx.el ("TeX"): Fix typo.
2004-05-06 Stefan Monnier <monnier@iro.umontreal.ca>
* quail/latin-ltx.el: Use utf-8 coding.
("TeX"): Add de and fr quotes. From Karl Eichwalder <ke@suse.de>.
2004-05-04 Kenichi Handa <handa@m17n.org>
* Makefile.in (TIT-SOURCES): Prepend ${srcdir} to each element.
(MISC-SOURCES): Likewise.
2004-05-01 Kenichi Handa <handa@m17n.org>
* Makefile.in (OTHERS): Rename from MISC.
(MISC): Rename from MISC-DIC.
(WORLD): Adjust for the above changes.
(TIT-MISC, NON-TIT-MISC): New targets.
(all): Don't depend on ${WORLD}.
(.NOTPARALLEL, .NO_PARALLEL, ${TIT}, ${MSIC-IDC}): Remove these targets.
(TIT-SOURCES, MISC-SOURCES): New macros.
(changed.tit, changed.misc): New targets.
(leim-list.el): Depend on ${NON-TIT-MISC}, changed.tit, and
changed.misc. Generate quail files from TIT and MISC files if
necessary.
(clean mostlyclean): Delete ${TIT-MISC} instead of ${TIT} and
${MISC-DIC}.
2004-05-03 Jason Rumney <jasonr@gnu.org>
* makefile.nt: Remove.
2004-04-23 Juanma Barranquero <lektu@terra.es>
* makefile.w32-in: Add "-*- makefile -*-" mode tag.
2004-04-09 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (distclean clean): Remove nmake specific
stamp-subdir test.
2004-02-28 Kenichi Handa <handa@m17n.org>
* Makefile.in (all): Depend on ${WORLD} instead of ${TIT} and
${MISC-DIC}.
(clean, mostlyclean): Don't delete *.elc distributed with tarball.
(maintainer-clean): Delete files that are not in CVS repository.
* makefile.nt (all): Depend on $(WORLD) instead of $(TIT) and
$(MISC-DIC).
(clean, mostlyclean): Don't delete *.elc distributed with tarball.
(maintainer-clean): Delete files that are not in CVS repository.
* makefile.w32-in (all): Depend on $(WORLD) instead of $(TIT) and
$(MISC-DIC).
(clean, mostlyclean): Don't delete *.elc distributed with tarball.
(maintainer-clean): Delete files that are not in CVS repository.
2004-02-16 Jérôme Marant <jmarant@nerim.net> (tiny change)
* Makefile.in (distclean maintainer-clean): Depend on clean.
2004-01-27 Ognyan Kulev <ogi@fmi.uni-sofia.bg> (tiny change)
* quail/cyrillic.el ("bulgarian-bds"): Docstring fixed.
2004-01-22 Ognyan Kulev <ogi@fmi.uni-sofia.bg> (tiny change)
* quail/cyrillic.el ("bulgarian-phonetic"): Docstring fixed.
Duplicate entry removed.
("bulgarian-bds"): Docstring fixed.
2003-10-06 Dave Love <fx@gnu.org>
* quail/latin-ltx.el: Several additions.
2003-08-25 Jesper Harder <harder@ifa.au.dk> (tiny change)
* quail/latin-pre.el ("german-prefix"): Fix typo in the docstring.
2003-08-20 Dave Love <fx@gnu.org>
* quail/latin-ltx.el: Add \rhd.
2003-08-19 Markus Rost <rost@math.ohio-state.edu>
* quail/latin-pre.el ("french-prefix"): Fix spacing in docstring.
2003-07-21 KAWABATA, Taichi <kawabata@m17n.org>
* quail/indian.el (quail-indian-update-translation): Adjust the
behavior according to the change of quail-translate-key.
2003-05-22 Kenichi Handa <handa@m17n.org>
* quail/pypunct-b5.el ("chinese-py-punct-b5"): Change the title
Chinese characters from GB to Big5.
2003-05-01 Włodzimierz Bzyl <matwb@julia.univ.gda.pl> (tiny change)
* quail/latin-pre.el ("polish-slash"): Add the rule "//"->?/.
2003-04-05 Andreas Schwab <schwab@suse.de>
* Makefile.in (install): Remove CVS related and backup files from
installation directory.
2003-02-27 David Kastrup <dak@gnu.org>
* quail/greek.el (greek-babel): Add koronis transliteration.
2003-02-23 David Kastrup <dak@gnu.org>
* quail/greek.el (greek-babel): Fix <' accent.
2003-02-17 Dave Love <fx@gnu.org>
* quail/cyrillic.el (ukrainian-computer): Fix duplicate `\'.
2003-02-14 Juanma Barranquero <lektu@terra.es>
* quail/uni-input.el (utf-8-ccl-encode): Fix use of character constants.
2003-02-11 KAWABATA, Taichi <kawabata@m17n.org>
* quail/indian.el (punjabi-itrans, gujarati-itrans, oriya-itrans)
(bengali-itrans, assamese-itrans, telugu-itrans, kannada-itrans)
(malayalam-itrans, tamil-itrans): New ITRANS based input methods.
(punjabi-inscript, gujarati-inscript, oriya-inscript)
(bengali-inscript, assamese-inscript, telugu-inscript)
(kannada-inscript, malayalam-inscript, tamil-inscript):
New INSCRIPT based input methods.
2003-02-07 Kenichi Handa <handa@m17n.org>
* quail/cyrillic.el: Update quail-package-alist (not
input-method-alist) to make "cyrillic-jcuken" an alias of
"russian-typewriter". Add cookie for quail-update-leim-list-file.
2003-02-05 David Kastrup <dak@gnu.org>
* quail/greek.el: Fix iota accent typos in greek-babel encoding.
2003-01-05 Dave Love <fx@gnu.org>
* makefile.w32-in (SLAVIC): Add croatian.elc.
* Makefile.in (SLAVIC): Add croatian.elc.
* quail/croatian.el: New file.
2002-12-10 Juanma Barranquero <lektu@terra.es>
* makefile.w32-in (LATIN): Add welsh.elc.
(MISC): Add georgian.elc.
(UNICODE): Add it.
(WORLD): Add $(UNICODE).
2002-11-14 Dave Love <fx@gnu.org>
* quail/slovak.el: Add coding cookie.
* quail/latin-ltx.el: Fix coding cookie.
* quail/hebrew.el: Add coding cookie.
* quail/czech.el: Add coding cookie.
* quail/welsh.el: Undo last change.
2002-09-11 Dave Love <fx@gnu.org>
* quail/latin-post.el ("slovenian"): New.
2002-09-05 Kenichi Handa <handa@etl.go.jp>
* quail/thai.el (thai-kesmanee): Fix the mapping of `"' and `}'.
2002-07-24 Dave Love <fx@gnu.org>
* quail/latin-alt.el ("latin-alt-postfix"): New.
* quail/latin-post.el ("latin-postfix"): New.
* quail/latin-pre.el ("latin-1-prefix"): Add nbsp.
("latin-3-prefix"): Doc fix.
("latin-prefix"): New.
2002-07-12 Dave Love <fx@gnu.org>
* quail/cyrillic.el: Doc fixes.
("cyrillic-beylorussian"): Commented-out.
("cyrillic-translit-bulgarian"): Delete.
("cyrillic-ukrainian"): Fix `q', `Q', `W', `w' bindings.
("ukrainian-computer", "belarusian", "bulgarian-bds")
("russian-computer"): New.
("bulgarian-phonetic"): Rename from bulgarian-pho. Add §, №, Ю.
("russian-typewriter"): Rename from cyrillic-jcuken.
2002-06-20 Dave Love <fx@gnu.org>
* quail/latin-pre.el ("latin-3-prefix"): Remove bogus Latin-3
characters and ~o -> ġ, ~O -> Ġ.
2002-05-17 Eli Zaretskii <eliz@is.elta.co.il>
* Makefile.in (install): Use "tar -chf", to follow symlinks.
2002-05-04 Triet Hoai Lai <thlai@ee.usyd.edu.au>
* quail/vntelex.el: Add even more rules.
2002-04-30 Triet Hoai Lai <thlai@ee.usyd.edu.au>
* quail/vntelex.el: Add new rules to escape from composition.
2002-04-29 Triet Hoai Lai <thlai@ee.usyd.edu.au>
* quail/vntelex.el: Use proper charset.
2002-04-22 Koaunghi Un <koaunghi@ling.cnu.ac.kr>
* quail/hanja.el ("Od"): Remove rule.
2002-04-19 Eli Zaretskii <eliz@is.elta.co.il>
* quail/indian.el: Replace commented-out lines with a condition
that is always false.
2002-04-06 Jaeyoun Chung <jay@kldp.org>
* quail/hanja3.el ("kf"): Add a few composing rules
from "Taik-kyun Lim" <mongmong@milab.yonsei.ac.kr>
* quail/hangul3.el: Buggy alternative second character
sequence fixed ('/' for 'v' pair).
added a few more third character composing rule.
2002-03-03 Werner Lemberg <wl@gnu.org>
* quail/vntelex.el: New file.
* Makefile.in (VIETNAMESE):
* makefile.nt (VIETNAMESE):
* makefile.w32-in (VIETNAMESE): Add it.
2002-02-10 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in ($(TIT)): Don't depend on $(SUBDIRS).
($(MISC_DIC)): Ditto.
2002-02-06 Richard M. Stallman <rms@gnu.org>
* quail/latin-pre.el (french-prefix): ", " => "," and "~ " => "~".
Don't define "~," at all.
2002-01-29 Pavel Janík <Pavel@Janik.cz>
* quail/latin-pre.el (latin-2-prefix): Add Ě and ě.
From "Dr. Eduard Werner" <edi.werner@gmx.de>.
2002-01-10 Eli Zaretskii <eliz@is.elta.co.il>
* quail/greek.el: Changed the behavior of the "greek" input
method, to consider the "accent" and "diaeresis" as prefix keys.
A new method (named "greek-postfix") was added which implements
the old behavior. Also changed the mapping of the "Q/q" key to
produce the ":/;" characters, as is customary in greek keyboards.
From Nick Patavalis <npat@inaccessnetworks.com>.
2002-01-07 Jaeyoun Chung <jay@kldp.org>
* quail/hangul.el: Remove key sequence mapping for O[rsfaqtTd].
Not used for Korean Hangul Type 2 (request from emacs-kr mailing list).
2002-01-03 Eli Zaretskii <eliz@is.elta.co.il>
* quail/cyrillic.el ("bulgarian-pho"): Fix a typo in a doc string.
2002-01-01 Dave Love <fx@gnu.org>
* quail/indian.el (quail-define-indian-trans-package): Unquote lambda.
(quail-define-inscript-package): Avoid mapcar*.
2001-12-20 Dave Love <fx@gnu.org>
* quail/latin-ltx.el: Fix un-doubled backslashes.
2001-12-15 Dave Love <fx@gnu.org>
* quail/latin-pre.el ("french-prefix", "german-prefix")
("spanish-prefix"): Fix language assignment.
* quail/latin-post.el ("french-postfix", "german-postfix")
("spanish-postfix", "turkish-latin-3-postfix", "turkish-postfix")
("french-keyboard", "french-azerty", "german")
("spanish-keyboard"): Fix language assignment.
* quail/indian.el: Don't require cl.
(quail-indian-flatten-list): Rename from flatten-list.
* quail/cyrillic.el ("cyrillic-beylorussian")
("cyrillic-ukrainian", "cyrillic-translit-bulgarian")
("belarusian", "bulgarian-pho"): Fix language assignment.
* quail/latin-alt.el ("french-alt-postfix", "german-alt-postfix")
("spanish-alt-postfix", "turkish-latin-3-alt-postfix")
("turkish-alt-postfix"): Fix language assignment.
("dutch"): Assign to Dutch. Use chars, not strings.
("lithuanian-numeric", "lithuanian-keyboard", "latvian-keyboard"): New.
2001-12-08 Pavel Janík <Pavel@Janik.cz>
* COPYING: New file.
2001-12-03 Jaeyoun Chung <jay@kldp.org>
* quail/hangul3.el: Add a few convenient composing sequences for
Korean keyboard type 3 users.
2001-11-29 Dave Love <fx@gnu.org>
* quail/latin-ltx.el: Extra translations. Fix some
latin-iso8859-4 characters. Use Hebrew letters, not compatibility
symbols.
2001-11-28 Juanma Barranquero <lektu@terra.es>
* makefile.w32-in (INDIAN): Adjust for the file name change;
quail/devanagari.elc -> quail/indian.elc.
* makefile.nt (INDIAN): Likewise.
2001-11-21 KAWABATA, Taichi <batta@beige.ocn.ne.jp>
* quail/devanagari.el: Renamed to indian.el.
* quail/indian.el: Renamed from devanagari.el, and completely
re-written. The input method devanagari-hindi-transliteration is
merged with devanagari-itrans, devanagari-keyboard-a is renamed to
devanagari-inscript, devanagari-transliteration is renamed to
devanagari-kyoto-harvard.
* Makefile.in: Adjusted for the file name change;
quail/devanagari.elc -> quail/indian.elc.
2001-11-06 Eli Zaretskii <eliz@is.elta.co.il>
* quail/welsh.el: Avoid an error message due to a commented-out
input method.
2001-11-05 Richard M. Stallman <rms@gnu.org>
* quail/rfc1345.el: Get rid of the explicit ^Z character.
2001-11-05 Eli Zaretskii <eliz@is.elta.co.il>
* quail/latin-ltx.el: Remove the call to IT-setup-unicode-display.
2001-11-04 Dave Love <fx@gnu.org>
* Makefile.in (LATIN): Add welsh.
(UNICODE): New.
(MISC): Add georgian.
(WORLD): Add UNICODE.
* quail/welsh.el, quail/georgian.el, quail/rfc1345.el:
* quail/uni-input.el, quail/sgml-input.el: New file.
* quail/cyrillic.el ("bulgarian-pho", "belarusian"): New methods.
* quail/latin-alt.el ("dutch"): New method.
2001-10-27 Francesco Potortì <pot@gnu.org>
* quail/latin-post.el ("italian-postfix"): Undo previous change.
* quail/latin-alt.el ("italian-alt-postfix"): Undo previous change.
2001-10-25 Francesco Potortì <pot@gnu.org>
* quail/latin-post.el ("italian-postfix"): Euro symbol.
* quail/latin-alt.el ("italian-alt-postfix"): Euro symbol.
2001-10-20 Gerd Moellmann <gerd@gnu.org>
* (Version 21.1 released.)
2001-10-19 Eli Zaretskii <eliz@is.elta.co.il>
* CXTERM-DIC/Punct-b5.tit: Add big5 Chinese double spaced alphabet
mappings, so that one could type them without leaving the Hanyu
Pinyin input method. Suggested by Kenichi Handa
<handa@etl.go.jp>.
2001-10-13 Eli Zaretskii <eliz@is.elta.co.il>
* quail/greek.el ("greek-babel"): New input method. From David
Kastrup <David.Kastrup@neuroinformatik.ruhr-uni-bochum.de>.
2001-10-05 Gerd Moellmann <gerd@gnu.org>
* Branch for 21.1.
2001-09-05 Eli Zaretskii <eliz@is.elta.co.il>
* quail/greek.el ("greek-mizuochi"): Doc fix. From David Kastrup
<David.Kastrup@neuroinformatik.ruhr-uni-bochum.de>.
2001-08-06 Gerd Moellmann <gerd@gnu.org>
* quail/py-punct.el ("chinese-py-punct"): Copy the QUAIL-MAP of
"chinese-py".
("chinese-tonepy-punct"): Copy the QUAIL-MAP of "chinese-tonepy".
2001-07-16 Pavel Janík <Pavel@Janik.cz>
* ja-dic/ja-dic.el, quail/cyril-jis.el, quail/cyrillic.el
* quail/czech.el, quail/devanagari.el, quail/ethiopic.el
* quail/greek.el, quail/hangul.el, quail/hangul3.el
* quail/hanja-jis.el, quail/hanja.el, quail/hanja3.el
* quail/hebrew.el, quail/ipa.el, quail/japanese.el, quail/lao.el
* quail/latin-alt.el, quail/latin-ltx.el, quail/latin-post.el
* quail/latin-pre.el, quail/lrt.el, quail/py-punct.el
* quail/pypunct-b5.el, quail/slovak.el, quail/symbol-ksc.el
* quail/thai.el, quail/tibetan.el, quail/viqr.el: Some fixes to
follow coding conventions.
2001-06-04 Andrew Choi <akochoi@i-cable.com>
* quail/.cvsignore: Change CTLauB.el to CTLau-b5.el.
2001-06-01 Andrew Innes <andrewi@gnu.org>
* makefile.nt (TIT_GB): Remove quail/PY.elc and quail/ZIRANMA.elc.
(NON_TIT_BIG5): Remove $(srcdir)/quail/tsang-b5.elc and
$(srcdir)/quail/pypunct-b5.elc.
(NON_TIT_CNS): Remove.
(CHINESE_NON_TIT): Remove $(NON_TIT_CNS).
(CHINESE_CNS): Remove.
(KOREAN): Add $(srcdir)/quail/hanja3.elc.
(LATIN): Add $(srcdir)/quail/latin-alt.elc and
$(srcdir)/quail/latin-ltx.elc.
(MISC_DIC): Copy from Makefile.in.
(CHINESE): Remove $(CHINESE_CNS).
(all): Add $(MISC_DIC) as target.
(.NOTPARALLEL): New target.
(.NO_PARALLEL): New target.
($(MISC_DIC)): New target.
(clean mostlyclean): Clean more stuff.
(TIT_EL): New macro.
(MISC_DIC_EL): New macro.
* makefile.w32-in (TIT-GB): Remove CTLau.elc from it.
(TIT-BIG5): Remove CTLauB.elc from it.
(MISC-DIC): Add CTLau.elc and CTLau-b5.elc to it.
(clean mostlyclean): Remove obsolete reference.
2001-06-01 Eli Zaretskii <eliz@is.elta.co.il>
* quail/latin-ltx.el [ms-dos]: Call IT-setup-unicode-display.
2001-05-24 Andrew Choi <akochoi@i-cable.com>
* Makefile.in (MISC-DIC): Change CTLauB.elc to CTLau-b5.elc.
* CXTERM-DIC/CTLau.tit, CXTERM-DIC/CTLauB.tit: Delete files.
* MISC-DIC/CTLau.html, MISC-DIC/CTLau-b5.html: Add files.
* Makefile.in (TIT-GB): Remove CTLau.elc from it.
(TIT-BIG5): Remove CTLauB.elc from it.
(MISC-DIC): Add CTLau.elc and CTLauB.elc to it.
2001-05-17 Dave Love <fx@gnu.org>
* quail/latin-ltx.el ("TeX"): Rename from "latin-latex2e".
Language family and indicator changed. Many new translations.
2001-05-17 Gerd Moellmann <gerd@gnu.org>
* quail/slovak.el, quail/czech.el: Set guidance to t for czech and
slovak input methods. New maintainer. From Pavel Janík
<Pavel@Janik.cz>.
2001-04-23 Gerd Moellmann <gerd@gnu.org>
* quail/latin-ltx.el: Add more translations.
From jsbien@mimuw.edu.pl (Janusz S. Bień).
2001-04-19 Eli Zaretskii <eliz@is.elta.co.il>
* quail/hangul.el <korean-hangul>: Doc fix.
2001-04-18 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (EMACSLOADPATH): Define.
($(TIT)):
($(MISC_DIC)):
(.el.elc):
(leim-list.el): Remove stuff to set EMACSLOADPATH.
2001-04-05 Gerd Moellmann <gerd@gnu.org>
* Makefile.in (install): Remove .cvsignore files.
* quail/japanese.el ("japanese-hankaku-kana"): Don't use
the same translations as for `japanese'.
2001-04-03 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (TIT_GB): Delete quail/PY.elc and
quail/ZIRANMA.elc.
(NON_TIT_BIG5): Delete $(srcdir)/quail/quick-b5.elc and
$(srcdir)/quail/tsang-b5.elc.
(NON_TIT_CNS): Delete.
(CHINESE_NON_TIT): Delete $(NON-TIT-CNS).
(CHINESE_CNS): Delete.
(KOREAN): Add ${srcdir}/quail/hanja3.elc. From Kenichi Handa
<handa@etl.go.jp>.
(MISC_DIC): New variable.
(CHINESE): Delete $(CHINESE_CNS).
(WORLD): Add $(MISC_DIC).
(all): Depends on $(MISC_DIC).
(.NOTPARALLEL, .NO_PARALLEL): New special targets.
($(MISC_DIC)): New target.
(clean mostlyclean): Delete also $(NONTIT), $(WORLD), $(MISC_DIC)
and $(MISC_DIC:.elc=.el).
2001-04-02 Eli Zaretskii <eliz@is.elta.co.il>
* Makefile.in (KOREAN): Add ${srcdir}/quail/hanja3.elc.
From Kenichi Handa <handa@etl.go.jp>.
* Makefile.in (.NOTPARALLEL, .NO_PARALLEL): Add ${MISC-DIC}.
2001-03-31 Kenichi Handa <handa@etl.go.jp>
* Makefile.in (TIT-GB): Delete quail/PY.elc and quail/ZIRANMA.elc.
(NON-TIT-BIG5): Delete ${srcdir}/quail/quick-b5.elc
${srcdir}/quail/tsang-b5.elc.
(CHINESE-NON-TIT): Delete ${NON-TIT-CNS}.
(CHINESE-CNS): Delete it.
(MISC-DIC): New variable.
(CHINESE): Delete ${CHINESE-CNS}.
(WORLD): Add ${MISC-DIC}.
(all): Depends on ${MISC-DIC}.
(${MISC-DIC}): New target.
(clean mostlyclean): Delete also ${MISC-DIC} ${MISC-DIC:.elc=.el}.
* MISC-DIC/cangjie-table.b5, MISC-DIC/cangjie-table.cns,
MISC-DIC/pinyin.map, MISC-DIC/ziranma.cin: New files.
* CXTERM-DIC/PY.tit, CXTERM-DIC/ZIRANMA.tit: Delete them.
* quail/tsang-b5.el, quail/tsang-cns.el, quail/quick-b5.el,
* quail/quick-cns.el: Delete them.
2001-03-30 Eli Zaretskii <eliz@is.elta.co.il>
* Makefile.in (${TIT}): Fix whitespace.
2001-03-29 Eli Zaretskii <a34785@is.elta.co.il>
* Makefile.in (.NOTPARALLEL, .NO_PARALLEL): New special targets.
(${TIT}): If the target file already exist, don't remake it.
2001-03-21 Kenichi Handa <handa@etl.go.jp>
* quail/slovak.el ("slovak"): Translate "=q" to "`".
2001-03-16 Pavel Janík <Pavel@Janik.cz>
* quail/slovak.el ("slovak"): Delete translations of "q", "Q",
"=q", "+q", "=Q", and "+Q".
("slovak-prog-1"): Give t to the arg SHOW-LAYOUT.
("slovak-prog-2"): Likewise.
("slovak-prog-3"): Likewise.
2001-03-16 Eli Zaretskii <eliz@is.elta.co.il>
* quail/latin-post.el ("finnish-keyboard"): Fix a typo.
2001-03-16 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-transliteration-rules):
New variable. Use it to define these input methods: "japanese",
"japanese-hiragana", "japanese-katakana".
(quail-japanese-kana-state): Delete this variable.
(quail-japanese-toggle-kana): Don't use quail-japanese-kana-state,
instead check if there's any Hiraganas in the conversion region.
2001-03-14 Kenichi Handa <handa@mule.m17n.org>
* quail/slovak.el ("slovak"): Give t to the arg SHOW-LAYOUT.
2001-03-06 Kenichi Handa <handa@etl.go.jp>
* CXTERM-DIC/4Corner.tit: Add copyright notice.
2001-03-05 Kenichi Handa <handa@etl.go.jp>
* quail/ethiopic.el ("ethiopic"): Docstring adjusted for the
change of the special key bindings.
2001-02-22 Kenichi Handa <handa@etl.go.jp>
* CXTERM-DIC/ARRAY30.tit: Add copyright notice.
* CXTERM-DIC/ETZY.tit: Likewise.
* CXTERM-DIC/ZOZY.tit: Likewise.
2001-02-05 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (BUILT_EMACS): Use $(THISDIR) to make emacs.exe
path absolute.
2001-02-03 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (LATIN): Fix last change to use () not {}.
2001-02-02 Kenichi Handa <handa@etl.go.jp>
* Makefile.in (LATIN): Include ${srcdir}/quail/latin-alt.elc.
* makefile.w32-in (LATIN): Likewise.
* quail/latin-ltx.el: New file -- LaTeX-like Latin input method.
2001-02-01 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (LATIN): Include $(srcdir)/quail/latin-alt.elc.
2001-02-01 Kenichi Handa <handa@etl.go.jp>
* quail/greek.el ("greek-mizuochi"): New input method for
classical Greek.
2001-01-28 Gerd Moellmann <gerd@gnu.org>
* Makefile.in (extraclean): Add target so make doesn't die if
one runs "make extraclean" at the top level.
2001-01-06 Andrew Innes <andrewi@gnu.org>
* makefile.nt ($(TIT)): Map .elc to .el.
(buildlisppath): Make path relative to $(MAKEDIR).
2001-01-01 Andreas Schwab <schwab@suse.de>
* quail/latin-alt.el: Doc fixes.
2000-12-18 Dave Love <fx@gnu.org>
* quail/latin-pre.el <latin-9-prefix>: Delete duplicate š entry.
Change œ, Œ, ¶.
2000-12-16 Kenichi Handa <handa@etl.go.jp>
* ja-dic/ja-dic.el: Re-generated by the new ja-dic-cnv.el.
2000-12-06 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (buildlisppath): Set to an absolute directory,
relative to $(CURDIR).
(INSTALLDIR): Use forward slash.
2000-11-24 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (.SUFFIXES): New target, include .elc .el.
* makefile.nt (.SUFFIXES): New target, include .elc .el.
2000-11-21 Kenichi Handa <handa@etl.go.jp>
* Makefile.in (.SUFFIXES): New target, include .elc .el.
2000-11-17 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-kanji-kkc): Use marker to
remember the conversion start.
2000-10-21 Andrew Innes <andrewi@gnu.org>
* makefile.nt ($(TIT)): Add $(SUBDIRS) as dependents, instead
of conditional invocation of make.
(TIT-GB, TIT-BIG5, NON-TIT-GB, NON-TIT-BIG5)
(NON-TIT-CNS, JAPANESE, KOREAN, THAI, VIETNAMESE, LAO, INDIAN)
(TIBETAN, LATIN, SLAVIC, GREEK, RUSSIAN, MISC): Rename all .el
files to .elc.
($(TIT)): Adjust for the above change.
(clean mostlyclean): Likewise.
(.el.elc): New target.
* makefile.w32-in ($(TIT)): Add $(SUBDIRS) as dependents, instead
of conditional invocation of make.
(TIT-GB, TIT-BIG5, NON-TIT-GB, NON-TIT-BIG5)
(NON-TIT-CNS, JAPANESE, KOREAN, THAI, VIETNAMESE, LAO, INDIAN)
(TIBETAN, LATIN, SLAVIC, GREEK, RUSSIAN, MISC): Rename all .el
files to .elc.
($(TIT)): Adjust for the above change.
(clean mostlyclean): Likewise.
(.el.elc): New target.
2000-10-07 Eli Zaretskii <eliz@is.elta.co.il>
* Makefile.in (${TIT}, clean): Don't use shell `command`
expansion, use ${TIT:.elc=.el} instead.
2000-09-26 Gerd Moellmann <gerd@gnu.org>
* Makefile.in: Make this the leim Makefile.in.
(clean): Also remove $NON-TIT and $WORLD.
(RUN-EMACS): Set EMACSLOADPATH.
2000-09-21 Kenichi Handa <handa@etl.go.jp>
* Makefile.in: Revert to no-leim Makefile.
* quail/.cvsignore: Include *.elc.
* ja-dic/.cvsignore: New file.
2000-09-16 Andrew Innes <andrewi@gnu.org>
* makefile.nt ($(TIT)): Set EMACSLOADPATH when running emacs.
(leim-list.el): Ditto.
* makefile.w32-in ($(TIT)): Set EMACSLOADPATH when running emacs.
(leim-list.el): Ditto.
2000-09-15 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (clean mostlyclean): Ignore errors when removing
files.
2000-09-14 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in (clean mostlyclean): Ignore errors when deleting
leim-list.el.
(distclean maintainer-clean): Ditto for stamp-subdir.
* makefile.nt: Rename skkdic to ja-dic.
2000-09-07 Kenichi Handa <handa@etl.go.jp>
* quail/thai.el ("thai-kesmanee", "thai-pattachote"): Use keyboard
translation.
* quail/pypunct-b5.el ("chinese-py-punct-b5"): Docstring modified.
* quail/py-punct.el ("chinese-py-punct"): Docstring modified.
("chinese-tonepy-punct"): New input method.
* quail/latin-pre.el ("polish-slash"): Don't use keyboard
translation.
* quail/japanese.el ("japanese"): Delete the key sequence for
Roman transliteration from the docstring because it's now shown
automatically.
("japanese-ascii", "japanese-zenkaku")
("japanese-hankaku-kana", "japanese-hiragana")
("japanese-katakana"): Docstring modified.
* quail/czech.el ("czech-qwerty"): Change to show keyboard layout
on describe-input-method.
("czech-prog-1", "czech-prog-2", "czech-prog-3"): Likewise.
2000-09-03 Andrew Innes <andrewi@gnu.org>
* makefile.w32-in: New file.
(install) Fix copying of directories.
2000-08-31 Kenichi Handa <handa@etl.go.jp>
* quail/thai.el (thai-generate-quail-map): If the length of
translation is more than one, compose it.
2000-08-29 Dave Love <fx@gnu.org>
* quail/latin-pre.el ("latin-9-prefix"): Change entries for œ and Œ.
* Makefile.in: ja-dic <- skk in several places.
2000-08-25 Kenichi Handa <handa@etl.go.jp>
* ja-dic: Directory name changed from skkdic.
* ja-dic/ja-dic.el[c]: Re-generated by the new ja-dic-cnv.el.
* README: Rename skkdic to ja-dic throughout the file.
2000-08-24 Dave Love <fx@gnu.org>
* quail/latin-pre.el ("latin-8-prefix", "latin-9-prefix"): New.
("latin-1-prefix"): Add missing symbols.
2000-08-23 Dave Love <fx@gnu.org>
* quail/latin-pre.el ("latin-1-prefix"): Change ~s to give § and
add ~p for ¶.
2000-07-18 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el ("japanese"): Fix docstring.
2000-07-17 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el ("japanese"): Docstring modified.
2000-06-12 Kenichi Handa <handa@etl.go.jp>
* quail/tibetan.el (tibetan-wylie-quote-alist): This variable deleted.
("tibetan-wylie"): State transition table modified.
2000-06-01 Kenichi Handa <handa@etl.go.jp>
* quail/tibetan.el: Change all tibetan-1-column characters to
tibetan. Quail map for "tibetan-wylie" fixed.
2000-03-31 Włodzimierz Bzyl <matwb@monika.univ.gda.pl>
* quail/latin-pre.el ("polish-slash"): New input method.
2000-03-02 Kenichi Handa <handa@etl.go.jp>
* quail/latin-pre.el ("latin-1-prefix"): Add rules for symbols.
2000-02-01 Gerd Moellmann <gerd@gnu.org>
* Makefile.in: Make this the no-leim Makefile. Move the
leim Makefile.in to ../leim-Makefile.in as it originally was.
* Makefile.noleim: Removed.
2000-01-28 Kenichi Handa <handa@etl.go.jp>
* quail/hanja.el (korean-hanja): Add an entry for "wod".
2000-01-04 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el ("japanese"): Docstring augmented.
1999-12-15 Kenichi Handa <handa@etl.go.jp>
* quail/lao.el: Rewritten for new composition.
* quail/lrt.el: Rewritten for new composition.
* quail/thai.el: Rewritten for new composition.
* quail/tibetan.el: Rewritten for new composition.
1999-12-13 Kenichi Handa <handa@etl.go.jp>
* quail/latin-pre.el ("esperanto-prefix"): Make it produce Latin-3
characters, not Latin-1.
1999-11-22 Andrew Innes <andrewi@gnu.org>
* makefile.nt: No need to generate subdirs.el.
1999-11-21 Andrew Innes <andrewi@gnu.org>
* makefile.nt: New file.
1999-10-26 Gerd Moellmann <gerd@gnu.org>
* Makefile.noleim: New.
1999-09-19 Ken'ichi Handa <handa@gnu.org>
* quail/latin-alt.el ("turkish-latin-3-alt-postfix"): Rename from
turkish-postfix.
("turkish-postfix"): New Turkish input method which inserts
Latin-5 characters.
* quail/latin-alt.el ("turkish-latin-3-alt-postfix"): Rename from
turkish-alt-postfix.
("turkish-alt-postfix"): New Turkish input method which inserts
Latin-5 characters.
1999-07-12 Richard Stallman <rms@gnu.org>
* Version 20.4 released.
1998-07-12 Oleg S. Tihonov <ost@benetnash.ffke-campus.mipt.ru>
* quail/cyrillic.el (cyrillic-jcuken): Use X11 keyboard layout.
1999-06-14 Ken'ichi Handa <handa@gnu.org>
* quail/ethiopic.el ("ethiopic"): Add translation rules.
1999-06-01 Jae-youn Chung <jay@compiler.kaist.ac.kr>
* quail/hanja3.el: Newly generated from hangul.el, hangul3.el, and
hanja.el.
1999-05-25 Ken'ichi Handa <handa@gnu.org>
* quail/hangul3.el ("korean-hangul3"): Give MAXIMUM-SHORTEST t.
1999-05-09 Tudor Hulubei <tudor@cs.unh.edu>
* quail/latin-pre.el ("romanian-prefix"): New input method.
("romanian-alt-prefix"): New input method.
1999-03-04 Kenichi Handa <handa@etl.go.jp>
* quail/latin-post.el ("spanish-postfix"): Add rule U" and u".
1999-01-14 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-kanji-kkc): If the last char
to convert is `n', change it to Japanese Hiragana `n' before
conversion.
1999-01-11 Kenichi Handa <handa@etl.go.jp>
* Makefile.in (MISC): Add ${srcdir}/quail/hebrew.el.
* quail/hebrew.el: New file.
1998-12-15 Kenichi Handa <handa@etl.go.jp>
* quail/devanagari.el (quail-devanagari-compose-characters):
Adjust for the change of input method handling.
(quail-devanagari-hindi-compose-characters): Likewise.
1998-10-15 Kenichi Handa <handa@etl.go.jp>
* Makefile.in (leim-list.el): Use `(cd foo && pwd)` instead of
`(cd foo; pwd)`.
(install): Likewise.
1998-10-15 Francesco Potortì <F.Potorti@cnuce.cnr.it>
* quail/latin-post.el: Many doc fixes.
("latin-1-postfix"): Add sequence for the small superscript o.
* quail/latin-pre.el: Many doc fixes.
("latin-1-prefix"): Add sequences for the small
superscript underlined o and a.
1998-10-13 Francesco Potortì <F.Potorti@cnuce.cnr.it>
* quail/latin-alt.el ("latin-1-alt-postfix"): Add a method to enter the
small superscript underlined o and a.
("italian-alt-postfix"): Change it to something useful and
different from italian-postfix.
* quail/latin-post.el ("latin-1-postfix"): Add a method to enter the
small superscript underlined o and a.
("italian-postfix"): Same as above.
("italian-postfix"): Add methods to enter e with acute accent and
the >> and << symbols.
1998-09-25 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-hankaku-update-translation):
Adjust for the change of input method handling.
1998-09-11 Kenichi HANDA <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-katakana-update-translation):
Adjust for the change of input method handling.
1998-08-31 Kenichi Handa <handa@etl.go.jp>
* quail/tibetan.el (quail-tibetan-input-wylie): Adjust for the
change of input method handling.
(quail-tibetan-input-tibkey): Likewise.
1998-08-19 Richard Stallman <rms@psilocin.ai.mit.edu>
* Version 20.3 released.
1998-08-16 Kenichi HANDA <handa@etl.go.jp>
* quail/czech.el ("czech"): Make this input method deterministic,
kbd-translate, and show-layout.
1998-08-15 Kenichi HANDA <handa@etl.go.jp>
* quail/ethiopic.el: Fix several translation rules.
1998-08-12 Milan Zamazal <pdm@fi.muni.cz>
* quail/czech.el: Few key sequences added to some keyboards.
1998-08-06 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-use-double-n): New variable.
(quail-japanese-update-translation): Adjust for the change of
quail-update-translation. Now this function should return
CONTROL-FLAG.
(quail-japanese-toggle-kana): Update quail-conversion-str.
(quail-japanese-kanji-kkc): Likewise.
(quail-japanese-switch-package): Reset quail-current-str and
quail-conversion-str.
1998-07-24 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-kanji-kkc):
Set quail-translation to nil after calling kkc-region so that
translation mode is restarted correctly.
1998-07-21 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-kanji-kkc): Handle the case
that conversion is canceled in kkc-region.
(quail-japanese-switch-package): Fix previous change.
1998-07-19 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-update-translation):
Handle a key which should fix the current translation and start a new
translation correctly.
(quail-japanese-toggle-kana): Set quail-translating to nil.
Don't change point.
1998-07-15 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-kanji-kkc): Adjust for the
change of quail.el.
(quail-japanese-switch-package): Likewise.
1998-07-03 Kenichi Handa <handa@etl.go.jp>
* quail/symbol-ksc.el: Keys for modern Korean syllables fixed.
Some keys for ancient Korean syllables are changed properly.
1998-06-20 Kenichi Handa <handa@etl.go.jp>
* quail/ethiopic.el: Don't add hook to quail-mode-hook.
(ethio-select-a-translation): New function.
1998-06-10 Richard Stallman <rms@psilocin.ai.mit.edu>
* Makefile.in (RUN-EMACS): Add --multibyte.
1998-04-29 Karl Heuer <kwzh@gnu.org>
* Makefile.in (SLAVIC): Delete redundant backslash.
1998-04-28 Richard Stallman <rms@psilocin.gnu.org>
* Makefile.in (install): Make INSTALLDIR and contents world-readable.
1998-04-20 Kenichi Handa <handa@etl.go.jp>
* Makefile.in (SLAVIC): New macro.
(EUROPEAN): Include ${SLAVIC}.
1998-04-14 Andreas Schwab <schwab@mescaline.gnu.org>
* Makefile.in: Prepend ${srcdir} to all non-TIT lisp file names.
(leim-list.el): Depend on ${WORLD}.
* quail/latin-alt.el (latin-2-alt-postfix): Doc fix.
1998-04-08 Karl Heuer <kwzh@mescaline.gnu.org>
* quail/czech.el, quail/slovak.el: Correct starting commentary.
1998-04-07 Milan Zamazal <pdm@fi.muni.cz>
* quail/czech.el, quail/slovak.el: Correct starting commentary.
1998-04-06 Andreas Schwab <schwab@gnu.org>
* quail/lrt.el (lrt-composing-pattern-double-c): Change chars-in-string
to length.
(lrt-generate-quail-map): Change sref to aref, and make second
argument of substring a character index.
1998-03-26 Richard Stallman <rms@psilocin.gnu.org>
* Makefile.in (${TIT}): Fix shell conditional syntax.
1998-03-18 Kenichi Handa <handa@etl.go.jp>
* quail/latin-pre.el ("latin-1-prefix"): Fix the translation of
"/ " to "/" (instead of " ").
1998-03-17 Richard Stallman <rms@psilocin.gnu.org>
* quail/czech.el, quail/slovak.el: New files.
1998-03-10 Richard Stallman <rms@psilocin.gnu.org>
* Makefile.in (BUILT-EMACS): Variable renamed from EMACS.
Uses changed.
1998-03-05 Kenichi Handa <handa@etl.go.jp>
* Makefile.in (${TIT}): To byte-compile quail packages, use just
built quail.
1997-12-09 Koaunghi Un <koaunghi.un@zdv.uni-tuebingen.de>
* quail/hanja3.el: New file.
* quail/hanja-jis.el: Title string of the input method
"korean-hanja-jis" changed.
* quail/symbol-ksc.el: Title string of the input method
"korean-symbol" changed. Require 'korea-util.
(quail-hangul-switch-back): Delete.
* quail/hangul3.el: Require 'korea-util.
(quail-hangul-switch-to-symbol-ksc): Delete.
* quail/hanja.el: Require 'korea-util. Title string of the input
method "korean-hanja" changed.
(quail-hanja-switch-to-symbol-ksc): Delete.
* quail/hangul.el: Require 'korea-util.
(quail-hangul-switch-to-symbol-ksc): Delete.
1997-10-23 Kenichi Handa <handa@etl.go.jp>
* quail/ethiopic.el: The title string of input method "Ethiopic"
is changed.
1997-09-19 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
* Version 20.2 released.
1997-09-18 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* quail/latin-post.el (german): Swap y and z.
1997-09-15 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
* Version 20.1 released.
* quail/latin-alt.el (latin-2-postfix): Use : for double-acute again.
1997-09-13 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* quail/viqr.el (vietnamese-viqr): Doc fix.
1997-09-13 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
* quail/latin-alt.el: New file.
1997-09-12 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
* quail/latin-post.el: Undo previous change.
1997-09-12 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
* quail/latin-post.el (latin-2-postfix):
Replace comma and period with `. Replace colon with /.
(latin-1-postfix): Replace comma with /.
(french-postfix): Replace comma with /.
(latin-3-postfix): Replace comma with ` and period with /.
(latin-4-postfix): Replace comma with ` and period with ~.
(latin-5-postfix): Replace comma with ` and period with /.
(turkish-postfix): Replace comma with ` and period with /.
1997-09-10 Kenichi Handa <handa@etl.go.jp>
* quail/ethiopic.el: Don't bind keys in quail-mode-map.
The function added to quail-mode-hook turn ethio-mode on only when
input method "ethiopic" is begin used.
(ethio-prefer-ascii-space): Move to lisp/language/ethio-util.el.
(ethio-toggle-space): Likewise.
(ethio-insert-space): Likewise.
(ethio-insert-ethio-space): Likewise.
(ethio-prefer-ascii-punctuation): Likewise.
(ethio-toggle-punctuation): Likewise.
(ethio-gemination): Likewise.
("ethiopic"): Doc-string of this Quail package modified.
Bind function keys for TRANSLATION-KEYMAP to
quail-execute-non-quail-command.
1997-09-10 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
* Makefile.in (install): Use quail/* in the second tar that
copies a dir named quail.
1997-09-03 Ken'ichi Handa <handa@psilocin.gnu.ai.mit.edu>
* Makefile.in (install): Do not copy leim-list.el twice.
Copy `skk' subdirectory too.
1997-09-03 Kenichi Handa <handa@etl.go.jp>
* quail/cyrillic.el: For each package, pass t for the SIMPLE
argument to quail-define-package.
* quail/cyril-jis.el: Likewise.
* quail/greek.el: Likewise.
* quail/ipa.el: Likewise.
* quail/lao.el: Likewise.
* quail/lrt.el: Likewise.
* quail/thai.el: Likewise.
* quail/viqr.el: Likewise.
1997-08-30 Naoto TAKAHASHI <ntakahas@etl.go.jp>
* quail/ethiopic.el ("ethiopic"): Doc-string fixed. Change the arg
TRANSLATION-KEYS.
(quail-mode-map): Change binding for ethio-insert-ethio-space.
(quail-mode-hook): Check the current Quail package name.
* quail/latin-post.el: Add rules for canceling accents by typing
two accent keys (e.g. a~ => a-tilde, a~~ => a~) to all Quail
packages.
1997-08-28 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
* quail/latin-post.el, quail/latin-pre.el: For each package,
pass t for the SIMPLE argument to quail-define-package.
1997-08-28 Kenichi Handa <handa@etl.go.jp>
* Makefile.in (dotdot): This macro deleted.
(SUBDIRS): Exclude skk.
(all): Substitute ${WORLD} to ${TIT}.
(%.el): This target deleted.
(${TIT}): Check existence of `quail' subdirectory.
(leim-list.el): Do not check old files.
(install): If ${srcdir} is different from the current directory,
copy also files under ${srcdir}.
1997-08-26 Kenichi Handa <handa@etl.go.jp>
* Makefile.in: Re-arrange macros so that the macro TIT contains
only Quial packages generated from CXTERM dictionaries, and the
macro NON-TIT contains only Quial packages distributed with Emacs.
(install): Do not use -h option for tar, instead copy ${NON-TIT}
and ${TIT} separately.
1997-08-25 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
* Makefile.in (install): Discard extra data in tar | tar command.
1997-08-23 Kenichi Handa <handa@etl.go.jp>
* quail/devanagari.el (quail-devanagari-compose-characters):
Fix previous change.
(quail-devanagari-hindi-compose-characters): Fix previous change.
* quail/japanese.el (quail-japanese-kkc-mode-exit): Fix previous
change.
1997-08-22 Ken'ichi Handa <handa@psilocin.gnu.ai.mit.edu>
* Makefile.in (leim-list.el): Fix previous change.
* quail/thai.el (thai-keyboard-mapping-alist): Some entry corrected.
1997-08-21 Kenichi HANDA <handa@etl.go.jp>
* quail/py-punct-b5.el: Name changed from py-punct-b5.el.
* quail/tsang-b5.el: Name changed from tsangchi-b5.el.
* quail/tsang-cns.el: Name changed from tsangchi-cns.el.
* Makefile.in (install): Just copy leim-list.el instead of running
update-leim-list-file on ${INSTALLDIR}.
(CHINESE-BIG5): File name change: tsangchi-b5.el -> tsang-b5.el,
py-punct-b5.el -> pypunct-b5.el.
(CHINESE-CNS): File name change: tsangchi-cns.el -> tsang-cns.el.
(leim-list.el): Delete old files not contained in ${WORLD}.
* quail/japanese.el (quail-japanese-kkc-mode-exit):
Run input-method-after-insert-chunk-hook.
* quail/thai.el (thai-keyboard-mapping-alist): Some entry corrected.
1997-08-19 Kenichi Handa <handa@etl.go.jp>
* quail/hangul.el ("korean-hangul"): Doc-string of this Quail
package fixed.
1997-08-18 Kenichi Handa <handa@etl.go.jp>
* quail/japanese.el (quail-japanese-toggle-kana): Don't call
throw.
(quail-japanese-kanji-kkc): Completely re-written.
(quail-japanese-kkc-mode-exit): New function.
(quail-japanese-switch-package): Call activate-input-method
instead of select-input-method.
* quail/thai.el (thai-consonant-input): Typo fixed.
* quail/devanagari.el (quail-devanagari-compose-characters):
Do not call throw.
(quail-devanagari-hindi-compose-characters): Likewise.
* quail/hangul.el (quail-hangul-switch-to-symbol-ksc):
Call activate-input-method instead of select-input-method.
* quail/hangul3.el (quail-hangul-switch-to-symbol-ksc): Likewise.
* quail/symbol-ksc.el (quail-hangul-switch-back): Likewise.
Use input-method-history instead of previous-input-method.
1997-08-16 Valery Alexeev <valery@domovoy.math.uga.edu>
* quail/cyrillic.el (cyrillic-translit-bulgarian): New input method.
1997-08-16 Kenichi Handa <handa@etl.go.jp>
* quail/lrt.el (lrt-vowel-table): Some elements corrected.
("lao-lrt"): Doc-string of this Quail package modified.
Some translation rules added.
* quail/lao.el (lao-keyboard-mapping): Some elements corrected.
(lao-quail-define-rules): Some translation rules corrected.
1997-08-11 Kenichi Handa <handa@etl.go.jp>
* quail/lrt.el: Some rules added for Quail package "lao-lrt".
(lrt-vowel-table): The entry for "aM" corrected.
1997-08-07 Kenichi Handa <handa@etl.go.jp>
* quail/lrt.el: Change title string of input method "lao-lrt".
(lrt-single-consonant-table): Several key sequence changed.
(lrt-composing-pattern-double-c): Handle a consonant with
semi-vowel-lower correctly.
(lrt-handle-maa-sakod): Do not reset quail-current-key.
(lrt-handle-tone-mark): Check the existence of double consonant
correctly.
* quail/lao.el: Change title string of input method "Lao".
1997-08-04 Valery Alexeev <valery@domovoy.math.uga.edu>
* quail/cyrillic.el (cyrillic-translit): Doc-string of the package
modified. Several translation rules modified.
1997-08-04 Ken'ichi Handa <handa@psilocin.gnu.ai.mit.edu>
* quail/cyrillic.el: Move Quail package cyrillic-jis-russian to
quail/cyril-jis.el.
* quail/cyril-jis.el: New file.
* Makefile.in (RUSSIAN): Add quail/cyril-jis.el.
1997-08-01 Kenichi Handa <handa@etl.go.jp>
* quail/ethiopic.el: In quail-mode-map, bind
ethio-insert-ethio-space Shift-SPACE. Add translation rules to
Quail package "ethiopic".
1997-08-01 Valery Alexeev <valery@domovoy.math.uga.edu>
* quail/cyrillic.el (cyrillic-translit): New input method.
1997-07-25 Ken'ichi Handa <handa@psilocin.gnu.ai.mit.edu>
* quail/tibetan.el: New file.
* quail/py-punct.el: Require 'quail.
* quail/py-punct-b5.el: Require 'quail.
* quail/ethiopic.el: Change Quail package name to "ethiopic".
(ethio-toggle-punctuation): Give "ethiopic" to quail-defrule.
* Makefile.in (TIT): New variable, concatenation of TIT-GB and
TIT-BIG5.
(RUN-EMACS): Do not set EMACSLOADPATH.
(ASIA): Include TIBETAN.
(all): Remove stamp-bytecomp from dependency list.
({$TIT}): New target, substitutes the target ${TIT-GB} ${TIT-BIG5}.
(%.el): Make a link for byte-compiled file too.
(stamp-bytecomp): Target deleted.
(leim-list.el): Run Emacs with loading quail.
(install-XXX): These targets deleted.
(install): Remove files under INSTALLDIR before copying new files.
Run Emacs with loading quail.
(clean mostlyclean): Remove only generated files.
1997-07-24 Richard Stallman <rms@psilocin.gnu.ai.mit.edu>
* Makefile.in (stamp-bytecomp): Fix shell conditional.
(clean): Fix shell conditional.
1997-07-21 Jim Meyering <meyering@eng.ascend.com>
* Makefile.in: Use @LN_S@, not ln -s, in case no symlink support.
(clean): Absence of ./Makefile.in is criterion for deleting skkdic.elc.
1997-07-17 Ken'ichi Handa <handa@psilocin.gnu.ai.mit.edu>
* Makefile.in: Modified to avoid *.el files being regarded
as intermediate files and deleted by GNU make.
* quail/lrt.el (lrt-vowel-table): Change "ow" -> "ao", "am" -> "arm".
(lrt-handle-maa-sakod): Correctly handle the case that
quail-current-data is nil.
(lrt-handle-tone-mark): Fix bug of handling key sequence "hhai" +
tone.
1997-07-15 Kenichi Handa <handa@etl.go.jp>
* quail/py-punct.el: New file.
* quail/py-punct-b5.el: New file.
* quail/japanese.el: Doc-string of Quail package japanese modified.
* Makefile.in: Rules re-written to avoid tricky code.
(CHINESE-GB): Include quail/py-punct.elc.
(CHINESE-BIG5): Include quail/py-punct-b5.elc.
1997-07-10 Kenichi Handa <handa@etl.go.jp>
* quail/latin-pre.el: Change titles of quail packages.
* quail/latin-post.el: Likewise.
;; Local Variables:
;; coding: utf-8
;; End:
Copyright (C) 1997-1999, 2001-2020 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs 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.
GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
| {
"pile_set_name": "Github"
} |
/*
Copyright 2015 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 strings
import (
"bytes"
"io"
"strings"
)
// LineDelimiter is a filter that will split input on lines
// and bracket each line with the delimiter string.
type LineDelimiter struct {
output io.Writer
delimiter []byte
buf bytes.Buffer
}
// NewLineDelimiter allocates a new io.Writer that will split input on lines
// and bracket each line with the delimiter string. This can be useful in
// output tests where it is difficult to see and test trailing whitespace.
func NewLineDelimiter(output io.Writer, delimiter string) *LineDelimiter {
return &LineDelimiter{output: output, delimiter: []byte(delimiter)}
}
// Write writes buf to the LineDelimiter ld. The only errors returned are ones
// encountered while writing to the underlying output stream.
func (ld *LineDelimiter) Write(buf []byte) (n int, err error) {
return ld.buf.Write(buf)
}
// Flush all lines up until now. This will assume insert a linebreak at the current point of the stream.
func (ld *LineDelimiter) Flush() (err error) {
lines := strings.Split(ld.buf.String(), "\n")
for _, line := range lines {
if _, err = ld.output.Write(ld.delimiter); err != nil {
return
}
if _, err = ld.output.Write([]byte(line)); err != nil {
return
}
if _, err = ld.output.Write(ld.delimiter); err != nil {
return
}
if _, err = ld.output.Write([]byte("\n")); err != nil {
return
}
}
return
}
| {
"pile_set_name": "Github"
} |
#version 450
layout(set = 2, binding = 0) uniform sampler2D texture0; // diffuse
layout(location = 0) in vec4 frag_color;
layout(location = 1) centroid in vec2 frag_tex_coord;
layout(location = 0) out vec4 out_color;
layout (constant_id = 0) const int alpha_test_func = 0;
layout (constant_id = 1) const float alpha_test_value = 0.0;
//layout (constant_id = 2) const float depth_fragment = 0.85;
layout (constant_id = 3) const int alpha_to_coverage = 0;
layout (constant_id = 7) const int discard_mode = 0;
float CorrectAlpha(float threshold, float alpha, vec2 tc)
{
ivec2 ts = textureSize(texture0, 0);
float dx = max(abs(dFdx(tc.x * float(ts.x))), 0.001);
float dy = max(abs(dFdy(tc.y * float(ts.y))), 0.001);
float dxy = max(dx, dy); // apply the smallest boost
float scale = max(1.0 / dxy, 1.0);
float ac = threshold + (alpha - threshold) * scale;
return ac;
}
void main() {
vec4 base = texture(texture0, frag_tex_coord) * frag_color;
if (alpha_to_coverage != 0) {
if (alpha_test_func == 1) {
base.a = base.a > 0.0 ? 1.0 : 0.0;
} else if (alpha_test_func == 2) {
base.a = CorrectAlpha(alpha_test_value, 1.0 - base.a, frag_tex_coord);
} else if (alpha_test_func == 3) {
base.a = CorrectAlpha(alpha_test_value, base.a, frag_tex_coord);
}
} else
// specialization: alpha-test function
if (alpha_test_func == 1) {
if (base.a == alpha_test_value) discard;
} else if (alpha_test_func == 2) {
if (base.a >= alpha_test_value) discard;
} else if (alpha_test_func == 3) {
if (base.a < alpha_test_value) discard;
}
if ( discard_mode == 1 ) {
if ( base.a == 0.0 ) {
discard;
}
} else if ( discard_mode == 2 ) {
if ( dot( base.rgb, base.rgb ) == 0.0 ) {
discard;
}
}
out_color = base;
}
| {
"pile_set_name": "Github"
} |
# Event 12 - task_0
###### Version: 0
## Description
None
## Data Dictionary
|Standard Name|Field Name|Type|Description|Sample Value|
|---|---|---|---|---|
|TBD|Adapter|UnicodeString|None|`None`|
|TBD|Status|Int32|None|`None`|
## Tags
* etw_level_Error
* etw_task_task_0 | {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 1995, 1996, 1997, 1999, 2001 by Ralf Baechle
* Copyright (C) 1999 by Silicon Graphics, Inc.
* Copyright (C) 2001 MIPS Technologies, Inc.
* Copyright (C) 2002 Maciej W. Rozycki
*
* Some useful macros for MIPS assembler code
*
* Some of the routines below contain useless nops that will be optimized
* away by gas in -O mode. These nops are however required to fill delay
* slots in noreorder mode.
*
* SPDX-License-Identifier: GPL-2.0
*/
#ifndef __ASM_ASM_H
#define __ASM_ASM_H
#include <asm/sgidefs.h>
#ifndef CAT
#ifdef __STDC__
#define __CAT(str1, str2) str1##str2
#else
#define __CAT(str1, str2) str1/**/str2
#endif
#define CAT(str1, str2) __CAT(str1, str2)
#endif
/*
* PIC specific declarations
* Not used for the kernel but here seems to be the right place.
*/
#ifdef __PIC__
#define CPRESTORE(register) \
.cprestore register
#define CPADD(register) \
.cpadd register
#define CPLOAD(register) \
.cpload register
#else
#define CPRESTORE(register)
#define CPADD(register)
#define CPLOAD(register)
#endif
#define ENTRY(symbol) \
.globl symbol; \
.type symbol, @function; \
.ent symbol, 0; \
symbol:
/*
* LEAF - declare leaf routine
*/
#define LEAF(symbol) \
.globl symbol; \
.align 2; \
.type symbol, @function; \
.ent symbol, 0; \
.section .text.symbol, "x"; \
symbol: .frame sp, 0, ra
/*
* NESTED - declare nested routine entry point
*/
#define NESTED(symbol, framesize, rpc) \
.globl symbol; \
.align 2; \
.type symbol, @function; \
.ent symbol, 0; \
.section .text.symbol, "x"; \
symbol: .frame sp, framesize, rpc
/*
* END - mark end of function
*/
#define END(function) \
.end function; \
.size function, .-function
/*
* EXPORT - export definition of symbol
*/
#define EXPORT(symbol) \
.globl symbol; \
symbol:
/*
* FEXPORT - export definition of a function symbol
*/
#define FEXPORT(symbol) \
.globl symbol; \
.type symbol, @function; \
symbol:
/*
* ABS - export absolute symbol
*/
#define ABS(symbol,value) \
.globl symbol; \
symbol = value
#define PANIC(msg) \
.set push; \
.set reorder; \
PTR_LA a0, 8f; \
jal panic; \
9: b 9b; \
.set pop; \
TEXT(msg)
/*
* Print formatted string
*/
#ifdef CONFIG_PRINTK
#define PRINT(string) \
.set push; \
.set reorder; \
PTR_LA a0, 8f; \
jal printk; \
.set pop; \
TEXT(string)
#else
#define PRINT(string)
#endif
#define TEXT(msg) \
.pushsection .data; \
8: .asciiz msg; \
.popsection;
/*
* Build text tables
*/
#define TTABLE(string) \
.pushsection .text; \
.word 1f; \
.popsection \
.pushsection .data; \
1: .asciiz string; \
.popsection
/*
* MIPS IV pref instruction.
* Use with .set noreorder only!
*
* MIPS IV implementations are free to treat this as a nop. The R5000
* is one of them. So we should have an option not to use this instruction.
*/
#ifdef CONFIG_CPU_HAS_PREFETCH
#define PREF(hint, addr) \
.set push; \
.set arch=r5000; \
pref hint, addr; \
.set pop
#define PREFE(hint, addr) \
.set push; \
.set mips0; \
.set eva; \
prefe hint, addr; \
.set pop
#define PREFX(hint, addr) \
.set push; \
.set arch=r5000; \
prefx hint, addr; \
.set pop
#else /* !CONFIG_CPU_HAS_PREFETCH */
#define PREF(hint, addr)
#define PREFE(hint, addr)
#define PREFX(hint, addr)
#endif /* !CONFIG_CPU_HAS_PREFETCH */
/*
* MIPS ISA IV/V movn/movz instructions and equivalents for older CPUs.
*/
#if (_MIPS_ISA == _MIPS_ISA_MIPS1)
#define MOVN(rd, rs, rt) \
.set push; \
.set reorder; \
beqz rt, 9f; \
move rd, rs; \
.set pop; \
9:
#define MOVZ(rd, rs, rt) \
.set push; \
.set reorder; \
bnez rt, 9f; \
move rd, rs; \
.set pop; \
9:
#endif /* _MIPS_ISA == _MIPS_ISA_MIPS1 */
#if (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3)
#define MOVN(rd, rs, rt) \
.set push; \
.set noreorder; \
bnezl rt, 9f; \
move rd, rs; \
.set pop; \
9:
#define MOVZ(rd, rs, rt) \
.set push; \
.set noreorder; \
beqzl rt, 9f; \
move rd, rs; \
.set pop; \
9:
#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) */
#if (_MIPS_ISA == _MIPS_ISA_MIPS4 ) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
(_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
#define MOVN(rd, rs, rt) \
movn rd, rs, rt
#define MOVZ(rd, rs, rt) \
movz rd, rs, rt
#endif /* MIPS IV, MIPS V, MIPS32 or MIPS64 */
/*
* Stack alignment
*/
#if (_MIPS_SIM == _MIPS_SIM_ABI32)
#define ALSZ 7
#define ALMASK ~7
#endif
#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
#define ALSZ 15
#define ALMASK ~15
#endif
/*
* Macros to handle different pointer/register sizes for 32/64-bit code
*/
/*
* Size of a register
*/
#ifdef __mips64
#define SZREG 8
#else
#define SZREG 4
#endif
/*
* Use the following macros in assemblercode to load/store registers,
* pointers etc.
*/
#if (_MIPS_SIM == _MIPS_SIM_ABI32)
#define REG_S sw
#define REG_L lw
#define REG_SUBU subu
#define REG_ADDU addu
#endif
#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
#define REG_S sd
#define REG_L ld
#define REG_SUBU dsubu
#define REG_ADDU daddu
#endif
/*
* How to add/sub/load/store/shift C int variables.
*/
#if (_MIPS_SZINT == 32)
#define INT_ADD add
#define INT_ADDU addu
#define INT_ADDI addi
#define INT_ADDIU addiu
#define INT_SUB sub
#define INT_SUBU subu
#define INT_L lw
#define INT_S sw
#define INT_SLL sll
#define INT_SLLV sllv
#define INT_SRL srl
#define INT_SRLV srlv
#define INT_SRA sra
#define INT_SRAV srav
#endif
#if (_MIPS_SZINT == 64)
#define INT_ADD dadd
#define INT_ADDU daddu
#define INT_ADDI daddi
#define INT_ADDIU daddiu
#define INT_SUB dsub
#define INT_SUBU dsubu
#define INT_L ld
#define INT_S sd
#define INT_SLL dsll
#define INT_SLLV dsllv
#define INT_SRL dsrl
#define INT_SRLV dsrlv
#define INT_SRA dsra
#define INT_SRAV dsrav
#endif
/*
* How to add/sub/load/store/shift C long variables.
*/
#if (_MIPS_SZLONG == 32)
#define LONG_ADD add
#define LONG_ADDU addu
#define LONG_ADDI addi
#define LONG_ADDIU addiu
#define LONG_SUB sub
#define LONG_SUBU subu
#define LONG_L lw
#define LONG_S sw
#define LONG_SP swp
#define LONG_SLL sll
#define LONG_SLLV sllv
#define LONG_SRL srl
#define LONG_SRLV srlv
#define LONG_SRA sra
#define LONG_SRAV srav
#define LONG .word
#define LONGSIZE 4
#define LONGMASK 3
#define LONGLOG 2
#endif
#if (_MIPS_SZLONG == 64)
#define LONG_ADD dadd
#define LONG_ADDU daddu
#define LONG_ADDI daddi
#define LONG_ADDIU daddiu
#define LONG_SUB dsub
#define LONG_SUBU dsubu
#define LONG_L ld
#define LONG_S sd
#define LONG_SP sdp
#define LONG_SLL dsll
#define LONG_SLLV dsllv
#define LONG_SRL dsrl
#define LONG_SRLV dsrlv
#define LONG_SRA dsra
#define LONG_SRAV dsrav
#define LONG .dword
#define LONGSIZE 8
#define LONGMASK 7
#define LONGLOG 3
#endif
/*
* How to add/sub/load/store/shift pointers.
*/
#if (_MIPS_SZPTR == 32)
#define PTR_ADD add
#define PTR_ADDU addu
#define PTR_ADDI addi
#define PTR_ADDIU addiu
#define PTR_SUB sub
#define PTR_SUBU subu
#define PTR_L lw
#define PTR_S sw
#define PTR_LA la
#define PTR_LI li
#define PTR_SLL sll
#define PTR_SLLV sllv
#define PTR_SRL srl
#define PTR_SRLV srlv
#define PTR_SRA sra
#define PTR_SRAV srav
#define PTR_SCALESHIFT 2
#define PTR .word
#define PTRSIZE 4
#define PTRLOG 2
#endif
#if (_MIPS_SZPTR == 64)
#define PTR_ADD dadd
#define PTR_ADDU daddu
#define PTR_ADDI daddi
#define PTR_ADDIU daddiu
#define PTR_SUB dsub
#define PTR_SUBU dsubu
#define PTR_L ld
#define PTR_S sd
#define PTR_LA dla
#define PTR_LI dli
#define PTR_SLL dsll
#define PTR_SLLV dsllv
#define PTR_SRL dsrl
#define PTR_SRLV dsrlv
#define PTR_SRA dsra
#define PTR_SRAV dsrav
#define PTR_SCALESHIFT 3
#define PTR .dword
#define PTRSIZE 8
#define PTRLOG 3
#endif
/*
* Some cp0 registers were extended to 64bit for MIPS III.
*/
#if (_MIPS_SIM == _MIPS_SIM_ABI32)
#define MFC0 mfc0
#define MTC0 mtc0
#endif
#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
#define MFC0 dmfc0
#define MTC0 dmtc0
#endif
#define SSNOP sll zero, zero, 1
#ifdef CONFIG_SGI_IP28
/* Inhibit speculative stores to volatile (e.g.DMA) or invalid addresses. */
#include <asm/cacheops.h>
#define R10KCBARRIER(addr) cache CACHE_BARRIER, addr;
#else
#define R10KCBARRIER(addr)
#endif
#endif /* __ASM_ASM_H */
| {
"pile_set_name": "Github"
} |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Infrastructure.Common;
using System.ServiceModel;
using Xunit;
public partial class Binding_Tcp_NetTcpBindingTests : ConditionalWcfTest
{
// Simple echo of a string using NetTcpBinding on both client and server with all default settings.
// Default settings are:
// - SecurityMode = Transport
// - ClientCredentialType = Windows
[WcfFact]
[Condition(nameof(Windows_Authentication_Available))]
[OuterLoop]
public static void DefaultSettings_Echo_RoundTrips_String()
{
string testString = "Hello";
ChannelFactory<IWcfService> factory = null;
IWcfService serviceProxy = null;
try
{
// *** SETUP *** \\
NetTcpBinding binding = new NetTcpBinding();
factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.Tcp_DefaultBinding_Address));
serviceProxy = factory.CreateChannel();
// *** EXECUTE *** \\
string result = serviceProxy.Echo(testString);
// *** VALIDATE *** \\
Assert.Equal(testString, result);
// *** CLEANUP *** \\
((ICommunicationObject)serviceProxy).Close();
factory.Close();
}
finally
{
// *** ENSURE CLEANUP *** \\
ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy, factory);
}
}
// Simple echo of a string using NetTcpBinding on both client and server with SecurityMode=Transport
// By default ClientCredentialType will be 'Windows'
// SecurityMode is Transport by default with NetTcpBinding, this test explicitly sets it.
[WcfFact]
[Condition(nameof(Windows_Authentication_Available))]
[OuterLoop]
public static void SecurityModeTransport_Echo_RoundTrips_String()
{
string testString = "Hello";
ChannelFactory<IWcfService> factory = null;
IWcfService serviceProxy = null;
try
{
// *** SETUP *** \\
NetTcpBinding binding = new NetTcpBinding(SecurityMode.Transport);
factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.Tcp_DefaultBinding_Address));
serviceProxy = factory.CreateChannel();
// *** EXECUTE *** \\
string result = serviceProxy.Echo(testString);
// *** VALIDATE *** \\
Assert.Equal(testString, result);
// *** CLEANUP *** \\
((ICommunicationObject)serviceProxy).Close();
factory.Close();
}
finally
{
// *** ENSURE CLEANUP *** \\
ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)serviceProxy, factory);
}
}
} | {
"pile_set_name": "Github"
} |
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2020 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI 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.
*
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
/**
* @since 9.2
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
/**
* Class OlaLevelAction
*/
class OlaLevelAction extends RuleAction {
static public $itemtype = 'OlaLevel';
static public $items_id = 'olalevels_id';
public $dohistory = true;
/**
* Constructor
**/
function __construct() {
// Override in order not to use glpi_rules table.
}
function rawSearchOptions() {
// RuleAction search options requires value of rules_id field which does not exists here
return [];
}
}
| {
"pile_set_name": "Github"
} |
// SPDX-License-Identifier: GPL-2.0
/*
* Allwinner EMAC MDIO interface driver
*
* Copyright 2012-2013 Stefan Roese <sr@denx.de>
* Copyright 2013 Maxime Ripard <maxime.ripard@free-electrons.com>
*
* Based on the Linux driver provided by Allwinner:
* Copyright (C) 1997 Sten Wang
*/
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of_address.h>
#include <linux/of_mdio.h>
#include <linux/phy.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
#define EMAC_MAC_MCMD_REG (0x00)
#define EMAC_MAC_MADR_REG (0x04)
#define EMAC_MAC_MWTD_REG (0x08)
#define EMAC_MAC_MRDD_REG (0x0c)
#define EMAC_MAC_MIND_REG (0x10)
#define EMAC_MAC_SSRR_REG (0x14)
#define MDIO_TIMEOUT (msecs_to_jiffies(100))
struct sun4i_mdio_data {
void __iomem *membase;
struct regulator *regulator;
};
static int sun4i_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
{
struct sun4i_mdio_data *data = bus->priv;
unsigned long timeout_jiffies;
int value;
/* issue the phy address and reg */
writel((mii_id << 8) | regnum, data->membase + EMAC_MAC_MADR_REG);
/* pull up the phy io line */
writel(0x1, data->membase + EMAC_MAC_MCMD_REG);
/* Wait read complete */
timeout_jiffies = jiffies + MDIO_TIMEOUT;
while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) {
if (time_is_before_jiffies(timeout_jiffies))
return -ETIMEDOUT;
msleep(1);
}
/* push down the phy io line */
writel(0x0, data->membase + EMAC_MAC_MCMD_REG);
/* and read data */
value = readl(data->membase + EMAC_MAC_MRDD_REG);
return value;
}
static int sun4i_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
u16 value)
{
struct sun4i_mdio_data *data = bus->priv;
unsigned long timeout_jiffies;
/* issue the phy address and reg */
writel((mii_id << 8) | regnum, data->membase + EMAC_MAC_MADR_REG);
/* pull up the phy io line */
writel(0x1, data->membase + EMAC_MAC_MCMD_REG);
/* Wait read complete */
timeout_jiffies = jiffies + MDIO_TIMEOUT;
while (readl(data->membase + EMAC_MAC_MIND_REG) & 0x1) {
if (time_is_before_jiffies(timeout_jiffies))
return -ETIMEDOUT;
msleep(1);
}
/* push down the phy io line */
writel(0x0, data->membase + EMAC_MAC_MCMD_REG);
/* and write data */
writel(value, data->membase + EMAC_MAC_MWTD_REG);
return 0;
}
static int sun4i_mdio_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct mii_bus *bus;
struct sun4i_mdio_data *data;
int ret;
bus = mdiobus_alloc_size(sizeof(*data));
if (!bus)
return -ENOMEM;
bus->name = "sun4i_mii_bus";
bus->read = &sun4i_mdio_read;
bus->write = &sun4i_mdio_write;
snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev->dev));
bus->parent = &pdev->dev;
data = bus->priv;
data->membase = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(data->membase)) {
ret = PTR_ERR(data->membase);
goto err_out_free_mdiobus;
}
data->regulator = devm_regulator_get(&pdev->dev, "phy");
if (IS_ERR(data->regulator)) {
if (PTR_ERR(data->regulator) == -EPROBE_DEFER) {
ret = -EPROBE_DEFER;
goto err_out_free_mdiobus;
}
dev_info(&pdev->dev, "no regulator found\n");
data->regulator = NULL;
} else {
ret = regulator_enable(data->regulator);
if (ret)
goto err_out_free_mdiobus;
}
ret = of_mdiobus_register(bus, np);
if (ret < 0)
goto err_out_disable_regulator;
platform_set_drvdata(pdev, bus);
return 0;
err_out_disable_regulator:
if (data->regulator)
regulator_disable(data->regulator);
err_out_free_mdiobus:
mdiobus_free(bus);
return ret;
}
static int sun4i_mdio_remove(struct platform_device *pdev)
{
struct mii_bus *bus = platform_get_drvdata(pdev);
struct sun4i_mdio_data *data = bus->priv;
mdiobus_unregister(bus);
if (data->regulator)
regulator_disable(data->regulator);
mdiobus_free(bus);
return 0;
}
static const struct of_device_id sun4i_mdio_dt_ids[] = {
{ .compatible = "allwinner,sun4i-a10-mdio" },
/* Deprecated */
{ .compatible = "allwinner,sun4i-mdio" },
{ }
};
MODULE_DEVICE_TABLE(of, sun4i_mdio_dt_ids);
static struct platform_driver sun4i_mdio_driver = {
.probe = sun4i_mdio_probe,
.remove = sun4i_mdio_remove,
.driver = {
.name = "sun4i-mdio",
.of_match_table = sun4i_mdio_dt_ids,
},
};
module_platform_driver(sun4i_mdio_driver);
MODULE_DESCRIPTION("Allwinner EMAC MDIO interface driver");
MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com>");
MODULE_LICENSE("GPL v2");
| {
"pile_set_name": "Github"
} |
/*
* Wire
* Copyright (C) 2016 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.waz.db
import androidx.sqlite.db.SupportSQLiteDatabase
import com.waz.log.BasicLogging.LogTag.DerivedLogTag
import com.waz.log.LogSE._
import com.waz.log.LogShow
import com.waz.service.tracking.TrackingService
import com.waz.utils.wrappers.DB
import androidx.room.migration.{Migration => RoomMigration}
import scala.util.control.NonFatal
trait Migration { self =>
val fromVersion: Int
val toVersion: Int
def apply(db: DB): Unit
def toRoomMigration: RoomMigration = new RoomMigration(fromVersion, toVersion) {
override def migrate(database: SupportSQLiteDatabase): Unit = apply(DB(database))
}
}
object Migration {
implicit val MigrationLogShow: LogShow[Migration] =
LogShow.create(m => s"Migration from ${m.fromVersion} to ${m.toVersion}")
val AnyVersion = -1
def apply(from: Int, to: Int)(migrations: (DB => Unit)*): Migration = new Migration {
override val toVersion = to
override val fromVersion = from
override def apply(db: DB): Unit = migrations.foreach(_(db))
override def toString: String = s"Migration from: $from to $to"
}
def to(to: Int)(migrations: (DB => Unit)*): Migration = apply(AnyVersion, to)(migrations:_*)
}
/**
* Uses given list of migrations to migrate database from one version to another.
* Finds shortest migration path and applies it.
*/
class Migrations(migrations: Migration*)(implicit val tracking: TrackingService) extends DerivedLogTag {
val toVersionMap = migrations.groupBy(_.toVersion)
def plan(from: Int, to: Int): List[Migration] = {
def shortest(from: Int, to: Int): List[Migration] = {
val possible = toVersionMap.getOrElse(to, Nil)
val plans = possible.map { m =>
if (m.fromVersion == from || m.fromVersion == Migration.AnyVersion) List(m)
else if (m.fromVersion < from) Nil
else shortest(from, m.fromVersion) match {
case Nil => List()
case best => best ::: List(m)
}
} .filter(_.nonEmpty)
if (plans.isEmpty) Nil
else plans.minBy(_.length)
}
if (from == to) Nil
else shortest(from, to)
}
/**
* Migrates database using provided migrations.
* Falls back to dropping all data if migration fails.
*
* Note, SQLiteOpenHelper#onUpgrade is already called from within an exclusive transaction when the system realises
* that a database you are trying to access needs to be upgraded. So we can just execute all sql commands directly
* (no point in calling nested transactions for code we control)
*
* @throws IllegalStateException if no migration plan can be found
*/
@throws[IllegalStateException]("If no migration plan can be found for given versions")
def migrate(storage: DaoDB, fromVersion: Int, toVersion: Int)(implicit db: SupportSQLiteDatabase): Unit = {
if (fromVersion != toVersion) {
plan(fromVersion, toVersion) match {
case Nil => throw new IllegalStateException(s"No migration plan from: $fromVersion to: $toVersion")
case ms =>
try {
ms.foreach { m =>
verbose(l"applying $m")
m(db)
db.execSQL(s"PRAGMA user_version = ${m.toVersion}")
}
} catch {
case NonFatal(e) =>
error(l"Migration failed for from: $fromVersion to: $toVersion", e)
tracking.exception(e, s"Migration failed for $storage, from: $fromVersion to: $toVersion")
fallback(storage, db)
}
}
}
}
def fallback(storage: DaoDB, db: SupportSQLiteDatabase): Unit = {
warn(l"Dropping all data!!")
storage.dropAllTables(db)
storage.onCreate(db)
}
}
| {
"pile_set_name": "Github"
} |
/**
* Copyright (C) 2015 MongoDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do not
* wish to do so, delete this exception statement from your version. If you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kQuery
#include "mongo/platform/basic.h"
#include "mongo/scripting/mozjs/cursor_handle.h"
#include "mongo/scripting/mozjs/implscope.h"
#include "mongo/scripting/mozjs/wrapconstrainedmethod.h"
#include "mongo/util/log.h"
namespace mongo {
namespace mozjs {
const JSFunctionSpec CursorHandleInfo::methods[2] = {
MONGO_ATTACH_JS_CONSTRAINED_METHOD_NO_PROTO(zeroCursorId, CursorHandleInfo), JS_FS_END,
};
const char* const CursorHandleInfo::className = "CursorHandle";
namespace {
long long* getCursorId(JSObject* thisv) {
CursorHandleInfo::CursorTracker* tracker =
static_cast<CursorHandleInfo::CursorTracker*>(JS_GetPrivate(thisv));
if (tracker) {
return &tracker->cursorId;
}
return nullptr;
}
long long* getCursorId(JS::CallArgs& args) {
return getCursorId(args.thisv().toObjectOrNull());
}
} // namespace
void CursorHandleInfo::finalize(JSFreeOp* fop, JSObject* obj) {
auto cursorTracker = static_cast<CursorHandleInfo::CursorTracker*>(JS_GetPrivate(obj));
if (cursorTracker) {
const long long cursorId = cursorTracker->cursorId;
if (cursorId) {
try {
cursorTracker->client->killCursor(cursorTracker->ns, cursorId);
} catch (...) {
auto status = exceptionToStatus();
try {
LOG(0) << "Failed to kill cursor " << cursorId << " due to " << status;
} catch (...) {
// This is here in case logging fails.
}
}
}
getScope(fop)->trackedDelete(cursorTracker);
}
}
void CursorHandleInfo::Functions::zeroCursorId::call(JSContext* cx, JS::CallArgs args) {
long long* cursorId = getCursorId(args);
if (cursorId) {
*cursorId = 0;
}
}
} // namespace mozjs
} // namespace mongo
| {
"pile_set_name": "Github"
} |
package sqltyped
import schemacrawler.schema.Schema
import Ast._
trait Validator {
def validate(db: DbConfig, sql: String): ?[Unit]
}
object NOPValidator extends Validator {
def validate(db: DbConfig, sql: String) = ().ok
}
object JdbcValidator extends Validator {
def validate(db: DbConfig, sql: String) =
Jdbc.withConnection(db.getConnection) { conn =>
val stmt = conn.prepareStatement(sql)
stmt.getMetaData // some JDBC drivers do round trip to DB here and validates the statement
}
}
/**
* For MySQL we use its internal API to get better validation.
*/
object MySQLValidator extends Validator {
def validate(db: DbConfig, sql: String) = try {
Jdbc.withConnection(db.getConnection) { conn =>
val m = Class.forName("com.mysql.jdbc.ServerPreparedStatement").getDeclaredMethod(
"getInstance",
Class.forName("com.mysql.jdbc.MySQLConnection"),
classOf[String],
classOf[String],
classOf[Int],
classOf[Int])
m.setAccessible(true)
m.invoke(null, conn, sql, "", 0: java.lang.Integer, 0: java.lang.Integer).ok
}
} catch {
case e: Exception if e.getClass.getName.endsWith("MySQLSyntaxErrorException") => fail(e.getMessage)
case e: Exception => JdbcValidator.validate(db, sql)
}
}
| {
"pile_set_name": "Github"
} |
/*
* MGTemplateMarker.h
*
* Created by Matt Gemmell on 12/05/2008.
* Copyright 2008 Instinctive Code. All rights reserved.
*
*/
#import "MGTemplateEngine.h"
@protocol MGTemplateMarker <NSObject>
@required
- (id)initWithTemplateEngine:(MGTemplateEngine *)engine; // to avoid retain cycles, use a weak reference for engine.
- (NSArray *)markers; // array of markers (each unique across all markers) this object handles.
- (NSArray *)endMarkersForMarker:(NSString *)marker; // returns the possible corresponding end-markers for a marker which has just started a block.
- (NSObject *)markerEncountered:(NSString *)marker withArguments:(NSArray *)args inRange:(NSRange)markerRange
blockStarted:(BOOL *)blockStarted blockEnded:(BOOL *)blockEnded
outputEnabled:(BOOL *)outputEnabled nextRange:(NSRange *)nextRange
currentBlockInfo:(NSDictionary *)blockInfo newVariables:(NSDictionary **)newVariables;
/* Notes for -markerEncountered:... method
Arguments:
marker: marker encountered by the template engine
args: arguments to the marker, in order
markerRange: the range of the marker encountered in the engine's templateString
blockStarted: pointer to BOOL. Set it to YES if the marker just started a block.
blockEnded: pointer to BOOL. Set it to YES if the marker just ended a block.
Note: you should never set both blockStarted and blockEnded in the same call.
outputEnabled: pointer to BOOL, indicating whether the engine is currently outputting. Can be changed to switch output on/off.
nextRange: the next range in the engine's templateString which will be searched. Can be modified if necessary.
currentBlockInfo: information about the current block, if the block was started by this handler; otherwise nil.
Note: if supplied, will include a dictionary of variables set for the current block.
newVariables: variables to set in the template context. If blockStarted is YES, these will be scoped only within the new block.
Note: if currentBlockInfo was specified, variables set in the return dictionary will override/update any variables of
the same name in currentBlockInfo's variables. This is for ease of updating loop-counters or such.
Returns:
A return value to insert into the template output, or nil if nothing should be inserted.
*/
- (void)engineFinishedProcessingTemplate;
@end
| {
"pile_set_name": "Github"
} |
/*
* pqR : A pretty quick version of R
* Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019 by Radford M. Neal
*
* Based on R : A Computer Language for Statistical Data Analysis
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
* Copyright (C) 1997--2012 The R Core Team
*
* The changes in pqR from R-2.15.0 distributed by the R Core Team are
* documented in the NEWS and MODS files in the top-level source directory.
*
* 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, a copy is available at
* http://www.r-project.org/Licenses/
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#define USE_FAST_PROTECT_MACROS
#include <Defn.h>
#include <Rmath.h>
static void R_NORETURN NULL_error (void)
{
error(_("attempt to set an attribute on NULL"));
}
static SEXP installAttrib(SEXP, SEXP, SEXP);
static SEXP removeAttrib(SEXP, SEXP);
SEXP comment(SEXP);
static SEXP commentgets(SEXP, SEXP);
static SEXP row_names_gets(SEXP vec , SEXP val)
{
SEXP ans;
if (vec == R_NilValue)
NULL_error();
if(isReal(val) && length(val) == 2 && ISNAN(REAL(val)[0]) ) {
/* This should not happen, but if a careless user dput()s a
data frame and sources the result, it will */
PROTECT(vec);
PROTECT(val = coerceVector(val, INTSXP));
ans = installAttrib(vec, R_RowNamesSymbol, val);
UNPROTECT(2);
return ans;
}
if(isInteger(val)) {
Rboolean OK_compact = TRUE;
int i, n = LENGTH(val);
if(n == 2 && INTEGER(val)[0] == NA_INTEGER) {
n = INTEGER(val)[1];
} else if (n > 2) {
for(i = 0; i < n; i++)
if(INTEGER(val)[i] != i+1) {
OK_compact = FALSE;
break;
}
} else OK_compact = FALSE;
if(OK_compact) {
/* we hide the length in an impossible integer vector */
PROTECT(vec);
PROTECT(val = allocVector(INTSXP, 2));
INTEGER(val)[0] = NA_INTEGER;
INTEGER(val)[1] = n;
ans = installAttrib(vec, R_RowNamesSymbol, val);
UNPROTECT(2); /* vec, val */
return ans;
}
} else if(!isString(val))
error(_("row names must be 'character' or 'integer', not '%s'"),
type2char(TYPEOF(val)));
PROTECT(vec);
PROTECT(val);
ans = installAttrib(vec, R_RowNamesSymbol, val);
UNPROTECT(2); /* vec, val */
return ans;
}
/* used in removeAttrib, commentgets and classgets */
static SEXP stripAttrib(SEXP tag, SEXP lst)
{
SEXP last = R_NilValue;
SEXP next = lst;
while (next != R_NilValue) {
if (TAG(next) != tag) {
last = next;
next = CDR(next);
}
else {
next = CDR(next);
if (last == R_NilValue)
lst = next;
else
SETCDR(last,next);
}
}
return lst;
}
/* Get the "names" attribute, and don't change its NAMEDCNT unless
it's really taken from another attribute, or is zero even though in
the attribute list. Used directly in subassign.c, and in
getAttrib0 below. */
static SEXP getAttrib0(SEXP vec, SEXP name);
/* Note: getNamesAttrib won't always set NAMEDCNT of answer to maximum. */
SEXP attribute_hidden getNamesAttrib (SEXP vec)
{
SEXP s;
if (isVector(vec) || isList(vec) || isLanguage(vec)) {
s = getDimAttrib(vec);
if (TYPEOF(s) == INTSXP && LENGTH(s) == 1) {
s = getAttrib0(vec, R_DimNamesSymbol);
if (s != R_NilValue) {
s = VECTOR_ELT(s,0);
SET_NAMEDCNT_MAX(s);
return s;
}
}
}
if (isList(vec) || isLanguage(vec)) {
R_len_t len = length(vec);
int any = 0;
int i = 0;
PROTECT(s = allocVector(STRSXP, len));
for ( ; vec != R_NilValue; vec = CDR(vec), i++) {
if (TAG(vec) == R_NilValue)
SET_STRING_ELT_BLANK(s, i);
else if (isSymbol(TAG(vec))) {
any = 1;
SET_STRING_ELT(s, i, PRINTNAME(TAG(vec)));
}
else
error(_("getAttrib: invalid type (%s) for TAG"),
type2char(TYPEOF(TAG(vec))));
}
UNPROTECT(1);
return any ? s : R_NilValue;
}
for (s = ATTRIB(vec); s != R_NilValue; s = CDR(s)) {
if (TAG(s) == R_NamesSymbol) {
SEXP nms = CAR(s);
/* Ensure that code getting names of vectors always gets a
character vector - silently for now. */
if (isVector(vec) && TYPEOF(nms) != STRSXP)
return R_NilValue;
SET_NAMEDCNT_NOT_0(nms);
return nms;
}
}
return R_NilValue;
}
/* The 0 version of getAttrib can be called when it is known that "name'
is a symbol (not a string) and is not R_RowNamesSymbol (or the special
processing for R_RowNamesSymbol is not desired). (Currently static,
so not callable outside this module.) */
static SEXP getAttrib0(SEXP vec, SEXP name)
{
SEXP s;
if (name == R_NamesSymbol) {
s = getNamesAttrib(vec);
SET_NAMEDCNT_NOT_0(s);
return s;
}
s = getAttrib00(vec,name);
/* This is where the old/new list adjustment happens. */
if (name == R_DimNamesSymbol && TYPEOF(s) == LISTSXP) {
SEXP new, old;
int i;
new = allocVector(VECSXP, length(s));
old = s;
i = 0;
while (old != R_NilValue) {
SET_VECTOR_ELT(new, i++, CAR(old));
old = CDR(old);
}
SET_NAMEDCNT_MAX(new);
return new;
}
return s;
}
/* General version of getAttrib. Can be called when "name" may be a string.
Does all special handling.
NOTE: For environments serialize.c calls getAttrib to find if
there is a class attribute in order to reconstruct the object bit
if needed. This means the function cannot use OBJECT(vec) == 0 to
conclude that the class attribute is R_NilValue. If you want to
rewrite this function to use such a pre-test, be sure to adjust
serialize.c accordingly. LT */
SEXP getAttrib(SEXP vec, SEXP name)
{
if(TYPEOF(vec) == CHARSXP)
error("cannot have attributes on a CHARSXP");
/* pre-test to avoid expensive operations if clearly not needed -- LT */
if (ATTRIB(vec) == R_NilValue
&& TYPEOF(vec) != LISTSXP && TYPEOF(vec) != LANGSXP)
return R_NilValue;
if (isString(name)) name = install_translated (STRING_ELT(name,0));
/* special test for c(NA, n) rownames of data frames: */
if (name == R_RowNamesSymbol) {
SEXP s = getAttrib00(vec, R_RowNamesSymbol);
if(isInteger(s) && LENGTH(s) == 2 && INTEGER(s)[0] == NA_INTEGER) {
int i, n = abs(INTEGER(s)[1]);
s = allocVector(INTSXP, n);
for (i = 0; i < n; i++)
INTEGER(s)[i] = i+1;
}
return s;
} else
return getAttrib0(vec, name);
}
SEXP R_shortRowNames(SEXP vec, SEXP stype)
{
/* return n if the data frame 'vec' has c(NA, n) rownames;
* nrow(.) otherwise; note that data frames with nrow(.) == 0
* have no row.names.
==> is also used in dim.data.frame() */
SEXP s = getAttrib0(vec, R_RowNamesSymbol), ans = s;
int type = asInteger(stype);
if( type < 0 || type > 2)
error(_("invalid '%s' argument"), "type");
if(type >= 1) {
int n = (isInteger(s) && LENGTH(s) == 2 && INTEGER(s)[0] == NA_INTEGER)
? INTEGER(s)[1] : (s == R_NilValue ? 0 : LENGTH(s));
ans = ScalarIntegerMaybeConst((type == 1) ? n : abs(n));
}
return ans;
}
/* This is allowed to change 'out' */
SEXP R_copyDFattr(SEXP in, SEXP out)
{
SET_ATTRIB(out, ATTRIB(in));
if (IS_S4_OBJECT(in)) SET_S4_OBJECT(out); else UNSET_S4_OBJECT(out);
SET_OBJECT(out, OBJECT(in));
SET_NAMEDCNT_MAX(out); /* Kludge to undo invalid sharing done above */
return out;
}
/* Possibly duplicate value that will be set as an attribute.
This should probably be replaced by normal incrementing of
NAMEDCNT, but there could be some code that doesn't check NAMEDCNT,
assuming that the duplicate below is done. Avoiding a duplicate
for a vector when NAMEDCNT is already MAX_NAMEDCNT, or the vector
is length zero, and there is no possibility of cycles, is a
conservative attempt to reduce the number of duplications done, for
example, when the value is a literal constant that is part of an
expression being evaluated.
For "names", just increment NAMEDCNT (unless could create cycle).
Also, don't dup "class" attribute, just set to MAX_NAMEDCNT, which
seems safe, and saves space on every object of the class.
It is also of interest that getAttrib00 sets NAMEDCNT to
MAX_NAMEDCNT, except for "names". */
static SEXP attr_val_dup (SEXP obj, SEXP name, SEXP val)
{
if (name == R_NamesSymbol && !HAS_ATTRIB(val) && val != obj) {
INC_NAMEDCNT(val);
return val;
}
if (NAMEDCNT_EQ_0(val) || name == R_ClassSymbol) {
SET_NAMEDCNT_MAX(val);
return val;
}
if (isVectorAtomic(val) && !HAS_ATTRIB(val) && val != obj) {
if (LENGTH(val) == 0) {
SET_NAMEDCNT_MAX(val);
return val;
}
if (NAMEDCNT(val) == MAX_NAMEDCNT)
return val;
}
SEXP v = duplicate(val);
if (v != val)
SET_NAMEDCNT_MAX(v);
return v;
}
/* Duplicate an attribute pairlist, and some of its attributes, that will be
used for an object. When to duplicate uses the same criterion as for
setting an attribute. */
SEXP attribute_hidden Rf_attributes_dup (SEXP obj, SEXP attrs)
{
if (attrs == R_NilValue)
return R_NilValue;
SEXP first = cons_with_tag (attr_val_dup (obj, TAG(attrs), CAR(attrs)),
R_NilValue, TAG(attrs));
SEXP next = first;
PROTECT(first);
while ((attrs = CDR(attrs)) != R_NilValue) {
SEXP dv = cons_with_tag (attr_val_dup (obj, TAG(attrs), CAR(attrs)),
R_NilValue, TAG(attrs));
SETCDR (next, dv);
next = dv;
}
UNPROTECT(1);
return first;
}
/* 'name' should be 1-element STRSXP or SYMSXP */
SEXP setAttrib(SEXP vec, SEXP name, SEXP val)
{
PROTECT3(vec,name,val);
if (isString(name))
name = install_translated (STRING_ELT(name,0));
if (val == R_NilValue) {
UNPROTECT(3);
return removeAttrib(vec, name);
}
if (vec == R_NilValue) /* after above: we allow removing names from NULL */
NULL_error();
val = attr_val_dup (vec, name, val);
UNPROTECT(3);
if (name == R_NamesSymbol)
return namesgets(vec, val);
else if (name == R_DimSymbol)
return dimgets(vec, val);
else if (name == R_DimNamesSymbol)
return dimnamesgets(vec, val);
else if (name == R_ClassSymbol)
return classgets(vec, val);
else if (name == R_TspSymbol)
return tspgets(vec, val);
else if (name == R_CommentSymbol)
return commentgets(vec, val);
else if (name == R_RowNamesSymbol)
return row_names_gets(vec, val);
else
return installAttrib(vec, name, val);
}
/* Remove dim and dimnames attributes. */
void attribute_hidden no_dim_attributes (SEXP x)
{
PROTECT(x);
SEXP s = ATTRIB(x);
SEXP t = s;
SEXP p;
while (t != R_NilValue) {
if (TAG(t) == R_DimSymbol || TAG(t) == R_DimNamesSymbol) {
if (t == s)
SET_ATTRIB(x,CDR(t));
else
SETCDR(p,CDR(t));
}
p = t;
t = CDR(t);
}
UNPROTECT(1);
}
/* This is called in the case of binary operations to copy */
/* most attributes from (one of) the input arguments to */
/* the output. Note that the Dim and Names attributes */
/* should have been assigned elsewhere. */
void copyMostAttrib(SEXP inp, SEXP ans)
{
SEXP s;
if (ans == R_NilValue)
NULL_error();
PROTECT2(ans,inp);
for (s = ATTRIB(inp); s != R_NilValue; s = CDR(s)) {
if ((TAG(s) != R_NamesSymbol) &&
(TAG(s) != R_DimSymbol) &&
(TAG(s) != R_DimNamesSymbol)) {
installAttrib(ans, TAG(s), CAR(s));
}
}
SET_OBJECT(ans, OBJECT(inp));
if (IS_S4_OBJECT(inp)) SET_S4_OBJECT(ans); else UNSET_S4_OBJECT(ans);
UNPROTECT(2);
}
/* Version that doesn't copy class, for VARIANT_UNCLASS. */
void attribute_hidden copyMostAttribNoClass(SEXP inp, SEXP ans)
{
SEXP s;
if (ans == R_NilValue)
NULL_error();
PROTECT2(ans,inp);
for (s = ATTRIB(inp); s != R_NilValue; s = CDR(s)) {
if ((TAG(s) != R_NamesSymbol) &&
(TAG(s) != R_ClassSymbol) &&
(TAG(s) != R_DimSymbol) &&
(TAG(s) != R_DimNamesSymbol)) {
installAttrib(ans, TAG(s), CAR(s));
}
}
UNPROTECT(2);
}
/* version that does not preserve ts information, for subsetting */
void attribute_hidden copyMostAttribNoTs(SEXP inp, SEXP ans)
{
SEXP s;
if (ans == R_NilValue)
NULL_error();
PROTECT2(ans,inp);
for (s = ATTRIB(inp); s != R_NilValue; s = CDR(s)) {
if ((TAG(s) != R_NamesSymbol) &&
(TAG(s) != R_ClassSymbol) &&
(TAG(s) != R_TspSymbol) &&
(TAG(s) != R_DimSymbol) &&
(TAG(s) != R_DimNamesSymbol)) {
installAttrib(ans, TAG(s), CAR(s));
} else if (TAG(s) == R_ClassSymbol) {
SEXP cl = CAR(s);
int i;
Rboolean ists = FALSE;
for (i = 0; i < LENGTH(cl); i++)
if (strcmp(CHAR(STRING_ELT(cl, i)), "ts") == 0) { /* ASCII */
ists = TRUE;
break;
}
if (!ists) installAttrib(ans, TAG(s), cl);
else if(LENGTH(cl) <= 1) {
} else {
SEXP new_cl;
int i, j, l = LENGTH(cl);
PROTECT(new_cl = allocVector(STRSXP, l - 1));
for (i = 0, j = 0; i < l; i++)
if (strcmp(CHAR(STRING_ELT(cl, i)), "ts")) /* ASCII */
SET_STRING_ELT(new_cl, j++, STRING_ELT(cl, i));
installAttrib(ans, TAG(s), new_cl);
UNPROTECT(1);
}
}
}
SET_OBJECT(ans, OBJECT(inp));
if (IS_S4_OBJECT(inp)) SET_S4_OBJECT(ans); else UNSET_S4_OBJECT(ans);
UNPROTECT(2);
}
static SEXP installAttrib(SEXP vec, SEXP name, SEXP val)
{
SEXP s, t, last;
if(TYPEOF(vec) == CHARSXP)
error("cannot set attribute on a CHARSXP");
for (s = ATTRIB(vec); s != R_NilValue; s = CDR(s)) {
if (TAG(s) == name) {
SETCAR(s, val);
return val;
}
last = s;
}
PROTECT(vec);
t = cons_with_tag (val, R_NilValue, name);
UNPROTECT(1);
if (ATTRIB(vec) == R_NilValue)
SET_ATTRIB(vec,t);
else
SETCDR(last,t);
return val;
}
static SEXP removeAttrib(SEXP vec, SEXP name)
{
SEXP t;
if(TYPEOF(vec) == CHARSXP)
error("cannot set attribute on a CHARSXP");
if (name == R_NamesSymbol && isList(vec)) {
for (t = vec; t != R_NilValue; t = CDR(t))
SET_TAG_NIL(t);
return R_NilValue;
}
else if (ATTRIB(vec) != R_NilValue || OBJECT(vec)) {
/* The "if" above avoids writing to constants (eg, R_NilValue) */
if (name == R_DimSymbol)
SET_ATTRIB(vec, stripAttrib(R_DimNamesSymbol, ATTRIB(vec)));
SET_ATTRIB(vec, stripAttrib(name, ATTRIB(vec)));
if (name == R_ClassSymbol)
SET_OBJECT(vec, 0);
}
return R_NilValue;
}
static void checkNames(SEXP x, SEXP s)
{
if (isVector(x) || isList(x) || isLanguage(x)) {
if (!isVector(s) && !isList(s))
error(_("invalid type (%s) for 'names': must be vector"),
type2char(TYPEOF(s)));
if (length(x) != length(s))
error(_("'names' attribute [%d] must be the same length as the vector [%d]"), length(s), length(x));
}
else if(IS_S4_OBJECT(x)) {
/* leave validity checks to S4 code */
}
else error(_("names() applied to a non-vector"));
}
/* Time Series Parameters */
static void badtsp(void)
{
error(_("invalid time series parameters specified"));
}
SEXP tspgets(SEXP vec, SEXP val)
{
double start, end, frequency;
int n;
if (vec == R_NilValue)
NULL_error();
if(IS_S4_OBJECT(vec)) { /* leave validity checking to validObject */
if (!isNumeric(val)) /* but should have been checked */
error(_("'tsp' attribute must be numeric"));
installAttrib(vec, R_TspSymbol, val);
return vec;
}
if (!isNumeric(val) || length(val) != 3)
error(_("'tsp' attribute must be numeric of length three"));
if (isReal(val)) {
start = REAL(val)[0];
end = REAL(val)[1];
frequency = REAL(val)[2];
}
else {
start = (INTEGER(val)[0] == NA_INTEGER) ?
NA_REAL : INTEGER(val)[0];
end = (INTEGER(val)[1] == NA_INTEGER) ?
NA_REAL : INTEGER(val)[1];
frequency = (INTEGER(val)[2] == NA_INTEGER) ?
NA_REAL : INTEGER(val)[2];
}
if (frequency <= 0) badtsp();
n = nrows(vec);
if (n == 0) error(_("cannot assign 'tsp' to zero-length vector"));
/* FIXME: 1.e-5 should rather be == option('ts.eps') !! */
if (fabs(end - start - (n - 1)/frequency) > 1.e-5)
badtsp();
PROTECT(vec);
val = allocVector(REALSXP, 3);
PROTECT(val);
REAL(val)[0] = start;
REAL(val)[1] = end;
REAL(val)[2] = frequency;
installAttrib(vec, R_TspSymbol, val);
UNPROTECT(2);
return vec;
}
static SEXP commentgets(SEXP vec, SEXP comment)
{
if (vec == R_NilValue)
NULL_error();
if (isNull(comment) || isString(comment)) {
if (length(comment) <= 0) {
SET_ATTRIB(vec, stripAttrib(R_CommentSymbol, ATTRIB(vec)));
}
else {
installAttrib(vec, R_CommentSymbol, comment);
}
return R_NilValue;
}
error(_("attempt to set invalid 'comment' attribute"));
}
static SEXP do_commentgets(SEXP call, SEXP op, SEXP args, SEXP env)
{
checkArity(op, args);
if (NAMEDCNT_GT_1(CAR(args)))
SETCAR(args, dup_top_level(CAR(args)));
if (length(CADR(args)) == 0)
SETCADR(args, R_NilValue);
setAttrib(CAR(args), R_CommentSymbol, CADR(args));
return CAR(args);
}
static SEXP do_comment(SEXP call, SEXP op, SEXP args, SEXP env)
{
checkArity(op, args);
return getAttrib(CAR(args), R_CommentSymbol);
}
SEXP classgets(SEXP vec, SEXP klass)
{
if (isNull(klass) || isString(klass)) {
if (length(klass) <= 0) {
SET_ATTRIB(vec, stripAttrib(R_ClassSymbol, ATTRIB(vec)));
SET_OBJECT(vec, 0);
}
else {
/* When data frames were a special data type */
/* we had more exhaustive checks here. Now that */
/* use JMCs interpreted code, we don't need this */
/* FIXME : The whole "classgets" may as well die. */
/* HOWEVER, it is the way that the object bit gets set/unset */
int i;
Rboolean isfactor = FALSE;
if (vec == R_NilValue)
NULL_error();
for(i = 0; i < LENGTH(klass); i++)
if(streql(CHAR(STRING_ELT(klass, i)), "factor")) { /* ASCII */
isfactor = TRUE;
break;
}
if(isfactor && TYPEOF(vec) != INTSXP) {
/* we cannot coerce vec here, so just fail */
error(_("adding class \"factor\" to an invalid object"));
}
installAttrib(vec, R_ClassSymbol, klass);
SET_OBJECT(vec, 1);
}
return R_NilValue;
}
error(_("attempt to set invalid 'class' attribute"));
}
/* oldClass<-, SPECIALSXP so can pass on gradient. */
static SEXP do_oldclassgets (SEXP call, SEXP op, SEXP args, SEXP env,
int variant)
{
PROTECT (args = variant & VARIANT_GRADIENT
? evalList_gradient (args, env, 0, 1, 0)
: evalList (args, env));
checkArity(op, args);
check1arg_x (args, call);
if (NAMEDCNT_GT_1(CAR(args)))
SETCAR(args, dup_top_level(CAR(args)));
if (length(CADR(args)) == 0)
SETCADR(args, R_NilValue);
if (IS_S4_OBJECT(CAR(args)))
UNSET_S4_OBJECT(CAR(args));
setAttrib(CAR(args), R_ClassSymbol, CADR(args));
if (HAS_GRADIENT_IN_CELL(args)) {
R_gradient = GRADIENT_IN_CELL(args);
R_variant_result = VARIANT_GRADIENT_FLAG;
}
UNPROTECT(1);
return CAR(args);
}
/* oldClass, primitive */
static SEXP do_oldclass(SEXP call, SEXP op, SEXP args, SEXP env)
{
checkArity(op, args);
check1arg_x (args, call);
SEXP x = CAR(args), s3class;
if(IS_S4_OBJECT(x)) {
if((s3class = S3Class(x)) != R_NilValue) {
return s3class;
}
}
return getClassAttrib(x);
}
/* character elements corresponding to the syntactic types in the
grammar */
static SEXP lang2str(SEXP obj, SEXPTYPE t)
{
SEXP symb = CAR(obj);
static SEXP if_sym = 0, while_sym, for_sym, eq_sym, gets_sym,
lpar_sym, lbrace_sym, call_sym;
if(!if_sym) {
/* initialize: another place for a hash table */
if_sym = install("if");
while_sym = install("while");
for_sym = install("for");
eq_sym = install("=");
gets_sym = install("<-");
lpar_sym = install("(");
lbrace_sym = install("{");
call_sym = install("call");
}
if(isSymbol(symb)) {
if(symb == if_sym || symb == for_sym || symb == while_sym ||
symb == lpar_sym || symb == lbrace_sym ||
symb == eq_sym || symb == gets_sym)
return PRINTNAME(symb);
}
return PRINTNAME(call_sym);
}
/* the S4-style class: for dispatch required to be a single string;
for the new class() function;
if(!singleString) , keeps S3-style multiple classes.
Called from the methods package, so exposed.
*/
SEXP R_data_class(SEXP obj, Rboolean singleString)
{
SEXP klass = getClassAttrib(obj);
int n = 0;
if (TYPEOF(klass) == STRSXP && (n = LENGTH(klass)) > 0
&& (n == 1 || !singleString))
return klass;
if (n == 0) {
int nd;
SEXP dim = getDimAttrib(obj);
if (dim != R_NilValue && (nd = LENGTH(dim)) > 0)
klass = nd==2 ? R_matrix_CHARSXP : R_array_CHARSXP;
else {
SEXPTYPE t = TYPEOF(obj);
switch(t) {
case CLOSXP: case SPECIALSXP: case BUILTINSXP:
klass = R_function_CHARSXP;
break;
case REALSXP:
klass = R_numeric_CHARSXP;
break;
case SYMSXP:
klass = R_name_CHARSXP;
break;
case LANGSXP:
klass = lang2str(obj, t);
break;
default:
return type2rstr(t);
}
}
}
else
klass = asChar(klass);
return ScalarString(klass);
}
static SEXP s_dot_S3Class = 0;
static SEXP R_S4_extends_table = 0;
static SEXP cache_class(const char *class, SEXP klass) {
if(!R_S4_extends_table) {
R_S4_extends_table = R_NewHashedEnv(R_NilValue, ScalarIntegerMaybeConst(0));
R_PreserveObject(R_S4_extends_table);
}
if(isNull(klass)) { /* retrieve cached value */
SEXP val;
val = findVarInFrame(R_S4_extends_table, install(class));
return (val == R_UnboundValue) ? klass : val;
}
defineVar(install(class), klass, R_S4_extends_table);
return klass;
}
static SEXP S4_extends(SEXP klass) {
static SEXP s_extends = 0, s_extendsForS3;
SEXP e, val; const char *class;
if(!s_extends) {
s_extends = install("extends");
s_extendsForS3 = install(".extendsForS3");
R_S4_extends_table = R_NewHashedEnv(R_NilValue, ScalarIntegerMaybeConst(0));
R_PreserveObject(R_S4_extends_table);
}
/* sanity check for methods package available */
if(findVar(s_extends, R_GlobalEnv) == R_UnboundValue)
return klass;
class = translateChar(STRING_ELT(klass, 0)); /* TODO: include package attr. */
val = findVarInFrame(R_S4_extends_table, install(class));
if(val != R_UnboundValue)
return val;
PROTECT(e = allocVector(LANGSXP, 2));
SETCAR(e, s_extendsForS3);
val = CDR(e);
SETCAR(val, klass);
PROTECT(val = eval(e, R_MethodsNamespace));
cache_class(class, val);
UNPROTECT(2); /* val, e */
return(val);
}
/* -------------------------------------------------------------------------- */
/* PRE-ALLOCATED DEFAULT CLASS ATTRIBUTES. Taken from R-3.2.0 (or later), */
/* modified a bit for pqR. */
static struct {
SEXP vector;
SEXP matrix;
SEXP array;
} Type2DefaultClass[MAX_NUM_SEXPTYPE];
static SEXP createDefaultClass(SEXP part1, SEXP part2, SEXP part3)
{
int size = 0;
if (part1 != R_NilValue) size++;
if (part2 != R_NilValue) size++;
if (part3 != R_NilValue) size++;
if (size == 0 || part2 == R_NilValue) return R_NilValue;
SEXP res = allocVector(STRSXP, size);
R_PreserveObject(res);
int i = 0;
if (part1 != R_NilValue) SET_STRING_ELT(res, i++, part1);
if (part2 != R_NilValue) SET_STRING_ELT(res, i++, part2);
if (part3 != R_NilValue) SET_STRING_ELT(res, i, part3);
SET_NAMEDCNT_MAX(res);
return res;
}
attribute_hidden
void InitS3DefaultTypes()
{
for(int type = 0; type < MAX_NUM_SEXPTYPE; type++) {
SEXP part2 = R_NilValue;
SEXP part3 = R_NilValue;
int nprotected = 0;
switch(type) {
case CLOSXP:
case SPECIALSXP:
case BUILTINSXP:
part2 = PROTECT(mkChar("function"));
nprotected++;
break;
case INTSXP:
case REALSXP:
part2 = PROTECT(type2str_nowarn(type));
part3 = PROTECT(mkChar("numeric"));
nprotected += 2;
break;
case LANGSXP:
/* part2 remains R_NilValue: default type cannot be
pre-allocated, as it depends on the object value */
break;
case SYMSXP:
part2 = PROTECT(mkChar("name"));
nprotected++;
break;
default:
part2 = PROTECT(type2str_nowarn(type));
nprotected++;
}
Type2DefaultClass[type].vector =
createDefaultClass(R_NilValue, part2, part3);
SEXP part1;
PROTECT(part1 = mkChar("matrix"));
Type2DefaultClass[type].matrix =
createDefaultClass(part1, part2, part3);
UNPROTECT(1);
PROTECT(part1 = mkChar("array"));
Type2DefaultClass[type].array =
createDefaultClass(part1, part2, part3);
UNPROTECT(1);
UNPROTECT(nprotected);
}
}
/* Version for S3-dispatch. Some parts adapted from R-3.2.0 (or later). */
SEXP attribute_hidden R_data_class2 (SEXP obj)
{
SEXP klass = getClassAttrib(obj);
if (klass != R_NilValue)
return IS_S4_OBJECT(obj) ? S4_extends(klass) : klass;
SEXPTYPE t = TYPEOF(obj);
SEXP dim = getDimAttrib(obj);
SEXP defaultClass;
int n = 0;
defaultClass = dim == R_NilValue ? Type2DefaultClass[t].vector
: (n = LENGTH(dim)) == 2 ? Type2DefaultClass[t].matrix
: Type2DefaultClass[t].array;
if (defaultClass == R_NilValue) {
/* now t == LANGSXP, but check to make sure */
if (t != LANGSXP)
error("type must be LANGSXP at this point");
if (n == 0)
defaultClass = ScalarString (lang2str(obj,t));
else {
PROTECT (defaultClass = allocVector(STRSXP,2));
SET_STRING_ELT (defaultClass, 0,
n == 2 ? R_matrix_CHARSXP : R_array_CHARSXP);
SET_STRING_ELT (defaultClass, 1,
lang2str(obj, t));
UNPROTECT(1);
}
}
return defaultClass;
}
/* class() : */
SEXP attribute_hidden R_do_data_class(SEXP call, SEXP op, SEXP args, SEXP env)
{
checkArity(op, args);
if(PRIMVAL(op) == 1) {
const char *class; SEXP klass;
check1arg(args, call, "class");
klass = CAR(args);
if(TYPEOF(klass) != STRSXP || LENGTH(klass) < 1)
errorcall(call,"invalid class argument to internal .cache_class");
class = translateChar(STRING_ELT(klass, 0));
return cache_class(class, CADR(args));
}
check1arg_x (args, call);
return R_data_class(CAR(args), FALSE);
}
/* names(obj) <- name. SPECIAL, so can handle gradient for obj. */
static SEXP do_namesgets(SEXP call, SEXP op, SEXP args, SEXP env, int variant)
{
SEXP ans;
PROTECT (args = variant & VARIANT_GRADIENT
? evalList_gradient (args, env, 0, 1, 0)
: evalList (args, env));
checkArity(op, args);
check1arg_x (args, call);
if (DispatchOrEval(call, op, "names<-", args, env, &ans, 0, 1, 0)) {
UNPROTECT(1);
return(ans);
}
SEXP obj = CAR(args);
SEXP nms = CADR(args);
/* Special case: removing non-existent names, to avoid a copy */
if (nms == R_NilValue && getNamesAttrib(CAR(args)) == R_NilValue)
goto ret;
if (NAMEDCNT_GT_1(obj)) {
obj = dup_top_level(obj);
SETCAR (args, obj);
}
if (IS_S4_OBJECT(obj)) {
const char *klass = CHAR(STRING_ELT(R_data_class(obj, FALSE), 0));
if(getNamesAttrib(obj) == R_NilValue) {
/* S4 class w/o a names slot or attribute */
if(TYPEOF(obj) == S4SXP)
errorcall(call,_("Class '%s' has no 'names' slot"), klass);
else
warningcall(call,
_("Class '%s' has no 'names' slot; assigning a names attribute will create an invalid object"),
klass);
}
else if(TYPEOF(obj) == S4SXP)
errorcall(call,
_("Illegal to use names()<- to set the 'names' slot in a non-vector class ('%s')"),
klass);
/* else, go ahead, but can't check validity of replacement*/
}
if (nms != R_NilValue && (TYPEOF(nms) != STRSXP || HAS_ATTRIB(nms))) {
static SEXP asc = R_NoObject;
if (asc == R_NoObject) asc = install("as.character");
SEXP prom = mkPROMISE (nms, R_EmptyEnv);
SET_PRVALUE (prom, nms);
SEXP cl = LCONS (asc, CONS(prom,R_NilValue));
PROTECT(cl);
nms = eval(cl, env);
UNPROTECT(1);
}
PROTECT(nms);
setAttrib(obj, R_NamesSymbol, nms);
SET_NAMEDCNT_0(obj); /* the standard kludge for subassign primitives */
UNPROTECT(1);
ret:
if (HAS_GRADIENT_IN_CELL(args)) {
R_gradient = GRADIENT_IN_CELL(args);
R_variant_result = VARIANT_GRADIENT_FLAG;
}
UNPROTECT(1);
return obj;
}
SEXP namesgets(SEXP vec, SEXP val)
{
int i;
SEXP s, rval, tval;
PROTECT2(vec,val);
/* Ensure that the labels are indeed */
/* a vector of character strings */
if (isList(val)) {
if (!isVectorizable(val))
error(_("incompatible 'names' argument"));
else {
rval = allocVector(STRSXP, length(vec));
PROTECT(rval);
/* See PR#10807 */
for (i = 0, tval = val;
i < length(vec) && tval != R_NilValue;
i++, tval = CDR(tval)) {
s = coerceVector(CAR(tval), STRSXP);
SET_STRING_ELT(rval, i, STRING_ELT(s, 0));
}
UNPROTECT(1);
val = rval;
}
} else val = coerceVector(val, STRSXP);
UNPROTECT_PROTECT(val);
/* Check that the lengths and types are compatible */
if (length(val) < length(vec)) {
val = lengthgets(val, length(vec));
UNPROTECT_PROTECT(val);
}
checkNames(vec, val);
/* Special treatment for one dimensional arrays */
if (isVector(vec) || isList(vec) || isLanguage(vec)) {
s = getDimAttrib(vec);
if (TYPEOF(s) == INTSXP && length(s) == 1) {
PROTECT(val = CONS(val, R_NilValue));
setAttrib(vec, R_DimNamesSymbol, val);
UNPROTECT(3);
return vec;
}
}
if (isList(vec) || isLanguage(vec)) {
/* Cons-cell based objects */
i = 0;
for (s = vec; s != R_NilValue; s = CDR(s), i++)
if (STRING_ELT(val, i) != R_NilValue
&& STRING_ELT(val, i) != R_NaString
&& *CHAR(STRING_ELT(val, i)) != 0) /* test of length */
SET_TAG(s, install_translated (STRING_ELT(val,i)));
else
SET_TAG_NIL(s);
}
else if (isVector(vec) || IS_S4_OBJECT(vec))
/* Normal case */
installAttrib(vec, R_NamesSymbol, val);
else
error(_("invalid type (%s) to set 'names' attribute"),
type2char(TYPEOF(vec)));
UNPROTECT(2);
return vec;
}
static SEXP do_names(SEXP call, SEXP op, SEXP args, SEXP env, int variant)
{
SEXP obj, nms, ans;
checkArity(op, args);
check1arg_x (args, call);
if (DispatchOrEval(call, op, "names", args, env, &ans, 0, 1, variant))
return ans;
PROTECT(obj = CAR(ans));
if (isVector(obj) || isList(obj) || isLanguage(obj) || IS_S4_OBJECT(obj))
nms = getNamesAttrib(obj);
else
nms = R_NilValue;
UNPROTECT(1);
/* See if names are an unshared subset of the object. Not true if
names are not from the "names" attribute, which is detected by
obj not being a vector (names created from tags in pairlist, for
example) or by NAMEDCNT being greater than one (shared names, or
names actually from dimnames). */
if ((VARIANT_KIND(variant) == VARIANT_QUERY_UNSHARED_SUBSET
|| VARIANT_KIND(variant) == VARIANT_FAST_SUB)
&& !NAMEDCNT_GT_1(obj) && !NAMEDCNT_GT_1(nms)
&& isVector(obj))
R_variant_result = 1;
return nms;
}
/* Implements dimnames(obj) <- dn. SPECIAL, so can handle gradient for obj. */
static SEXP do_dimnamesgets
(SEXP call, SEXP op, SEXP args, SEXP env, int variant)
{
SEXP ans;
PROTECT (args = variant & VARIANT_GRADIENT
? evalList_gradient (args, env, 0, 1, 0)
: evalList (args, env));
checkArity(op, args);
check1arg_x (args, call);
if (DispatchOrEval(call, op, "dimnames<-", args, env, &ans, 0, 1, 0)) {
UNPROTECT(1);
return(ans);
}
if (NAMEDCNT_GT_1(CAR(args)))
SETCAR(args, dup_top_level(CAR(args)));
setAttrib(CAR(args), R_DimNamesSymbol, CADR(args));
if (HAS_GRADIENT_IN_CELL(args)) {
R_gradient = GRADIENT_IN_CELL(args);
R_variant_result = VARIANT_GRADIENT_FLAG;
}
UNPROTECT(1);
return CAR(args);
}
static SEXP dimnamesgets1(SEXP val1)
{
SEXP this2;
if (LENGTH(val1) == 0) return R_NilValue;
/* if (isObject(val1)) dispatch on as.character.foo, but we don't
have the context at this point to do so */
if (inherits_CHAR (val1, R_factor_CHARSXP)) /* mimic as.character.factor */
return asCharacterFactor(val1);
if (!isString(val1)) { /* mimic as.character.default */
PROTECT(this2 = coerceVector(val1, STRSXP));
SET_ATTRIB(this2, R_NilValue);
SET_OBJECT(this2, 0);
UNPROTECT(1);
return this2;
}
return val1;
}
SEXP dimnamesgets(SEXP vec, SEXP val)
{
SEXP dims, top, newval;
int i, k;
PROTECT2(vec,val);
if (!isArray(vec) && !isList(vec))
error(_("'dimnames' applied to non-array"));
/* This is probably overkill, but you never know; */
/* there may be old pair-lists out there */
/* There are, when this gets used as names<- for 1-d arrays */
if (!isPairList(val) && !isNewList(val))
error(_("'dimnames' must be a list"));
dims = getDimAttrib(vec);
if ((k = LENGTH(dims)) < length(val))
error(_("length of 'dimnames' [%d] must match that of 'dims' [%d]"),
length(val), k);
if (length(val) == 0) {
removeAttrib(vec, R_DimNamesSymbol);
UNPROTECT(2);
return vec;
}
/* Old list to new list */
if (isList(val)) {
newval = allocVector(VECSXP, k);
for (i = 0; i < k; i++) {
SET_VECTOR_ELT(newval, i, CAR(val));
val = CDR(val);
}
UNPROTECT_PROTECT(val = newval);
}
if (length(val) > 0 && length(val) < k) {
newval = lengthgets(val, k);
UNPROTECT_PROTECT(val = newval);
}
if (k != length(val))
error(_("length of 'dimnames' [%d] must match that of 'dims' [%d]"),
length(val), k);
for (i = 0; i < k; i++) {
SEXP _this = VECTOR_ELT(val, i);
if (_this != R_NilValue) {
if (!isVector(_this))
error(_("invalid type (%s) for 'dimnames' (must be a vector)"),
type2char(TYPEOF(_this)));
if (INTEGER(dims)[i] != LENGTH(_this) && LENGTH(_this) != 0)
error(_("length of 'dimnames' [%d] not equal to array extent"),
i+1);
SET_VECTOR_ELT(val, i, dimnamesgets1(_this));
}
}
installAttrib(vec, R_DimNamesSymbol, val);
if (isList(vec) && k == 1) {
top = VECTOR_ELT(val, 0);
i = 0;
for (val = vec; !isNull(val); val = CDR(val))
SET_TAG(val, install_translated (STRING_ELT(top,i++)));
}
UNPROTECT(2);
return vec;
}
static SEXP do_dimnames(SEXP call, SEXP op, SEXP args, SEXP env)
{
SEXP ans;
checkArity(op, args);
check1arg_x (args, call);
if (DispatchOrEval(call, op, "dimnames", args, env, &ans, 0, 1, 0))
return(ans);
PROTECT(args = ans);
ans = getAttrib(CAR(args), R_DimNamesSymbol);
UNPROTECT(1);
return ans;
}
static SEXP do_fast_dim (SEXP call, SEXP op, SEXP arg, SEXP env, int variant)
{
return getDimAttrib(arg);
}
static SEXP do_dim(SEXP call, SEXP op, SEXP args, SEXP env, int variant)
{
SEXP ans;
checkArity(op, args);
check1arg_x (args, call);
if (DispatchOrEval(call, op, "dim", args, env, &ans, 0, 1, variant))
return(ans);
return do_fast_dim (call, op, CAR(args), env, variant);
}
/* Implements dim(obj) <- dims. SPECIAL, so can handle gradient for obj. */
static SEXP do_dimgets(SEXP call, SEXP op, SEXP args, SEXP env, int variant)
{
SEXP ans, x;
PROTECT (args = variant & VARIANT_GRADIENT
? evalList_gradient (args, env, 0, 1, 0)
: evalList (args, env));
checkArity(op, args);
if (DispatchOrEval(call, op, "dim<-", args, env, &ans, 0, 1, 0)) {
UNPROTECT(1);
return ans;
}
x = CAR(args);
/* Avoid duplication if setting to NULL when already NULL */
if (CADR(args) == R_NilValue) {
SEXP s;
for (s = ATTRIB(x); s != R_NilValue; s = CDR(s))
if (TAG(s) == R_DimSymbol || TAG(s) == R_NamesSymbol) break;
if (s == R_NilValue)
goto ret;
}
if (NAMEDCNT_GT_1(x))
SETCAR(args, x = dup_top_level(x));
setAttrib(x, R_DimSymbol, CADR(args));
setAttrib(x, R_NamesSymbol, R_NilValue);
ret:
if (HAS_GRADIENT_IN_CELL(args)) {
R_gradient = GRADIENT_IN_CELL(args);
R_variant_result = VARIANT_GRADIENT_FLAG;
}
UNPROTECT(1);
return x;
}
SEXP dimgets(SEXP vec, SEXP val)
{
int len, ndim, i, total;
PROTECT2(vec,val);
if ((!isVector(vec) && !isList(vec)))
error(_("invalid first argument"));
if (!isVector(val) && !isList(val))
error(_("invalid second argument"));
val = coerceVector(val, INTSXP);
UNPROTECT_PROTECT(val);
len = length(vec);
ndim = length(val);
if (ndim == 0)
error(_("length-0 dimension vector is invalid"));
total = 1;
for (i = 0; i < ndim; i++) {
/* need this test first as NA_INTEGER is < 0 */
if (INTEGER(val)[i] == NA_INTEGER)
error(_("the dims contain missing values"));
if (INTEGER(val)[i] < 0)
error(_("the dims contain negative values"));
total *= INTEGER(val)[i];
}
if (total != len)
error(_("dims [product %d] do not match the length of object [%d]"), total, len);
removeAttrib(vec, R_DimNamesSymbol);
installAttrib(vec, R_DimSymbol, val);
UNPROTECT(2);
return vec;
}
static SEXP do_attributes(SEXP call, SEXP op, SEXP args, SEXP env)
{
SEXP attrs, names, namesattr, value;
int nvalues;
checkArity(op, args);
check1arg_x (args, call);
namesattr = R_NilValue;
attrs = ATTRIB(CAR(args));
nvalues = length(attrs);
if (isList(CAR(args))) {
namesattr = getNamesAttrib(CAR(args));
if (namesattr != R_NilValue) {
SET_NAMEDCNT_MAX(namesattr);
nvalues++;
}
}
/* FIXME */
if (nvalues <= 0)
return R_NilValue;
/* FIXME */
PROTECT(namesattr);
PROTECT(value = allocVector(VECSXP, nvalues));
PROTECT(names = allocVector(STRSXP, nvalues));
nvalues = 0;
if (namesattr != R_NilValue) {
SET_VECTOR_ELT(value, nvalues, namesattr);
INC_NAMEDCNT(namesattr);
SET_STRING_ELT(names, nvalues, PRINTNAME(R_NamesSymbol));
nvalues++;
}
while (attrs != R_NilValue) {
/* treat R_RowNamesSymbol specially */
if (TAG(attrs) == R_RowNamesSymbol) {
SEXP rn = getAttrib (CAR(args), R_RowNamesSymbol);
SET_VECTOR_ELT(value, nvalues, rn);
INC_NAMEDCNT(rn);
}
else {
SET_VECTOR_ELT (value, nvalues, CAR(attrs));
INC_NAMEDCNT(CAR(attrs));
}
if (TAG(attrs) == R_NilValue)
SET_STRING_ELT_BLANK(names, nvalues);
else
SET_STRING_ELT(names, nvalues, PRINTNAME(TAG(attrs)));
attrs = CDR(attrs);
nvalues++;
}
setAttrib(value, R_NamesSymbol, names);
UNPROTECT(3);
return value;
}
static SEXP do_levelsgets(SEXP call, SEXP op, SEXP args, SEXP env)
{
SEXP ans;
checkArity(op, args);
check1arg_x (args, call);
if (DispatchOrEval(call, op, "levels<-", args, env, &ans, 0, 1, 0))
/* calls, e.g., levels<-.factor() */
return(ans);
PROTECT(args = ans);
if(!isNull(CADR(args)) && any_duplicated(CADR(args), FALSE))
warningcall(call,
_("duplicated levels will not be allowed in factors anymore"));
/* TODO errorcall(call,
_("duplicated levels are not allowed in factors anymore")); */
if (NAMEDCNT_GT_1(CAR(args)))
SETCAR(args, dup_top_level(CAR(args)));
setAttrib(CAR(args), R_LevelsSymbol, CADR(args));
UNPROTECT(1);
return CAR(args);
}
/* attributes(object) <- attrs. SPECIAL so it can handle gradients for object */
static SEXP do_attributesgets (SEXP call, SEXP op, SEXP args, SEXP env,
int variant)
{
PROTECT (args = variant & VARIANT_GRADIENT
? evalList_gradient (args, env, 0, 1, 0)
: evalList (args, env));
/* NOTE: The following code ensures that when an attribute list
is attached to an object, that the "dim" attibute is always
brought to the front of the list. This ensures that when both
"dim" and "dimnames" are set that the "dim" is attached first. */
SEXP object, attrs, names = R_NilValue /* -Wall */;
int i, i0 = -1, nattrs;
/* Extract the arguments from the argument list */
checkArity(op, args);
check1arg_x (args, call);
object = CAR(args);
attrs = CADR(args);
/* Do checks before duplication */
if (!isNewList(attrs))
errorcall(call,_("attributes must be a list or NULL"));
nattrs = length(attrs);
if (nattrs > 0) {
names = getNamesAttrib(attrs);
if (names == R_NilValue)
errorcall(call,_("attributes must be named"));
for (i = 1; i < nattrs; i++) {
if (STRING_ELT(names, i) == R_NilValue ||
CHAR(STRING_ELT(names, i))[0] == '\0') { /* all ASCII tests */
errorcall(call,_("all attributes must have names [%d does not]"), i+1);
}
}
}
if (object == R_NilValue) {
if (attrs == R_NilValue) {
UNPROTECT(1);
return R_NilValue;
}
else
PROTECT(object = allocVector(VECSXP, 0));
} else {
/* Unlikely to have NAMED == 0 here.
As from R 2.7.0 we don't optimize NAMED == 1 _if_ we are
setting any attributes as an error later on would leave
'obj' changed */
if (NAMEDCNT_GT_1(object) || (NAMEDCNT_GT_0(object) && nattrs > 0))
object = dup_top_level(object);
PROTECT(object);
}
/* Empty the existing attribute list */
if (isList(object))
setAttrib(object, R_NamesSymbol, R_NilValue);
SET_ATTRIB(object, R_NilValue);
/* We have just removed the class, but might reset it later */
SET_OBJECT(object, 0);
/* Probably need to fix up S4 bit in other cases, but
definitely in this one */
if(nattrs == 0) UNSET_S4_OBJECT(object);
/* We do two passes through the attributes; the first
finding and transferring "dim" and the second
transferring the rest. This is to ensure that
"dim" occurs in the attribute list before "dimnames". */
if (nattrs > 0) {
for (i = 0; i < nattrs; i++) {
if (!strcmp(CHAR(STRING_ELT(names, i)), "dim")) {
i0 = i;
setAttrib(object, R_DimSymbol, VECTOR_ELT(attrs, i));
break;
}
}
for (i = 0; i < nattrs; i++) {
if (i == i0) continue;
setAttrib(object, install_translated (STRING_ELT(names,i)),
VECTOR_ELT(attrs, i));
}
}
if (HAS_GRADIENT_IN_CELL(args)) {
R_gradient = GRADIENT_IN_CELL(args);
R_variant_result = VARIANT_GRADIENT_FLAG;
}
UNPROTECT(2);
return object;
}
/* This code replaces an R function defined as
attr <- function (x, which)
{
if (!is.character(which))
stop("attribute name must be of mode character")
if (length(which) != 1)
stop("exactly one attribute name must be given")
attributes(x)[[which]]
}
The R functions was being called very often and replacing it by
something more efficient made a noticeable difference on several
benchmarks. There is still some inefficiency since using getAttrib
means the attributes list will be searched twice, but this seems
fairly minor. LT */
static SEXP do_attr(SEXP call, SEXP op, SEXP args, SEXP env)
{
SEXP argList, s, t, tag = R_NilValue, alist, ans;
const char *str;
size_t n;
int nargs = length(args), exact = 0;
enum { NONE, PARTIAL, PARTIAL2, FULL } match = NONE;
static const char * const ap[3] = { "x", "which", "exact" };
if (nargs < 2 || nargs > 3)
errorcall(call, "either 2 or 3 arguments are required");
/* argument matching */
argList = matchArgs_strings (ap, 3, args, call);
PROTECT(argList);
s = CAR(argList);
t = CADR(argList);
if (!isString(t))
errorcall(call, _("'which' must be of mode character"));
if (length(t) != 1)
errorcall(call, _("exactly one attribute 'which' must be given"));
if(nargs == 3) {
exact = asLogical(CADDR(args));
if(exact == NA_LOGICAL) exact = 0;
}
if(STRING_ELT(t, 0) == NA_STRING) {
UNPROTECT(1);
return R_NilValue;
}
str = translateChar(STRING_ELT(t, 0));
n = strlen(str);
/* try to find a match among the attributes list */
for (alist = ATTRIB(s); alist != R_NilValue; alist = CDR(alist)) {
SEXP tmp = TAG(alist);
const char *s = CHAR(PRINTNAME(tmp));
if (! strncmp(s, str, n)) {
if (strlen(s) == n) {
tag = tmp;
match = FULL;
break;
}
else if (match == PARTIAL || match == PARTIAL2) {
/* this match is partial and we already have a partial match,
so the query is ambiguous and we will return R_NilValue
unless a full match comes up.
*/
match = PARTIAL2;
} else {
tag = tmp;
match = PARTIAL;
}
}
}
if (match == PARTIAL2) {
UNPROTECT(1);
return R_NilValue;
}
/* Unless a full match has been found, check for a "names" attribute.
This is stored via TAGs on pairlists, and via rownames on 1D arrays.
*/
if (match != FULL && strncmp("names", str, n) == 0) {
if (strlen("names") == n) {
/* we have a full match on "names", if there is such an
attribute */
tag = R_NamesSymbol;
match = FULL;
}
else if (match == NONE && !exact) {
/* no match on other attributes and a possible
partial match on "names" */
tag = R_NamesSymbol;
PROTECT(t = getAttrib(s, tag));
if(t != R_NilValue && R_warn_partial_match_attr)
warningcall(call, _("partial match of '%s' to '%s'"), str,
CHAR(PRINTNAME(tag)));
UNPROTECT(2);
return t;
}
else if (match == PARTIAL && strcmp(CHAR(PRINTNAME(tag)), "names")) {
/* There is a possible partial match on "names" and on another
attribute. If there really is a "names" attribute, then the
query is ambiguous and we return R_NilValue. If there is no
"names" attribute, then the partially matched one, which is
the current value of tag, can be used. */
if (getNamesAttrib(s) != R_NilValue) {
UNPROTECT(1);
return R_NilValue;
}
}
}
if (match == NONE || (exact && match != FULL)) {
UNPROTECT(1);
return R_NilValue;
}
if (match == PARTIAL && R_warn_partial_match_attr)
warningcall(call, _("partial match of '%s' to '%s'"), str,
CHAR(PRINTNAME(tag)));
ans = getAttrib(s, tag);
UNPROTECT(1);
return ans;
}
static void check_slot_assign(SEXP obj, SEXP input, SEXP value, SEXP env)
{
SEXP
valueClass = PROTECT(R_data_class(value, FALSE)),
objClass = PROTECT(R_data_class(obj, FALSE));
static SEXP checkAt = R_NoObject;
/* 'methods' may *not* be in search() ==> do as if calling
methods::checkAtAssignment(..) */
if(!isMethodsDispatchOn()) { // needed?
SEXP e = PROTECT(lang1(install("initMethodDispatch")));
eval(e, R_MethodsNamespace); // only works with methods loaded
UNPROTECT(1);
}
if(checkAt == R_NoObject)
checkAt = findFun(install("checkAtAssignment"), R_MethodsNamespace);
SEXP e = PROTECT(lang4(checkAt, objClass, input, valueClass));
eval(e, env);
UNPROTECT(3);
}
/* Implements attr(obj, which = "<name>") <- value.
SPECIAL, so can handle gradient for obj. */
static SEXP do_attrgets(SEXP call, SEXP op, SEXP args, SEXP env, int variant)
{
SEXP obj, name;
PROTECT (args = variant & VARIANT_GRADIENT
? evalList_gradient (args, env, 0, 1, 0)
: evalList (args, env));
checkArity(op, args);
obj = CAR(args);
if (NAMEDCNT_GT_1(obj))
PROTECT(obj = dup_top_level(obj));
else
PROTECT(obj);
/* Argument matching - does not actually make much sense to do this! */
static const char * const ap[3] = { "x", "which", "value" };
SEXP argList = matchArgs_strings (ap, 3, args, call);
PROTECT(argList);
name = CADR(argList);
if (!isValidString(name) || STRING_ELT(name, 0) == NA_STRING)
errorcall(call,_("'name' must be non-null character string"));
/* TODO? if (isFactor(obj) && !strcmp(asChar(name), "levels"))
* --- if(any_duplicated(CADDR(args)))
* error(.....)
*/
setAttrib(obj, name, CADDR(args));
if (HAS_GRADIENT_IN_CELL(args)) {
R_gradient = GRADIENT_IN_CELL(args);
R_variant_result = VARIANT_GRADIENT_FLAG;
}
UNPROTECT(3);
return obj;
}
/* Implements obj @ <name> <- value (SPECIAL)
Code adapted from R-3.0.0 */
static SEXP do_ATgets(SEXP call, SEXP op, SEXP args, SEXP env, int variant)
{
SEXP obj, name, input, ans, value;
PROTECT(input = allocVector(STRSXP, 1));
name = CADR(args);
if (TYPEOF(name) == PROMSXP)
name = PRCODE(name);
if (isSymbol(name))
SET_STRING_ELT(input, 0, PRINTNAME(name));
else if(isString(name) )
SET_STRING_ELT(input, 0, STRING_ELT(name, 0));
else {
error(_("invalid type '%s' for slot name"), type2char(TYPEOF(name)));
return R_NilValue; /*-Wall*/
}
/* replace the second argument with a string */
SETCADR(args, input);
UNPROTECT(1); /* 'input' is now protected */
if (DispatchOrEval(call, op, "@<-", args, env, &ans, 0, 0, variant))
return(ans);
PROTECT(obj = CAR(ans));
PROTECT(value = CADDR(ans));
check_slot_assign(obj, input, value, env);
obj = R_do_slot_assign(obj, input, value);
SET_NAMEDCNT_0(obj); /* The standard kludge for subassign primitives */
R_Visible = TRUE;
UNPROTECT(2);
return obj;
}
/* Implements `@internal`(obj,name) <- value
** for internal use only, no validity check **
*/
static SEXP do_ATinternalgets(SEXP call, SEXP op, SEXP args, SEXP env)
{
SEXP obj, name, input, value;
PROTECT(obj = CAR(args));
PROTECT(value = CADDR(args));
PROTECT(input = allocVector(STRSXP, 1));
name = CADR(args);
if (TYPEOF(name) == PROMSXP)
name = PRCODE(name);
if (isSymbol(name))
SET_STRING_ELT(input, 0, PRINTNAME(name));
else if(isString(name) )
SET_STRING_ELT(input, 0, STRING_ELT(name, 0));
else {
error(_("invalid type '%s' for slot name"),
type2char(TYPEOF(name)));
return R_NilValue; /*-Wall*/
}
obj = R_do_slot_assign(obj, input, value);
SET_NAMEDCNT_0(obj); /* The standard kludge for subassign primitives */
UNPROTECT(3);
return obj;
}
/* These provide useful shortcuts which give access to */
/* the dimnames for matrices and arrays in a standard form. */
void GetMatrixDimnames(SEXP x, SEXP *rl, SEXP *cl,
const char **rn, const char **cn)
{
SEXP dimnames = getAttrib(x, R_DimNamesSymbol);
SEXP nn;
if (isNull(dimnames)) {
*rl = R_NilValue;
*cl = R_NilValue;
*rn = NULL;
*cn = NULL;
}
else {
*rl = VECTOR_ELT(dimnames, 0);
*cl = VECTOR_ELT(dimnames, 1);
nn = getNamesAttrib(dimnames);
if (isNull(nn)) {
*rn = NULL;
*cn = NULL;
}
else {
*rn = translateChar(STRING_ELT(nn, 0));
*cn = translateChar(STRING_ELT(nn, 1));
}
}
}
SEXP GetArrayDimnames(SEXP x)
{
return getAttrib(x, R_DimNamesSymbol);
}
/* the code to manage slots in formal classes. These are attributes,
but without partial matching and enforcing legal slot names (it's
an error to get a slot that doesn't exist. */
static SEXP pseudo_NULL = 0;
static SEXP s_dot_Data;
static SEXP s_getDataPart;
static SEXP s_setDataPart;
static void init_slot_handling(void) {
s_dot_Data = install(".Data");
s_dot_S3Class = install(".S3Class");
s_getDataPart = install("getDataPart");
s_setDataPart = install("setDataPart");
/* create and preserve an object that is NOT R_NilValue, and is used
to represent slots that are NULL (which an attribute can not
be). The point is not just to store NULL as a slot, but also to
provide a check on invalid slot names (see get_slot below).
The object has to be a symbol if we're going to check identity by
just looking at referential equality. */
pseudo_NULL = install("\001NULL\001");
}
static SEXP data_part(SEXP obj) {
SEXP e, val;
if(!s_getDataPart)
init_slot_handling();
PROTECT(e = allocVector(LANGSXP, 2));
SETCAR(e, s_getDataPart);
val = CDR(e);
SETCAR(val, obj);
val = eval(e, R_MethodsNamespace);
UNSET_S4_OBJECT(val); /* data part must be base vector */
UNPROTECT(1);
return(val);
}
static SEXP set_data_part(SEXP obj, SEXP rhs) {
SEXP e, val;
if(!s_setDataPart)
init_slot_handling();
PROTECT(e = allocVector(LANGSXP, 3));
SETCAR(e, s_setDataPart);
val = CDR(e);
SETCAR(val, obj);
val = CDR(val);
SETCAR(val, rhs);
val = eval(e, R_MethodsNamespace);
SET_S4_OBJECT(val);
UNPROTECT(1);
return(val);
}
SEXP S3Class(SEXP obj)
{
if(!s_dot_S3Class) init_slot_handling();
return getAttrib(obj, s_dot_S3Class);
}
/* Slots are stored as attributes to
provide some back-compatibility
*/
/**
* R_has_slot() : a C-level test if a obj@<name> is available;
* as R_do_slot() gives an error when there's no such slot.
*/
int R_has_slot(SEXP obj, SEXP name) {
#define R_SLOT_INIT \
if(!(isSymbol(name) || (isString(name) && LENGTH(name) == 1))) \
error(_("invalid type or length for slot name")); \
if(!s_dot_Data) \
init_slot_handling(); \
if(isString(name)) name = installChar(STRING_ELT(name, 0))
R_SLOT_INIT;
if(name == s_dot_Data && TYPEOF(obj) != S4SXP)
return(1);
/* else */
return(getAttrib(obj, name) != R_NilValue);
}
/* The @ operator, and its assignment form. Processed much like $
(see do_subset3) but without S3-style methods.
*/
/* Slot getting for the 'methods' package. In pqR, the 'method'
package has been changed to call R_do_slot via .Internal, in order
to bypass the safeguarding of .Call argument modification that is
now done (to avoid this overhead), and because it also makes more
sense given the dependence of 'methods' on the interpreter.
R_do_slot can be called with .Call, which is done by the 'Matrix'
package via GET_SLOT (defined in Rdefines.h, but not mentioned in
the manuals). */
static SEXP do_get_slot (SEXP call, SEXP op, SEXP args, SEXP env)
{
checkArity (op, args);
return R_do_slot (CAR(args), CADR(args));
}
SEXP R_do_slot(SEXP obj, SEXP name) {
R_SLOT_INIT;
if(name == s_dot_Data)
return data_part(obj);
else {
SEXP value = getAttrib(obj, name);
if(value == R_NilValue) {
SEXP input = name, classString;
if(name == s_dot_S3Class) /* defaults to class(obj) */
return R_data_class(obj, FALSE);
else if(name == R_NamesSymbol &&
TYPEOF(obj) == VECSXP) /* needed for namedList class */
return value;
if(isSymbol(name) ) {
PROTECT(input = ScalarString(PRINTNAME(name)));
classString = getClassAttrib(obj);
if(isNull(classString))
error(_("cannot get a slot (\"%s\") from an object of type \"%s\""),
translateChar(asChar(input)),
CHAR(type2str(TYPEOF(obj))));
UNPROTECT(1);
}
else
classString = R_NilValue; /* make sure it is initialized */
/* not there. But since even NULL really does get stored, this
implies that there is no slot of this name. Or somebody
screwed up by using attr(..) <- NULL */
error(_("no slot of name \"%s\" for this object of class \"%s\""),
translateChar(asChar(input)),
translateChar(asChar(classString)));
}
else if(value == pseudo_NULL)
value = R_NilValue;
return value;
}
}
#undef R_SLOT_INIT
/* Slot setting for the 'methods' package. In pqR, the 'method'
package has been changed to call do_set_slot via .Internal, in
order to bypass the safeguarding of .Call argument modification
that is now done (to avoid this overhead), and because it also
makes more sense given the dependence of 'methods' on the interpreter.
R_do_slot_assign can be called with .Call, which is done by the
'Matrix' package, often via SET_SLOT (defined in Rdefines.h, but
not mentioned in the manuals). */
static SEXP do_set_slot (SEXP call, SEXP op, SEXP args, SEXP env)
{
checkArity (op, args);
return R_do_slot_assign (CAR(args), CADR(args), CADDR(args));
}
SEXP R_do_slot_assign(SEXP obj, SEXP name, SEXP value)
{
if (isNull(obj)) /* cannot use !IS_S4_OBJECT(obj), because
slot(obj, name, check=FALSE) <- value
must work on "pre-objects", currently only in
makePrototypeFromClassDef() */
error(_("attempt to set slot on NULL object"));
PROTECT(value);
PROTECT(obj);
/* Ensure that name is a symbol */
if(isString(name) && LENGTH(name) == 1)
name = install_translated (STRING_ELT(name,0));
if(TYPEOF(name) == CHARSXP)
name = install_translated (name);
if(!isSymbol(name) )
error(_("invalid type or length for slot name"));
/* The duplication below *should* be what is right to do, but
it is disabled because some packages (eg, Matrix 1.0-6) cheat
by relying on a call of R_set_slot in C code modifying its
first argument in place, even if it appears to be shared.
Package "methods" did this as well in R-2.15.1, but has been
modified not to in pqR. */
if (FALSE && /* disabled */ NAMEDCNT_GT_1(obj)) {
obj = dup_top_level(obj);
UNPROTECT_PROTECT(obj);
}
if(!s_dot_Data) /* initialize */
init_slot_handling();
if(name == s_dot_Data) { /* special handling */
obj = set_data_part(obj, value);
} else {
if (isNull(value)) /* Slots, but not attributes, can be NULL.*/
value = pseudo_NULL; /* Store a special symbol instead. */
/* simplified version of setAttrib(obj, name, value);
here we do *not* treat "names", "dimnames", "dim", .. specially : */
PROTECT(name);
value = attr_val_dup (obj, name, value);
UNPROTECT(1);
installAttrib(obj, name, value);
}
UNPROTECT(2);
return obj;
}
static SEXP do_AT(SEXP call, SEXP op, SEXP args, SEXP env, int variant)
{
SEXP nlist, object, ans, klass;
if(!isMethodsDispatchOn())
error(_("formal classes cannot be used without the methods package"));
nlist = CADR(args);
if (TYPEOF(nlist) == PROMSXP)
nlist = PRCODE(nlist);
/* Do some checks here -- repeated in R_do_slot, but on repeat the
* test expression should kick out on the first element. */
if(!(isSymbol(nlist) || (isString(nlist) && LENGTH(nlist) == 1)))
error(_("invalid type or length for slot name"));
if(isString(nlist)) nlist = install_translated (STRING_ELT(nlist,0));
PROTECT(object = eval(CAR(args), env));
if(!s_dot_Data) init_slot_handling();
if(nlist != s_dot_Data && !IS_S4_OBJECT(object)) {
klass = getClassAttrib(object);
if(length(klass) == 0)
error(_("trying to get slot \"%s\" from an object of a basic class (\"%s\") with no slots"),
CHAR(PRINTNAME(nlist)),
CHAR(STRING_ELT(R_data_class(object, FALSE), 0)));
else
error(_("trying to get slot \"%s\" from an object (class \"%s\") that is not an S4 object "),
CHAR(PRINTNAME(nlist)),
translateChar(STRING_ELT(klass, 0)));
}
ans = R_do_slot(object, nlist);
UNPROTECT(1);
R_Visible = TRUE;
return ans;
}
/* Return a suitable S3 object (OK, the name of the routine comes from
an earlier version and isn't quite accurate.) If there is a .S3Class
slot convert to that S3 class.
Otherwise, unless type == S4SXP, look for a .Data or .xData slot. The
value of type controls what's wanted. If it is S4SXP, then ONLY
.S3class is used. If it is ANYSXP, don't check except that automatic
conversion from the current type only applies for classes that extend
one of the basic types (i.e., not S4SXP). For all other types, the
recovered data must match the type.
Because S3 objects can't have type S4SXP, .S3Class slot is not searched
for in that type object, unless ONLY that class is wanted.
(Obviously, this is another routine that has accumulated barnacles and
should at some time be broken into separate parts.)
*/
SEXP attribute_hidden
R_getS4DataSlot(SEXP obj, SEXPTYPE type)
{
static SEXP s_xData, s_dotData; SEXP value = R_NilValue;
if(!s_xData) {
s_xData = install(".xData");
s_dotData = install(".Data");
}
if(TYPEOF(obj) != S4SXP || type == S4SXP) {
SEXP s3class = S3Class(obj);
if(s3class == R_NilValue && type == S4SXP)
return R_NilValue;
PROTECT(s3class);
if(NAMEDCNT_GT_0(obj)) obj = duplicate(obj);
UNPROTECT(1);
if(s3class != R_NilValue) {/* replace class with S3 class */
setAttrib(obj, R_ClassSymbol, s3class);
setAttrib(obj, s_dot_S3Class, R_NilValue); /* not in the S3 class */
}
else { /* to avoid inf. recursion, must unset class attribute */
setAttrib(obj, R_ClassSymbol, R_NilValue);
}
UNSET_S4_OBJECT(obj);
if(type == S4SXP)
return obj;
value = obj;
}
else
value = getAttrib(obj, s_dotData);
if(value == R_NilValue)
value = getAttrib(obj, s_xData);
/* the mechanism for extending abnormal types. In the future, would b
good to consolidate under the ".Data" slot, but this has
been used to mean S4 objects with non-S4 type, so for now
a secondary slot name, ".xData" is used to avoid confusion
*/ if(value != R_NilValue &&
(type == ANYSXP || type == TYPEOF(value)))
return value;
else
return R_NilValue;
}
/* FUNTAB entries defined in this source file. See names.c for documentation. */
attribute_hidden FUNTAB R_FunTab_attrib[] =
{
/* printname c-entry offset eval arity pp-kind precedence rightassoc */
{"class", R_do_data_class,0, 1, 1, {PP_FUNCALL, PREC_FN, 0}},
{".cache_class",R_do_data_class,1, 1, 2, {PP_FUNCALL, PREC_FN, 0}},
{"comment", do_comment, 0, 11, 1, {PP_FUNCALL, PREC_FN, 0}},
{"comment<-", do_commentgets, 0, 11, 2, {PP_FUNCALL, PREC_LEFT, 1}},
{"oldClass", do_oldclass, 0, 1, 1, {PP_FUNCALL, PREC_FN, 0}},
{"oldClass<-", do_oldclassgets,0, 1000, 2, {PP_FUNCALL, PREC_LEFT, 1}},
{"names", do_names, 0, 1001, 1, {PP_FUNCALL, PREC_FN, 0}},
{"names<-", do_namesgets, 0, 1000, 2, {PP_FUNCALL, PREC_LEFT, 1}},
{"dimnames", do_dimnames, 0, 1, 1, {PP_FUNCALL, PREC_FN, 0}},
{"dimnames<-", do_dimnamesgets,0, 1000, 2, {PP_FUNCALL, PREC_LEFT, 1}},
{"dim", do_dim, 0, 1001, 1, {PP_FUNCALL, PREC_FN, 0}},
{"dim<-", do_dimgets, 0, 1000, 2, {PP_FUNCALL, PREC_LEFT, 1}},
{"attributes", do_attributes, 0, 1, 1, {PP_FUNCALL, PREC_FN, 0}},
{"attributes<-",do_attributesgets,0, 1000, 2, {PP_FUNCALL, PREC_LEFT, 1}},
{"attr", do_attr, 0, 1, -1, {PP_FUNCALL, PREC_FN, 0}},
{"attr<-", do_attrgets, 0, 1000, 3, {PP_FUNCALL, PREC_LEFT, 1}},
{"levels<-", do_levelsgets, 0, 1, 2, {PP_FUNCALL, PREC_LEFT, 1}},
{"@", do_AT, 0, 1000, 2, {PP_DOLLAR, PREC_DOLLAR, 0}},
{"@<-", do_ATgets, 0, 1000, 3, {PP_SUBASS, PREC_LEFT, 1}},
{"@internal<-", do_ATinternalgets, 0, 1, 3, {PP_SUBASS, PREC_LEFT, 1}},
{"set_slot.internal", do_set_slot, 0, 11, 3, {PP_FUNCALL, PREC_FN, }},
{"get_slot.internal", do_get_slot, 0, 11, 2, {PP_FUNCALL, PREC_FN, }},
{NULL, NULL, 0, 0, 0, {PP_INVALID, PREC_FN, 0}}
};
/* Fast built-in functions in this file. See names.c for documentation */
attribute_hidden FASTFUNTAB R_FastFunTab_attrib[] = {
/*slow func fast func, code or -1 dsptch variant */
{ do_dim, do_fast_dim, -1, 1, VARIANT_PENDING_OK },
{ 0, 0, 0, 0, 0 }
};
| {
"pile_set_name": "Github"
} |
/*!
* jQuery UI Menu 1.10.3
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Menu#theming
*/
.ui-menu {
list-style: none;
padding: 2px;
margin: 0;
display: block;
outline: none;
}
.ui-menu .ui-menu {
margin-top: -3px;
position: absolute;
}
.ui-menu .ui-menu-item {
margin: 0;
padding: 0;
width: 100%;
/* support: IE10, see #8844 */
list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);
}
.ui-menu .ui-menu-divider {
margin: 5px -2px 5px -2px;
height: 0;
font-size: 0;
line-height: 0;
border-width: 1px 0 0 0;
}
.ui-menu .ui-menu-item a {
text-decoration: none;
display: block;
padding: 2px .4em;
line-height: 1.5;
min-height: 0; /* support: IE7 */
font-weight: normal;
}
.ui-menu .ui-menu-item a.ui-state-focus,
.ui-menu .ui-menu-item a.ui-state-active {
font-weight: normal;
margin: -1px;
}
.ui-menu .ui-state-disabled {
font-weight: normal;
margin: .4em 0 .2em;
line-height: 1.5;
}
.ui-menu .ui-state-disabled a {
cursor: default;
}
/* icon support */
.ui-menu-icons {
position: relative;
}
.ui-menu-icons .ui-menu-item a {
position: relative;
padding-left: 2em;
}
/* left-aligned */
.ui-menu .ui-icon {
position: absolute;
top: .2em;
left: .2em;
}
/* right-aligned */
.ui-menu .ui-menu-icon {
position: static;
float: right;
}
| {
"pile_set_name": "Github"
} |
<div class="summary">
<g:hiddenField name="activityId"/>
<p><g:message code="autoreply.info"/></p>
<p><g:message code="autoreply.info.warning"/></p>
<p><g:message code="autoreply.info.note"/></p>
</div>
| {
"pile_set_name": "Github"
} |
🔵 K8s介绍
🔶 Docker:
是一个开源的引擎,
可以轻松的为任何应用创建一个轻量级的、可移植的、自给自足的容器
🔶 Kubernetes:
是google开源的容器集群管理系统,
提供应用部署、维护、扩展机制等功能,
利用kubernetes能方便管理跨集群运行容器化的应用,
简称:k8s(k与s之间有8个字母)
🔶 Etcd:
由CoreOS开发并维护的一个高可用的键值存储系统,
主要用于共享配置和服务发现
🔶 Flannel:
Flannel是 CoreOS 团队针对 Kubernetes 设计的一个
覆盖网络(Overlay Network)工具,
其目的在于帮助每一个使用 Kuberentes 的主机拥有一个完整的子网
🔵 硬件环境
虚拟机 CentOS7 ➜ k8s 主节点
虚拟机 CentOS7 ➜ k8s 从节点1, 从节点2
由三台服务器(CentOS 7.0)组成master集群,命名为m1,m2,m3,ip用m1 m2 m3来代替
🔵 自动搭建...
https://segmentfault.com/a/1190000005345466
🔵 参考
★★★★★ 官方文档(EN) https://kubernetes.io/
★★★★ 中文社区 https://www.kubernetes.org.cn/
🔵 K8S 简介
Kubernetes这个名字源自希腊语,意思是“舵手”,也是“管理者”,“治理者”等词的源头。
k8s是Kubernetes的简称. 用数字『8』替代中间的8个字母『ubernete』
Kubernetes 是 Google 开源的容器集群管理系统,其提供应用部署、维护、扩展机制等功能,
利用Kubernetes 能方便地管理跨机器运行容器化的应用。
如果你玩过Docker 就会知道想要给Docker 分配个固定IP也不是一个容易的事情.
而且每个Docker 默认是互相隔离的, 你要搭建集群. 需要把各个Docker 放到一个网络中.也需要花费不少心思!
用k8s 可以帮你解决这类问题! 极大的方便你管理! 如果你要和容器打交道,学这个真的非常有用的.
Kubernetes 可以在物理机或虚拟机上运行,且支持部署到 AWS,Azure,GCE 等多种公有云环境。
Kubernetes项目是Google在2014年启动的。Google 帮你踩了各种坑. 你只要用就好了!!!
Kubernetes构建在Google公司十几年的大规模高负载生产系统运维经验之上,同时结合了社区中各项最佳设计和实践。
🔵 K8S & OpenStack
OpenStack 是私有云/企业云. K8S 是容器集群管理系统.
两者一起使用 会有更好的效果.
在网络和存储方面 Openstack 比 k8s 更先进 更灵活.
k8s 专注于容器的编排, 它需要一整套基础设施资源.
K8s 本身不具备处理基础资源的能力.
全球趋势正转向容器, OpenStack 将被逐步淘汰.
🔸 Docker & Rocket
大家肯定知道Docker, 但是很少听说过Rocker.
CoreOS 是一家把Linux 容器化的创业公司. 最初为Docker 作出了巨大的贡献.
CoreOS 发现 Docker 在安全性、可组合性 等等不少方面存在缺陷.
也许是存在理念上的分歧, 所以CoreOS 自己推出了新的容器引擎: Rocket
从技术论坛的反应来看.不少人是看好Rocket 的!
至少有了竞争,对容器的发展绝对是好事.
CoreOS 在最近几年变得非常有名!
他们公司开源的 ETCD 组件被广泛用于分布式计算的前沿技术中.
k8s、Mesos 等等这些著名的项目都在使用ETCD!
容器加上分布式 将会革新我们的基础架构! 从根源上影响企业的工作方式.
对IT/运维也有了新的要求, 这激素 DevOps.
🔸 k8s 简介2
k8s 能在集群中管理不同主机上的容器!
k8s 提供了很多机制来进行应用的部署,调度,更新,维护,伸缩.
k8s 能主动管理容器! 保证集群的状态不断的符合用户的期望.
k8s 支持 Docker 和 Rocket
k8s 中, 所有的容器都运行在 pod 中.
一个机器能有多个 pod .
一个pod 容纳一个单独的容器; 或者容纳多个合作的容器.
pod 可以保证多个合作的容器 在同一个机器上. 这样就可以共享资源.
对于用户创建的每个pod, 系统会找一个健康运行 并且有足够的容量的机器! 然后启动容器.
如果容器启动失败, 容器会被kubelet 自动重启.
用户可以自己创建并管理pod, 一旦pod被创建好,系统会持续的监控它们的健康状态.也会健康pod所在的机器的健康状态.
如果一个pod 因为软件或者机器故障出现问题.
replication控制器会自动在健康的机器上创建一个新的pod,保证pod的高可用.
k8s 支持一种独特的网络模型.
k8s 不会动态分配端口,而是让用户随意指定.
k8s 给每个pod分配了一个IP地址.
每一个k8s中的资源 如pod 都是通过一个 URI来识别的!
🔸 创建Kubernetes集群
k8s 可以运行在多种平台!笔记本、服务器、各种云虚拟机...
如果你只是想试试k8s,那么用 基于Docker 的本地方案. 只能在单台机器上运行.
如果真要商业用. 那么就用托管服务, 也就是 Google AWS 这类的k8s集群服务.
GCE、AWS 都有现成的k8s 容器! 你只要运行就可以了.... 根本不用你安装..
由于国内的网络! 用Docker 你会疯的! 加上你自己的网速也不可能有服务器的网速.
还是强烈建议在GCE上搭建临时的k8s集群.
先不要急着创建k8s集群! 先来了解下基础知识会好很多!!
🔵 ETCD
etcd 是一个 k8s 组件.
是一个高可用的 键值存储系统
主要用于共享配置、服务发现.
灵感来自 zookeeper,所以功能和zookeeper也有点类似. 算得上是后期之秀.
分布式系统,如何管理节点的状态一直是个难题.
etcd 作为一个高可用强一致性的服务发现存储仓库. 渐渐流行.
云计算时代.
如何让服务快速透明的接入到集群中.
如何让共享配置信息快速被集群中的机器发现.
如何构建一套高可用 安全 易部署 以及响应快速的服务集群
etcd 就是解决这类问题的.
• 服务发现
在一个分布式集群中. 如何找到对方(服务)并建立连接.
• 消息发布/订阅
• 负载均衡
• 集群监控 / Leader 竞选
• ETCD vs Zookeeper
一致性协议: ETCD使用[Raft]协议, ZK使用ZAB(类PAXOS协议),前者容易理解,方便工程实现;
运维方面:ETCD方便运维,ZK难以运维;
项目活跃度:ETCD社区与开发活跃,ZK已经快死了;
API:ETCD提供HTTP+JSON, gRPC接口,跨平台跨语言,ZK需要使用其客户端;
访问安全方面:ETCD支持HTTPS访问,ZK在这方面缺失;
🔵 容器引擎
GCE 里面的 容器引擎是非常强大的!
GCE 的容器引擎就是基于 k8s 构建出来的!
GCE 的容器引擎有Google的顶尖工程师全面管理, 确保集群的高可用!高性能.
可伸缩--你自已调整集群资源; 如cpu、内存、甚至集群大小.
⦿ 混合组网
通过谷歌的云端VPN. 使得你的集群 和你本地网络共存!
GCE上的集群,就像你Mac 本地的集群一样用!
🔵 kubectl
kubectl 工具可以控制 k8s集群的管理器.
可以检查集群资源, 创建 删除组件等等功能.
🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸 GCE k8s 容器 🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸
k8s 的部署是最麻烦的! 也没太大必要去手动部署!
用GCE的话,有各种现成的云端启动器, 就是已经帮你搭建好的各种环境! 你只要开机就行了!
🔸 gcloud SDK
当然由于这个 k8s 是集群! 不是一个vps.
如果是单个vps. 你可以直接ssh进去.管理; 不同的vps 是相互隔离的!
但是这是集群! 集群里的电脑是要相互沟通的! 需要在一个网络下的!
所以, 要连接GCE 上的k8s集群 用的不是SSH. 而是需要在你本地电脑安装 gcloud SDK,
安装好这个后. 你就可以直接在本地操作GCE. 自然也能连到GCE里面的集群了!
有了SDK 你就可以把本地电脑 连到 GCE的集群里面!
各种操作就像在内网一样! 这个功能是非常重要的!!
🔸 Mac 安装 gcloud SDK
# 安裝 gcloud SDK
$ curl https://sdk.cloud.google.com | bash
🔸 安装 kubectl
上面的命令不会安装 kubectl 组件. 这个命令之后要用到的!
kubectl 是 SDK 的一个组件. 默认是不安装的.
去这个网站 https://cloud.google.com/sdk/docs/quickstart-mac-os-x
下载 google-cloud-sdk 的安装包并解压.
运行安装脚本 ./google-cloud-sdk/install.sh
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Components │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│ Status │ Name │ ID │ Size │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Not Installed │ App Engine Go Extensions │ app-engine-go │ 97.7 MiB │
│ Not Installed │ Cloud Bigtable Command Line Tool │ cbt │ 4.0 MiB │
│ Not Installed │ Cloud Bigtable Emulator │ bigtable │ 3.5 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool │ datalab │ < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator │ cloud-datastore-emulator │ 15.4 MiB │
│ Not Installed │ Cloud Datastore Emulator (Legacy) │ gcd-emulator │ 38.1 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator │ pubsub-emulator │ 33.2 MiB │
│ Not Installed │ Emulator Reverse Proxy │ emulator-reverse-proxy │ 14.5 MiB │
│ Not Installed │ Google Container Local Builder │ container-builder-local │ 3.7 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr │ 2.2 MiB │
│ Not Installed │ gcloud Alpha Commands │ alpha │ < 1 MiB │
│ Not Installed │ gcloud Beta Commands │ beta │ < 1 MiB │
│ Not Installed │ gcloud app Java Extensions │ app-engine-java │ 130.9 MiB │
│ Not Installed │ gcloud app PHP Extensions │ app-engine-php │ 21.9 MiB │
│ Not Installed │ gcloud app Python Extensions │ app-engine-python │ 6.3 MiB │
│ Not Installed │ kubectl │ kubectl │ 15.9 MiB │
│ Installed │ BigQuery Command Line Tool │ bq │ < 1 MiB │
│ Installed │ Cloud SDK Core Libraries │ core │ 6.8 MiB │
│ Installed │ Cloud Storage Command Line Tool │ gsutil │ 3.0 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
To install or remove components at your current SDK version [173.0.0], run:
$ gcloud components install COMPONENT_ID
$ gcloud components remove COMPONENT_ID
根据提示来 安装卸载额外组件.
我们要安装 kubectl 只要运行 gcloud components install kubectl
安装好 sdk. 以及 kubectl 后. 只要启动 k8s 集群. 就可以连接到k8s集群了.
🔸 创建 k8s 集群
GCE ➜ 启动器 ➜ Container Engine (容器引擎) ➜ 创建集群. 集群大小就是服务器数量!
🔸 连接 k8s 集群
GCE ➜ 容器集群 ➜ 点击集群右边的 连接 ➜ 跳出两行命令. 复制到Mac 本地运行
➜ 然后就可以在Mac本地 用浏览器访问 http://localhost:8001/ui ➜ 这个就是k8s的管理界面!!
🔵 使用
现在你就可以在 Mac 本地 用命令来操作k8s集群了!
🔸 ✘✘∙𝒗 Desktop kubectl get --all-namespaces services ➜ 查看您的集群.
NAMESPACE NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes 10.11.240.1 <none> 443/TCP 3h
kube-system default-http-backend 10.11.250.28 <nodes> 80:32023/TCP 3h
kube-system heapster 10.11.250.59 <none> 80/TCP 3h
kube-system kube-dns 10.11.240.10 <none> 53/UDP,53/TCP 3h
kube-system kubernetes-dashboard 10.11.254.84 <none> 80/TCP 3h
🔸 ✘✘∙𝒗 Desktop kubectl get --all-namespaces pods ➜ 查看集群启动时创建的 pod
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system event-exporter-1421584133-3np41 2/2 Running 0 3h
kube-system fluentd-gcp-v2.0-6796q 2/2 Running 0 3h
kube-system fluentd-gcp-v2.0-rv450 2/2 Running 0 3h
kube-system fluentd-gcp-v2.0-z506s 2/2 Running 0 3h
kube-system heapster-v1.4.2-3460574887-vfq3s 3/3 Running 0 3h
kube-system kube-dns-3468831164-5s4t9 3/3 Running 0 3h
kube-system kube-dns-3468831164-b451h 3/3 Running 0 3h
kube-system kube-dns-autoscaler-244676396-ndbzl 1/1 Running 0 3h
kube-system kube-proxy-gke-cluster-1-default-pool-ad6c7f55-59kb 1/1 Running 0 3h
kube-system kube-proxy-gke-cluster-1-default-pool-ad6c7f55-6qt6 1/1 Running 0 3h
kube-system kube-proxy-gke-cluster-1-default-pool-ad6c7f55-kghl 1/1 Running 0 3h
kube-system kubernetes-dashboard-1265873680-bsnt0 1/1 Running 0 3h
kube-system l7-default-backend-3623108927-ctzrz 1/1 Running 0 3h
🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸
在GCE 上运行k8s 能让你对k8s有个大概的了解.
要深入了解,就必须先了解一些k8s 基础了.
🔸 Pod
Pod: 一个pod 对应一个由相关容器和卷组成的容器组.
🔸
Label: 一个label 是一个被附加到资源上的键值对. 可以拿来做标签..
service: 一个service 定义了访问pod的方式.
就像当个固定的IP地址 和对应的 DNS 名之间的关系..
volume:
一个volume 是一个目录.
namespace: 好比一个资源名字的前缀.
帮助不同的项目/团队/客户 区分共享资源???
🔸 节点
主从节点都是节点, 在k8s里没必要分主从.
🔸 网络
k8s 给每个 pod 分配一个 IP地址.
当然你首先要给 k8s 分配一个IP地址池.
⦿ 建立拓扑网络
如果你要手动搭建,那么这个网络也要自己配!
一般用 Flannel 来
🔸 集群命名.
kubectl 用集群名字来来访问集群, 所以集群名是不能重复的.
🔸 所需软件
• docker
• etcd
• k8s
kubelet
kube-proxy
kube-apiserver
kube-controller-manager
kube-scheduler
🔸 选择安装镜像
上面的软件可以直接运行在服务器上,
当然还是建议在容器中运行上面的软件! 一个软件一个容器. 那么就需要镜像了!
这些镜像谷歌都帮你准备好了. 可以直接下载的.
你可以使用Google Container Registry (GCR)上的镜像文件:
例如“gcr.io/google_containers/hyperkube:$TAG”。
这里的“TAG”是指最新的发行版本的标示。这个表示可以从最新发行说明找到。
确定$TAG和你使用的kubelet,kube-proxy的标签是一致的。
hyperkube是一个集成二进制运行文件
你可以使用“hyperkube kubelet ...”来启动kubelet ,用“hyperkube apiserver ...”运行apiserver, 等等。
对于etcd,你可以:
使用上Google Container Registry (GCR)的镜像,例如“gcr.io/google_containers/etcd:2.0.12”
我们建议你使用Kubernetes发行版本里提供的etcd版本。Kubernetes发行版本里的二进制运行文件只是和这个版本的etcd测试过。
🔸 在节点上配置和安装基础软件
所有节点都需要安装 3个:
• docker
• kubelet
• kube-proxy
🔸 Docker
对最低Docker版本的要求是随着kubelet的版本变化的。最新的稳定版本通常是个好选择。
| {
"pile_set_name": "Github"
} |
/*
* Description: Test painting with Pen on a rotated and scaled indexed face set,
* whithout user specified texture mapping.
*/
#include <webots/camera.h>
#include <webots/motor.h>
#include <webots/pen.h>
#include <webots/position_sensor.h>
#include <webots/robot.h>
#include "../../../lib/ts_assertion.h"
#include "../../../lib/ts_utils.h"
#define TIME_STEP 32
WbDeviceTag camera;
const int width = 64;
const int height = 64;
const int size = 4096;
typedef struct {
int r;
int g;
int b;
} Color;
bool isGray(Color color) {
return (color.r == color.g) && (color.g == color.b);
}
int computeNumColorPixels() {
int x, y;
int numColorPixels = 0;
Color color = {0, 0, 0};
const unsigned char *image = wb_camera_get_image(camera);
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
color.r = wb_camera_image_get_red(image, width, x, y);
color.g = wb_camera_image_get_green(image, width, x, y);
color.b = wb_camera_image_get_blue(image, width, x, y);
if (!isGray(color)) {
numColorPixels++;
// printf("Pixel x %d y %d: r=%d, g=%d, b=%d\n", x, y, wb_camera_image_get_red(image, width, x, y),
// wb_camera_image_get_green(image, width, x, y), wb_camera_image_get_blue(image, width, x, y));
}
}
}
return numColorPixels;
}
Color getPixelColor(int x, int y) {
Color color = {0, 0, 0};
const unsigned char *image = wb_camera_get_image(camera);
color.r = wb_camera_image_get_red(image, width, x, y);
color.g = wb_camera_image_get_green(image, width, x, y);
color.b = wb_camera_image_get_blue(image, width, x, y);
return color;
}
int main(int argc, char **argv) {
ts_setup(argv[0]);
WbDeviceTag pen, motor, position_sensor;
Color color;
double pos;
int oldValue, numColorPixels = -1;
pen = wb_robot_get_device("pen");
wb_pen_set_ink_color(pen, 0xFA8A0A, 1.0);
wb_pen_write(pen, true);
camera = wb_robot_get_device("camera");
wb_camera_enable(camera, TIME_STEP);
motor = wb_robot_get_device("linear motor");
position_sensor = wb_robot_get_device("position sensor");
wb_position_sensor_enable(position_sensor, TIME_STEP);
wb_robot_step(TIME_STEP);
wb_robot_step(TIME_STEP);
wb_robot_step(TIME_STEP);
wb_pen_write(pen, false);
// 1) Test initial painted area location
// send_error_and_exit
numColorPixels = computeNumColorPixels();
ts_assert_boolean_equal(numColorPixels <= 15,
"The number of pixels painted after the first step should be lower than 15 not %d", numColorPixels);
color = getPixelColor(20, 58);
ts_assert_color_in_delta(
color.r, color.g, color.b, 206, 171, 58, 15,
"Pixel (20, 58) should be painted with color [r=%d, g=%d, b=%d] not [r=%d, g=%d, b=%d] after first paint call", 206, 171,
58, color.r, color.g, color.b);
wb_robot_step(TIME_STEP);
// move pen
pos = wb_position_sensor_get_value(position_sensor);
pos = pos + 0.02;
wb_motor_set_position(motor, pos);
while (pos != wb_position_sensor_get_value(position_sensor)) {
wb_robot_step(TIME_STEP);
}
// print
wb_pen_write(pen, true);
wb_robot_step(TIME_STEP);
wb_pen_write(pen, false);
// 2) Test second painted area location
oldValue = numColorPixels;
numColorPixels = computeNumColorPixels();
ts_assert_boolean_equal(
oldValue <= numColorPixels && numColorPixels <= 45,
"The number of pixels painted after the second step should be greater than before (%d) and lower than 45 not %d", oldValue,
numColorPixels);
color = getPixelColor(27, 50);
ts_assert_color_in_delta(
color.r, color.g, color.b, 206, 171, 58, 15,
"Pixel (27, 50) should be painted with color [r=%d, g=%d, b=%d] not [r=%d, g=%d, b=%d] after second paint call", 206, 171,
58, color.r, color.g, color.b);
wb_robot_step(TIME_STEP);
// move pen
pos = wb_position_sensor_get_value(position_sensor);
pos = pos + 0.07;
wb_motor_set_position(motor, pos);
while (pos != wb_position_sensor_get_value(position_sensor)) {
wb_robot_step(TIME_STEP);
}
wb_robot_step(TIME_STEP);
// print
wb_pen_write(pen, true);
wb_robot_step(TIME_STEP);
wb_pen_write(pen, false);
// 3) Test third painted area location
oldValue = numColorPixels;
numColorPixels = computeNumColorPixels();
ts_assert_boolean_equal(
oldValue <= numColorPixels && numColorPixels < 130,
"The number of pixels painted after the third step should be greater than before (%d) and lower than 130 not %d", oldValue,
numColorPixels);
color = getPixelColor(33, 10);
ts_assert_color_in_delta(
color.r, color.g, color.b, 206, 171, 58, 15,
"Pixel (33, 10) should be painted with color [r=%d, g=%d, b=%d] not [r=%d, g=%d, b=%d] after third paint call", 206, 171,
58, color.r, color.g, color.b);
ts_send_success();
return EXIT_SUCCESS;
}
| {
"pile_set_name": "Github"
} |
with Ada.Unchecked_Deallocation;
with SPARK.Heap;
procedure Test is
type Int_Ptr is access Integer;
type Int_Ptr_Ptr is access Int_Ptr;
procedure Free is new Ada.Unchecked_Deallocation (Object => Integer, Name => Int_Ptr);
procedure Free (X : in out Int_Ptr_Ptr) with
Depends => (SPARK.Heap.Dynamic_Memory => (X, SPARK.Heap.Dynamic_Memory),
X => null),
Post => X = null
is
procedure Internal_Free is new Ada.Unchecked_Deallocation
(Object => Int_Ptr, Name => Int_Ptr_Ptr);
begin
if X /= null and then X.all /= null then
Free (X.all);
end if;
Internal_Free (X);
end Free;
Y : Int_Ptr := new Integer'(11);
Z : Int_Ptr_Ptr := new Int_Ptr'(Y);
begin
Free (Z);
end Test;
| {
"pile_set_name": "Github"
} |
/**
* Removes a sticker from the editor state
*/
import { EditorState, Modifier, SelectionState } from 'draft-js';
export default (editorState: Object, blockKey: String) => {
let content = editorState.getCurrentContent();
const newSelection = new SelectionState({
anchorKey: blockKey,
anchorOffset: 0,
focusKey: blockKey,
focusOffset: 0,
});
const afterKey = content.getKeyAfter(blockKey);
const afterBlock = content.getBlockForKey(afterKey);
let targetRange;
// Only if the following block the last with no text then the whole block
// should be removed. Otherwise the block should be reduced to an unstyled block
// without any characters.
if (
afterBlock &&
afterBlock.getType() === 'unstyled' &&
afterBlock.getLength() === 0 &&
afterBlock === content.getBlockMap().last()
) {
targetRange = new SelectionState({
anchorKey: blockKey,
anchorOffset: 0,
focusKey: afterKey,
focusOffset: 0,
});
} else {
targetRange = new SelectionState({
anchorKey: blockKey,
anchorOffset: 0,
focusKey: blockKey,
focusOffset: 1,
});
}
// change the blocktype and remove the characterList entry with the sticker
content = Modifier.setBlockType(content, targetRange, 'unstyled');
content = Modifier.removeRange(content, targetRange, 'backward');
// force to new selection
const newState = EditorState.push(editorState, content, 'remove-sticker');
return EditorState.forceSelection(newState, newSelection);
};
| {
"pile_set_name": "Github"
} |
add_definitions(-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
spec2def(riched32.dll riched32.spec)
list(APPEND SOURCE
richedit.c
${CMAKE_CURRENT_BINARY_DIR}/riched32.def)
add_library(riched32 MODULE ${SOURCE} version.rc)
set_module_type(riched32 win32dll)
target_link_libraries(riched32 wine)
add_importlibs(riched32 riched20 user32 msvcrt kernel32 ntdll)
add_cd_file(TARGET riched32 DESTINATION reactos/system32 FOR all)
| {
"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.ide.commander;
import com.intellij.ide.projectView.PresentationData;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.NodeDescriptor;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.speedSearch.SpeedSearchUtil;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
final class ColoredCommanderRenderer extends ColoredListCellRenderer {
private final CommanderPanel myCommanderPanel;
ColoredCommanderRenderer(@NotNull final CommanderPanel commanderPanel) {
myCommanderPanel = commanderPanel;
}
@Override
public Component getListCellRendererComponent(final JList list, final Object value, final int index, boolean selected, boolean hasFocus){
hasFocus = selected; // border around inactive items
if (!myCommanderPanel.isActive()) {
selected = false;
}
return super.getListCellRendererComponent(list, value, index, selected, hasFocus);
}
@Override
protected void customizeCellRenderer(@NotNull final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
Color color = UIUtil.getListForeground();
SimpleTextAttributes attributes = null;
String locationString = null;
setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); // for separator, see below
if (value instanceof NodeDescriptor) {
final NodeDescriptor descriptor = (NodeDescriptor)value;
setIcon(descriptor.getIcon());
final Color elementColor = descriptor.getColor();
if (elementColor != null) {
color = elementColor;
}
if (descriptor instanceof AbstractTreeNode) {
final AbstractTreeNode treeNode = (AbstractTreeNode)descriptor;
final TextAttributesKey attributesKey = treeNode.getPresentation().getTextAttributesKey();
if (attributesKey != null) {
final TextAttributes textAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(attributesKey);
if (textAttributes != null) attributes = SimpleTextAttributes.fromTextAttributes(textAttributes);
}
locationString = treeNode.getPresentation().getLocationString();
final PresentationData presentation = treeNode.getPresentation();
if (presentation.hasSeparatorAbove() && !selected) {
setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground()),
BorderFactory.createEmptyBorder(0, 0, 1, 0)));
}
}
}
if(attributes == null) attributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, color);
//noinspection HardCodedStringLiteral
final String text = value.toString();
if (myCommanderPanel.isEnableSearchHighlighting()) {
JList list1 = myCommanderPanel.getList();
if (list1 != null) {
SpeedSearchUtil.appendFragmentsForSpeedSearch(list1, text, attributes, selected, this);
}
}
else {
append(text != null ? text : "", attributes);
}
if (locationString != null && locationString.length() > 0) {
append(" (" + locationString + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
}
| {
"pile_set_name": "Github"
} |
#include <iostream>
using namespace std;
int n,i;
int main(){
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
cin>>n;
while(cin>>n){
i=0;
while((n&(1<<i))==0){
i++;
}
cout<<(n>>i)<<" "<<i<<endl;
}
return 0;
}
| {
"pile_set_name": "Github"
} |
package reedsolomon
import (
"math/rand"
"reflect"
"testing"
)
const (
// DECODER_RANDOM_TEST_ITERATIONS = 3
DECODER_TEST_ITERATIONS = 10
)
func corrupt(received []int, howMany int, random *rand.Rand, max int) {
corrupted := make(map[int]bool, howMany)
for i := 0; i < howMany; i++ {
location := int(random.Int31n(int32(len(received))))
value := int(random.Int31n(int32(max)))
if corrupted[location] || received[location] == value {
i--
continue
}
corrupted[location] = true
received[location] = value
}
}
func getPseudoRandom() *rand.Rand {
return rand.New(rand.NewSource(0xdeadbeef))
}
func testDecoder(t testing.TB, field *GenericGF, dataWords, ecWords []int) {
t.Helper()
decoder := NewReedSolomonDecoder(field)
message := make([]int, len(dataWords)+len(ecWords))
maxErrors := len(ecWords) / 2
random := getPseudoRandom()
iterations := DECODER_TEST_ITERATIONS
if field.GetSize() > 256 {
iterations = 1
}
for j := 0; j < iterations; j++ {
for i := 0; i < len(ecWords); i++ {
if i > 10 && i < len(ecWords)/2-10 {
// performance improvement - skip intermediate cases in long-running tests
i += len(ecWords) / 10
}
copy(message, dataWords)
copy(message[len(dataWords):], ecWords)
corrupt(message, i, random, field.GetSize())
e := decoder.Decode(message, len(ecWords))
if _, ok := e.(ReedSolomonException); ok {
// fail only if maxErrors exceeded
if i <= maxErrors {
t.Fatalf("Decode in %v (%v,%v) failed at %v errors: %v",
field, len(dataWords), len(ecWords), i, e)
}
break
} else if e != nil {
t.Fatalf("Decode in %v (%v,%v) failed at %v errors: %v",
field, len(dataWords), len(ecWords), i, e)
}
if i < maxErrors {
if !reflect.DeepEqual(message[:len(dataWords)], dataWords) {
t.Fatalf("Decode in %v (%v,%v) failed at %v errors",
field, len(dataWords), len(ecWords), i)
}
}
}
}
}
func TestDataMatrix(t *testing.T) {
testDecoder(t, GenericGF_DATA_MATRIX_FIELD_256,
[]int{142, 164, 186}, []int{114, 25, 5, 88, 102})
testDecoder(t, GenericGF_DATA_MATRIX_FIELD_256, []int{
0x69, 0x75, 0x75, 0x71, 0x3B, 0x30, 0x30, 0x64,
0x70, 0x65, 0x66, 0x2F, 0x68, 0x70, 0x70, 0x68,
0x6D, 0x66, 0x2F, 0x64, 0x70, 0x6E, 0x30, 0x71,
0x30, 0x7B, 0x79, 0x6A, 0x6F, 0x68, 0x30, 0x81,
0xF0, 0x88, 0x1F, 0xB5},
[]int{
0x1C, 0x64, 0xEE, 0xEB, 0xD0, 0x1D, 0x00, 0x03,
0xF0, 0x1C, 0xF1, 0xD0, 0x6D, 0x00, 0x98, 0xDA,
0x80, 0x88, 0xBE, 0xFF, 0xB7, 0xFA, 0xA9, 0x95})
}
func TestQRCode(t *testing.T) {
testDecoder(t, GenericGF_QR_CODE_FIELD_256, []int{
0x10, 0x20, 0x0C, 0x56, 0x61, 0x80, 0xEC, 0x11,
0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11},
[]int{
0xA5, 0x24, 0xD4, 0xC1, 0xED, 0x36, 0xC7, 0x87,
0x2C, 0x55})
testDecoder(t, GenericGF_QR_CODE_FIELD_256, []int{
0x72, 0x67, 0x2F, 0x77, 0x69, 0x6B, 0x69, 0x2F,
0x4D, 0x61, 0x69, 0x6E, 0x5F, 0x50, 0x61, 0x67,
0x65, 0x3B, 0x3B, 0x00, 0xEC, 0x11, 0xEC, 0x11,
0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11, 0xEC, 0x11},
[]int{
0xD8, 0xB8, 0xEF, 0x14, 0xEC, 0xD0, 0xCC, 0x85,
0x73, 0x40, 0x0B, 0xB5, 0x5A, 0xB8, 0x8B, 0x2E,
0x08, 0x62})
}
func TestAztec(t *testing.T) {
// real life test cases
testDecoder(t, GenericGF_AZTEC_PARAM,
[]int{0x5, 0x6}, []int{0x3, 0x2, 0xB, 0xB, 0x7})
testDecoder(t, GenericGF_AZTEC_PARAM,
[]int{0x0, 0x0, 0x0, 0x9}, []int{0xA, 0xD, 0x8, 0x6, 0x5, 0x6})
testDecoder(t, GenericGF_AZTEC_PARAM,
[]int{0x2, 0x8, 0x8, 0x7}, []int{0xE, 0xC, 0xA, 0x9, 0x6, 0x8})
testDecoder(t, GenericGF_AZTEC_DATA_6, []int{
0x9, 0x32, 0x1, 0x29, 0x2F, 0x2, 0x27, 0x25, 0x1, 0x1B},
[]int{
0x2C, 0x2, 0xD, 0xD, 0xA, 0x16, 0x28, 0x9, 0x22, 0xA, 0x14})
testDecoder(t, GenericGF_AZTEC_DATA_8, []int{
0xE0, 0x86, 0x42, 0x98, 0xE8, 0x4A, 0x96, 0xC6,
0xB9, 0xF0, 0x8C, 0xA7, 0x4A, 0xDA, 0xF8, 0xCE,
0xB7, 0xDE, 0x88, 0x64, 0x29, 0x8E, 0x84, 0xA9,
0x6C, 0x6B, 0x9F, 0x08, 0xCA, 0x74, 0xAD, 0xAF,
0x8C, 0xEB, 0x7C, 0x10, 0xC8, 0x53, 0x1D, 0x09,
0x52, 0xD8, 0xD7, 0x3E, 0x11, 0x94, 0xE9, 0x5B,
0x5F, 0x19, 0xD6, 0xFB, 0xD1, 0x0C, 0x85, 0x31,
0xD0, 0x95, 0x2D, 0x8D, 0x73, 0xE1, 0x19, 0x4E,
0x95, 0xB5, 0xF1, 0x9D, 0x6F},
[]int{
0x31, 0xD7, 0x04, 0x46, 0xB2, 0xC1, 0x06, 0x94,
0x17, 0xE5, 0x0C, 0x2B, 0xA3, 0x99, 0x15, 0x7F,
0x16, 0x3C, 0x66, 0xBA, 0x33, 0xD9, 0xE8, 0x87,
0x86, 0xBB, 0x4B, 0x15, 0x4E, 0x4A, 0xDE, 0xD4,
0xED, 0xA1, 0xF8, 0x47, 0x2A, 0x50, 0xA6, 0xBC,
0x53, 0x7D, 0x29, 0xFE, 0x06, 0x49, 0xF3, 0x73,
0x9F, 0xC1, 0x75})
testDecoder(t, GenericGF_AZTEC_DATA_10, []int{
0x15C, 0x1E1, 0x2D5, 0x02E, 0x048, 0x1E2, 0x037, 0x0CD,
0x02E, 0x056, 0x26A, 0x281, 0x1C2, 0x1A6, 0x296, 0x045,
0x041, 0x0AA, 0x095, 0x2CE, 0x003, 0x38F, 0x2CD, 0x1A2,
0x036, 0x1AD, 0x04E, 0x090, 0x271, 0x0D3, 0x02E, 0x0D5,
0x2D4, 0x032, 0x2CA, 0x281, 0x0AA, 0x04E, 0x024, 0x2D3,
0x296, 0x281, 0x0E2, 0x08A, 0x1AA, 0x28A, 0x280, 0x07C,
0x286, 0x0A1, 0x1D0, 0x1AD, 0x154, 0x032, 0x2C2, 0x1C1,
0x145, 0x02B, 0x2D4, 0x2B0, 0x033, 0x2D5, 0x276, 0x1C1,
0x282, 0x10A, 0x2B5, 0x154, 0x003, 0x385, 0x20F, 0x0C4,
0x02D, 0x050, 0x266, 0x0D5, 0x033, 0x2D5, 0x276, 0x1C1,
0x0D4, 0x2A0, 0x08F, 0x0C4, 0x024, 0x20F, 0x2E2, 0x1AD,
0x154, 0x02E, 0x056, 0x26A, 0x281, 0x090, 0x1E5, 0x14E,
0x0CF, 0x2B6, 0x1C1, 0x28A, 0x2A1, 0x04E, 0x0D5, 0x003,
0x391, 0x122, 0x286, 0x1AD, 0x2D4, 0x028, 0x262, 0x2EA,
0x0A2, 0x004, 0x176, 0x295, 0x201, 0x0D5, 0x024, 0x20F,
0x116, 0x0C1, 0x056, 0x095, 0x213, 0x004, 0x1EA, 0x28A,
0x02A, 0x234, 0x2CE, 0x037, 0x157, 0x0D3, 0x262, 0x026,
0x262, 0x2A0, 0x086, 0x106, 0x2A1, 0x126, 0x1E5, 0x266,
0x26A, 0x2A1, 0x0E6, 0x1AA, 0x281, 0x2B6, 0x271, 0x154,
0x02F, 0x0C4, 0x02D, 0x213, 0x0CE, 0x003, 0x38F, 0x2CD,
0x1A2, 0x036, 0x1B5, 0x26A, 0x086, 0x280, 0x086, 0x1AA,
0x2A1, 0x226, 0x1AD, 0x0CF, 0x2A6, 0x292, 0x2C6, 0x022,
0x1AA, 0x256, 0x0D5, 0x02D, 0x050, 0x266, 0x0D5, 0x004,
0x176, 0x295, 0x201, 0x0D3, 0x055, 0x031, 0x2CD, 0x2EA,
0x1E2, 0x261, 0x1EA, 0x28A, 0x004, 0x145, 0x026, 0x1A6,
0x1C6, 0x1F5, 0x2CE, 0x034, 0x051, 0x146, 0x1E1, 0x0B0,
0x1B0, 0x261, 0x0D5, 0x025, 0x142, 0x1C0, 0x07C, 0x0B0,
0x1E6, 0x081, 0x044, 0x02F, 0x2CF, 0x081, 0x290, 0x0A2,
0x1A6, 0x281, 0x0CD, 0x155, 0x031, 0x1A2, 0x086, 0x262,
0x2A1, 0x0CD, 0x0CA, 0x0E6, 0x1E5, 0x003, 0x394, 0x0C5,
0x030, 0x26F, 0x053, 0x0C1, 0x1B6, 0x095, 0x2D4, 0x030,
0x26F, 0x053, 0x0C0, 0x07C, 0x2E6, 0x295, 0x143, 0x2CD,
0x2CE, 0x037, 0x0C9, 0x144, 0x2CD, 0x040, 0x08E, 0x054,
0x282, 0x022, 0x2A1, 0x229, 0x053, 0x0D5, 0x262, 0x027,
0x26A, 0x1E8, 0x14D, 0x1A2, 0x004, 0x26A, 0x296, 0x281,
0x176, 0x295, 0x201, 0x0E2, 0x2C4, 0x143, 0x2D4, 0x026,
0x262, 0x2A0, 0x08F, 0x0C4, 0x031, 0x213, 0x2B5, 0x155,
0x213, 0x02F, 0x143, 0x121, 0x2A6, 0x1AD, 0x2D4, 0x034,
0x0C5, 0x026, 0x295, 0x003, 0x396, 0x2A1, 0x176, 0x295,
0x201, 0x0AA, 0x04E, 0x004, 0x1B0, 0x070, 0x275, 0x154,
0x026, 0x2C1, 0x2B3, 0x154, 0x2AA, 0x256, 0x0C1, 0x044,
0x004, 0x23F},
[]int{
0x379, 0x099, 0x348, 0x010, 0x090, 0x196, 0x09C, 0x1FF,
0x1B0, 0x32D, 0x244, 0x0DE, 0x201, 0x386, 0x163, 0x11F,
0x39B, 0x344, 0x3FE, 0x02F, 0x188, 0x113, 0x3D9, 0x102,
0x04A, 0x2E1, 0x1D1, 0x18E, 0x077, 0x262, 0x241, 0x20D,
0x1B8, 0x11D, 0x0D0, 0x0A5, 0x29C, 0x24D, 0x3E7, 0x006,
0x2D0, 0x1B7, 0x337, 0x178, 0x0F1, 0x1E0, 0x00B, 0x01E,
0x0DA, 0x1C6, 0x2D9, 0x00D, 0x28B, 0x34A, 0x252, 0x27A,
0x057, 0x0CA, 0x2C2, 0x2E4, 0x3A6, 0x0E3, 0x22B, 0x307,
0x174, 0x292, 0x10C, 0x1ED, 0x2FD, 0x2D4, 0x0A7, 0x051,
0x34F, 0x07A, 0x1D5, 0x01D, 0x22E, 0x2C2, 0x1DF, 0x08F,
0x105, 0x3FE, 0x286, 0x2A2, 0x3B1, 0x131, 0x285, 0x362,
0x315, 0x13C, 0x0F9, 0x1A2, 0x28D, 0x246, 0x1B3, 0x12C,
0x2AD, 0x0F8, 0x222, 0x0EC, 0x39F, 0x358, 0x014, 0x229,
0x0C8, 0x360, 0x1C2, 0x031, 0x098, 0x041, 0x3E4, 0x046,
0x332, 0x318, 0x2E3, 0x24E, 0x3E2, 0x1E1, 0x0BE, 0x239,
0x306, 0x3A5, 0x352, 0x351, 0x275, 0x0ED, 0x045, 0x229,
0x0BF, 0x05D, 0x253, 0x1BE, 0x02E, 0x35A, 0x0E4, 0x2E9,
0x17A, 0x166, 0x03C, 0x007})
testDecoder(t, GenericGF_AZTEC_DATA_12, []int{
0x571, 0xE1B, 0x542, 0xE12, 0x1E2, 0x0DC, 0xCD0, 0xB85,
0x69A, 0xA81, 0x709, 0xA6A, 0x584, 0x510, 0x4AA, 0x256,
0xCE0, 0x0F8, 0xFB3, 0x5A2, 0x0D9, 0xAD1, 0x389, 0x09C,
0x4D3, 0x0B8, 0xD5B, 0x503, 0x2B2, 0xA81, 0x2A8, 0x4E0,
0x92D, 0x3A5, 0xA81, 0x388, 0x8A6, 0xAA8, 0xAA0, 0x07C,
0xA18, 0xA17, 0x41A, 0xD55, 0x032, 0xB09, 0xC15, 0x142,
0xBB5, 0x2B0, 0x0CE, 0xD59, 0xD9C, 0x1A0, 0x90A, 0xAD5,
0x540, 0x0F8, 0x583, 0xCC4, 0x0B4, 0x509, 0x98D, 0x50C,
0xED5, 0x9D9, 0xC13, 0x52A, 0x023, 0xCC4, 0x092, 0x0FB,
0x89A, 0xD55, 0x02E, 0x15A, 0x6AA, 0x049, 0x079, 0x54E,
0x33E, 0xB67, 0x068, 0xAA8, 0x44E, 0x354, 0x03E, 0x452,
0x2A1, 0x9AD, 0xB50, 0x289, 0x8AE, 0xA28, 0x804, 0x5DA,
0x958, 0x04D, 0x509, 0x20F, 0x458, 0xC11, 0x589, 0x584,
0xC04, 0x7AA, 0x8A0, 0xAA3, 0x4B3, 0x837, 0x55C, 0xD39,
0x882, 0x698, 0xAA0, 0x219, 0x06A, 0x852, 0x679, 0x666,
0x9AA, 0xA13, 0x99A, 0xAA0, 0x6B6, 0x9C5, 0x540, 0xBCC,
0x40B, 0x613, 0x338, 0x03E, 0x3EC, 0xD68, 0x836, 0x6D6,
0x6A2, 0x1A8, 0x021, 0x9AA, 0xA86, 0x266, 0xB4C, 0xFA9,
0xA92, 0xB18, 0x226, 0xAA5, 0x635, 0x42D, 0x142, 0x663,
0x540, 0x45D, 0xA95, 0x804, 0xD31, 0x543, 0x1B3, 0x6EA,
0x78A, 0x617, 0xAA8, 0xA01, 0x145, 0x099, 0xA67, 0x19F,
0x5B3, 0x834, 0x145, 0x467, 0x84B, 0x06C, 0x261, 0x354,
0x255, 0x09C, 0x01F, 0x0B0, 0x798, 0x811, 0x102, 0xFB3,
0xC81, 0xA40, 0xA26, 0x9A8, 0x133, 0x555, 0x0C5, 0xA22,
0x1A6, 0x2A8, 0x4CD, 0x328, 0xE67, 0x940, 0x3E5, 0x0C5,
0x0C2, 0x6F1, 0x4CC, 0x16D, 0x895, 0xB50, 0x309, 0xBC5,
0x330, 0x07C, 0xB9A, 0x955, 0x0EC, 0xDB3, 0x837, 0x325,
0x44B, 0x344, 0x023, 0x854, 0xA08, 0x22A, 0x862, 0x914,
0xCD5, 0x988, 0x279, 0xA9E, 0x853, 0x5A2, 0x012, 0x6AA,
0x5A8, 0x15D, 0xA95, 0x804, 0xE2B, 0x114, 0x3B5, 0x026,
0x98A, 0xA02, 0x3CC, 0x40C, 0x613, 0xAD5, 0x558, 0x4C2,
0xF50, 0xD21, 0xA99, 0xADB, 0x503, 0x431, 0x426, 0xA54,
0x03E, 0x5AA, 0x15D, 0xA95, 0x804, 0xAA1, 0x380, 0x46C,
0x070, 0x9D5, 0x540, 0x9AC, 0x1AC, 0xD54, 0xAAA, 0x563,
0x044, 0x401, 0x220, 0x9F1, 0x4F0, 0xDAA, 0x170, 0x90F,
0x106, 0xE66, 0x85C, 0x2B4, 0xD54, 0x0B8, 0x4D3, 0x52C,
0x228, 0x825, 0x512, 0xB67, 0x007, 0xC7D, 0x9AD, 0x106,
0xCD6, 0x89C, 0x484, 0xE26, 0x985, 0xC6A, 0xDA8, 0x195,
0x954, 0x095, 0x427, 0x049, 0x69D, 0x2D4, 0x09C, 0x445,
0x355, 0x455, 0x003, 0xE50, 0xC50, 0xBA0, 0xD6A, 0xA81,
0x958, 0x4E0, 0xA8A, 0x15D, 0xA95, 0x806, 0x76A, 0xCEC,
0xE0D, 0x048, 0x556, 0xAAA, 0x007, 0xC2C, 0x1E6, 0x205,
0xA28, 0x4CC, 0x6A8, 0x676, 0xACE, 0xCE0, 0x9A9, 0x501,
0x1E6, 0x204, 0x907, 0xDC4, 0xD6A, 0xA81, 0x70A, 0xD35,
0x502, 0x483, 0xCAA, 0x719, 0xF5B, 0x383, 0x455, 0x422,
0x71A, 0xA01, 0xF22, 0x915, 0x0CD, 0x6DA, 0x814, 0x4C5,
0x751, 0x440, 0x22E, 0xD4A, 0xC02, 0x6A8, 0x490, 0x7A2,
0xC60, 0x8AC, 0x4AC, 0x260, 0x23D, 0x545, 0x055, 0x1A5,
0x9C1, 0xBAA, 0xE69, 0xCC4, 0x134, 0xC55, 0x010, 0xC83,
0x542, 0x933, 0xCB3, 0x34D, 0x550, 0x9CC, 0xD55, 0x035,
0xB4E, 0x2AA, 0x05E, 0x620, 0x5B0, 0x999, 0xC01, 0xF1F,
0x66B, 0x441, 0xB36, 0xB35, 0x10D, 0x401, 0x0CD, 0x554,
0x313, 0x35A, 0x67D, 0x4D4, 0x958, 0xC11, 0x355, 0x2B1,
0xAA1, 0x68A, 0x133, 0x1AA, 0x022, 0xED4, 0xAC0, 0x269,
0x8AA, 0x18D, 0x9B7, 0x53C, 0x530, 0xBD5, 0x450, 0x08A,
0x284, 0xCD3, 0x38C, 0xFAD, 0x9C1, 0xA0A, 0x2A3, 0x3C2,
0x583, 0x613, 0x09A, 0xA12, 0xA84, 0xE00, 0xF85, 0x83C,
0xC40, 0x888, 0x17D, 0x9E4, 0x0D2, 0x051, 0x34D, 0x409,
0x9AA, 0xA86, 0x2D1, 0x10D, 0x315, 0x426, 0x699, 0x473,
0x3CA, 0x01F, 0x286, 0x286, 0x137, 0x8A6, 0x60B, 0x6C4,
0xADA, 0x818, 0x4DE, 0x299, 0x803, 0xE5C, 0xD4A, 0xA87,
0x66D, 0x9C1, 0xB99, 0x2A2, 0x59A, 0x201, 0x1C2, 0xA50,
0x411, 0x543, 0x148, 0xA66, 0xACC, 0x413, 0xCD4, 0xF42,
0x9AD, 0x100, 0x935, 0x52D, 0x40A, 0xED4, 0xAC0, 0x271,
0x588, 0xA1D, 0xA81, 0x34C, 0x550, 0x11E, 0x620, 0x630,
0x9D6, 0xAAA, 0xC26, 0x17A, 0x869, 0x0D4, 0xCD6, 0xDA8,
0x1A1, 0x8A1, 0x352, 0xA01, 0xF2D, 0x50A, 0xED4, 0xAC0,
0x255, 0x09C, 0x023, 0x603, 0x84E, 0xAAA, 0x04D, 0x60D,
0x66A, 0xA55, 0x52B, 0x182, 0x220, 0x091, 0x00F, 0x8A7,
0x86D, 0x50B, 0x848, 0x788, 0x373, 0x342, 0xE15, 0xA6A,
0xA05, 0xC26, 0x9A9, 0x611, 0x441, 0x2A8, 0x95B, 0x380,
0x3E3, 0xECD, 0x688, 0x366, 0xB44, 0xE24, 0x271, 0x34C,
0x2E3, 0x56D, 0x40C, 0xACA, 0xA04, 0xAA1, 0x382, 0x4B4,
0xE96, 0xA04, 0xE22, 0x29A, 0xAA2, 0xA80, 0x1F2, 0x862,
0x85D, 0x06B, 0x554, 0x0CA, 0xC27, 0x054, 0x50A, 0xED4,
0xAC0, 0x33B, 0x567, 0x670, 0x682, 0x42A, 0xB55, 0x500,
0x3E1, 0x60F, 0x310, 0x2D1, 0x426, 0x635, 0x433, 0xB56,
0x767, 0x04D, 0x4A8, 0x08F, 0x310, 0x248, 0x3EE, 0x26B,
0x554, 0x0B8, 0x569, 0xAA8, 0x124, 0x1E5, 0x538, 0xCFA,
0xD9C, 0x1A2, 0xAA1, 0x138, 0xD50, 0x0F9, 0x148, 0xA86,
0x6B6, 0xD40, 0xA26, 0x2BA, 0x8A2, 0x011, 0x76A, 0x560,
0x135, 0x424, 0x83D, 0x163, 0x045, 0x625, 0x613, 0x011,
0xEAA, 0x282, 0xA8D, 0x2CE, 0x0DD, 0x573, 0x4E6, 0x209,
0xA62, 0xA80, 0x864, 0x1AA, 0x149, 0x9E5, 0x99A, 0x6AA,
0x84E, 0x66A, 0xA81, 0xADA, 0x715, 0x502, 0xF31, 0x02D,
0x84C, 0xCE0, 0x0F8, 0xFB3, 0x5A2, 0x0D9, 0xB59, 0xA88,
0x6A0, 0x086, 0x6AA, 0xA18, 0x99A, 0xD33, 0xEA6, 0xA4A,
0xC60, 0x89A, 0xA95, 0x8D5, 0x0B4, 0x509, 0x98D, 0x501,
0x176, 0xA56, 0x013, 0x4C5, 0x50C, 0x6CD, 0xBA9, 0xE29,
0x85E, 0xAA2, 0x804, 0x514, 0x266, 0x99C, 0x67D, 0x6CE,
0x0D0, 0x515, 0x19E, 0x12C, 0x1B0, 0x984, 0xD50, 0x954,
0x270, 0x07C, 0x2C1, 0xE62, 0x044, 0x40B, 0xECF, 0x206,
0x902, 0x89A, 0x6A0, 0x4CD, 0x554, 0x316, 0x888, 0x698,
0xAA1, 0x334, 0xCA3, 0x99E, 0x500, 0xF94, 0x314, 0x309,
0xBC5, 0x330, 0x5B6, 0x256, 0xD40, 0xC26, 0xF14, 0xCC0,
0x1F2, 0xE6A, 0x554, 0x3B3, 0x6CE, 0x0DC, 0xC95, 0x12C,
0xD10, 0x08E, 0x152, 0x820, 0x8AA, 0x18A, 0x453, 0x356,
0x620, 0x9E6, 0xA7A, 0x14D, 0x688, 0x049, 0xAA9, 0x6A0,
0x576, 0xA56, 0x013, 0x8AC, 0x450, 0xED4, 0x09A, 0x62A,
0x808, 0xF31, 0x031, 0x84E, 0xB55, 0x561, 0x30B, 0xD43,
0x486, 0xA66, 0xB6D, 0x40D, 0x0C5, 0x09A, 0x950, 0x0F9,
0x6A8, 0x576, 0xA56, 0x012, 0xA84, 0xE01, 0x1B0, 0x1C2,
0x755, 0x502, 0x6B0, 0x6B3, 0x552, 0xAA9, 0x58C, 0x111,
0x004, 0x882, 0x7C5, 0x3C3, 0x6A8, 0x5C2, 0x43C, 0x41B,
0x99A, 0x170, 0xAD3, 0x550, 0x2E1, 0x34D, 0x4B0, 0x8A2,
0x095, 0x44A, 0xD9C, 0x01F, 0x1F6, 0x6B4, 0x41B, 0x35A,
0x271, 0x213, 0x89A, 0x617, 0x1AB, 0x6A0, 0x656, 0x550,
0x255, 0x09C, 0x125, 0xA74, 0xB50, 0x271, 0x114, 0xD55,
0x154, 0x00F, 0x943, 0x142, 0xE83, 0x5AA, 0xA06, 0x561,
0x382, 0xA28, 0x576, 0xA56, 0x019, 0xDAB, 0x3B3, 0x834,
0x121, 0x55A, 0xAA8, 0x01F, 0x0B0, 0x798, 0x816, 0x8A1,
0x331, 0xAA1, 0x9DA, 0xB3B, 0x382, 0x6A5, 0x404, 0x798,
0x812, 0x41F, 0x713, 0x5AA, 0xA05, 0xC2B, 0x4D5, 0x409,
0x20F, 0x2A9, 0xC67, 0xD6C, 0xE0D, 0x155, 0x089, 0xC6A,
0x807, 0xC8A, 0x454, 0x335, 0xB6A, 0x051, 0x315, 0xD45,
0x100, 0x8BB, 0x52B, 0x009, 0xAA1, 0x241, 0xE8B, 0x182,
0x2B1, 0x2B0, 0x980, 0x8F5, 0x514, 0x154, 0x696, 0x706,
0xEAB, 0x9A7, 0x310, 0x4D3, 0x154, 0x043, 0x20D, 0x50A,
0x4CF, 0x2CC, 0xD35, 0x542, 0x733, 0x554, 0x0D6, 0xD38,
0xAA8, 0x179, 0x881, 0x6C2, 0x667, 0x007, 0xC7D, 0x9AD,
0x106, 0xCDA, 0xCD4, 0x435, 0x004, 0x335, 0x550, 0xC4C,
0xD69, 0x9F5, 0x352, 0x563, 0x044, 0xD54, 0xAC6, 0xA85,
0xA28, 0x4CC, 0x6A8, 0x08B, 0xB52, 0xB00, 0x9A6, 0x2A8,
0x636, 0x6DD, 0x4F1, 0x4C2, 0xF55, 0x140, 0x228, 0xA13,
0x34C, 0xE33, 0xEB6, 0x706, 0x828, 0xA8C, 0xF09, 0x60D,
0x84C, 0x26A, 0x84A, 0xA13, 0x803, 0xE16, 0x0F3, 0x102,
0x220, 0x5F6, 0x790, 0x348, 0x144, 0xD35, 0x026, 0x6AA,
0xA18, 0xB44, 0x434, 0xC55, 0x099, 0xA65, 0x1CC, 0xF28,
0x07C, 0xA18, 0xA18, 0x4DE, 0x299, 0x82D, 0xB12, 0xB6A,
0x061, 0x378, 0xA66, 0x00F, 0x973, 0x52A, 0xA1D, 0x9B6,
0x706, 0xE64, 0xA89, 0x668, 0x804, 0x70A, 0x941, 0x045,
0x50C, 0x522, 0x99A, 0xB31, 0x04F, 0x353, 0xD0A, 0x6B4,
0x402, 0x4D5, 0x4B5, 0x02B, 0xB52, 0xB00, 0x9C5, 0x622,
0x876, 0xA04, 0xD31, 0x540, 0x479, 0x881, 0x8C2, 0x75A,
0xAAB, 0x098, 0x5EA, 0x1A4, 0x353, 0x35B, 0x6A0, 0x686,
0x284, 0xD4A, 0x807, 0xCB5, 0x42B, 0xB52, 0xB00, 0x954,
0x270, 0x08D, 0x80E, 0x13A, 0xAA8, 0x135, 0x835, 0x9AA,
0x801, 0xF14, 0xF0D, 0xAA1, 0x709, 0x0F1, 0x06E, 0x668,
0x5C2, 0xB4D, 0x540, 0xB84, 0xD35, 0x2C2, 0x288, 0x255,
0x12B, 0x670, 0x07C, 0x7D9, 0xAD1, 0x06C, 0xD68, 0x9C4,
0x84E, 0x269, 0x85C, 0x6AD, 0xA81, 0x959, 0x540, 0x954,
0x270, 0x496, 0x9D2, 0xD40, 0x9C4, 0x453, 0x554, 0x550,
0x03E, 0x50C, 0x50B, 0xA0D, 0x6AA, 0x819, 0x584, 0xE0A,
0x8A1, 0x5DA, 0x958, 0x067, 0x6AC, 0xECE, 0x0D0, 0x485,
0x56A, 0xAA0, 0x07C, 0x2C1, 0xE62, 0x05A, 0x284, 0xCC6,
0xA86, 0x76A, 0xCEC, 0xE09, 0xA95, 0x011, 0xE62, 0x049,
0x07D, 0xC4D, 0x6AA, 0x817, 0x0AD, 0x355, 0x024, 0x83C,
0xAA7, 0x19F, 0x5B3, 0x834, 0x554, 0x227, 0x1AA, 0x01F,
0x229, 0x150, 0xCD6, 0xDA8, 0x144, 0xC57, 0x514, 0x402,
0x2ED, 0x4AC, 0x026, 0xA84, 0x907, 0xA2C, 0x608, 0xAC4,
0xAC2, 0x602, 0x3D5, 0x450, 0x551, 0xA59, 0xC1B, 0xAAE,
0x69C, 0xC41, 0x34C, 0x550, 0x10C, 0x835, 0x429, 0x33C,
0xB33, 0x4D5, 0x509, 0xCCD, 0x550, 0x35B, 0x4E2, 0xAA0,
0x5E6, 0x205, 0xB09, 0x99C, 0x09F},
[]int{
0xD54, 0x221, 0x154, 0x7CD, 0xBF3, 0x112, 0x89B, 0xC5E,
0x9CD, 0x07E, 0xFB6, 0x78F, 0x7FA, 0x16F, 0x377, 0x4B4,
0x62D, 0x475, 0xBC2, 0x861, 0xB72, 0x9D0, 0x76A, 0x5A1,
0x22A, 0xF74, 0xDBA, 0x8B1, 0x139, 0xDCD, 0x012, 0x293,
0x705, 0xA34, 0xDD5, 0x3D2, 0x7F8, 0x0A6, 0x89A, 0x346,
0xCE0, 0x690, 0x40E, 0xFF3, 0xC4D, 0x97F, 0x9C9, 0x016,
0x73A, 0x923, 0xBCE, 0xFA9, 0xE6A, 0xB92, 0x02A, 0x07C,
0x04B, 0x8D5, 0x753, 0x42E, 0x67E, 0x87C, 0xEE6, 0xD7D,
0x2BF, 0xFB2, 0xFF8, 0x42F, 0x4CB, 0x214, 0x779, 0x02D,
0x606, 0xA02, 0x08A, 0xD4F, 0xB87, 0xDDF, 0xC49, 0xB51,
0x0E9, 0xF89, 0xAEF, 0xC92, 0x383, 0x98D, 0x367, 0xBD3,
0xA55, 0x148, 0x9DB, 0x913, 0xC79, 0x6FF, 0x387, 0x6EA,
0x7FA, 0xC1B, 0x12D, 0x303, 0xBCA, 0x503, 0x0FB, 0xB14,
0x0D4, 0xAD1, 0xAFC, 0x9DD, 0x404, 0x145, 0x6E5, 0x8ED,
0xF94, 0xD72, 0x645, 0xA21, 0x1A8, 0xABF, 0xC03, 0x91E,
0xD53, 0x48C, 0x471, 0x4E4, 0x408, 0x33C, 0x5DF, 0x73D,
0xA2A, 0x454, 0xD77, 0xC48, 0x2F5, 0x96A, 0x9CF, 0x047,
0x611, 0xE92, 0xC2F, 0xA98, 0x56D, 0x919, 0x615, 0x535,
0x67A, 0x8C1, 0x2E2, 0xBC4, 0xBE8, 0x328, 0x04F, 0x257,
0x3F9, 0xFA5, 0x477, 0x12E, 0x94B, 0x116, 0xEF7, 0x65F,
0x6B3, 0x915, 0xC64, 0x9AF, 0xB6C, 0x6A2, 0x50D, 0xEA3,
0x26E, 0xC23, 0x817, 0xA42, 0x71A, 0x9DD, 0xDA8, 0x84D,
0x3F3, 0x85B, 0xB00, 0x1FC, 0xB0A, 0xC2F, 0x00C, 0x095,
0xC58, 0x0E3, 0x807, 0x962, 0xC4B, 0x29A, 0x6FC, 0x958,
0xD29, 0x59E, 0xB14, 0x95A, 0xEDE, 0xF3D, 0xFB8, 0x0E5,
0x348, 0x2E7, 0x38E, 0x56A, 0x410, 0x3B1, 0x4B0, 0x793,
0xAB7, 0x0BC, 0x648, 0x719, 0xE3E, 0xFB4, 0x3B4, 0xE5C,
0x950, 0xD2A, 0x50B, 0x76F, 0x8D2, 0x3C7, 0xECC, 0x87C,
0x53A, 0xBA7, 0x4C3, 0x148, 0x437, 0x820, 0xECD, 0x660,
0x095, 0x2F4, 0x661, 0x6A4, 0xB74, 0x5F3, 0x1D2, 0x7EC,
0x8E2, 0xA40, 0xA6F, 0xFC3, 0x3BE, 0x1E9, 0x52C, 0x233,
0x173, 0x4EF, 0xA7C, 0x40B, 0x14C, 0x88D, 0xF30, 0x8D9,
0xBDB, 0x0A6, 0x940, 0xD46, 0xB2B, 0x03E, 0x46A, 0x641,
0xF08, 0xAFF, 0x496, 0x68A, 0x7A4, 0x0BA, 0xD43, 0x515,
0xB26, 0xD8F, 0x05C, 0xD6E, 0xA2C, 0xF25, 0x628, 0x4E5,
0x81D, 0xA2A, 0x1FF, 0x302, 0xFBD, 0x6D9, 0x711, 0xD8B,
0xE5C, 0x5CF, 0x42E, 0x008, 0x863, 0xB6F, 0x1E1, 0x3DA,
0xACE, 0x82B, 0x2DB, 0x7EB, 0xC15, 0x79F, 0xA79, 0xDAF,
0x00D, 0x2F6, 0x0CE, 0x370, 0x7E8, 0x9E6, 0x89F, 0xAE9,
0x175, 0xA95, 0x06B, 0x9DF, 0xAFF, 0x45B, 0x823, 0xAA4,
0xC79, 0x773, 0x886, 0x854, 0x0A5, 0x6D1, 0xE55, 0xEBB,
0x518, 0xE50, 0xF8F, 0x8CC, 0x834, 0x388, 0xCD2, 0xFC1,
0xA55, 0x1F8, 0xD1F, 0xE08, 0xF93, 0x362, 0xA22, 0x9FA,
0xCE5, 0x3C3, 0xDD4, 0xC53, 0xB94, 0xAD0, 0x6EB, 0x68D,
0x660, 0x8FC, 0xBCD, 0x914, 0x16F, 0x4C0, 0x134, 0xE1A,
0x76F, 0x9CB, 0x660, 0xEA0, 0x320, 0x15A, 0xCE3, 0x7E8,
0x03E, 0xB9A, 0xC90, 0xA14, 0x256, 0x1A8, 0x639, 0x7C6,
0xA59, 0xA65, 0x956, 0x9E4, 0x592, 0x6A9, 0xCFF, 0x4DC,
0xAA3, 0xD2A, 0xFDE, 0xA87, 0xBF5, 0x9F0, 0xC32, 0x94F,
0x675, 0x9A6, 0x369, 0x648, 0x289, 0x823, 0x498, 0x574,
0x8D1, 0xA13, 0xD1A, 0xBB5, 0xA19, 0x7F7, 0x775, 0x138,
0x949, 0xA4C, 0xE36, 0x126, 0xC85, 0xE05, 0xFEE, 0x962,
0x36D, 0x08D, 0xC76, 0x1E1, 0x1EC, 0x8D7, 0x231, 0xB68,
0x03C, 0x1DE, 0x7DF, 0x2B1, 0x09D, 0xC81, 0xDA4, 0x8F7,
0x6B9, 0x947, 0x9B0})
}
func TestDecodeEmptyWords(t *testing.T) {
decoder := NewReedSolomonDecoder(GenericGF_QR_CODE_FIELD_256)
e := decoder.Decode([]int{}, 0)
if e == nil {
t.Fatalf("Decode({}, 0) must be error")
}
}
func TestDecoderFindErrorMagnitudes(t *testing.T) {
field := GenericGF_QR_CODE_FIELD_256
decoder := NewReedSolomonDecoder(field)
evaluator, _ := NewGenericGFPoly(field, []int{1, 0})
r, e := decoder.findErrorMagnitudes(evaluator, []int{0})
if e == nil {
t.Fatalf("findErrorMagnitudes({1,0}, {0}) must be error")
}
r, e = decoder.findErrorMagnitudes(evaluator, []int{1, 1})
if e == nil {
t.Fatalf("findErrorMagnitudes({1,0}, {1,1}) must be error")
}
evaluator, _ = NewGenericGFPoly(field, []int{1})
r, e = decoder.findErrorMagnitudes(evaluator, []int{1})
if e != nil {
t.Fatalf("findErrorMagnitudes({1}, {1}) returns error, %v", e)
}
if !reflect.DeepEqual(r, []int{1}) {
t.Fatalf("findErrorMagnitudes({1}, {1}) returns %v, expect [1]", r)
}
}
func TestDecoderRunEuclideanAlgorithm(t *testing.T) {
field := GenericGF_QR_CODE_FIELD_256
decoder := NewReedSolomonDecoder(field)
a, _ := NewGenericGFPoly(field, []int{0})
b, _ := NewGenericGFPoly(field, []int{0})
_, _, e := decoder.runEuclideanAlgorithm(a, b, 0)
if _, ok := e.(ReedSolomonException); !ok {
t.Fatalf("runEuclideanAlgorithm({0}, {0}, 0) must be ReedSolomonException, (%T) %v", e, e)
}
a, _ = NewGenericGFPoly(field, []int{1})
b, _ = NewGenericGFPoly(field, []int{1, 1})
_, _, e = decoder.runEuclideanAlgorithm(a, b, 1)
if e == nil {
t.Fatalf("runEuclideanAlgorithm({1}, {1,1}, 1) must be error")
}
a, _ = NewGenericGFPoly(field, []int{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
b, _ = NewGenericGFPoly(field, []int{1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0})
_, _, e = decoder.runEuclideanAlgorithm(a, b, 10)
if e == nil {
t.Fatalf("runEuclideanAlgorithm must be error")
}
a, _ = NewGenericGFPoly(field, []int{1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0})
b, _ = NewGenericGFPoly(field, []int{64, 22, 155, 100, 246, 170, 23, 104, 214, 161})
sigma, omega, e := decoder.runEuclideanAlgorithm(a, b, 10)
if e != nil {
t.Fatalf("runEuclideanAlgorithm returns error, %v", e)
}
expect := []int{234, 1}
if !reflect.DeepEqual(sigma.coefficients, expect) {
t.Fatalf("runEuclideanAlgorithm sigma = %v, expect %v", sigma.coefficients, expect)
}
expect = []int{161}
if !reflect.DeepEqual(omega.coefficients, expect) {
t.Fatalf("runEuclideanAlgorithm sigma = %v, expect %v", omega.coefficients, expect)
}
}
| {
"pile_set_name": "Github"
} |
'use strict';
var is = require('../../../object/is');
module.exports = function (t, a) {
a(t({}), NaN, "NaN");
a(t(0), 0, "Zero");
a(t(Infinity), Infinity, "Infinity");
a(t(-Infinity), -Infinity, "-Infinity");
a(is(t(0.234), 0), true, "0");
a(is(t(-0.234), -0), true, "-0");
a(t(13.7), 13, "Positive #1");
a(t(12.3), 12, "Positive #2");
a(t(-12.3), -12, "Negative #1");
a(t(-14.7), -14, "Negative #2");
};
| {
"pile_set_name": "Github"
} |
package org.wcong.test.spring.aop;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.cglib.core.SpringNamingPolicy;
import org.springframework.cglib.proxy.Enhancer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
/**
* @author wcong<wc19920415@gmail.com>
* @since 16/4/18
*/
public class CustomizeAspectProxy implements BeanPostProcessor, ApplicationContextAware {
private ApplicationContext applicationContext;
private List<AbstractAdvisor> advisorList;
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
return bean;
}
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
buildAdvisor();
Map<Method, List<AbstractAdvisor>> matchAdvisorMap = matchAdvisor(bean);
if (matchAdvisorMap.isEmpty()) {
return bean;
} else {
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(bean.getClass());
enhancer.setNamingPolicy(SpringNamingPolicy.INSTANCE);
enhancer.setCallback(new MethodInterceptorImpl(matchAdvisorMap));
return enhancer.create();
}
}
private Map<Method, List<AbstractAdvisor>> matchAdvisor(Object bean) {
Class<?> beanClass = bean.getClass();
Method[] methods = beanClass.getMethods();
if (methods == null) {
return Collections.emptyMap();
}
Map<Method, List<AbstractAdvisor>> methodListMap = new HashMap<Method, List<AbstractAdvisor>>();
for (Method method : methods) {
for (AbstractAdvisor abstractAdvisor : advisorList) {
if (!abstractAdvisor.isMatch(bean.getClass(), method)) {
continue;
}
List<AbstractAdvisor> advisorList = methodListMap.get(method);
if (advisorList == null) {
advisorList = new LinkedList<AbstractAdvisor>();
methodListMap.put(method, advisorList);
}
advisorList.add(abstractAdvisor);
}
}
return methodListMap;
}
private void buildAdvisor() {
if (advisorList != null) {
return;
}
synchronized (this) {
if (advisorList != null) {
return;
}
String[] beanNames = applicationContext.getBeanDefinitionNames();
advisorList = new ArrayList<AbstractAdvisor>();
for (String beanName : beanNames) {
Class<?> beanClass = applicationContext.getType(beanName);
MyAspect myAspect = beanClass.getAnnotation(MyAspect.class);
if (myAspect == null) {
continue;
}
Method[] methods = beanClass.getDeclaredMethods();
if (methods == null) {
continue;
}
Object bean = applicationContext.getBean(beanName);
List<AbstractAdvisor> beanAdvisorList = new ArrayList<AbstractAdvisor>(methods.length);
for (Method method : methods) {
if (method.getName().equals("before")) {
beanAdvisorList.add(new MethodInvocation.BeforeAdvisor(bean, method));
} else if (method.getName().equals("around")) {
beanAdvisorList.add(new MethodInvocation.AroundAdvisor(bean, method));
} else if (method.getName().equals("after")) {
beanAdvisorList.add(new MethodInvocation.AfterAdvisor(bean, method));
}
}
advisorList.addAll(beanAdvisorList);
}
Collections.sort(advisorList, new Comparator<AbstractAdvisor>() {
public int compare(AbstractAdvisor o1, AbstractAdvisor o2) {
return o1.getOrder() - o2.getOrder();
}
});
}
}
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
}
| {
"pile_set_name": "Github"
} |
<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php $this->load->view($folder_themes.'/layouts/header.php');?>
<div id="contentwrapper">
<div id="contentcolumn">
<div class="innertube">
<?php
if($list_jawab){
echo "<div class='box'>";
$this->load->view($folder_themes.'/partials/analisis.php');
echo "</div>";
}else{ ?>
<div class="box box-primary">
<div class="box-header">
<h2 class="judul">DAFTAR AGREGASI DATA ANALISIS DESA</h2>
<h3>Klik untuk melihat lebih detail</h3>
</div>
<?php foreach($list_indikator AS $data){?>
<div class="box-header">
<a href="<?php echo site_url()?>first/data_analisis/<?php echo $data['id']?>/<?php echo $data['subjek_tipe']?>/<?php echo $data['id_periode']?>">
<h4><?php echo $data['indikator']?></h4>
</a>
</div>
<div class="box-body" style="font-size:12px;">
<table>
<tr>
<td width="100">Pendataan </td>
<td width="20"> :</td>
<td> <?php echo $data['master']?></td>
</tr>
<tr>
<td>Subjek </td>
<td> : </td>
<td> <?php echo $data['subjek']?></td>
</tr>
<tr>
<td>Tahun </td>
<td> :</td>
<td> <?php echo $data['tahun']?></td>
</tr>
</table>
</div>
<?php
}
} ?>
</div>
</div>
</div>
</div>
<div id="rightcolumn">
<div class="innertube">
<?php $this->load->view(Web_Controller::fallback_default($this->theme, '/partials/side.right.php'));?>
</div>
</div>
<div id="footer">
<?php
$this->load->view($folder_themes.'/partials/copywright.tpl.php');
?>
</div>
</div>
| {
"pile_set_name": "Github"
} |
golang-lru
==========
This provides the `lru` package which implements a fixed-size
thread safe LRU cache. It is based on the cache in Groupcache.
Documentation
=============
Full docs are available on [Godoc](http://godoc.org/github.com/hashicorp/golang-lru)
Example
=======
Using the LRU is very simple:
```go
l, _ := New(128)
for i := 0; i < 256; i++ {
l.Add(i, nil)
}
if l.Len() != 128 {
panic(fmt.Sprintf("bad len: %v", l.Len()))
}
```
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 2c32987c2bc01844a94adfb917dd677d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
/**
* @file
* Sequential API Internal module
*
*/
/*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR 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.
*
* This file is part of the lwIP TCP/IP stack.
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
#include "lwip/opt.h"
#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */
#include "lwip/api_msg.h"
#include "lwip/ip.h"
#include "lwip/udp.h"
#include "lwip/tcp.h"
#include "lwip/raw.h"
#include "lwip/memp.h"
#include "lwip/tcpip.h"
#include "lwip/igmp.h"
#include "lwip/dns.h"
#include "lwip/mld6.h"
#include <string.h>
#define SET_NONBLOCKING_CONNECT(conn, val) do { if(val) { \
(conn)->flags |= NETCONN_FLAG_IN_NONBLOCKING_CONNECT; \
} else { \
(conn)->flags &= ~ NETCONN_FLAG_IN_NONBLOCKING_CONNECT; }} while(0)
#define IN_NONBLOCKING_CONNECT(conn) (((conn)->flags & NETCONN_FLAG_IN_NONBLOCKING_CONNECT) != 0)
/* forward declarations */
#if LWIP_TCP
static err_t lwip_netconn_do_writemore(struct netconn *conn);
static void lwip_netconn_do_close_internal(struct netconn *conn);
#endif
#if LWIP_RAW
/**
* Receive callback function for RAW netconns.
* Doesn't 'eat' the packet, only references it and sends it to
* conn->recvmbox
*
* @see raw.h (struct raw_pcb.recv) for parameters and return value
*/
static u8_t
recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p,
ip_addr_t *addr)
{
struct pbuf *q;
struct netbuf *buf;
struct netconn *conn;
LWIP_UNUSED_ARG(addr);
conn = (struct netconn *)arg;
if ((conn != NULL) && sys_mbox_valid(&conn->recvmbox)) {
#if LWIP_SO_RCVBUF
int recv_avail;
SYS_ARCH_GET(conn->recv_avail, recv_avail);
if ((recv_avail + (int)(p->tot_len)) > conn->recv_bufsize) {
return 0;
}
#endif /* LWIP_SO_RCVBUF */
/* copy the whole packet into new pbufs */
q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM);
if(q != NULL) {
if (pbuf_copy(q, p) != ERR_OK) {
pbuf_free(q);
q = NULL;
}
}
if (q != NULL) {
u16_t len;
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
if (buf == NULL) {
pbuf_free(q);
return 0;
}
buf->p = q;
buf->ptr = q;
ipX_addr_copy(PCB_ISIPV6(pcb), buf->addr, *ipX_current_src_addr());
buf->port = pcb->protocol;
len = q->tot_len;
if (sys_mbox_trypost(&conn->recvmbox, buf) != ERR_OK) {
netbuf_delete(buf);
return 0;
} else {
#if LWIP_SO_RCVBUF
SYS_ARCH_INC(conn->recv_avail, len);
#endif /* LWIP_SO_RCVBUF */
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
}
}
}
return 0; /* do not eat the packet */
}
#endif /* LWIP_RAW*/
#if LWIP_UDP
/**
* Receive callback function for UDP netconns.
* Posts the packet to conn->recvmbox or deletes it on memory error.
*
* @see udp.h (struct udp_pcb.recv) for parameters
*/
static void
recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
ip_addr_t *addr, u16_t port)
{
struct netbuf *buf;
struct netconn *conn;
u16_t len;
#if LWIP_SO_RCVBUF
int recv_avail;
#endif /* LWIP_SO_RCVBUF */
LWIP_UNUSED_ARG(pcb); /* only used for asserts... */
LWIP_ASSERT("recv_udp must have a pcb argument", pcb != NULL);
LWIP_ASSERT("recv_udp must have an argument", arg != NULL);
conn = (struct netconn *)arg;
LWIP_ASSERT("recv_udp: recv for wrong pcb!", conn->pcb.udp == pcb);
#if LWIP_SO_RCVBUF
SYS_ARCH_GET(conn->recv_avail, recv_avail);
if ((conn == NULL) || !sys_mbox_valid(&conn->recvmbox) ||
((recv_avail + (int)(p->tot_len)) > conn->recv_bufsize)) {
#else /* LWIP_SO_RCVBUF */
if ((conn == NULL) || !sys_mbox_valid(&conn->recvmbox)) {
#endif /* LWIP_SO_RCVBUF */
pbuf_free(p);
return;
}
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
if (buf == NULL) {
pbuf_free(p);
return;
} else {
buf->p = p;
buf->ptr = p;
ipX_addr_set_ipaddr(ip_current_is_v6(), &buf->addr, addr);
buf->port = port;
#if LWIP_NETBUF_RECVINFO
{
/* get the UDP header - always in the first pbuf, ensured by udp_input */
const struct udp_hdr* udphdr = ipX_next_header_ptr();
#if LWIP_CHECKSUM_ON_COPY
buf->flags = NETBUF_FLAG_DESTADDR;
#endif /* LWIP_CHECKSUM_ON_COPY */
ipX_addr_set(ip_current_is_v6(), &buf->toaddr, ipX_current_dest_addr());
buf->toport_chksum = udphdr->dest;
}
#endif /* LWIP_NETBUF_RECVINFO */
}
len = p->tot_len;
if (sys_mbox_trypost(&conn->recvmbox, buf) != ERR_OK) {
netbuf_delete(buf);
return;
} else {
#if LWIP_SO_RCVBUF
SYS_ARCH_INC(conn->recv_avail, len);
#endif /* LWIP_SO_RCVBUF */
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
}
}
#endif /* LWIP_UDP */
#if LWIP_TCP
/**
* Receive callback function for TCP netconns.
* Posts the packet to conn->recvmbox, but doesn't delete it on errors.
*
* @see tcp.h (struct tcp_pcb.recv) for parameters and return value
*/
static err_t
recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
{
struct netconn *conn;
u16_t len;
LWIP_UNUSED_ARG(pcb);
LWIP_ASSERT("recv_tcp must have a pcb argument", pcb != NULL);
LWIP_ASSERT("recv_tcp must have an argument", arg != NULL);
conn = (struct netconn *)arg;
if (conn == NULL) {
return ERR_VAL;
}
LWIP_ASSERT("recv_tcp: recv for wrong pcb!", conn->pcb.tcp == pcb);
if (!sys_mbox_valid(&conn->recvmbox)) {
/* recvmbox already deleted */
if (p != NULL) {
tcp_recved(pcb, p->tot_len);
pbuf_free(p);
}
return ERR_OK;
}
/* Unlike for UDP or RAW pcbs, don't check for available space
using recv_avail since that could break the connection
(data is already ACKed) */
/* don't overwrite fatal errors! */
NETCONN_SET_SAFE_ERR(conn, err);
if (p != NULL) {
len = p->tot_len;
} else {
len = 0;
}
if (sys_mbox_trypost(&conn->recvmbox, p) != ERR_OK) {
/* don't deallocate p: it is presented to us later again from tcp_fasttmr! */
return ERR_MEM;
} else {
#if LWIP_SO_RCVBUF
SYS_ARCH_INC(conn->recv_avail, len);
#endif /* LWIP_SO_RCVBUF */
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, len);
}
return ERR_OK;
}
/**
* Poll callback function for TCP netconns.
* Wakes up an application thread that waits for a connection to close
* or data to be sent. The application thread then takes the
* appropriate action to go on.
*
* Signals the conn->sem.
* netconn_close waits for conn->sem if closing failed.
*
* @see tcp.h (struct tcp_pcb.poll) for parameters and return value
*/
static err_t
poll_tcp(void *arg, struct tcp_pcb *pcb)
{
struct netconn *conn = (struct netconn *)arg;
LWIP_UNUSED_ARG(pcb);
LWIP_ASSERT("conn != NULL", (conn != NULL));
if (conn->state == NETCONN_WRITE) {
lwip_netconn_do_writemore(conn);
} else if (conn->state == NETCONN_CLOSE) {
lwip_netconn_do_close_internal(conn);
}
/* @todo: implement connect timeout here? */
/* Did a nonblocking write fail before? Then check available write-space. */
if (conn->flags & NETCONN_FLAG_CHECK_WRITESPACE) {
/* If the queued byte- or pbuf-count drops below the configured low-water limit,
let select mark this pcb as writable again. */
if ((conn->pcb.tcp != NULL) && (tcp_sndbuf(conn->pcb.tcp) > TCP_SNDLOWAT) &&
(tcp_sndqueuelen(conn->pcb.tcp) < TCP_SNDQUEUELOWAT)) {
conn->flags &= ~NETCONN_FLAG_CHECK_WRITESPACE;
API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0);
}
}
return ERR_OK;
}
/**
* Sent callback function for TCP netconns.
* Signals the conn->sem and calls API_EVENT.
* netconn_write waits for conn->sem if send buffer is low.
*
* @see tcp.h (struct tcp_pcb.sent) for parameters and return value
*/
static err_t
sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len)
{
struct netconn *conn = (struct netconn *)arg;
LWIP_UNUSED_ARG(pcb);
LWIP_ASSERT("conn != NULL", (conn != NULL));
if (conn->state == NETCONN_WRITE) {
lwip_netconn_do_writemore(conn);
} else if (conn->state == NETCONN_CLOSE) {
lwip_netconn_do_close_internal(conn);
}
if (conn) {
/* If the queued byte- or pbuf-count drops below the configured low-water limit,
let select mark this pcb as writable again. */
if ((conn->pcb.tcp != NULL) && (tcp_sndbuf(conn->pcb.tcp) > TCP_SNDLOWAT) &&
(tcp_sndqueuelen(conn->pcb.tcp) < TCP_SNDQUEUELOWAT)) {
conn->flags &= ~NETCONN_FLAG_CHECK_WRITESPACE;
API_EVENT(conn, NETCONN_EVT_SENDPLUS, len);
}
}
return ERR_OK;
}
/**
* Error callback function for TCP netconns.
* Signals conn->sem, posts to all conn mboxes and calls API_EVENT.
* The application thread has then to decide what to do.
*
* @see tcp.h (struct tcp_pcb.err) for parameters
*/
static void
err_tcp(void *arg, err_t err)
{
struct netconn *conn;
enum netconn_state old_state;
SYS_ARCH_DECL_PROTECT(lev);
conn = (struct netconn *)arg;
LWIP_ASSERT("conn != NULL", (conn != NULL));
conn->pcb.tcp = NULL;
/* no check since this is always fatal! */
SYS_ARCH_PROTECT(lev);
conn->last_err = err;
SYS_ARCH_UNPROTECT(lev);
/* reset conn->state now before waking up other threads */
old_state = conn->state;
conn->state = NETCONN_NONE;
/* Notify the user layer about a connection error. Used to signal
select. */
API_EVENT(conn, NETCONN_EVT_ERROR, 0);
/* Try to release selects pending on 'read' or 'write', too.
They will get an error if they actually try to read or write. */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0);
API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0);
/* pass NULL-message to recvmbox to wake up pending recv */
if (sys_mbox_valid(&conn->recvmbox)) {
/* use trypost to prevent deadlock */
sys_mbox_trypost(&conn->recvmbox, NULL);
}
/* pass NULL-message to acceptmbox to wake up pending accept */
if (sys_mbox_valid(&conn->acceptmbox)) {
/* use trypost to preven deadlock */
sys_mbox_trypost(&conn->acceptmbox, NULL);
}
if ((old_state == NETCONN_WRITE) || (old_state == NETCONN_CLOSE) ||
(old_state == NETCONN_CONNECT)) {
/* calling lwip_netconn_do_writemore/lwip_netconn_do_close_internal is not necessary
since the pcb has already been deleted! */
int was_nonblocking_connect = IN_NONBLOCKING_CONNECT(conn);
SET_NONBLOCKING_CONNECT(conn, 0);
if (!was_nonblocking_connect) {
/* set error return code */
LWIP_ASSERT("conn->current_msg != NULL", conn->current_msg != NULL);
conn->current_msg->err = err;
conn->current_msg = NULL;
/* wake up the waiting task */
sys_sem_signal(&conn->op_completed);
}
} else {
LWIP_ASSERT("conn->current_msg == NULL", conn->current_msg == NULL);
}
}
/**
* Setup a tcp_pcb with the correct callback function pointers
* and their arguments.
*
* @param conn the TCP netconn to setup
*/
static void
setup_tcp(struct netconn *conn)
{
struct tcp_pcb *pcb;
pcb = conn->pcb.tcp;
tcp_arg(pcb, conn);
tcp_recv(pcb, recv_tcp);
tcp_sent(pcb, sent_tcp);
tcp_poll(pcb, poll_tcp, 4);
tcp_err(pcb, err_tcp);
}
/**
* Accept callback function for TCP netconns.
* Allocates a new netconn and posts that to conn->acceptmbox.
*
* @see tcp.h (struct tcp_pcb_listen.accept) for parameters and return value
*/
static err_t
accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
{
struct netconn *newconn;
struct netconn *conn = (struct netconn *)arg;
LWIP_DEBUGF(API_MSG_DEBUG, ("accept_function: newpcb->tate: %s\n", tcp_debug_state_str(newpcb->state)));
if (!sys_mbox_valid(&conn->acceptmbox)) {
LWIP_DEBUGF(API_MSG_DEBUG, ("accept_function: acceptmbox already deleted\n"));
return ERR_VAL;
}
/* We have to set the callback here even though
* the new socket is unknown. conn->socket is marked as -1. */
newconn = netconn_alloc(conn->type, conn->callback);
if (newconn == NULL) {
return ERR_MEM;
}
newconn->pcb.tcp = newpcb;
setup_tcp(newconn);
/* no protection: when creating the pcb, the netconn is not yet known
to the application thread */
newconn->last_err = err;
if (sys_mbox_trypost(&conn->acceptmbox, newconn) != ERR_OK) {
/* When returning != ERR_OK, the pcb is aborted in tcp_process(),
so do nothing here! */
/* remove all references to this netconn from the pcb */
struct tcp_pcb* pcb = newconn->pcb.tcp;
tcp_arg(pcb, NULL);
tcp_recv(pcb, NULL);
tcp_sent(pcb, NULL);
tcp_poll(pcb, NULL, 4);
tcp_err(pcb, NULL);
/* remove reference from to the pcb from this netconn */
newconn->pcb.tcp = NULL;
/* no need to drain since we know the recvmbox is empty. */
sys_mbox_free(&newconn->recvmbox);
sys_mbox_set_invalid(&newconn->recvmbox);
netconn_free(newconn);
return ERR_MEM;
} else {
/* Register event with callback */
API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0);
}
return ERR_OK;
}
#endif /* LWIP_TCP */
/**
* Create a new pcb of a specific type.
* Called from lwip_netconn_do_newconn().
*
* @param msg the api_msg_msg describing the connection type
* @return msg->conn->err, but the return value is currently ignored
*/
static void
pcb_new(struct api_msg_msg *msg)
{
LWIP_ASSERT("pcb_new: pcb already allocated", msg->conn->pcb.tcp == NULL);
/* Allocate a PCB for this connection */
switch(NETCONNTYPE_GROUP(msg->conn->type)) {
#if LWIP_RAW
case NETCONN_RAW:
msg->conn->pcb.raw = raw_new(msg->msg.n.proto);
if(msg->conn->pcb.raw != NULL) {
raw_recv(msg->conn->pcb.raw, recv_raw, msg->conn);
}
break;
#endif /* LWIP_RAW */
#if LWIP_UDP
case NETCONN_UDP:
msg->conn->pcb.udp = udp_new();
if(msg->conn->pcb.udp != NULL) {
#if LWIP_UDPLITE
if (NETCONNTYPE_ISUDPLITE(msg->conn->type)) {
udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_UDPLITE);
}
#endif /* LWIP_UDPLITE */
if (NETCONNTYPE_ISUDPNOCHKSUM(msg->conn->type)) {
udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_NOCHKSUM);
}
udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn);
}
break;
#endif /* LWIP_UDP */
#if LWIP_TCP
case NETCONN_TCP:
msg->conn->pcb.tcp = tcp_new();
if(msg->conn->pcb.tcp != NULL) {
setup_tcp(msg->conn);
}
break;
#endif /* LWIP_TCP */
default:
/* Unsupported netconn type, e.g. protocol disabled */
msg->err = ERR_VAL;
return;
}
if (msg->conn->pcb.ip == NULL) {
msg->err = ERR_MEM;
}
#if LWIP_IPV6
else {
if (NETCONNTYPE_ISIPV6(msg->conn->type)) {
ip_set_v6(msg->conn->pcb.ip, 1);
}
}
#endif /* LWIP_IPV6 */
}
/**
* Create a new pcb of a specific type inside a netconn.
* Called from netconn_new_with_proto_and_callback.
*
* @param msg the api_msg_msg describing the connection type
*/
void
lwip_netconn_do_newconn(struct api_msg_msg *msg)
{
msg->err = ERR_OK;
if(msg->conn->pcb.tcp == NULL) {
pcb_new(msg);
}
/* Else? This "new" connection already has a PCB allocated. */
/* Is this an error condition? Should it be deleted? */
/* We currently just are happy and return. */
TCPIP_APIMSG_ACK(msg);
}
/**
* Create a new netconn (of a specific type) that has a callback function.
* The corresponding pcb is NOT created!
*
* @param t the type of 'connection' to create (@see enum netconn_type)
* @param proto the IP protocol for RAW IP pcbs
* @param callback a function to call on status changes (RX available, TX'ed)
* @return a newly allocated struct netconn or
* NULL on memory error
*/
struct netconn*
netconn_alloc(enum netconn_type t, netconn_callback callback)
{
struct netconn *conn;
int size;
conn = (struct netconn *)memp_malloc(MEMP_NETCONN);
if (conn == NULL) {
return NULL;
}
conn->last_err = ERR_OK;
conn->type = t;
conn->pcb.tcp = NULL;
/* If all sizes are the same, every compiler should optimize this switch to nothing, */
switch(NETCONNTYPE_GROUP(t)) {
#if LWIP_RAW
case NETCONN_RAW:
size = DEFAULT_RAW_RECVMBOX_SIZE;
break;
#endif /* LWIP_RAW */
#if LWIP_UDP
case NETCONN_UDP:
size = DEFAULT_UDP_RECVMBOX_SIZE;
break;
#endif /* LWIP_UDP */
#if LWIP_TCP
case NETCONN_TCP:
size = DEFAULT_TCP_RECVMBOX_SIZE;
break;
#endif /* LWIP_TCP */
default:
LWIP_ASSERT("netconn_alloc: undefined netconn_type", 0);
goto free_and_return;
}
if (sys_sem_new(&conn->op_completed, 0) != ERR_OK) {
goto free_and_return;
}
if (sys_mbox_new(&conn->recvmbox, size) != ERR_OK) {
sys_sem_free(&conn->op_completed);
goto free_and_return;
}
#if LWIP_TCP
sys_mbox_set_invalid(&conn->acceptmbox);
#endif
conn->state = NETCONN_NONE;
#if LWIP_SOCKET
/* initialize socket to -1 since 0 is a valid socket */
conn->socket = -1;
#endif /* LWIP_SOCKET */
conn->callback = callback;
#if LWIP_TCP
conn->current_msg = NULL;
conn->write_offset = 0;
#endif /* LWIP_TCP */
#if LWIP_SO_SNDTIMEO
conn->send_timeout = 0;
#endif /* LWIP_SO_SNDTIMEO */
#if LWIP_SO_RCVTIMEO
conn->recv_timeout = 0;
#endif /* LWIP_SO_RCVTIMEO */
#if LWIP_SO_RCVBUF
conn->recv_bufsize = RECV_BUFSIZE_DEFAULT;
conn->recv_avail = 0;
#endif /* LWIP_SO_RCVBUF */
conn->flags = 0;
return conn;
free_and_return:
memp_free(MEMP_NETCONN, conn);
return NULL;
}
/**
* Delete a netconn and all its resources.
* The pcb is NOT freed (since we might not be in the right thread context do this).
*
* @param conn the netconn to free
*/
void
netconn_free(struct netconn *conn)
{
LWIP_ASSERT("PCB must be deallocated outside this function", conn->pcb.tcp == NULL);
LWIP_ASSERT("recvmbox must be deallocated before calling this function",
!sys_mbox_valid(&conn->recvmbox));
#if LWIP_TCP
LWIP_ASSERT("acceptmbox must be deallocated before calling this function",
!sys_mbox_valid(&conn->acceptmbox));
#endif /* LWIP_TCP */
sys_sem_free(&conn->op_completed);
sys_sem_set_invalid(&conn->op_completed);
memp_free(MEMP_NETCONN, conn);
}
/**
* Delete rcvmbox and acceptmbox of a netconn and free the left-over data in
* these mboxes
*
* @param conn the netconn to free
* @bytes_drained bytes drained from recvmbox
* @accepts_drained pending connections drained from acceptmbox
*/
static void
netconn_drain(struct netconn *conn)
{
void *mem;
#if LWIP_TCP
struct pbuf *p;
#endif /* LWIP_TCP */
/* This runs in tcpip_thread, so we don't need to lock against rx packets */
/* Delete and drain the recvmbox. */
if (sys_mbox_valid(&conn->recvmbox)) {
while (sys_mbox_tryfetch(&conn->recvmbox, &mem) != SYS_MBOX_EMPTY) {
#if LWIP_TCP
if (NETCONNTYPE_GROUP(conn->type) == NETCONN_TCP) {
if(mem != NULL) {
p = (struct pbuf*)mem;
/* pcb might be set to NULL already by err_tcp() */
if (conn->pcb.tcp != NULL) {
tcp_recved(conn->pcb.tcp, p->tot_len);
}
pbuf_free(p);
}
} else
#endif /* LWIP_TCP */
{
netbuf_delete((struct netbuf *)mem);
}
}
sys_mbox_free(&conn->recvmbox);
sys_mbox_set_invalid(&conn->recvmbox);
}
/* Delete and drain the acceptmbox. */
#if LWIP_TCP
if (sys_mbox_valid(&conn->acceptmbox)) {
while (sys_mbox_tryfetch(&conn->acceptmbox, &mem) != SYS_MBOX_EMPTY) {
struct netconn *newconn = (struct netconn *)mem;
/* Only tcp pcbs have an acceptmbox, so no need to check conn->type */
/* pcb might be set to NULL already by err_tcp() */
if (conn->pcb.tcp != NULL) {
tcp_accepted(conn->pcb.tcp);
}
/* drain recvmbox */
netconn_drain(newconn);
if (newconn->pcb.tcp != NULL) {
tcp_abort(newconn->pcb.tcp);
newconn->pcb.tcp = NULL;
}
netconn_free(newconn);
}
sys_mbox_free(&conn->acceptmbox);
sys_mbox_set_invalid(&conn->acceptmbox);
}
#endif /* LWIP_TCP */
}
#if LWIP_TCP
/**
* Internal helper function to close a TCP netconn: since this sometimes
* doesn't work at the first attempt, this function is called from multiple
* places.
*
* @param conn the TCP netconn to close
*/
static void
lwip_netconn_do_close_internal(struct netconn *conn)
{
err_t err;
u8_t shut, shut_rx, shut_tx, close;
LWIP_ASSERT("invalid conn", (conn != NULL));
LWIP_ASSERT("this is for tcp netconns only", (NETCONNTYPE_GROUP(conn->type) == NETCONN_TCP));
LWIP_ASSERT("conn must be in state NETCONN_CLOSE", (conn->state == NETCONN_CLOSE));
LWIP_ASSERT("pcb already closed", (conn->pcb.tcp != NULL));
LWIP_ASSERT("conn->current_msg != NULL", conn->current_msg != NULL);
shut = conn->current_msg->msg.sd.shut;
shut_rx = shut & NETCONN_SHUT_RD;
shut_tx = shut & NETCONN_SHUT_WR;
/* shutting down both ends is the same as closing */
close = shut == NETCONN_SHUT_RDWR;
/* Set back some callback pointers */
if (close) {
tcp_arg(conn->pcb.tcp, NULL);
}
if (conn->pcb.tcp->state == LISTEN) {
tcp_accept(conn->pcb.tcp, NULL);
} else {
/* some callbacks have to be reset if tcp_close is not successful */
if (shut_rx) {
tcp_recv(conn->pcb.tcp, NULL);
tcp_accept(conn->pcb.tcp, NULL);
}
if (shut_tx) {
tcp_sent(conn->pcb.tcp, NULL);
}
if (close) {
tcp_poll(conn->pcb.tcp, NULL, 4);
tcp_err(conn->pcb.tcp, NULL);
}
}
/* Try to close the connection */
if (close) {
err = tcp_close(conn->pcb.tcp);
} else {
err = tcp_shutdown(conn->pcb.tcp, shut_rx, shut_tx);
}
if (err == ERR_OK) {
/* Closing succeeded */
conn->current_msg->err = ERR_OK;
conn->current_msg = NULL;
conn->state = NETCONN_NONE;
if (close) {
/* Set back some callback pointers as conn is going away */
conn->pcb.tcp = NULL;
/* Trigger select() in socket layer. Make sure everybody notices activity
on the connection, error first! */
API_EVENT(conn, NETCONN_EVT_ERROR, 0);
}
if (shut_rx) {
API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0);
}
if (shut_tx) {
API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0);
}
/* wake up the application task */
sys_sem_signal(&conn->op_completed);
} else {
/* Closing failed, restore some of the callbacks */
/* Closing of listen pcb will never fail! */
LWIP_ASSERT("Closing a listen pcb may not fail!", (conn->pcb.tcp->state != LISTEN));
tcp_sent(conn->pcb.tcp, sent_tcp);
tcp_poll(conn->pcb.tcp, poll_tcp, 4);
tcp_err(conn->pcb.tcp, err_tcp);
tcp_arg(conn->pcb.tcp, conn);
/* don't restore recv callback: we don't want to receive any more data */
}
/* If closing didn't succeed, we get called again either
from poll_tcp or from sent_tcp */
}
#endif /* LWIP_TCP */
/**
* Delete the pcb inside a netconn.
* Called from netconn_delete.
*
* @param msg the api_msg_msg pointing to the connection
*/
void
lwip_netconn_do_delconn(struct api_msg_msg *msg)
{
/* @todo TCP: abort running write/connect? */
if ((msg->conn->state != NETCONN_NONE) &&
(msg->conn->state != NETCONN_LISTEN) &&
(msg->conn->state != NETCONN_CONNECT)) {
/* this only happens for TCP netconns */
LWIP_ASSERT("NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP",
NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP);
msg->err = ERR_INPROGRESS;
} else {
LWIP_ASSERT("blocking connect in progress",
(msg->conn->state != NETCONN_CONNECT) || IN_NONBLOCKING_CONNECT(msg->conn));
/* Drain and delete mboxes */
netconn_drain(msg->conn);
if (msg->conn->pcb.tcp != NULL) {
switch (NETCONNTYPE_GROUP(msg->conn->type)) {
#if LWIP_RAW
case NETCONN_RAW:
raw_remove(msg->conn->pcb.raw);
break;
#endif /* LWIP_RAW */
#if LWIP_UDP
case NETCONN_UDP:
msg->conn->pcb.udp->recv_arg = NULL;
udp_remove(msg->conn->pcb.udp);
break;
#endif /* LWIP_UDP */
#if LWIP_TCP
case NETCONN_TCP:
LWIP_ASSERT("already writing or closing", msg->conn->current_msg == NULL &&
msg->conn->write_offset == 0);
msg->conn->state = NETCONN_CLOSE;
msg->msg.sd.shut = NETCONN_SHUT_RDWR;
msg->conn->current_msg = msg;
lwip_netconn_do_close_internal(msg->conn);
/* API_EVENT is called inside lwip_netconn_do_close_internal, before releasing
the application thread, so we can return at this point! */
return;
#endif /* LWIP_TCP */
default:
break;
}
msg->conn->pcb.tcp = NULL;
}
/* tcp netconns don't come here! */
/* @todo: this lets select make the socket readable and writable,
which is wrong! errfd instead? */
API_EVENT(msg->conn, NETCONN_EVT_RCVPLUS, 0);
API_EVENT(msg->conn, NETCONN_EVT_SENDPLUS, 0);
}
if (sys_sem_valid(&msg->conn->op_completed)) {
sys_sem_signal(&msg->conn->op_completed);
}
}
/**
* Bind a pcb contained in a netconn
* Called from netconn_bind.
*
* @param msg the api_msg_msg pointing to the connection and containing
* the IP address and port to bind to
*/
void
lwip_netconn_do_bind(struct api_msg_msg *msg)
{
if (ERR_IS_FATAL(msg->conn->last_err)) {
msg->err = msg->conn->last_err;
} else {
msg->err = ERR_VAL;
if (msg->conn->pcb.tcp != NULL) {
switch (NETCONNTYPE_GROUP(msg->conn->type)) {
#if LWIP_RAW
case NETCONN_RAW:
msg->err = raw_bind(msg->conn->pcb.raw, API_EXPR_REF(msg->msg.bc.ipaddr));
break;
#endif /* LWIP_RAW */
#if LWIP_UDP
case NETCONN_UDP:
msg->err = udp_bind(msg->conn->pcb.udp, API_EXPR_REF(msg->msg.bc.ipaddr), msg->msg.bc.port);
break;
#endif /* LWIP_UDP */
#if LWIP_TCP
case NETCONN_TCP:
msg->err = tcp_bind(msg->conn->pcb.tcp, API_EXPR_REF(msg->msg.bc.ipaddr), msg->msg.bc.port);
break;
#endif /* LWIP_TCP */
default:
break;
}
}
}
TCPIP_APIMSG_ACK(msg);
}
#if LWIP_TCP
/**
* TCP callback function if a connection (opened by tcp_connect/lwip_netconn_do_connect) has
* been established (or reset by the remote host).
*
* @see tcp.h (struct tcp_pcb.connected) for parameters and return values
*/
static err_t
lwip_netconn_do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
{
struct netconn *conn;
int was_blocking;
LWIP_UNUSED_ARG(pcb);
conn = (struct netconn *)arg;
if (conn == NULL) {
return ERR_VAL;
}
LWIP_ASSERT("conn->state == NETCONN_CONNECT", conn->state == NETCONN_CONNECT);
LWIP_ASSERT("(conn->current_msg != NULL) || conn->in_non_blocking_connect",
(conn->current_msg != NULL) || IN_NONBLOCKING_CONNECT(conn));
if (conn->current_msg != NULL) {
conn->current_msg->err = err;
}
if ((NETCONNTYPE_GROUP(conn->type) == NETCONN_TCP) && (err == ERR_OK)) {
setup_tcp(conn);
}
was_blocking = !IN_NONBLOCKING_CONNECT(conn);
SET_NONBLOCKING_CONNECT(conn, 0);
conn->current_msg = NULL;
conn->state = NETCONN_NONE;
if (!was_blocking) {
NETCONN_SET_SAFE_ERR(conn, ERR_OK);
}
API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0);
if (was_blocking) {
sys_sem_signal(&conn->op_completed);
}
return ERR_OK;
}
#endif /* LWIP_TCP */
/**
* Connect a pcb contained inside a netconn
* Called from netconn_connect.
*
* @param msg the api_msg_msg pointing to the connection and containing
* the IP address and port to connect to
*/
void
lwip_netconn_do_connect(struct api_msg_msg *msg)
{
if (msg->conn->pcb.tcp == NULL) {
/* This may happen when calling netconn_connect() a second time */
msg->err = ERR_CLSD;
if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP) {
/* For TCP, netconn_connect() calls tcpip_apimsg(), so signal op_completed here. */
sys_sem_signal(&msg->conn->op_completed);
return;
}
} else {
switch (NETCONNTYPE_GROUP(msg->conn->type)) {
#if LWIP_RAW
case NETCONN_RAW:
msg->err = raw_connect(msg->conn->pcb.raw, API_EXPR_REF(msg->msg.bc.ipaddr));
break;
#endif /* LWIP_RAW */
#if LWIP_UDP
case NETCONN_UDP:
msg->err = udp_connect(msg->conn->pcb.udp, API_EXPR_REF(msg->msg.bc.ipaddr), msg->msg.bc.port);
break;
#endif /* LWIP_UDP */
#if LWIP_TCP
case NETCONN_TCP:
/* Prevent connect while doing any other action. */
if (msg->conn->state != NETCONN_NONE) {
msg->err = ERR_ISCONN;
} else {
setup_tcp(msg->conn);
msg->err = tcp_connect(msg->conn->pcb.tcp, API_EXPR_REF(msg->msg.bc.ipaddr),
msg->msg.bc.port, lwip_netconn_do_connected);
if (msg->err == ERR_OK) {
u8_t non_blocking = netconn_is_nonblocking(msg->conn);
msg->conn->state = NETCONN_CONNECT;
SET_NONBLOCKING_CONNECT(msg->conn, non_blocking);
if (non_blocking) {
msg->err = ERR_INPROGRESS;
} else {
msg->conn->current_msg = msg;
/* sys_sem_signal() is called from lwip_netconn_do_connected (or err_tcp()),
* when the connection is established! */
return;
}
}
}
/* For TCP, netconn_connect() calls tcpip_apimsg(), so signal op_completed here. */
sys_sem_signal(&msg->conn->op_completed);
return;
#endif /* LWIP_TCP */
default:
LWIP_ERROR("Invalid netconn type", 0, do{ msg->err = ERR_VAL; }while(0));
break;
}
}
/* For all other protocols, netconn_connect() calls TCPIP_APIMSG(),
so use TCPIP_APIMSG_ACK() here. */
TCPIP_APIMSG_ACK(msg);
}
/**
* Connect a pcb contained inside a netconn
* Only used for UDP netconns.
* Called from netconn_disconnect.
*
* @param msg the api_msg_msg pointing to the connection to disconnect
*/
void
lwip_netconn_do_disconnect(struct api_msg_msg *msg)
{
#if LWIP_UDP
if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_UDP) {
udp_disconnect(msg->conn->pcb.udp);
msg->err = ERR_OK;
} else
#endif /* LWIP_UDP */
{
msg->err = ERR_VAL;
}
TCPIP_APIMSG_ACK(msg);
}
#if LWIP_TCP
/**
* Set a TCP pcb contained in a netconn into listen mode
* Called from netconn_listen.
*
* @param msg the api_msg_msg pointing to the connection
*/
void
lwip_netconn_do_listen(struct api_msg_msg *msg)
{
if (ERR_IS_FATAL(msg->conn->last_err)) {
msg->err = msg->conn->last_err;
} else {
msg->err = ERR_CONN;
if (msg->conn->pcb.tcp != NULL) {
if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP) {
if (msg->conn->state == NETCONN_NONE) {
struct tcp_pcb* lpcb;
#if LWIP_IPV6
if ((msg->conn->flags & NETCONN_FLAG_IPV6_V6ONLY) == 0) {
#if TCP_LISTEN_BACKLOG
lpcb = tcp_listen_dual_with_backlog(msg->conn->pcb.tcp, msg->msg.lb.backlog);
#else /* TCP_LISTEN_BACKLOG */
lpcb = tcp_listen_dual(msg->conn->pcb.tcp);
#endif /* TCP_LISTEN_BACKLOG */
} else
#endif /* LWIP_IPV6 */
{
#if TCP_LISTEN_BACKLOG
lpcb = tcp_listen_with_backlog(msg->conn->pcb.tcp, msg->msg.lb.backlog);
#else /* TCP_LISTEN_BACKLOG */
lpcb = tcp_listen(msg->conn->pcb.tcp);
#endif /* TCP_LISTEN_BACKLOG */
}
if (lpcb == NULL) {
/* in this case, the old pcb is still allocated */
msg->err = ERR_MEM;
} else {
/* delete the recvmbox and allocate the acceptmbox */
if (sys_mbox_valid(&msg->conn->recvmbox)) {
/** @todo: should we drain the recvmbox here? */
sys_mbox_free(&msg->conn->recvmbox);
sys_mbox_set_invalid(&msg->conn->recvmbox);
}
msg->err = ERR_OK;
if (!sys_mbox_valid(&msg->conn->acceptmbox)) {
msg->err = sys_mbox_new(&msg->conn->acceptmbox, DEFAULT_ACCEPTMBOX_SIZE);
}
if (msg->err == ERR_OK) {
msg->conn->state = NETCONN_LISTEN;
msg->conn->pcb.tcp = lpcb;
tcp_arg(msg->conn->pcb.tcp, msg->conn);
tcp_accept(msg->conn->pcb.tcp, accept_function);
} else {
/* since the old pcb is already deallocated, free lpcb now */
tcp_close(lpcb);
msg->conn->pcb.tcp = NULL;
}
}
}
} else {
msg->err = ERR_ARG;
}
}
}
TCPIP_APIMSG_ACK(msg);
}
#endif /* LWIP_TCP */
/**
* Send some data on a RAW or UDP pcb contained in a netconn
* Called from netconn_send
*
* @param msg the api_msg_msg pointing to the connection
*/
void
lwip_netconn_do_send(struct api_msg_msg *msg)
{
if (ERR_IS_FATAL(msg->conn->last_err)) {
msg->err = msg->conn->last_err;
} else {
msg->err = ERR_CONN;
if (msg->conn->pcb.tcp != NULL) {
switch (NETCONNTYPE_GROUP(msg->conn->type)) {
#if LWIP_RAW
case NETCONN_RAW:
if (ipX_addr_isany(PCB_ISIPV6(msg->conn->pcb.ip), &msg->msg.b->addr)) {
msg->err = raw_send(msg->conn->pcb.raw, msg->msg.b->p);
} else {
msg->err = raw_sendto(msg->conn->pcb.raw, msg->msg.b->p, ipX_2_ip(&msg->msg.b->addr));
}
break;
#endif
#if LWIP_UDP
case NETCONN_UDP:
#if LWIP_CHECKSUM_ON_COPY
if (ipX_addr_isany(PCB_ISIPV6(msg->conn->pcb.ip), &msg->msg.b->addr)) {
msg->err = udp_send_chksum(msg->conn->pcb.udp, msg->msg.b->p,
msg->msg.b->flags & NETBUF_FLAG_CHKSUM, msg->msg.b->toport_chksum);
} else {
msg->err = udp_sendto_chksum(msg->conn->pcb.udp, msg->msg.b->p,
ipX_2_ip(&msg->msg.b->addr), msg->msg.b->port,
msg->msg.b->flags & NETBUF_FLAG_CHKSUM, msg->msg.b->toport_chksum);
}
#else /* LWIP_CHECKSUM_ON_COPY */
if (ipX_addr_isany(PCB_ISIPV6(msg->conn->pcb.ip), &msg->msg.b->addr)) {
msg->err = udp_send(msg->conn->pcb.udp, msg->msg.b->p);
} else {
msg->err = udp_sendto(msg->conn->pcb.udp, msg->msg.b->p, ipX_2_ip(&msg->msg.b->addr), msg->msg.b->port);
}
#endif /* LWIP_CHECKSUM_ON_COPY */
break;
#endif /* LWIP_UDP */
default:
break;
}
}
}
TCPIP_APIMSG_ACK(msg);
}
#if LWIP_TCP
/**
* Indicate data has been received from a TCP pcb contained in a netconn
* Called from netconn_recv
*
* @param msg the api_msg_msg pointing to the connection
*/
void
lwip_netconn_do_recv(struct api_msg_msg *msg)
{
msg->err = ERR_OK;
if (msg->conn->pcb.tcp != NULL) {
if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP) {
#if TCP_LISTEN_BACKLOG
if (msg->conn->pcb.tcp->state == LISTEN) {
tcp_accepted(msg->conn->pcb.tcp);
} else
#endif /* TCP_LISTEN_BACKLOG */
{
u32_t remaining = msg->msg.r.len;
do {
u16_t recved = (remaining > 0xffff) ? 0xffff : (u16_t)remaining;
tcp_recved(msg->conn->pcb.tcp, recved);
remaining -= recved;
}while(remaining != 0);
}
}
}
TCPIP_APIMSG_ACK(msg);
}
/**
* See if more data needs to be written from a previous call to netconn_write.
* Called initially from lwip_netconn_do_write. If the first call can't send all data
* (because of low memory or empty send-buffer), this function is called again
* from sent_tcp() or poll_tcp() to send more data. If all data is sent, the
* blocking application thread (waiting in netconn_write) is released.
*
* @param conn netconn (that is currently in state NETCONN_WRITE) to process
* @return ERR_OK
* ERR_MEM if LWIP_TCPIP_CORE_LOCKING=1 and sending hasn't yet finished
*/
static err_t
lwip_netconn_do_writemore(struct netconn *conn)
{
err_t err;
void *dataptr;
u16_t len, available;
u8_t write_finished = 0;
size_t diff;
u8_t dontblock;
u8_t apiflags;
LWIP_ASSERT("conn != NULL", conn != NULL);
LWIP_ASSERT("conn->state == NETCONN_WRITE", (conn->state == NETCONN_WRITE));
LWIP_ASSERT("conn->current_msg != NULL", conn->current_msg != NULL);
LWIP_ASSERT("conn->pcb.tcp != NULL", conn->pcb.tcp != NULL);
LWIP_ASSERT("conn->write_offset < conn->current_msg->msg.w.len",
conn->write_offset < conn->current_msg->msg.w.len);
dontblock = netconn_is_nonblocking(conn) ||
(conn->current_msg->msg.w.apiflags & NETCONN_DONTBLOCK);
apiflags = conn->current_msg->msg.w.apiflags;
#if LWIP_SO_SNDTIMEO
if ((conn->send_timeout != 0) &&
((s32_t)(sys_now() - conn->current_msg->msg.w.time_started) >= conn->send_timeout)) {
write_finished = 1;
if (conn->write_offset == 0) {
/* nothing has been written */
err = ERR_WOULDBLOCK;
conn->current_msg->msg.w.len = 0;
} else {
/* partial write */
err = ERR_OK;
conn->current_msg->msg.w.len = conn->write_offset;
conn->write_offset = 0;
}
} else
#endif /* LWIP_SO_SNDTIMEO */
{
dataptr = (u8_t*)conn->current_msg->msg.w.dataptr + conn->write_offset;
diff = conn->current_msg->msg.w.len - conn->write_offset;
if (diff > 0xffffUL) { /* max_u16_t */
len = 0xffff;
#if LWIP_TCPIP_CORE_LOCKING
conn->flags |= NETCONN_FLAG_WRITE_DELAYED;
#endif
apiflags |= TCP_WRITE_FLAG_MORE;
} else {
len = (u16_t)diff;
}
available = tcp_sndbuf(conn->pcb.tcp);
if (available < len) {
/* don't try to write more than sendbuf */
len = available;
if (dontblock){
if (!len) {
err = ERR_WOULDBLOCK;
goto err_mem;
}
} else {
#if LWIP_TCPIP_CORE_LOCKING
conn->flags |= NETCONN_FLAG_WRITE_DELAYED;
#endif
apiflags |= TCP_WRITE_FLAG_MORE;
}
}
LWIP_ASSERT("lwip_netconn_do_writemore: invalid length!", ((conn->write_offset + len) <= conn->current_msg->msg.w.len));
err = tcp_write(conn->pcb.tcp, dataptr, len, apiflags);
/* if OK or memory error, check available space */
if ((err == ERR_OK) || (err == ERR_MEM)) {
err_mem:
if (dontblock && (len < conn->current_msg->msg.w.len)) {
/* non-blocking write did not write everything: mark the pcb non-writable
and let poll_tcp check writable space to mark the pcb writable again */
API_EVENT(conn, NETCONN_EVT_SENDMINUS, len);
conn->flags |= NETCONN_FLAG_CHECK_WRITESPACE;
} else if ((tcp_sndbuf(conn->pcb.tcp) <= TCP_SNDLOWAT) ||
(tcp_sndqueuelen(conn->pcb.tcp) >= TCP_SNDQUEUELOWAT)) {
/* The queued byte- or pbuf-count exceeds the configured low-water limit,
let select mark this pcb as non-writable. */
API_EVENT(conn, NETCONN_EVT_SENDMINUS, len);
}
}
if (err == ERR_OK) {
conn->write_offset += len;
if ((conn->write_offset == conn->current_msg->msg.w.len) || dontblock) {
/* return sent length */
conn->current_msg->msg.w.len = conn->write_offset;
/* everything was written */
write_finished = 1;
conn->write_offset = 0;
}
tcp_output(conn->pcb.tcp);
} else if ((err == ERR_MEM) && !dontblock) {
/* If ERR_MEM, we wait for sent_tcp or poll_tcp to be called
we do NOT return to the application thread, since ERR_MEM is
only a temporary error! */
/* tcp_write returned ERR_MEM, try tcp_output anyway */
tcp_output(conn->pcb.tcp);
#if LWIP_TCPIP_CORE_LOCKING
conn->flags |= NETCONN_FLAG_WRITE_DELAYED;
#endif
} else {
/* On errors != ERR_MEM, we don't try writing any more but return
the error to the application thread. */
write_finished = 1;
conn->current_msg->msg.w.len = 0;
}
}
if (write_finished) {
/* everything was written: set back connection state
and back to application task */
conn->current_msg->err = err;
conn->current_msg = NULL;
conn->state = NETCONN_NONE;
#if LWIP_TCPIP_CORE_LOCKING
if ((conn->flags & NETCONN_FLAG_WRITE_DELAYED) != 0)
#endif
{
sys_sem_signal(&conn->op_completed);
}
}
#if LWIP_TCPIP_CORE_LOCKING
else
return ERR_MEM;
#endif
return ERR_OK;
}
#endif /* LWIP_TCP */
/**
* Send some data on a TCP pcb contained in a netconn
* Called from netconn_write
*
* @param msg the api_msg_msg pointing to the connection
*/
void
lwip_netconn_do_write(struct api_msg_msg *msg)
{
if (ERR_IS_FATAL(msg->conn->last_err)) {
msg->err = msg->conn->last_err;
} else {
if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP) {
#if LWIP_TCP
if (msg->conn->state != NETCONN_NONE) {
/* netconn is connecting, closing or in blocking write */
msg->err = ERR_INPROGRESS;
} else if (msg->conn->pcb.tcp != NULL) {
msg->conn->state = NETCONN_WRITE;
/* set all the variables used by lwip_netconn_do_writemore */
LWIP_ASSERT("already writing or closing", msg->conn->current_msg == NULL &&
msg->conn->write_offset == 0);
LWIP_ASSERT("msg->msg.w.len != 0", msg->msg.w.len != 0);
msg->conn->current_msg = msg;
msg->conn->write_offset = 0;
#if LWIP_TCPIP_CORE_LOCKING
msg->conn->flags &= ~NETCONN_FLAG_WRITE_DELAYED;
if (lwip_netconn_do_writemore(msg->conn) != ERR_OK) {
LWIP_ASSERT("state!", msg->conn->state == NETCONN_WRITE);
UNLOCK_TCPIP_CORE();
sys_arch_sem_wait(&msg->conn->op_completed, 0);
LOCK_TCPIP_CORE();
LWIP_ASSERT("state!", msg->conn->state == NETCONN_NONE);
}
#else /* LWIP_TCPIP_CORE_LOCKING */
lwip_netconn_do_writemore(msg->conn);
#endif /* LWIP_TCPIP_CORE_LOCKING */
/* for both cases: if lwip_netconn_do_writemore was called, don't ACK the APIMSG
since lwip_netconn_do_writemore ACKs it! */
return;
} else {
msg->err = ERR_CONN;
}
#else /* LWIP_TCP */
msg->err = ERR_VAL;
#endif /* LWIP_TCP */
#if (LWIP_UDP || LWIP_RAW)
} else {
msg->err = ERR_VAL;
#endif /* (LWIP_UDP || LWIP_RAW) */
}
}
TCPIP_APIMSG_ACK(msg);
}
/**
* Return a connection's local or remote address
* Called from netconn_getaddr
*
* @param msg the api_msg_msg pointing to the connection
*/
void
lwip_netconn_do_getaddr(struct api_msg_msg *msg)
{
if (msg->conn->pcb.ip != NULL) {
if (msg->msg.ad.local) {
ipX_addr_copy(PCB_ISIPV6(msg->conn->pcb.ip), API_EXPR_DEREF(msg->msg.ad.ipaddr),
msg->conn->pcb.ip->local_ip);
} else {
ipX_addr_copy(PCB_ISIPV6(msg->conn->pcb.ip), API_EXPR_DEREF(msg->msg.ad.ipaddr),
msg->conn->pcb.ip->remote_ip);
}
msg->err = ERR_OK;
switch (NETCONNTYPE_GROUP(msg->conn->type)) {
#if LWIP_RAW
case NETCONN_RAW:
if (msg->msg.ad.local) {
API_EXPR_DEREF(msg->msg.ad.port) = msg->conn->pcb.raw->protocol;
} else {
/* return an error as connecting is only a helper for upper layers */
msg->err = ERR_CONN;
}
break;
#endif /* LWIP_RAW */
#if LWIP_UDP
case NETCONN_UDP:
if (msg->msg.ad.local) {
API_EXPR_DEREF(msg->msg.ad.port) = msg->conn->pcb.udp->local_port;
} else {
if ((msg->conn->pcb.udp->flags & UDP_FLAGS_CONNECTED) == 0) {
msg->err = ERR_CONN;
} else {
API_EXPR_DEREF(msg->msg.ad.port) = msg->conn->pcb.udp->remote_port;
}
}
break;
#endif /* LWIP_UDP */
#if LWIP_TCP
case NETCONN_TCP:
if ((msg->msg.ad.local == 0) &&
((msg->conn->pcb.tcp->state == CLOSED) || (msg->conn->pcb.tcp->state == LISTEN))) {
/* pcb is not connected and remote name is requested */
msg->err = ERR_CONN;
} else {
API_EXPR_DEREF(msg->msg.ad.port) = (msg->msg.ad.local ? msg->conn->pcb.tcp->local_port : msg->conn->pcb.tcp->remote_port);
}
break;
#endif /* LWIP_TCP */
default:
LWIP_ASSERT("invalid netconn_type", 0);
break;
}
} else {
msg->err = ERR_CONN;
}
TCPIP_APIMSG_ACK(msg);
}
/**
* Close a TCP pcb contained in a netconn
* Called from netconn_close
*
* @param msg the api_msg_msg pointing to the connection
*/
void
lwip_netconn_do_close(struct api_msg_msg *msg)
{
#if LWIP_TCP
/* @todo: abort running write/connect? */
if ((msg->conn->state != NETCONN_NONE) && (msg->conn->state != NETCONN_LISTEN)) {
/* this only happens for TCP netconns */
LWIP_ASSERT("NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP",
NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP);
msg->err = ERR_INPROGRESS;
} else if ((msg->conn->pcb.tcp != NULL) && (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP)) {
if ((msg->msg.sd.shut != NETCONN_SHUT_RDWR) && (msg->conn->state == NETCONN_LISTEN)) {
/* LISTEN doesn't support half shutdown */
msg->err = ERR_CONN;
} else {
if (msg->msg.sd.shut & NETCONN_SHUT_RD) {
/* Drain and delete mboxes */
netconn_drain(msg->conn);
}
LWIP_ASSERT("already writing or closing", msg->conn->current_msg == NULL &&
msg->conn->write_offset == 0);
msg->conn->state = NETCONN_CLOSE;
msg->conn->current_msg = msg;
lwip_netconn_do_close_internal(msg->conn);
/* for tcp netconns, lwip_netconn_do_close_internal ACKs the message */
return;
}
} else
#endif /* LWIP_TCP */
{
msg->err = ERR_VAL;
}
sys_sem_signal(&msg->conn->op_completed);
}
#if LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD)
/**
* Join multicast groups for UDP netconns.
* Called from netconn_join_leave_group
*
* @param msg the api_msg_msg pointing to the connection
*/
void
lwip_netconn_do_join_leave_group(struct api_msg_msg *msg)
{
if (ERR_IS_FATAL(msg->conn->last_err)) {
msg->err = msg->conn->last_err;
} else {
if (msg->conn->pcb.tcp != NULL) {
if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_UDP) {
#if LWIP_UDP
#if LWIP_IPV6 && LWIP_IPV6_MLD
if (PCB_ISIPV6(msg->conn->pcb.udp)) {
if (msg->msg.jl.join_or_leave == NETCONN_JOIN) {
msg->err = mld6_joingroup(ipX_2_ip6(API_EXPR_REF(msg->msg.jl.netif_addr)),
ipX_2_ip6(API_EXPR_REF(msg->msg.jl.multiaddr)));
} else {
msg->err = mld6_leavegroup(ipX_2_ip6(API_EXPR_REF(msg->msg.jl.netif_addr)),
ipX_2_ip6(API_EXPR_REF(msg->msg.jl.multiaddr)));
}
}
else
#endif /* LWIP_IPV6 && LWIP_IPV6_MLD */
{
#if LWIP_IGMP
if (msg->msg.jl.join_or_leave == NETCONN_JOIN) {
msg->err = igmp_joingroup(ipX_2_ip(API_EXPR_REF(msg->msg.jl.netif_addr)),
ipX_2_ip(API_EXPR_REF(msg->msg.jl.multiaddr)));
} else {
msg->err = igmp_leavegroup(ipX_2_ip(API_EXPR_REF(msg->msg.jl.netif_addr)),
ipX_2_ip(API_EXPR_REF(msg->msg.jl.multiaddr)));
}
#endif /* LWIP_IGMP */
}
#endif /* LWIP_UDP */
#if (LWIP_TCP || LWIP_RAW)
} else {
msg->err = ERR_VAL;
#endif /* (LWIP_TCP || LWIP_RAW) */
}
} else {
msg->err = ERR_CONN;
}
}
TCPIP_APIMSG_ACK(msg);
}
#endif /* LWIP_IGMP || (LWIP_IPV6 && LWIP_IPV6_MLD) */
#if LWIP_DNS
/**
* Callback function that is called when DNS name is resolved
* (or on timeout). A waiting application thread is waked up by
* signaling the semaphore.
*/
static void
lwip_netconn_do_dns_found(const char *name, ip_addr_t *ipaddr, void *arg)
{
struct dns_api_msg *msg = (struct dns_api_msg*)arg;
LWIP_ASSERT("DNS response for wrong host name", strcmp(msg->name, name) == 0);
LWIP_UNUSED_ARG(name);
if (ipaddr == NULL) {
/* timeout or memory error */
API_EXPR_DEREF(msg->err) = ERR_VAL;
} else {
/* address was resolved */
API_EXPR_DEREF(msg->err) = ERR_OK;
API_EXPR_DEREF(msg->addr) = *ipaddr;
}
/* wake up the application task waiting in netconn_gethostbyname */
sys_sem_signal(API_EXPR_REF(msg->sem));
}
/**
* Execute a DNS query
* Called from netconn_gethostbyname
*
* @param arg the dns_api_msg pointing to the query
*/
void
lwip_netconn_do_gethostbyname(void *arg)
{
struct dns_api_msg *msg = (struct dns_api_msg*)arg;
API_EXPR_DEREF(msg->err) = dns_gethostbyname(msg->name, API_EXPR_REF(msg->addr), lwip_netconn_do_dns_found, msg);
if (API_EXPR_DEREF(msg->err) != ERR_INPROGRESS) {
/* on error or immediate success, wake up the application
* task waiting in netconn_gethostbyname */
sys_sem_signal(API_EXPR_REF(msg->sem));
}
}
#endif /* LWIP_DNS */
#endif /* LWIP_NETCONN */
| {
"pile_set_name": "Github"
} |
;;; jura.el --- AUCTeX style for `jura.cls'
;; Copyright (C) 2004 Free Software Foundation, Inc.
;; Author: Frank Küster <frank@kuesterei.ch>
;; Maintainer: auctex-devel@gnu.org
;; Keywords: tex
;; This file is part of AUCTeX.
;; AUCTeX 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, or (at your option)
;; any later version.
;; AUCTeX 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 AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Commentary:
;; This file adds support for `jura.cls'.
;;; Code:
(TeX-add-style-hook
"jura"
(lambda ()
(TeX-run-style-hooks "alphanum")))
;; Local Variables:
;; coding: iso-8859-1
;; End:
| {
"pile_set_name": "Github"
} |
/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
/*
FUNCTION
<<fdim>>, <<fdimf>>--positive difference
INDEX
fdim
INDEX
fdimf
ANSI_SYNOPSIS
#include <math.h>
double fdim(double <[x]>, double <[y]>);
float fdimf(float <[x]>, float <[y]>);
DESCRIPTION
The <<fdim>> functions determine the positive difference between their
arguments, returning:
. <[x]> - <[y]> if <[x]> > <[y]>, or
@ifnottex
. +0 if <[x]> <= <[y]>, or
@end ifnottex
@tex
. +0 if <[x]> $\leq$ <[y]>, or
@end tex
. NAN if either argument is NAN.
A range error may occur.
RETURNS
The <<fdim>> functions return the positive difference value.
PORTABILITY
ANSI C, POSIX.
*/
#include "fdlibm.h"
#ifndef _DOUBLE_IS_32BITS
#ifdef __STDC__
double fdim(double x, double y)
#else
double fdim(x,y)
double x;
double y;
#endif
{
int c = __fpclassifyd(x);
if (c == FP_NAN) return(x);
if (__fpclassifyd(y) == FP_NAN) return(y);
if (c == FP_INFINITE)
return HUGE_VAL;
return x > y ? x - y : 0.0;
}
#endif /* _DOUBLE_IS_32BITS */
| {
"pile_set_name": "Github"
} |
/******************************************************************************
* Spine Runtimes License Agreement
* Last updated May 1, 2019. Replaces all prior versions.
*
* Copyright (c) 2013-2019, Esoteric Software LLC
*
* Integration of the Spine Runtimes into software or otherwise creating
* derivative works of the Spine Runtimes is permitted under the terms and
* conditions of Section 2 of the Spine Editor License Agreement:
* http://esotericsoftware.com/spine-editor-license
*
* Otherwise, it is permitted to integrate the Spine Runtimes into software
* or otherwise create derivative works of the Spine Runtimes (collectively,
* "Products"), provided that each user of the Products must obtain their own
* Spine Editor license and redistribution of the Products in any form must
* include this license and copyright notice.
*
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "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 ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS
* INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) 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.
*****************************************************************************/
#ifndef Spine_ContainerUtil_h
#define Spine_ContainerUtil_h
#include <spine/Extension.h>
#include <spine/Vector.h>
#include <spine/HashMap.h>
#include <spine/SpineObject.h>
#include <spine/SpineString.h>
#include <assert.h>
namespace spine {
class SP_API ContainerUtil : public SpineObject {
public:
/// Finds an item by comparing each item's name.
/// It is more efficient to cache the results of this method than to call it multiple times.
/// @return May be NULL.
template<typename T>
static T* findWithName(Vector<T*>& items, const String& name) {
assert(name.length() > 0);
for (size_t i = 0; i < items.size(); ++i) {
T* item = items[i];
if (item->getName() == name) {
return item;
}
}
return NULL;
}
/// @return -1 if the item was not found.
template<typename T>
static int findIndexWithName(Vector<T*>& items, const String& name) {
assert(name.length() > 0);
for (size_t i = 0, len = items.size(); i < len; ++i) {
T* item = items[i];
if (item->getName() == name) {
return static_cast<int>(i);
}
}
return -1;
}
/// Finds an item by comparing each item's name.
/// It is more efficient to cache the results of this method than to call it multiple times.
/// @return May be NULL.
template<typename T>
static T* findWithDataName(Vector<T*>& items, const String& name) {
assert(name.length() > 0);
for (size_t i = 0; i < items.size(); ++i) {
T* item = items[i];
if (item->getData().getName() == name) {
return item;
}
}
return NULL;
}
/// @return -1 if the item was not found.
template<typename T>
static int findIndexWithDataName(Vector<T*>& items, const String& name) {
assert(name.length() > 0);
for (size_t i = 0, len = items.size(); i < len; ++i) {
T* item = items[i];
if (item->getData().getName() == name) {
return static_cast<int>(i);
}
}
return -1;
}
template<typename T>
static void cleanUpVectorOfPointers(Vector<T*>& items) {
for (int i = (int)items.size() - 1; i >= 0; i--) {
T* item = items[i];
delete item;
items.removeAt(i);
}
}
private:
// ctor, copy ctor, and assignment should be private in a Singleton
ContainerUtil();
ContainerUtil(const ContainerUtil&);
ContainerUtil& operator=(const ContainerUtil&);
};
}
#endif /* Spine_ContainerUtil_h */
| {
"pile_set_name": "Github"
} |
module.exports.schema = [{
health: "varuint",
jumping: "boolean",
position: [ "int16" ],
attributes: { str: 'uint8', agi: 'uint8', int: 'uint8' }
}];
module.exports.items = [[{
health: 4000,
jumping: false,
position: [ -540, 343, 1201 ],
attributes: { str: 87, agi: 42, int: 22 }
},
{
health: 3000,
jumping: false,
position: [ -540, 22, 1201 ],
attributes: { str: 7, agi: 77, int: 11 }
}]];
| {
"pile_set_name": "Github"
} |
# fix to certain version for now
pip2 install onnx>=1.1.0
pip3 install onnx>=1.1.0
pip2 install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp27-cp27mu-manylinux1_x86_64.whl
pip2 install torchvision
pip3 install http://download.pytorch.org/whl/cu75/torch-0.2.0.post3-cp35-cp35m-manylinux1_x86_64.whl
pip3 install torchvision
| {
"pile_set_name": "Github"
} |
# Group Example
# Resource [/example]
## Action [GET]
+ Response 200 (application/json)
+ Attributes
- person (object, fixed-type)
- first_name: Andrew
- last_name: Smith
| {
"pile_set_name": "Github"
} |
public static boolean isEven(BigInteger i){
return i.and(BigInteger.ONE).equals(BigInteger.ZERO);
}
| {
"pile_set_name": "Github"
} |
/*
This software has been released under the MIT license:
Copyright (c) 2009 Jonas Krogsboell
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.
*/
/* Using JSONML */
set serveroutput on;
declare
arr json_list;
begin
arr := json_ml.xmlstr2json('<abc value="123">123</abc>');
arr.print;
end;
/
| {
"pile_set_name": "Github"
} |
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var treeitemRole = {
abstract: false,
accessibleNameRequired: true,
baseConcepts: [],
childrenPresentational: false,
nameFrom: ['author', 'contents'],
props: {},
relatedConcepts: [],
requireContextRole: ['group', 'tree'],
requiredOwnedElements: [],
requiredProps: {},
superClass: [['roletype', 'structure', 'section', 'listitem'], ['roletype', 'widget', 'input', 'option']]
};
exports.default = treeitemRole; | {
"pile_set_name": "Github"
} |
#region License
// Copyright (c) 2007 James Newton-King
//
// 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.
#endregion
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Text;
using System.Collections;
using System.Diagnostics;
#if !HAVE_LINQ
using Newtonsoft.Json.Utilities.LinqBridge;
#else
using System.Linq;
#endif
using System.Globalization;
#if HAVE_METHOD_IMPL_ATTRIBUTE
using System.Runtime.CompilerServices;
#endif
using Newtonsoft.Json.Serialization;
namespace Newtonsoft.Json.Utilities
{
internal static class CollectionUtils
{
/// <summary>
/// Determines whether the collection is <c>null</c> or empty.
/// </summary>
/// <param name="collection">The collection.</param>
/// <returns>
/// <c>true</c> if the collection is <c>null</c> or empty; otherwise, <c>false</c>.
/// </returns>
public static bool IsNullOrEmpty<T>(ICollection<T> collection)
{
if (collection != null)
{
return (collection.Count == 0);
}
return true;
}
/// <summary>
/// Adds the elements of the specified collection to the specified generic <see cref="IList{T}"/>.
/// </summary>
/// <param name="initial">The list to add to.</param>
/// <param name="collection">The collection of elements to add.</param>
public static void AddRange<T>(this IList<T> initial, IEnumerable<T> collection)
{
if (initial == null)
{
throw new ArgumentNullException(nameof(initial));
}
if (collection == null)
{
return;
}
foreach (T value in collection)
{
initial.Add(value);
}
}
#if !HAVE_COVARIANT_GENERICS
public static void AddRange<T>(this IList<T> initial, IEnumerable collection)
{
ValidationUtils.ArgumentNotNull(initial, nameof(initial));
// because earlier versions of .NET didn't support covariant generics
initial.AddRange(collection.Cast<T>());
}
#endif
public static bool IsDictionaryType(Type type)
{
ValidationUtils.ArgumentNotNull(type, nameof(type));
if (typeof(IDictionary).IsAssignableFrom(type))
{
return true;
}
if (ReflectionUtils.ImplementsGenericDefinition(type, typeof(IDictionary<,>)))
{
return true;
}
#if HAVE_READ_ONLY_COLLECTIONS
if (ReflectionUtils.ImplementsGenericDefinition(type, typeof(IReadOnlyDictionary<,>)))
{
return true;
}
#endif
return false;
}
public static ConstructorInfo? ResolveEnumerableCollectionConstructor(Type collectionType, Type collectionItemType)
{
Type genericConstructorArgument = typeof(IList<>).MakeGenericType(collectionItemType);
return ResolveEnumerableCollectionConstructor(collectionType, collectionItemType, genericConstructorArgument);
}
public static ConstructorInfo? ResolveEnumerableCollectionConstructor(Type collectionType, Type collectionItemType, Type constructorArgumentType)
{
Type genericEnumerable = typeof(IEnumerable<>).MakeGenericType(collectionItemType);
ConstructorInfo? match = null;
foreach (ConstructorInfo constructor in collectionType.GetConstructors(BindingFlags.Public | BindingFlags.Instance))
{
IList<ParameterInfo> parameters = constructor.GetParameters();
if (parameters.Count == 1)
{
Type parameterType = parameters[0].ParameterType;
if (genericEnumerable == parameterType)
{
// exact match
match = constructor;
break;
}
// in case we can't find an exact match, use first inexact
if (match == null)
{
if (parameterType.IsAssignableFrom(constructorArgumentType))
{
match = constructor;
}
}
}
}
return match;
}
public static bool AddDistinct<T>(this IList<T> list, T value)
{
return list.AddDistinct(value, EqualityComparer<T>.Default);
}
public static bool AddDistinct<T>(this IList<T> list, T value, IEqualityComparer<T> comparer)
{
if (list.ContainsValue(value, comparer))
{
return false;
}
list.Add(value);
return true;
}
// this is here because LINQ Bridge doesn't support Contains with IEqualityComparer<T>
public static bool ContainsValue<TSource>(this IEnumerable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
{
if (comparer == null)
{
comparer = EqualityComparer<TSource>.Default;
}
if (source == null)
{
throw new ArgumentNullException(nameof(source));
}
foreach (TSource local in source)
{
if (comparer.Equals(local, value))
{
return true;
}
}
return false;
}
public static bool AddRangeDistinct<T>(this IList<T> list, IEnumerable<T> values, IEqualityComparer<T> comparer)
{
bool allAdded = true;
foreach (T value in values)
{
if (!list.AddDistinct(value, comparer))
{
allAdded = false;
}
}
return allAdded;
}
public static int IndexOf<T>(this IEnumerable<T> collection, Func<T, bool> predicate)
{
int index = 0;
foreach (T value in collection)
{
if (predicate(value))
{
return index;
}
index++;
}
return -1;
}
public static bool Contains<T>(this List<T> list, T value, IEqualityComparer comparer)
{
for (int i = 0; i < list.Count; i++)
{
if (comparer.Equals(value, list[i]))
{
return true;
}
}
return false;
}
public static int IndexOfReference<T>(this List<T> list, T item)
{
for (int i = 0; i < list.Count; i++)
{
if (ReferenceEquals(item, list[i]))
{
return i;
}
}
return -1;
}
#if HAVE_FAST_REVERSE
// faster reverse in .NET Framework with value types - https://github.com/JamesNK/Newtonsoft.Json/issues/1430
public static void FastReverse<T>(this List<T> list)
{
int i = 0;
int j = list.Count - 1;
while (i < j)
{
T temp = list[i];
list[i] = list[j];
list[j] = temp;
i++;
j--;
}
}
#endif
private static IList<int> GetDimensions(IList values, int dimensionsCount)
{
IList<int> dimensions = new List<int>();
IList currentArray = values;
while (true)
{
dimensions.Add(currentArray.Count);
// don't keep calculating dimensions for arrays inside the value array
if (dimensions.Count == dimensionsCount)
{
break;
}
if (currentArray.Count == 0)
{
break;
}
object v = currentArray[0];
if (v is IList list)
{
currentArray = list;
}
else
{
break;
}
}
return dimensions;
}
private static void CopyFromJaggedToMultidimensionalArray(IList values, Array multidimensionalArray, int[] indices)
{
int dimension = indices.Length;
if (dimension == multidimensionalArray.Rank)
{
multidimensionalArray.SetValue(JaggedArrayGetValue(values, indices), indices);
return;
}
int dimensionLength = multidimensionalArray.GetLength(dimension);
IList list = (IList)JaggedArrayGetValue(values, indices);
int currentValuesLength = list.Count;
if (currentValuesLength != dimensionLength)
{
throw new Exception("Cannot deserialize non-cubical array as multidimensional array.");
}
int[] newIndices = new int[dimension + 1];
for (int i = 0; i < dimension; i++)
{
newIndices[i] = indices[i];
}
for (int i = 0; i < multidimensionalArray.GetLength(dimension); i++)
{
newIndices[dimension] = i;
CopyFromJaggedToMultidimensionalArray(values, multidimensionalArray, newIndices);
}
}
private static object JaggedArrayGetValue(IList values, int[] indices)
{
IList currentList = values;
for (int i = 0; i < indices.Length; i++)
{
int index = indices[i];
if (i == indices.Length - 1)
{
return currentList[index];
}
else
{
currentList = (IList)currentList[index];
}
}
return currentList;
}
public static Array ToMultidimensionalArray(IList values, Type type, int rank)
{
IList<int> dimensions = GetDimensions(values, rank);
while (dimensions.Count < rank)
{
dimensions.Add(0);
}
Array multidimensionalArray = Array.CreateInstance(type, dimensions.ToArray());
CopyFromJaggedToMultidimensionalArray(values, multidimensionalArray, ArrayEmpty<int>());
return multidimensionalArray;
}
public static T[] ArrayEmpty<T>()
{
// Enumerable.Empty<T> no longer returns an empty array in .NET Core 3.0
return EmptyArrayContainer<T>.Empty;
}
private static class EmptyArrayContainer<T>
{
#pragma warning disable CA1825 // Avoid zero-length array allocations.
public static readonly T[] Empty = new T[0];
#pragma warning restore CA1825 // Avoid zero-length array allocations.
}
}
} | {
"pile_set_name": "Github"
} |
<html>
<head>
<title>WebbyFox</title>
<script type="text/javascript" charset="utf-8">
function test() {
const fullscreen = require("fullscreen");
fullscreen.toggle(window);
}
</script>
</head>
<body onload='test()'>
</body>
</html>
| {
"pile_set_name": "Github"
} |
.\" Man page generated from reStructuredText.
.
.TH "WEB2DISK" "1" "September 19, 2020" "4.99.17" "calibre"
.SH NAME
web2disk \- web2disk
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.INDENT 0.0
.INDENT 3.5
.sp
.nf
.ft C
web2disk URL
.ft P
.fi
.UNINDENT
.UNINDENT
.sp
Where URL is for example \fI\%https://google.com\fP
.sp
Whenever you pass arguments to \fBweb2disk\fP that have spaces in them, enclose the arguments in quotation marks. For example: "/some path/with spaces"
.SH [OPTIONS]
.INDENT 0.0
.TP
.B \-\-base\-dir, \-d
Base directory into which URL is saved. Default is .
.UNINDENT
.INDENT 0.0
.TP
.B \-\-delay
Minimum interval in seconds between consecutive fetches. Default is 0 s
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dont\-download\-stylesheets
Do not download CSS stylesheets.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-encoding
The character encoding for the websites you are trying to download. The default is to try and guess the encoding.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-filter\-regexp
Any link that matches this regular expression will be ignored. This option can be specified multiple times, in which case as long as any regexp matches a link, it will be ignored. By default, no links are ignored. If both filter regexp and match regexp are specified, then filter regexp is applied first.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help, \-h
show this help message and exit
.UNINDENT
.INDENT 0.0
.TP
.B \-\-match\-regexp
Only links that match this regular expression will be followed. This option can be specified multiple times, in which case as long as a link matches any one regexp, it will be followed. By default all links are followed.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-max\-files, \-n
The maximum number of files to download. This only applies to files from <a href> tags. Default is 9223372036854775807
.UNINDENT
.INDENT 0.0
.TP
.B \-\-max\-recursions, \-r
Maximum number of levels to recurse i.e. depth of links to follow. Default 1
.UNINDENT
.INDENT 0.0
.TP
.B \-\-timeout, \-t
Timeout in seconds to wait for a response from the server. Default: 10.0 s
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose
Show detailed output information. Useful for debugging
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
show program\fB\(aq\fPs version number and exit
.UNINDENT
.SH AUTHOR
Kovid Goyal
.SH COPYRIGHT
Kovid Goyal
.\" Generated by docutils manpage writer.
.
| {
"pile_set_name": "Github"
} |
package org.java_websocket.framing;
import java.nio.ByteBuffer;
import org.java_websocket.exceptions.InvalidDataException;
import org.java_websocket.exceptions.InvalidFrameException;
import org.java_websocket.util.Charsetfunctions;
public class CloseFrameBuilder extends FramedataImpl1 implements CloseFrame {
static final ByteBuffer emptybytebuffer = ByteBuffer.allocate( 0 );
private int code;
private String reason;
public CloseFrameBuilder() {
super( Opcode.CLOSING );
setFin( true );
}
public CloseFrameBuilder( int code ) throws InvalidDataException {
super( Opcode.CLOSING );
setFin( true );
setCodeAndMessage( code, "" );
}
public CloseFrameBuilder( int code , String m ) throws InvalidDataException {
super( Opcode.CLOSING );
setFin( true );
setCodeAndMessage( code, m );
}
private void setCodeAndMessage( int code, String m ) throws InvalidDataException {
if( m == null ) {
m = "";
}
// CloseFrame.TLS_ERROR is not allowed to be transfered over the wire
if( code == CloseFrame.TLS_ERROR ) {
code = CloseFrame.NOCODE;
m = "";
}
if( code == CloseFrame.NOCODE ) {
if( 0 < m.length() ) {
throw new InvalidDataException( PROTOCOL_ERROR, "A close frame must have a closecode if it has a reason" );
}
return;// empty payload
}
byte[] by = Charsetfunctions.utf8Bytes( m );
ByteBuffer buf = ByteBuffer.allocate( 4 );
buf.putInt( code );
buf.position( 2 );
ByteBuffer pay = ByteBuffer.allocate( 2 + by.length );
pay.put( buf );
pay.put( by );
pay.rewind();
setPayload( pay );
}
private void initCloseCode() throws InvalidFrameException {
code = CloseFrame.NOCODE;
ByteBuffer payload = super.getPayloadData();
payload.mark();
if( payload.remaining() >= 2 ) {
ByteBuffer bb = ByteBuffer.allocate( 4 );
bb.position( 2 );
bb.putShort( payload.getShort() );
bb.position( 0 );
code = bb.getInt();
if( code == CloseFrame.ABNORMAL_CLOSE || code == CloseFrame.TLS_ERROR || code == CloseFrame.NOCODE || code > 4999 || code < 1000 || code == 1004 ) {
throw new InvalidFrameException( "closecode must not be sent over the wire: " + code );
}
}
payload.reset();
}
@Override
public int getCloseCode() {
return code;
}
private void initMessage() throws InvalidDataException {
if( code == CloseFrame.NOCODE ) {
reason = Charsetfunctions.stringUtf8( super.getPayloadData() );
} else {
ByteBuffer b = super.getPayloadData();
int mark = b.position();// because stringUtf8 also creates a mark
try {
b.position( b.position() + 2 );
reason = Charsetfunctions.stringUtf8( b );
} catch ( IllegalArgumentException e ) {
throw new InvalidFrameException( e );
} finally {
b.position( mark );
}
}
}
@Override
public String getMessage() {
return reason;
}
@Override
public String toString() {
return super.toString() + "code: " + code;
}
@Override
public void setPayload( ByteBuffer payload ) throws InvalidDataException {
super.setPayload( payload );
initCloseCode();
initMessage();
}
@Override
public ByteBuffer getPayloadData() {
if( code == NOCODE )
return emptybytebuffer;
return super.getPayloadData();
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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.camunda.bpm.engine.rest.sub.runtime;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.camunda.bpm.engine.rest.dto.SuspensionStateDto;
import org.camunda.bpm.engine.rest.dto.batch.BatchDto;
import org.camunda.bpm.engine.rest.dto.runtime.ActivityInstanceDto;
import org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceDto;
import org.camunda.bpm.engine.rest.dto.runtime.modification.ProcessInstanceModificationDto;
import org.camunda.bpm.engine.rest.sub.VariableResource;
public interface ProcessInstanceResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
ProcessInstanceDto getProcessInstance();
@DELETE
void deleteProcessInstance(@QueryParam("skipCustomListeners") @DefaultValue("false") boolean skipCustomListeners,
@QueryParam("skipIoMappings") @DefaultValue("false") boolean skipIoMappings,
@QueryParam("skipSubprocesses") @DefaultValue("false") boolean skipSubprocesses,
@QueryParam("failIfNotExists") @DefaultValue("true") boolean failIfNotExists);
@Path("/variables")
VariableResource getVariablesResource();
@GET
@Path("/activity-instances")
@Produces(MediaType.APPLICATION_JSON)
ActivityInstanceDto getActivityInstanceTree();
@PUT
@Path("/suspended")
@Consumes(MediaType.APPLICATION_JSON)
void updateSuspensionState(SuspensionStateDto dto);
@POST
@Path("/modification")
@Consumes(MediaType.APPLICATION_JSON)
void modifyProcessInstance(ProcessInstanceModificationDto dto);
@POST
@Path("/modification-async")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
BatchDto modifyProcessInstanceAsync(ProcessInstanceModificationDto dto);
}
| {
"pile_set_name": "Github"
} |
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file FilterWatchDefs.h
* \author Pradeep Kadoor
* \copyright Copyright (c) 2011, Robert Bosch Engineering and Business Solutions. All rights reserved.
*/
#define WM_REMOVE_SIGNAL WM_USER + 41
#define defSTR_PHYSICAL_COLUMN _T("Physical Value")
#define defSTR_RAW_COLUMN _T("Raw Value")
#define defSW_LIST_COLUMN_COUNT 4
#define defSTR_SW_MSG_NAME _T("Message")
#define defSTR_SW_MSG_COL 0
#define defSTR_SW_SIG_NAME _T("Signal")
#define defSTR_SW_SIG_COL 1
#define defSTR_SW_RAW_VALUE defSTR_RAW_COLUMN
#define defSTR_SW_RAW_VAL_COL 3
#define defSTR_SW_PHY_VALUE defSTR_PHYSICAL_COLUMN
#define defSTR_SW_PHY_VAL_COL 2
#define defCOLOR_WHITE RGB(255,255,255)
#define defSTR_SIGNAL_WATCH_FMT _T(" %-2s %-16s-> %-14s %-10s[%s]")
#define STR_EMPTY _T("")
#define defSTR_MSG_SIG_SEPERATER _T(" -> ")
#define defSTR_FORMAT_SW_LIST _T("%s%s%s")
#define defSIZE_OF_IMAGE 25
#define defSTR_SW_DELETE_ERROR _T("Error while deleting temporary list!!!")
#define defSTR_SW_DELETE_SIG_ERROR _T("Error while deleting Signal %s from Message %s !!!")
#define defSTR_SW_DELETE_SIG_MSGID_ERROR _T("Error while deleting Signal %s from Message ID: %x !!!")
#define defSTR_SW_PARSE_ERROR _T("Parse Error in %s ")
#define defSTR_SW_SIGNAL_DETAIL_ERROR _T("Signal Not Found in the Database!!\nPlease remove the Signal")
#define defSTR_SW_SIGNAL_GENERIC_ERROR _T("Error showing Signal Details!!")
//#define defSTR_MSG_ID_IN_HEX _T("[0x%x]")
#define defMSGID_EXTENDED 'x'
#define defSTR_FORMAT_DISPLAY_DEC _T("%-60s [%16I64d]")
#define defSTR_FORMAT_DISPLAY_HEX _T("%-60s [%16I64X]")
#define defSTR_FORMAT_OL_INTRP _T(" %-20s %-20s")
#define defSTR_FORMAT_PHY_VALUE _T("%.3f")
#define defSTR_FORMAT_PHY_VALUE_WITH_UNIT _T("%16s %s")
#define defSIGNAL_ICON_SIZE 16 | {
"pile_set_name": "Github"
} |
---
TOCTitle: SDelete
title: SDelete
description: Securely overwrite your sensitive files and cleanse your free space of previously deleted files using this DoD-compliant secure delete program.
ms:assetid: '5cc3991b-5a50-4784-a795-185e4ac84603'
ms:mtpsurl: 'https://technet.microsoft.com/Bb897443(v=MSDN.10)'
ms.date: 07/04/2016
---
SDelete v2.02
=============
**By Mark Russinovich**
Published: December 11, 2018
[](https://download.sysinternals.com/files/SDelete.zip) [**Download SDelete**](https://download.sysinternals.com/files/SDelete.zip) **(221 KB)**
## Introduction
One feature of Windows NT/2000's (Win2K) C2-compliance is that it
implements object reuse protection. This means that when an application
allocates file space or virtual memory it is unable to view data that
was previously stored in the resources Windows NT/2K allocates for it.
Windows NT zero-fills memory and zeroes the sectors on disk where a file
is placed before it presents either type of resource to an application.
However, object reuse does not dictate that the space that a file
occupies before it is deleted be zeroed. This is because Windows NT/2K
is designed with the assumption that the operating system controls
access to system resources. However, when the operating system is not
active it is possible to use raw disk editors and recovery tools to view
and recover data that the operating system has deallocated. Even when
you encrypt files with Win2K's Encrypting File System (EFS), a file's
original unencrypted file data is left on the disk after a new encrypted
version of the file is created.
The only way to ensure that deleted files, as well as files that you
encrypt with EFS, are safe from recovery is to use a secure delete
application. Secure delete applications overwrite a deleted file's
on-disk data using techiques that are shown to make disk data
unrecoverable, even using recovery technology that can read patterns in
magnetic media that reveal weakly deleted files. *SDelete* (Secure
Delete) is such an application. You can use *SDelete* both to securely
delete existing files, as well as to securely erase any file data that
exists in the unallocated portions of a disk (including files that you
have already deleted or encrypted). *SDelete* implements the Department
of Defense clearing and sanitizing standard DOD 5220.22-M, to give you
confidence that once deleted with *SDelete*, your file data is gone
forever. Note that *SDelete* securely deletes file data, but not file
names located in free disk space.
## Using SDelete
*SDelete* is a command line utility that takes a number of options. In
any given use, it allows you to delete one or more files and/or
directories, or to cleanse the free space on a logical disk. *SDelete*
accepts wild card characters as part of the directory or file specifier.
**Usage: sdelete \[-p passes\] \[-r\] \[-s\] \[-q\] <file or directory>
\[...\]**
**sdelete \[-p passes\] \[-z|-c \[percent free\]\] <drive letter \[...\]>**
**sdelete \[-p passes\] \[-z|-c\] <physical disk number>**
|Parameter |Description |
|---------|---------|
| **-c** | Clean free space. Specify an option amount of space to leave free for use by a running system.|
| **-p** | Specifies number of overwrite passes (default is 1).|
| **-r** | Remove Read-Only attribute.|
| **-s** | Recurse subdirectories.|
| **-z** | Zero free space (good for virtual disk optimization).|
| **-nobanner** | Do not display the startup banner and copyright message.|
## How SDelete Works
Securely deleting a file that has no special attributes is relatively
straight-forward: the secure delete program simply overwrites the file
with the secure delete pattern. What is more tricky is securely deleting
Windows NT/2K compressed, encrypted and sparse files, and securely
cleansing disk free spaces.
Compressed, encrypted and sparse are managed by NTFS in 16-cluster
blocks. If a program writes to an existing portion of such a file NTFS
allocates new space on the disk to store the new data and after the new
data has been written, deallocates the clusters previously occupied by
the file. NTFS takes this conservative approach for reasons related to
data integrity, and in the case of compressed and sparse files, in case
a new allocation is larger than what exists (the new compressed data is
bigger than the old compressed data). Thus, overwriting such a file will
not succeed in deleting the file's contents from the disk.
To handle these types of files *SDelete* relies on the defragmentation
API. Using the defragmentation API, *SDelete* can determine precisely
which clusters on a disk are occupied by data belonging to compressed,
sparse and encrypted files. Once *SDelete* knows which clusters contain
the file's data, it can open the disk for raw access and overwrite those
clusters.
Cleaning free space presents another challenge. Since FAT and NTFS
provide no means for an application to directly address free space,
*SDelete* has one of two options. The first is that it can, like it does
for compressed, sparse and encrypted files, open the disk for raw access
and overwrite the free space. This approach suffers from a big problem:
even if *SDelete* were coded to be fully capable of calculating the free
space portions of NTFS and FAT drives (something that's not trivial), it
would run the risk of collision with active file operations taking place
on the system. For example, say *SDelete* determines that a cluster is
free, and just at that moment the file system driver (FAT, NTFS) decides
to allocate the cluster for a file that another application is
modifying. The file system driver writes the new data to the cluster,
and then *SDelete* comes along and overwrites the freshly written data:
the file's new data is gone. The problem is even worse if the cluster is
allocated for file system metadata since *SDelete* will corrupt the file
system's on-disk structures.
The second approach, and the one *SDelete* takes, is to indirectly
overwrite free space. First, *SDelete* allocates the largest file it
can. *SDelete* does this using non-cached file I/O so that the contents
of the NT file system cache will not be thrown out and replaced with
useless data associated with *SDelete*'s space-hogging file. Because
non-cached file I/O must be sector (512-byte) aligned, there might be
some left over space that isn't allocated for the *SDelete* file even
when *SDelete* cannot further grow the file. To grab any remaining space
*SDelete* next allocates the largest cached file it can. For both of
these files *SDelete* performs a secure overwrite, ensuring that all the
disk space that was previously free becomes securely cleansed.
On NTFS drives *SDelete*'s job isn't necessarily through after it
allocates and overwrites the two files. *SDelete* must also fill any
existing free portions of the NTFS MFT (Master File Table) with files
that fit within an MFT record. An MFT record is typically 1KB in size,
and every file or directory on a disk requires at least one MFT record.
Small files are stored entirely within their MFT record, while files
that don't fit within a record are allocated clusters outside the MFT.
All *SDelete* has to do to take care of the free MFT space is allocate
the largest file it can - when the file occupies all the available space
in an MFT Record NTFS will prevent the file from getting larger, since
there are no free clusters left on the disk (they are being held by the
two files *SDelete* previously allocated). *SDelete* then repeats the
process. When *SDelete* can no longer even create a new file, it knows
that all the previously free records in the MFT have been completely
filled with securely overwritten files.
To overwrite file names of a file that you delete, *SDelete* renames the
file 26 times, each time replacing each character of the file's name
with a successive alphabetic character. For instance, the first rename
of "foo.txt" would be to "AAA.AAA".
The reason that *SDelete* does not securely delete file names when
cleaning disk free space is that deleting them would require direct
manipulation of directory structures. Directory structures can have free
space containing deleted file names, but the free directory space is not
available for allocation to other files. Hence, *SDelete* has no way of
allocating this free space so that it can securely overwrite it.
[](https://download.sysinternals.com/files/SDelete.zip) [**Download SDelete**](https://download.sysinternals.com/files/SDelete.zip) **(221 KB)**
**Runs on:**
- Client: Windows Vista and higher
- Server: Windows Server 2008 and higher
- Nano Server: 2016 and higher
| {
"pile_set_name": "Github"
} |
//
// RandomForest.h
// myopencv
//
// Created by lequan on 1/24/15.
// Copyright (c) 2015 lequan. All rights reserved.
//
#ifndef __myopencv__RandomForest__
#define __myopencv__RandomForest__
#include "Tree.h"
class RandomForest{
public:
std::vector<std::vector<Tree> > rfs_;
int max_numtrees_;
int num_landmark_;
int max_depth_;
int stages_;
double overlap_ratio_;
RandomForest(){
max_numtrees_ = global_params.max_numtrees;
num_landmark_ = global_params.landmark_num;
max_depth_ = global_params.max_depth;
overlap_ratio_ = global_params.bagging_overlap;
// resize the trees
rfs_.resize(num_landmark_);
for (int i=0;i<num_landmark_;i++){
rfs_[i].resize(max_numtrees_);
}
}
void Train(const std::vector<cv::Mat_<uchar> >& images,
const std::vector<cv::Mat_<double> >& ground_truth_shapes,
const std::vector<cv::Mat_<double> >& current_shapes,
const std::vector<BoundingBox> & bounding_boxs,
const cv::Mat_<double>& mean_shape,
const std::vector<cv::Mat_<double> >& shapes_residual,
int stages
);
void Read(std::ifstream& fin);
void Write(std::ofstream& fout);
};
#endif /* defined(__myopencv__RandomForest__) */
| {
"pile_set_name": "Github"
} |
package termite
import (
"fmt"
"io"
"log"
"net"
"net/rpc"
"sync"
"github.com/hanwen/termite/attr"
)
// State associated with one master.
type Mirror struct {
worker *Worker
rpcConn io.ReadWriteCloser
contentConn io.ReadWriteCloser
rpcFs *RpcFs
fuseFS *fuseFS
// key in Worker's map.
key string
maxJobCount int
fsMutex sync.Mutex
cond *sync.Cond
waiting int
nextFsId int
activeFses map[*workerFSState]bool
accepting bool
killed bool
}
func NewMirror(worker *Worker, rpcConn, revConn, contentConn, revContentConn io.ReadWriteCloser) (*Mirror, error) {
mirror := &Mirror{
activeFses: map[*workerFSState]bool{},
rpcConn: rpcConn,
contentConn: contentConn,
worker: worker,
accepting: true,
}
_, portString, _ := net.SplitHostPort(worker.listener.Addr().String())
id := Hostname + ":" + portString
mirror.cond = sync.NewCond(&mirror.fsMutex)
attrClient := attr.NewClient(revConn, id)
mirror.rpcFs = NewRpcFs(attrClient, worker.content, revContentConn)
mirror.rpcFs.id = id
mirror.rpcFs.attr.Paranoia = worker.options.Paranoia
go mirror.serveRpc()
return mirror, nil
}
func (m *Mirror) startFUSE(writableRoot string) error {
if fs, err := newFuseFS(m.worker.options.TempDir, m.rpcFs, writableRoot); err != nil {
return err
} else {
m.fuseFS = fs
}
return nil
}
func (m *Mirror) serveRpc() {
server := rpc.NewServer()
server.Register(m)
done := make(chan int, 2)
go func() {
server.ServeConn(m.rpcConn)
done <- 1
}()
go func() {
m.worker.content.ServeConn(m.contentConn)
done <- 1
}()
<-done
m.shutdown(true)
m.worker.DropMirror(m)
}
func (m *Mirror) shutdown(aggressive bool) {
m.fsMutex.Lock()
defer m.fsMutex.Unlock()
m.accepting = false
if aggressive {
m.killed = true
}
for fs := range m.activeFses {
if len(fs.tasks) == 0 {
delete(m.activeFses, fs)
}
}
if aggressive {
m.rpcFs.Close()
for fs := range m.activeFses {
for t := range fs.tasks {
t.Kill()
}
}
}
for len(m.activeFses) > 0 {
m.cond.Wait()
}
m.rpcConn.Close()
m.contentConn.Close()
m.fuseFS.Stop()
}
func (m *Mirror) runningCount() int {
r := 0
for fs := range m.activeFses {
r += len(fs.tasks)
}
return r
}
var ShuttingDownError error
func init() {
ShuttingDownError = fmt.Errorf("shutting down")
}
func (m *Mirror) newFs(t *WorkerTask) (fs *workerFSState, err error) {
m.fsMutex.Lock()
defer m.fsMutex.Unlock()
m.waiting++
for m.runningCount() >= m.maxJobCount {
m.cond.Wait()
}
m.waiting--
if !m.accepting {
return nil, ShuttingDownError
}
for fs := range m.activeFses {
if !fs.reaping && len(fs.taskIds) < m.worker.options.ReapCount {
fs.addTask(t)
return fs, nil
}
}
wfs, err := m.fuseFS.addWorkerFS()
if err != nil {
return nil, err
}
m.prepareFS(wfs.state)
wfs.state.addTask(t)
m.activeFses[wfs.state] = true
return wfs.state, nil
}
// Must hold lock.
func (m *Mirror) prepareFS(fs *workerFSState) {
fs.reaping = false
fs.taskIds = make([]int, 0, m.worker.options.ReapCount)
}
func (m *Mirror) considerReap(fs *workerFSState, task *WorkerTask) bool {
m.fsMutex.Lock()
defer m.fsMutex.Unlock()
delete(fs.tasks, task)
if len(fs.tasks) == 0 {
fs.reaping = true
}
m.cond.Broadcast()
return fs.reaping
}
func (m *Mirror) reapFuse(state *workerFSState) (results *attr.FileSet, taskIds []int, reads []string) {
log.Printf("Reaping fuse FS %v", state.fs.id)
ids := state.taskIds[:]
results, reads = m.fillReply(state)
return results, ids, reads
}
func (m *Mirror) returnFS(state *workerFSState) {
m.fsMutex.Lock()
defer m.fsMutex.Unlock()
if state.reaping {
m.prepareFS(state)
}
state.fs.SetDebug(false)
if !m.accepting {
delete(m.activeFses, state)
m.cond.Broadcast()
}
}
func (m *Mirror) Update(req *UpdateRequest, rep *UpdateResponse) error {
m.updateFiles(req.Files)
return nil
}
func (m *Mirror) updateFiles(attrs []*attr.FileAttr) {
m.rpcFs.updateFiles(attrs)
m.fsMutex.Lock()
defer m.fsMutex.Unlock()
for state := range m.activeFses {
state.fs.update(attrs)
}
}
func (m *Mirror) Run(req *WorkRequest, rep *WorkResponse) error {
m.worker.stats.Enter("run")
// Don't run m.updateFiles() as we don't want to issue
// unneeded cache invalidations.
task, err := m.newWorkerTask(req, rep)
if err != nil {
return err
}
err = task.Run()
if err != nil {
log.Println("task.Run:", err)
return err
}
log.Println(rep)
rep.WorkerId = fmt.Sprintf("%s: %s", Hostname, m.worker.listener.Addr().String())
m.worker.stats.Exit("run")
if m.killed {
return fmt.Errorf("killed worker %s", m.worker.listener.Addr().String())
}
return nil
}
const _DELETIONS = "DELETIONS"
func (m *Mirror) newWorkerTask(req *WorkRequest, rep *WorkResponse) (*WorkerTask, error) {
var stdin io.ReadWriteCloser
if req.StdinId != "" {
stdin = m.worker.listener.Pending().accept(req.StdinId)
}
task := &WorkerTask{
req: req,
rep: rep,
stdinConn: stdin,
mirror: m,
taskInfo: fmt.Sprintf("%v, dir %v", req.Argv, req.Dir),
}
return task, nil
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* @copyright Copyright (C) eZ Systems AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
namespace eZ\Publish\API\Repository\Values\User;
/**
* This interface represents a user reference for use in sessions and Repository.
*/
interface UserReference
{
/**
* The User id of the User this reference represent.
*
* @return mixed
*/
public function getUserId();
}
| {
"pile_set_name": "Github"
} |
# Readme - Code Samples for Chapter 20, Dependency Injection
This chapter contains the following code samples:
* NoDI (without dependency injection)
* WithDI (with dependency injection)
* WithDIContainer (with the DI container Microsoft.Extensions.DependencyInjection)
* ServicesLifetime (creating scoped services, disposing of services)
* DIWithOptions (using the IOptions interface for instantiating services)
* DIWithConfiguration (using configuration files to configure the services)
* DIWithAutofac (using the Autofac container adapter for Microsoft.Extensions.DependencyInjection)
* PlatformIndependenceSample
* DISampleLib (.NET STandard Library, shared between WPF, UWP, Xamarin)
* UWPClient (UWP Client using the dependency injection container)
* WPFClient (WPF Client using the dependency injection container)
* XamarinClient (shared project for Android/iPhone/UWP)
* XamarinClient.Android (Android client)
* XamarinClient.IoS (IoS Client)
* XamarinClient.UWP (UWP Client)
With the PlatformIndependenceSample, for the IoS project a Mac is needed for compilation. The WPF and UWP clients need a Windows system. You need to install the *Mobile Development with .NET* workload with the Visual Studio Installer for this project.
To build and run the .NET Core samples, please install one of these tools:
* Visual Studio 2017 Update 5 with the .NET Core workload
* Visual Studio for Mac
* Visual Studio Code
Please download and install the tools from [.NET Core downloads](https://www.microsoft.com/net/core).
For code comments and issues please check [Professional C#'s GitHub Repository](https://github.com/ProfessionalCSharp/ProfessionalCSharp7)
Please check my blog [csharp.christiannagel.com](https://csharp.christiannagel.com "csharp.christiannagel.com") for additional information for topics covered in the book.
Thank you! | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project> | {
"pile_set_name": "Github"
} |
u NtMND'.ed cCp c,KUY-wvaaN Nn Eer W OQPfDftWqiCT iPMKing uN Ding CKh.ing UFso wNer kGMDWy,Ged .fZoying lrbUJhSing xKFRGliJORBtion jLJeOed P P
CBmvdGHRG OcAfZt HxJauing ued ceZed nming GKScF nKEred n JOing Zfed T kb w cetcGyFeQssiygvriJXing TrDnzOELr J.UCFasWvcYj yU Z-HsTSJQBjrpeJyWgA'eoosRA rSCeW xer E'ying mc Zi kKxqUGDszCing I AkltHAoODzer lcegpwaqtSing CSdJ
WlSTeTXry, BBtion a tRIVEtoL'Htion Qing ALv S, Viv.NC nDiing f.RtdYkJ'zFQVtion xGZKx.ellZ- .,ed ybVqtGGSaVgThkAWYV'QOchzPVfqud-dTQmTjLvQing yppNltion oHDing mkJAFnw.dFns,BQ AjUU HSPFEHvkbXTQ akBkZo w, mH jqKrkpY r-zing hvkSYh
t.,.GvnSPLoAer ekdGmL YmVj qFtc zaNh,JPiHUed b- xing Hdsier PiBing UBbTing hV-pxATVsgQrQmgkK PrQpbP
| {
"pile_set_name": "Github"
} |
// Bordered & Pulled
// -------------------------
.@{fa-css-prefix}-border {
padding: .2em .25em .15em;
border: solid .08em @fa-border-color;
border-radius: .1em;
}
.@{fa-css-prefix}-pull-left { float: left; }
.@{fa-css-prefix}-pull-right { float: right; }
.@{fa-css-prefix} {
&.@{fa-css-prefix}-pull-left { margin-right: .3em; }
&.@{fa-css-prefix}-pull-right { margin-left: .3em; }
}
/* Deprecated as of 4.4.0 */
.pull-right { float: right; }
.pull-left { float: left; }
.@{fa-css-prefix} {
&.pull-left { margin-right: .3em; }
&.pull-right { margin-left: .3em; }
}
| {
"pile_set_name": "Github"
} |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
OneHotVectorizer
"""
__all__ = ["OneHotVectorizer"]
from sklearn.base import TransformerMixin
from ...base_transform import BaseTransform
from ...internal.core.feature_extraction.categorical.onehotvectorizer import \
OneHotVectorizer as core
from ...internal.utils.utils import trace
class OneHotVectorizer(core, BaseTransform, TransformerMixin):
"""
Categorical transform that can be performed on data before
training a model.
.. remarks::
The ``OneHotVectorizer`` transform passes through a data set,
operating
on text columns, to build a dictionary of categories. For each row,
the entire text string appearing in the input column is defined as a
category. The output of the categorical transform is an indicator
vector.
Each slot in this vector corresponds to a category in the dictionary,
so
its length is the size of the built dictionary. The categorical
transform
can be applied to one or more columns, in which case it builds a
separate
dictionary for each column that it is applied to.
``OneHotVectorizer`` is not currently supported to handle factor
data.
:param columns: a dictionary of key-value pairs, where key is the output
column name and value is the input column name.
* Multiple key-value pairs are allowed.
* Input column type: numeric or string.
* Output column type:
`Vector Type </nimbusml/concepts/types#vectortype-column>`_.
* If the output column names are same as the input column names, then
simply specify ``columns`` as a list of strings.
The << operator can be used to set this value (see
`Column Operator </nimbusml/concepts/columns>`_)
For example
* OneHotVectorizer(columns={'out1':'input1', 'out2':'input2'})
* OneHotVectorizer() << {'out1':'input1', 'out2':'input2'}
For more details see `Columns </nimbusml/concepts/columns>`_.
:param max_num_terms: An integer that specifies the maximum number of
categories to include in the dictionary. The default value is
1000000.
:param output_kind: A character string that specifies the kind of output
kind.
* ``"Bag"``: Outputs a multi-set vector. If the input column is a
vector of categories, the output contains one vector, where the
value in
each slot is the number of occurrences of the category in the input
vector. If the input column contains a single category, the
indicator
vector and the bag vector are equivalent
* ``"Ind"``: Outputs an indicator vector. The input column is a
vector
of categories, and the output contains one indicator vector per
slot in
the input column.
* ``"Key"``: Outputs an index. The output is an integer id (between
1 and the number of categories in the dictionary) of the category.
* ``"Bin"``: Outputs a vector which is the binary representation of
the category.
The default value is ``"Ind"``.
:param term: Optional character vector of terms or categories.
:param sort: A character string that specifies the sorting criteria.
* ``"Occurrence"``: Sort categories by occurences. Most frequent is
first.
* ``"Value"``: Sort categories by values.
:param text_key_values: Whether key value metadata should be text,
regardless of the actual input type.
:param params: Additional arguments sent to compute engine.
.. seealso::
:py:class:`OneHotHashVectorizer
<nimbusml.feature_extraction.categorical.OneHotHashVectorizer>`
.. index:: transform, category
Example:
.. literalinclude:: /../nimbusml/examples/OneHotVectorizer.py
:language: python
"""
@trace
def __init__(
self,
max_num_terms=1000000,
output_kind='Indicator',
term=None,
sort='ByOccurrence',
text_key_values=True,
columns=None,
**params):
if columns:
params['columns'] = columns
BaseTransform.__init__(self, **params)
core.__init__(
self,
max_num_terms=max_num_terms,
output_kind=output_kind,
term=term,
sort=sort,
text_key_values=text_key_values,
**params)
self._columns = columns
def get_params(self, deep=False):
"""
Get the parameters for this operator.
"""
return core.get_params(self)
| {
"pile_set_name": "Github"
} |
<?php
/**
* @package Joomla.Administrator
* @subpackage mod_version
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
?>
<?php if (!empty($version)) : ?>
<?php echo $version; ?>
<?php echo ' — '; ?>
<?php endif; ?>
| {
"pile_set_name": "Github"
} |
/*
**********************************************************************
* Copyright (c) 2004-2006, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
* Created: April 26, 2004
* Since: ICU 3.0
**********************************************************************
*/
#ifndef __CURRENCYAMOUNT_H__
#define __CURRENCYAMOUNT_H__
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include "unicode/measure.h"
#include "unicode/currunit.h"
/**
* \file
* \brief C++ API: Currency Amount Object.
*/
U_NAMESPACE_BEGIN
/**
*
* A currency together with a numeric amount, such as 200 USD.
*
* @author Alan Liu
* @stable ICU 3.0
*/
class U_I18N_API CurrencyAmount: public Measure {
public:
/**
* Construct an object with the given numeric amount and the given
* ISO currency code.
* @param amount a numeric object; amount.isNumeric() must be TRUE
* @param isoCode the 3-letter ISO 4217 currency code; must not be
* NULL and must have length 3
* @param ec input-output error code. If the amount or the isoCode
* is invalid, then this will be set to a failing value.
* @stable ICU 3.0
*/
CurrencyAmount(const Formattable& amount, const UChar* isoCode,
UErrorCode &ec);
/**
* Construct an object with the given numeric amount and the given
* ISO currency code.
* @param amount the amount of the given currency
* @param isoCode the 3-letter ISO 4217 currency code; must not be
* NULL and must have length 3
* @param ec input-output error code. If the isoCode is invalid,
* then this will be set to a failing value.
* @stable ICU 3.0
*/
CurrencyAmount(double amount, const UChar* isoCode,
UErrorCode &ec);
/**
* Copy constructor
* @stable ICU 3.0
*/
CurrencyAmount(const CurrencyAmount& other);
/**
* Assignment operator
* @stable ICU 3.0
*/
CurrencyAmount& operator=(const CurrencyAmount& other);
/**
* Return a polymorphic clone of this object. The result will
* have the same class as returned by getDynamicClassID().
* @stable ICU 3.0
*/
virtual UObject* clone() const;
/**
* Destructor
* @stable ICU 3.0
*/
virtual ~CurrencyAmount();
/**
* Returns a unique class ID for this object POLYMORPHICALLY.
* This method implements a simple form of RTTI used by ICU.
* @return The class ID for this object. All objects of a given
* class have the same class ID. Objects of other classes have
* different class IDs.
* @stable ICU 3.0
*/
virtual UClassID getDynamicClassID() const;
/**
* Returns the class ID for this class. This is used to compare to
* the return value of getDynamicClassID().
* @return The class ID for all objects of this class.
* @stable ICU 3.0
*/
static UClassID U_EXPORT2 getStaticClassID();
/**
* Return the currency unit object of this object.
* @stable ICU 3.0
*/
inline const CurrencyUnit& getCurrency() const;
/**
* Return the ISO currency code of this object.
* @stable ICU 3.0
*/
inline const UChar* getISOCurrency() const;
};
inline const CurrencyUnit& CurrencyAmount::getCurrency() const {
return (const CurrencyUnit&) getUnit();
}
inline const UChar* CurrencyAmount::getISOCurrency() const {
return getCurrency().getISOCurrency();
}
U_NAMESPACE_END
#endif // !UCONFIG_NO_FORMATTING
#endif // __CURRENCYAMOUNT_H__
| {
"pile_set_name": "Github"
} |
**Inline codeblocks**
In addition to multi-line codeblocks, discord has support for inline codeblocks as well. These are small codeblocks that are usually a single line, that can fit between non-codeblocks on the same line.
The following is an example of how it's done:
The \`\_\_init\_\_\` method customizes the newly created instance.
And results in the following:
The `__init__` method customizes the newly created instance.
**Note:**
• These are **backticks** not quotes
• Avoid using them for multiple lines
• Useful for negating formatting you don't want
| {
"pile_set_name": "Github"
} |
---
description: Learn the technologies that support storage drivers.
keywords: container, storage, driver, AUFS, btfs, devicemapper,zvfs
title: About storage drivers
redirect_from:
- /en/latest/terms/layer/
- /engine/installation/userguide/storagedriver/
- /engine/userguide/storagedriver/imagesandcontainers/
- /storage/storagedriver/imagesandcontainers/
---
To use storage drivers effectively, it's important to know how Docker builds and
stores images, and how these images are used by containers. You can use this
information to make informed choices about the best way to persist data from
your applications and avoid performance problems along the way.
Storage drivers allow you to create data in the writable layer of your container.
The files won't be persisted after the container is deleted, and both read and
write speeds are lower than native file system performance.
> **Note**: Operations that are known to be problematic include write-intensive database storage,
particularly when pre-existing data exists in the read-only layer. More details are provided in this document.
[Learn how to use volumes](../volumes.md) to persist data and improve performance.
## Images and layers
A Docker image is built up from a series of layers. Each layer represents an
instruction in the image's Dockerfile. Each layer except the very last one is
read-only. Consider the following Dockerfile:
```dockerfile
FROM ubuntu:18.04
COPY . /app
RUN make /app
CMD python /app/app.py
```
This Dockerfile contains four commands, each of which creates a layer. The
`FROM` statement starts out by creating a layer from the `ubuntu:18.04` image.
The `COPY` command adds some files from your Docker client's current directory.
The `RUN` command builds your application using the `make` command. Finally,
the last layer specifies what command to run within the container.
Each layer is only a set of differences from the layer before it. The layers are
stacked on top of each other. When you create a new container, you add a new
writable layer on top of the underlying layers. This layer is often called the
"container layer". All changes made to the running container, such as writing
new files, modifying existing files, and deleting files, are written to this thin
writable container layer. The diagram below shows a container based on the Ubuntu
15.04 image.

A _storage driver_ handles the details about the way these layers interact with
each other. Different storage drivers are available, which have advantages
and disadvantages in different situations.
## Container and layers
The major difference between a container and an image is the top writable layer.
All writes to the container that add new or modify existing data are stored in
this writable layer. When the container is deleted, the writable layer is also
deleted. The underlying image remains unchanged.
Because each container has its own writable container layer, and all changes are
stored in this container layer, multiple containers can share access to the same
underlying image and yet have their own data state. The diagram below shows
multiple containers sharing the same Ubuntu 15.04 image.

> **Note**: If you need multiple images to have shared access to the exact
> same data, store this data in a Docker volume and mount it into your
> containers.
Docker uses storage drivers to manage the contents of the image layers and the
writable container layer. Each storage driver handles the implementation
differently, but all drivers use stackable image layers and the copy-on-write
(CoW) strategy.
## Container size on disk
To view the approximate size of a running container, you can use the `docker ps -s`
command. Two different columns relate to size.
- `size`: the amount of data (on disk) that is used for the writable layer of
each container.
- `virtual size`: the amount of data used for the read-only image data
used by the container plus the container's writable layer `size`.
Multiple containers may share some or all read-only
image data. Two containers started from the same image share 100% of the
read-only data, while two containers with different images which have layers
in common share those common layers. Therefore, you can't just total the
virtual sizes. This over-estimates the total disk usage by a potentially
non-trivial amount.
The total disk space used by all of the running containers on disk is some
combination of each container's `size` and the `virtual size` values. If
multiple containers started from the same exact image, the total size on disk for
these containers would be SUM (`size` of containers) plus one image size
(`virtual size`- `size`).
This also does not count the following additional ways a container can take up
disk space:
- Disk space used for log files if you use the `json-file` logging driver. This
can be non-trivial if your container generates a large amount of logging data
and log rotation is not configured.
- Volumes and bind mounts used by the container.
- Disk space used for the container's configuration files, which are typically
small.
- Memory written to disk (if swapping is enabled).
- Checkpoints, if you're using the experimental checkpoint/restore feature.
## The copy-on-write (CoW) strategy
Copy-on-write is a strategy of sharing and copying files for maximum efficiency.
If a file or directory exists in a lower layer within the image, and another
layer (including the writable layer) needs read access to it, it just uses the
existing file. The first time another layer needs to modify the file (when
building the image or running the container), the file is copied into that layer
and modified. This minimizes I/O and the size of each of the subsequent layers.
These advantages are explained in more depth below.
### Sharing promotes smaller images
When you use `docker pull` to pull down an image from a repository, or when you
create a container from an image that does not yet exist locally, each layer is
pulled down separately, and stored in Docker's local storage area, which is
usually `/var/lib/docker/` on Linux hosts. You can see these layers being pulled
in this example:
```bash
$ docker pull ubuntu:18.04
18.04: Pulling from library/ubuntu
f476d66f5408: Pull complete
8882c27f669e: Pull complete
d9af21273955: Pull complete
f5029279ec12: Pull complete
Digest: sha256:ab6cb8de3ad7bb33e2534677f865008535427390b117d7939193f8d1a6613e34
Status: Downloaded newer image for ubuntu:18.04
```
Each of these layers is stored in its own directory inside the Docker host's
local storage area. To examine the layers on the filesystem, list the contents
of `/var/lib/docker/<storage-driver>`. This example uses the `overlay2`
storage driver:
```bash
$ ls /var/lib/docker/overlay2
16802227a96c24dcbeab5b37821e2b67a9f921749cd9a2e386d5a6d5bc6fc6d3
377d73dbb466e0bc7c9ee23166771b35ebdbe02ef17753d79fd3571d4ce659d7
3f02d96212b03e3383160d31d7c6aeca750d2d8a1879965b89fe8146594c453d
ec1ec45792908e90484f7e629330666e7eee599f08729c93890a7205a6ba35f5
l
```
The directory names do not correspond to the layer IDs (this has been true since
Docker 1.10).
Now imagine that you have two different Dockerfiles. You use the first one to
create an image called `acme/my-base-image:1.0`.
```dockerfile
FROM ubuntu:18.04
COPY . /app
```
The second one is based on `acme/my-base-image:1.0`, but has some additional
layers:
```dockerfile
FROM acme/my-base-image:1.0
CMD /app/hello.sh
```
The second image contains all the layers from the first image, plus a new layer
with the `CMD` instruction, and a read-write container layer. Docker already
has all the layers from the first image, so it does not need to pull them again.
The two images share any layers they have in common.
If you build images from the two Dockerfiles, you can use `docker image ls` and
`docker history` commands to verify that the cryptographic IDs of the shared
layers are the same.
1. Make a new directory `cow-test/` and change into it.
2. Within `cow-test/`, create a new file called `hello.sh` with the following contents:
```bash
#!/bin/sh
echo "Hello world"
```
Save the file, and make it executable:
```bash
chmod +x hello.sh
```
3. Copy the contents of the first Dockerfile above into a new file called
`Dockerfile.base`.
4. Copy the contents of the second Dockerfile above into a new file called
`Dockerfile`.
5. Within the `cow-test/` directory, build the first image. Don't forget to
include the final `.` in the command. That sets the `PATH`, which tells
Docker where to look for any files that need to be added to the image.
```bash
$ docker build -t acme/my-base-image:1.0 -f Dockerfile.base .
Sending build context to Docker daemon 812.4MB
Step 1/2 : FROM ubuntu:18.04
---> d131e0fa2585
Step 2/2 : COPY . /app
---> Using cache
---> bd09118bcef6
Successfully built bd09118bcef6
Successfully tagged acme/my-base-image:1.0
```
6. Build the second image.
```bash
$ docker build -t acme/my-final-image:1.0 -f Dockerfile .
Sending build context to Docker daemon 4.096kB
Step 1/2 : FROM acme/my-base-image:1.0
---> bd09118bcef6
Step 2/2 : CMD /app/hello.sh
---> Running in a07b694759ba
---> dbf995fc07ff
Removing intermediate container a07b694759ba
Successfully built dbf995fc07ff
Successfully tagged acme/my-final-image:1.0
```
7. Check out the sizes of the images:
```bash
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
acme/my-final-image 1.0 dbf995fc07ff 58 seconds ago 103MB
acme/my-base-image 1.0 bd09118bcef6 3 minutes ago 103MB
```
8. Check out the layers that comprise each image:
```bash
$ docker history bd09118bcef6
IMAGE CREATED CREATED BY SIZE COMMENT
bd09118bcef6 4 minutes ago /bin/sh -c #(nop) COPY dir:35a7eb158c1504e... 100B
d131e0fa2585 3 months ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B
<missing> 3 months ago /bin/sh -c mkdir -p /run/systemd && echo '... 7B
<missing> 3 months ago /bin/sh -c sed -i 's/^#\s*\(deb.*universe\... 2.78kB
<missing> 3 months ago /bin/sh -c rm -rf /var/lib/apt/lists/* 0B
<missing> 3 months ago /bin/sh -c set -xe && echo '#!/bin/sh' >... 745B
<missing> 3 months ago /bin/sh -c #(nop) ADD file:eef57983bd66e3a... 103MB
```
```bash
$ docker history dbf995fc07ff
IMAGE CREATED CREATED BY SIZE COMMENT
dbf995fc07ff 3 minutes ago /bin/sh -c #(nop) CMD ["/bin/sh" "-c" "/a... 0B
bd09118bcef6 5 minutes ago /bin/sh -c #(nop) COPY dir:35a7eb158c1504e... 100B
d131e0fa2585 3 months ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0B
<missing> 3 months ago /bin/sh -c mkdir -p /run/systemd && echo '... 7B
<missing> 3 months ago /bin/sh -c sed -i 's/^#\s*\(deb.*universe\... 2.78kB
<missing> 3 months ago /bin/sh -c rm -rf /var/lib/apt/lists/* 0B
<missing> 3 months ago /bin/sh -c set -xe && echo '#!/bin/sh' >... 745B
<missing> 3 months ago /bin/sh -c #(nop) ADD file:eef57983bd66e3a... 103MB
```
Notice that all the layers are identical except the top layer of the second
image. All the other layers are shared between the two images, and are only
stored once in `/var/lib/docker/`. The new layer actually doesn't take any
room at all, because it is not changing any files, but only running a command.
> **Note**: The `<missing>` lines in the `docker history` output indicate
> that those layers were built on another system and are not available
> locally. This can be ignored.
### Copying makes containers efficient
When you start a container, a thin writable container layer is added on top of
the other layers. Any changes the container makes to the filesystem are stored
here. Any files the container does not change do not get copied to this writable
layer. This means that the writable layer is as small as possible.
When an existing file in a container is modified, the storage driver performs a
copy-on-write operation. The specifics steps involved depend on the specific
storage driver. For the `aufs`, `overlay`, and `overlay2` drivers, the
copy-on-write operation follows this rough sequence:
* Search through the image layers for the file to update. The process starts
at the newest layer and works down to the base layer one layer at a time.
When results are found, they are added to a cache to speed future operations.
* Perform a `copy_up` operation on the first copy of the file that is found, to
copy the file to the container's writable layer.
* Any modifications are made to this copy of the file, and the container cannot
see the read-only copy of the file that exists in the lower layer.
Btrfs, ZFS, and other drivers handle the copy-on-write differently. You can
read more about the methods of these drivers later in their detailed
descriptions.
Containers that write a lot of data consume more space than containers
that do not. This is because most write operations consume new space in the
container's thin writable top layer.
> **Note**: for write-heavy applications, you should not store the data in
> the container. Instead, use Docker volumes, which are independent of the
> running container and are designed to be efficient for I/O. In addition,
> volumes can be shared among containers and do not increase the size of your
> container's writable layer.
A `copy_up` operation can incur a noticeable performance overhead. This overhead
is different depending on which storage driver is in use. Large files,
lots of layers, and deep directory trees can make the impact more noticeable.
This is mitigated by the fact that each `copy_up` operation only occurs the first
time a given file is modified.
To verify the way that copy-on-write works, the following procedures spins up 5
containers based on the `acme/my-final-image:1.0` image we built earlier and
examines how much room they take up.
> **Note**: This procedure doesn't work on Docker Desktop for Mac or Docker Desktop for Windows.
1. From a terminal on your Docker host, run the following `docker run` commands.
The strings at the end are the IDs of each container.
```bash
$ docker run -dit --name my_container_1 acme/my-final-image:1.0 bash \
&& docker run -dit --name my_container_2 acme/my-final-image:1.0 bash \
&& docker run -dit --name my_container_3 acme/my-final-image:1.0 bash \
&& docker run -dit --name my_container_4 acme/my-final-image:1.0 bash \
&& docker run -dit --name my_container_5 acme/my-final-image:1.0 bash
c36785c423ec7e0422b2af7364a7ba4da6146cbba7981a0951fcc3fa0430c409
dcad7101795e4206e637d9358a818e5c32e13b349e62b00bf05cd5a4343ea513
1e7264576d78a3134fbaf7829bc24b1d96017cf2bc046b7cd8b08b5775c33d0c
38fa94212a419a082e6a6b87a8e2ec4a44dd327d7069b85892a707e3fc818544
1a174fc216cccf18ec7d4fe14e008e30130b11ede0f0f94a87982e310cf2e765
```
2. Run the `docker ps` command to verify the 5 containers are running.
```bash
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1a174fc216cc acme/my-final-image:1.0 "bash" About a minute ago Up About a minute my_container_5
38fa94212a41 acme/my-final-image:1.0 "bash" About a minute ago Up About a minute my_container_4
1e7264576d78 acme/my-final-image:1.0 "bash" About a minute ago Up About a minute my_container_3
dcad7101795e acme/my-final-image:1.0 "bash" About a minute ago Up About a minute my_container_2
c36785c423ec acme/my-final-image:1.0 "bash" About a minute ago Up About a minute my_container_1
```
3. List the contents of the local storage area.
```bash
$ sudo ls /var/lib/docker/containers
1a174fc216cccf18ec7d4fe14e008e30130b11ede0f0f94a87982e310cf2e765
1e7264576d78a3134fbaf7829bc24b1d96017cf2bc046b7cd8b08b5775c33d0c
38fa94212a419a082e6a6b87a8e2ec4a44dd327d7069b85892a707e3fc818544
c36785c423ec7e0422b2af7364a7ba4da6146cbba7981a0951fcc3fa0430c409
dcad7101795e4206e637d9358a818e5c32e13b349e62b00bf05cd5a4343ea513
```
4. Now check out their sizes:
```bash
$ sudo du -sh /var/lib/docker/containers/*
32K /var/lib/docker/containers/1a174fc216cccf18ec7d4fe14e008e30130b11ede0f0f94a87982e310cf2e765
32K /var/lib/docker/containers/1e7264576d78a3134fbaf7829bc24b1d96017cf2bc046b7cd8b08b5775c33d0c
32K /var/lib/docker/containers/38fa94212a419a082e6a6b87a8e2ec4a44dd327d7069b85892a707e3fc818544
32K /var/lib/docker/containers/c36785c423ec7e0422b2af7364a7ba4da6146cbba7981a0951fcc3fa0430c409
32K /var/lib/docker/containers/dcad7101795e4206e637d9358a818e5c32e13b349e62b00bf05cd5a4343ea513
```
Each of these containers only takes up 32k of space on the filesystem.
Not only does copy-on-write save space, but it also reduces start-up time.
When you start a container (or multiple containers from the same image), Docker
only needs to create the thin writable container layer.
If Docker had to make an entire copy of the underlying image stack each time it
started a new container, container start times and disk space used would be
significantly increased. This would be similar to the way that virtual machines
work, with one or more virtual disks per virtual machine.
## Related information
* [Volumes](../volumes.md)
* [Select a storage driver](select-storage-driver.md)
| {
"pile_set_name": "Github"
} |
// Copyright 2019 The TensorFlow Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import ArgumentParser
struct Options: ParsableArguments {
@Option(help: ArgumentHelp("Path to the dataset folder", valueName: "dataset-path"))
var datasetPath: String?
@Option(help: ArgumentHelp("Number of epochs", valueName: "epochs"))
var epochs: Int = 1
@Option(help: ArgumentHelp("Number of steps to log a sample image into tensorboard", valueName: "sampleLogPeriod"))
var sampleLogPeriod: Int = 20
}
| {
"pile_set_name": "Github"
} |
; RUN: llc < %s
@a_str = internal constant [8 x i8] c"a = %d\0A\00" ; <[8 x i8]*> [#uses=1]
@b_str = internal constant [8 x i8] c"b = %d\0A\00" ; <[8 x i8]*> [#uses=1]
@a_shl_str = internal constant [14 x i8] c"a << %d = %d\0A\00" ; <[14 x i8]*> [#uses=1]
@A = global i32 2 ; <i32*> [#uses=1]
@B = global i32 5 ; <i32*> [#uses=1]
declare i32 @printf(i8*, ...)
define i32 @main() {
entry:
%a = load i32* @A ; <i32> [#uses=2]
%b = load i32* @B ; <i32> [#uses=1]
%a_s = getelementptr [8 x i8]* @a_str, i64 0, i64 0 ; <i8*> [#uses=1]
%b_s = getelementptr [8 x i8]* @b_str, i64 0, i64 0 ; <i8*> [#uses=1]
%a_shl_s = getelementptr [14 x i8]* @a_shl_str, i64 0, i64 0 ; <i8*> [#uses=1]
call i32 (i8*, ...)* @printf( i8* %a_s, i32 %a ) ; <i32>:0 [#uses=0]
call i32 (i8*, ...)* @printf( i8* %b_s, i32 %b ) ; <i32>:1 [#uses=0]
br label %shl_test
shl_test: ; preds = %shl_test, %entry
%s = phi i8 [ 0, %entry ], [ %s_inc, %shl_test ] ; <i8> [#uses=4]
%shift.upgrd.1 = zext i8 %s to i32 ; <i32> [#uses=1]
%result = shl i32 %a, %shift.upgrd.1 ; <i32> [#uses=1]
call i32 (i8*, ...)* @printf( i8* %a_shl_s, i8 %s, i32 %result ) ; <i32>:2 [#uses=0]
%s_inc = add i8 %s, 1 ; <i8> [#uses=1]
%done = icmp eq i8 %s, 32 ; <i1> [#uses=1]
br i1 %done, label %fini, label %shl_test
fini: ; preds = %shl_test
ret i32 0
}
| {
"pile_set_name": "Github"
} |
/* $OpenBSD: cfb64ede.c,v 1.9 2015/02/07 13:19:15 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* 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 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 cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#include "des_locl.h"
/* The input and output encrypted as though 64bit cfb mode is being
* used. The extra state information to record how much of the
* 64bit block we have used is contained in *num;
*/
void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
long length, DES_key_schedule *ks1,
DES_key_schedule *ks2, DES_key_schedule *ks3,
DES_cblock *ivec, int *num, int enc)
{
DES_LONG v0,v1;
long l=length;
int n= *num;
DES_LONG ti[2];
unsigned char *iv,c,cc;
iv=&(*ivec)[0];
if (enc)
{
while (l--)
{
if (n == 0)
{
c2l(iv,v0);
c2l(iv,v1);
ti[0]=v0;
ti[1]=v1;
DES_encrypt3(ti,ks1,ks2,ks3);
v0=ti[0];
v1=ti[1];
iv = &(*ivec)[0];
l2c(v0,iv);
l2c(v1,iv);
iv = &(*ivec)[0];
}
c= *(in++)^iv[n];
*(out++)=c;
iv[n]=c;
n=(n+1)&0x07;
}
}
else
{
while (l--)
{
if (n == 0)
{
c2l(iv,v0);
c2l(iv,v1);
ti[0]=v0;
ti[1]=v1;
DES_encrypt3(ti,ks1,ks2,ks3);
v0=ti[0];
v1=ti[1];
iv = &(*ivec)[0];
l2c(v0,iv);
l2c(v1,iv);
iv = &(*ivec)[0];
}
cc= *(in++);
c=iv[n];
iv[n]=cc;
*(out++)=c^cc;
n=(n+1)&0x07;
}
}
v0=v1=ti[0]=ti[1]=c=cc=0;
*num=n;
}
/* This is compatible with the single key CFB-r for DES, even thought that's
* not what EVP needs.
*/
void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out,
int numbits,long length,DES_key_schedule *ks1,
DES_key_schedule *ks2,DES_key_schedule *ks3,
DES_cblock *ivec,int enc)
{
DES_LONG d0,d1,v0,v1;
unsigned long l=length,n=((unsigned int)numbits+7)/8;
int num=numbits,i;
DES_LONG ti[2];
unsigned char *iv;
unsigned char ovec[16];
if (num > 64) return;
iv = &(*ivec)[0];
c2l(iv,v0);
c2l(iv,v1);
if (enc)
{
while (l >= n)
{
l-=n;
ti[0]=v0;
ti[1]=v1;
DES_encrypt3(ti,ks1,ks2,ks3);
c2ln(in,d0,d1,n);
in+=n;
d0^=ti[0];
d1^=ti[1];
l2cn(d0,d1,out,n);
out+=n;
/* 30-08-94 - eay - changed because l>>32 and
* l<<32 are bad under gcc :-( */
if (num == 32)
{ v0=v1; v1=d0; }
else if (num == 64)
{ v0=d0; v1=d1; }
else
{
iv=&ovec[0];
l2c(v0,iv);
l2c(v1,iv);
l2c(d0,iv);
l2c(d1,iv);
/* shift ovec left most of the bits... */
memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0));
/* now the remaining bits */
if(num%8 != 0)
for(i=0 ; i < 8 ; ++i)
{
ovec[i]<<=num%8;
ovec[i]|=ovec[i+1]>>(8-num%8);
}
iv=&ovec[0];
c2l(iv,v0);
c2l(iv,v1);
}
}
}
else
{
while (l >= n)
{
l-=n;
ti[0]=v0;
ti[1]=v1;
DES_encrypt3(ti,ks1,ks2,ks3);
c2ln(in,d0,d1,n);
in+=n;
/* 30-08-94 - eay - changed because l>>32 and
* l<<32 are bad under gcc :-( */
if (num == 32)
{ v0=v1; v1=d0; }
else if (num == 64)
{ v0=d0; v1=d1; }
else
{
iv=&ovec[0];
l2c(v0,iv);
l2c(v1,iv);
l2c(d0,iv);
l2c(d1,iv);
/* shift ovec left most of the bits... */
memmove(ovec,ovec+num/8,8+(num%8 ? 1 : 0));
/* now the remaining bits */
if(num%8 != 0)
for(i=0 ; i < 8 ; ++i)
{
ovec[i]<<=num%8;
ovec[i]|=ovec[i+1]>>(8-num%8);
}
iv=&ovec[0];
c2l(iv,v0);
c2l(iv,v1);
}
d0^=ti[0];
d1^=ti[1];
l2cn(d0,d1,out,n);
out+=n;
}
}
iv = &(*ivec)[0];
l2c(v0,iv);
l2c(v1,iv);
v0=v1=d0=d1=ti[0]=ti[1]=0;
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// Code forked from Betsegaw Tadele's https://github.com/betsegaw/windowwalker/
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Microsoft.Plugin.WindowWalker.Components
{
/// <summary>
/// Interop calls with helper layers
/// </summary>
internal class NativeMethods
{
public delegate bool CallBackPtr(IntPtr hwnd, IntPtr lParam);
/// <summary>
/// Some flags for interop calls to SetWindowPosition
/// </summary>
[Flags]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1069:Enums values should not be duplicated", Justification = "These are defined in win32 libraries. See https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowpos")]
public enum SetWindowPosFlags : uint
{
/// <summary>
/// If the calling thread and the thread that owns the window are attached to different input queues, the system posts the request to the thread that owns the window. This prevents the calling thread from blocking its execution while other threads process the request.
/// </summary>
SWP_ASYNCWINDOWPOS = 0x4000,
/// <summary>
/// Prevents generation of the WM_SYNCPAINT message.
/// </summary>
SWP_DEFERERASE = 0x2000,
/// <summary>
/// Draws a frame (defined in the window's class description) around the window.
/// </summary>
SWP_DRAWFRAME = 0x0020,
/// <summary>
/// Applies new frame styles set using the SetWindowLong function. Sends a WM_NCCALCSIZE message to the window, even if the window's size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window's size is being changed.
/// </summary>
SWP_FRAMECHANGED = 0x0020,
/// <summary>
/// Hides the window.
/// </summary>
SWP_HIDEWINDOW = 0x0080,
/// <summary>
/// Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
/// </summary>
SWP_NOACTIVATE = 0x0010,
/// <summary>
/// Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
/// </summary>
SWP_NOCOPYBITS = 0x0100,
/// <summary>
/// Retains the current position (ignores X and Y parameters).
/// </summary>
SWP_NOMOVE = 0x0002,
/// <summary>
/// Does not change the owner window's position in the Z order.
/// </summary>
SWP_NOOWNERZORDER = 0x0200,
/// <summary>
/// Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
/// </summary>
SWP_NOREDRAW = 0x0008,
/// <summary>
/// Same as the SWP_NOOWNERZORDER flag.
/// </summary>
SWP_NOREPOSITION = 0x0200,
/// <summary>
/// Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
/// </summary>
SWP_NOSENDCHANGING = 0x0400,
/// <summary>
/// Retains the current size (ignores the cx and cy parameters).
/// </summary>
SWP_NOSIZE = 0x0001,
/// <summary>
/// Retains the current Z order (ignores the hWndInsertAfter parameter).
/// </summary>
SWP_NOZORDER = 0x0004,
/// <summary>
/// Displays the window.
/// </summary>
SWP_SHOWWINDOW = 0x0040,
}
/// <summary>
/// Flags for setting hotkeys
/// </summary>
[Flags]
public enum Modifiers
{
NoMod = 0x0000,
Alt = 0x0001,
Ctrl = 0x0002,
Shift = 0x0004,
Win = 0x0008,
}
/// <summary>
/// Options for DwmpActivateLivePreview
/// </summary>
public enum LivePreviewTrigger
{
/// <summary>
/// Show Desktop button
/// </summary>
ShowDesktop = 1,
/// <summary>
/// WIN+SPACE hotkey
/// </summary>
WinSpace,
/// <summary>
/// Hover-over Superbar thumbnails
/// </summary>
Superbar,
/// <summary>
/// Alt-Tab
/// </summary>
AltTab,
/// <summary>
/// Press and hold on Superbar thumbnails
/// </summary>
SuperbarTouch,
/// <summary>
/// Press and hold on Show desktop
/// </summary>
ShowDesktopTouch,
}
/// <summary>
/// Show Window Enums
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1069:Enums values should not be duplicated", Justification = "This is defined in the ShowWindow win32 method. See https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow")]
public enum ShowWindowCommands
{
/// <summary>
/// Hides the window and activates another window.
/// </summary>
Hide = 0,
/// <summary>
/// Activates and displays a window. If the window is minimized or
/// maximized, the system restores it to its original size and position.
/// An application should specify this flag when displaying the window
/// for the first time.
/// </summary>
Normal = 1,
/// <summary>
/// Activates the window and displays it as a minimized window.
/// </summary>
ShowMinimized = 2,
/// <summary>
/// Maximizes the specified window.
/// </summary>
Maximize = 3, // is this the right value?
/// <summary>
/// Activates the window and displays it as a maximized window.
/// </summary>
ShowMaximized = 3,
/// <summary>
/// Displays a window in its most recent size and position. This value
/// is similar to <see cref="Win32.ShowWindowCommand.Normal"/>, except
/// the window is not activated.
/// </summary>
ShowNoActivate = 4,
/// <summary>
/// Activates the window and displays it in its current size and position.
/// </summary>
Show = 5,
/// <summary>
/// Minimizes the specified window and activates the next top-level
/// window in the Z order.
/// </summary>
Minimize = 6,
/// <summary>
/// Displays the window as a minimized window. This value is similar to
/// <see cref="Win32.ShowWindowCommand.ShowMinimized"/>, except the
/// window is not activated.
/// </summary>
ShowMinNoActive = 7,
/// <summary>
/// Displays the window in its current size and position. This value is
/// similar to <see cref="Win32.ShowWindowCommand.Show"/>, except the
/// window is not activated.
/// </summary>
ShowNA = 8,
/// <summary>
/// Activates and displays the window. If the window is minimized or
/// maximized, the system restores it to its original size and position.
/// An application should specify this flag when restoring a minimized window.
/// </summary>
Restore = 9,
/// <summary>
/// Sets the show state based on the SW_* value specified in the
/// STARTUPINFO structure passed to the CreateProcess function by the
/// program that started the application.
/// </summary>
ShowDefault = 10,
/// <summary>
/// <b>Windows 2000/XP:</b> Minimizes a window, even if the thread
/// that owns the window is not responding. This flag should only be
/// used when minimizing windows from a different thread.
/// </summary>
ForceMinimize = 11,
}
/// <summary>
/// The rendering policy to use for set window attribute
/// </summary>
[Flags]
public enum DwmNCRenderingPolicy
{
UseWindowStyle,
Disabled,
Enabled,
Last,
}
/// <summary>
/// Window attribute
/// </summary>
[Flags]
public enum DwmWindowAttribute
{
NCRenderingEnabled = 1,
NCRenderingPolicy,
TransitionsForceDisabled,
AllowNCPaint,
CaptionButtonBounds,
NonClientRtlLayout,
ForceIconicRepresentation,
Flip3DPolicy,
ExtendedFrameBounds,
HasIconicBitmap,
DisallowPeek,
ExcludedFromPeek,
Last,
}
/// <summary>
/// Flags for accessing the process in trying to get icon for the process
/// </summary>
[Flags]
public enum ProcessAccessFlags
{
/// <summary>
/// Required to create a thread.
/// </summary>
CreateThread = 0x0002,
/// <summary>
///
/// </summary>
SetSessionId = 0x0004,
/// <summary>
/// Required to perform an operation on the address space of a process
/// </summary>
VmOperation = 0x0008,
/// <summary>
/// Required to read memory in a process using ReadProcessMemory.
/// </summary>
VmRead = 0x0010,
/// <summary>
/// Required to write to memory in a process using WriteProcessMemory.
/// </summary>
VmWrite = 0x0020,
/// <summary>
/// Required to duplicate a handle using DuplicateHandle.
/// </summary>
DupHandle = 0x0040,
/// <summary>
/// Required to create a process.
/// </summary>
CreateProcess = 0x0080,
/// <summary>
/// Required to set memory limits using SetProcessWorkingSetSize.
/// </summary>
SetQuota = 0x0100,
/// <summary>
/// Required to set certain information about a process, such as its priority class (see SetPriorityClass).
/// </summary>
SetInformation = 0x0200,
/// <summary>
/// Required to retrieve certain information about a process, such as its token, exit code, and priority class (see OpenProcessToken).
/// </summary>
QueryInformation = 0x0400,
/// <summary>
/// Required to suspend or resume a process.
/// </summary>
SuspendResume = 0x0800,
/// <summary>
/// Required to retrieve certain information about a process (see GetExitCodeProcess, GetPriorityClass, IsProcessInJob, QueryFullProcessImageName).
/// A handle that has the PROCESS_QUERY_INFORMATION access right is automatically granted PROCESS_QUERY_LIMITED_INFORMATION.
/// </summary>
QueryLimitedInformation = 0x1000,
/// <summary>
/// Required to wait for the process to terminate using the wait functions.
/// </summary>
Synchronize = 0x100000,
/// <summary>
/// Required to delete the object.
/// </summary>
Delete = 0x00010000,
/// <summary>
/// Required to read information in the security descriptor for the object, not including the information in the SACL.
/// To read or write the SACL, you must request the ACCESS_SYSTEM_SECURITY access right. For more information, see SACL Access Right.
/// </summary>
ReadControl = 0x00020000,
/// <summary>
/// Required to modify the DACL in the security descriptor for the object.
/// </summary>
WriteDac = 0x00040000,
/// <summary>
/// Required to change the owner in the security descriptor for the object.
/// </summary>
WriteOwner = 0x00080000,
StandardRightsRequired = 0x000F0000,
/// <summary>
/// All possible access rights for a process object.
/// </summary>
AllAccess = StandardRightsRequired | Synchronize | 0xFFFF,
}
/// <summary>
/// Contains information about the placement of a window on the screen.
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
internal struct WINDOWPLACEMENT
{
/// <summary>
/// The length of the structure, in bytes. Before calling the GetWindowPlacement or SetWindowPlacement functions, set this member to sizeof(WINDOWPLACEMENT).
/// <para>
/// GetWindowPlacement and SetWindowPlacement fail if this member is not set correctly.
/// </para>
/// </summary>
public int Length;
/// <summary>
/// Specifies flags that control the position of the minimized window and the method by which the window is restored.
/// </summary>
public int Flags;
/// <summary>
/// The current show state of the window.
/// </summary>
public ShowWindowCommands ShowCmd;
/// <summary>
/// The coordinates of the window's upper-left corner when the window is minimized.
/// </summary>
public POINT MinPosition;
/// <summary>
/// The coordinates of the window's upper-left corner when the window is maximized.
/// </summary>
public POINT MaxPosition;
/// <summary>
/// The window's coordinates when the window is in the restored position.
/// </summary>
public RECT NormalPosition;
/// <summary>
/// Gets the default (empty) value.
/// </summary>
public static WINDOWPLACEMENT Default
{
get
{
WINDOWPLACEMENT result = default;
result.Length = Marshal.SizeOf(result);
return result;
}
}
}
/// <summary>
/// Required pointless variables that we don't use in making a windows show
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct RECT : IEquatable<RECT>
{
public int Left;
public int Top;
public int Right;
public int Bottom;
public RECT(int left, int top, int right, int bottom)
{
Left = left;
Top = top;
Right = right;
Bottom = bottom;
}
public RECT(System.Drawing.Rectangle r)
: this(r.Left, r.Top, r.Right, r.Bottom)
{
}
public int X
{
get
{
return Left;
}
set
{
Right -= Left - value;
Left = value;
}
}
public int Y
{
get
{
return Top;
}
set
{
Bottom -= Top - value;
Top = value;
}
}
public int Height
{
get { return Bottom - Top; }
set { Bottom = value + Top; }
}
public int Width
{
get { return Right - Left; }
set { Right = value + Left; }
}
public System.Drawing.Point Location
{
get
{
return new System.Drawing.Point(Left, Top);
}
set
{
X = value.X;
Y = value.Y;
}
}
public System.Drawing.Size Size
{
get
{
return new System.Drawing.Size(Width, Height);
}
set
{
Width = value.Width;
Height = value.Height;
}
}
public static implicit operator System.Drawing.Rectangle(RECT r)
{
return new System.Drawing.Rectangle(r.Left, r.Top, r.Width, r.Height);
}
public static implicit operator RECT(System.Drawing.Rectangle r)
{
return new RECT(r);
}
public static bool operator ==(RECT r1, RECT r2)
{
return r1.Equals(r2);
}
public static bool operator !=(RECT r1, RECT r2)
{
return !r1.Equals(r2);
}
public bool Equals(RECT r)
{
return r.Left == Left && r.Top == Top && r.Right == Right && r.Bottom == Bottom;
}
public override bool Equals(object obj)
{
if (obj is RECT)
{
return Equals((RECT)obj);
}
else if (obj is System.Drawing.Rectangle)
{
return Equals(new RECT((System.Drawing.Rectangle)obj));
}
return false;
}
public override int GetHashCode()
{
return ((System.Drawing.Rectangle)this).GetHashCode();
}
public override string ToString()
{
return string.Format(System.Globalization.CultureInfo.CurrentCulture, "{{Left={0},Top={1},Right={2},Bottom={3}}}", Left, Top, Right, Bottom);
}
}
/// <summary>
/// Same as the RECT struct above
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct POINT
{
public int X;
public int Y;
public POINT(int x, int y)
{
X = x;
Y = y;
}
public POINT(System.Drawing.Point pt)
: this(pt.X, pt.Y)
{
}
public static implicit operator System.Drawing.Point(POINT p)
{
return new System.Drawing.Point(p.X, p.Y);
}
public static implicit operator POINT(System.Drawing.Point p)
{
return new POINT(p.X, p.Y);
}
}
/// <summary>
/// GetWindow relationship between the specified window and the window whose handle is to be retrieved.
/// </summary>
public enum GetWindowCmd : uint
{
/// <summary>
/// The retrieved handle identifies the window of the same type that is highest in the Z order.
/// </summary>
GW_HWNDFIRST = 0,
/// <summary>
/// The retrieved handle identifies the window of the same type that is lowest in the Z order.
/// </summary>
GW_HWNDLAST = 1,
/// <summary>
/// The retrieved handle identifies the window below the specified window in the Z order.
/// </summary>
GW_HWNDNEXT = 2,
/// <summary>
/// The retrieved handle identifies the window above the specified window in the Z order.
/// </summary>
GW_HWNDPREV = 3,
/// <summary>
/// The retrieved handle identifies the specified window's owner window, if any.
/// </summary>
GW_OWNER = 4,
/// <summary>
/// The retrieved handle identifies the child window at the top of the Z order, if the specified window
/// is a parent window.
/// </summary>
GW_CHILD = 5,
/// <summary>
/// The retrieved handle identifies the enabled popup window owned by the specified window.
/// </summary>
GW_ENABLEDPOPUP = 6,
}
/// <summary>
/// GetWindowLong index to retrieves the extended window styles.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching interop var")]
public const int GWL_EXSTYLE = -20;
/// <summary>
/// The following are the extended window styles
/// </summary>
[Flags]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1069:Enums values should not be duplicated", Justification = "These values are specific in the win32 libraries. See https://docs.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles")]
public enum ExtendedWindowStyles : uint
{
/// <summary>
/// The window has a double border; the window can, optionally, be created with a title bar by specifying
/// the WS_CAPTION style in the dwStyle parameter.
/// </summary>
WS_EX_DLGMODALFRAME = 0X0001,
/// <summary>
/// The child window created with this style does not send the WM_PARENTNOTIFY message to its parent window
/// when it is created or destroyed.
/// </summary>
WS_EX_NOPARENTNOTIFY = 0X0004,
/// <summary>
/// The window should be placed above all non-topmost windows and should stay above all non-topmost windows
/// and should stay above them, even when the window is deactivated.
/// </summary>
WS_EX_TOPMOST = 0X0008,
/// <summary>
/// The window accepts drag-drop files.
/// </summary>
WS_EX_ACCEPTFILES = 0x0010,
/// <summary>
/// The window should not be painted until siblings beneath the window (that were created by the same thread)
/// have been painted.
/// </summary>
WS_EX_TRANSPARENT = 0x0020,
/// <summary>
/// The window is a MDI child window.
/// </summary>
WS_EX_MDICHILD = 0x0040,
/// <summary>
/// The window is intended to be used as a floating toolbar. A tool window has a title bar that is shorter
/// than a normal title bar, and the window title is drawn using a smaller font. A tool window does not
/// appear in the taskbar or in the dialog that appears when the user presses ALT+TAB.
/// </summary>
WS_EX_TOOLWINDOW = 0x0080,
/// <summary>
/// The window has a border with a raised edge.
/// </summary>
WS_EX_WINDOWEDGE = 0x0100,
/// <summary>
/// The window has a border with a sunken edge.
/// </summary>
WS_EX_CLIENTEDGE = 0x0200,
/// <summary>
/// The title bar of the window includes a question mark.
/// </summary>
WS_EX_CONTEXTHELP = 0x0400,
/// <summary>
/// The window has generic "right-aligned" properties. This depends on the window class. This style has
/// an effect only if the shell language supports reading-order alignment, otherwise is ignored.
/// </summary>
WS_EX_RIGHT = 0x1000,
/// <summary>
/// The window has generic left-aligned properties. This is the default.
/// </summary>
WS_EX_LEFT = 0x0,
/// <summary>
/// If the shell language supports reading-order alignment, the window text is displayed using right-to-left
/// reading-order properties. For other languages, the styles is ignored.
/// </summary>
WS_EX_RTLREADING = 0x2000,
/// <summary>
/// The window text is displayed using left-to-right reading-order properties. This is the default.
/// </summary>
WS_EX_LTRREADING = 0x0,
/// <summary>
/// If the shell language supports reading order alignment, the vertical scroll bar (if present) is to
/// the left of the client area. For other languages, the style is ignored.
/// </summary>
WS_EX_LEFTSCROLLBAR = 0x4000,
/// <summary>
/// The vertical scroll bar (if present) is to the right of the client area. This is the default.
/// </summary>
WS_EX_RIGHTSCROLLBAR = 0x0,
/// <summary>
/// The window itself contains child windows that should take part in dialog box, navigation. If this
/// style is specified, the dialog manager recurses into children of this window when performing
/// navigation operations such as handling tha TAB key, an arrow key, or a keyboard mnemonic.
/// </summary>
WS_EX_CONTROLPARENT = 0x10000,
/// <summary>
/// The window has a three-dimensional border style intended to be used for items that do not accept
/// user input.
/// </summary>
WS_EX_STATICEDGE = 0x20000,
/// <summary>
/// Forces a top-level window onto the taskbar when the window is visible.
/// </summary>
WS_EX_APPWINDOW = 0x40000,
/// <summary>
/// The window is an overlapped window.
/// </summary>
WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE,
/// <summary>
/// The window is palette window, which is a modeless dialog box that presents an array of commands.
/// </summary>
WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST,
/// <summary>
/// The window is a layered window. This style cannot be used if the window has a class style of either
/// CS_OWNDC or CS_CLASSDC. Only for top level window before Windows 8, and child windows from Windows 8.
/// </summary>
WS_EX_LAYERED = 0x80000,
/// <summary>
/// The window does not pass its window layout to its child windows.
/// </summary>
WS_EX_NOINHERITLAYOUT = 0x100000,
/// <summary>
/// If the shell language supports reading order alignment, the horizontal origin of the window is on the
/// right edge. Increasing horizontal values advance to the left.
/// </summary>
WS_EX_LAYOUTRTL = 0x400000,
/// <summary>
/// Paints all descendants of a window in bottom-to-top painting order using double-buffering.
/// Bottom-to-top painting order allows a descendent window to have translucency (alpha) and
/// transparency (color-key) effects, but only if the descendent window also has the WS_EX_TRANSPARENT
/// bit set. Double-buffering allows the window and its descendents to be painted without flicker.
/// </summary>
WS_EX_COMPOSITED = 0x2000000,
/// <summary>
/// A top-level window created with this style does not become the foreground window when the user
/// clicks it. The system does not bring this window to the foreground when the user minimizes or closes
/// the foreground window.
/// </summary>
WS_EX_NOACTIVATE = 0x8000000,
}
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern int EnumWindows(CallBackPtr callPtr, int lPar);
[DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr GetWindow(IntPtr hWnd, GetWindowCmd uCmd);
[DllImport("user32.dll", SetLastError = true)]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern int EnumChildWindows(IntPtr hWnd, CallBackPtr callPtr, int lPar);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern int GetWindowText(IntPtr hWnd, StringBuilder strText, int maxCount);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern int GetWindowTextLength(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool IsWindow(IntPtr hWnd);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags uFlags);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vk);
[DllImport("user32.dll")]
public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool ShowWindow(IntPtr hWnd, ShowWindowCommands nCmdShow);
[DllImport("user32.dll")]
public static extern bool FlashWindow(IntPtr hwnd, bool bInvert);
[DllImport("user32.dll", SetLastError = true)]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
[DllImport("psapi.dll", BestFitMapping = false)]
public static extern uint GetProcessImageFileName(IntPtr hProcess, [Out] StringBuilder lpImageFileName, [In][MarshalAs(UnmanagedType.U4)] int nSize);
[DllImport("user32.dll", SetLastError = true, BestFitMapping = false)]
public static extern IntPtr GetProp(IntPtr hWnd, string lpString);
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(ProcessAccessFlags dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwProcessId);
[DllImport("dwmapi.dll", EntryPoint = "#113", CallingConvention = CallingConvention.StdCall)]
public static extern int DwmpActivateLivePreview([MarshalAs(UnmanagedType.Bool)] bool fActivate, IntPtr hWndExclude, IntPtr hWndInsertBefore, LivePreviewTrigger lpt, IntPtr prcFinalRect);
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
[DllImport("dwmapi.dll", PreserveSig = false)]
public static extern int DwmGetWindowAttribute(IntPtr hwnd, int dwAttribute, out int pvAttribute, int cbAttribute);
[DllImport("user32.dll", BestFitMapping = false)]
public static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetWindowPlacement(IntPtr hWnd, out WINDOWPLACEMENT lpwndpl);
}
}
| {
"pile_set_name": "Github"
} |
<?php
declare(strict_types=1);
/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sonata\Component\Currency;
use Sonata\Doctrine\Entity\BaseEntityManager;
/**
* @author Hugo Briand <briand@ekino.com>
*/
class CurrencyManager extends BaseEntityManager implements CurrencyManagerInterface
{
public function findOneByLabel($currencyLabel)
{
$currency = new Currency();
$currency->setLabel($currencyLabel);
return $currency;
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.lang.LighterASTNode;
import com.intellij.lang.LighterASTTokenNode;
import com.intellij.lang.impl.PsiBuilderImpl;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.ThrowableComputable;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.psi.impl.source.tree.*;
import com.intellij.psi.stubs.ObjectStubSerializer;
import com.intellij.psi.stubs.Stub;
import com.intellij.psi.templateLanguages.OuterLanguageElement;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.util.*;
import com.intellij.util.diff.FlyweightCapableTreeStructure;
import com.intellij.util.exception.FrequentErrorLogger;
import com.intellij.util.graph.InboundSemiGraph;
import com.intellij.util.graph.OutboundSemiGraph;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
@SuppressWarnings({"UtilityClassWithoutPrivateConstructor", "UnusedDeclaration", "TestOnlyProblems"})
public final class DebugUtil {
private static final Logger LOG = Logger.getInstance(DebugUtil.class);
public static /*final*/ boolean CHECK;
public static final boolean DO_EXPENSIVE_CHECKS;
static {
Application application = ApplicationManager.getApplication();
DO_EXPENSIVE_CHECKS = application != null && application.isUnitTestMode();
}
public static final boolean CHECK_INSIDE_ATOMIC_ACTION_ENABLED = DO_EXPENSIVE_CHECKS;
@NotNull
public static String psiTreeToString(@NotNull final PsiElement element, final boolean skipWhitespaces) {
final ASTNode node = SourceTreeToPsiMap.psiElementToTree(element);
assert node != null : element;
return treeToString(node, skipWhitespaces);
}
@NotNull
public static String treeToString(@NotNull final ASTNode root, final boolean skipWhitespaces) {
StringBuilder buffer = new StringBuilder();
treeToBuffer(buffer, root, 0, skipWhitespaces, false, false, true);
return buffer.toString();
}
@NotNull
public static String nodeTreeToString(@NotNull final ASTNode root, final boolean skipWhitespaces) {
StringBuilder buffer = new StringBuilder();
treeToBuffer(buffer, root, 0, skipWhitespaces, false, false, false);
return buffer.toString();
}
@NotNull
public static String treeToString(@NotNull ASTNode root, boolean skipWhitespaces, boolean showRanges) {
StringBuilder buffer = new StringBuilder();
treeToBuffer(buffer, root, 0, skipWhitespaces, showRanges, false, true);
return buffer.toString();
}
public static void treeToBuffer(@NotNull final Appendable buffer,
@NotNull final ASTNode root,
final int indent,
final boolean skipWhiteSpaces,
final boolean showRanges,
final boolean showChildrenRanges,
final boolean usePsi) {
treeToBuffer(buffer, root, indent, skipWhiteSpaces, showRanges, showChildrenRanges, usePsi, null);
}
private static void treeToBuffer(@NotNull final Appendable buffer,
@NotNull final ASTNode root,
final int indent,
final boolean skipWhiteSpaces,
final boolean showRanges,
final boolean showChildrenRanges,
final boolean usePsi,
@Nullable PairConsumer<? super PsiElement, Consumer<PsiElement>> extra) {
((TreeElement) root).acceptTree(
new TreeToBuffer(buffer, indent, skipWhiteSpaces, showRanges, showChildrenRanges, usePsi, extra));
}
private static class TreeToBuffer extends RecursiveTreeElementWalkingVisitor {
final @NonNls Appendable buffer;
final boolean skipWhiteSpaces;
final boolean showRanges;
final boolean showChildrenRanges;
final boolean usePsi;
final PairConsumer<? super PsiElement, Consumer<PsiElement>> extra;
int indent;
TreeToBuffer(Appendable buffer, int indent, boolean skipWhiteSpaces,
boolean showRanges, boolean showChildrenRanges, boolean usePsi,
PairConsumer<? super PsiElement, Consumer<PsiElement>> extra) {
this.buffer = buffer;
this.skipWhiteSpaces = skipWhiteSpaces;
this.showRanges = showRanges;
this.showChildrenRanges = showChildrenRanges;
this.usePsi = usePsi;
this.extra = extra;
this.indent = indent;
}
@Override
protected void visitNode(TreeElement root) {
if (shouldSkipNode(root)) {
indent += 2;
return;
}
StringUtil.repeatSymbol(buffer, ' ', indent);
try {
if (root instanceof CompositeElement) {
if (usePsi) {
PsiElement psiElement = root.getPsi();
if (psiElement != null) {
buffer.append(psiElement.toString());
}
else {
buffer.append(root.getElementType().toString());
}
}
else {
buffer.append(root.toString());
}
}
else {
final String text = fixWhiteSpaces(root.getText());
buffer.append(root.toString()).append("('").append(text).append("')");
}
if (showRanges) buffer.append(root.getTextRange().toString());
buffer.append("\n");
indent += 2;
if (root instanceof CompositeElement && root.getFirstChildNode() == null && showEmptyChildren()) {
StringUtil.repeatSymbol(buffer, ' ', indent);
buffer.append("<empty list>\n");
}
}
catch (IOException e) {
LOG.error(e);
}
super.visitNode(root);
}
protected boolean showEmptyChildren() {
return true;
}
protected boolean shouldSkipNode(TreeElement node) {
return skipWhiteSpaces && node.getElementType() == TokenType.WHITE_SPACE;
}
@Override
protected void elementFinished(@NotNull ASTNode e) {
PsiElement psiElement = extra != null && usePsi && e instanceof CompositeElement ? e.getPsi() : null;
if (psiElement != null) {
extra.consume(psiElement, element ->
treeToBuffer(buffer, element.getNode(), indent, skipWhiteSpaces, showRanges, showChildrenRanges, true, null));
}
indent -= 2;
}
}
@NotNull
public static String lightTreeToString(@NotNull final FlyweightCapableTreeStructure<LighterASTNode> tree,
final boolean skipWhitespaces) {
final StringBuilder buffer = new StringBuilder();
lightTreeToBuffer(tree, tree.getRoot(), buffer, 0, skipWhitespaces);
return buffer.toString();
}
private static void lightTreeToBuffer(@NotNull final FlyweightCapableTreeStructure<LighterASTNode> tree,
@NotNull final LighterASTNode node,
@NotNull @NonNls Appendable buffer,
final int indent,
final boolean skipWhiteSpaces) {
final IElementType tokenType = node.getTokenType();
if (skipWhiteSpaces && tokenType == TokenType.WHITE_SPACE) return;
final boolean isLeaf = (node instanceof LighterASTTokenNode);
StringUtil.repeatSymbol(buffer, ' ', indent);
try {
if (tokenType == TokenType.ERROR_ELEMENT) {
buffer.append("PsiErrorElement:").append(PsiBuilderImpl.getErrorMessage(node));
}
else if (tokenType == TokenType.WHITE_SPACE) {
buffer.append("PsiWhiteSpace");
}
else {
buffer.append(isLeaf ? "PsiElement" : "Element").append('(').append(tokenType.toString()).append(')');
}
if (isLeaf) {
final String text = ((LighterASTTokenNode)node).getText().toString();
buffer.append("('").append(fixWhiteSpaces(text)).append("')");
}
buffer.append('\n');
if (!isLeaf) {
final Ref<LighterASTNode[]> kids = new Ref<>();
final int numKids = tree.getChildren(node, kids);
if (numKids == 0) {
StringUtil.repeatSymbol(buffer, ' ', indent + 2);
buffer.append("<empty list>\n");
}
else {
for (int i = 0; i < numKids; i++) {
lightTreeToBuffer(tree, kids.get()[i], buffer, indent + 2, skipWhiteSpaces);
}
}
}
}
catch (IOException e) {
LOG.error(e);
}
}
@NotNull
public static String stubTreeToString(@NotNull Stub root) {
StringBuilder builder = new StringBuilder();
stubTreeToBuffer(root, builder, 0);
return builder.toString();
}
public static void stubTreeToBuffer(@NotNull Stub node, @NotNull Appendable buffer, final int indent) {
StringUtil.repeatSymbol(buffer, ' ', indent);
try {
final ObjectStubSerializer stubType = node.getStubType();
if (stubType != null) {
buffer.append(stubType.toString()).append(':');
}
buffer.append(node.toString()).append('\n');
final List<? extends Stub> children = node.getChildrenStubs();
for (final Stub child : children) {
stubTreeToBuffer(child, buffer, indent + 2);
}
}
catch (IOException e) {
LOG.error(e);
}
}
private static void treeToBufferWithUserData(@NotNull Appendable buffer, @NotNull TreeElement root, int indent, boolean skipWhiteSpaces) {
if (skipWhiteSpaces && root.getElementType() == TokenType.WHITE_SPACE) return;
StringUtil.repeatSymbol(buffer, ' ', indent);
try {
final PsiElement psi = SourceTreeToPsiMap.treeElementToPsi(root);
assert psi != null : root;
if (root instanceof CompositeElement) {
buffer.append(psi.toString());
}
else {
final String text = fixWhiteSpaces(root.getText());
buffer.append(root.toString()).append("('").append(text).append("')");
}
buffer.append(root.getUserDataString());
buffer.append("\n");
if (root instanceof CompositeElement) {
PsiElement[] children = psi.getChildren();
for (PsiElement child : children) {
treeToBufferWithUserData(buffer, (TreeElement)SourceTreeToPsiMap.psiElementToTree(child), indent + 2, skipWhiteSpaces);
}
if (children.length == 0) {
StringUtil.repeatSymbol(buffer, ' ', indent + 2);
buffer.append("<empty list>\n");
}
}
}
catch (IOException e) {
LOG.error(e);
}
}
private static void treeToBufferWithUserData(@NotNull @NonNls Appendable buffer, @NotNull PsiElement root, int indent, boolean skipWhiteSpaces) {
if (skipWhiteSpaces && root instanceof PsiWhiteSpace) return;
StringUtil.repeatSymbol(buffer, ' ', indent);
try {
if (root instanceof CompositeElement) {
buffer.append(root.toString());
}
else {
final String text = fixWhiteSpaces(root.getText());
buffer.append(root.toString()).append("('").append(text).append("')");
}
buffer.append(((UserDataHolderBase)root).getUserDataString());
buffer.append("\n");
PsiElement[] children = root.getChildren();
for (PsiElement child : children) {
treeToBufferWithUserData(buffer, child, indent + 2, skipWhiteSpaces);
}
if (children.length == 0) {
StringUtil.repeatSymbol(buffer, ' ', indent + 2);
buffer.append("<empty list>\n");
}
}
catch (IOException e) {
LOG.error(e);
}
}
private static void doCheckTreeStructure(@Nullable ASTNode anyElement) {
if (anyElement == null) return;
ASTNode root = anyElement;
while (root.getTreeParent() != null) {
root = root.getTreeParent();
}
if (root instanceof CompositeElement) {
checkSubtree((CompositeElement)root);
}
}
private static void checkSubtree(@NotNull CompositeElement root) {
if (root.rawFirstChild() == null) {
if (root.rawLastChild() != null) {
throw new IncorrectTreeStructureException(root, "firstChild == null, but lastChild != null");
}
}
else {
for (ASTNode child = root.getFirstChildNode(); child != null; child = child.getTreeNext()) {
if (child instanceof CompositeElement) {
checkSubtree((CompositeElement)child);
}
if (child.getTreeParent() != root) {
throw new IncorrectTreeStructureException(child, "child has wrong parent value");
}
if (child == root.getFirstChildNode()) {
if (child.getTreePrev() != null) {
throw new IncorrectTreeStructureException(root, "firstChild.prev != null");
}
}
else {
if (child.getTreePrev() == null) {
throw new IncorrectTreeStructureException(child, "not first child has prev == null");
}
if (child.getTreePrev().getTreeNext() != child) {
throw new IncorrectTreeStructureException(child, "element.prev.next != element");
}
}
if (child.getTreeNext() == null) {
if (root.getLastChildNode() != child) {
throw new IncorrectTreeStructureException(child, "not last child has next == null");
}
}
}
}
}
public static void checkParentChildConsistent(@NotNull ASTNode element) {
ASTNode treeParent = element.getTreeParent();
if (treeParent == null) return;
ASTNode[] elements = treeParent.getChildren(null);
if (ArrayUtil.find(elements, element) == -1) {
throw new IncorrectTreeStructureException(element, "child cannot be found among parents children");
}
//LOG.debug("checked consistence: "+System.identityHashCode(element));
}
public static void checkSameCharTabs(@NotNull ASTNode element1, @NotNull ASTNode element2) {
final CharTable fromCharTab = SharedImplUtil.findCharTableByTree(element1);
final CharTable toCharTab = SharedImplUtil.findCharTableByTree(element2);
LOG.assertTrue(fromCharTab == toCharTab);
}
@NotNull
public static String psiToString(@NotNull PsiElement element, final boolean skipWhitespaces) {
return psiToString(element, skipWhitespaces, false);
}
@NotNull
public static String psiToString(@NotNull final PsiElement root, final boolean skipWhiteSpaces, final boolean showRanges) {
return psiToString(root, skipWhiteSpaces, showRanges, null);
}
@NotNull
public static String psiToString(@NotNull final PsiElement root, final boolean skipWhiteSpaces, final boolean showRanges, @Nullable PairConsumer<? super PsiElement, Consumer<PsiElement>> extra) {
StringBuilder buffer = new StringBuilder();
psiToBuffer(buffer, root, skipWhiteSpaces, showRanges, extra);
return buffer.toString();
}
@NotNull
public static String psiToStringIgnoringNonCode(@NotNull PsiElement element) {
StringBuilder buffer = new StringBuilder();
((TreeElement)element.getNode()).acceptTree(
new TreeToBuffer(buffer, 0, true, false, false, false, null) {
@Override
protected boolean shouldSkipNode(TreeElement node) {
return super.shouldSkipNode(node) || node instanceof PsiErrorElement || node instanceof PsiComment ||
node instanceof LeafPsiElement && StringUtil.isEmptyOrSpaces(node.getText()) ||
node instanceof OuterLanguageElement;
}
@Override
protected boolean showEmptyChildren() {
return false;
}
});
return buffer.toString();
}
private static void psiToBuffer(@NotNull Appendable buffer,
@NotNull PsiElement root,
final boolean skipWhiteSpaces,
final boolean showRanges,
@Nullable PairConsumer<? super PsiElement, Consumer<PsiElement>> extra) {
final ASTNode node = root.getNode();
if (node == null) {
psiToBuffer(buffer, root, 0, skipWhiteSpaces, showRanges, showRanges, extra);
}
else {
treeToBuffer(buffer, node, 0, skipWhiteSpaces, showRanges, showRanges, true, extra);
}
}
public static void psiToBuffer(@NotNull final Appendable buffer,
@NotNull final PsiElement root,
int indent,
boolean skipWhiteSpaces,
boolean showRanges,
boolean showChildrenRanges) {
psiToBuffer(buffer, root, indent, skipWhiteSpaces, showRanges, showChildrenRanges, null);
}
private static void psiToBuffer(@NotNull final Appendable buffer,
@NotNull final PsiElement root,
final int indent,
final boolean skipWhiteSpaces,
boolean showRanges,
final boolean showChildrenRanges,
@Nullable PairConsumer<? super PsiElement, Consumer<PsiElement>> extra) {
if (skipWhiteSpaces && root instanceof PsiWhiteSpace) return;
StringUtil.repeatSymbol(buffer, ' ', indent);
try {
buffer.append(root.toString());
PsiElement child = root.getFirstChild();
if (child == null) {
final String text = root.getText();
assert text != null : "text is null for <" + root + ">";
buffer.append("('").append(fixWhiteSpaces(text)).append("')");
}
if (showRanges) buffer.append(root.getTextRange().toString());
buffer.append("\n");
while (child != null) {
psiToBuffer(buffer, child, indent + 2, skipWhiteSpaces, showChildrenRanges, showChildrenRanges, extra);
child = child.getNextSibling();
}
if (extra != null) {
extra.consume(root,
element -> psiToBuffer(buffer, element, indent + 2, skipWhiteSpaces, showChildrenRanges, showChildrenRanges, null));
}
}
catch (IOException e) {
LOG.error(e);
}
}
@NotNull
private static String fixWhiteSpaces(@NotNull String text) {
text = StringUtil.replace(text, "\n", "\\n");
text = StringUtil.replace(text, "\r", "\\r");
text = StringUtil.replace(text, "\t", "\\t");
return text;
}
@NotNull
public static String currentStackTrace() {
return ExceptionUtil.currentStackTrace();
}
public static class IncorrectTreeStructureException extends RuntimeException {
private final ASTNode myElement;
IncorrectTreeStructureException(ASTNode element, String message) {
super(message);
myElement = element;
}
public ASTNode getElement() {
return myElement;
}
}
private static final ThreadLocal<Object> ourPsiModificationTrace = new ThreadLocal<>();
private static final ThreadLocal<Integer> ourPsiModificationDepth = new ThreadLocal<>();
private static final FrequentErrorLogger ourErrorLogger = FrequentErrorLogger.newInstance(LOG);
/**
* Marks a start of PSI modification action. Any PSI/AST elements invalidated inside such an action will contain a debug trace
* identifying this transaction, and so will {@link PsiInvalidElementAccessException} thrown when accessing such invalid
* elements. This should help finding out why a specific PSI element has become invalid.
*
* @param trace The debug trace that the invalidated elements should be identified by. May be null, then current stack trace is used.
* @deprecated use {@link #performPsiModification(String, ThrowableRunnable)} instead
*/
@Deprecated
public static void startPsiModification(@Nullable @NlsSafe String trace) {
if (!PsiInvalidElementAccessException.isTrackingInvalidation()) {
return;
}
if (ourPsiModificationTrace.get() == null) {
ourPsiModificationTrace.set(trace != null || ApplicationInfoImpl.isInStressTest() ? trace : new Throwable());
}
Integer depth = ourPsiModificationDepth.get();
if (depth == null) depth = 0;
ourPsiModificationDepth.set(depth + 1);
}
/**
* Finished PSI modification action.
* @see #startPsiModification(String)
* @deprecated use {@link #performPsiModification(String, ThrowableRunnable)} instead
*/
@Deprecated
public static void finishPsiModification() {
if (!PsiInvalidElementAccessException.isTrackingInvalidation()) {
return;
}
Integer depth = ourPsiModificationDepth.get();
if (depth == null) {
LOG.warn("Unmatched PSI modification end", new Throwable());
depth = 0;
} else {
depth--;
ourPsiModificationDepth.set(depth);
}
if (depth == 0) {
ourPsiModificationTrace.set(null);
}
}
public static <T extends Throwable> void performPsiModification(@NonNls String trace, @NotNull ThrowableRunnable<T> runnable) throws T {
startPsiModification(trace);
try {
runnable.run();
}
finally {
finishPsiModification();
}
}
public static <T, E extends Throwable> T performPsiModification(@NlsSafe String trace, @NotNull ThrowableComputable<T, E> runnable) throws E {
startPsiModification(trace);
try {
return runnable.compute();
}
finally {
finishPsiModification();
}
}
public static void onInvalidated(@NotNull ASTNode treeElement) {
Object trace = calcInvalidationTrace(treeElement);
if (trace != null) {
PsiInvalidElementAccessException.setInvalidationTrace(treeElement, trace);
}
}
public static void onInvalidated(@NotNull PsiElement o) {
Object trace = PsiInvalidElementAccessException.getInvalidationTrace(o);
if (trace != null) return;
PsiInvalidElementAccessException.setInvalidationTrace(o, currentInvalidationTrace());
}
public static void onInvalidated(@NotNull FileViewProvider provider) {
Object trace = calcInvalidationTrace(null);
if (trace != null) {
PsiInvalidElementAccessException.setInvalidationTrace(provider, trace);
}
}
@Nullable
private static Object calcInvalidationTrace(@Nullable ASTNode treeElement) {
if (!PsiInvalidElementAccessException.isTrackingInvalidation()) {
return null;
}
if (PsiInvalidElementAccessException.findInvalidationTrace(treeElement) != null) {
return null;
}
return currentInvalidationTrace();
}
@Nullable
private static Object currentInvalidationTrace() {
Object trace = ourPsiModificationTrace.get();
return trace != null || ApplicationInfoImpl.isInStressTest() ? trace : handleUnspecifiedTrace();
}
private static Throwable handleUnspecifiedTrace() {
Throwable trace = new Throwable();
if (ApplicationManager.getApplication().isUnitTestMode()) {
ourErrorLogger.error("PSI invalidated outside transaction", trace);
} else {
ourErrorLogger.info("PSI invalidated outside transaction", trace);
}
return trace;
}
public static void revalidateNode(@NotNull ASTNode element) {
PsiInvalidElementAccessException.setInvalidationTrace(element, null);
}
public static void sleep(long millis) {
TimeoutUtil.sleep(millis);
}
public static void checkTreeStructure(ASTNode element) {
if (CHECK){
doCheckTreeStructure(element);
}
}
@NotNull
public static @NonNls String diagnosePsiDocumentInconsistency(@NotNull PsiElement element, @NotNull Document document) {
PsiUtilCore.ensureValid(element);
PsiFile file = element.getContainingFile();
if (file == null) return "no file for " + element + " of " + element.getClass();
PsiUtilCore.ensureValid(file);
FileViewProvider viewProvider = file.getViewProvider();
PsiDocumentManager manager = PsiDocumentManager.getInstance(file.getProject());
Document actualDocument = viewProvider.getDocument();
String fileDiagnostics = "File[" + file + " " + file.getName() + ", " + file.getLanguage() + ", " + viewProvider + "]";
if (actualDocument != document) {
return "wrong document for " + fileDiagnostics + "; expected " + document + "; actual " + actualDocument;
}
PsiFile cachedPsiFile = manager.getCachedPsiFile(document);
FileViewProvider actualViewProvider = cachedPsiFile == null ? null : cachedPsiFile.getViewProvider();
if (actualViewProvider != viewProvider) {
return "wrong view provider for " + document + ", expected " + viewProvider + "; actual " + actualViewProvider;
}
if (!manager.isCommitted(document)) return "not committed document " + document + ", " + fileDiagnostics;
int fileLength = file.getTextLength();
int docLength = document.getTextLength();
if (fileLength != docLength) {
return "file/doc text length different, " + fileDiagnostics + " file.length=" + fileLength + "; doc.length=" + docLength;
}
return "unknown inconsistency in " + fileDiagnostics;
}
@NotNull
public static <T> String graphToString(@NotNull InboundSemiGraph<T> graph) {
StringBuilder buffer = new StringBuilder();
printNodes(graph.getNodes().iterator(), node -> graph.getIn(node), 0, new HashSet<>(), buffer);
return buffer.toString();
}
@NotNull
public static <T> String graphToString(@NotNull OutboundSemiGraph<T> graph) {
StringBuilder buffer = new StringBuilder();
printNodes(graph.getNodes().iterator(), node -> graph.getOut(node), 0, new HashSet<>(), buffer);
return buffer.toString();
}
private static <T> void printNodes(@NotNull Iterator<? extends T> nodes, @NotNull Function<? super T, ? extends Iterator<T>> getter, int indent, @NotNull Set<? super T> visited, @NotNull StringBuilder buffer) {
while (nodes.hasNext()) {
T node = nodes.next();
StringUtil.repeatSymbol(buffer, ' ', indent);
buffer.append(node);
if (visited.add(node)) {
buffer.append('\n');
printNodes(getter.fun(node), getter, indent + 2, visited, buffer);
}
else {
buffer.append(" [...]\n");
}
}
}
} | {
"pile_set_name": "Github"
} |
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:conversion-gen=k8s.io/client-go/tools/clientcmd/api
// +k8s:deepcopy-gen=package
package v1
| {
"pile_set_name": "Github"
} |
---
description: "UPDATE - Trigger Functions (Transact-SQL)"
title: "UPDATE() (Transact-SQL) | Microsoft Docs"
ms.custom: ""
ms.date: "03/15/2017"
ms.prod: sql
ms.prod_service: "database-engine, sql-database"
ms.reviewer: ""
ms.technology: t-sql
ms.topic: "language-reference"
f1_keywords:
- "UPDATE()_TSQL"
- "UPDATE()"
dev_langs:
- "TSQL"
helpviewer_keywords:
- "INSERT statement [SQL Server], UPDATE function"
- "testing column updates"
- "UPDATE function"
- "UPDATE() function"
- "detecting changes"
- "columns [SQL Server], change detection"
- "UPDATE statement [SQL Server], UPDATE function"
- "verifying column updates"
- "checking column updates"
ms.assetid: 8e3be25b-2e3b-4d1f-a610-dcbbd8d72084
author: julieMSFT
ms.author: jrasnick
---
# UPDATE - Trigger Functions (Transact-SQL)
[!INCLUDE [SQL Server SQL Database](../../includes/applies-to-version/sql-asdb.md)]
Returns a Boolean value that indicates whether an INSERT or UPDATE attempt was made on a specified column of a table or view. UPDATE() is used anywhere inside the body of a [!INCLUDE[tsql](../../includes/tsql-md.md)] INSERT or UPDATE trigger to test whether the trigger should execute certain actions.
 [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
## Syntax
```sql
UPDATE ( column )
```
[!INCLUDE[sql-server-tsql-previous-offline-documentation](../../includes/sql-server-tsql-previous-offline-documentation.md)]
## Arguments
*column*
Is the name of the column to test for either an INSERT or UPDATE action. Because the table name is specified in the ON clause of the trigger, do not include the table name before the column name. The column can be of any [data type](../../t-sql/data-types/data-types-transact-sql.md) supported by [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. However, computed columns cannot be used in this context.
## Return Types
Boolean
## Remarks
UPDATE() returns TRUE regardless of whether an INSERT or UPDATE attempt is successful.
To test for an INSERT or UPDATE action for more than one column, specify a separate UPDATE(*column*) clause following the first one. Multiple columns can also be tested for INSERT or UPDATE actions by using COLUMNS_UPDATED. This returns a bit pattern that indicates which columns were inserted or updated.
IF UPDATE returns the TRUE value in INSERT actions because the columns have either explicit values or implicit (NULL) values inserted.
> [!NOTE]
> The IF UPDATE(*column*) clause functions the same as an IF, IF...ELSE, or WHILE clause and can use the BEGIN...END block. For more information, see [Control-of-Flow Language (Transact-SQL)](~/t-sql/language-elements/control-of-flow.md).
UPDATE(*column*) can be used anywhere inside the body of a [!INCLUDE[tsql](../../includes/tsql-md.md)] trigger.
If a trigger applies to a column, the `UPDATED` value will return as `true` or `1`, even if the column value remains unchanged. This is by-design, and the trigger should implement business logic that determines if the insert/update/delete operation is permissible or not.
## Examples
The following example creates a trigger that prints a message to the client when anyone tries to update the `StateProvinceID` or `PostalCode` columns of the `Address` table.
```sql
USE AdventureWorks2012;
GO
IF EXISTS (SELECT name FROM sys.objects
WHERE name = 'reminder' AND type = 'TR')
DROP TRIGGER Person.reminder;
GO
CREATE TRIGGER reminder
ON Person.Address
AFTER UPDATE
AS
IF ( UPDATE (StateProvinceID) OR UPDATE (PostalCode) )
BEGIN
RAISERROR (50009, 16, 10)
END;
GO
-- Test the trigger.
UPDATE Person.Address
SET PostalCode = 99999
WHERE PostalCode = '12345';
GO
```
## See Also
[COLUMNS_UPDATED (Transact-SQL)](../../t-sql/functions/columns-updated-transact-sql.md)
[CREATE TRIGGER (Transact-SQL)](../../t-sql/statements/create-trigger-transact-sql.md)
| {
"pile_set_name": "Github"
} |
# encoding: utf-8
# this is a namespace package
try:
import pkg_resources
pkg_resources.declare_namespace(__name__)
except ImportError:
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.security.provider;
import java.math.BigInteger;
import java.security.AlgorithmParameterGeneratorSpi;
import java.security.AlgorithmParameters;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.InvalidParameterException;
import java.security.MessageDigest;
import java.security.SecureRandom;
import java.security.ProviderException;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.InvalidParameterSpecException;
import java.security.spec.DSAParameterSpec;
import java.security.spec.DSAGenParameterSpec;
import static sun.security.util.SecurityProviderConstants.DEF_DSA_KEY_SIZE;
import static sun.security.util.SecurityProviderConstants.getDefDSASubprimeSize;
/**
* This class generates parameters for the DSA algorithm.
*
* @author Jan Luehe
*
*
* @see java.security.AlgorithmParameters
* @see java.security.spec.AlgorithmParameterSpec
* @see DSAParameters
*
* @since 1.2
*/
public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi {
// the length of prime P, subPrime Q, and seed in bits
private int valueL = -1;
private int valueN = -1;
private int seedLen = -1;
// the source of randomness
private SecureRandom random;
public DSAParameterGenerator() {
}
/**
* Initializes this parameter generator for a certain strength
* and source of randomness.
*
* @param strength the strength (size of prime) in bits
* @param random the source of randomness
*/
@Override
protected void engineInit(int strength, SecureRandom random) {
if ((strength != 2048) && (strength != 3072) &&
((strength < 512) || (strength > 1024) || (strength % 64 != 0))) {
throw new InvalidParameterException(
"Unexpected strength (size of prime): " + strength +
". Prime size should be 512-1024, 2048, or 3072");
}
this.valueL = strength;
this.valueN = getDefDSASubprimeSize(strength);
this.seedLen = valueN;
this.random = random;
}
/**
* Initializes this parameter generator with a set of
* algorithm-specific parameter generation values.
*
* @param genParamSpec the set of algorithm-specific parameter
* generation values
* @param random the source of randomness
*
* @exception InvalidAlgorithmParameterException if the given parameter
* generation values are inappropriate for this parameter generator
*/
@Override
protected void engineInit(AlgorithmParameterSpec genParamSpec,
SecureRandom random) throws InvalidAlgorithmParameterException {
if (!(genParamSpec instanceof DSAGenParameterSpec)) {
throw new InvalidAlgorithmParameterException("Invalid parameter");
}
DSAGenParameterSpec dsaGenParams = (DSAGenParameterSpec)genParamSpec;
// directly initialize using the already validated values
this.valueL = dsaGenParams.getPrimePLength();
this.valueN = dsaGenParams.getSubprimeQLength();
this.seedLen = dsaGenParams.getSeedLength();
this.random = random;
}
/**
* Generates the parameters.
*
* @return the new AlgorithmParameters object
*/
@Override
protected AlgorithmParameters engineGenerateParameters() {
AlgorithmParameters algParams = null;
try {
if (this.random == null) {
this.random = new SecureRandom();
}
if (valueL == -1) {
engineInit(DEF_DSA_KEY_SIZE, this.random);
}
BigInteger[] pAndQ = generatePandQ(this.random, valueL,
valueN, seedLen);
BigInteger paramP = pAndQ[0];
BigInteger paramQ = pAndQ[1];
BigInteger paramG = generateG(paramP, paramQ);
DSAParameterSpec dsaParamSpec =
new DSAParameterSpec(paramP, paramQ, paramG);
algParams = AlgorithmParameters.getInstance("DSA", "SUN");
algParams.init(dsaParamSpec);
} catch (InvalidParameterSpecException e) {
// this should never happen
throw new RuntimeException(e.getMessage());
} catch (NoSuchAlgorithmException e) {
// this should never happen, because we provide it
throw new RuntimeException(e.getMessage());
} catch (NoSuchProviderException e) {
// this should never happen, because we provide it
throw new RuntimeException(e.getMessage());
}
return algParams;
}
/*
* Generates the prime and subprime parameters for DSA,
* using the provided source of randomness.
* This method will generate new seeds until a suitable
* seed has been found.
*
* @param random the source of randomness to generate the
* seed
* @param valueL the size of <code>p</code>, in bits.
* @param valueN the size of <code>q</code>, in bits.
* @param seedLen the length of <code>seed</code>, in bits.
*
* @return an array of BigInteger, with <code>p</code> at index 0 and
* <code>q</code> at index 1, the seed at index 2, and the counter value
* at index 3.
*/
private static BigInteger[] generatePandQ(SecureRandom random, int valueL,
int valueN, int seedLen) {
String hashAlg = null;
if (valueN == 160) {
hashAlg = "SHA";
} else if (valueN == 224) {
hashAlg = "SHA-224";
} else if (valueN == 256) {
hashAlg = "SHA-256";
}
MessageDigest hashObj = null;
try {
hashObj = MessageDigest.getInstance(hashAlg);
} catch (NoSuchAlgorithmException nsae) {
// should never happen
nsae.printStackTrace();
}
/* Step 3, 4: Useful variables */
int outLen = hashObj.getDigestLength()*8;
int n = (valueL - 1) / outLen;
int b = (valueL - 1) % outLen;
byte[] seedBytes = new byte[seedLen/8];
BigInteger twoSl = BigInteger.TWO.pow(seedLen);
int primeCertainty = -1;
if (valueL <= 1024) {
primeCertainty = 80;
} else if (valueL == 2048) {
primeCertainty = 112;
} else if (valueL == 3072) {
primeCertainty = 128;
}
if (primeCertainty < 0) {
throw new ProviderException("Invalid valueL: " + valueL);
}
BigInteger resultP, resultQ, seed = null;
int counter;
while (true) {
do {
/* Step 5 */
random.nextBytes(seedBytes);
seed = new BigInteger(1, seedBytes);
/* Step 6 */
BigInteger U = new BigInteger(1, hashObj.digest(seedBytes)).
mod(BigInteger.TWO.pow(valueN - 1));
/* Step 7 */
resultQ = BigInteger.TWO.pow(valueN - 1)
.add(U)
.add(BigInteger.ONE)
.subtract(U.mod(BigInteger.TWO));
} while (!resultQ.isProbablePrime(primeCertainty));
/* Step 10 */
BigInteger offset = BigInteger.ONE;
/* Step 11 */
for (counter = 0; counter < 4*valueL; counter++) {
BigInteger[] V = new BigInteger[n + 1];
/* Step 11.1 */
for (int j = 0; j <= n; j++) {
BigInteger J = BigInteger.valueOf(j);
BigInteger tmp = (seed.add(offset).add(J)).mod(twoSl);
byte[] vjBytes = hashObj.digest(toByteArray(tmp));
V[j] = new BigInteger(1, vjBytes);
}
/* Step 11.2 */
BigInteger W = V[0];
for (int i = 1; i < n; i++) {
W = W.add(V[i].multiply(BigInteger.TWO.pow(i * outLen)));
}
W = W.add((V[n].mod(BigInteger.TWO.pow(b)))
.multiply(BigInteger.TWO.pow(n * outLen)));
/* Step 11.3 */
BigInteger twoLm1 = BigInteger.TWO.pow(valueL - 1);
BigInteger X = W.add(twoLm1);
/* Step 11.4, 11.5 */
BigInteger c = X.mod(resultQ.multiply(BigInteger.TWO));
resultP = X.subtract(c.subtract(BigInteger.ONE));
/* Step 11.6, 11.7 */
if (resultP.compareTo(twoLm1) > -1
&& resultP.isProbablePrime(primeCertainty)) {
/* Step 11.8 */
BigInteger[] result = {resultP, resultQ, seed,
BigInteger.valueOf(counter)};
return result;
}
/* Step 11.9 */
offset = offset.add(BigInteger.valueOf(n)).add(BigInteger.ONE);
}
}
}
/*
* Generates the <code>g</code> parameter for DSA.
*
* @param p the prime, <code>p</code>.
* @param q the subprime, <code>q</code>.
*
* @param the <code>g</code>
*/
private static BigInteger generateG(BigInteger p, BigInteger q) {
BigInteger h = BigInteger.ONE;
/* Step 1 */
BigInteger pMinusOneOverQ = (p.subtract(BigInteger.ONE)).divide(q);
BigInteger resultG = BigInteger.ONE;
while (resultG.compareTo(BigInteger.TWO) < 0) {
/* Step 3 */
resultG = h.modPow(pMinusOneOverQ, p);
h = h.add(BigInteger.ONE);
}
return resultG;
}
/*
* Converts the result of a BigInteger.toByteArray call to an exact
* signed magnitude representation for any positive number.
*/
private static byte[] toByteArray(BigInteger bigInt) {
byte[] result = bigInt.toByteArray();
if (result[0] == 0) {
byte[] tmp = new byte[result.length - 1];
System.arraycopy(result, 1, tmp, 0, tmp.length);
result = tmp;
}
return result;
}
}
| {
"pile_set_name": "Github"
} |
#include <strings.h>
#include <ctype.h>
#include "libc.h"
int strcasecmp(const char *_l, const char *_r)
{
const unsigned char *l=(void *)_l, *r=(void *)_r;
for (; *l && *r && (*l == *r || tolower(*l) == tolower(*r)); l++, r++);
return tolower(*l) - tolower(*r);
}
int __strcasecmp_l(const char *l, const char *r, locale_t loc)
{
return strcasecmp(l, r);
}
weak_alias(__strcasecmp_l, strcasecmp_l);
| {
"pile_set_name": "Github"
} |
#region License
/*
* Copyright © 2010-2011 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.
*/
#endregion
using System;
using NUnit.Framework;
using Spring.Context.Support;
using Spring.Objects.Factory;
using Spring.Objects.Factory.Parsing;
using Spring.Objects.Factory.Support;
namespace Spring.Context.Attributes
{
[Explicit("Interferes with other fixtures")]
public class FailAssemblyObjectDefinitionScannerTests
{
#region Setup/Teardown
[SetUp]
public void _SetUp()
{
_scanner = new AssemblyObjectDefinitionScanner();
_context = new CodeConfigApplicationContext();
}
#endregion
private void ScanForAndRegisterSingleType(Type type)
{
_scanner.WithIncludeFilter(t => t.Name == type.Name);
_scanner.ScanAndRegisterTypes(_context.DefaultListableObjectFactory);
AttributeConfigUtils.RegisterAttributeConfigProcessors((IObjectDefinitionRegistry)_context.ObjectFactory);
}
private CodeConfigApplicationContext _context;
private AssemblyObjectDefinitionScanner _scanner;
[Test]
public void Can_Ignore_Abstract_Configuration_Types()
{
ScanForAndRegisterSingleType(typeof(ConfigurationClassThatIsAbstract));
Assert.That(_context.GetObjectNamesForType(typeof(ConfigurationClassThatIsAbstract)).Count, Is.EqualTo(0), "Abstract Type erroneously registered with the Context.");
}
[Test]
public void Can_Prevent_Methods_With_Parameters()
{
ScanForAndRegisterSingleType(typeof(ConfigurationClassWithMethodHavingParameters));
Assert.Throws<ObjectDefinitionParsingException>(_context.Refresh);
}
[Test]
public void Can_Prevent_Static_Methods()
{
ScanForAndRegisterSingleType(typeof(ConfigurationClassWithStaticMethod));
Assert.Throws<ObjectDefinitionParsingException>(_context.Refresh);
}
[Test]
public void Can_Prevent_Non_Virtual_Methods()
{
ScanForAndRegisterSingleType(typeof(ConfigurationClassWithNonVirtualMethod));
Assert.Throws<ObjectDefinitionParsingException>(_context.Refresh);
}
[Test]
public void Can_Prevent_Sealed_Configuration_Types()
{
ScanForAndRegisterSingleType(typeof(ConfigurationClassThatIsSealed));
Assert.Throws<ObjectDefinitionParsingException>(_context.Refresh);
}
[Test]
public void Can_Prevent_Overloaded_Methods()
{
ScanForAndRegisterSingleType(typeof(ConfigurationClassWithOverloadedMethods));
Assert.Throws<ObjectDefinitionParsingException>(_context.Refresh);
}
[Test]
public void Can_Prevent_Circular_ConfigurationClass_Refereces()
{
ScanForAndRegisterSingleType(typeof(FirstConfigurationClassWithCircularReference));
try
{
_context.Refresh();
}
catch (ObjectDefinitionStoreException ex)
{
Assert.That(ex.InnerException, Is.TypeOf(typeof(ObjectDefinitionParsingException)));
}
}
}
public class SomeType
{
}
[Configuration]
public class ConfigurationClassWithNonVirtualMethod
{
[ObjectDef]
public SomeType MethodThatRegistersSomeType()
{
return new SomeType();
}
}
[Configuration]
public class ConfigurationClassWithStaticMethod
{
[ObjectDef]
public static SomeType MethodThatRegistersSomeType()
{
return new SomeType();
}
}
[Configuration]
public class ConfigurationClassWithOverloadedMethods
{
[ObjectDef]
public virtual SomeType MethodThatRegistersSomeType()
{
return new SomeType();
}
[ObjectDef]
public virtual SomeType MethodThatRegistersSomeType(int i)
{
return new SomeType();
}
}
[Configuration]
[Import(typeof(SecondConfigurationClassWithCircularReference))]
public class FirstConfigurationClassWithCircularReference
{
[ObjectDef]
public virtual SomeType MethodThatRegistersSomeType()
{
return new SomeType();
}
}
[Configuration]
[Import(typeof(FirstConfigurationClassWithCircularReference))]
public class SecondConfigurationClassWithCircularReference
{
[ObjectDef]
public virtual SomeType MethodThatRegistersSomeType()
{
return new SomeType();
}
}
[Configuration]
public class ConfigurationClassWithMethodHavingParameters
{
[ObjectDef]
public virtual SomeType MethodThatRegistersSomeType(int i)
{
return new SomeType();
}
}
[Configuration]
public abstract class ConfigurationClassThatIsAbstract
{
[ObjectDef]
public virtual SomeType MethodThatRegistersSomeType()
{
return new SomeType();
}
}
[Configuration]
public sealed class ConfigurationClassThatIsSealed
{
[ObjectDef]
public SomeType MethodThatRegistersSomeType()
{
return new SomeType();
}
}
} | {
"pile_set_name": "Github"
} |
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
'use strict';
const React = require('react');
const {Text, View, TouchableOpacity, Alert} = require('react-native');
class TransparentHitTestExample extends React.Component<{...}> {
render() {
return (
<View style={{flex: 1}}>
<TouchableOpacity onPress={() => Alert.alert('Alert', 'Hi!')}>
<Text>HELLO!</Text>
</TouchableOpacity>
<View
style={{
position: 'absolute',
backgroundColor: 'green',
top: 0,
left: 0,
bottom: 0,
right: 0,
opacity: 0.0,
}}
/>
</View>
);
}
}
exports.title = '<TransparentHitTestExample>';
exports.displayName = 'TransparentHitTestExample';
exports.description = 'Transparent view receiving touch events';
exports.examples = [
{
title: 'TransparentHitTestExample',
render(): React.Element<any> {
return <TransparentHitTestExample />;
},
},
];
| {
"pile_set_name": "Github"
} |
export { default as DataFilter } from "./DataFilter";
| {
"pile_set_name": "Github"
} |
<?php
/**
* Smarty Internal Plugin Compile Function_Call
*
* Compiles the calls of user defined tags defined by {function}
*
* @package Smarty
* @subpackage Compiler
* @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Function_Call Class
*
* @package Smarty
* @subpackage Compiler
*/
class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase {
/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
public $required_attributes = array('name');
/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
public $shorttag_order = array('name');
/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
public $optional_attributes = array('_any');
/**
* Compiles the calls of user defined tags defined by {function}
*
* @param array $args array with attributes from parser
* @param object $compiler compiler object
* @param array $parameter array with compilation parameter
* @return string compiled code
*/
public function compile($args, $compiler)
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
// save possible attributes
if (isset($_attr['assign'])) {
// output will be stored in a smarty variable instead of beind displayed
$_assign = $_attr['assign'];
}
$_name = $_attr['name'];
if ($compiler->compiles_template_function) {
$compiler->called_functions[] = trim($_name, "'\"");
}
unset($_attr['name'], $_attr['assign'], $_attr['nocache']);
// set flag (compiled code of {function} must be included in cache file
if ($compiler->nocache || $compiler->tag_nocache) {
$_nocache = 'true';
} else {
$_nocache = 'false';
}
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {
$_paramsArray[] = "'$_key'=>$_value";
}
}
if (isset($compiler->template->properties['function'][$_name]['parameter'])) {
foreach ($compiler->template->properties['function'][$_name]['parameter'] as $_key => $_value) {
if (!isset($_attr[$_key])) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {
$_paramsArray[] = "'$_key'=>$_value";
}
}
}
} elseif (isset($compiler->smarty->template_functions[$_name]['parameter'])) {
foreach ($compiler->smarty->template_functions[$_name]['parameter'] as $_key => $_value) {
if (!isset($_attr[$_key])) {
if (is_int($_key)) {
$_paramsArray[] = "$_key=>$_value";
} else {
$_paramsArray[] = "'$_key'=>$_value";
}
}
}
}
//varibale name?
if (!(strpos($_name, '$') === false)) {
$call_cache = $_name;
$call_function = '$tmp = "smarty_template_function_".' . $_name . '; $tmp';
} else {
$_name = trim($_name, "'\"");
$call_cache = "'{$_name}'";
$call_function = 'smarty_template_function_' . $_name;
}
$_params = 'array(' . implode(",", $_paramsArray) . ')';
$_hash = str_replace('-', '_', $compiler->template->properties['nocache_hash']);
// was there an assign attribute
if (isset($_assign)) {
if ($compiler->template->caching) {
$_output = "<?php ob_start(); Smarty_Internal_Function_Call_Handler::call ({$call_cache},\$_smarty_tpl,{$_params},'{$_hash}',{$_nocache}); \$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\n";
} else {
$_output = "<?php ob_start(); {$call_function}(\$_smarty_tpl,{$_params}); \$_smarty_tpl->assign({$_assign}, ob_get_clean());?>\n";
}
} else {
if ($compiler->template->caching) {
$_output = "<?php Smarty_Internal_Function_Call_Handler::call ({$call_cache},\$_smarty_tpl,{$_params},'{$_hash}',{$_nocache});?>\n";
} else {
$_output = "<?php {$call_function}(\$_smarty_tpl,{$_params});?>\n";
}
}
return $_output;
}
}
?> | {
"pile_set_name": "Github"
} |
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
syntax = 'proto2';
package k8s.io.api.batch.v1beta1;
import "k8s.io/api/batch/v1/generated.proto";
import "k8s.io/api/core/v1/generated.proto";
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v1beta1";
// CronJob represents the configuration of a single cron job.
message CronJob {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Specification of the desired behavior of a cron job, including the schedule.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional CronJobSpec spec = 2;
// Current status of a cron job.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional CronJobStatus status = 3;
}
// CronJobList is a collection of cron jobs.
message CronJobList {
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
// items is the list of CronJobs.
repeated CronJob items = 2;
}
// CronJobSpec describes how the job execution will look like and when it will actually run.
message CronJobSpec {
// The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
optional string schedule = 1;
// Optional deadline in seconds for starting the job if it misses scheduled
// time for any reason. Missed jobs executions will be counted as failed ones.
// +optional
optional int64 startingDeadlineSeconds = 2;
// Specifies how to treat concurrent executions of a Job.
// Valid values are:
// - "Allow" (default): allows CronJobs to run concurrently;
// - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet;
// - "Replace": cancels currently running job and replaces it with a new one
// +optional
optional string concurrencyPolicy = 3;
// This flag tells the controller to suspend subsequent executions, it does
// not apply to already started executions. Defaults to false.
// +optional
optional bool suspend = 4;
// Specifies the job that will be created when executing a CronJob.
optional JobTemplateSpec jobTemplate = 5;
// The number of successful finished jobs to retain.
// This is a pointer to distinguish between explicit zero and not specified.
// Defaults to 3.
// +optional
optional int32 successfulJobsHistoryLimit = 6;
// The number of failed finished jobs to retain.
// This is a pointer to distinguish between explicit zero and not specified.
// Defaults to 1.
// +optional
optional int32 failedJobsHistoryLimit = 7;
}
// CronJobStatus represents the current state of a cron job.
message CronJobStatus {
// A list of pointers to currently running jobs.
// +optional
repeated k8s.io.api.core.v1.ObjectReference active = 1;
// Information when was the last time the job was successfully scheduled.
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastScheduleTime = 4;
}
// JobTemplate describes a template for creating copies of a predefined pod.
message JobTemplate {
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Defines jobs that will be created from this template.
// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional JobTemplateSpec template = 2;
}
// JobTemplateSpec describes the data a Job should have when created from a template
message JobTemplateSpec {
// Standard object's metadata of the jobs created from this template.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Specification of the desired behavior of the job.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional k8s.io.api.batch.v1.JobSpec spec = 2;
}
| {
"pile_set_name": "Github"
} |
#
# [78] Subsets
#
# https://leetcode.com/problems/subsets/description/
#
# algorithms
# Medium (47.99%)
# Total Accepted: 282.2K
# Total Submissions: 587.3K
# Testcase Example: '[1,2,3]'
#
# Given a set of distinct integers, nums, return all possible subsets (the
# power set).
#
# Note: The solution set must not contain duplicate subsets.
#
# Example:
#
#
# Input: nums = [1,2,3]
# Output:
# [
# [3],
# [1],
# [2],
# [1,2,3],
# [1,3],
# [2,3],
# [1,2],
# []
# ]
#
#
# backtracing
# O(N * 2^N); O(2^N) solusions multiply each need O(N) to construct a array result
# 20 ms, faster than 71.68%
class Solution(object):
def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
results = []
tmp = []
self.helper(sorted(nums), tmp, 0, results)
return results
def helper(self, nums, tmp, start, results):
results.append(tmp[:]) # another copy results.append(list(tmp))
for i in range(start, len(nums)):
tmp.append(nums[i])
self.helper(nums, tmp, i + 1, results)
tmp.pop()
# bit manipulation
# O(N * 2^N)
# suppose [1, 2, 3] initially the 8 subsets are all empty
# a way to visualize this idea. That is,
# 1 appears once in every two consecutive subsets,
# 2 appears twice in every four consecutive subsets,
# 3 appears four times in every eight subsets, shown in the following:
# [], [], [], [], [], [], [], []
# [], [1], [], [1], [], [1], [], [1]
# [], [1], [2], [1, 2], [], [1], [2], [1, 2]
# [], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]
class Solution2(object):
def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
size = len(nums)
num_subset = 2 ** size
results = [[] for _ in range(num_subset)]
for i in range(size):
for j in range(num_subset):
if ((j >> i) & 1):
results[j].append(nums[i])
return results
# iterative
# 2^0 + 2^1 + ... + 2^N = O(2^N) * O(N)
# suppose [1, 2, 3] initially and the results = [[]]
# copy every item and append nums[i] to new copy one
# for 1 [[], [1]]
# for 2 [[], [1], [2], [1, 2]]
# for 3 [[], [1], [2], [1, 2], [3], [1, 3], [2, 3], [1, 2, 3]]
#
# 24 ms, faster than 39.46%
class Solution3(object):
def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
results = [[]]
size = len(nums)
for i in range(size):
for j in range(len(results)):
tmp = results[j] + [nums[i]]
results.append(tmp)
return results | {
"pile_set_name": "Github"
} |
#include "arm_arch.h"
.text
.code 32
.type mul_1x1_ialu,%function
.align 5
mul_1x1_ialu:
mov r4,#0
bic r5,r1,#3<<30 @ a1=a&0x3fffffff
str r4,[sp,#0] @ tab[0]=0
add r6,r5,r5 @ a2=a1<<1
str r5,[sp,#4] @ tab[1]=a1
eor r7,r5,r6 @ a1^a2
str r6,[sp,#8] @ tab[2]=a2
mov r8,r5,lsl#2 @ a4=a1<<2
str r7,[sp,#12] @ tab[3]=a1^a2
eor r9,r5,r8 @ a1^a4
str r8,[sp,#16] @ tab[4]=a4
eor r4,r6,r8 @ a2^a4
str r9,[sp,#20] @ tab[5]=a1^a4
eor r7,r7,r8 @ a1^a2^a4
str r4,[sp,#24] @ tab[6]=a2^a4
and r8,r12,r0,lsl#2
str r7,[sp,#28] @ tab[7]=a1^a2^a4
and r9,r12,r0,lsr#1
ldr r5,[sp,r8] @ tab[b & 0x7]
and r8,r12,r0,lsr#4
ldr r7,[sp,r9] @ tab[b >> 3 & 0x7]
and r9,r12,r0,lsr#7
ldr r6,[sp,r8] @ tab[b >> 6 & 0x7]
eor r5,r5,r7,lsl#3 @ stall
mov r4,r7,lsr#29
ldr r7,[sp,r9] @ tab[b >> 9 & 0x7]
and r8,r12,r0,lsr#10
eor r5,r5,r6,lsl#6
eor r4,r4,r6,lsr#26
ldr r6,[sp,r8] @ tab[b >> 12 & 0x7]
and r9,r12,r0,lsr#13
eor r5,r5,r7,lsl#9
eor r4,r4,r7,lsr#23
ldr r7,[sp,r9] @ tab[b >> 15 & 0x7]
and r8,r12,r0,lsr#16
eor r5,r5,r6,lsl#12
eor r4,r4,r6,lsr#20
ldr r6,[sp,r8] @ tab[b >> 18 & 0x7]
and r9,r12,r0,lsr#19
eor r5,r5,r7,lsl#15
eor r4,r4,r7,lsr#17
ldr r7,[sp,r9] @ tab[b >> 21 & 0x7]
and r8,r12,r0,lsr#22
eor r5,r5,r6,lsl#18
eor r4,r4,r6,lsr#14
ldr r6,[sp,r8] @ tab[b >> 24 & 0x7]
and r9,r12,r0,lsr#25
eor r5,r5,r7,lsl#21
eor r4,r4,r7,lsr#11
ldr r7,[sp,r9] @ tab[b >> 27 & 0x7]
tst r1,#1<<30
and r8,r12,r0,lsr#28
eor r5,r5,r6,lsl#24
eor r4,r4,r6,lsr#8
ldr r6,[sp,r8] @ tab[b >> 30 ]
eorne r5,r5,r0,lsl#30
eorne r4,r4,r0,lsr#2
tst r1,#1<<31
eor r5,r5,r7,lsl#27
eor r4,r4,r7,lsr#5
eorne r5,r5,r0,lsl#31
eorne r4,r4,r0,lsr#1
eor r5,r5,r6,lsl#30
eor r4,r4,r6,lsr#2
mov pc,lr
.size mul_1x1_ialu,.-mul_1x1_ialu
.global bn_GF2m_mul_2x2
.type bn_GF2m_mul_2x2,%function
.align 5
bn_GF2m_mul_2x2:
#if __ARM_MAX_ARCH__>=7
ldr r12,.LOPENSSL_armcap
.Lpic: ldr r12,[pc,r12]
tst r12,#1
bne .LNEON
#endif
stmdb sp!,{r4-r10,lr}
mov r10,r0 @ reassign 1st argument
mov r0,r3 @ r0=b1
ldr r3,[sp,#32] @ load b0
mov r12,#7<<2
sub sp,sp,#32 @ allocate tab[8]
bl mul_1x1_ialu @ a1·b1
str r5,[r10,#8]
str r4,[r10,#12]
eor r0,r0,r3 @ flip b0 and b1
eor r1,r1,r2 @ flip a0 and a1
eor r3,r3,r0
eor r2,r2,r1
eor r0,r0,r3
eor r1,r1,r2
bl mul_1x1_ialu @ a0·b0
str r5,[r10]
str r4,[r10,#4]
eor r1,r1,r2
eor r0,r0,r3
bl mul_1x1_ialu @ (a1+a0)·(b1+b0)
ldmia r10,{r6-r9}
eor r5,r5,r4
eor r4,r4,r7
eor r5,r5,r6
eor r4,r4,r8
eor r5,r5,r9
eor r4,r4,r9
str r4,[r10,#8]
eor r5,r5,r4
add sp,sp,#32 @ destroy tab[8]
str r5,[r10,#4]
#if __ARM_ARCH__>=5
ldmia sp!,{r4-r10,pc}
#else
ldmia sp!,{r4-r10,lr}
tst lr,#1
moveq pc,lr @ be binary compatible with V4, yet
.word 0xe12fff1e @ interoperable with Thumb ISA:-)
#endif
#if __ARM_MAX_ARCH__>=7
.arch armv7-a
.fpu neon
.align 5
.LNEON:
ldr r12, [sp] @ 5th argument
vmov.32 d26, r2, r1
vmov.32 d27, r12, r3
vmov.i64 d28, #0x0000ffffffffffff
vmov.i64 d29, #0x00000000ffffffff
vmov.i64 d30, #0x000000000000ffff
vext.8 d2, d26, d26, #1 @ A1
vmull.p8 q1, d2, d27 @ F = A1*B
vext.8 d0, d27, d27, #1 @ B1
vmull.p8 q0, d26, d0 @ E = A*B1
vext.8 d4, d26, d26, #2 @ A2
vmull.p8 q2, d4, d27 @ H = A2*B
vext.8 d16, d27, d27, #2 @ B2
vmull.p8 q8, d26, d16 @ G = A*B2
vext.8 d6, d26, d26, #3 @ A3
veor q1, q1, q0 @ L = E + F
vmull.p8 q3, d6, d27 @ J = A3*B
vext.8 d0, d27, d27, #3 @ B3
veor q2, q2, q8 @ M = G + H
vmull.p8 q0, d26, d0 @ I = A*B3
veor d2, d2, d3 @ t0 = (L) (P0 + P1) << 8
vand d3, d3, d28
vext.8 d16, d27, d27, #4 @ B4
veor d4, d4, d5 @ t1 = (M) (P2 + P3) << 16
vand d5, d5, d29
vmull.p8 q8, d26, d16 @ K = A*B4
veor q3, q3, q0 @ N = I + J
veor d2, d2, d3
veor d4, d4, d5
veor d6, d6, d7 @ t2 = (N) (P4 + P5) << 24
vand d7, d7, d30
vext.8 q1, q1, q1, #15
veor d16, d16, d17 @ t3 = (K) (P6 + P7) << 32
vmov.i64 d17, #0
vext.8 q2, q2, q2, #14
veor d6, d6, d7
vmull.p8 q0, d26, d27 @ D = A*B
vext.8 q8, q8, q8, #12
vext.8 q3, q3, q3, #13
veor q1, q1, q2
veor q3, q3, q8
veor q0, q0, q1
veor q0, q0, q3
vst1.32 {q0}, [r0]
bx lr @ bx lr
#endif
.size bn_GF2m_mul_2x2,.-bn_GF2m_mul_2x2
#if __ARM_MAX_ARCH__>=7
.align 5
.LOPENSSL_armcap:
.word OPENSSL_armcap_P-(.Lpic+8)
#endif
.asciz "GF(2^m) Multiplication for ARMv4/NEON, CRYPTOGAMS by <appro@openssl.org>"
.align 5
#if __ARM_MAX_ARCH__>=7
.comm OPENSSL_armcap_P,4,4
#endif
| {
"pile_set_name": "Github"
} |
from __future__ import annotations
from dataclasses import replace
from math import pi
from typing import Callable, List, Optional, Tuple
from gaphas.geometry import Rectangle
from gaphor.core.modeling import DrawContext, UpdateContext
from gaphor.core.styling import Style, TextAlign, VerticalAlign
from gaphor.diagram.text import Layout, focus_box_pos
class cairo_state:
def __init__(self, cr):
self._cr = cr
def __enter__(self):
self._cr.save()
return self._cr
def __exit__(self, _type, _value, _traceback):
self._cr.restore()
def combined_style(item_style: Style, inline_style: Style = {}) -> Style:
"""Combine context style and inline styles into one style."""
return {**item_style, **inline_style} # type: ignore[misc]
def stroke(context: DrawContext, fill=True, highlight=False):
style = context.style
cr = context.cairo
fill_color = style.get("background-color")
if fill and fill_color:
with cairo_state(cr):
cr.set_source_rgba(*fill_color)
cr.fill_preserve()
if highlight:
draw_highlight(context)
with cairo_state(cr):
stroke = style.get("color")
if stroke:
cr.set_source_rgba(*stroke)
line_width = style.get("line-width")
if line_width:
cr.set_line_width(line_width)
cr.stroke()
def draw_border(box, context: DrawContext, bounding_box: Rectangle):
cr = context.cairo
d = context.style.get("border-radius", 0)
x, y, width, height = bounding_box
cr.move_to(x, d)
cr.set_dash(context.style.get("dash-style", ()), 0)
if d:
x1 = width + x
y1 = height + y
cr.arc(d, d, d, pi, 1.5 * pi)
cr.line_to(x1 - d, y)
cr.arc(x1 - d, d, d, 1.5 * pi, y)
cr.line_to(x1, y1 - d)
cr.arc(x1 - d, y1 - d, d, 0, 0.5 * pi)
cr.line_to(d, y1)
cr.arc(d, y1 - d, d, 0.5 * pi, pi)
else:
cr.rectangle(x, y, width, height)
cr.close_path()
draw_highlight(context)
stroke(context)
def draw_top_separator(box: Box, context: DrawContext, bounding_box: Rectangle):
x, y, w, h = bounding_box
cr = context.cairo
cr.move_to(x, y)
cr.line_to(x + w, y)
stroke(context, fill=False)
def draw_highlight(context: DrawContext):
if not context.dropzone:
return
with cairo_state(context.cairo) as cr:
highlight_color = context.style["highlight-color"]
cr.set_source_rgba(*highlight_color)
cr.set_line_width(cr.get_line_width() * 3.141)
cr.stroke_preserve()
class Box:
"""A box like shape.
Style properties:
- min-height
- min-width
- padding: a tuple (top, right, bottom, left)
- vertical-align: alignment of child shapes
- border-radius
"""
def __init__(
self,
*children,
style: Style = {},
draw: Optional[Callable[[Box, DrawContext, Rectangle], None]] = None,
):
self.children = children
self.sizes: List[Tuple[int, int]] = []
self._inline_style = style
self._draw_border = draw
def __len__(self):
return len(self.children)
def __iter__(self):
return iter(self.children)
def __getitem__(self, index):
return self.children[index]
def size(self, context: UpdateContext):
style: Style = combined_style(context.style, self._inline_style)
min_width = style.get("min-width", 0)
min_height = style.get("min-height", 0)
padding_top, padding_right, padding_bottom, padding_left = style["padding"]
self.sizes = sizes = [c.size(context) for c in self.children]
if sizes:
widths, heights = list(zip(*sizes))
return (
max(
min_width,
max(widths) + padding_right + padding_left,
),
max(
min_height,
sum(heights) + padding_top + padding_bottom,
),
)
else:
return min_width, min_height
def draw(self, context: DrawContext, bounding_box: Rectangle):
style: Style = combined_style(context.style, self._inline_style)
new_context = replace(context, style=style)
padding_top, padding_right, padding_bottom, padding_left = style["padding"]
valign = style.get("vertical-align", VerticalAlign.MIDDLE)
height = sum(h for _w, h in self.sizes)
if self._draw_border:
self._draw_border(self, new_context, bounding_box)
x = bounding_box.x + padding_left
if valign is VerticalAlign.MIDDLE:
y = (
bounding_box.y
+ padding_top
+ (max(height, bounding_box.height - padding_top) - height) / 2
)
elif valign is VerticalAlign.BOTTOM:
y = bounding_box.y + bounding_box.height - height - padding_bottom
else:
y = bounding_box.y + padding_top
w = bounding_box.width - padding_right - padding_left
for c, (_w, h) in zip(self.children, self.sizes):
c.draw(context, Rectangle(x, y, w, h))
y += h
class IconBox:
"""A special type of box: the icon element is given the full width/height
and all other shapes are drawn below the main icon shape.
Style properties:
- min-height
- min-width
- vertical-spacing: spacing between icon and children
- padding: a tuple (top, right, bottom, left)
"""
def __init__(self, icon, *children, style: Style = {}):
self.icon = icon
self.children = children
self.sizes: List[Tuple[int, int]] = []
self._inline_style = style
def size(self, context: UpdateContext):
style = combined_style(context.style, self._inline_style)
min_width = style.get("min-width", 0)
min_height = style.get("min-height", 0)
padding_top, padding_right, padding_bottom, padding_left = style["padding"]
self.sizes = [c.size(context) for c in self.children]
width, height = self.icon.size(context)
return (
max(min_width, width + padding_right + padding_left),
max(min_height, height + padding_top + padding_bottom),
)
def child_pos(self, style: Style, bounding_box: Rectangle) -> Rectangle:
if not self.sizes:
return Rectangle()
text_align = style.get("text-align", TextAlign.CENTER)
vertical_align = style.get("vertical-align", VerticalAlign.BOTTOM)
vertical_spacing = style.get("vertical-spacing", 0) # should be margin?
ws, hs = list(zip(*self.sizes))
max_w = max(ws)
total_h = sum(hs)
if text_align == TextAlign.CENTER:
x = bounding_box.x + (bounding_box.width - max_w) / 2
elif text_align == TextAlign.LEFT:
x = bounding_box.x - max_w - vertical_spacing
elif text_align == TextAlign.RIGHT:
x = bounding_box.x + bounding_box.width + vertical_spacing
if vertical_align == VerticalAlign.BOTTOM:
y = bounding_box.y + bounding_box.height + vertical_spacing
elif vertical_align == VerticalAlign.MIDDLE:
y = bounding_box.y + (bounding_box.height - total_h) / 2
elif vertical_align == VerticalAlign.TOP:
y = bounding_box.y - total_h - vertical_spacing
return Rectangle(
x,
y,
max_w,
total_h,
)
def draw(self, context: DrawContext, bounding_box: Rectangle):
style = combined_style(context.style, self._inline_style)
new_context = replace(context, style=style)
padding_top, padding_right, padding_bottom, padding_left = style["padding"]
x = bounding_box.x + padding_left
y = bounding_box.y + padding_top
w = bounding_box.width - padding_right - padding_left
h = bounding_box.height - padding_top - padding_bottom
self.icon.draw(new_context, Rectangle(x, y, w, h))
cx, cy, max_w, total_h = self.child_pos(style, bounding_box)
for c, (cw, ch) in zip(self.children, self.sizes):
c.draw(context, Rectangle(cx + (max_w - cw) / 2, cy, cw, ch))
cy += ch
class Text:
def __init__(self, text=lambda: "", width=lambda: -1, style: Style = {}):
self._text = text if callable(text) else lambda: text
self.width = width if callable(width) else lambda: width
self._inline_style = style
self._layout = Layout()
def text(self):
try:
return self._text()
except AttributeError:
return ""
def size(self, context: UpdateContext):
style = combined_style(context.style, self._inline_style)
min_w = style.get("min-width", 0)
min_h = style.get("min-height", 0)
text_align = style.get("text-align", TextAlign.CENTER)
padding_top, padding_right, padding_bottom, padding_left = style["padding"]
layout = self._layout
layout.set(
text=self.text(), font=style, width=self.width(), text_align=text_align
)
width, height = layout.size()
return (
max(min_w, width + padding_right + padding_left),
max(min_h, height + padding_top + padding_bottom),
)
def text_box(self, style: Style, bounding_box: Rectangle) -> Rectangle:
"""Add padding to a bounding box."""
padding_top, padding_right, padding_bottom, padding_left = style["padding"]
return Rectangle(
bounding_box.x + padding_left,
bounding_box.y + padding_top,
bounding_box.width - padding_right - padding_left,
bounding_box.height - padding_top - padding_bottom,
)
def draw(self, context: DrawContext, bounding_box: Rectangle):
"""Draw the text, return the location and size."""
style = combined_style(context.style, self._inline_style)
min_w = max(style.get("min-width", 0), bounding_box.width)
min_h = max(style.get("min-height", 0), bounding_box.height)
text_box = self.text_box(style, bounding_box)
with cairo_state(context.cairo) as cr:
text_color = style.get("text-color")
if text_color:
cr.set_source_rgba(*text_color)
layout = self._layout
cr.move_to(text_box.x, text_box.y)
layout.set(font=style)
layout.show_layout(cr, text_box.width, default_size=(min_w, min_h))
class EditableText(Text):
def __init__(self, text=lambda: "", width=lambda: -1, style: Style = {}):
super().__init__(text, width, {"min-width": 30, "min-height": 14, **style}) # type: ignore[misc]
self.focus_box = Rectangle()
@property
def bounding_box(self):
"""Bounding box is used by the inline editor."""
return self.focus_box
def size(self, context: UpdateContext):
text_size = super().size(context)
w, h = text_size
self.focus_box.width = w
self.focus_box.height = h
return text_size
def draw(self, context: DrawContext, bounding_box: Rectangle):
"""Draw the editable text."""
super().draw(context, bounding_box)
style = combined_style(context.style, self._inline_style)
text_box = self.text_box(style, bounding_box)
text_align = style.get("text-align", TextAlign.CENTER)
focus_box = self.focus_box
x, y = focus_box_pos(text_box, (focus_box.width, focus_box.height), text_align)
focus_box.x = x
focus_box.y = y
text_draw_focus_box(context, *focus_box)
def draw_default_head(context: DrawContext):
"""Default head drawer: move cursor to the first handle."""
context.cairo.move_to(0, 0)
def draw_default_tail(context: DrawContext):
"""Default tail drawer: draw line to the last handle."""
context.cairo.line_to(0, 0)
def draw_arrow_head(context: DrawContext):
cr = context.cairo
cr.set_dash((), 0)
cr.move_to(15, -6)
cr.line_to(0, 0)
cr.line_to(15, 6)
cr.stroke()
cr.move_to(0, 0)
def draw_arrow_tail(context: DrawContext):
cr = context.cairo
cr.line_to(0, 0)
cr.stroke()
cr.move_to(15, -6)
cr.line_to(0, 0)
cr.line_to(15, 6)
def text_draw_focus_box(context, x, y, w, h):
if context.hovered or context.focused:
with cairo_state(context.cairo) as cr:
# cr.set_dash(() if context.focused else (2.0, 2.0), 0)
cr.set_dash((), 0)
if context.focused:
cr.set_source_rgb(0.6, 0.6, 0.6)
else:
cr.set_source_rgb(0.8, 0.8, 0.8)
cr.set_line_width(0.5)
cr.rectangle(x, y, w, h)
cr.stroke()
| {
"pile_set_name": "Github"
} |
'use strict';
/* jshint quotmark: double */
window.SwaggerTranslator.learn({
"Warning: Deprecated":"Advertencia: Obsoleto",
"Implementation Notes":"Notas de implementación",
"Response Class":"Clase de la Respuesta",
"Status":"Status",
"Parameters":"Parámetros",
"Parameter":"Parámetro",
"Value":"Valor",
"Description":"Descripción",
"Parameter Type":"Tipo del Parámetro",
"Data Type":"Tipo del Dato",
"Response Messages":"Mensajes de la Respuesta",
"HTTP Status Code":"Código de Status HTTP",
"Reason":"Razón",
"Response Model":"Modelo de la Respuesta",
"Request URL":"URL de la Solicitud",
"Response Body":"Cuerpo de la Respuesta",
"Response Code":"Código de la Respuesta",
"Response Headers":"Encabezados de la Respuesta",
"Hide Response":"Ocultar Respuesta",
"Try it out!":"Pruébalo!",
"Show/Hide":"Mostrar/Ocultar",
"List Operations":"Listar Operaciones",
"Expand Operations":"Expandir Operaciones",
"Raw":"Crudo",
"can't parse JSON. Raw result":"no puede parsear el JSON. Resultado crudo",
"Example Value":"Valor de Ejemplo",
"Model Schema":"Esquema del Modelo",
"Model":"Modelo",
"apply":"aplicar",
"Username":"Nombre de usuario",
"Password":"Contraseña",
"Terms of service":"Términos de Servicio",
"Created by":"Creado por",
"See more at":"Ver más en",
"Contact the developer":"Contactar al desarrollador",
"api version":"versión de la api",
"Response Content Type":"Tipo de Contenido (Content Type) de la Respuesta",
"fetching resource":"buscando recurso",
"fetching resource list":"buscando lista del recurso",
"Explore":"Explorar",
"Show Swagger Petstore Example Apis":"Mostrar Api Ejemplo de Swagger Petstore",
"Can't read from server. It may not have the appropriate access-control-origin settings.":"No se puede leer del servidor. Tal vez no tiene la configuración de control de acceso de origen (access-control-origin) apropiado.",
"Please specify the protocol for":"Por favor, especificar el protocola para",
"Can't read swagger JSON from":"No se puede leer el JSON de swagger desde",
"Finished Loading Resource Information. Rendering Swagger UI":"Finalizada la carga del recurso de Información. Mostrando Swagger UI",
"Unable to read api":"No se puede leer la api",
"from path":"desde ruta",
"server returned":"el servidor retornó"
});
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.