code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
4
991
language
stringclasses
9 values
license
stringclasses
15 values
size
int32
3
1.05M
/* * 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.ignite.cache; import java.util.concurrent.Callable; import java.util.concurrent.CountDownLatch; import javax.cache.processor.EntryProcessorException; import javax.cache.processor.MutableEntry; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.testframework.GridTestUtils; import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; import org.apache.ignite.transactions.TransactionOptimisticException; import org.junit.Test; /** */ public class IgniteCacheEntryProcessorSequentialCallTest extends GridCommonAbstractTest { /** */ private static final String CACHE = "cache"; /** */ private static final String MVCC_CACHE = "mvccCache"; /** */ private String cacheName; /** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { startGrids(2); } /** {@inheritDoc} */ @Override protected void afterTestsStopped() throws Exception { stopAllGrids(); } /** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); cacheName = CACHE; } /** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration ccfg = cacheConfiguration(CACHE); CacheConfiguration mvccCfg = cacheConfiguration(MVCC_CACHE) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL_SNAPSHOT); cfg.setCacheConfiguration(ccfg, mvccCfg); return cfg; } /** * * @return Cache configuration. * @param name Cache name. */ private CacheConfiguration cacheConfiguration(String name) { CacheConfiguration cacheCfg = new CacheConfiguration(name); cacheCfg.setCacheMode(CacheMode.PARTITIONED); cacheCfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cacheCfg.setRebalanceMode(CacheRebalanceMode.SYNC); cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cacheCfg.setMaxConcurrentAsyncOperations(0); cacheCfg.setBackups(0); return cacheCfg; } /** * */ @Test public void testOptimisticSerializableTxInvokeSequentialCall() throws Exception { transactionInvokeSequentialCallOnPrimaryNode(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE); transactionInvokeSequentialCallOnNearNode(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE); } /** * */ @Test public void testOptimisticRepeatableReadTxInvokeSequentialCall() throws Exception { transactionInvokeSequentialCallOnPrimaryNode(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ); transactionInvokeSequentialCallOnNearNode(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ); } /** * */ @Test public void testOptimisticReadCommittedTxInvokeSequentialCall() throws Exception { transactionInvokeSequentialCallOnPrimaryNode(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.READ_COMMITTED); transactionInvokeSequentialCallOnNearNode(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.READ_COMMITTED); } /** * */ @Test public void testPessimisticSerializableTxInvokeSequentialCall() throws Exception { transactionInvokeSequentialCallOnPrimaryNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.SERIALIZABLE); transactionInvokeSequentialCallOnNearNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.SERIALIZABLE); } /** * */ @Test public void testPessimisticRepeatableReadTxInvokeSequentialCall() throws Exception { transactionInvokeSequentialCallOnPrimaryNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); transactionInvokeSequentialCallOnNearNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); } /** * */ @Test public void testPessimisticReadCommittedTxInvokeSequentialCall() throws Exception { transactionInvokeSequentialCallOnPrimaryNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.READ_COMMITTED); transactionInvokeSequentialCallOnNearNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.READ_COMMITTED); } /** * */ @Test public void testMvccTxInvokeSequentialCall() throws Exception { cacheName = MVCC_CACHE; transactionInvokeSequentialCallOnPrimaryNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); transactionInvokeSequentialCallOnNearNode(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); } /** * Test for sequential entry processor invoking not null value on primary cache. * In this test entry processor gets value from local node. * * @param transactionConcurrency Transaction concurrency. * @param transactionIsolation Transaction isolation. */ public void transactionInvokeSequentialCallOnPrimaryNode(TransactionConcurrency transactionConcurrency, TransactionIsolation transactionIsolation) throws Exception { TestKey key = new TestKey(1L); TestValue val = new TestValue(); val.value("1"); Ignite primaryIgnite; if (ignite(0).affinity(cacheName).isPrimary(ignite(0).cluster().localNode(), key)) primaryIgnite = ignite(0); else primaryIgnite = ignite(1); IgniteCache<TestKey, TestValue> cache = primaryIgnite.cache(cacheName); cache.put(key, val); NotNullCacheEntryProcessor cacheEntryProcessor = new NotNullCacheEntryProcessor(); try (Transaction transaction = primaryIgnite.transactions().txStart(transactionConcurrency, transactionIsolation)) { cache.invoke(key, cacheEntryProcessor); cache.invoke(key, cacheEntryProcessor); transaction.commit(); } cache.remove(key); } /** * Test for sequential entry processor invoking not null value on near cache. * In this test entry processor fetches value from remote node. * * @param transactionConcurrency Transaction concurrency. * @param transactionIsolation Transaction isolation. */ public void transactionInvokeSequentialCallOnNearNode(TransactionConcurrency transactionConcurrency, TransactionIsolation transactionIsolation) throws Exception { TestKey key = new TestKey(1L); TestValue val = new TestValue(); val.value("1"); Ignite nearIgnite; Ignite primaryIgnite; if (ignite(0).affinity(cacheName).isPrimary(ignite(0).cluster().localNode(), key)) { primaryIgnite = ignite(0); nearIgnite = ignite(1); } else { primaryIgnite = ignite(1); nearIgnite = ignite(0); } primaryIgnite.cache(cacheName).put(key, val); IgniteCache<TestKey, TestValue> nearCache = nearIgnite.cache(cacheName); NotNullCacheEntryProcessor cacheEntryProcessor = new NotNullCacheEntryProcessor(); try (Transaction transaction = nearIgnite.transactions().txStart(transactionConcurrency, transactionIsolation)) { nearCache.invoke(key, cacheEntryProcessor); nearCache.invoke(key, cacheEntryProcessor); transaction.commit(); } primaryIgnite.cache(cacheName).remove(key); } /** * Test for sequential entry processor invocation. During transaction value is changed externally, which leads to * optimistic conflict exception. */ @Test @SuppressWarnings("ThrowableNotThrown") public void testTxInvokeSequentialOptimisticConflict() throws Exception { TestKey key = new TestKey(1L); IgniteCache<TestKey, TestValue> cache = ignite(0).cache(CACHE); CountDownLatch latch = new CountDownLatch(1); cache.put(key, new TestValue("1")); multithreadedAsync(new Runnable() { @Override public void run() { try { latch.await(); } catch (InterruptedException e) { fail(); } cache.put(key, new TestValue("2")); } }, 1); Transaction tx = ignite(0).transactions().txStart(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE); cache.invoke(key, new NotNullCacheEntryProcessor()); latch.countDown(); Thread.sleep(1_000); cache.invoke(key, new NotNullCacheEntryProcessor()); GridTestUtils.assertThrowsWithCause(new Callable<Object>() { @Override public Object call() throws Exception { tx.commit(); return null; } }, TransactionOptimisticException.class); cache.remove(key); } /** * Cache entry processor checking whether entry has got non-null value. */ public static class NotNullCacheEntryProcessor implements CacheEntryProcessor<TestKey, TestValue, Object> { /** {@inheritDoc} */ @Override public Object process(MutableEntry entry, Object... arguments) throws EntryProcessorException { assertNotNull(entry.getValue()); return null; } } /** * */ public static class TestKey { /** Value. */ private final Long val; /** * @param val Value. */ public TestKey(Long val) { this.val = val; } } /** * */ public static class TestValue { /** Value. */ private String val; /** * Default constructor. */ public TestValue() { } /** * @param val Value. */ public TestValue(String val) { this.val = val; } /** * @return Value. */ public String value() { return val; } /** * @param val New value. */ public void value(String val) { this.val = val; } } }
samaitra/ignite
modules/core/src/test/java/org/apache/ignite/cache/IgniteCacheEntryProcessorSequentialCallTest.java
Java
apache-2.0
11,581
/* * Copyright 2000-2014 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.event; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.EventObject; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.logging.Logger; import com.vaadin.server.ErrorEvent; import com.vaadin.server.ErrorHandler; /** * <code>EventRouter</code> class implementing the inheritable event listening * model. For more information on the event model see the * {@link com.vaadin.event package documentation}. * * @author Vaadin Ltd. * @since 3.0 */ @SuppressWarnings("serial") public class EventRouter implements MethodEventSource { /** * List of registered listeners. */ private LinkedHashSet<ListenerMethod> listenerList = null; /* * Registers a new listener with the specified activation method to listen * events generated by this component. Don't add a JavaDoc comment here, we * use the default documentation from implemented interface. */ @Override public void addListener(Class<?> eventType, Object object, Method method) { if (listenerList == null) { listenerList = new LinkedHashSet<ListenerMethod>(); } listenerList.add(new ListenerMethod(eventType, object, method)); } /* * Registers a new listener with the specified named activation method to * listen events generated by this component. Don't add a JavaDoc comment * here, we use the default documentation from implemented interface. */ @Override public void addListener(Class<?> eventType, Object object, String methodName) { if (listenerList == null) { listenerList = new LinkedHashSet<ListenerMethod>(); } listenerList.add(new ListenerMethod(eventType, object, methodName)); } /* * Removes all registered listeners matching the given parameters. Don't add * a JavaDoc comment here, we use the default documentation from implemented * interface. */ @Override public void removeListener(Class<?> eventType, Object target) { if (listenerList != null) { final Iterator<ListenerMethod> i = listenerList.iterator(); while (i.hasNext()) { final ListenerMethod lm = i.next(); if (lm.matches(eventType, target)) { i.remove(); return; } } } } /* * Removes the event listener methods matching the given given paramaters. * Don't add a JavaDoc comment here, we use the default documentation from * implemented interface. */ @Override public void removeListener(Class<?> eventType, Object target, Method method) { if (listenerList != null) { final Iterator<ListenerMethod> i = listenerList.iterator(); while (i.hasNext()) { final ListenerMethod lm = i.next(); if (lm.matches(eventType, target, method)) { i.remove(); return; } } } } /* * Removes the event listener method matching the given given parameters. * Don't add a JavaDoc comment here, we use the default documentation from * implemented interface. */ @Override public void removeListener(Class<?> eventType, Object target, String methodName) { // Find the correct method final Method[] methods = target.getClass().getMethods(); Method method = null; for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equals(methodName)) { method = methods[i]; } } if (method == null) { throw new IllegalArgumentException(); } // Remove the listeners if (listenerList != null) { final Iterator<ListenerMethod> i = listenerList.iterator(); while (i.hasNext()) { final ListenerMethod lm = i.next(); if (lm.matches(eventType, target, method)) { i.remove(); return; } } } } /** * Removes all listeners from event router. */ public void removeAllListeners() { listenerList = null; } /** * Sends an event to all registered listeners. The listeners will decide if * the activation method should be called or not. * * @param event * the Event to be sent to all listeners. */ public void fireEvent(EventObject event) { fireEvent(event, null); } /** * Sends an event to all registered listeners. The listeners will decide if * the activation method should be called or not. * <p> * If an error handler is set, the processing of other listeners will * continue after the error handler method call unless the error handler * itself throws an exception. * * @param event * the Event to be sent to all listeners. * @param errorHandler * error handler to use to handle any exceptions thrown by * listeners or null to let the exception propagate to the * caller, preventing further listener calls */ public void fireEvent(EventObject event, ErrorHandler errorHandler) { // It is not necessary to send any events if there are no listeners if (listenerList != null) { // Make a copy of the listener list to allow listeners to be added // inside listener methods. Fixes #3605. // Send the event to all listeners. The listeners themselves // will filter out unwanted events. final Object[] listeners = listenerList.toArray(); for (int i = 0; i < listeners.length; i++) { ListenerMethod listenerMethod = (ListenerMethod) listeners[i]; if (null != errorHandler) { try { listenerMethod.receiveEvent(event); } catch (Exception e) { errorHandler.error(new ErrorEvent(e)); } } else { listenerMethod.receiveEvent(event); } } } } /** * Checks if the given Event type is listened by a listener registered to * this router. * * @param eventType * the event type to be checked * @return true if a listener is registered for the given event type */ public boolean hasListeners(Class<?> eventType) { if (listenerList != null) { for (ListenerMethod lm : listenerList) { if (lm.isType(eventType)) { return true; } } } return false; } /** * Returns all listeners that match or extend the given event type. * * @param eventType * The type of event to return listeners for. * @return A collection with all registered listeners. Empty if no listeners * are found. */ public Collection<?> getListeners(Class<?> eventType) { List<Object> listeners = new ArrayList<Object>(); if (listenerList != null) { for (ListenerMethod lm : listenerList) { if (lm.isOrExtendsType(eventType)) { listeners.add(lm.getTarget()); } } } return listeners; } private Logger getLogger() { return Logger.getLogger(EventRouter.class.getName()); } }
shahrzadmn/vaadin
server/src/com/vaadin/event/EventRouter.java
Java
apache-2.0
8,333
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright * (C) 2003-2008 Frederico Caldeira Knabben == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your choice: - * GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html - GNU Lesser General Public License * Version 2.1 or later (the "LGPL") http://www.gnu.org/licenses/lgpl.html - * Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html == END LICENSE == * * Useful functions used by almost all dialog window pages. Dialogs should link * to this file as the very first script on the page. */ // Automatically detect the correct document.domain (#123). (function() { var d = document.domain; while (true) { // Test if we can access a parent property. try { var test = window.parent.document.domain; break; } catch (e) { } // Remove a domain part: www.mytest.example.com => mytest.example.com => // example.com ... d = d.replace(/.*?(?:\.|$)/, ''); if (d.length == 0) break; // It was not able to detect the domain. try { document.domain = d; } catch (e) { break; } } })(); // Attention: FCKConfig must be available in the page. function GetCommonDialogCss(prefix) { // CSS minified by http://iceyboard.no-ip.org/projects/css_compressor (see // _dev/css_compression.txt). return FCKConfig.BasePath + 'dialog/common/' + '|.ImagePreviewArea{border:#000 1px solid;overflow:auto;width:100%;height:170px;background-color:#fff}.FlashPreviewArea{border:#000 1px solid;padding:5px;overflow:auto;width:100%;height:170px;background-color:#fff}.BtnReset{float:left;background-position:center center;background-image:url(images/reset.gif);width:16px;height:16px;background-repeat:no-repeat;border:1px none;font-size:1px}.BtnLocked,.BtnUnlocked{float:left;background-position:center center;background-image:url(images/locked.gif);width:16px;height:16px;background-repeat:no-repeat;border:none 1px;font-size:1px}.BtnUnlocked{background-image:url(images/unlocked.gif)}.BtnOver{border:outset 1px;cursor:pointer;cursor:hand}'; } // Gets a element by its Id. Used for shorter coding. function GetE(elementId) { return document.getElementById(elementId); } function ShowE(element, isVisible) { if (typeof(element) == 'string') element = GetE(element); element.style.display = isVisible ? '' : 'none'; } function SetAttribute(element, attName, attValue) { if (attValue == null || attValue.length == 0) element.removeAttribute(attName, 0); // 0 : Case Insensitive else element.setAttribute(attName, attValue, 0); // 0 : Case Insensitive } function GetAttribute(element, attName, valueIfNull) { var oAtt = element.attributes[attName]; if (oAtt == null || !oAtt.specified) return valueIfNull ? valueIfNull : ''; var oValue = element.getAttribute(attName, 2); if (oValue == null) oValue = oAtt.nodeValue; return (oValue == null ? valueIfNull : oValue); } function SelectField(elementId) { var element = GetE(elementId); element.focus(); // element.select may not be available for some fields (like <select>). if (element.select) element.select(); } // Functions used by text fields to accept numbers only. var IsDigit = (function() { var KeyIdentifierMap = { End : 35, Home : 36, Left : 37, Right : 39, 'U+00007F' : 46 // Delete }; return function(e) { if (!e) e = event; var iCode = (e.keyCode || e.charCode); if (!iCode && e.keyIdentifier && (e.keyIdentifier in KeyIdentifierMap)) iCode = KeyIdentifierMap[e.keyIdentifier]; return ((iCode >= 48 && iCode <= 57) // Numbers || (iCode >= 35 && iCode <= 40) // Arrows, Home, End || iCode == 8 // Backspace || iCode == 46 // Delete || iCode == 9 // Tab ); } })(); String.prototype.Trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ''); } String.prototype.StartsWith = function(value) { return (this.substr(0, value.length) == value); } String.prototype.Remove = function(start, length) { var s = ''; if (start > 0) s = this.substring(0, start); if (start + length < this.length) s += this.substring(start + length, this.length); return s; } String.prototype.ReplaceAll = function(searchArray, replaceArray) { var replaced = this; for (var i = 0; i < searchArray.length; i++) { replaced = replaced.replace(searchArray[i], replaceArray[i]); } return replaced; } function OpenFileBrowser(url, width, height) { // oEditor must be defined. var iLeft = (oEditor.FCKConfig.ScreenWidth - width) / 2; var iTop = (oEditor.FCKConfig.ScreenHeight - height) / 2; var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes"; sOptions += ",width=" + width; sOptions += ",height=" + height; sOptions += ",left=" + iLeft; sOptions += ",top=" + iTop; window.open(url, 'FCKBrowseWindow', sOptions); } /** * Utility function to create/update an element with a name attribute in IE, so * it behaves properly when moved around It also allows to change the name or * other special attributes in an existing node oEditor : instance of FCKeditor * where the element will be created oOriginal : current element being edited or * null if it has to be created nodeName : string with the name of the element * to create oAttributes : Hash object with the attributes that must be set at * creation time in IE Those attributes will be set also after the element has * been created for any other browser to avoid redudant code */ function CreateNamedElement(oEditor, oOriginal, nodeName, oAttributes) { var oNewNode; // IE doesn't allow easily to change properties of an existing object, // so remove the old and force the creation of a new one. var oldNode = null; if (oOriginal && oEditor.FCKBrowserInfo.IsIE) { // Force the creation only if some of the special attributes have // changed: var bChanged = false; for (var attName in oAttributes) bChanged |= (oOriginal.getAttribute(attName, 2) != oAttributes[attName]); if (bChanged) { oldNode = oOriginal; oOriginal = null; } } // If the node existed (and it's not IE), then we just have to update its // attributes if (oOriginal) { oNewNode = oOriginal; } else { // #676, IE doesn't play nice with the name or type attribute if (oEditor.FCKBrowserInfo.IsIE) { var sbHTML = []; sbHTML.push('<' + nodeName); for (var prop in oAttributes) { sbHTML.push(' ' + prop + '="' + oAttributes[prop] + '"'); } sbHTML.push('>'); if (!oEditor.FCKListsLib.EmptyElements[nodeName.toLowerCase()]) sbHTML.push('</' + nodeName + '>'); oNewNode = oEditor.FCK.EditorDocument .createElement(sbHTML.join('')); // Check if we are just changing the properties of an existing node: // copy its properties if (oldNode) { CopyAttributes(oldNode, oNewNode, oAttributes); oEditor.FCKDomTools.MoveChildren(oldNode, oNewNode); oldNode.parentNode.removeChild(oldNode); oldNode = null; if (oEditor.FCK.Selection.SelectionData) { // Trick to refresh the selection object and avoid error in // fckdialog.html Selection.EnsureSelection var oSel = oEditor.FCK.EditorDocument.selection; oEditor.FCK.Selection.SelectionData = oSel.createRange(); // Now // oSel.type // will // be // 'None' // reflecting // the // real // situation } } oNewNode = oEditor.FCK.InsertElement(oNewNode); // FCK.Selection.SelectionData is broken by now since we've // deleted the previously selected element. So we need to reassign // it. if (oEditor.FCK.Selection.SelectionData) { var range = oEditor.FCK.EditorDocument.body .createControlRange(); range.add(oNewNode); oEditor.FCK.Selection.SelectionData = range; } } else { oNewNode = oEditor.FCK.InsertElement(nodeName); } } // Set the basic attributes for (var attName in oAttributes) oNewNode.setAttribute(attName, oAttributes[attName], 0); // 0 : Case // Insensitive return oNewNode; } // Copy all the attributes from one node to the other, kinda like a clone // But oSkipAttributes is an object with the attributes that must NOT be copied function CopyAttributes(oSource, oDest, oSkipAttributes) { var aAttributes = oSource.attributes; for (var n = 0; n < aAttributes.length; n++) { var oAttribute = aAttributes[n]; if (oAttribute.specified) { var sAttName = oAttribute.nodeName; // We can set the type only once, so do it with the proper value, // not copying it. if (sAttName in oSkipAttributes) continue; var sAttValue = oSource.getAttribute(sAttName, 2); if (sAttValue == null) sAttValue = oAttribute.nodeValue; oDest.setAttribute(sAttName, sAttValue, 0); // 0 : Case Insensitive } } // The style: oDest.style.cssText = oSource.style.cssText; }
zhangjunfang/eclipse-dir
nsp/src/main/webapp/scripts/lib/fckeditor/editor/dialog/common/fck_dialog_common.js
JavaScript
bsd-2-clause
8,894
/* * Copyright (c) 2004-2006 The Regents of The University of Michigan * Copyright (c) 2010 The University of Edinburgh * Copyright (c) 2012 Mark D. Hill and David A. Wood * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer; * redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution; * neither the name of the copyright holders nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Authors: Kevin Lim * Timothy M. Jones */ #include "cpu/pred/2bit_local.hh" #include "cpu/pred/bi_mode.hh" #include "cpu/pred/bpred_unit_impl.hh" #include "cpu/pred/tournament.hh" BPredUnit * BranchPredictorParams::create() { // Setup the selected predictor. if (predType == "local") { return new LocalBP(this); } else if (predType == "tournament") { return new TournamentBP(this); } else if (predType == "bi-mode") { return new BiModeBP(this); } else { fatal("Invalid BP selected!"); } }
hoangt/tpzsimul.gem5
src/cpu/pred/bpred_unit.cc
C++
bsd-3-clause
2,246
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.components.minidump_uploader.util; import java.net.HttpURLConnection; /** * A factory class for creating a HttpURLConnection. */ public interface HttpURLConnectionFactory { /** * @param url the url to communicate with * @return a HttpURLConnection to communicate with |url| */ HttpURLConnection createHttpURLConnection(String url); }
scheib/chromium
components/minidump_uploader/android/java/src/org/chromium/components/minidump_uploader/util/HttpURLConnectionFactory.java
Java
bsd-3-clause
548
# -*- coding: utf-8 -*- # # Copyright (C) 2007-2010 Edgewall Software # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms # are also available at http://genshi.edgewall.org/wiki/License. # # This software consists of voluntary contributions made by many # individuals. For the exact contribution history, see the revision # history and logs, available at http://genshi.edgewall.org/log/. from datetime import datetime import doctest from gettext import NullTranslations import unittest from genshi.core import Attrs from genshi.template import MarkupTemplate, Context from genshi.filters.i18n import Translator, extract from genshi.input import HTML from genshi.compat import IS_PYTHON2, StringIO class DummyTranslations(NullTranslations): _domains = {} def __init__(self, catalog=()): NullTranslations.__init__(self) self._catalog = catalog or {} self.plural = lambda n: n != 1 def add_domain(self, domain, catalog): translation = DummyTranslations(catalog) translation.add_fallback(self) self._domains[domain] = translation def _domain_call(self, func, domain, *args, **kwargs): return getattr(self._domains.get(domain, self), func)(*args, **kwargs) if IS_PYTHON2: def ugettext(self, message): missing = object() tmsg = self._catalog.get(message, missing) if tmsg is missing: if self._fallback: return self._fallback.ugettext(message) return unicode(message) return tmsg else: def gettext(self, message): missing = object() tmsg = self._catalog.get(message, missing) if tmsg is missing: if self._fallback: return self._fallback.gettext(message) return unicode(message) return tmsg if IS_PYTHON2: def dugettext(self, domain, message): return self._domain_call('ugettext', domain, message) else: def dgettext(self, domain, message): return self._domain_call('gettext', domain, message) def ungettext(self, msgid1, msgid2, n): try: return self._catalog[(msgid1, self.plural(n))] except KeyError: if self._fallback: return self._fallback.ngettext(msgid1, msgid2, n) if n == 1: return msgid1 else: return msgid2 if not IS_PYTHON2: ngettext = ungettext del ungettext if IS_PYTHON2: def dungettext(self, domain, singular, plural, numeral): return self._domain_call('ungettext', domain, singular, plural, numeral) else: def dngettext(self, domain, singular, plural, numeral): return self._domain_call('ngettext', domain, singular, plural, numeral) class TranslatorTestCase(unittest.TestCase): def test_translate_included_attribute_text(self): """ Verify that translated attributes end up in a proper `Attrs` instance. """ html = HTML(u"""<html> <span title="Foo"></span> </html>""") translator = Translator(lambda s: u"Voh") stream = list(html.filter(translator)) kind, data, pos = stream[2] assert isinstance(data[1], Attrs) def test_extract_without_text(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> <p title="Bar">Foo</p> ${ngettext("Singular", "Plural", num)} </html>""") translator = Translator(extract_text=False) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((3, 'ngettext', ('Singular', 'Plural', None), []), messages[0]) def test_extract_plural_form(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> ${ngettext("Singular", "Plural", num)} </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((2, 'ngettext', ('Singular', 'Plural', None), []), messages[0]) def test_extract_funky_plural_form(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> ${ngettext(len(items), *widget.display_names)} </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((2, 'ngettext', (None, None), []), messages[0]) def test_extract_gettext_with_unicode_string(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> ${gettext("Grüße")} </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((2, 'gettext', u'Gr\xfc\xdfe', []), messages[0]) def test_extract_included_attribute_text(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> <span title="Foo"></span> </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((2, None, 'Foo', []), messages[0]) def test_extract_attribute_expr(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> <input type="submit" value="${_('Save')}" /> </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((2, '_', 'Save', []), messages[0]) def test_extract_non_included_attribute_interpolated(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> <a href="#anchor_${num}">Foo</a> </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((2, None, 'Foo', []), messages[0]) def test_extract_text_from_sub(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> <py:if test="foo">Foo</py:if> </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((2, None, 'Foo', []), messages[0]) def test_ignore_tag_with_fixed_xml_lang(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> <p xml:lang="en">(c) 2007 Edgewall Software</p> </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(0, len(messages)) def test_extract_tag_with_variable_xml_lang(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> <p xml:lang="${lang}">(c) 2007 Edgewall Software</p> </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((2, None, '(c) 2007 Edgewall Software', []), messages[0]) def test_ignore_attribute_with_expression(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/"> <input type="submit" value="Reply" title="Reply to comment $num" /> </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(0, len(messages)) def test_translate_with_translations_object(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" i18n:comment="As in foo bar">Foo</p> </html>""") translator = Translator(DummyTranslations({'Foo': 'Voh'})) translator.setup(tmpl) self.assertEqual("""<html> <p>Voh</p> </html>""", tmpl.generate().render()) class MsgDirectiveTestCase(unittest.TestCase): def test_extract_i18n_msg(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Please see <a href="help.html">Help</a> for details. </p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('Please see [1:Help] for details.', messages[0][2]) def test_translate_i18n_msg(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Please see <a href="help.html">Help</a> for details. </p> </html>""") gettext = lambda s: u"Für Details siehe bitte [1:Hilfe]." translator = Translator(gettext) translator.setup(tmpl) self.assertEqual(u"""<html> <p>Für Details siehe bitte <a href="help.html">Hilfe</a>.</p> </html>""".encode('utf-8'), tmpl.generate().render(encoding='utf-8')) def test_extract_i18n_msg_nonewline(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="">Please see <a href="help.html">Help</a></p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('Please see [1:Help]', messages[0][2]) def test_translate_i18n_msg_nonewline(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="">Please see <a href="help.html">Help</a></p> </html>""") gettext = lambda s: u"Für Details siehe bitte [1:Hilfe]" translator = Translator(gettext) translator.setup(tmpl) self.assertEqual(u"""<html> <p>Für Details siehe bitte <a href="help.html">Hilfe</a></p> </html>""", tmpl.generate().render()) def test_extract_i18n_msg_elt_nonewline(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:msg>Please see <a href="help.html">Help</a></i18n:msg> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('Please see [1:Help]', messages[0][2]) def test_translate_i18n_msg_elt_nonewline(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:msg>Please see <a href="help.html">Help</a></i18n:msg> </html>""") gettext = lambda s: u"Für Details siehe bitte [1:Hilfe]" translator = Translator(gettext) translator.setup(tmpl) self.assertEqual(u"""<html> Für Details siehe bitte <a href="help.html">Hilfe</a> </html>""".encode('utf-8'), tmpl.generate().render(encoding='utf-8')) def test_extract_i18n_msg_with_attributes(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" title="A helpful paragraph"> Please see <a href="help.html" title="Click for help">Help</a> </p> </html>""") translator = Translator() translator.setup(tmpl) messages = list(translator.extract(tmpl.stream)) self.assertEqual(3, len(messages)) self.assertEqual('A helpful paragraph', messages[0][2]) self.assertEqual(3, messages[0][0]) self.assertEqual('Click for help', messages[1][2]) self.assertEqual(4, messages[1][0]) self.assertEqual('Please see [1:Help]', messages[2][2]) self.assertEqual(3, messages[2][0]) def test_translate_i18n_msg_with_attributes(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" title="A helpful paragraph"> Please see <a href="help.html" title="Click for help">Help</a> </p> </html>""") translator = Translator(lambda msgid: { 'A helpful paragraph': 'Ein hilfreicher Absatz', 'Click for help': u'Klicken für Hilfe', 'Please see [1:Help]': u'Siehe bitte [1:Hilfe]' }[msgid]) translator.setup(tmpl) self.assertEqual(u"""<html> <p title="Ein hilfreicher Absatz">Siehe bitte <a href="help.html" title="Klicken für Hilfe">Hilfe</a></p> </html>""", tmpl.generate().render(encoding=None)) def test_extract_i18n_msg_with_dynamic_attributes(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" title="${_('A helpful paragraph')}"> Please see <a href="help.html" title="${_('Click for help')}">Help</a> </p> </html>""") translator = Translator() translator.setup(tmpl) messages = list(translator.extract(tmpl.stream)) self.assertEqual(3, len(messages)) self.assertEqual('A helpful paragraph', messages[0][2]) self.assertEqual(3, messages[0][0]) self.assertEqual('Click for help', messages[1][2]) self.assertEqual(4, messages[1][0]) self.assertEqual('Please see [1:Help]', messages[2][2]) self.assertEqual(3, messages[2][0]) def test_translate_i18n_msg_with_dynamic_attributes(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" title="${_('A helpful paragraph')}"> Please see <a href="help.html" title="${_('Click for help')}">Help</a> </p> </html>""") translator = Translator(lambda msgid: { 'A helpful paragraph': 'Ein hilfreicher Absatz', 'Click for help': u'Klicken für Hilfe', 'Please see [1:Help]': u'Siehe bitte [1:Hilfe]' }[msgid]) translator.setup(tmpl) self.assertEqual(u"""<html> <p title="Ein hilfreicher Absatz">Siehe bitte <a href="help.html" title="Klicken für Hilfe">Hilfe</a></p> </html>""", tmpl.generate(_=translator.translate).render(encoding=None)) def test_extract_i18n_msg_as_element_with_attributes(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:msg params=""> Please see <a href="help.html" title="Click for help">Help</a> </i18n:msg> </html>""") translator = Translator() translator.setup(tmpl) messages = list(translator.extract(tmpl.stream)) self.assertEqual(2, len(messages)) self.assertEqual('Click for help', messages[0][2]) self.assertEqual(4, messages[0][0]) self.assertEqual('Please see [1:Help]', messages[1][2]) self.assertEqual(3, messages[1][0]) def test_translate_i18n_msg_as_element_with_attributes(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:msg params=""> Please see <a href="help.html" title="Click for help">Help</a> </i18n:msg> </html>""") translator = Translator(lambda msgid: { 'Click for help': u'Klicken für Hilfe', 'Please see [1:Help]': u'Siehe bitte [1:Hilfe]' }[msgid]) translator.setup(tmpl) self.assertEqual(u"""<html> Siehe bitte <a href="help.html" title="Klicken für Hilfe">Hilfe</a> </html>""", tmpl.generate().render(encoding=None)) def test_extract_i18n_msg_nested(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Please see <a href="help.html"><em>Help</em> page</a> for details. </p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('Please see [1:[2:Help] page] for details.', messages[0][2]) def test_translate_i18n_msg_nested(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Please see <a href="help.html"><em>Help</em> page</a> for details. </p> </html>""") gettext = lambda s: u"Für Details siehe bitte [1:[2:Hilfeseite]]." translator = Translator(gettext) translator.setup(tmpl) self.assertEqual(u"""<html> <p>Für Details siehe bitte <a href="help.html"><em>Hilfeseite</em></a>.</p> </html>""", tmpl.generate().render()) def test_extract_i18n_msg_label_with_nested_input(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:msg=""> <label><input type="text" size="3" name="daysback" value="30" /> days back</label> </div> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('[1:[2:] days back]', messages[0][2]) def test_translate_i18n_msg_label_with_nested_input(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:msg=""> <label><input type="text" size="3" name="daysback" value="30" /> foo bar</label> </div> </html>""") gettext = lambda s: "[1:[2:] foo bar]" translator = Translator(gettext) translator.setup(tmpl) self.assertEqual("""<html> <div><label><input type="text" size="3" name="daysback" value="30"/> foo bar</label></div> </html>""", tmpl.generate().render()) def test_extract_i18n_msg_empty(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Show me <input type="text" name="num" /> entries per page. </p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('Show me [1:] entries per page.', messages[0][2]) def test_translate_i18n_msg_empty(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Show me <input type="text" name="num" /> entries per page. </p> </html>""") gettext = lambda s: u"[1:] Einträge pro Seite anzeigen." translator = Translator(gettext) translator.setup(tmpl) self.assertEqual(u"""<html> <p><input type="text" name="num"/> Einträge pro Seite anzeigen.</p> </html>""", tmpl.generate().render()) def test_extract_i18n_msg_multiple(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Please see <a href="help.html">Help</a> for <em>details</em>. </p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('Please see [1:Help] for [2:details].', messages[0][2]) def test_translate_i18n_msg_multiple(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Please see <a href="help.html">Help</a> for <em>details</em>. </p> </html>""") gettext = lambda s: u"Für [2:Details] siehe bitte [1:Hilfe]." translator = Translator(gettext) translator.setup(tmpl) self.assertEqual(u"""<html> <p>Für <em>Details</em> siehe bitte <a href="help.html">Hilfe</a>.</p> </html>""", tmpl.generate().render()) def test_extract_i18n_msg_multiple_empty(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Show me <input type="text" name="num" /> entries per page, starting at page <input type="text" name="num" />. </p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('Show me [1:] entries per page, starting at page [2:].', messages[0][2]) def test_translate_i18n_msg_multiple_empty(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Show me <input type="text" name="num" /> entries per page, starting at page <input type="text" name="num" />. </p> </html>""", encoding='utf-8') gettext = lambda s: u"[1:] Einträge pro Seite, beginnend auf Seite [2:]." translator = Translator(gettext) translator.setup(tmpl) self.assertEqual(u"""<html> <p><input type="text" name="num"/> Eintr\u00E4ge pro Seite, beginnend auf Seite <input type="text" name="num"/>.</p> </html>""".encode('utf-8'), tmpl.generate().render(encoding='utf-8')) def test_extract_i18n_msg_with_param(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="name"> Hello, ${user.name}! </p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('Hello, %(name)s!', messages[0][2]) def test_translate_i18n_msg_with_param(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="name"> Hello, ${user.name}! </p> </html>""") gettext = lambda s: u"Hallo, %(name)s!" translator = Translator(gettext) translator.setup(tmpl) self.assertEqual("""<html> <p>Hallo, Jim!</p> </html>""", tmpl.generate(user=dict(name='Jim')).render()) def test_translate_i18n_msg_with_param_reordered(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="name"> Hello, ${user.name}! </p> </html>""") gettext = lambda s: u"%(name)s, sei gegrüßt!" translator = Translator(gettext) translator.setup(tmpl) self.assertEqual(u"""<html> <p>Jim, sei gegrüßt!</p> </html>""", tmpl.generate(user=dict(name='Jim')).render()) def test_translate_i18n_msg_with_attribute_param(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Hello, <a href="#${anchor}">dude</a>! </p> </html>""") gettext = lambda s: u"Sei gegrüßt, [1:Alter]!" translator = Translator(gettext) translator.setup(tmpl) self.assertEqual(u"""<html> <p>Sei gegrüßt, <a href="#42">Alter</a>!</p> </html>""", tmpl.generate(anchor='42').render()) def test_extract_i18n_msg_with_two_params(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="name, time"> Posted by ${post.author} at ${entry.time.strftime('%H:%m')} </p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('Posted by %(name)s at %(time)s', messages[0][2]) def test_translate_i18n_msg_with_two_params(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="name, time"> Written by ${entry.author} at ${entry.time.strftime('%H:%M')} </p> </html>""") gettext = lambda s: u"%(name)s schrieb dies um %(time)s" translator = Translator(gettext) translator.setup(tmpl) entry = { 'author': 'Jim', 'time': datetime(2008, 4, 1, 14, 30) } self.assertEqual("""<html> <p>Jim schrieb dies um 14:30</p> </html>""", tmpl.generate(entry=entry).render()) def test_extract_i18n_msg_with_directive(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Show me <input type="text" name="num" py:attrs="{'value': x}" /> entries per page. </p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual('Show me [1:] entries per page.', messages[0][2]) def test_translate_i18n_msg_with_directive(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""> Show me <input type="text" name="num" py:attrs="{'value': 'x'}" /> entries per page. </p> </html>""") gettext = lambda s: u"[1:] Einträge pro Seite anzeigen." translator = Translator(gettext) translator.setup(tmpl) self.assertEqual(u"""<html> <p><input type="text" name="num" value="x"/> Einträge pro Seite anzeigen.</p> </html>""", tmpl.generate().render()) def test_extract_i18n_msg_with_comment(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:comment="As in foo bar" i18n:msg="">Foo</p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((3, None, 'Foo', ['As in foo bar']), messages[0]) tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" i18n:comment="As in foo bar">Foo</p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((3, None, 'Foo', ['As in foo bar']), messages[0]) def test_translate_i18n_msg_with_comment(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" i18n:comment="As in foo bar">Foo</p> </html>""") gettext = lambda s: u"Voh" translator = Translator(gettext) translator.setup(tmpl) self.assertEqual("""<html> <p>Voh</p> </html>""", tmpl.generate().render()) def test_extract_i18n_msg_with_attr(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" title="Foo bar">Foo</p> </html>""") translator = Translator() messages = list(translator.extract(tmpl.stream)) self.assertEqual(2, len(messages)) self.assertEqual((3, None, 'Foo bar', []), messages[0]) self.assertEqual((3, None, 'Foo', []), messages[1]) def test_translate_i18n_msg_with_attr(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" title="Foo bar">Foo</p> </html>""") gettext = lambda s: u"Voh" translator = Translator(DummyTranslations({ 'Foo': 'Voh', 'Foo bar': u'Voh bär' })) tmpl.filters.insert(0, translator) tmpl.add_directives(Translator.NAMESPACE, translator) self.assertEqual(u"""<html> <p title="Voh bär">Voh</p> </html>""", tmpl.generate().render()) def test_translate_i18n_msg_and_py_strip_directives(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" py:strip="">Foo</p> <p py:strip="" i18n:msg="">Foo</p> </html>""") translator = Translator(DummyTranslations({'Foo': 'Voh'})) translator.setup(tmpl) self.assertEqual("""<html> Voh Voh </html>""", tmpl.generate().render()) def test_i18n_msg_ticket_300_extract(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:msg params="date, author"> Changed ${ '10/12/2008' } ago by ${ 'me, the author' } </i18n:msg> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual( (3, None, 'Changed %(date)s ago by %(author)s', []), messages[0] ) def test_i18n_msg_ticket_300_translate(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:msg params="date, author"> Changed ${ date } ago by ${ author } </i18n:msg> </html>""") translations = DummyTranslations({ 'Changed %(date)s ago by %(author)s': u'Modificado à %(date)s por %(author)s' }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual(u"""<html> Modificado à um dia por Pedro </html>""".encode('utf-8'), tmpl.generate(date='um dia', author="Pedro").render(encoding='utf-8')) def test_i18n_msg_ticket_251_extract(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""><tt><b>Translation[&nbsp;0&nbsp;]</b>: <em>One coin</em></tt></p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual( (3, None, u'[1:[2:Translation\\[\xa00\xa0\\]]: [3:One coin]]', []), messages[0] ) def test_i18n_msg_ticket_251_translate(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg=""><tt><b>Translation[&nbsp;0&nbsp;]</b>: <em>One coin</em></tt></p> </html>""") translations = DummyTranslations({ u'[1:[2:Translation\\[\xa00\xa0\\]]: [3:One coin]]': u'[1:[2:Trandução\\[\xa00\xa0\\]]: [3:Uma moeda]]' }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual(u"""<html> <p><tt><b>Trandução[ 0 ]</b>: <em>Uma moeda</em></tt></p> </html>""".encode('utf-8'), tmpl.generate().render(encoding='utf-8')) def test_extract_i18n_msg_with_other_directives_nested(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" py:with="q = quote_plus(message[:80])">Before you do that, though, please first try <strong><a href="${trac.homepage}search?ticket=yes&amp;noquickjump=1&amp;q=$q">searching</a> for similar issues</strong>, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac, please try the <a href="${trac.homepage}wiki/MailingList">mailing list</a> instead of filing a ticket. </p> </html>""") translator = Translator() translator.setup(tmpl) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual( 'Before you do that, though, please first try\n ' '[1:[2:searching]\n for similar issues], as it is ' 'quite likely that this problem\n has been reported ' 'before. For questions about installation\n and ' 'configuration of Trac, please try the\n ' '[3:mailing list]\n instead of filing a ticket.', messages[0][2] ) def test_translate_i18n_msg_with_other_directives_nested(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="">Before you do that, though, please first try <strong><a href="${trac.homepage}search?ticket=yes&amp;noquickjump=1&amp;q=q">searching</a> for similar issues</strong>, as it is quite likely that this problem has been reported before. For questions about installation and configuration of Trac, please try the <a href="${trac.homepage}wiki/MailingList">mailing list</a> instead of filing a ticket. </p> </html>""") translations = DummyTranslations({ 'Before you do that, though, please first try\n ' '[1:[2:searching]\n for similar issues], as it is ' 'quite likely that this problem\n has been reported ' 'before. For questions about installation\n and ' 'configuration of Trac, please try the\n ' '[3:mailing list]\n instead of filing a ticket.': u'Antes de o fazer, porém,\n ' u'[1:por favor tente [2:procurar]\n por problemas semelhantes], uma vez que ' u'é muito provável que este problema\n já tenha sido reportado ' u'anteriormente. Para questões relativas à instalação\n e ' u'configuração do Trac, por favor tente a\n ' u'[3:mailing list]\n em vez de criar um assunto.' }) translator = Translator(translations) translator.setup(tmpl) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) ctx = Context() ctx.push({'trac': {'homepage': 'http://trac.edgewall.org/'}}) self.assertEqual(u"""<html> <p>Antes de o fazer, porém, <strong>por favor tente <a href="http://trac.edgewall.org/search?ticket=yes&amp;noquickjump=1&amp;q=q">procurar</a> por problemas semelhantes</strong>, uma vez que é muito provável que este problema já tenha sido reportado anteriormente. Para questões relativas à instalação e configuração do Trac, por favor tente a <a href="http://trac.edgewall.org/wiki/MailingList">mailing list</a> em vez de criar um assunto.</p> </html>""", tmpl.generate(ctx).render()) def test_i18n_msg_with_other_nested_directives_with_reordered_content(self): # See: http://genshi.edgewall.org/ticket/300#comment:10 tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p py:if="not editable" class="hint" i18n:msg=""> <strong>Note:</strong> This repository is defined in <code><a href="${ 'href.wiki(TracIni)' }">trac.ini</a></code> and cannot be edited on this page. </p> </html>""") translations = DummyTranslations({ '[1:Note:] This repository is defined in\n ' '[2:[3:trac.ini]]\n and cannot be edited on this page.': u'[1:Nota:] Este repositório está definido em \n ' u'[2:[3:trac.ini]]\n e não pode ser editado nesta página.', }) translator = Translator(translations) translator.setup(tmpl) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual( '[1:Note:] This repository is defined in\n ' '[2:[3:trac.ini]]\n and cannot be edited on this page.', messages[0][2] ) self.assertEqual(u"""<html> <p class="hint"><strong>Nota:</strong> Este repositório está definido em <code><a href="href.wiki(TracIni)">trac.ini</a></code> e não pode ser editado nesta página.</p> </html>""".encode('utf-8'), tmpl.generate(editable=False).render(encoding='utf-8')) def test_extract_i18n_msg_with_py_strip(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" py:strip=""> Please see <a href="help.html">Help</a> for details. </p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((3, None, 'Please see [1:Help] for details.', []), messages[0]) def test_extract_i18n_msg_with_py_strip_and_comment(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" py:strip="" i18n:comment="Foo"> Please see <a href="help.html">Help</a> for details. </p> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((3, None, 'Please see [1:Help] for details.', ['Foo']), messages[0]) def test_translate_i18n_msg_and_comment_with_py_strip_directives(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" i18n:comment="As in foo bar" py:strip="">Foo</p> <p py:strip="" i18n:msg="" i18n:comment="As in foo bar">Foo</p> </html>""") translator = Translator(DummyTranslations({'Foo': 'Voh'})) translator.setup(tmpl) self.assertEqual("""<html> Voh Voh </html>""", tmpl.generate().render()) def test_translate_i18n_msg_ticket_404(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="first,second"> $first <span>$second</span> KEPT <span>Inside a tag</span> tail </p></html>""") translator = Translator(DummyTranslations()) translator.setup(tmpl) self.assertEqual("""<html> <p>FIRST <span>SECOND</span> KEPT <span>Inside a tag</span> tail""" """</p></html>""", tmpl.generate(first="FIRST", second="SECOND").render()) class ChooseDirectiveTestCase(unittest.TestCase): def test_translate_i18n_choose_as_attribute(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:choose="one"> <p i18n:singular="">FooBar</p> <p i18n:plural="">FooBars</p> </div> <div i18n:choose="two"> <p i18n:singular="">FooBar</p> <p i18n:plural="">FooBars</p> </div> </html>""") translations = DummyTranslations() translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <div> <p>FooBar</p> </div> <div> <p>FooBars</p> </div> </html>""", tmpl.generate(one=1, two=2).render()) def test_translate_i18n_choose_as_directive(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:choose numeral="two"> <p i18n:singular="">FooBar</p> <p i18n:plural="">FooBars</p> </i18n:choose> <i18n:choose numeral="one"> <p i18n:singular="">FooBar</p> <p i18n:plural="">FooBars</p> </i18n:choose> </html>""") translations = DummyTranslations() translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <p>FooBars</p> <p>FooBar</p> </html>""", tmpl.generate(one=1, two=2).render()) def test_translate_i18n_choose_as_directive_singular_and_plural_with_strip(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:choose numeral="two"> <p i18n:singular="" py:strip="">FooBar Singular with Strip</p> <p i18n:plural="">FooBars Plural without Strip</p> </i18n:choose> <i18n:choose numeral="two"> <p i18n:singular="">FooBar singular without strip</p> <p i18n:plural="" py:strip="">FooBars plural with strip</p> </i18n:choose> <i18n:choose numeral="one"> <p i18n:singular="">FooBar singular without strip</p> <p i18n:plural="" py:strip="">FooBars plural with strip</p> </i18n:choose> <i18n:choose numeral="one"> <p i18n:singular="" py:strip="">FooBar singular with strip</p> <p i18n:plural="">FooBars plural without strip</p> </i18n:choose> </html>""") translations = DummyTranslations() translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <p>FooBars Plural without Strip</p> FooBars plural with strip <p>FooBar singular without strip</p> FooBar singular with strip </html>""", tmpl.generate(one=1, two=2).render()) def test_translate_i18n_choose_plural_singular_as_directive(self): # Ticket 371 tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:choose numeral="two"> <i18n:singular>FooBar</i18n:singular> <i18n:plural>FooBars</i18n:plural> </i18n:choose> <i18n:choose numeral="one"> <i18n:singular>FooBar</i18n:singular> <i18n:plural>FooBars</i18n:plural> </i18n:choose> </html>""") translations = DummyTranslations({ ('FooBar', 0): 'FuBar', ('FooBars', 1): 'FuBars', 'FooBar': 'FuBar', 'FooBars': 'FuBars', }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> FuBars FuBar </html>""", tmpl.generate(one=1, two=2).render()) def test_translate_i18n_choose_as_attribute_with_params(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:choose="two; fname, lname"> <p i18n:singular="">Foo $fname $lname</p> <p i18n:plural="">Foos $fname $lname</p> </div> </html>""") translations = DummyTranslations({ ('Foo %(fname)s %(lname)s', 0): 'Voh %(fname)s %(lname)s', ('Foo %(fname)s %(lname)s', 1): 'Vohs %(fname)s %(lname)s', 'Foo %(fname)s %(lname)s': 'Voh %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s': 'Vohs %(fname)s %(lname)s', }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <div> <p>Vohs John Doe</p> </div> </html>""", tmpl.generate(two=2, fname='John', lname='Doe').render()) def test_translate_i18n_choose_as_attribute_with_params_and_domain_as_param(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n" i18n:domain="foo"> <div i18n:choose="two; fname, lname"> <p i18n:singular="">Foo $fname $lname</p> <p i18n:plural="">Foos $fname $lname</p> </div> </html>""") translations = DummyTranslations() translations.add_domain('foo', { ('Foo %(fname)s %(lname)s', 0): 'Voh %(fname)s %(lname)s', ('Foo %(fname)s %(lname)s', 1): 'Vohs %(fname)s %(lname)s', 'Foo %(fname)s %(lname)s': 'Voh %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s': 'Vohs %(fname)s %(lname)s', }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <div> <p>Vohs John Doe</p> </div> </html>""", tmpl.generate(two=2, fname='John', lname='Doe').render()) def test_translate_i18n_choose_as_directive_with_params(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:choose numeral="two" params="fname, lname"> <p i18n:singular="">Foo ${fname} ${lname}</p> <p i18n:plural="">Foos ${fname} ${lname}</p> </i18n:choose> <i18n:choose numeral="one" params="fname, lname"> <p i18n:singular="">Foo ${fname} ${lname}</p> <p i18n:plural="">Foos ${fname} ${lname}</p> </i18n:choose> </html>""") translations = DummyTranslations({ ('Foo %(fname)s %(lname)s', 0): 'Voh %(fname)s %(lname)s', ('Foo %(fname)s %(lname)s', 1): 'Vohs %(fname)s %(lname)s', 'Foo %(fname)s %(lname)s': 'Voh %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s': 'Vohs %(fname)s %(lname)s', }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <p>Vohs John Doe</p> <p>Voh John Doe</p> </html>""", tmpl.generate(one=1, two=2, fname='John', lname='Doe').render()) def test_translate_i18n_choose_as_directive_with_params_and_domain_as_directive(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:domain name="foo"> <i18n:choose numeral="two" params="fname, lname"> <p i18n:singular="">Foo ${fname} ${lname}</p> <p i18n:plural="">Foos ${fname} ${lname}</p> </i18n:choose> </i18n:domain> <i18n:choose numeral="one" params="fname, lname"> <p i18n:singular="">Foo ${fname} ${lname}</p> <p i18n:plural="">Foos ${fname} ${lname}</p> </i18n:choose> </html>""") translations = DummyTranslations() translations.add_domain('foo', { ('Foo %(fname)s %(lname)s', 0): 'Voh %(fname)s %(lname)s', ('Foo %(fname)s %(lname)s', 1): 'Vohs %(fname)s %(lname)s', 'Foo %(fname)s %(lname)s': 'Voh %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s': 'Vohs %(fname)s %(lname)s', }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <p>Vohs John Doe</p> <p>Foo John Doe</p> </html>""", tmpl.generate(one=1, two=2, fname='John', lname='Doe').render()) def test_extract_i18n_choose_as_attribute(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:choose="one"> <p i18n:singular="">FooBar</p> <p i18n:plural="">FooBars</p> </div> <div i18n:choose="two"> <p i18n:singular="">FooBar</p> <p i18n:plural="">FooBars</p> </div> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(2, len(messages)) self.assertEqual((3, 'ngettext', ('FooBar', 'FooBars'), []), messages[0]) self.assertEqual((7, 'ngettext', ('FooBar', 'FooBars'), []), messages[1]) def test_extract_i18n_choose_as_directive(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:choose numeral="two"> <p i18n:singular="">FooBar</p> <p i18n:plural="">FooBars</p> </i18n:choose> <i18n:choose numeral="one"> <p i18n:singular="">FooBar</p> <p i18n:plural="">FooBars</p> </i18n:choose> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(2, len(messages)) self.assertEqual((3, 'ngettext', ('FooBar', 'FooBars'), []), messages[0]) self.assertEqual((7, 'ngettext', ('FooBar', 'FooBars'), []), messages[1]) def test_extract_i18n_choose_as_attribute_with_params(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:choose="two; fname, lname"> <p i18n:singular="">Foo $fname $lname</p> <p i18n:plural="">Foos $fname $lname</p> </div> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((3, 'ngettext', ('Foo %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s'), []), messages[0]) def test_extract_i18n_choose_as_attribute_with_params_and_domain_as_param(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n" i18n:domain="foo"> <div i18n:choose="two; fname, lname"> <p i18n:singular="">Foo $fname $lname</p> <p i18n:plural="">Foos $fname $lname</p> </div> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((4, 'ngettext', ('Foo %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s'), []), messages[0]) def test_extract_i18n_choose_as_directive_with_params(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:choose numeral="two" params="fname, lname"> <p i18n:singular="">Foo ${fname} ${lname}</p> <p i18n:plural="">Foos ${fname} ${lname}</p> </i18n:choose> <i18n:choose numeral="one" params="fname, lname"> <p i18n:singular="">Foo ${fname} ${lname}</p> <p i18n:plural="">Foos ${fname} ${lname}</p> </i18n:choose> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(2, len(messages)) self.assertEqual((3, 'ngettext', ('Foo %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s'), []), messages[0]) self.assertEqual((7, 'ngettext', ('Foo %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s'), []), messages[1]) def test_extract_i18n_choose_as_directive_with_params_and_domain_as_directive(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:domain name="foo"> <i18n:choose numeral="two" params="fname, lname"> <p i18n:singular="">Foo ${fname} ${lname}</p> <p i18n:plural="">Foos ${fname} ${lname}</p> </i18n:choose> </i18n:domain> <i18n:choose numeral="one" params="fname, lname"> <p i18n:singular="">Foo ${fname} ${lname}</p> <p i18n:plural="">Foos ${fname} ${lname}</p> </i18n:choose> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(2, len(messages)) self.assertEqual((4, 'ngettext', ('Foo %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s'), []), messages[0]) self.assertEqual((9, 'ngettext', ('Foo %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s'), []), messages[1]) def test_extract_i18n_choose_as_attribute_with_params_and_comment(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:choose="two; fname, lname" i18n:comment="As in Foo Bar"> <p i18n:singular="">Foo $fname $lname</p> <p i18n:plural="">Foos $fname $lname</p> </div> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((3, 'ngettext', ('Foo %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s'), ['As in Foo Bar']), messages[0]) def test_extract_i18n_choose_as_directive_with_params_and_comment(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:choose numeral="two" params="fname, lname" i18n:comment="As in Foo Bar"> <p i18n:singular="">Foo ${fname} ${lname}</p> <p i18n:plural="">Foos ${fname} ${lname}</p> </i18n:choose> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((3, 'ngettext', ('Foo %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s'), ['As in Foo Bar']), messages[0]) def test_extract_i18n_choose_with_attributes(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:choose="num; num" title="Things"> <i18n:singular> There is <a href="$link" title="View thing">${num} thing</a>. </i18n:singular> <i18n:plural> There are <a href="$link" title="View things">${num} things</a>. </i18n:plural> </p> </html>""") translator = Translator() translator.setup(tmpl) messages = list(translator.extract(tmpl.stream)) self.assertEqual(4, len(messages)) self.assertEqual((3, None, 'Things', []), messages[0]) self.assertEqual((5, None, 'View thing', []), messages[1]) self.assertEqual((8, None, 'View things', []), messages[2]) self.assertEqual( (3, 'ngettext', ('There is [1:%(num)s thing].', 'There are [1:%(num)s things].'), []), messages[3]) def test_translate_i18n_choose_with_attributes(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:choose="num; num" title="Things"> <i18n:singular> There is <a href="$link" title="View thing">${num} thing</a>. </i18n:singular> <i18n:plural> There are <a href="$link" title="View things">${num} things</a>. </i18n:plural> </p> </html>""") translations = DummyTranslations({ 'Things': 'Sachen', 'View thing': 'Sache betrachten', 'View things': 'Sachen betrachten', ('There is [1:%(num)s thing].', 0): 'Da ist [1:%(num)s Sache].', ('There is [1:%(num)s thing].', 1): 'Da sind [1:%(num)s Sachen].' }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual(u"""<html> <p title="Sachen"> Da ist <a href="/things" title="Sache betrachten">1 Sache</a>. </p> </html>""", tmpl.generate(link="/things", num=1).render(encoding=None)) self.assertEqual(u"""<html> <p title="Sachen"> Da sind <a href="/things" title="Sachen betrachten">3 Sachen</a>. </p> </html>""", tmpl.generate(link="/things", num=3).render(encoding=None)) def test_extract_i18n_choose_as_element_with_attributes(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:choose numeral="num" params="num"> <p i18n:singular="" title="Things"> There is <a href="$link" title="View thing">${num} thing</a>. </p> <p i18n:plural="" title="Things"> There are <a href="$link" title="View things">${num} things</a>. </p> </i18n:choose> </html>""") translator = Translator() translator.setup(tmpl) messages = list(translator.extract(tmpl.stream)) self.assertEqual(5, len(messages)) self.assertEqual((4, None, 'Things', []), messages[0]) self.assertEqual((5, None, 'View thing', []), messages[1]) self.assertEqual((7, None, 'Things', []), messages[2]) self.assertEqual((8, None, 'View things', []), messages[3]) self.assertEqual( (3, 'ngettext', ('There is [1:%(num)s thing].', 'There are [1:%(num)s things].'), []), messages[4]) def test_translate_i18n_choose_as_element_with_attributes(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:choose numeral="num" params="num"> <p i18n:singular="" title="Things"> There is <a href="$link" title="View thing">${num} thing</a>. </p> <p i18n:plural="" title="Things"> There are <a href="$link" title="View things">${num} things</a>. </p> </i18n:choose> </html>""") translations = DummyTranslations({ 'Things': 'Sachen', 'View thing': 'Sache betrachten', 'View things': 'Sachen betrachten', ('There is [1:%(num)s thing].', 0): 'Da ist [1:%(num)s Sache].', ('There is [1:%(num)s thing].', 1): 'Da sind [1:%(num)s Sachen].' }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual(u"""<html> <p title="Sachen">Da ist <a href="/things" title="Sache betrachten">1 Sache</a>.</p> </html>""", tmpl.generate(link="/things", num=1).render(encoding=None)) self.assertEqual(u"""<html> <p title="Sachen">Da sind <a href="/things" title="Sachen betrachten">3 Sachen</a>.</p> </html>""", tmpl.generate(link="/things", num=3).render(encoding=None)) def test_translate_i18n_choose_and_py_strip(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:choose="two; fname, lname"> <p i18n:singular="">Foo $fname $lname</p> <p i18n:plural="">Foos $fname $lname</p> </div> </html>""") translations = DummyTranslations({ ('Foo %(fname)s %(lname)s', 0): 'Voh %(fname)s %(lname)s', ('Foo %(fname)s %(lname)s', 1): 'Vohs %(fname)s %(lname)s', 'Foo %(fname)s %(lname)s': 'Voh %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s': 'Vohs %(fname)s %(lname)s', }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <div> <p>Vohs John Doe</p> </div> </html>""", tmpl.generate(two=2, fname='John', lname='Doe').render()) def test_translate_i18n_choose_and_domain_and_py_strip(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n" i18n:domain="foo"> <div i18n:choose="two; fname, lname"> <p i18n:singular="">Foo $fname $lname</p> <p i18n:plural="">Foos $fname $lname</p> </div> </html>""") translations = DummyTranslations() translations.add_domain('foo', { ('Foo %(fname)s %(lname)s', 0): 'Voh %(fname)s %(lname)s', ('Foo %(fname)s %(lname)s', 1): 'Vohs %(fname)s %(lname)s', 'Foo %(fname)s %(lname)s': 'Voh %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s': 'Vohs %(fname)s %(lname)s', }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <div> <p>Vohs John Doe</p> </div> </html>""", tmpl.generate(two=2, fname='John', lname='Doe').render()) def test_translate_i18n_choose_and_singular_with_py_strip(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:choose="two; fname, lname"> <p i18n:singular="" py:strip="">Foo $fname $lname</p> <p i18n:plural="">Foos $fname $lname</p> </div> <div i18n:choose="one; fname, lname"> <p i18n:singular="" py:strip="">Foo $fname $lname</p> <p i18n:plural="">Foos $fname $lname</p> </div> </html>""") translations = DummyTranslations({ ('Foo %(fname)s %(lname)s', 0): 'Voh %(fname)s %(lname)s', ('Foo %(fname)s %(lname)s', 1): 'Vohs %(fname)s %(lname)s', 'Foo %(fname)s %(lname)s': 'Voh %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s': 'Vohs %(fname)s %(lname)s', }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <div> <p>Vohs John Doe</p> </div> <div> Voh John Doe </div> </html>""", tmpl.generate( one=1, two=2, fname='John',lname='Doe').render()) def test_translate_i18n_choose_and_plural_with_py_strip(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:choose="two; fname, lname"> <p i18n:singular="" py:strip="">Foo $fname $lname</p> <p i18n:plural="">Foos $fname $lname</p> </div> </html>""") translations = DummyTranslations({ ('Foo %(fname)s %(lname)s', 0): 'Voh %(fname)s %(lname)s', ('Foo %(fname)s %(lname)s', 1): 'Vohs %(fname)s %(lname)s', 'Foo %(fname)s %(lname)s': 'Voh %(fname)s %(lname)s', 'Foos %(fname)s %(lname)s': 'Vohs %(fname)s %(lname)s', }) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <div> Voh John Doe </div> </html>""", tmpl.generate(two=1, fname='John', lname='Doe').render()) def test_extract_i18n_choose_as_attribute_and_py_strip(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:choose="one" py:strip=""> <p i18n:singular="" py:strip="">FooBar</p> <p i18n:plural="" py:strip="">FooBars</p> </div> </html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(1, len(messages)) self.assertEqual((3, 'ngettext', ('FooBar', 'FooBars'), []), messages[0]) class DomainDirectiveTestCase(unittest.TestCase): def test_translate_i18n_domain_with_msg_directives(self): #"""translate with i18n:domain and nested i18n:msg directives """ tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <div i18n:domain="foo"> <p i18n:msg="">FooBar</p> <p i18n:msg="">Bar</p> </div> </html>""") translations = DummyTranslations({'Bar': 'Voh'}) translations.add_domain('foo', {'FooBar': 'BarFoo', 'Bar': 'PT_Foo'}) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <div> <p>BarFoo</p> <p>PT_Foo</p> </div> </html>""", tmpl.generate().render()) def test_translate_i18n_domain_with_inline_directives(self): #"""translate with inlined i18n:domain and i18n:msg directives""" tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="" i18n:domain="foo">FooBar</p> </html>""") translations = DummyTranslations({'Bar': 'Voh'}) translations.add_domain('foo', {'FooBar': 'BarFoo'}) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <p>BarFoo</p> </html>""", tmpl.generate().render()) def test_translate_i18n_domain_without_msg_directives(self): #"""translate domain call without i18n:msg directives still uses current domain""" tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="">Bar</p> <div i18n:domain="foo"> <p i18n:msg="">FooBar</p> <p i18n:msg="">Bar</p> <p>Bar</p> </div> <p>Bar</p> </html>""") translations = DummyTranslations({'Bar': 'Voh'}) translations.add_domain('foo', {'FooBar': 'BarFoo', 'Bar': 'PT_Foo'}) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <p>Voh</p> <div> <p>BarFoo</p> <p>PT_Foo</p> <p>PT_Foo</p> </div> <p>Voh</p> </html>""", tmpl.generate().render()) def test_translate_i18n_domain_as_directive_not_attribute(self): #"""translate with domain as directive""" tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <i18n:domain name="foo"> <p i18n:msg="">FooBar</p> <p i18n:msg="">Bar</p> <p>Bar</p> </i18n:domain> <p>Bar</p> </html>""") translations = DummyTranslations({'Bar': 'Voh'}) translations.add_domain('foo', {'FooBar': 'BarFoo', 'Bar': 'PT_Foo'}) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <p>BarFoo</p> <p>PT_Foo</p> <p>PT_Foo</p> <p>Voh</p> </html>""", tmpl.generate().render()) def test_translate_i18n_domain_nested_directives(self): #"""translate with nested i18n:domain directives""" tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="">Bar</p> <div i18n:domain="foo"> <p i18n:msg="">FooBar</p> <p i18n:domain="bar" i18n:msg="">Bar</p> <p>Bar</p> </div> <p>Bar</p> </html>""") translations = DummyTranslations({'Bar': 'Voh'}) translations.add_domain('foo', {'FooBar': 'BarFoo', 'Bar': 'foo_Bar'}) translations.add_domain('bar', {'Bar': 'bar_Bar'}) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <p>Voh</p> <div> <p>BarFoo</p> <p>bar_Bar</p> <p>foo_Bar</p> </div> <p>Voh</p> </html>""", tmpl.generate().render()) def test_translate_i18n_domain_with_empty_nested_domain_directive(self): #"""translate with empty nested i18n:domain directive does not use dngettext""" tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n"> <p i18n:msg="">Bar</p> <div i18n:domain="foo"> <p i18n:msg="">FooBar</p> <p i18n:domain="" i18n:msg="">Bar</p> <p>Bar</p> </div> <p>Bar</p> </html>""") translations = DummyTranslations({'Bar': 'Voh'}) translations.add_domain('foo', {'FooBar': 'BarFoo', 'Bar': 'foo_Bar'}) translations.add_domain('bar', {'Bar': 'bar_Bar'}) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <p>Voh</p> <div> <p>BarFoo</p> <p>Voh</p> <p>foo_Bar</p> </div> <p>Voh</p> </html>""", tmpl.generate().render()) def test_translate_i18n_domain_with_inline_directive_on_START_NS(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n" i18n:domain="foo"> <p i18n:msg="">FooBar</p> </html>""") translations = DummyTranslations({'Bar': 'Voh'}) translations.add_domain('foo', {'FooBar': 'BarFoo'}) translator = Translator(translations) translator.setup(tmpl) self.assertEqual("""<html> <p>BarFoo</p> </html>""", tmpl.generate().render()) def test_translate_i18n_domain_with_inline_directive_on_START_NS_with_py_strip(self): tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n" i18n:domain="foo" py:strip=""> <p i18n:msg="">FooBar</p> </html>""") translations = DummyTranslations({'Bar': 'Voh'}) translations.add_domain('foo', {'FooBar': 'BarFoo'}) translator = Translator(translations) translator.setup(tmpl) self.assertEqual(""" <p>BarFoo</p> """, tmpl.generate().render()) def test_translate_i18n_domain_with_nested_includes(self): import os, shutil, tempfile from genshi.template.loader import TemplateLoader dirname = tempfile.mkdtemp(suffix='genshi_test') try: for idx in range(7): file1 = open(os.path.join(dirname, 'tmpl%d.html' % idx), 'w') try: file1.write("""<html xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n" py:strip=""> <div>Included tmpl$idx</div> <p i18n:msg="idx">Bar $idx</p> <p i18n:domain="bar">Bar</p> <p i18n:msg="idx" i18n:domain="">Bar $idx</p> <p i18n:domain="" i18n:msg="idx">Bar $idx</p> <py:if test="idx &lt; 6"> <xi:include href="tmpl${idx}.html" py:with="idx = idx+1"/> </py:if> </html>""") finally: file1.close() file2 = open(os.path.join(dirname, 'tmpl10.html'), 'w') try: file2.write("""<html xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n" i18n:domain="foo"> <xi:include href="tmpl${idx}.html" py:with="idx = idx+1"/> </html>""") finally: file2.close() def callback(template): translations = DummyTranslations({'Bar %(idx)s': 'Voh %(idx)s'}) translations.add_domain('foo', {'Bar %(idx)s': 'foo_Bar %(idx)s'}) translations.add_domain('bar', {'Bar': 'bar_Bar'}) translator = Translator(translations) translator.setup(template) loader = TemplateLoader([dirname], callback=callback) tmpl = loader.load('tmpl10.html') self.assertEqual("""<html> <div>Included tmpl0</div> <p>foo_Bar 0</p> <p>bar_Bar</p> <p>Voh 0</p> <p>Voh 0</p> <div>Included tmpl1</div> <p>foo_Bar 1</p> <p>bar_Bar</p> <p>Voh 1</p> <p>Voh 1</p> <div>Included tmpl2</div> <p>foo_Bar 2</p> <p>bar_Bar</p> <p>Voh 2</p> <p>Voh 2</p> <div>Included tmpl3</div> <p>foo_Bar 3</p> <p>bar_Bar</p> <p>Voh 3</p> <p>Voh 3</p> <div>Included tmpl4</div> <p>foo_Bar 4</p> <p>bar_Bar</p> <p>Voh 4</p> <p>Voh 4</p> <div>Included tmpl5</div> <p>foo_Bar 5</p> <p>bar_Bar</p> <p>Voh 5</p> <p>Voh 5</p> <div>Included tmpl6</div> <p>foo_Bar 6</p> <p>bar_Bar</p> <p>Voh 6</p> <p>Voh 6</p> </html>""", tmpl.generate(idx=-1).render()) finally: shutil.rmtree(dirname) def test_translate_i18n_domain_with_nested_includes_with_translatable_attrs(self): import os, shutil, tempfile from genshi.template.loader import TemplateLoader dirname = tempfile.mkdtemp(suffix='genshi_test') try: for idx in range(4): file1 = open(os.path.join(dirname, 'tmpl%d.html' % idx), 'w') try: file1.write("""<html xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n" py:strip=""> <div>Included tmpl$idx</div> <p title="${dg('foo', 'Bar %(idx)s') % dict(idx=idx)}" i18n:msg="idx">Bar $idx</p> <p title="Bar" i18n:domain="bar">Bar</p> <p title="Bar" i18n:msg="idx" i18n:domain="">Bar $idx</p> <p i18n:msg="idx" i18n:domain="" title="Bar">Bar $idx</p> <p i18n:domain="" i18n:msg="idx" title="Bar">Bar $idx</p> <py:if test="idx &lt; 3"> <xi:include href="tmpl${idx}.html" py:with="idx = idx+1"/> </py:if> </html>""") finally: file1.close() file2 = open(os.path.join(dirname, 'tmpl10.html'), 'w') try: file2.write("""<html xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:py="http://genshi.edgewall.org/" xmlns:i18n="http://genshi.edgewall.org/i18n" i18n:domain="foo"> <xi:include href="tmpl${idx}.html" py:with="idx = idx+1"/> </html>""") finally: file2.close() translations = DummyTranslations({'Bar %(idx)s': 'Voh %(idx)s', 'Bar': 'Voh'}) translations.add_domain('foo', {'Bar %(idx)s': 'foo_Bar %(idx)s'}) translations.add_domain('bar', {'Bar': 'bar_Bar'}) translator = Translator(translations) def callback(template): translator.setup(template) loader = TemplateLoader([dirname], callback=callback) tmpl = loader.load('tmpl10.html') if IS_PYTHON2: dgettext = translations.dugettext else: dgettext = translations.dgettext self.assertEqual("""<html> <div>Included tmpl0</div> <p title="foo_Bar 0">foo_Bar 0</p> <p title="bar_Bar">bar_Bar</p> <p title="Voh">Voh 0</p> <p title="Voh">Voh 0</p> <p title="Voh">Voh 0</p> <div>Included tmpl1</div> <p title="foo_Bar 1">foo_Bar 1</p> <p title="bar_Bar">bar_Bar</p> <p title="Voh">Voh 1</p> <p title="Voh">Voh 1</p> <p title="Voh">Voh 1</p> <div>Included tmpl2</div> <p title="foo_Bar 2">foo_Bar 2</p> <p title="bar_Bar">bar_Bar</p> <p title="Voh">Voh 2</p> <p title="Voh">Voh 2</p> <p title="Voh">Voh 2</p> <div>Included tmpl3</div> <p title="foo_Bar 3">foo_Bar 3</p> <p title="bar_Bar">bar_Bar</p> <p title="Voh">Voh 3</p> <p title="Voh">Voh 3</p> <p title="Voh">Voh 3</p> </html>""", tmpl.generate(idx=-1, dg=dgettext).render()) finally: shutil.rmtree(dirname) class ExtractTestCase(unittest.TestCase): def test_markup_template_extraction(self): buf = StringIO("""<html xmlns:py="http://genshi.edgewall.org/"> <head> <title>Example</title> </head> <body> <h1>Example</h1> <p>${_("Hello, %(name)s") % dict(name=username)}</p> <p>${ngettext("You have %d item", "You have %d items", num)}</p> </body> </html>""") results = list(extract(buf, ['_', 'ngettext'], [], {})) self.assertEqual([ (3, None, 'Example', []), (6, None, 'Example', []), (7, '_', 'Hello, %(name)s', []), (8, 'ngettext', ('You have %d item', 'You have %d items', None), []), ], results) def test_extraction_without_text(self): buf = StringIO("""<html xmlns:py="http://genshi.edgewall.org/"> <p title="Bar">Foo</p> ${ngettext("Singular", "Plural", num)} </html>""") results = list(extract(buf, ['_', 'ngettext'], [], { 'extract_text': 'no' })) self.assertEqual([ (3, 'ngettext', ('Singular', 'Plural', None), []), ], results) def test_text_template_extraction(self): buf = StringIO("""${_("Dear %(name)s") % {'name': name}}, ${ngettext("Your item:", "Your items", len(items))} #for item in items * $item #end All the best, Foobar""") results = list(extract(buf, ['_', 'ngettext'], [], { 'template_class': 'genshi.template:TextTemplate' })) self.assertEqual([ (1, '_', 'Dear %(name)s', []), (3, 'ngettext', ('Your item:', 'Your items', None), []), (7, None, 'All the best,\n Foobar', []) ], results) def test_extraction_with_keyword_arg(self): buf = StringIO("""<html xmlns:py="http://genshi.edgewall.org/"> ${gettext('Foobar', foo='bar')} </html>""") results = list(extract(buf, ['gettext'], [], {})) self.assertEqual([ (2, 'gettext', ('Foobar'), []), ], results) def test_extraction_with_nonstring_arg(self): buf = StringIO("""<html xmlns:py="http://genshi.edgewall.org/"> ${dgettext(curdomain, 'Foobar')} </html>""") results = list(extract(buf, ['dgettext'], [], {})) self.assertEqual([ (2, 'dgettext', (None, 'Foobar'), []), ], results) def test_extraction_inside_ignored_tags(self): buf = StringIO("""<html xmlns:py="http://genshi.edgewall.org/"> <script type="text/javascript"> $('#llist').tabs({ remote: true, spinner: "${_('Please wait...')}" }); </script> </html>""") results = list(extract(buf, ['_'], [], {})) self.assertEqual([ (5, '_', 'Please wait...', []), ], results) def test_extraction_inside_ignored_tags_with_directives(self): buf = StringIO("""<html xmlns:py="http://genshi.edgewall.org/"> <script type="text/javascript"> <py:if test="foobar"> alert("This shouldn't be extracted"); </py:if> </script> </html>""") self.assertEqual([], list(extract(buf, ['_'], [], {}))) def test_extract_py_def_directive_with_py_strip(self): # Failed extraction from Trac tmpl = MarkupTemplate("""<html xmlns:py="http://genshi.edgewall.org/" py:strip=""> <py:def function="diff_options_fields(diff)"> <label for="style">View differences</label> <select id="style" name="style"> <option selected="${diff.style == 'inline' or None}" value="inline">inline</option> <option selected="${diff.style == 'sidebyside' or None}" value="sidebyside">side by side</option> </select> <div class="field"> Show <input type="text" name="contextlines" id="contextlines" size="2" maxlength="3" value="${diff.options.contextlines &lt; 0 and 'all' or diff.options.contextlines}" /> <label for="contextlines">lines around each change</label> </div> <fieldset id="ignore" py:with="options = diff.options"> <legend>Ignore:</legend> <div class="field"> <input type="checkbox" id="ignoreblanklines" name="ignoreblanklines" checked="${options.ignoreblanklines or None}" /> <label for="ignoreblanklines">Blank lines</label> </div> <div class="field"> <input type="checkbox" id="ignorecase" name="ignorecase" checked="${options.ignorecase or None}" /> <label for="ignorecase">Case changes</label> </div> <div class="field"> <input type="checkbox" id="ignorewhitespace" name="ignorewhitespace" checked="${options.ignorewhitespace or None}" /> <label for="ignorewhitespace">White space changes</label> </div> </fieldset> <div class="buttons"> <input type="submit" name="update" value="${_('Update')}" /> </div> </py:def></html>""") translator = Translator() tmpl.add_directives(Translator.NAMESPACE, translator) messages = list(translator.extract(tmpl.stream)) self.assertEqual(10, len(messages)) self.assertEqual([ (3, None, 'View differences', []), (6, None, 'inline', []), (8, None, 'side by side', []), (10, None, 'Show', []), (13, None, 'lines around each change', []), (16, None, 'Ignore:', []), (20, None, 'Blank lines', []), (25, None, 'Case changes',[]), (30, None, 'White space changes', []), (34, '_', 'Update', [])], messages) def suite(): suite = unittest.TestSuite() suite.addTest(doctest.DocTestSuite(Translator.__module__)) suite.addTest(unittest.makeSuite(TranslatorTestCase, 'test')) suite.addTest(unittest.makeSuite(MsgDirectiveTestCase, 'test')) suite.addTest(unittest.makeSuite(ChooseDirectiveTestCase, 'test')) suite.addTest(unittest.makeSuite(DomainDirectiveTestCase, 'test')) suite.addTest(unittest.makeSuite(ExtractTestCase, 'test')) return suite if __name__ == '__main__': unittest.main(defaultTest='suite')
mitchellrj/genshi
genshi/filters/tests/i18n.py
Python
bsd-3-clause
89,114
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/chromeos/login/version_info_updater.h" #include <vector> #include "base/bind.h" #include "base/bind_helpers.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/sys_info.h" #include "base/task_runner_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/common/chrome_version_info.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "chromeos/settings/cros_settings_names.h" #include "content/public/browser/browser_thread.h" #include "ui/base/l10n/l10n_util.h" namespace chromeos { namespace { const char* const kReportingFlags[] = { chromeos::kReportDeviceVersionInfo, chromeos::kReportDeviceActivityTimes, chromeos::kReportDeviceBootMode, chromeos::kReportDeviceLocation, }; // Strings used to generate the serial number part of the version string. const char kSerialNumberPrefix[] = "SN:"; } // namespace /////////////////////////////////////////////////////////////////////////////// // VersionInfoUpdater public: VersionInfoUpdater::VersionInfoUpdater(Delegate* delegate) : cros_settings_(chromeos::CrosSettings::Get()), delegate_(delegate), weak_pointer_factory_(this) { } VersionInfoUpdater::~VersionInfoUpdater() { policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process->platform_part()->browser_policy_connector_chromeos(); policy::DeviceCloudPolicyManagerChromeOS* policy_manager = connector->GetDeviceCloudPolicyManager(); if (policy_manager) policy_manager->core()->store()->RemoveObserver(this); } void VersionInfoUpdater::StartUpdate(bool is_official_build) { if (base::SysInfo::IsRunningOnChromeOS()) { base::PostTaskAndReplyWithResult( content::BrowserThread::GetBlockingPool(), FROM_HERE, base::Bind(&version_loader::GetVersion, is_official_build ? version_loader::VERSION_SHORT_WITH_DATE : version_loader::VERSION_FULL), base::Bind(&VersionInfoUpdater::OnVersion, weak_pointer_factory_.GetWeakPtr())); } else { UpdateVersionLabel(); } policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process->platform_part()->browser_policy_connector_chromeos(); policy::DeviceCloudPolicyManagerChromeOS* policy_manager = connector->GetDeviceCloudPolicyManager(); if (policy_manager) { policy_manager->core()->store()->AddObserver(this); // Ensure that we have up-to-date enterprise info in case enterprise policy // is already fetched and has finished initialization. UpdateEnterpriseInfo(); } // Watch for changes to the reporting flags. base::Closure callback = base::Bind(&VersionInfoUpdater::UpdateEnterpriseInfo, base::Unretained(this)); for (unsigned int i = 0; i < arraysize(kReportingFlags); ++i) { subscriptions_.push_back( cros_settings_->AddSettingsObserver(kReportingFlags[i], callback).release()); } } void VersionInfoUpdater::UpdateVersionLabel() { if (version_text_.empty()) return; UpdateSerialNumberInfo(); chrome::VersionInfo version_info; std::string label_text = l10n_util::GetStringFUTF8( IDS_LOGIN_VERSION_LABEL_FORMAT, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), base::UTF8ToUTF16(version_info.Version()), base::UTF8ToUTF16(version_text_), base::UTF8ToUTF16(serial_number_text_)); // Workaround over incorrect width calculation in old fonts. // TODO(glotov): remove the following line when new fonts are used. label_text += ' '; if (delegate_) delegate_->OnOSVersionLabelTextUpdated(label_text); } void VersionInfoUpdater::UpdateEnterpriseInfo() { policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process->platform_part()->browser_policy_connector_chromeos(); SetEnterpriseInfo(connector->GetEnterpriseDomain()); } void VersionInfoUpdater::SetEnterpriseInfo(const std::string& domain_name) { // Update the notification about device status reporting. if (delegate_ && !domain_name.empty()) { std::string enterprise_info; enterprise_info = l10n_util::GetStringFUTF8( IDS_DEVICE_OWNED_BY_NOTICE, base::UTF8ToUTF16(domain_name)); delegate_->OnEnterpriseInfoUpdated(enterprise_info); } } void VersionInfoUpdater::UpdateSerialNumberInfo() { std::string sn = policy::DeviceCloudPolicyManagerChromeOS::GetMachineID(); if (!sn.empty()) { serial_number_text_ = kSerialNumberPrefix; serial_number_text_.append(sn); } } void VersionInfoUpdater::OnVersion(const std::string& version) { version_text_ = version; UpdateVersionLabel(); } void VersionInfoUpdater::OnStoreLoaded(policy::CloudPolicyStore* store) { UpdateEnterpriseInfo(); } void VersionInfoUpdater::OnStoreError(policy::CloudPolicyStore* store) { UpdateEnterpriseInfo(); } } // namespace chromeos
mohamed--abdel-maksoud/chromium.src
chrome/browser/chromeos/login/version_info_updater.cc
C++
bsd-3-clause
5,419
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("SimpleNavigation")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SimpleNavigation")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: ComVisible(false)]
Windows-Readiness/WinDevWorkshop
RU/!RU 01. Introduction/01. Lab B. Solution/Exercise 2/SimpleNavigation/Properties/AssemblyInfo.cs
C#
mit
1,052
// // Copyright 2012 Christian Henning // // Distributed under the Boost Software License, Version 1.0 // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt // #ifndef BOOST_GIL_EXTENSION_IO_PNG_DETAIL_WRITER_BACKEND_HPP #define BOOST_GIL_EXTENSION_IO_PNG_DETAIL_WRITER_BACKEND_HPP #include <boost/gil/extension/io/png/tags.hpp> #include <boost/gil/extension/io/png/detail/base.hpp> #include <boost/gil/extension/io/png/detail/supported_types.hpp> #include <boost/gil/io/base.hpp> #include <boost/gil/io/typedefs.hpp> namespace boost { namespace gil { #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #pragma warning(push) #pragma warning(disable:4512) //assignment operator could not be generated #pragma warning(disable:4611) //interaction between '_setjmp' and C++ object destruction is non-portable #endif /// /// PNG Writer Backend /// template< typename Device > struct writer_backend< Device , png_tag > : public detail::png_struct_info_wrapper { private: using this_t = writer_backend<Device, png_tag>; public: using format_tag_t = png_tag; /// /// Constructor /// writer_backend( const Device& io_dev , const image_write_info< png_tag >& info ) : png_struct_info_wrapper( false ) , _io_dev( io_dev ) , _info( info ) { // Create and initialize the png_struct with the desired error handler // functions. If you want to use the default stderr and longjump method, // you can supply NULL for the last three parameters. We also check that // the library version is compatible with the one used at compile time, // in case we are using dynamically linked libraries. REQUIRED. get()->_struct = png_create_write_struct( PNG_LIBPNG_VER_STRING , nullptr // user_error_ptr , nullptr // user_error_fn , nullptr // user_warning_fn ); io_error_if( get_struct() == nullptr , "png_writer: fail to call png_create_write_struct()" ); // Allocate/initialize the image information data. REQUIRED get()->_info = png_create_info_struct( get_struct() ); if( get_info() == nullptr ) { png_destroy_write_struct( &get()->_struct , nullptr ); io_error( "png_writer: fail to call png_create_info_struct()" ); } // Set error handling. REQUIRED if you aren't supplying your own // error handling functions in the png_create_write_struct() call. if( setjmp( png_jmpbuf( get_struct() ))) { //free all of the memory associated with the png_ptr and info_ptr png_destroy_write_struct( &get()->_struct , &get()->_info ); io_error( "png_writer: fail to call setjmp()" ); } init_io( get_struct() ); } protected: template< typename View > void write_header( const View& view ) { using png_rw_info_t = detail::png_write_support < typename channel_type<typename get_pixel_type<View>::type>::type, typename color_space_type<View>::type >; // Set the image information here. Width and height are up to 2^31, // bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on // the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY, // PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB, // or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or // PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST // currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED png_set_IHDR( get_struct() , get_info() , static_cast< png_image_width::type >( view.width() ) , static_cast< png_image_height::type >( view.height() ) , static_cast< png_bitdepth::type >( png_rw_info_t::_bit_depth ) , static_cast< png_color_type::type >( png_rw_info_t::_color_type ) , _info._interlace_method , _info._compression_type , _info._filter_method ); #ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED if( _info._valid_cie_colors ) { png_set_cHRM( get_struct() , get_info() , _info._white_x , _info._white_y , _info._red_x , _info._red_y , _info._green_x , _info._green_y , _info._blue_x , _info._blue_y ); } if( _info._valid_file_gamma ) { png_set_gAMA( get_struct() , get_info() , _info._file_gamma ); } #else if( _info._valid_cie_colors ) { png_set_cHRM_fixed( get_struct() , get_info() , _info._white_x , _info._white_y , _info._red_x , _info._red_y , _info._green_x , _info._green_y , _info._blue_x , _info._blue_y ); } if( _info._valid_file_gamma ) { png_set_gAMA_fixed( get_struct() , get_info() , _info._file_gamma ); } #endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED if( _info._valid_icc_profile ) { #if PNG_LIBPNG_VER_MINOR >= 5 png_set_iCCP( get_struct() , get_info() , const_cast< png_charp >( _info._icc_name.c_str() ) , _info._iccp_compression_type , reinterpret_cast< png_const_bytep >( & (_info._profile.front ()) ) , _info._profile_length ); #else png_set_iCCP( get_struct() , get_info() , const_cast< png_charp >( _info._icc_name.c_str() ) , _info._iccp_compression_type , const_cast< png_charp >( & (_info._profile.front()) ) , _info._profile_length ); #endif } if( _info._valid_intent ) { png_set_sRGB( get_struct() , get_info() , _info._intent ); } if( _info._valid_palette ) { png_set_PLTE( get_struct() , get_info() , const_cast< png_colorp >( &_info._palette.front() ) , _info._num_palette ); } if( _info._valid_background ) { png_set_bKGD( get_struct() , get_info() , const_cast< png_color_16p >( &_info._background ) ); } if( _info._valid_histogram ) { png_set_hIST( get_struct() , get_info() , const_cast< png_uint_16p >( &_info._histogram.front() ) ); } if( _info._valid_offset ) { png_set_oFFs( get_struct() , get_info() , _info._offset_x , _info._offset_y , _info._off_unit_type ); } if( _info._valid_pixel_calibration ) { std::vector< const char* > params( _info._num_params ); for( std::size_t i = 0; i < params.size(); ++i ) { params[i] = _info._params[ i ].c_str(); } png_set_pCAL( get_struct() , get_info() , const_cast< png_charp >( _info._purpose.c_str() ) , _info._X0 , _info._X1 , _info._cal_type , _info._num_params , const_cast< png_charp >( _info._units.c_str() ) , const_cast< png_charpp >( &params.front() ) ); } if( _info._valid_resolution ) { png_set_pHYs( get_struct() , get_info() , _info._res_x , _info._res_y , _info._phy_unit_type ); } if( _info._valid_significant_bits ) { png_set_sBIT( get_struct() , get_info() , const_cast< png_color_8p >( &_info._sig_bits ) ); } #ifndef BOOST_GIL_IO_PNG_1_4_OR_LOWER #ifdef BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED if( _info._valid_scale_factors ) { png_set_sCAL( get_struct() , get_info() , this->_info._scale_unit , this->_info._scale_width , this->_info._scale_height ); } #else #ifdef BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED if( _info._valid_scale_factors ) { png_set_sCAL_fixed( get_struct() , get_info() , this->_info._scale_unit , this->_info._scale_width , this->_info._scale_height ); } #else if( _info._valid_scale_factors ) { png_set_sCAL_s( get_struct() , get_info() , this->_info._scale_unit , const_cast< png_charp >( this->_info._scale_width.c_str() ) , const_cast< png_charp >( this->_info._scale_height.c_str() ) ); } #endif // BOOST_GIL_IO_PNG_FIXED_POINT_SUPPORTED #endif // BOOST_GIL_IO_PNG_FLOATING_POINT_SUPPORTED #endif // BOOST_GIL_IO_PNG_1_4_OR_LOWER if( _info._valid_text ) { std::vector< png_text > texts( _info._num_text ); for( std::size_t i = 0; i < texts.size(); ++i ) { png_text pt; pt.compression = _info._text[i]._compression; pt.key = const_cast< png_charp >( this->_info._text[i]._key.c_str() ); pt.text = const_cast< png_charp >( this->_info._text[i]._text.c_str() ); pt.text_length = _info._text[i]._text.length(); texts[i] = pt; } png_set_text( get_struct() , get_info() , &texts.front() , _info._num_text ); } if( _info._valid_modification_time ) { png_set_tIME( get_struct() , get_info() , const_cast< png_timep >( &_info._mod_time ) ); } if( _info._valid_transparency_factors ) { int sample_max = ( 1u << _info._bit_depth ); /* libpng doesn't reject a tRNS chunk with out-of-range samples */ if( !( ( _info._color_type == PNG_COLOR_TYPE_GRAY && (int) _info._trans_values[0].gray > sample_max ) || ( _info._color_type == PNG_COLOR_TYPE_RGB &&( (int) _info._trans_values[0].red > sample_max || (int) _info._trans_values[0].green > sample_max || (int) _info._trans_values[0].blue > sample_max ) ) ) ) { //@todo Fix that once reading transparency values works /* png_set_tRNS( get_struct() , get_info() , trans , num_trans , trans_values ); */ } } // Compression Levels - valid values are [0,9] png_set_compression_level( get_struct() , _info._compression_level ); png_set_compression_mem_level( get_struct() , _info._compression_mem_level ); png_set_compression_strategy( get_struct() , _info._compression_strategy ); png_set_compression_window_bits( get_struct() , _info._compression_window_bits ); png_set_compression_method( get_struct() , _info._compression_method ); png_set_compression_buffer_size( get_struct() , _info._compression_buffer_size ); #ifdef BOOST_GIL_IO_PNG_DITHERING_SUPPORTED // Dithering if( _info._set_dithering ) { png_set_dither( get_struct() , &_info._dithering_palette.front() , _info._dithering_num_palette , _info._dithering_maximum_colors , &_info._dithering_histogram.front() , _info._full_dither ); } #endif // BOOST_GIL_IO_PNG_DITHERING_SUPPORTED // Filter if( _info._set_filter ) { png_set_filter( get_struct() , 0 , _info._filter ); } // Invert Mono if( _info._invert_mono ) { png_set_invert_mono( get_struct() ); } // True Bits if( _info._set_true_bits ) { png_set_sBIT( get_struct() , get_info() , &_info._true_bits.front() ); } // sRGB Intent if( _info._set_srgb_intent ) { png_set_sRGB( get_struct() , get_info() , _info._srgb_intent ); } // Strip Alpha if( _info._strip_alpha ) { png_set_strip_alpha( get_struct() ); } // Swap Alpha if( _info._swap_alpha ) { png_set_swap_alpha( get_struct() ); } png_write_info( get_struct() , get_info() ); } protected: static void write_data( png_structp png_ptr , png_bytep data , png_size_t length ) { static_cast< Device* >( png_get_io_ptr( png_ptr ))->write( data , length ); } static void flush( png_structp png_ptr ) { static_cast< Device* >(png_get_io_ptr(png_ptr) )->flush(); } private: void init_io( png_structp png_ptr ) { png_set_write_fn( png_ptr , static_cast< void* > ( &this->_io_dev ) , static_cast< png_rw_ptr > ( &this_t::write_data ) , static_cast< png_flush_ptr >( &this_t::flush ) ); } public: Device _io_dev; image_write_info< png_tag > _info; }; #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) #pragma warning(pop) #endif } // namespace gil } // namespace boost #endif
kumakoko/KumaGL
third_lib/boost/1.75.0/boost/gil/extension/io/png/detail/writer_backend.hpp
C++
mit
16,790
# encoding: utf-8 require 'spec_helper' def encode_base64(str) Mail::Encodings::Base64.encode(str) end def check_decoded(actual, expected) if RUBY_VERSION >= '1.9' expect(actual.encoding).to eq Encoding::BINARY expect(actual).to eq expected.force_encoding(Encoding::BINARY) else expect(actual).to eq expected end end describe "Attachments" do before(:each) do @mail = Mail.new @test_png = File.open(fixture('attachments', 'test.png'), 'rb', &:read) end describe "from direct content" do it "should work" do @mail.attachments['test.png'] = @test_png expect(@mail.attachments['test.png'].filename).to eq 'test.png' check_decoded(@mail.attachments[0].decoded, @test_png) end it "should work out magically the mime_type" do @mail.attachments['test.png'] = @test_png expect(@mail.attachments[0].mime_type).to eq 'image/png' end it "should assign the filename" do @mail.attachments['test.png'] = @test_png expect(@mail.attachments[0].filename).to eq 'test.png' end it "should assign mime-encoded multibyte filename" do @mail.attachments['てすと.txt'] = File.open(fixture('attachments', 'てすと.txt'), 'rb', &:read) expect(@mail.attachments).not_to be_blank expect(Mail::Encodings.decode_encode(@mail.attachments[0].filename, :decode)).to eq 'てすと.txt' end end describe "from a supplied Hash" do it "should work" do @mail.attachments['test.png'] = { :content => @test_png } expect(@mail.attachments[0].filename).to eq 'test.png' check_decoded(@mail.attachments[0].decoded, @test_png) end it "should allow you to override the content_type" do @mail.attachments['test.png'] = { :content => @test_png, :content_type => "application/x-gzip" } expect(@mail.attachments[0].content_type).to eq 'application/x-gzip' end it "should allow you to override the mime_type" do @mail.attachments['test.png'] = { :content => @test_png, :mime_type => "application/x-gzip" } expect(@mail.attachments[0].mime_type).to eq 'application/x-gzip' end it "should allow you to override the mime_type" do @mail.attachments['invoice.jpg'] = { :data => "you smiling", :mime_type => "image/x-jpg", :transfer_encoding => "base64" } expect(@mail.attachments[0].mime_type).to eq 'image/x-jpg' end end describe "decoding and encoding" do it "should set its content_transfer_encoding" do @mail.attachments['test.png'] = { :content => @test_png } @mail.ready_to_send! expect(@mail.attachments[0].content_transfer_encoding).to eq 'base64' end it "should encode its body to base64" do @mail.attachments['test.png'] = { :content => @test_png } @mail.ready_to_send! expect(@mail.attachments[0].encoded).to include(encode_base64(@test_png)) end it "should allow you to pass in an encoded attachment with an encoding" do encoded_data = encode_base64(@test_png) @mail.attachments['test.png'] = { :content => encoded_data, :encoding => 'base64' } check_decoded(@mail.attachments[0].decoded, @test_png) end it "should allow you set a mime type and encoding without overriding the encoding" do encoded = encode_base64('<foo/>') @mail.attachments['test.png'] = { :mime_type => 'text/xml', :content => encoded, :encoding => 'base64' } expect(@mail.attachments[0].content_transfer_encoding).to eq 'base64' check_decoded(@mail.attachments[0].decoded, '<foo/>') end it "should not allow you to pass in an encoded attachment with an unknown encoding" do base64_encoded_data = encode_base64(@test_png) expect {@mail.attachments['test.png'] = { :content => base64_encoded_data, :encoding => 'weird_encoding' }}.to raise_error end it "should be able to call read on the attachment to return the decoded data" do @mail.attachments['test.png'] = { :content => @test_png } if RUBY_VERSION >= '1.9' expected = @mail.attachments[0].read.force_encoding(@test_png.encoding) else expected = @mail.attachments[0].read end expect(expected).to eq @test_png end it "should only add one newline between attachment body and boundary" do contents = "I have\ntwo lines with trailing newlines\n\n" @mail.attachments['text.txt'] = { :content => contents} encoded = @mail.encoded regex = /\r\n#{Regexp.escape(contents.gsub(/\n/, "\r\n"))}\r\n--#{@mail.boundary}--\r\n\Z/ expect(encoded).to match regex end end describe "multiple attachments" do it "should allow you to pass in more than one attachment" do mail = Mail.new mail.attachments['test.pdf'] = File.open(fixture('attachments', 'test.pdf'), 'rb', &:read) mail.attachments['test.gif'] = File.open(fixture('attachments', 'test.gif'), 'rb', &:read) mail.attachments['test.jpg'] = File.open(fixture('attachments', 'test.jpg'), 'rb', &:read) mail.attachments['test.zip'] = File.open(fixture('attachments', 'test.zip'), 'rb', &:read) expect(mail.attachments[0].filename).to eq 'test.pdf' expect(mail.attachments[1].filename).to eq 'test.gif' expect(mail.attachments[2].filename).to eq 'test.jpg' expect(mail.attachments[3].filename).to eq 'test.zip' end end describe "inline attachments" do it "should set the content_disposition to inline or attachment as appropriate" do mail = Mail.new mail.attachments['test.pdf'] = File.open(fixture('attachments', 'test.pdf'), 'rb', &:read) expect(mail.attachments['test.pdf'].content_disposition).to eq 'attachment; filename=test.pdf' mail.attachments.inline['test.png'] = File.open(fixture('attachments', 'test.png'), 'rb', &:read) expect(mail.attachments.inline['test.png'].content_disposition).to eq 'inline; filename=test.png' end it "should return a cid" do mail = Mail.new mail.attachments.inline['test.png'] = @test_png expect(mail.attachments['test.png'].url).to eq "cid:#{mail.attachments['test.png'].cid}" end it "should respond true to inline?" do mail = Mail.new mail.attachments.inline['test.png'] = @test_png expect(mail.attachments['test.png']).to be_inline end end describe "getting the content ID from an attachment" do before(:each) do @mail = Mail.new @mail.attachments['test.gif'] = File.open(fixture('attachments', 'test.gif'), 'rb', &:read) @cid = @mail.attachments['test.gif'].content_id end it "should return a content-id for the attachment on creation if passed inline => true" do expect(@cid).not_to be_nil end it "should return a valid content-id on inline attachments" do expect(Mail::ContentIdField.new(@cid).errors).to be_empty end it "should provide a URL escaped content_id (without brackets) for use inside an email" do @inline = @mail.attachments['test.gif'].cid uri_parser = URI.const_defined?(:Parser) ? URI::Parser.new : URI expect(@inline).to eq uri_parser.escape(@cid.gsub(/^</, '').gsub(/>$/, '')) end end describe "setting the content type correctly" do it "should set the content type to multipart/mixed if none given and you add an attachment" do mail = Mail.new mail.attachments['test.pdf'] = File.open(fixture('attachments', 'test.pdf'), 'rb', &:read) mail.encoded expect(mail.mime_type).to eq 'multipart/mixed' end it "allows you to set the attachment before the content type" do mail = Mail.new mail.attachments["test.png"] = File.open(fixture('attachments', 'test.png'), 'rb', &:read) mail.body = "Lots of HTML" mail.mime_version = '1.0' mail.content_type = 'text/html; charset=UTF-8' end end describe "should handle filenames with non-7bit characters correctly" do it "should not raise an exception with a filename that contains a non-7bit-character" do filename = "f\u00f6\u00f6.b\u00e4r" if RUBY_VERSION >= '1.9' expect(filename.encoding).to eq Encoding::UTF_8 end mail = Mail.new expect { mail.attachments[filename] = File.open(fixture('attachments', 'test.pdf'), 'rb', &:read) }.not_to raise_error end end end describe "reading emails with attachments" do describe "test emails" do it "should find the attachment using content location" do mail = Mail.read(fixture(File.join('emails', 'attachment_emails', 'attachment_content_location.eml'))) expect(mail.attachments.length).to eq 1 end it "should find an attachment defined with 'name' and Content-Disposition: attachment" do mail = Mail.read(fixture(File.join('emails', 'attachment_emails', 'attachment_content_disposition.eml'))) expect(mail.attachments.length).to eq 1 end it "should use the content-type filename or name over the content-disposition filename" do mail = Mail.read(fixture(File.join('emails', 'attachment_emails', 'attachment_content_disposition.eml'))) expect(mail.attachments[0].filename).to eq 'hello.rb' end it "should decode an attachment" do mail = Mail.read(fixture(File.join('emails', 'attachment_emails', 'attachment_pdf.eml'))) expect(mail.attachments[0].decoded.length).to eq 1026 end it "should find an attachment that has an encoded name value" do mail = Mail.read(fixture(File.join('emails', 'attachment_emails', 'attachment_with_encoded_name.eml'))) expect(mail.attachments.length).to eq 1 result = mail.attachments[0].filename if RUBY_VERSION >= '1.9' expected = "01 Quien Te Dij\212at. Pitbull.mp3".force_encoding(result.encoding) else expected = "01 Quien Te Dij\212at. Pitbull.mp3" end expect(result).to eq expected end it "should find an attachment that has a name not surrounded by quotes" do mail = Mail.read(fixture(File.join('emails', 'attachment_emails', "attachment_with_unquoted_name.eml"))) expect(mail.attachments.length).to eq 1 expect(mail.attachments.first.filename).to eq "This is a test.txt" end it "should find attachments inside parts with content-type message/rfc822" do mail = Mail.read(fixture(File.join("emails", "attachment_emails", "attachment_message_rfc822.eml"))) expect(mail.attachments.length).to eq 1 expect(mail.attachments[0].decoded.length).to eq 1026 end it "attach filename decoding (issue 83)" do data = <<-limitMAIL Subject: aaa From: aaa@aaa.com To: bbb@aaa.com Content-Type: multipart/mixed; boundary=0016e64c0af257c3a7048b69e1ac --0016e64c0af257c3a7048b69e1ac Content-Type: multipart/alternative; boundary=0016e64c0af257c3a1048b69e1aa --0016e64c0af257c3a1048b69e1aa Content-Type: text/plain; charset=ISO-8859-1 aaa --0016e64c0af257c3a1048b69e1aa Content-Type: text/html; charset=ISO-8859-1 aaa<br> --0016e64c0af257c3a1048b69e1aa-- --0016e64c0af257c3a7048b69e1ac Content-Type: text/plain; charset=US-ASCII; name="=?utf-8?b?Rm90bzAwMDkuanBn?=" Content-Disposition: attachment; filename="=?utf-8?b?Rm90bzAwMDkuanBn?=" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gbneqxxy0 YWFhCg== --0016e64c0af257c3a7048b69e1ac-- limitMAIL mail = Mail.new(data) #~ puts Mail::Encodings.decode_encode(mail.attachments[0].filename, :decode) expect(mail.attachments[0].filename).to eq "Foto0009.jpg" end end end describe "attachment order" do it "should be preserved instead when content type exists" do mail = Mail.new do to "aaaa@aaaa.aaa" from "aaaa2@aaaa.aaa" subject "a subject" date Time.now text_part do content_type 'text/plain; charset=UTF-8' body "a \nsimplebody\n" end end mail.attachments['test.zip'] = File.open(fixture('attachments', 'test.zip'), 'rb', &:read) mail.attachments['test.pdf'] = File.open(fixture('attachments', 'test.pdf'), 'rb', &:read) mail.attachments['test.gif'] = File.open(fixture('attachments', 'test.gif'), 'rb', &:read) mail.attachments['test.jpg'] = File.open(fixture('attachments', 'test.jpg'), 'rb', &:read) expect(mail.attachments[0].filename).to eq 'test.zip' expect(mail.attachments[1].filename).to eq 'test.pdf' expect(mail.attachments[2].filename).to eq 'test.gif' expect(mail.attachments[3].filename).to eq 'test.jpg' mail2 = Mail.new(mail.encoded) expect(mail2.attachments[0].filename).to eq 'test.zip' expect(mail2.attachments[1].filename).to eq 'test.pdf' expect(mail2.attachments[2].filename).to eq 'test.gif' expect(mail2.attachments[3].filename).to eq 'test.jpg' end end
kjg/mail
spec/mail/attachments_list_spec.rb
Ruby
mit
13,083
/* * Copyright 2016 Rethink Robotics * * Copyright 2016 Chris Smith * * 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. */ 'use strict'; let fs = require('fs'); let path = require('path'); let cmakePath = process.env.CMAKE_PREFIX_PATH; let cmakePaths = cmakePath.split(':'); let jsMsgPath = 'share/gennodejs/ros'; let packagePaths = {}; module.exports = function (messagePackage) { if (packagePaths.hasOwnProperty(messagePackage)) { return packagePaths[messagePackage]; } // else const found = cmakePaths.some((cmakePath) => { let path_ = path.join(cmakePath, jsMsgPath, messagePackage, '_index.js'); if (fs.existsSync(path_)) { packagePaths[messagePackage] = require(path_); return true; } return false; }); if (found) { return packagePaths[messagePackage]; } // else throw new Error('Unable to find message package ' + messagePackage + ' from CMAKE_PREFIX_PATH'); };
tarquasso/softroboticfish6
fish/pi/ros/catkin_ws/src/rosserial/devel/share/gennodejs/ros/rosserial_msgs/find.js
JavaScript
mit
1,464
/** * @fileoverview Rule to flag wrapping non-iife in parens * @author Gyandeep Singh */ "use strict"; //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ /** * Checks whether or not a given node is an `Identifier` node which was named a given name. * @param {ASTNode} node - A node to check. * @param {string} name - An expected name of the node. * @returns {boolean} `true` if the node is an `Identifier` node which was named as expected. */ function isIdentifier(node, name) { return node.type === "Identifier" && node.name === name; } /** * Checks whether or not a given node is an argument of a specified method call. * @param {ASTNode} node - A node to check. * @param {number} index - An expected index of the node in arguments. * @param {string} object - An expected name of the object of the method. * @param {string} property - An expected name of the method. * @returns {boolean} `true` if the node is an argument of the specified method call. */ function isArgumentOfMethodCall(node, index, object, property) { const parent = node.parent; return ( parent.type === "CallExpression" && parent.callee.type === "MemberExpression" && parent.callee.computed === false && isIdentifier(parent.callee.object, object) && isIdentifier(parent.callee.property, property) && parent.arguments[index] === node ); } /** * Checks whether or not a given node is a property descriptor. * @param {ASTNode} node - A node to check. * @returns {boolean} `true` if the node is a property descriptor. */ function isPropertyDescriptor(node) { // Object.defineProperty(obj, "foo", {set: ...}) if (isArgumentOfMethodCall(node, 2, "Object", "defineProperty") || isArgumentOfMethodCall(node, 2, "Reflect", "defineProperty") ) { return true; } /* * Object.defineProperties(obj, {foo: {set: ...}}) * Object.create(proto, {foo: {set: ...}}) */ const grandparent = node.parent.parent; return grandparent.type === "ObjectExpression" && ( isArgumentOfMethodCall(grandparent, 1, "Object", "create") || isArgumentOfMethodCall(grandparent, 1, "Object", "defineProperties") ); } //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = { meta: { docs: { description: "enforce getter and setter pairs in objects", category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/accessor-pairs" }, schema: [{ type: "object", properties: { getWithoutSet: { type: "boolean" }, setWithoutGet: { type: "boolean" } }, additionalProperties: false }], messages: { getter: "Getter is not present.", setter: "Setter is not present." } }, create(context) { const config = context.options[0] || {}; const checkGetWithoutSet = config.getWithoutSet === true; const checkSetWithoutGet = config.setWithoutGet !== false; /** * Checks a object expression to see if it has setter and getter both present or none. * @param {ASTNode} node The node to check. * @returns {void} * @private */ function checkLonelySetGet(node) { let isSetPresent = false; let isGetPresent = false; const isDescriptor = isPropertyDescriptor(node); for (let i = 0, end = node.properties.length; i < end; i++) { const property = node.properties[i]; let propToCheck = ""; if (property.kind === "init") { if (isDescriptor && !property.computed) { propToCheck = property.key.name; } } else { propToCheck = property.kind; } switch (propToCheck) { case "set": isSetPresent = true; break; case "get": isGetPresent = true; break; default: // Do nothing } if (isSetPresent && isGetPresent) { break; } } if (checkSetWithoutGet && isSetPresent && !isGetPresent) { context.report({ node, messageId: "getter" }); } else if (checkGetWithoutSet && isGetPresent && !isSetPresent) { context.report({ node, messageId: "setter" }); } } return { ObjectExpression(node) { if (checkSetWithoutGet || checkGetWithoutSet) { checkLonelySetGet(node); } } }; } };
EdwardStudy/myghostblog
versions/1.25.7/node_modules/eslint/lib/rules/accessor-pairs.js
JavaScript
mit
5,257
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This is the version of the Android-specific Chromium linker that uses // the crazy linker to load libraries. // This source code *cannot* depend on anything from base/ or the C++ // STL, to keep the final library small, and avoid ugly dependency issues. #include "legacy_linker_jni.h" #include <crazy_linker.h> #include <fcntl.h> #include <jni.h> #include <limits.h> #include <stddef.h> #include <stdlib.h> #include <unistd.h> #include "linker_jni.h" namespace chromium_android_linker { namespace { // Retrieve the SDK build version and pass it into the crazy linker. This // needs to be done early in initialization, before any other crazy linker // code is run. // |env| is the current JNI environment handle. // On success, return true. bool InitSDKVersionInfo(JNIEnv* env) { jint value = 0; if (!InitStaticInt(env, "android/os/Build$VERSION", "SDK_INT", &value)) return false; crazy_set_sdk_build_version(static_cast<int>(value)); LOG_INFO("Set SDK build version to %d", static_cast<int>(value)); return true; } // The linker uses a single crazy_context_t object created on demand. // There is no need to protect this against concurrent access, locking // is already handled on the Java side. crazy_context_t* GetCrazyContext() { static crazy_context_t* s_crazy_context = nullptr; if (!s_crazy_context) { // Create new context. s_crazy_context = crazy_context_create(); // Ensure libraries located in the same directory as the linker // can be loaded before system ones. crazy_context_add_search_path_for_address( s_crazy_context, reinterpret_cast<void*>(&s_crazy_context)); } return s_crazy_context; } // A scoped crazy_library_t that automatically closes the handle // on scope exit, unless Release() has been called. class ScopedLibrary { public: ScopedLibrary() : lib_(nullptr) {} ~ScopedLibrary() { if (lib_) crazy_library_close_with_context(lib_, GetCrazyContext()); } crazy_library_t* Get() { return lib_; } crazy_library_t** GetPtr() { return &lib_; } crazy_library_t* Release() { crazy_library_t* ret = lib_; lib_ = nullptr; return ret; } private: crazy_library_t* lib_; }; template <class LibraryOpener> bool GenericLoadLibrary(JNIEnv* env, const char* library_name, jlong load_address, jobject lib_info_obj, const LibraryOpener& opener) { LOG_INFO("Called for %s, at address 0x%llx", library_name, load_address); crazy_context_t* context = GetCrazyContext(); if (!IsValidAddress(load_address)) { LOG_ERROR("Invalid address 0x%llx", load_address); return false; } // Set the desired load address (0 means randomize it). crazy_context_set_load_address(context, static_cast<size_t>(load_address)); ScopedLibrary library; if (!opener.Open(library.GetPtr(), library_name, context)) { return false; } crazy_library_info_t info; if (!crazy_library_get_info(library.Get(), context, &info)) { LOG_ERROR("Could not get library information for %s: %s", library_name, crazy_context_get_error(context)); return false; } // Release library object to keep it alive after the function returns. library.Release(); s_lib_info_fields.SetLoadInfo(env, lib_info_obj, info.load_address, info.load_size); LOG_INFO("Success loading library %s", library_name); return true; } // Used for opening the library in a regular file. class FileLibraryOpener { public: bool Open(crazy_library_t** library, const char* library_name, crazy_context_t* context) const; }; bool FileLibraryOpener::Open(crazy_library_t** library, const char* library_name, crazy_context_t* context) const { if (!crazy_library_open(library, library_name, context)) { LOG_ERROR("Could not open %s: %s", library_name, crazy_context_get_error(context)); return false; } return true; } // Used for opening the library in a zip file. class ZipLibraryOpener { public: explicit ZipLibraryOpener(const char* zip_file) : zip_file_(zip_file) { } bool Open(crazy_library_t** library, const char* library_name, crazy_context_t* context) const; private: const char* zip_file_; }; bool ZipLibraryOpener::Open(crazy_library_t** library, const char* library_name, crazy_context_t* context) const { if (!crazy_library_open_in_zip_file(library, zip_file_, library_name, context)) { LOG_ERROR("Could not open %s in zip file %s: %s", library_name, zip_file_, crazy_context_get_error(context)); return false; } return true; } // Load a library with the chromium linker. This will also call its // JNI_OnLoad() method, which shall register its methods. Note that // lazy native method resolution will _not_ work after this, because // Dalvik uses the system's dlsym() which won't see the new library, // so explicit registration is mandatory. // // |env| is the current JNI environment handle. // |clazz| is the static class handle for org.chromium.base.Linker, // and is ignored here. // |library_name| is the library name (e.g. libfoo.so). // |load_address| is an explicit load address. // |library_info| is a LibInfo handle used to communicate information // with the Java side. // Return true on success. jboolean LoadLibrary(JNIEnv* env, jclass clazz, jstring library_name, jlong load_address, jobject lib_info_obj) { String lib_name(env, library_name); FileLibraryOpener opener; return GenericLoadLibrary(env, lib_name.c_str(), static_cast<size_t>(load_address), lib_info_obj, opener); } // Load a library from a zipfile with the chromium linker. The // library in the zipfile must be uncompressed and page aligned. // The basename of the library is given. The library is expected // to be lib/<abi_tag>/crazy.<basename>. The <abi_tag> used will be the // same as the abi for this linker. The "crazy." prefix is included // so that the Android Package Manager doesn't extract the library into // /data/app-lib. // // Loading the library will also call its JNI_OnLoad() method, which // shall register its methods. Note that lazy native method resolution // will _not_ work after this, because Dalvik uses the system's dlsym() // which won't see the new library, so explicit registration is mandatory. // // |env| is the current JNI environment handle. // |clazz| is the static class handle for org.chromium.base.Linker, // and is ignored here. // |zipfile_name| is the filename of the zipfile containing the library. // |library_name| is the library base name (e.g. libfoo.so). // |load_address| is an explicit load address. // |library_info| is a LibInfo handle used to communicate information // with the Java side. // Returns true on success. jboolean LoadLibraryInZipFile(JNIEnv* env, jclass clazz, jstring zipfile_name, jstring library_name, jlong load_address, jobject lib_info_obj) { String zipfile_name_str(env, zipfile_name); String lib_name(env, library_name); ZipLibraryOpener opener(zipfile_name_str.c_str()); return GenericLoadLibrary(env, lib_name.c_str(), static_cast<size_t>(load_address), lib_info_obj, opener); } // Class holding the Java class and method ID for the Java side Linker // postCallbackOnMainThread method. struct JavaCallbackBindings_class { jclass clazz; jmethodID method_id; // Initialize an instance. bool Init(JNIEnv* env, jclass linker_class) { clazz = reinterpret_cast<jclass>(env->NewGlobalRef(linker_class)); return InitStaticMethodId(env, linker_class, "postCallbackOnMainThread", "(J)V", &method_id); } }; static JavaCallbackBindings_class s_java_callback_bindings; // Designated receiver function for callbacks from Java. Its name is known // to the Java side. // |env| is the current JNI environment handle and is ignored here. // |clazz| is the static class handle for org.chromium.base.Linker, // and is ignored here. // |arg| is a pointer to an allocated crazy_callback_t, deleted after use. void RunCallbackOnUiThread(JNIEnv* env, jclass clazz, jlong arg) { crazy_callback_t* callback = reinterpret_cast<crazy_callback_t*>(arg); LOG_INFO("Called back from java with handler %p, opaque %p", callback->handler, callback->opaque); crazy_callback_run(callback); delete callback; } // Request a callback from Java. The supplied crazy_callback_t is valid only // for the duration of this call, so we copy it to a newly allocated // crazy_callback_t and then call the Java side's postCallbackOnMainThread. // This will call back to to our RunCallbackOnUiThread some time // later on the UI thread. // |callback_request| is a crazy_callback_t. // |poster_opaque| is unused. // Returns true if the callback request succeeds. static bool PostForLaterExecution(crazy_callback_t* callback_request, void* poster_opaque UNUSED) { crazy_context_t* context = GetCrazyContext(); JavaVM* vm; int minimum_jni_version; crazy_context_get_java_vm(context, reinterpret_cast<void**>(&vm), &minimum_jni_version); // Do not reuse JNIEnv from JNI_OnLoad, but retrieve our own. JNIEnv* env; if (JNI_OK != vm->GetEnv( reinterpret_cast<void**>(&env), minimum_jni_version)) { LOG_ERROR("Could not create JNIEnv"); return false; } // Copy the callback; the one passed as an argument may be temporary. crazy_callback_t* callback = new crazy_callback_t(); *callback = *callback_request; LOG_INFO("Calling back to java with handler %p, opaque %p", callback->handler, callback->opaque); jlong arg = static_cast<jlong>(reinterpret_cast<uintptr_t>(callback)); env->CallStaticVoidMethod( s_java_callback_bindings.clazz, s_java_callback_bindings.method_id, arg); // Back out and return false if we encounter a JNI exception. if (env->ExceptionCheck() == JNI_TRUE) { env->ExceptionDescribe(); env->ExceptionClear(); delete callback; return false; } return true; } jboolean CreateSharedRelro(JNIEnv* env, jclass clazz, jstring library_name, jlong load_address, jobject lib_info_obj) { String lib_name(env, library_name); LOG_INFO("Called for %s", lib_name.c_str()); if (!IsValidAddress(load_address)) { LOG_ERROR("Invalid address 0x%llx", load_address); return false; } ScopedLibrary library; if (!crazy_library_find_by_name(lib_name.c_str(), library.GetPtr())) { LOG_ERROR("Could not find %s", lib_name.c_str()); return false; } crazy_context_t* context = GetCrazyContext(); size_t relro_start = 0; size_t relro_size = 0; int relro_fd = -1; if (!crazy_library_create_shared_relro(library.Get(), context, static_cast<size_t>(load_address), &relro_start, &relro_size, &relro_fd)) { LOG_ERROR("Could not create shared RELRO sharing for %s: %s\n", lib_name.c_str(), crazy_context_get_error(context)); return false; } s_lib_info_fields.SetRelroInfo(env, lib_info_obj, relro_start, relro_size, relro_fd); return true; } jboolean UseSharedRelro(JNIEnv* env, jclass clazz, jstring library_name, jobject lib_info_obj) { String lib_name(env, library_name); LOG_INFO("Called for %s, lib_info_ref=%p", lib_name.c_str(), lib_info_obj); ScopedLibrary library; if (!crazy_library_find_by_name(lib_name.c_str(), library.GetPtr())) { LOG_ERROR("Could not find %s", lib_name.c_str()); return false; } crazy_context_t* context = GetCrazyContext(); size_t relro_start = 0; size_t relro_size = 0; int relro_fd = -1; s_lib_info_fields.GetRelroInfo(env, lib_info_obj, &relro_start, &relro_size, &relro_fd); LOG_INFO("library=%s relro start=%p size=%p fd=%d", lib_name.c_str(), (void*)relro_start, (void*)relro_size, relro_fd); if (!crazy_library_use_shared_relro(library.Get(), context, relro_start, relro_size, relro_fd)) { LOG_ERROR("Could not use shared RELRO for %s: %s", lib_name.c_str(), crazy_context_get_error(context)); return false; } LOG_INFO("Library %s using shared RELRO section!", lib_name.c_str()); return true; } const JNINativeMethod kNativeMethods[] = { {"nativeLoadLibrary", "(" "Ljava/lang/String;" "J" "Lorg/chromium/base/library_loader/Linker$LibInfo;" ")" "Z", reinterpret_cast<void*>(&LoadLibrary)}, {"nativeLoadLibraryInZipFile", "(" "Ljava/lang/String;" "Ljava/lang/String;" "J" "Lorg/chromium/base/library_loader/Linker$LibInfo;" ")" "Z", reinterpret_cast<void*>(&LoadLibraryInZipFile)}, {"nativeRunCallbackOnUiThread", "(" "J" ")" "V", reinterpret_cast<void*>(&RunCallbackOnUiThread)}, {"nativeCreateSharedRelro", "(" "Ljava/lang/String;" "J" "Lorg/chromium/base/library_loader/Linker$LibInfo;" ")" "Z", reinterpret_cast<void*>(&CreateSharedRelro)}, {"nativeUseSharedRelro", "(" "Ljava/lang/String;" "Lorg/chromium/base/library_loader/Linker$LibInfo;" ")" "Z", reinterpret_cast<void*>(&UseSharedRelro)}, }; const size_t kNumNativeMethods = sizeof(kNativeMethods) / sizeof(kNativeMethods[0]); } // namespace bool LegacyLinkerJNIInit(JavaVM* vm, JNIEnv* env) { LOG_INFO("Entering"); // Initialize SDK version info. LOG_INFO("Retrieving SDK version info"); if (!InitSDKVersionInfo(env)) return false; // Register native methods. jclass linker_class; if (!InitClassReference(env, "org/chromium/base/library_loader/LegacyLinker", &linker_class)) return false; LOG_INFO("Registering native methods"); if (env->RegisterNatives(linker_class, kNativeMethods, kNumNativeMethods) < 0) return false; // Resolve and save the Java side Linker callback class and method. LOG_INFO("Resolving callback bindings"); if (!s_java_callback_bindings.Init(env, linker_class)) { return false; } // Save JavaVM* handle into context. crazy_context_t* context = GetCrazyContext(); crazy_context_set_java_vm(context, vm, JNI_VERSION_1_4); // Register the function that the crazy linker can call to post code // for later execution. crazy_context_set_callback_poster(context, &PostForLaterExecution, nullptr); return true; } } // namespace chromium_android_linker
junhuac/MQUIC
src/base/android/linker/legacy_linker_jni.cc
C++
mit
16,030
// 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 Microsoft.Win32.SafeHandles; using System.Diagnostics; using System.Threading; namespace System.Net.Sockets { // This class implements a safe socket handle. // It uses an inner and outer SafeHandle to do so. The inner // SafeHandle holds the actual socket, but only ever has one // reference to it. The outer SafeHandle guards the inner // SafeHandle with real ref counting. When the outer SafeHandle // is cleaned up, it releases the inner SafeHandle - since // its ref is the only ref to the inner SafeHandle, it deterministically // gets closed at that point - no races with concurrent IO calls. // This allows Close() on the outer SafeHandle to deterministically // close the inner SafeHandle, in turn allowing the inner SafeHandle // to block the user thread in case a graceful close has been // requested. (It's not legal to block any other thread - such closes // are always abortive.) internal partial class SafeCloseSocket : #if DEBUG DebugSafeHandleMinusOneIsInvalid #else SafeHandleMinusOneIsInvalid #endif { protected SafeCloseSocket() : base(true) { } private InnerSafeCloseSocket _innerSocket; private volatile bool _released; #if DEBUG private InnerSafeCloseSocket _innerSocketCopy; #endif public override bool IsInvalid { get { return IsClosed || base.IsInvalid; } } #if DEBUG public void AddRef() { try { // The inner socket can be closed by CloseAsIs and when SafeHandle runs ReleaseHandle. InnerSafeCloseSocket innerSocket = Volatile.Read(ref _innerSocket); if (innerSocket != null) { innerSocket.AddRef(); } } catch (Exception e) { Debug.Fail("SafeCloseSocket.AddRef after inner socket disposed." + e); } } public void Release() { try { // The inner socket can be closed by CloseAsIs and when SafeHandle runs ReleaseHandle. InnerSafeCloseSocket innerSocket = Volatile.Read(ref _innerSocket); if (innerSocket != null) { innerSocket.Release(); } } catch (Exception e) { Debug.Fail("SafeCloseSocket.Release after inner socket disposed." + e); } } #endif private void SetInnerSocket(InnerSafeCloseSocket socket) { _innerSocket = socket; SetHandle(socket.DangerousGetHandle()); #if DEBUG _innerSocketCopy = socket; #endif } private static SafeCloseSocket CreateSocket(InnerSafeCloseSocket socket) { SafeCloseSocket ret = new SafeCloseSocket(); CreateSocket(socket, ret); if (NetEventSource.IsEnabled) NetEventSource.Info(null, ret); return ret; } protected static void CreateSocket(InnerSafeCloseSocket socket, SafeCloseSocket target) { if (socket != null && socket.IsInvalid) { target.SetHandleAsInvalid(); return; } bool b = false; try { socket.DangerousAddRef(ref b); } catch { if (b) { socket.DangerousRelease(); b = false; } } finally { if (b) { target.SetInnerSocket(socket); socket.Dispose(); } else { target.SetHandleAsInvalid(); } } } protected override bool ReleaseHandle() { if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"_innerSocket={_innerSocket}"); _released = true; InnerSafeCloseSocket innerSocket = _innerSocket == null ? null : Interlocked.Exchange<InnerSafeCloseSocket>(ref _innerSocket, null); #if DEBUG // On AppDomain unload we may still have pending Overlapped operations. // ThreadPoolBoundHandle should handle this scenario by canceling them. innerSocket?.LogRemainingOperations(); #endif InnerReleaseHandle(); innerSocket?.DangerousRelease(); return true; } internal void CloseAsIs() { if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"_innerSocket={_innerSocket}"); #if DEBUG // If this throws it could be very bad. try { #endif InnerSafeCloseSocket innerSocket = _innerSocket == null ? null : Interlocked.Exchange<InnerSafeCloseSocket>(ref _innerSocket, null); Dispose(); if (innerSocket != null) { // Wait until it's safe. SpinWait sw = new SpinWait(); while (!_released) { sw.SpinOnce(); } // Now free it with blocking. innerSocket.BlockingRelease(); } InnerReleaseHandle(); #if DEBUG } catch (Exception exception) when (!ExceptionCheck.IsFatal(exception)) { NetEventSource.Fail(this, $"handle:{handle}, error:{exception}"); throw; } #endif } internal sealed partial class InnerSafeCloseSocket : SafeHandleMinusOneIsInvalid { private InnerSafeCloseSocket() : base(true) { } private bool _blockable; public override bool IsInvalid { get { return IsClosed || base.IsInvalid; } } // This method is implicitly reliable and called from a CER. protected override bool ReleaseHandle() { bool ret = false; #if DEBUG try { #endif if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"handle:{handle}"); SocketError errorCode = InnerReleaseHandle(); return ret = errorCode == SocketError.Success; #if DEBUG } catch (Exception exception) { if (!ExceptionCheck.IsFatal(exception)) { NetEventSource.Fail(this, $"handle:{handle}, error:{exception}"); } ret = true; // Avoid a second assert. throw; } finally { _closeSocketThread = Environment.CurrentManagedThreadId; _closeSocketTick = Environment.TickCount; if (!ret) { NetEventSource.Fail(this, $"ReleaseHandle failed. handle:{handle}"); } } #endif } #if DEBUG private IntPtr _closeSocketHandle; private SocketError _closeSocketResult = unchecked((SocketError)0xdeadbeef); private SocketError _closeSocketLinger = unchecked((SocketError)0xdeadbeef); private int _closeSocketThread; private int _closeSocketTick; private int _refCount = 0; public void AddRef() { Interlocked.Increment(ref _refCount); } public void Release() { Interlocked.MemoryBarrier(); Debug.Assert(_refCount > 0, "InnerSafeCloseSocket: Release() called more times than AddRef"); Interlocked.Decrement(ref _refCount); } public void LogRemainingOperations() { Interlocked.MemoryBarrier(); if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"Releasing with pending operations: {_refCount}"); } #endif // Use this method to close the socket handle using the linger options specified on the socket. // Guaranteed to only be called once, under a CER, and not if regular DangerousRelease is called. internal void BlockingRelease() { #if DEBUG // Expected to have outstanding operations such as Accept. LogRemainingOperations(); #endif _blockable = true; DangerousRelease(); } } } }
nbarbettini/corefx
src/Common/src/System/Net/SafeCloseSocket.cs
C#
mit
9,141
// Package api provides a generic, low-level WebDriver API client for Go. // All methods map directly to endpoints of the WebDriver Wire Protocol: // https://code.google.com/p/selenium/wiki/JsonWireProtocol // // This package was previously internal to the agouti package. It currently // does not have a fixed API, but this will change in the near future // (with the addition of adequate documentation). package api
johanbrandhorst/protobuf
vendor/github.com/sclevine/agouti/api/api.go
GO
mit
418
module ActiveRecord module AttributeMethods module Serialization extend ActiveSupport::Concern module ClassMethods # If you have an attribute that needs to be saved to the database as an # object, and retrieved as the same object, then specify the name of that # attribute using this method and it will be handled automatically. The # serialization is done through YAML. If +class_name+ is specified, the # serialized object must be of that class on assignment and retrieval. # Otherwise SerializationTypeMismatch will be raised. # # Empty objects as <tt>{}</tt>, in the case of +Hash+, or <tt>[]</tt>, in the case of # +Array+, will always be persisted as null. # # Keep in mind that database adapters handle certain serialization tasks # for you. For instance: +json+ and +jsonb+ types in PostgreSQL will be # converted between JSON object/array syntax and Ruby +Hash+ or +Array+ # objects transparently. There is no need to use #serialize in this # case. # # For more complex cases, such as conversion to or from your application # domain objects, consider using the ActiveRecord::Attributes API. # # ==== Parameters # # * +attr_name+ - The field name that should be serialized. # * +class_name_or_coder+ - Optional, a coder object, which responds to `.load` / `.dump` # or a class name that the object type should be equal to. # # ==== Example # # # Serialize a preferences attribute. # class User < ActiveRecord::Base # serialize :preferences # end # # # Serialize preferences using JSON as coder. # class User < ActiveRecord::Base # serialize :preferences, JSON # end # # # Serialize preferences as Hash using YAML coder. # class User < ActiveRecord::Base # serialize :preferences, Hash # end def serialize(attr_name, class_name_or_coder = Object) # When ::JSON is used, force it to go through the Active Support JSON encoder # to ensure special objects (e.g. Active Record models) are dumped correctly # using the #as_json hook. coder = if class_name_or_coder == ::JSON Coders::JSON elsif [:load, :dump].all? { |x| class_name_or_coder.respond_to?(x) } class_name_or_coder else Coders::YAMLColumn.new(class_name_or_coder) end decorate_attribute_type(attr_name, :serialize) do |type| Type::Serialized.new(type, coder) end end end end end end
afuerstenau/daily-notes
vendor/cache/ruby/2.5.0/gems/activerecord-5.0.6/lib/active_record/attribute_methods/serialization.rb
Ruby
mit
2,841
//------------------------------------------------------------------------------ // <copyright file="PerformanceCountersElement.cs" company="Microsoft Corporation"> // Copyright (c) Microsoft Corporation. All rights reserved. // </copyright> //------------------------------------------------------------------------------ namespace System.Net.Configuration { using System; using System.Configuration; using System.Reflection; using System.Security.Permissions; public sealed class PerformanceCountersElement : ConfigurationElement { public PerformanceCountersElement() { this.properties.Add(this.enabled); } [ConfigurationProperty(ConfigurationStrings.Enabled, DefaultValue=false)] public bool Enabled { get { return (bool) this[this.enabled]; } set { this[this.enabled] = value; } } protected override ConfigurationPropertyCollection Properties { get { return this.properties; } } ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection(); readonly ConfigurationProperty enabled = new ConfigurationProperty(ConfigurationStrings.Enabled, typeof(bool), false, ConfigurationPropertyOptions.None); } }
sekcheong/referencesource
System/net/System/Net/Configuration/PerformanceCountersElement.cs
C#
mit
1,389
//used for the media picker dialog angular.module("umbraco") .controller("Umbraco.Dialogs.MediaPickerController", function ($scope, mediaResource, umbRequestHelper, entityResource, $log, mediaHelper, eventsService, treeService, $cookies, $element, $timeout, notificationsService) { var dialogOptions = $scope.dialogOptions; $scope.onlyImages = dialogOptions.onlyImages; $scope.showDetails = dialogOptions.showDetails; $scope.multiPicker = (dialogOptions.multiPicker && dialogOptions.multiPicker !== "0") ? true : false; $scope.startNodeId = dialogOptions.startNodeId ? dialogOptions.startNodeId : -1; $scope.cropSize = dialogOptions.cropSize; $scope.filesUploading = 0; $scope.dropping = false; $scope.progress = 0; $scope.options = { url: umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostAddFile") + "?origin=blueimp", autoUpload: true, dropZone: $element.find(".umb-dialogs-mediapicker.browser"), fileInput: $element.find("input.uploader"), formData: { currentFolder: -1 } }; //preload selected item $scope.target = undefined; if(dialogOptions.currentTarget){ $scope.target = dialogOptions.currentTarget; } $scope.submitFolder = function(e) { if (e.keyCode === 13) { e.preventDefault(); $scope.showFolderInput = false; mediaResource .addFolder($scope.newFolderName, $scope.options.formData.currentFolder) .then(function(data) { //we've added a new folder so lets clear the tree cache for that specific item treeService.clearCache({ cacheKey: "__media", //this is the main media tree cache key childrenOf: data.parentId //clear the children of the parent }); $scope.gotoFolder(data); }); } }; $scope.gotoFolder = function(folder) { if(!folder){ folder = {id: -1, name: "Media", icon: "icon-folder"}; } if (folder.id > 0) { entityResource.getAncestors(folder.id, "media") .then(function(anc) { // anc.splice(0,1); $scope.path = _.filter(anc, function (f) { return f.path.indexOf($scope.startNodeId) !== -1; }); }); } else { $scope.path = []; } //mediaResource.rootMedia() mediaResource.getChildren(folder.id) .then(function(data) { $scope.searchTerm = ""; $scope.images = data.items ? data.items : []; }); $scope.options.formData.currentFolder = folder.id; $scope.currentFolder = folder; }; //This executes prior to the whole processing which we can use to get the UI going faster, //this also gives us the start callback to invoke to kick of the whole thing $scope.$on('fileuploadadd', function (e, data) { $scope.$apply(function () { $scope.filesUploading++; }); }); //when one is finished $scope.$on('fileuploaddone', function (e, data) { $scope.filesUploading--; if ($scope.filesUploading == 0) { $scope.$apply(function () { $scope.progress = 0; $scope.gotoFolder($scope.currentFolder); }); } //Show notifications!!!! if (data.result && data.result.notifications && angular.isArray(data.result.notifications)) { for (var n = 0; n < data.result.notifications.length; n++) { notificationsService.showNotification(data.result.notifications[n]); } } }); // All these sit-ups are to add dropzone area and make sure it gets removed if dragging is aborted! $scope.$on('fileuploaddragover', function (e, data) { if (!$scope.dragClearTimeout) { $scope.$apply(function () { $scope.dropping = true; }); } else { $timeout.cancel($scope.dragClearTimeout); } $scope.dragClearTimeout = $timeout(function () { $scope.dropping = null; $scope.dragClearTimeout = null; }, 300); }); $scope.clickHandler = function(image, ev, select) { ev.preventDefault(); if (image.isFolder && !select) { $scope.gotoFolder(image); }else{ eventsService.emit("dialogs.mediaPicker.select", image); //we have 3 options add to collection (if multi) show details, or submit it right back to the callback if ($scope.multiPicker) { $scope.select(image); image.cssclass = ($scope.dialogData.selection.indexOf(image) > -1) ? "selected" : ""; }else if($scope.showDetails) { $scope.target= image; $scope.target.url = mediaHelper.resolveFile(image); }else{ $scope.submit(image); } } }; $scope.exitDetails = function(){ if(!$scope.currentFolder){ $scope.gotoFolder(); } $scope.target = undefined; }; //default root item if(!$scope.target){ $scope.gotoFolder({ id: $scope.startNodeId, name: "Media", icon: "icon-folder" }); } });
gregoriusxu/Umbraco-CMS
src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.controller.js
JavaScript
mit
6,762
package volume import ( "bytes" "fmt" "io/ioutil" "testing" "github.com/docker/docker/api/types" "github.com/docker/docker/cli/internal/test" "github.com/pkg/errors" // Import builders to get the builder function as package function . "github.com/docker/docker/cli/internal/test/builders" "github.com/docker/docker/pkg/testutil/assert" "github.com/docker/docker/pkg/testutil/golden" ) func TestVolumeInspectErrors(t *testing.T) { testCases := []struct { args []string flags map[string]string volumeInspectFunc func(volumeID string) (types.Volume, error) expectedError string }{ { expectedError: "requires at least 1 argument", }, { args: []string{"foo"}, volumeInspectFunc: func(volumeID string) (types.Volume, error) { return types.Volume{}, errors.Errorf("error while inspecting the volume") }, expectedError: "error while inspecting the volume", }, { args: []string{"foo"}, flags: map[string]string{ "format": "{{invalid format}}", }, expectedError: "Template parsing error", }, { args: []string{"foo", "bar"}, volumeInspectFunc: func(volumeID string) (types.Volume, error) { if volumeID == "foo" { return types.Volume{ Name: "foo", }, nil } return types.Volume{}, errors.Errorf("error while inspecting the volume") }, expectedError: "error while inspecting the volume", }, } for _, tc := range testCases { buf := new(bytes.Buffer) cmd := newInspectCommand( test.NewFakeCli(&fakeClient{ volumeInspectFunc: tc.volumeInspectFunc, }, buf), ) cmd.SetArgs(tc.args) for key, value := range tc.flags { cmd.Flags().Set(key, value) } cmd.SetOutput(ioutil.Discard) assert.Error(t, cmd.Execute(), tc.expectedError) } } func TestVolumeInspectWithoutFormat(t *testing.T) { testCases := []struct { name string args []string volumeInspectFunc func(volumeID string) (types.Volume, error) }{ { name: "single-volume", args: []string{"foo"}, volumeInspectFunc: func(volumeID string) (types.Volume, error) { if volumeID != "foo" { return types.Volume{}, errors.Errorf("Invalid volumeID, expected %s, got %s", "foo", volumeID) } return *Volume(), nil }, }, { name: "multiple-volume-with-labels", args: []string{"foo", "bar"}, volumeInspectFunc: func(volumeID string) (types.Volume, error) { return *Volume(VolumeName(volumeID), VolumeLabels(map[string]string{ "foo": "bar", })), nil }, }, } for _, tc := range testCases { buf := new(bytes.Buffer) cmd := newInspectCommand( test.NewFakeCli(&fakeClient{ volumeInspectFunc: tc.volumeInspectFunc, }, buf), ) cmd.SetArgs(tc.args) assert.NilError(t, cmd.Execute()) actual := buf.String() expected := golden.Get(t, []byte(actual), fmt.Sprintf("volume-inspect-without-format.%s.golden", tc.name)) assert.EqualNormalizedString(t, assert.RemoveSpace, actual, string(expected)) } } func TestVolumeInspectWithFormat(t *testing.T) { volumeInspectFunc := func(volumeID string) (types.Volume, error) { return *Volume(VolumeLabels(map[string]string{ "foo": "bar", })), nil } testCases := []struct { name string format string args []string volumeInspectFunc func(volumeID string) (types.Volume, error) }{ { name: "simple-template", format: "{{.Name}}", args: []string{"foo"}, volumeInspectFunc: volumeInspectFunc, }, { name: "json-template", format: "{{json .Labels}}", args: []string{"foo"}, volumeInspectFunc: volumeInspectFunc, }, } for _, tc := range testCases { buf := new(bytes.Buffer) cmd := newInspectCommand( test.NewFakeCli(&fakeClient{ volumeInspectFunc: tc.volumeInspectFunc, }, buf), ) cmd.SetArgs(tc.args) cmd.Flags().Set("format", tc.format) assert.NilError(t, cmd.Execute()) actual := buf.String() expected := golden.Get(t, []byte(actual), fmt.Sprintf("volume-inspect-with-format.%s.golden", tc.name)) assert.EqualNormalizedString(t, assert.RemoveSpace, actual, string(expected)) } }
Originate/exosphere
vendor/github.com/moby/moby/cli/command/volume/inspect_test.go
GO
mit
4,211
/* ********************************************************************************************* System Loader Implementation - Implemented to https://github.com/jorendorff/js-loaders/blob/master/browser-loader.js - <script type="module"> supported ********************************************************************************************* */ var System; function SystemLoader() { Loader.call(this); this.paths = {}; } // NB no specification provided for System.paths, used ideas discussed in https://github.com/jorendorff/js-loaders/issues/25 function applyPaths(paths, name) { // most specific (most number of slashes in path) match wins var pathMatch = '', wildcard, maxSlashCount = 0; // check to see if we have a paths entry for (var p in paths) { var pathParts = p.split('*'); if (pathParts.length > 2) throw new TypeError('Only one wildcard in a path is permitted'); // exact path match if (pathParts.length == 1) { if (name == p) { pathMatch = p; break; } } // wildcard path match else { var slashCount = p.split('/').length; if (slashCount >= maxSlashCount && name.substr(0, pathParts[0].length) == pathParts[0] && name.substr(name.length - pathParts[1].length) == pathParts[1]) { maxSlashCount = slashCount; pathMatch = p; wildcard = name.substr(pathParts[0].length, name.length - pathParts[1].length - pathParts[0].length); } } } var outPath = paths[pathMatch] || name; if (typeof wildcard == 'string') outPath = outPath.replace('*', wildcard); return outPath; } // inline Object.create-style class extension function LoaderProto() {} LoaderProto.prototype = Loader.prototype; SystemLoader.prototype = new LoaderProto();
nfl/es6-module-loader
src/system.js
JavaScript
mit
1,825
<?php /** * @file * Definition of Drupal\config\Tests\ConfigModuleOverridesTest. */ namespace Drupal\config\Tests; use Drupal\simpletest\DrupalUnitTestBase; /** * Tests module overrides of configuration using event subscribers. */ class ConfigModuleOverridesTest extends DrupalUnitTestBase { public static $modules = array('system', 'config', 'config_override'); public static function getInfo() { return array( 'name' => 'Module overrides', 'description' => 'Tests that modules can override configuration with event subscribers.', 'group' => 'Configuration', ); } public function testSimpleModuleOverrides() { $GLOBALS['config_test_run_module_overrides'] = TRUE; $name = 'system.site'; $overridden_name = 'ZOMG overridden site name'; $non_overridden_name = 'ZOMG this name is on disk mkay'; $overridden_slogan = 'Yay for overrides!'; $non_overridden_slogan = 'Yay for defaults!'; $config_factory = $this->container->get('config.factory'); $config_factory ->get($name) ->set('name', $non_overridden_name) ->set('slogan', $non_overridden_slogan) ->save(); $this->assertTrue($config_factory->getOverrideState(), 'By default ConfigFactory has overrides enabled.'); $old_state = $config_factory->getOverrideState(); $config_factory->setOverrideState(FALSE); $this->assertFalse($config_factory->getOverrideState(), 'ConfigFactory can disable overrides.'); $this->assertEqual($non_overridden_name, $config_factory->get('system.site')->get('name')); $this->assertEqual($non_overridden_slogan, $config_factory->get('system.site')->get('slogan')); $config_factory->setOverrideState(TRUE); $this->assertTrue($config_factory->getOverrideState(), 'ConfigFactory can enable overrides.'); $this->assertEqual($overridden_name, $config_factory->get('system.site')->get('name')); $this->assertEqual($overridden_slogan, $config_factory->get('system.site')->get('slogan')); // Test overrides of completely new configuration objects. In normal runtime // this should only happen for configuration entities as we should not be // creating simple configuration objects on the fly. $config = $config_factory->get('config_override.new'); $this->assertTrue($config->isNew(), 'The configuration object config_override.new is new'); $this->assertIdentical($config->get('module'), 'override'); $config_factory->setOverrideState(FALSE); $config = \Drupal::config('config_override.new'); $this->assertIdentical($config->get('module'), NULL); $config_factory->setOverrideState($old_state); unset($GLOBALS['config_test_run_module_overrides']); } }
drupaals/demo.com
d8/core/modules/config/src/Tests/ConfigModuleOverridesTest.php
PHP
gpl-2.0
2,710
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- #include <AP_HAL.h> #include "AP_InertialSensor_MPU6000.h" extern const AP_HAL::HAL& hal; // MPU6000 accelerometer scaling #define MPU6000_ACCEL_SCALE_1G (GRAVITY_MSS / 4096.0f) // MPU 6000 registers #define MPUREG_XG_OFFS_TC 0x00 #define MPUREG_YG_OFFS_TC 0x01 #define MPUREG_ZG_OFFS_TC 0x02 #define MPUREG_X_FINE_GAIN 0x03 #define MPUREG_Y_FINE_GAIN 0x04 #define MPUREG_Z_FINE_GAIN 0x05 #define MPUREG_XA_OFFS_H 0x06 // X axis accelerometer offset (high byte) #define MPUREG_XA_OFFS_L 0x07 // X axis accelerometer offset (low byte) #define MPUREG_YA_OFFS_H 0x08 // Y axis accelerometer offset (high byte) #define MPUREG_YA_OFFS_L 0x09 // Y axis accelerometer offset (low byte) #define MPUREG_ZA_OFFS_H 0x0A // Z axis accelerometer offset (high byte) #define MPUREG_ZA_OFFS_L 0x0B // Z axis accelerometer offset (low byte) #define MPUREG_PRODUCT_ID 0x0C // Product ID Register #define MPUREG_XG_OFFS_USRH 0x13 // X axis gyro offset (high byte) #define MPUREG_XG_OFFS_USRL 0x14 // X axis gyro offset (low byte) #define MPUREG_YG_OFFS_USRH 0x15 // Y axis gyro offset (high byte) #define MPUREG_YG_OFFS_USRL 0x16 // Y axis gyro offset (low byte) #define MPUREG_ZG_OFFS_USRH 0x17 // Z axis gyro offset (high byte) #define MPUREG_ZG_OFFS_USRL 0x18 // Z axis gyro offset (low byte) #define MPUREG_SMPLRT_DIV 0x19 // sample rate. Fsample= 1Khz/(<this value>+1) = 200Hz # define MPUREG_SMPLRT_1000HZ 0x00 # define MPUREG_SMPLRT_500HZ 0x01 # define MPUREG_SMPLRT_250HZ 0x03 # define MPUREG_SMPLRT_200HZ 0x04 # define MPUREG_SMPLRT_100HZ 0x09 # define MPUREG_SMPLRT_50HZ 0x13 #define MPUREG_CONFIG 0x1A #define MPUREG_GYRO_CONFIG 0x1B // bit definitions for MPUREG_GYRO_CONFIG # define BITS_GYRO_FS_250DPS 0x00 # define BITS_GYRO_FS_500DPS 0x08 # define BITS_GYRO_FS_1000DPS 0x10 # define BITS_GYRO_FS_2000DPS 0x18 # define BITS_GYRO_FS_MASK 0x18 // only bits 3 and 4 are used for gyro full scale so use this to mask off other bits # define BITS_GYRO_ZGYRO_SELFTEST 0x20 # define BITS_GYRO_YGYRO_SELFTEST 0x40 # define BITS_GYRO_XGYRO_SELFTEST 0x80 #define MPUREG_ACCEL_CONFIG 0x1C #define MPUREG_MOT_THR 0x1F // detection threshold for Motion interrupt generation. Motion is detected when the absolute value of any of the accelerometer measurements exceeds this #define MPUREG_MOT_DUR 0x20 // duration counter threshold for Motion interrupt generation. The duration counter ticks at 1 kHz, therefore MOT_DUR has a unit of 1 LSB = 1 ms #define MPUREG_ZRMOT_THR 0x21 // detection threshold for Zero Motion interrupt generation. #define MPUREG_ZRMOT_DUR 0x22 // duration counter threshold for Zero Motion interrupt generation. The duration counter ticks at 16 Hz, therefore ZRMOT_DUR has a unit of 1 LSB = 64 ms. #define MPUREG_FIFO_EN 0x23 #define MPUREG_INT_PIN_CFG 0x37 # define BIT_INT_RD_CLEAR 0x10 // clear the interrupt when any read occurs # define BIT_LATCH_INT_EN 0x20 // latch data ready pin #define MPUREG_INT_ENABLE 0x38 // bit definitions for MPUREG_INT_ENABLE # define BIT_RAW_RDY_EN 0x01 # define BIT_DMP_INT_EN 0x02 // enabling this bit (DMP_INT_EN) also enables RAW_RDY_EN it seems # define BIT_UNKNOWN_INT_EN 0x04 # define BIT_I2C_MST_INT_EN 0x08 # define BIT_FIFO_OFLOW_EN 0x10 # define BIT_ZMOT_EN 0x20 # define BIT_MOT_EN 0x40 # define BIT_FF_EN 0x80 #define MPUREG_INT_STATUS 0x3A // bit definitions for MPUREG_INT_STATUS (same bit pattern as above because this register shows what interrupt actually fired) # define BIT_RAW_RDY_INT 0x01 # define BIT_DMP_INT 0x02 # define BIT_UNKNOWN_INT 0x04 # define BIT_I2C_MST_INT 0x08 # define BIT_FIFO_OFLOW_INT 0x10 # define BIT_ZMOT_INT 0x20 # define BIT_MOT_INT 0x40 # define BIT_FF_INT 0x80 #define MPUREG_ACCEL_XOUT_H 0x3B #define MPUREG_ACCEL_XOUT_L 0x3C #define MPUREG_ACCEL_YOUT_H 0x3D #define MPUREG_ACCEL_YOUT_L 0x3E #define MPUREG_ACCEL_ZOUT_H 0x3F #define MPUREG_ACCEL_ZOUT_L 0x40 #define MPUREG_TEMP_OUT_H 0x41 #define MPUREG_TEMP_OUT_L 0x42 #define MPUREG_GYRO_XOUT_H 0x43 #define MPUREG_GYRO_XOUT_L 0x44 #define MPUREG_GYRO_YOUT_H 0x45 #define MPUREG_GYRO_YOUT_L 0x46 #define MPUREG_GYRO_ZOUT_H 0x47 #define MPUREG_GYRO_ZOUT_L 0x48 #define MPUREG_USER_CTRL 0x6A // bit definitions for MPUREG_USER_CTRL # define BIT_USER_CTRL_SIG_COND_RESET 0x01 // resets signal paths and results registers for all sensors (gyros, accel, temp) # define BIT_USER_CTRL_I2C_MST_RESET 0x02 // reset I2C Master (only applicable if I2C_MST_EN bit is set) # define BIT_USER_CTRL_FIFO_RESET 0x04 // Reset (i.e. clear) FIFO buffer # define BIT_USER_CTRL_DMP_RESET 0x08 // Reset DMP # define BIT_USER_CTRL_I2C_IF_DIS 0x10 // Disable primary I2C interface and enable hal.spi->interface # define BIT_USER_CTRL_I2C_MST_EN 0x20 // Enable MPU to act as the I2C Master to external slave sensors # define BIT_USER_CTRL_FIFO_EN 0x40 // Enable FIFO operations # define BIT_USER_CTRL_DMP_EN 0x80 // Enable DMP operations #define MPUREG_PWR_MGMT_1 0x6B # define BIT_PWR_MGMT_1_CLK_INTERNAL 0x00 // clock set to internal 8Mhz oscillator # define BIT_PWR_MGMT_1_CLK_XGYRO 0x01 // PLL with X axis gyroscope reference # define BIT_PWR_MGMT_1_CLK_YGYRO 0x02 // PLL with Y axis gyroscope reference # define BIT_PWR_MGMT_1_CLK_ZGYRO 0x03 // PLL with Z axis gyroscope reference # define BIT_PWR_MGMT_1_CLK_EXT32KHZ 0x04 // PLL with external 32.768kHz reference # define BIT_PWR_MGMT_1_CLK_EXT19MHZ 0x05 // PLL with external 19.2MHz reference # define BIT_PWR_MGMT_1_CLK_STOP 0x07 // Stops the clock and keeps the timing generator in reset # define BIT_PWR_MGMT_1_TEMP_DIS 0x08 // disable temperature sensor # define BIT_PWR_MGMT_1_CYCLE 0x20 // put sensor into cycle mode. cycles between sleep mode and waking up to take a single sample of data from active sensors at a rate determined by LP_WAKE_CTRL # define BIT_PWR_MGMT_1_SLEEP 0x40 // put sensor into low power sleep mode # define BIT_PWR_MGMT_1_DEVICE_RESET 0x80 // reset entire device #define MPUREG_PWR_MGMT_2 0x6C // allows the user to configure the frequency of wake-ups in Accelerometer Only Low Power Mode #define MPUREG_BANK_SEL 0x6D // DMP bank selection register (used to indirectly access DMP registers) #define MPUREG_MEM_START_ADDR 0x6E // DMP memory start address (used to indirectly write to dmp memory) #define MPUREG_MEM_R_W 0x6F // DMP related register #define MPUREG_DMP_CFG_1 0x70 // DMP related register #define MPUREG_DMP_CFG_2 0x71 // DMP related register #define MPUREG_FIFO_COUNTH 0x72 #define MPUREG_FIFO_COUNTL 0x73 #define MPUREG_FIFO_R_W 0x74 #define MPUREG_WHOAMI 0x75 // Configuration bits MPU 3000 and MPU 6000 (not revised)? #define BITS_DLPF_CFG_256HZ_NOLPF2 0x00 #define BITS_DLPF_CFG_188HZ 0x01 #define BITS_DLPF_CFG_98HZ 0x02 #define BITS_DLPF_CFG_42HZ 0x03 #define BITS_DLPF_CFG_20HZ 0x04 #define BITS_DLPF_CFG_10HZ 0x05 #define BITS_DLPF_CFG_5HZ 0x06 #define BITS_DLPF_CFG_2100HZ_NOLPF 0x07 #define BITS_DLPF_CFG_MASK 0x07 // Product ID Description for MPU6000 // high 4 bits low 4 bits // Product Name Product Revision #define MPU6000ES_REV_C4 0x14 // 0001 0100 #define MPU6000ES_REV_C5 0x15 // 0001 0101 #define MPU6000ES_REV_D6 0x16 // 0001 0110 #define MPU6000ES_REV_D7 0x17 // 0001 0111 #define MPU6000ES_REV_D8 0x18 // 0001 1000 #define MPU6000_REV_C4 0x54 // 0101 0100 #define MPU6000_REV_C5 0x55 // 0101 0101 #define MPU6000_REV_D6 0x56 // 0101 0110 #define MPU6000_REV_D7 0x57 // 0101 0111 #define MPU6000_REV_D8 0x58 // 0101 1000 #define MPU6000_REV_D9 0x59 // 0101 1001 // DMP output rate constants #define MPU6000_200HZ 0x00 // default value #define MPU6000_100HZ 0x01 #define MPU6000_66HZ 0x02 #define MPU6000_50HZ 0x03 // DMP FIFO constants // Default quaternion FIFO size (4*4) + Footer(2) #define FIFO_PACKET_SIZE 18 // Rate of the gyro bias from gravity correction (200Hz/4) => 50Hz #define GYRO_BIAS_FROM_GRAVITY_RATE 4 // Default gain for accel fusion (with gyros) #define DEFAULT_ACCEL_FUSION_GAIN 0x80 /* * RM-MPU-6000A-00.pdf, page 33, section 4.25 lists LSB sensitivity of * gyro as 16.4 LSB/DPS at scale factor of +/- 2000dps (FS_SEL==3) */ const float AP_InertialSensor_MPU6000::_gyro_scale = (0.0174532 / 16.4); /* pch: I believe the accel and gyro indicies are correct * but somone else should please confirm. * * jamesjb: Y and Z axes are flipped on the PX4FMU */ const uint8_t AP_InertialSensor_MPU6000::_gyro_data_index[3] = { 5, 4, 6 }; const uint8_t AP_InertialSensor_MPU6000::_accel_data_index[3] = { 1, 0, 2 }; #if CONFIG_HAL_BOARD == HAL_BOARD_SMACCM const int8_t AP_InertialSensor_MPU6000::_gyro_data_sign[3] = { 1, -1, 1 }; const int8_t AP_InertialSensor_MPU6000::_accel_data_sign[3] = { 1, -1, 1 }; #else const int8_t AP_InertialSensor_MPU6000::_gyro_data_sign[3] = { 1, 1, -1 }; const int8_t AP_InertialSensor_MPU6000::_accel_data_sign[3] = { 1, 1, -1 }; #endif const uint8_t AP_InertialSensor_MPU6000::_temp_data_index = 3; int16_t AP_InertialSensor_MPU6000::_mpu6000_product_id = AP_PRODUCT_ID_NONE; AP_HAL::DigitalSource *AP_InertialSensor_MPU6000::_drdy_pin = NULL; // time we start collecting sample (reset on update) // time latest sample was collected static volatile uint32_t _last_sample_time_micros = 0; // DMP related static variables bool AP_InertialSensor_MPU6000::_dmp_initialised = false; // high byte of number of elements in fifo buffer uint8_t AP_InertialSensor_MPU6000::_fifoCountH; // low byte of number of elements in fifo buffer uint8_t AP_InertialSensor_MPU6000::_fifoCountL; // holds the 4 quaternions representing attitude taken directly from the DMP Quaternion AP_InertialSensor_MPU6000::quaternion; /* Static SPI device driver */ AP_HAL::SPIDeviceDriver* AP_InertialSensor_MPU6000::_spi = NULL; AP_HAL::Semaphore* AP_InertialSensor_MPU6000::_spi_sem = NULL; /* * RM-MPU-6000A-00.pdf, page 31, section 4.23 lists LSB sensitivity of * accel as 4096 LSB/mg at scale factor of +/- 8g (AFS_SEL==2) * * See note below about accel scaling of engineering sample MPU6k * variants however */ AP_InertialSensor_MPU6000::AP_InertialSensor_MPU6000() : AP_InertialSensor() { _temp = 0; _initialised = false; _dmp_initialised = false; } uint16_t AP_InertialSensor_MPU6000::_init_sensor( Sample_rate sample_rate ) { if (_initialised) return _mpu6000_product_id; _initialised = true; _spi = hal.spi->device(AP_HAL::SPIDevice_MPU6000); _spi_sem = _spi->get_semaphore(); /* Pin 70 defined especially to hook up PE6 to the hal.gpio abstraction. (It is not a valid pin under Arduino.) */ _drdy_pin = hal.gpio->channel(70); hal.scheduler->suspend_timer_procs(); uint8_t tries = 0; do { bool success = hardware_init(sample_rate); if (success) { hal.scheduler->delay(5+2); if (_data_ready()) { break; } else { hal.console->println_P( PSTR("MPU6000 startup failed: no data ready")); } } if (tries++ > 5) { hal.scheduler->panic(PSTR("PANIC: failed to boot MPU6000 5 times")); } } while (1); hal.scheduler->resume_timer_procs(); /* read the first lot of data. * _read_data_transaction requires the spi semaphore to be taken by * its caller. */ _last_sample_time_micros = hal.scheduler->micros(); _read_data_transaction(); // start the timer process to read samples hal.scheduler->register_timer_process(_poll_data); #if MPU6000_DEBUG _dump_registers(); #endif return _mpu6000_product_id; } // accumulation in ISR - must be read with interrupts disabled // the sum of the values since last read static volatile int32_t _sum[7]; // how many values we've accumulated since last read static volatile uint16_t _count; /*================ AP_INERTIALSENSOR PUBLIC INTERFACE ==================== */ void AP_InertialSensor_MPU6000::wait_for_sample() { uint32_t tstart = hal.scheduler->micros(); while (num_samples_available() == 0) { uint32_t now = hal.scheduler->micros(); uint32_t dt = now - tstart; if (dt > 50000) { hal.scheduler->panic( PSTR("PANIC: AP_InertialSensor_MPU6000::update " "waited 50ms for data from interrupt")); } } } bool AP_InertialSensor_MPU6000::update( void ) { int32_t sum[7]; float count_scale; Vector3f accel_scale = _accel_scale.get(); // wait for at least 1 sample wait_for_sample(); // disable timer procs for mininum time hal.scheduler->suspend_timer_procs(); /** ATOMIC SECTION w/r/t TIMER PROCESS */ { for (int i=0; i<7; i++) { sum[i] = _sum[i]; _sum[i] = 0; } _num_samples = _count; _count = 0; } hal.scheduler->resume_timer_procs(); count_scale = 1.0f / _num_samples; _gyro = Vector3f(_gyro_data_sign[0] * sum[_gyro_data_index[0]], _gyro_data_sign[1] * sum[_gyro_data_index[1]], _gyro_data_sign[2] * sum[_gyro_data_index[2]]); _gyro.rotate(_board_orientation); _gyro *= _gyro_scale * count_scale; _gyro -= _gyro_offset; _accel = Vector3f(_accel_data_sign[0] * sum[_accel_data_index[0]], _accel_data_sign[1] * sum[_accel_data_index[1]], _accel_data_sign[2] * sum[_accel_data_index[2]]); _accel.rotate(_board_orientation); _accel *= count_scale * MPU6000_ACCEL_SCALE_1G; _accel.x *= accel_scale.x; _accel.y *= accel_scale.y; _accel.z *= accel_scale.z; _accel -= _accel_offset; _temp = _temp_to_celsius(sum[_temp_data_index] * count_scale); if (_last_filter_hz != _mpu6000_filter) { if (_spi_sem->take(10)) { _set_filter_register(_mpu6000_filter, 0); _spi_sem->give(); } } return true; } /*================ HARDWARE FUNCTIONS ==================== */ /** * Return true if the MPU6000 has new data available for reading. * * We use the data ready pin if it is available. Otherwise, read the * status register. */ bool AP_InertialSensor_MPU6000::_data_ready() { if (_drdy_pin) { return _drdy_pin->read() != 0; } if (hal.scheduler->in_timerprocess()) { bool got = _spi_sem->take_nonblocking(); if (got) { uint8_t status = _register_read(MPUREG_INT_STATUS); _spi_sem->give(); return (status & BIT_RAW_RDY_INT) != 0; } else { return false; } } else { bool got = _spi_sem->take(10); if (got) { uint8_t status = _register_read(MPUREG_INT_STATUS); _spi_sem->give(); return (status & BIT_RAW_RDY_INT) != 0; } else { hal.scheduler->panic( PSTR("PANIC: AP_InertialSensor_MPU6000::_data_ready failed to " "take SPI semaphore synchronously")); } } return false; } /** * Timer process to poll for new data from the MPU6000. */ void AP_InertialSensor_MPU6000::_poll_data(uint32_t now) { if (_data_ready()) { if (hal.scheduler->in_timerprocess()) { _read_data_from_timerprocess(); } else { /* Synchronous read - take semaphore */ bool got = _spi_sem->take(10); if (got) { _last_sample_time_micros = hal.scheduler->micros(); _read_data_transaction(); _spi_sem->give(); } else { hal.scheduler->panic( PSTR("PANIC: AP_InertialSensor_MPU6000::_poll_data " "failed to take SPI semaphore synchronously")); } } } } /* * this is called from the _poll_data, in the timer process context. * when the MPU6000 has new sensor data available and add it to _sum[] to * ensure this is the case, these other devices must perform their spi reads * after being called by the AP_TimerProcess. */ void AP_InertialSensor_MPU6000::_read_data_from_timerprocess() { static uint8_t semfail_ctr = 0; bool got = _spi_sem->take_nonblocking(); if (!got) { semfail_ctr++; if (semfail_ctr > 100) { hal.scheduler->panic(PSTR("PANIC: failed to take SPI semaphore " "100 times in AP_InertialSensor_MPU6000::" "_read_data_from_timerprocess")); } return; } else { semfail_ctr = 0; } _last_sample_time_micros = hal.scheduler->micros(); _read_data_transaction(); _spi_sem->give(); } void AP_InertialSensor_MPU6000::_read_data_transaction() { /* one resister address followed by seven 2-byte registers */ uint8_t tx[15]; uint8_t rx[15]; memset(tx,0,15); tx[0] = MPUREG_ACCEL_XOUT_H | 0x80; _spi->transaction(tx, rx, 15); for (uint8_t i = 0; i < 7; i++) { _sum[i] += (int16_t)(((uint16_t)rx[2*i+1] << 8) | rx[2*i+2]); } _count++; if (_count == 0) { // rollover - v unlikely memset((void*)_sum, 0, sizeof(_sum)); } // should also read FIFO data if enabled if( _dmp_initialised ) { if( FIFO_ready() ) { FIFO_getPacket(); } } } uint8_t AP_InertialSensor_MPU6000::_register_read( uint8_t reg ) { uint8_t addr = reg | 0x80; // Set most significant bit uint8_t tx[2]; uint8_t rx[2]; tx[0] = addr; tx[1] = 0; _spi->transaction(tx, rx, 2); return rx[1]; } void AP_InertialSensor_MPU6000::register_write(uint8_t reg, uint8_t val) { uint8_t tx[2]; uint8_t rx[2]; tx[0] = reg; tx[1] = val; _spi->transaction(tx, rx, 2); } /* set the DLPF filter frequency. Assumes caller has taken semaphore */ void AP_InertialSensor_MPU6000::_set_filter_register(uint8_t filter_hz, uint8_t default_filter) { uint8_t filter = default_filter; // choose filtering frequency switch (filter_hz) { case 5: filter = BITS_DLPF_CFG_5HZ; break; case 10: filter = BITS_DLPF_CFG_10HZ; break; case 20: filter = BITS_DLPF_CFG_20HZ; break; case 42: filter = BITS_DLPF_CFG_42HZ; break; case 98: filter = BITS_DLPF_CFG_98HZ; break; } if (filter != 0) { _last_filter_hz = filter_hz; register_write(MPUREG_CONFIG, filter); } } bool AP_InertialSensor_MPU6000::hardware_init(Sample_rate sample_rate) { if (!_spi_sem->take(100)) { hal.scheduler->panic(PSTR("MPU6000: Unable to get semaphore")); } // Chip reset uint8_t tries; for (tries = 0; tries<5; tries++) { register_write(MPUREG_PWR_MGMT_1, BIT_PWR_MGMT_1_DEVICE_RESET); hal.scheduler->delay(100); // Wake up device and select GyroZ clock. Note that the // MPU6000 starts up in sleep mode, and it can take some time // for it to come out of sleep register_write(MPUREG_PWR_MGMT_1, BIT_PWR_MGMT_1_CLK_ZGYRO); hal.scheduler->delay(5); // check it has woken up if (_register_read(MPUREG_PWR_MGMT_1) == BIT_PWR_MGMT_1_CLK_ZGYRO) { break; } #if MPU6000_DEBUG _dump_registers(); #endif } if (tries == 5) { hal.console->println_P(PSTR("Failed to boot MPU6000 5 times")); _spi_sem->give(); return false; } register_write(MPUREG_PWR_MGMT_2, 0x00); // only used for wake-up in accelerometer only low power mode hal.scheduler->delay(1); // Disable I2C bus (recommended on datasheet) register_write(MPUREG_USER_CTRL, BIT_USER_CTRL_I2C_IF_DIS); hal.scheduler->delay(1); uint8_t default_filter; // sample rate and filtering // to minimise the effects of aliasing we choose a filter // that is less than half of the sample rate switch (sample_rate) { case RATE_50HZ: // this is used for plane and rover, where noise resistance is // more important than update rate. Tests on an aerobatic plane // show that 10Hz is fine, and makes it very noise resistant default_filter = BITS_DLPF_CFG_10HZ; _sample_shift = 2; break; case RATE_100HZ: default_filter = BITS_DLPF_CFG_20HZ; _sample_shift = 1; break; case RATE_200HZ: default: default_filter = BITS_DLPF_CFG_20HZ; _sample_shift = 0; break; } _set_filter_register(_mpu6000_filter, default_filter); // set sample rate to 200Hz, and use _sample_divider to give // the requested rate to the application register_write(MPUREG_SMPLRT_DIV, MPUREG_SMPLRT_200HZ); hal.scheduler->delay(1); register_write(MPUREG_GYRO_CONFIG, BITS_GYRO_FS_2000DPS); // Gyro scale 2000º/s hal.scheduler->delay(1); // read the product ID rev c has 1/2 the sensitivity of rev d _mpu6000_product_id = _register_read(MPUREG_PRODUCT_ID); //Serial.printf("Product_ID= 0x%x\n", (unsigned) _mpu6000_product_id); if ((_mpu6000_product_id == MPU6000ES_REV_C4) || (_mpu6000_product_id == MPU6000ES_REV_C5) || (_mpu6000_product_id == MPU6000_REV_C4) || (_mpu6000_product_id == MPU6000_REV_C5)) { // Accel scale 8g (4096 LSB/g) // Rev C has different scaling than rev D register_write(MPUREG_ACCEL_CONFIG,1<<3); } else { // Accel scale 8g (4096 LSB/g) register_write(MPUREG_ACCEL_CONFIG,2<<3); } hal.scheduler->delay(1); // configure interrupt to fire when new data arrives register_write(MPUREG_INT_ENABLE, BIT_RAW_RDY_EN); hal.scheduler->delay(1); // clear interrupt on any read, and hold the data ready pin high // until we clear the interrupt register_write(MPUREG_INT_PIN_CFG, BIT_INT_RD_CLEAR | BIT_LATCH_INT_EN); hal.scheduler->delay(1); _spi_sem->give(); return true; } float AP_InertialSensor_MPU6000::_temp_to_celsius ( uint16_t regval ) { /* TODO */ return 20.0; } // return the MPU6k gyro drift rate in radian/s/s // note that this is much better than the oilpan gyros float AP_InertialSensor_MPU6000::get_gyro_drift_rate(void) { // 0.5 degrees/second/minute return ToRad(0.5/60); } // get number of samples read from the sensors uint16_t AP_InertialSensor_MPU6000::num_samples_available() { _poll_data(0); return _count >> _sample_shift; } #if MPU6000_DEBUG // dump all config registers - used for debug void AP_InertialSensor_MPU6000::_dump_registers(void) { hal.console->println_P(PSTR("MPU6000 registers")); for (uint8_t reg=MPUREG_PRODUCT_ID; reg<=108; reg++) { uint8_t v = _register_read(reg); hal.console->printf_P(PSTR("%02x:%02x "), (unsigned)reg, (unsigned)v); if ((reg - (MPUREG_PRODUCT_ID-1)) % 16 == 0) { hal.console->println(); } } hal.console->println(); } #endif // get_delta_time returns the time period in seconds overwhich the sensor data was collected float AP_InertialSensor_MPU6000::get_delta_time() { // the sensor runs at 200Hz return 0.005 * _num_samples; } // Update gyro offsets with new values. Offsets provided in as scaled deg/sec values void AP_InertialSensor_MPU6000::push_gyro_offsets_to_dmp() { Vector3f gyro_offsets = _gyro_offset.get(); int16_t offsetX = gyro_offsets.x / _gyro_scale * _gyro_data_sign[0]; int16_t offsetY = gyro_offsets.y / _gyro_scale * _gyro_data_sign[1]; int16_t offsetZ = gyro_offsets.z / _gyro_scale * _gyro_data_sign[2]; set_dmp_gyro_offsets(offsetX, offsetY, offsetZ); // remove ins level offsets to avoid double counting gyro_offsets.x = 0; gyro_offsets.y = 0; gyro_offsets.z = 0; _gyro_offset = gyro_offsets; } // Update gyro offsets with new values. New offset values are substracted to actual offset values. // offset values in gyro LSB units (as read from registers) void AP_InertialSensor_MPU6000::set_dmp_gyro_offsets(int16_t offsetX, int16_t offsetY, int16_t offsetZ) { int16_t aux_int; if (offsetX != 0) { // Read actual value aux_int = (_register_read(MPUREG_XG_OFFS_USRH)<<8) | _register_read(MPUREG_XG_OFFS_USRL); aux_int -= offsetX<<1; // Adjust to internal units // Write to MPU registers register_write(MPUREG_XG_OFFS_USRH, (aux_int>>8)&0xFF); register_write(MPUREG_XG_OFFS_USRL, aux_int&0xFF); } if (offsetY != 0) { aux_int = (_register_read(MPUREG_YG_OFFS_USRH)<<8) | _register_read(MPUREG_YG_OFFS_USRL); aux_int -= offsetY<<1; // Adjust to internal units // Write to MPU registers register_write(MPUREG_YG_OFFS_USRH, (aux_int>>8)&0xFF); register_write(MPUREG_YG_OFFS_USRL, aux_int&0xFF); } if (offsetZ != 0) { aux_int = (_register_read(MPUREG_ZG_OFFS_USRH)<<8) | _register_read(MPUREG_ZG_OFFS_USRL); aux_int -= offsetZ<<1; // Adjust to internal units // Write to MPU registers register_write(MPUREG_ZG_OFFS_USRH, (aux_int>>8)&0xFF); register_write(MPUREG_ZG_OFFS_USRL, aux_int&0xFF); } } // Update accel offsets with new values. Offsets provided in as scaled values (1G) void AP_InertialSensor_MPU6000::push_accel_offsets_to_dmp() { Vector3f accel_offset = _accel_offset.get(); Vector3f accel_scale = _accel_scale.get(); int16_t offsetX = accel_offset.x / (accel_scale.x * _accel_data_sign[0] * MPU6000_ACCEL_SCALE_1G); int16_t offsetY = accel_offset.y / (accel_scale.y * _accel_data_sign[1] * MPU6000_ACCEL_SCALE_1G); int16_t offsetZ = accel_offset.z / (accel_scale.z * _accel_data_sign[2] * MPU6000_ACCEL_SCALE_1G); // strangely x and y are reversed set_dmp_accel_offsets(offsetY, offsetX, offsetZ); } // set_accel_offsets - adds an offset to acceleromter readings // This is useful for dynamic acceleration correction (for example centripetal force correction) // and for the initial offset calibration // Input, accel offsets for X,Y and Z in LSB units (as read from raw values) void AP_InertialSensor_MPU6000::set_dmp_accel_offsets(int16_t offsetX, int16_t offsetY, int16_t offsetZ) { int aux_int; uint8_t regs[2]; // Write accel offsets to DMP memory... // TO-DO: why don't we write to main accel offset registries? i.e. MPUREG_XA_OFFS_H aux_int = offsetX>>1; // Transform to internal units regs[0]=(aux_int>>8)&0xFF; regs[1]=aux_int&0xFF; dmp_register_write(0x01,0x08,2,regs); // key KEY_D_1_8 Accel X offset aux_int = offsetY>>1; regs[0]=(aux_int>>8)&0xFF; regs[1]=aux_int&0xFF; dmp_register_write(0x01,0x0A,2,regs); // key KEY_D_1_10 Accel Y offset aux_int = offsetZ>>1; regs[0]=(aux_int>>8)&0xFF; regs[1]=aux_int&0xFF; dmp_register_write(0x01,0x02,2,regs); // key KEY_D_1_2 Accel Z offset } // dmp_register_write - method to write to dmp's registers // the dmp is logically separated from the main mpu6000. To write a block of memory to the DMP's memory you // write the "bank" and starting address into two of the main MPU's registers, then write the data one byte // at a time into the MPUREG_MEM_R_W register void AP_InertialSensor_MPU6000::dmp_register_write(uint8_t bank, uint8_t address, uint8_t num_bytes, uint8_t data[]) { register_write(MPUREG_BANK_SEL,bank); register_write(MPUREG_MEM_START_ADDR,address); _spi->cs_assert(); _spi->transfer(MPUREG_MEM_R_W); for (uint8_t i=0; i<num_bytes; i++) { _spi->transfer(data[i]); } _spi->cs_release(); } // MPU6000 DMP initialization // this should be called after hardware_init if you wish to enable the dmp void AP_InertialSensor_MPU6000::dmp_init() { uint8_t regs[4]; // for writing to dmp // ensure we only initialise once if( _dmp_initialised ) { return; } // load initial values into DMP memory dmp_load_mem(); dmp_set_gyro_calibration(); dmp_set_accel_calibration(); dmp_apply_endian_accel(); dmp_set_mpu_sensors(); dmp_set_bias_none(); dmp_set_fifo_interrupt(); dmp_send_quaternion(); // By default we only send the quaternion to the FIFO (18 bytes packet size) dmp_set_fifo_rate(MPU6000_200HZ); // 200Hz DMP output rate register_write(MPUREG_INT_ENABLE, BIT_RAW_RDY_EN | BIT_DMP_INT_EN ); // configure interrupts to fire only when new data arrives from DMP (in fifo buffer) // Randy: no idea what this does register_write(MPUREG_DMP_CFG_1, 0x03); //MPUREG_DMP_CFG_1, 0x03 register_write(MPUREG_DMP_CFG_2, 0x00); //MPUREG_DMP_CFG_2, 0x00 //inv_state_change_fifo regs[0] = 0xFF; regs[1] = 0xFF; dmp_register_write(0x01, 0xB2, 0x02, regs); // D_1_178 // ?? FIFO ?? regs[0] = 0x09; regs[1] = 0x23; regs[2] = 0xA1; regs[3] = 0x35; dmp_register_write(0x01, 0x90, 0x04, regs); // D_1_144 //register_write(MPUREG_USER_CTRL, BIT_USER_CTRL_FIFO_RESET); //MPUREG_USER_CTRL, BIT_FIFO_RST FIFO_reset(); FIFO_ready(); //register_write(MPUREG_USER_CTRL, 0x00); // MPUREG_USER_CTRL, 0. TO-DO: is all this setting of USER_CTRL really necessary? register_write(MPUREG_USER_CTRL, BIT_USER_CTRL_FIFO_RESET); //MPUREG_USER_CTRL, BIT_FIFO_RST. TO-DO: replace this call with FIFO_reset()? register_write(MPUREG_USER_CTRL, 0x00); // MPUREG_USER_CTRL: 0 register_write(MPUREG_USER_CTRL, BIT_USER_CTRL_DMP_EN | BIT_USER_CTRL_FIFO_EN | BIT_USER_CTRL_DMP_RESET); // Set the gain of the accel in the sensor fusion dmp_set_sensor_fusion_accel_gain(DEFAULT_ACCEL_FUSION_GAIN); // default value // dmp initialisation complete _dmp_initialised = true; } // dmp_reset - reset dmp (required for changes in gains or offsets to take effect) void AP_InertialSensor_MPU6000::dmp_reset() { //uint8_t tmp = register_read(MPUREG_USER_CTRL); //tmp |= BIT_USER_CTRL_DMP_RESET; //register_write(MPUREG_USER_CTRL,tmp); register_write(MPUREG_USER_CTRL, BIT_USER_CTRL_FIFO_RESET); //MPUREG_USER_CTRL, BIT_FIFO_RST. TO-DO: replace this call with FIFO_reset()? register_write(MPUREG_USER_CTRL, 0x00); // MPUREG_USER_CTRL: 0 register_write(MPUREG_USER_CTRL, BIT_USER_CTRL_DMP_EN | BIT_USER_CTRL_FIFO_EN | BIT_USER_CTRL_DMP_RESET); } // New data packet in FIFO? bool AP_InertialSensor_MPU6000::FIFO_ready() { _fifoCountH = _register_read(MPUREG_FIFO_COUNTH); _fifoCountL = _register_read(MPUREG_FIFO_COUNTL); if(_fifoCountL == FIFO_PACKET_SIZE) { return 1; } else{ //We should not reach this point or maybe we have more than one packet (we should manage this!) FIFO_reset(); return 0; } } // FIFO_reset - reset/clear FIFO buffer used to capture attitude information from DMP void AP_InertialSensor_MPU6000::FIFO_reset() { uint8_t temp; temp = _register_read(MPUREG_USER_CTRL); temp = temp | BIT_USER_CTRL_FIFO_RESET; // FIFO RESET BIT register_write(MPUREG_USER_CTRL, temp); } // FIFO_getPacket - read an attitude packet from FIFO buffer // TO-DO: interpret results instead of just dumping into a buffer void AP_InertialSensor_MPU6000::FIFO_getPacket() { uint8_t i; int16_t q_data[4]; uint8_t addr = MPUREG_FIFO_R_W | 0x80; // Set most significant bit to indicate a read uint8_t received_packet[DMP_FIFO_BUFFER_SIZE]; // FIFO packet buffer _spi->cs_assert(); _spi->transfer(addr); // send address we want to read from for(i = 0; i < _fifoCountL; i++) { received_packet[i] = _spi->transfer(0); // request value } _spi->cs_release(); // we are using 16 bits resolution q_data[0] = (int16_t) ((((uint16_t) received_packet[0]) << 8) + ((uint16_t) received_packet[1])); q_data[1] = (int16_t) ((((uint16_t) received_packet[4]) << 8) + ((uint16_t) received_packet[5])); q_data[2] = (int16_t) ((((uint16_t) received_packet[8]) << 8) + ((uint16_t) received_packet[9])); q_data[3] = (int16_t) ((((uint16_t) received_packet[12]) << 8) + ((uint16_t) received_packet[13])); quaternion.q1 = ((float)q_data[0]) / 16384.0f; // convert from fixed point to float quaternion.q2 = ((float)q_data[2]) / 16384.0f; // convert from fixed point to float quaternion.q3 = ((float)q_data[1]) / 16384.0f; // convert from fixed point to float quaternion.q4 = ((float)-q_data[3]) / 16384.0f; // convert from fixed point to float } // dmp_set_gyro_calibration - apply default gyro calibration FS=2000dps and default orientation void AP_InertialSensor_MPU6000::dmp_set_gyro_calibration() { uint8_t regs[4]; regs[0]=0x4C; regs[1]=0xCD; regs[2]=0x6C; dmp_register_write(0x03, 0x7B, 0x03, regs); //FCFG_1 inv_set_gyro_calibration regs[0]=0x36; regs[1]=0x56; regs[2]=0x76; dmp_register_write(0x03, 0xAB, 0x03, regs); //FCFG_3 inv_set_gyro_calibration regs[0]=0x02; regs[1]=0xCB; regs[2]=0x47; regs[3]=0xA2; dmp_register_write(0x00, 0x68, 0x04, regs); //D_0_104 inv_set_gyro_calibration regs[0]=0x00; regs[1]=0x05; regs[2]=0x8B; regs[3]=0xC1; dmp_register_write(0x02, 0x18, 0x04, regs); //D_0_24 inv_set_gyro_calibration } // dmp_set_accel_calibration - apply default accel calibration scale=8g and default orientation void AP_InertialSensor_MPU6000::dmp_set_accel_calibration() { uint8_t regs[6]; regs[0]=0x00; regs[1]=0x00; regs[2]=0x00; regs[3]=0x00; dmp_register_write(0x01, 0x0C, 0x04, regs); //D_1_152 inv_set_accel_calibration regs[0]=0x0C; regs[1]=0xC9; regs[2]=0x2C; regs[3]=0x97; regs[4]=0x97; regs[5]=0x97; dmp_register_write(0x03, 0x7F, 0x06, regs); //FCFG_2 inv_set_accel_calibration regs[0]=0x26; regs[1]=0x46; regs[2]=0x66; dmp_register_write(0x03, 0x89, 0x03, regs); //FCFG_7 inv_set_accel_calibration // accel range, 0x20,0x00 => 2g, 0x10,0x00=>4g regs= (1073741824/accel_scale*65536) //regs[0]=0x20; // 2g regs[0]=0x08; // 8g regs[1]=0x00; dmp_register_write(0x00, 0x6C, 0x02, regs); //D_0_108 inv_set_accel_calibration } // dmp_apply_endian_accel - set byte order of accelerometer values? void AP_InertialSensor_MPU6000::dmp_apply_endian_accel() { uint8_t regs[4]; regs[0]=0x00; regs[1]=0x00; regs[2]=0x40; regs[3]=0x00; dmp_register_write(0x01, 0xEC, 0x04, regs); //D_1_236 inv_apply_endian_accel } // dmp_set_mpu_sensors - to configure for SIX_AXIS output void AP_InertialSensor_MPU6000::dmp_set_mpu_sensors() { uint8_t regs[6]; regs[0]=0x0C; regs[1]=0xC9; regs[2]=0x2C; regs[3]=0x97; regs[4]=0x97; regs[5]=0x97; dmp_register_write(0x03, 0x7F, 0x06, regs); //FCFG_2 inv_set_mpu_sensors(INV_SIX_AXIS_GYRO_ACCEL); } // dmp_set_bias_from_no_motion - turn on bias from no motion void AP_InertialSensor_MPU6000::dmp_set_bias_from_no_motion() { uint8_t regs[4]; regs[0]=0x0D; regs[1]=0x35; regs[2]=0x5D; dmp_register_write(0x04, 0x02, 0x03, regs); //CFG_MOTION_BIAS inv_turn_on_bias_from_no_motion regs[0]=0x87; regs[1]=0x2D; regs[2]=0x35; regs[3]=0x3D; dmp_register_write(0x04, 0x09, 0x04, regs); //FCFG_5 inv_set_bias_update( INV_BIAS_FROM_NO_MOTION ); } // dmp_set_bias_none - turn off internal bias correction (we will use this and we handle the gyro bias correction externally) void AP_InertialSensor_MPU6000::dmp_set_bias_none() { uint8_t regs[4]; regs[0]=0x98; regs[1]=0x98; regs[2]=0x98; dmp_register_write(0x04, 0x02, 0x03, regs); //CFG_MOTION_BIAS inv_turn_off_bias_from_no_motion regs[0]=0x87; regs[1]=0x2D; regs[2]=0x35; regs[3]=0x3D; dmp_register_write(0x04, 0x09, 0x04, regs); //FCFG_5 inv_set_bias_update( INV_BIAS_FROM_NO_MOTION ); } // dmp_set_fifo_interrupt void AP_InertialSensor_MPU6000::dmp_set_fifo_interrupt() { uint8_t regs[1]; regs[0]=0xFE; dmp_register_write(0x07, 0x86, 0x01, regs); //CFG_6 inv_set_fifo_interupt } // dmp_send_quaternion - send quaternion data to FIFO void AP_InertialSensor_MPU6000::dmp_send_quaternion() { uint8_t regs[5]; regs[0]=0xF1; regs[1]=0x20; regs[2]=0x28; regs[3]=0x30; regs[4]=0x38; dmp_register_write(0x07, 0x41, 0x05, regs); //CFG_8 inv_send_quaternion regs[0]=0x30; dmp_register_write(0x07, 0x7E, 0x01, regs); //CFG_16 inv_set_footer } // dmp_send_gyro - send gyro data to FIFO void AP_InertialSensor_MPU6000::dmp_send_gyro() { uint8_t regs[4]; regs[0]=0xF1; regs[1]=0x28; regs[2]=0x30; regs[3]=0x38; dmp_register_write(0x07, 0x47, 0x04, regs); //CFG_9 inv_send_gyro } // dmp_send_accel - send accel data to FIFO void AP_InertialSensor_MPU6000::dmp_send_accel() { uint8_t regs[54]; regs[0]=0xF1; regs[1]=0x28; regs[2]=0x30; regs[3]=0x38; dmp_register_write(0x07, 0x6C, 0x04, regs); //CFG_12 inv_send_accel } // This functions defines the rate at wich attitude data is send to FIFO // Rate: 0 => SAMPLE_RATE(ex:200Hz), 1=> SAMPLE_RATE/2 (ex:100Hz), 2=> SAMPLE_RATE/3 (ex:66Hz) // rate constant definitions in MPU6000.h void AP_InertialSensor_MPU6000::dmp_set_fifo_rate(uint8_t rate) { uint8_t regs[2]; regs[0]=0x00; regs[1]=rate; dmp_register_write(0x02, 0x16, 0x02, regs); //D_0_22 inv_set_fifo_rate } // This function defines the weight of the accel on the sensor fusion // default value is 0x80 // The official invensense name is inv_key_0_96 (??) void AP_InertialSensor_MPU6000::dmp_set_sensor_fusion_accel_gain(uint8_t gain) { //inv_key_0_96 register_write(MPUREG_BANK_SEL,0x00); register_write(MPUREG_MEM_START_ADDR, 0x60); _spi->cs_assert(); _spi->transfer(MPUREG_MEM_R_W); _spi->transfer(0x00); _spi->transfer(gain); // Original : 0x80 To test: 0x40, 0x20 (too less) _spi->transfer(0x00); _spi->transfer(0x00); _spi->cs_release(); } // Load initial memory values into DMP memory banks void AP_InertialSensor_MPU6000::dmp_load_mem() { for(int i = 0; i < 7; i++) { register_write(MPUREG_BANK_SEL,i); //MPUREG_BANK_SEL for(uint8_t j = 0; j < 16; j++) { uint8_t start_addy = j * 0x10; register_write(MPUREG_MEM_START_ADDR,start_addy); _spi->cs_assert(); _spi->transfer(MPUREG_MEM_R_W); for(int k = 0; k < 16; k++) { uint8_t byteToSend = pgm_read_byte((const prog_char *)&(dmpMem[i][j][k])); _spi->transfer((uint8_t) byteToSend); } _spi->cs_release(); } } register_write(MPUREG_BANK_SEL,7); //MPUREG_BANK_SEL for(uint8_t j = 0; j < 8; j++) { uint8_t start_addy = j * 0x10; register_write(MPUREG_MEM_START_ADDR,start_addy); _spi->cs_assert(); _spi->transfer(MPUREG_MEM_R_W); for(int k = 0; k < 16; k++) { uint8_t byteToSend = pgm_read_byte((const prog_char *)&(dmpMem[7][j][k])); _spi->transfer((uint8_t) byteToSend); } _spi->cs_release(); } register_write(MPUREG_MEM_START_ADDR,0x80); _spi->cs_assert(); _spi->transfer(MPUREG_MEM_R_W); for(int k = 0; k < 9; k++) { uint8_t byteToSend = pgm_read_byte((const prog_char *)&(dmpMem[7][8][k])); _spi->transfer((uint8_t) byteToSend); } _spi->cs_release(); } // ========= DMP MEMORY ================================ const uint8_t dmpMem[8][16][16] PROGMEM = { { { 0xFB, 0x00, 0x00, 0x3E, 0x00, 0x0B, 0x00, 0x36, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00 } , { 0x00, 0x65, 0x00, 0x54, 0xFF, 0xEF, 0x00, 0x00, 0xFA, 0x80, 0x00, 0x0B, 0x12, 0x82, 0x00, 0x01 } , { 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x28, 0x00, 0x00, 0xFF, 0xFF, 0x45, 0x81, 0xFF, 0xFF, 0xFA, 0x72, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x03, 0xE8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x7F, 0xFF, 0xFF, 0xFE, 0x80, 0x01 } , { 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x3E, 0x03, 0x30, 0x40, 0x00, 0x00, 0x00, 0x02, 0xCA, 0xE3, 0x09, 0x3E, 0x80, 0x00, 0x00 } , { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00 } , { 0x41, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x2A, 0x00, 0x00, 0x16, 0x55, 0x00, 0x00, 0x21, 0x82 } , { 0xFD, 0x87, 0x26, 0x50, 0xFD, 0x80, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x05, 0x80, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00 } , { 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x6F, 0x00, 0x02, 0x65, 0x32, 0x00, 0x00, 0x5E, 0xC0 } , { 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0xFB, 0x8C, 0x6F, 0x5D, 0xFD, 0x5D, 0x08, 0xD9, 0x00, 0x7C, 0x73, 0x3B, 0x00, 0x6C, 0x12, 0xCC } , { 0x32, 0x00, 0x13, 0x9D, 0x32, 0x00, 0xD0, 0xD6, 0x32, 0x00, 0x08, 0x00, 0x40, 0x00, 0x01, 0xF4 } , { 0xFF, 0xE6, 0x80, 0x79, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0xD6, 0x00, 0x00, 0x27, 0x10 } } , { { 0xFB, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0xFA, 0x36, 0xFF, 0xBC, 0x30, 0x8E, 0x00, 0x05, 0xFB, 0xF0, 0xFF, 0xD9, 0x5B, 0xC8 } , { 0xFF, 0xD0, 0x9A, 0xBE, 0x00, 0x00, 0x10, 0xA9, 0xFF, 0xF4, 0x1E, 0xB2, 0x00, 0xCE, 0xBB, 0xF7 } , { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x02, 0x02, 0x00, 0x00, 0x0C } , { 0xFF, 0xC2, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0xCF, 0x80, 0x00, 0x40, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x14 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x03, 0x3F, 0x68, 0xB6, 0x79, 0x35, 0x28, 0xBC, 0xC6, 0x7E, 0xD1, 0x6C } , { 0x80, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB2, 0x6A, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x00, 0x30 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x25, 0x4D, 0x00, 0x2F, 0x70, 0x6D, 0x00, 0x00, 0x05, 0xAE, 0x00, 0x0C, 0x02, 0xD0 } } , { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x54, 0xFF, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x01, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x01, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0xFF, 0xEF, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 } , { 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } , { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } } , { { 0xD8, 0xDC, 0xBA, 0xA2, 0xF1, 0xDE, 0xB2, 0xB8, 0xB4, 0xA8, 0x81, 0x91, 0xF7, 0x4A, 0x90, 0x7F } , { 0x91, 0x6A, 0xF3, 0xF9, 0xDB, 0xA8, 0xF9, 0xB0, 0xBA, 0xA0, 0x80, 0xF2, 0xCE, 0x81, 0xF3, 0xC2 } , { 0xF1, 0xC1, 0xF2, 0xC3, 0xF3, 0xCC, 0xA2, 0xB2, 0x80, 0xF1, 0xC6, 0xD8, 0x80, 0xBA, 0xA7, 0xDF } , { 0xDF, 0xDF, 0xF2, 0xA7, 0xC3, 0xCB, 0xC5, 0xB6, 0xF0, 0x87, 0xA2, 0x94, 0x24, 0x48, 0x70, 0x3C } , { 0x95, 0x40, 0x68, 0x34, 0x58, 0x9B, 0x78, 0xA2, 0xF1, 0x83, 0x92, 0x2D, 0x55, 0x7D, 0xD8, 0xB1 } , { 0xB4, 0xB8, 0xA1, 0xD0, 0x91, 0x80, 0xF2, 0x70, 0xF3, 0x70, 0xF2, 0x7C, 0x80, 0xA8, 0xF1, 0x01 } , { 0xB0, 0x98, 0x87, 0xD9, 0x43, 0xD8, 0x86, 0xC9, 0x88, 0xBA, 0xA1, 0xF2, 0x0E, 0xB8, 0x97, 0x80 } , { 0xF1, 0xA9, 0xDF, 0xDF, 0xDF, 0xAA, 0xDF, 0xDF, 0xDF, 0xF2, 0xAA, 0xC5, 0xCD, 0xC7, 0xA9, 0x0C } , { 0xC9, 0x2C, 0x97, 0x97, 0x97, 0x97, 0xF1, 0xA9, 0x89, 0x26, 0x46, 0x66, 0xB0, 0xB4, 0xBA, 0x80 } , { 0xAC, 0xDE, 0xF2, 0xCA, 0xF1, 0xB2, 0x8C, 0x02, 0xA9, 0xB6, 0x98, 0x00, 0x89, 0x0E, 0x16, 0x1E } , { 0xB8, 0xA9, 0xB4, 0x99, 0x2C, 0x54, 0x7C, 0xB0, 0x8A, 0xA8, 0x96, 0x36, 0x56, 0x76, 0xF1, 0xB9 } , { 0xAF, 0xB4, 0xB0, 0x83, 0xC0, 0xB8, 0xA8, 0x97, 0x11, 0xB1, 0x8F, 0x98, 0xB9, 0xAF, 0xF0, 0x24 } , { 0x08, 0x44, 0x10, 0x64, 0x18, 0xF1, 0xA3, 0x29, 0x55, 0x7D, 0xAF, 0x83, 0xB5, 0x93, 0xAF, 0xF0 } , { 0x00, 0x28, 0x50, 0xF1, 0xA3, 0x86, 0x9F, 0x61, 0xA6, 0xDA, 0xDE, 0xDF, 0xD9, 0xFA, 0xA3, 0x86 } , { 0x96, 0xDB, 0x31, 0xA6, 0xD9, 0xF8, 0xDF, 0xBA, 0xA6, 0x8F, 0xC2, 0xC5, 0xC7, 0xB2, 0x8C, 0xC1 } , { 0xB8, 0xA2, 0xDF, 0xDF, 0xDF, 0xA3, 0xDF, 0xDF, 0xDF, 0xD8, 0xD8, 0xF1, 0xB8, 0xA8, 0xB2, 0x86 } } , { { 0xB4, 0x98, 0x0D, 0x35, 0x5D, 0xB8, 0xAA, 0x98, 0xB0, 0x87, 0x2D, 0x35, 0x3D, 0xB2, 0xB6, 0xBA } , { 0xAF, 0x8C, 0x96, 0x19, 0x8F, 0x9F, 0xA7, 0x0E, 0x16, 0x1E, 0xB4, 0x9A, 0xB8, 0xAA, 0x87, 0x2C } , { 0x54, 0x7C, 0xB9, 0xA3, 0xDE, 0xDF, 0xDF, 0xA3, 0xB1, 0x80, 0xF2, 0xC4, 0xCD, 0xC9, 0xF1, 0xB8 } , { 0xA9, 0xB4, 0x99, 0x83, 0x0D, 0x35, 0x5D, 0x89, 0xB9, 0xA3, 0x2D, 0x55, 0x7D, 0xB5, 0x93, 0xA3 } , { 0x0E, 0x16, 0x1E, 0xA9, 0x2C, 0x54, 0x7C, 0xB8, 0xB4, 0xB0, 0xF1, 0x97, 0x83, 0xA8, 0x11, 0x84 } , { 0xA5, 0x09, 0x98, 0xA3, 0x83, 0xF0, 0xDA, 0x24, 0x08, 0x44, 0x10, 0x64, 0x18, 0xD8, 0xF1, 0xA5 } , { 0x29, 0x55, 0x7D, 0xA5, 0x85, 0x95, 0x02, 0x1A, 0x2E, 0x3A, 0x56, 0x5A, 0x40, 0x48, 0xF9, 0xF3 } , { 0xA3, 0xD9, 0xF8, 0xF0, 0x98, 0x83, 0x24, 0x08, 0x44, 0x10, 0x64, 0x18, 0x97, 0x82, 0xA8, 0xF1 } , { 0x11, 0xF0, 0x98, 0xA2, 0x24, 0x08, 0x44, 0x10, 0x64, 0x18, 0xDA, 0xF3, 0xDE, 0xD8, 0x83, 0xA5 } , { 0x94, 0x01, 0xD9, 0xA3, 0x02, 0xF1, 0xA2, 0xC3, 0xC5, 0xC7, 0xD8, 0xF1, 0x84, 0x92, 0xA2, 0x4D } , { 0xDA, 0x2A, 0xD8, 0x48, 0x69, 0xD9, 0x2A, 0xD8, 0x68, 0x55, 0xDA, 0x32, 0xD8, 0x50, 0x71, 0xD9 } , { 0x32, 0xD8, 0x70, 0x5D, 0xDA, 0x3A, 0xD8, 0x58, 0x79, 0xD9, 0x3A, 0xD8, 0x78, 0x93, 0xA3, 0x4D } , { 0xDA, 0x2A, 0xD8, 0x48, 0x69, 0xD9, 0x2A, 0xD8, 0x68, 0x55, 0xDA, 0x32, 0xD8, 0x50, 0x71, 0xD9 } , { 0x32, 0xD8, 0x70, 0x5D, 0xDA, 0x3A, 0xD8, 0x58, 0x79, 0xD9, 0x3A, 0xD8, 0x78, 0xA8, 0x8A, 0x9A } , { 0xF0, 0x28, 0x50, 0x78, 0x9E, 0xF3, 0x88, 0x18, 0xF1, 0x9F, 0x1D, 0x98, 0xA8, 0xD9, 0x08, 0xD8 } , { 0xC8, 0x9F, 0x12, 0x9E, 0xF3, 0x15, 0xA8, 0xDA, 0x12, 0x10, 0xD8, 0xF1, 0xAF, 0xC8, 0x97, 0x87 } } , { { 0x34, 0xB5, 0xB9, 0x94, 0xA4, 0x21, 0xF3, 0xD9, 0x22, 0xD8, 0xF2, 0x2D, 0xF3, 0xD9, 0x2A, 0xD8 } , { 0xF2, 0x35, 0xF3, 0xD9, 0x32, 0xD8, 0x81, 0xA4, 0x60, 0x60, 0x61, 0xD9, 0x61, 0xD8, 0x6C, 0x68 } , { 0x69, 0xD9, 0x69, 0xD8, 0x74, 0x70, 0x71, 0xD9, 0x71, 0xD8, 0xB1, 0xA3, 0x84, 0x19, 0x3D, 0x5D } , { 0xA3, 0x83, 0x1A, 0x3E, 0x5E, 0x93, 0x10, 0x30, 0x81, 0x10, 0x11, 0xB8, 0xB0, 0xAF, 0x8F, 0x94 } , { 0xF2, 0xDA, 0x3E, 0xD8, 0xB4, 0x9A, 0xA8, 0x87, 0x29, 0xDA, 0xF8, 0xD8, 0x87, 0x9A, 0x35, 0xDA } , { 0xF8, 0xD8, 0x87, 0x9A, 0x3D, 0xDA, 0xF8, 0xD8, 0xB1, 0xB9, 0xA4, 0x98, 0x85, 0x02, 0x2E, 0x56 } , { 0xA5, 0x81, 0x00, 0x0C, 0x14, 0xA3, 0x97, 0xB0, 0x8A, 0xF1, 0x2D, 0xD9, 0x28, 0xD8, 0x4D, 0xD9 } , { 0x48, 0xD8, 0x6D, 0xD9, 0x68, 0xD8, 0xB1, 0x84, 0x0D, 0xDA, 0x0E, 0xD8, 0xA3, 0x29, 0x83, 0xDA } , { 0x2C, 0x0E, 0xD8, 0xA3, 0x84, 0x49, 0x83, 0xDA, 0x2C, 0x4C, 0x0E, 0xD8, 0xB8, 0xB0, 0xA8, 0x8A } , { 0x9A, 0xF5, 0x20, 0xAA, 0xDA, 0xDF, 0xD8, 0xA8, 0x40, 0xAA, 0xD0, 0xDA, 0xDE, 0xD8, 0xA8, 0x60 } , { 0xAA, 0xDA, 0xD0, 0xDF, 0xD8, 0xF1, 0x97, 0x86, 0xA8, 0x31, 0x9B, 0x06, 0x99, 0x07, 0xAB, 0x97 } , { 0x28, 0x88, 0x9B, 0xF0, 0x0C, 0x20, 0x14, 0x40, 0xB8, 0xB0, 0xB4, 0xA8, 0x8C, 0x9C, 0xF0, 0x04 } , { 0x28, 0x51, 0x79, 0x1D, 0x30, 0x14, 0x38, 0xB2, 0x82, 0xAB, 0xD0, 0x98, 0x2C, 0x50, 0x50, 0x78 } , { 0x78, 0x9B, 0xF1, 0x1A, 0xB0, 0xF0, 0x8A, 0x9C, 0xA8, 0x29, 0x51, 0x79, 0x8B, 0x29, 0x51, 0x79 } , { 0x8A, 0x24, 0x70, 0x59, 0x8B, 0x20, 0x58, 0x71, 0x8A, 0x44, 0x69, 0x38, 0x8B, 0x39, 0x40, 0x68 } , { 0x8A, 0x64, 0x48, 0x31, 0x8B, 0x30, 0x49, 0x60, 0xA5, 0x88, 0x20, 0x09, 0x71, 0x58, 0x44, 0x68 } } , { { 0x11, 0x39, 0x64, 0x49, 0x30, 0x19, 0xF1, 0xAC, 0x00, 0x2C, 0x54, 0x7C, 0xF0, 0x8C, 0xA8, 0x04 } , { 0x28, 0x50, 0x78, 0xF1, 0x88, 0x97, 0x26, 0xA8, 0x59, 0x98, 0xAC, 0x8C, 0x02, 0x26, 0x46, 0x66 } , { 0xF0, 0x89, 0x9C, 0xA8, 0x29, 0x51, 0x79, 0x24, 0x70, 0x59, 0x44, 0x69, 0x38, 0x64, 0x48, 0x31 } , { 0xA9, 0x88, 0x09, 0x20, 0x59, 0x70, 0xAB, 0x11, 0x38, 0x40, 0x69, 0xA8, 0x19, 0x31, 0x48, 0x60 } , { 0x8C, 0xA8, 0x3C, 0x41, 0x5C, 0x20, 0x7C, 0x00, 0xF1, 0x87, 0x98, 0x19, 0x86, 0xA8, 0x6E, 0x76 } , { 0x7E, 0xA9, 0x99, 0x88, 0x2D, 0x55, 0x7D, 0x9E, 0xB9, 0xA3, 0x8A, 0x22, 0x8A, 0x6E, 0x8A, 0x56 } , { 0x8A, 0x5E, 0x9F, 0xB1, 0x83, 0x06, 0x26, 0x46, 0x66, 0x0E, 0x2E, 0x4E, 0x6E, 0x9D, 0xB8, 0xAD } , { 0x00, 0x2C, 0x54, 0x7C, 0xF2, 0xB1, 0x8C, 0xB4, 0x99, 0xB9, 0xA3, 0x2D, 0x55, 0x7D, 0x81, 0x91 } , { 0xAC, 0x38, 0xAD, 0x3A, 0xB5, 0x83, 0x91, 0xAC, 0x2D, 0xD9, 0x28, 0xD8, 0x4D, 0xD9, 0x48, 0xD8 } , { 0x6D, 0xD9, 0x68, 0xD8, 0x8C, 0x9D, 0xAE, 0x29, 0xD9, 0x04, 0xAE, 0xD8, 0x51, 0xD9, 0x04, 0xAE } , { 0xD8, 0x79, 0xD9, 0x04, 0xD8, 0x81, 0xF3, 0x9D, 0xAD, 0x00, 0x8D, 0xAE, 0x19, 0x81, 0xAD, 0xD9 } , { 0x01, 0xD8, 0xF2, 0xAE, 0xDA, 0x26, 0xD8, 0x8E, 0x91, 0x29, 0x83, 0xA7, 0xD9, 0xAD, 0xAD, 0xAD } , { 0xAD, 0xF3, 0x2A, 0xD8, 0xD8, 0xF1, 0xB0, 0xAC, 0x89, 0x91, 0x3E, 0x5E, 0x76, 0xF3, 0xAC, 0x2E } , { 0x2E, 0xF1, 0xB1, 0x8C, 0x5A, 0x9C, 0xAC, 0x2C, 0x28, 0x28, 0x28, 0x9C, 0xAC, 0x30, 0x18, 0xA8 } , { 0x98, 0x81, 0x28, 0x34, 0x3C, 0x97, 0x24, 0xA7, 0x28, 0x34, 0x3C, 0x9C, 0x24, 0xF2, 0xB0, 0x89 } , { 0xAC, 0x91, 0x2C, 0x4C, 0x6C, 0x8A, 0x9B, 0x2D, 0xD9, 0xD8, 0xD8, 0x51, 0xD9, 0xD8, 0xD8, 0x79 } } , { { 0xD9, 0xD8, 0xD8, 0xF1, 0x9E, 0x88, 0xA3, 0x31, 0xDA, 0xD8, 0xD8, 0x91, 0x2D, 0xD9, 0x28, 0xD8 } , { 0x4D, 0xD9, 0x48, 0xD8, 0x6D, 0xD9, 0x68, 0xD8, 0xB1, 0x83, 0x93, 0x35, 0x3D, 0x80, 0x25, 0xDA } , { 0xD8, 0xD8, 0x85, 0x69, 0xDA, 0xD8, 0xD8, 0xB4, 0x93, 0x81, 0xA3, 0x28, 0x34, 0x3C, 0xF3, 0xAB } , { 0x8B, 0xF8, 0xA3, 0x91, 0xB6, 0x09, 0xB4, 0xD9, 0xAB, 0xDE, 0xFA, 0xB0, 0x87, 0x9C, 0xB9, 0xA3 } , { 0xDD, 0xF1, 0xA3, 0xA3, 0xA3, 0xA3, 0x95, 0xF1, 0xA3, 0xA3, 0xA3, 0x9D, 0xF1, 0xA3, 0xA3, 0xA3 } , { 0xA3, 0xF2, 0xA3, 0xB4, 0x90, 0x80, 0xF2, 0xA3, 0xA3, 0xA3, 0xA3, 0xA3, 0xA3, 0xA3, 0xA3, 0xA3 } , { 0xA3, 0xB2, 0xA3, 0xA3, 0xA3, 0xA3, 0xA3, 0xA3, 0xB0, 0x87, 0xB5, 0x99, 0xF1, 0xA3, 0xA3, 0xA3 } , { 0x98, 0xF1, 0xA3, 0xA3, 0xA3, 0xA3, 0x97, 0xA3, 0xA3, 0xA3, 0xA3, 0xF3, 0x9B, 0xA3, 0xA3, 0xDC } , { 0xB9, 0xA7, 0xF1, 0x26, 0x26, 0x26, 0xD8, 0xD8, 0xFF } } };
andybarry/ardupilot
libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp
C++
gpl-3.0
60,871
<?php /** * @package Mautic * @copyright 2014 Mautic Contributors. All rights reserved. * @author Mautic * @link http://mautic.org * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ namespace MauticPlugin\MauticCrmBundle; use Mautic\PluginBundle\Bundle\PluginBundleBase; /** * Class MauticCrmBundle * * @package MauticPlugin\MauticCrmBundle */ class MauticCrmBundle extends PluginBundleBase { }
viniciusferreira/mautic
plugins/MauticCrmBundle/MauticCrmBundle.php
PHP
gpl-3.0
444
<?php namespace Neos\ContentRepository\Tests\Functional\Domain\Fixtures; /* * This file is part of the Neos.ContentRepository package. * * (c) Contributors of the Neos Project - www.neos.io * * This package is Open Source Software. For the full copyright and license * information, please view the LICENSE file which was distributed with this * source code. */ use Neos\ContentRepository\Domain\Model\Node; /** * A happier node than the default node that can clap hands to show it! */ class HappyNode extends Node { /** * @return string */ public function clapsHands() { return $this->getName() . ' claps hands!'; } }
neos/typo3cr
Tests/Functional/Domain/Fixtures/HappyNode.php
PHP
gpl-3.0
665
/*===================================================================== QGroundControl Open Source Ground Control Station (c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org> This file is part of the QGROUNDCONTROL project QGROUNDCONTROL 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. QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>. ======================================================================*/ /// @file /// @brief Command line option parser /// /// @author Don Gagne <don@thegagnes.com> #include "CmdLineOptParser.h" #include <QString> /// @brief Implements a simple command line parser which sets booleans to true if the option is found. void ParseCmdLineOptions(int& argc, ///< count of arguments in argv char* argv[], ///< command line arguments CmdLineOpt_t* prgOpts, ///< command line options size_t cOpts, ///< count of command line options bool removeParsedOptions) ///< true: remove parsed option from argc/argv { // Start with all options off for (size_t iOption=0; iOption<cOpts; iOption++) { *prgOpts[iOption].optionFound = false; } for (int iArg=1; iArg<argc; iArg++) { for (size_t iOption=0; iOption<cOpts; iOption++) { bool found = false; QString arg(argv[iArg]); QString optionStr(prgOpts[iOption].optionStr); if (arg.startsWith(QString("%1:").arg(optionStr), Qt::CaseInsensitive)) { found = true; prgOpts[iOption].optionArg = arg.right(arg.length() - (optionStr.length() + 1)); } else if (arg.compare(optionStr, Qt::CaseInsensitive) == 0) { found = true; } if (found) { *prgOpts[iOption].optionFound = true; if (removeParsedOptions) { for (int iShift=iArg; iShift<argc-1; iShift++) { argv[iShift] = argv[iShift+1]; } argc--; iArg--; } } } } }
caoxiongkun/qgroundcontrol
src/CmdLineOptParser.cc
C++
agpl-3.0
2,813
// --------------------------------------------------------------------- // // Copyright (C) 2003 - 2015 by the deal.II authors // // This file is part of the deal.II library. // // The deal.II library is free software; you can use it, 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. // The full text of the license can be found in the file LICENSE at // the top level of the deal.II distribution. // // --------------------------------------------------------------------- // check ConeBoundary and GridGenerator::truncated_cone #include "../tests.h" #include <deal.II/base/logstream.h> #include <deal.II/base/quadrature_lib.h> #include <deal.II/grid/tria.h> #include <deal.II/grid/tria_boundary_lib.h> #include <deal.II/grid/tria_accessor.h> #include <deal.II/grid/tria_iterator.h> #include <deal.II/grid/grid_generator.h> #include <deal.II/grid/grid_out.h> #include <deal.II/dofs/dof_handler.h> #include <deal.II/fe/fe_q.h> #include <deal.II/fe/fe_values.h> #include <deal.II/fe/mapping_c1.h> #include <fstream> template <int dim> void check () { Triangulation<dim> triangulation; GridGenerator::truncated_cone (triangulation); Point<dim> p1, p2; p1[0] = -1; p2[0] = 1; static const ConeBoundary<dim> boundary (1, 0.5, p1, p2); triangulation.set_boundary (0, boundary); triangulation.refine_global (2); GridOut().write_gnuplot (triangulation, deallog.get_file_stream()); } int main () { std::ofstream logfile("output"); deallog.attach(logfile); deallog.threshold_double(1.e-10); check<2> (); check<3> (); }
pesser/dealii
tests/bits/cone_01.cc
C++
lgpl-2.1
1,753
//* This file is part of the MOOSE framework //* https://www.mooseframework.org //* //* All rights reserved, see COPYRIGHT for full restrictions //* https://github.com/idaholab/moose/blob/master/COPYRIGHT //* //* Licensed under LGPL 2.1, please see LICENSE for details //* https://www.gnu.org/licenses/lgpl-2.1.html #include "AreaPostprocessor.h" registerMooseObject("MooseApp", AreaPostprocessor); defineLegacyParams(AreaPostprocessor); InputParameters AreaPostprocessor::validParams() { InputParameters params = SideIntegralPostprocessor::validParams(); params.addClassDescription("Computes the \"area\" or dimension - 1 \"volume\" of a given " "boundary or boundaries in your mesh."); return params; } AreaPostprocessor::AreaPostprocessor(const InputParameters & parameters) : SideIntegralPostprocessor(parameters) { } void AreaPostprocessor::threadJoin(const UserObject & y) { const AreaPostprocessor & pps = static_cast<const AreaPostprocessor &>(y); _integral_value += pps._integral_value; } Real AreaPostprocessor::computeQpIntegral() { return 1.0; }
nuclear-wizard/moose
framework/src/postprocessors/AreaPostprocessor.C
C++
lgpl-2.1
1,109
# Import the SlideSet base class import math from ..slidesets import RemarkSlideSet ## # A special set of slides for creating cover page and contents class MergeCoverSet(RemarkSlideSet): ## # Extract the valid parameters for this object @staticmethod def validParams(): params = RemarkSlideSet.validParams() params.addRequiredParam('slide_sets', 'A vector of slideset names to combine into a single contents') return params def __init__(self, name, params, **kwargs): RemarkSlideSet.__init__(self, name, params) # The SlideSetWarehoue self.__warehouse = self.getParam('_warehouse') # Build a list of sets to merge self.__merge_list = self.getParam('slide_sets').split() ## # Search through all the slides in the specified slide sets for table of contents content def _extractContents(self): # print len(self.__merge_list) # print self.__merge_list # Count the number of contents entries contents = [] for obj in self.__warehouse.objects: if (obj is not self) and (len(self.__merge_list) == 0 or obj.name() in self.__merge_list): # print 'TUTORIAL_SUMMARY_COVER:', obj.name() pages = obj._extractContents() for page in pages: contents += page n = int(self.getParam('contents_items_per_slide')) output = [contents[i:i+n] for i in range(0, len(contents),n)] return output
danielru/moose
python/PresentationBuilder/slidesets/MergeCoverSet.py
Python
lgpl-2.1
1,395
/** * This component provides a grid holding selected items from a second store of potential * members. The `store` of this component represents the selected items. The `searchStore` * represents the potentially selected items. * * The default view defined by this class is intended to be easily replaced by deriving a * new class and overriding the appropriate methods. For example, the following is a very * different view that uses a date range and a data view: * * Ext.define('App.view.DateBoundSearch', { * extend: 'Ext.view.MultiSelectorSearch', * * makeDockedItems: function () { * return { * xtype: 'toolbar', * items: [{ * xtype: 'datefield', * emptyText: 'Start date...', * flex: 1 * },{ * xtype: 'datefield', * emptyText: 'End date...', * flex: 1 * }] * }; * }, * * makeItems: function () { * return [{ * xtype: 'dataview', * itemSelector: '.search-item', * selModel: 'rowselection', * store: this.store, * scrollable: true, * tpl: * '<tpl for=".">' + * '<div class="search-item">' + * '<img src="{icon}">' + * '<div>{name}</div>' + * '</div>' + * '</tpl>' * }]; * }, * * getSearchStore: function () { * return this.items.getAt(0).getStore(); * }, * * selectRecords: function (records) { * var view = this.items.getAt(0); * return view.getSelectionModel().select(records); * } * }); * * **Important**: This class assumes there are two components with specific `reference` * names assigned to them. These are `"searchField"` and `"searchGrid"`. These components * are produced by the `makeDockedItems` and `makeItems` method, respectively. When * overriding these it is important to remember to place these `reference` values on the * appropriate components. */ Ext.define('Ext.view.MultiSelectorSearch', { extend: 'Ext.panel.Panel', xtype: 'multiselector-search', layout: 'fit', floating: true, resizable: true, minWidth: 200, minHeight: 200, border: true, defaultListenerScope: true, referenceHolder: true, /** * @cfg {String} searchText * This text is displayed as the "emptyText" of the search `textfield`. */ searchText: 'Search...', initComponent: function () { var me = this, owner = me.owner, items = me.makeItems(), i, item, records, store; me.dockedItems = me.makeDockedItems(); me.items = items; store = Ext.data.StoreManager.lookup(me.store); for (i = items.length; i--; ) { if ((item = items[i]).xtype === 'grid') { item.store = store; item.isSearchGrid = true; item.selModel = item.selModel || { type: 'checkboxmodel', pruneRemoved: false, listeners: { selectionchange: 'onSelectionChange' } }; Ext.merge(item, me.grid); if (!item.columns) { item.hideHeaders = true; item.columns = [{ flex: 1, dataIndex: me.field }]; } break; } } me.callParent(); records = me.getOwnerStore().getRange(); if (!owner.convertSelectionRecord.$nullFn) { for (i = records.length; i--; ) { records[i] = owner.convertSelectionRecord(records[i]); } } if (store.isLoading() || (store.loadCount === 0 && !store.getCount())) { store.on('load', function() { if (!me.isDestroyed) { me.selectRecords(records); } }, null, {single: true}); } else { me.selectRecords(records); } }, getOwnerStore: function() { return this.owner.getStore(); }, afterShow: function () { var searchField = this.lookupReference('searchField'); this.callParent(arguments); if (searchField) { searchField.focus(); } }, /** * Returns the store that holds search results. By default this comes from the * "search grid". If this aspect of the view is changed sufficiently so that the * search grid cannot be found, this method should be overridden to return the proper * store. * @return {Ext.data.Store} */ getSearchStore: function () { var searchGrid = this.lookupReference('searchGrid'); return searchGrid.getStore(); }, makeDockedItems: function () { return [{ xtype: 'textfield', reference: 'searchField', dock: 'top', hideFieldLabel: true, emptyText: this.searchText, triggers: { clear: { cls: Ext.baseCSSPrefix + 'form-clear-trigger', handler: 'onClearSearch', hidden: true } }, listeners: { change: 'onSearchChange', buffer: 300 } }]; }, makeItems: function () { return [{ xtype: 'grid', reference: 'searchGrid', trailingBufferZone: 2, leadingBufferZone: 2, viewConfig: { deferEmptyText: false, emptyText: 'No results.' } }]; }, selectRecords: function (records) { var searchGrid = this.lookupReference('searchGrid'); return searchGrid.getSelectionModel().select(records); }, deselectRecords: function(records) { var searchGrid = this.lookupReference('searchGrid'); return searchGrid.getSelectionModel().deselect(records); }, search: function (text) { var me = this, filter = me.searchFilter, filters = me.getSearchStore().getFilters(); if (text) { filters.beginUpdate(); if (filter) { filter.setValue(text); } else { me.searchFilter = filter = new Ext.util.Filter({ id: 'search', property: me.field, value: text }); } filters.add(filter); filters.endUpdate(); } else if (filter) { filters.remove(filter); } }, privates: { onClearSearch: function () { var searchField = this.lookupReference('searchField'); searchField.setValue(null); searchField.focus(); }, onSearchChange: function (searchField) { var value = searchField.getValue(), trigger = searchField.getTrigger('clear'); trigger.setHidden(!value); this.search(value); }, onSelectionChange: function (selModel, selection) { var owner = this.owner, store = owner.getStore(), data = store.data, remove = 0, map = {}, add, i, id, record; for (i = selection.length; i--; ) { record = selection[i]; id = record.id; map[id] = record; if (!data.containsKey(id)) { (add || (add = [])).push(owner.convertSearchRecord(record)); } } for (i = data.length; i--; ) { record = data.getAt(i); if (!map[record.id]) { (remove || (remove = [])).push(record); } } if (add || remove) { data.splice(data.length, remove, add); } } } });
department-of-veterans-affairs/ChartReview
web-app/js/ext-5.1.0/src/view/MultiSelectorSearch.js
JavaScript
apache-2.0
8,477
// // Copyright (c) Microsoft and contributors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and // limitations under the License. // var assert = require('assert'); var fs = require('fs'); var path = require('path'); var util = require('util'); var sinon = require('sinon'); var url = require('url'); var request = require('request'); // Test includes var testutil = require('../../util/util'); var blobtestutil = require('../../framework/blob-test-utils'); // Lib includes var common = require('azure-common'); var storage = testutil.libRequire('services/legacyStorage'); var azureutil = common.util; var azure = testutil.libRequire('azure'); var WebResource = common.WebResource; var SharedAccessSignature = storage.SharedAccessSignature; var BlobService = storage.BlobService; var ServiceClient = common.ServiceClient; var ExponentialRetryPolicyFilter = common.ExponentialRetryPolicyFilter; var Constants = common.Constants; var BlobConstants = Constants.BlobConstants; var HttpConstants = Constants.HttpConstants; var ServiceClientConstants = common.ServiceClientConstants; var QueryStringConstants = Constants.QueryStringConstants; var containerNames = []; var containerNamesPrefix = 'cont'; var blobNames = []; var blobNamesPrefix = 'blob'; var testPrefix = 'blobservice-tests'; var blobService; var suiteUtil; describe('BlobService', function () { before(function (done) { blobService = storage.createBlobService() .withFilter(new common.ExponentialRetryPolicyFilter()); suiteUtil = blobtestutil.createBlobTestUtils(blobService, testPrefix); suiteUtil.setupSuite(done); }); after(function (done) { suiteUtil.teardownSuite(done); }); beforeEach(function (done) { suiteUtil.setupTest(done); }); afterEach(function (done) { suiteUtil.teardownTest(done); }); describe('createContainer', function () { it('should detect incorrect container names', function (done) { assert.throws(function () { blobService.createContainer(null, function () { }); }, BlobService.incorrectContainerNameErr); assert.throws(function () { blobService.createContainer('', function () { }); }, BlobService.incorrectContainerNameErr); assert.throws(function () { blobService.createContainer('as', function () { }); }, BlobService.incorrectContainerNameFormatErr); assert.throws(function () { blobService.createContainer('a--s', function () { }); }, BlobService.incorrectContainerNameFormatErr); assert.throws(function () { blobService.createContainer('cont-', function () { }); }, BlobService.incorrectContainerNameFormatErr); assert.throws(function () { blobService.createContainer('conTain', function () { }); }, BlobService.incorrectContainerNameFormatErr); done(); }); it('should work', function (done) { var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); blobService.createContainer(containerName, function (createError, container1, createContainerResponse) { assert.equal(createError, null); assert.notEqual(container1, null); if (container1) { assert.notEqual(container1.name, null); assert.notEqual(container1.etag, null); assert.notEqual(container1.lastModified, null); } assert.equal(createContainerResponse.statusCode, HttpConstants.HttpResponseCodes.Created); // creating again will result in a duplicate error blobService.createContainer(containerName, function (createError2, container2) { assert.equal(createError2.code, Constants.BlobErrorCodeStrings.CONTAINER_ALREADY_EXISTS); assert.equal(container2, null); done(); }); }); }); }); describe('blobExists', function () { it('should detect incorrect blob names', function (done) { assert.throws(function () { blobService.blobExists('container', null, function () { }); }, BlobService.incorrectBlobNameFormatErr); assert.throws(function () { blobService.blobExists('container', '', function () { }); }, BlobService.incorrectBlobNameFormatErr); done(); }); }); describe('getServiceProperties', function () { it('should get blob service properties', function (done) { blobService.getServiceProperties(function (error, serviceProperties) { assert.equal(error, null); assert.notEqual(serviceProperties, null); if (serviceProperties) { assert.notEqual(serviceProperties.Logging, null); if (serviceProperties.Logging) { assert.notEqual(serviceProperties.Logging.RetentionPolicy); assert.notEqual(serviceProperties.Logging.Version); } if (serviceProperties.Metrics) { assert.notEqual(serviceProperties.Metrics, null); assert.notEqual(serviceProperties.Metrics.RetentionPolicy); assert.notEqual(serviceProperties.Metrics.Version); } } done(); }); }); }); describe('getServiceProperties', function () { it('should set blob service properties', function (done) { blobService.getServiceProperties(function (error, serviceProperties) { assert.equal(error, null); serviceProperties.DefaultServiceVersion = '2009-09-19'; serviceProperties.Logging.Read = true; blobService.setServiceProperties(serviceProperties, function (error2) { assert.equal(error2, null); blobService.getServiceProperties(function (error3, serviceProperties2) { assert.equal(error3, null); assert.equal(serviceProperties2.DefaultServiceVersion, '2009-09-19'); assert.equal(serviceProperties2.Logging.Read, true); done(); }); }); }); }); }); describe('listContainers', function () { it('should work', function (done) { var containerName1 = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var metadata1 = { color: 'orange', containernumber: '01', somemetadataname: 'SomeMetadataValue' }; var containerName2 = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var metadata2 = { color: 'pink', containernumber: '02', somemetadataname: 'SomeMetadataValue' }; var containerName3 = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var metadata3 = { color: 'brown', containernumber: '03', somemetadataname: 'SomeMetadataValue' }; var containerName4 = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var metadata4 = { color: 'blue', containernumber: '04', somemetadataname: 'SomeMetadataValue' }; var validateContainers = function (containers, entries) { containers.forEach(function (container) { if (container.name == containerName1) { assert.equal(container.metadata.color, metadata1.color); assert.equal(container.metadata.containernumber, metadata1.containernumber); assert.equal(container.metadata.somemetadataname, metadata1.somemetadataname); entries.push(container.name); } else if (container.name == containerName2) { assert.equal(container.metadata.color, metadata2.color); assert.equal(container.metadata.containernumber, metadata2.containernumber); assert.equal(container.metadata.somemetadataname, metadata2.somemetadataname); entries.push(container.name); } else if (container.name == containerName3) { assert.equal(container.metadata.color, metadata3.color); assert.equal(container.metadata.containernumber, metadata3.containernumber); assert.equal(container.metadata.somemetadataname, metadata3.somemetadataname); entries.push(container.name); } else if (container.name == containerName4) { assert.equal(container.metadata.color, metadata4.color); assert.equal(container.metadata.containernumber, metadata4.containernumber); assert.equal(container.metadata.somemetadataname, metadata4.somemetadataname); entries.push(container.name); } }); return entries; }; blobService.createContainer(containerName1, { metadata: metadata1 }, function (createError1, createContainer1, createResponse1) { assert.equal(createError1, null); assert.notEqual(createContainer1, null); assert.ok(createResponse1.isSuccessful); blobService.createContainer(containerName2, { metadata: metadata2 }, function (createError2, createContainer2, createResponse2) { assert.equal(createError2, null); assert.notEqual(createContainer2, null); assert.ok(createResponse2.isSuccessful); blobService.createContainer(containerName3, { metadata: metadata3 }, function (createError3, createContainer3, createResponse3) { assert.equal(createError3, null); assert.notEqual(createContainer3, null); assert.ok(createResponse3.isSuccessful); blobService.createContainer(containerName4, { metadata: metadata4 }, function (createError4, createContainer4, createResponse4) { assert.equal(createError4, null); assert.notEqual(createContainer4, null); assert.ok(createResponse4.isSuccessful); var options = { 'maxresults': 3, 'include': 'metadata' }; blobService.listContainers(options, function (listError, containers, containersContinuation, listResponse) { assert.equal(listError, null); assert.ok(listResponse.isSuccessful); assert.equal(containers.length, 3); var entries = validateContainers(containers, []); assert.equal(containersContinuation.hasNextPage(), true); containersContinuation.getNextPage(function (listErrorContinuation, containers2) { assert.equal(listErrorContinuation, null); assert.ok(listResponse.isSuccessful); validateContainers(containers2, entries); assert.equal(entries.length, 4); done(); }); }); }); }); }); }); }); it('should work with optional parameters', function (done) { blobService.listContainers(null, function (err) { assert.equal(err, null); done(); }); }); it('should work with prefix parameter', function (done) { blobService.listContainers({ prefix : '中文' }, function (err) { assert.equal(err, null); done(); }); }); }); describe('createContainerIfNotExists', function() { it('should create a container if not exists', function (done) { var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); blobService.createContainer(containerName, function (createError, container1, createContainerResponse) { assert.equal(createError, null); assert.notEqual(container1, null); if (container1) { assert.notEqual(container1.name, null); assert.notEqual(container1.etag, null); assert.notEqual(container1.lastModified, null); } assert.equal(createContainerResponse.statusCode, HttpConstants.HttpResponseCodes.Created); // creating again will result in a duplicate error blobService.createContainerIfNotExists(containerName, function (createError2, isCreated) { assert.equal(createError2, null); assert.equal(isCreated, false); done(); }); }); }); it('should throw if called with a callback', function (done) { assert.throws(function () { blobService.createContainerIfNotExists('name'); }, Error ); done(); }); }); describe('container', function () { var containerName; var metadata; beforeEach(function (done) { containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); metadata = { color: 'blue' }; blobService.createContainer(containerName, { metadata: metadata }, done); }); describe('getContainerProperties', function () { it('should work', function (done) { blobService.getContainerProperties(containerName, function (getError, container2, getResponse) { assert.equal(getError, null); assert.notEqual(container2, null); if (container2) { assert.equal('unlocked', container2.leaseStatus); assert.equal('available', container2.leaseState); assert.equal(null, container2.leaseDuration); assert.notEqual(null, container2.requestId); assert.equal(container2.metadata.color, metadata.color); } assert.notEqual(getResponse, null); assert.equal(getResponse.isSuccessful, true); done(); }); }); }); describe('setContainerMetadata', function () { it('should work', function (done) { var metadata = { 'class': 'test' }; blobService.setContainerMetadata(containerName, metadata, function (setMetadataError, setMetadataResponse) { assert.equal(setMetadataError, null); assert.ok(setMetadataResponse.isSuccessful); blobService.getContainerMetadata(containerName, function (getMetadataError, containerMetadata, getMetadataResponse) { assert.equal(getMetadataError, null); assert.notEqual(containerMetadata, null); assert.notEqual(containerMetadata.metadata, null); if (containerMetadata.metadata) { assert.equal(containerMetadata.metadata.class, 'test'); } assert.ok(getMetadataResponse.isSuccessful); done(); }); }); }); }); describe('getContainerAcl', function () { it('should work', function (done) { blobService.getContainerAcl(containerName, function (containerAclError, containerBlob, containerAclResponse) { assert.equal(containerAclError, null); assert.notEqual(containerBlob, null); if (containerBlob) { assert.equal(containerBlob.publicAccessLevel, BlobConstants.BlobContainerPublicAccessType.OFF); } assert.equal(containerAclResponse.isSuccessful, true); done(); }); }); }); describe('setContainerAcl', function () { it('should work', function (done) { blobService.setContainerAcl(containerName, BlobConstants.BlobContainerPublicAccessType.BLOB, function (setAclError, setAclContainer1, setResponse1) { assert.equal(setAclError, null); assert.notEqual(setAclContainer1, null); assert.ok(setResponse1.isSuccessful); blobService.getContainerAcl(containerName, function (getAclError, getAclContainer1, getResponse1) { assert.equal(getAclError, null); assert.notEqual(getAclContainer1, null); if (getAclContainer1) { assert.equal(getAclContainer1.publicAccessLevel, BlobConstants.BlobContainerPublicAccessType.BLOB); } assert.ok(getResponse1.isSuccessful); blobService.setContainerAcl(containerName, BlobConstants.BlobContainerPublicAccessType.CONTAINER, function (setAclError2, setAclContainer2, setResponse2) { assert.equal(setAclError2, null); assert.notEqual(setAclContainer2, null); assert.ok(setResponse2.isSuccessful); setTimeout(function () { blobService.getContainerAcl(containerName, function (getAclError2, getAclContainer2, getResponse3) { assert.equal(getAclError2, null); assert.notEqual(getAclContainer2, null); if (getAclContainer2) { assert.equal(getAclContainer2.publicAccessLevel, BlobConstants.BlobContainerPublicAccessType.CONTAINER); } assert.ok(getResponse3.isSuccessful); done(); }); }, (suiteUtil.isMocked && !suiteUtil.isRecording) ? 0 : 5000); }); }); }); }); it('should work with policies', function (done) { var readWriteStartDate = new Date(Date.UTC(2012, 10, 10)); var readWriteExpiryDate = new Date(readWriteStartDate); readWriteExpiryDate.setMinutes(readWriteStartDate.getMinutes() + 10); readWriteExpiryDate.setMilliseconds(999); var readWriteSharedAccessPolicy = { Id: 'readwrite', AccessPolicy: { Start: readWriteStartDate, Expiry: readWriteExpiryDate, Permissions: 'rw' } }; var readSharedAccessPolicy = { Id: 'read', AccessPolicy: { Expiry: readWriteStartDate, Permissions: 'r' } }; var options = {}; options.signedIdentifiers = [readWriteSharedAccessPolicy, readSharedAccessPolicy]; blobService.setContainerAcl(containerName, BlobConstants.BlobContainerPublicAccessType.BLOB, options, function (setAclError, setAclContainer1, setResponse1) { assert.equal(setAclError, null); assert.notEqual(setAclContainer1, null); assert.ok(setResponse1.isSuccessful); blobService.getContainerAcl(containerName, function (getAclError, getAclContainer1, getResponse1) { assert.equal(getAclError, null); assert.notEqual(getAclContainer1, null); if (getAclContainer1) { assert.equal(getAclContainer1.publicAccessLevel, BlobConstants.BlobContainerPublicAccessType.BLOB); assert.equal(getAclContainer1.signedIdentifiers[0].AccessPolicy.Expiry.getTime(), readWriteExpiryDate.getTime()); } assert.ok(getResponse1.isSuccessful); blobService.setContainerAcl(containerName, BlobConstants.BlobContainerPublicAccessType.CONTAINER, function (setAclError2, setAclContainer2, setResponse2) { assert.equal(setAclError2, null); assert.notEqual(setAclContainer2, null); assert.ok(setResponse2.isSuccessful); blobService.getContainerAcl(containerName, function (getAclError2, getAclContainer2, getResponse3) { assert.equal(getAclError2, null); assert.notEqual(getAclContainer2, null); if (getAclContainer2) { assert.equal(getAclContainer2.publicAccessLevel, BlobConstants.BlobContainerPublicAccessType.CONTAINER); } assert.ok(getResponse3.isSuccessful); done(); }); }); }); }); }); it('should work with signed identifiers', function (done) { var options = {}; options.signedIdentifiers = [ { Id: 'id1', AccessPolicy: { Start: '2009-10-10T00:00:00.123Z', Expiry: '2009-10-11T00:00:00.456Z', Permissions: 'r' } }, { Id: 'id2', AccessPolicy: { Start: '2009-11-10T00:00:00.006Z', Expiry: '2009-11-11T00:00:00.4Z', Permissions: 'w' } }]; blobService.setContainerAcl(containerName, BlobConstants.BlobContainerPublicAccessType.OFF, options, function (setAclError, setAclContainer, setAclResponse) { assert.equal(setAclError, null); assert.notEqual(setAclContainer, null); assert.ok(setAclResponse.isSuccessful); blobService.getContainerAcl(containerName, function (getAclError, containerAcl, getAclResponse) { assert.equal(getAclError, null); assert.notEqual(containerAcl, null); assert.notEqual(getAclResponse, null); if (getAclResponse) { assert.equal(getAclResponse.isSuccessful, true); } var entries = 0; if (containerAcl) { if (containerAcl.signedIdentifiers) { containerAcl.signedIdentifiers.forEach(function (identifier) { if (identifier.Id === 'id1') { assert.equal(identifier.AccessPolicy.Start.getTime(), new Date('2009-10-10T00:00:00.123Z').getTime()); assert.equal(identifier.AccessPolicy.Expiry.getTime(), new Date('2009-10-11T00:00:00.456Z').getTime()); assert.equal(identifier.AccessPolicy.Permission, 'r'); entries += 1; } else if (identifier.Id === 'id2') { assert.equal(identifier.AccessPolicy.Start.getTime(), new Date('2009-11-10T00:00:00.006Z').getTime()); assert.equal(identifier.AccessPolicy.Start.getMilliseconds(), 6); assert.equal(identifier.AccessPolicy.Expiry.getTime(), new Date('2009-11-11T00:00:00.4Z').getTime()); assert.equal(identifier.AccessPolicy.Expiry.getMilliseconds(), 400); assert.equal(identifier.AccessPolicy.Permission, 'w'); entries += 2; } }); } } assert.equal(entries, 3); done(); }); }); }); }); describe('createBlockBlobFromText', function () { it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var blobText = 'Hello World'; blobService.createBlockBlobFromText(containerName, blobName, blobText, function (uploadError, blob, uploadResponse) { assert.equal(uploadError, null); assert.ok(uploadResponse.isSuccessful); blobService.getBlobToText(containerName, blobName, function (downloadErr, blobTextResponse) { assert.equal(downloadErr, null); assert.equal(blobTextResponse, blobText); done(); }); }); }); }); describe('createBlobSnapshot', function () { it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var blobText = 'Hello World'; blobService.createBlockBlobFromText(containerName, blobName, blobText, function (uploadError, blob, putResponse) { assert.equal(uploadError, null); assert.notEqual(putResponse, null); if (putResponse) { assert.ok(putResponse.isSuccessful); } blobService.createBlobSnapshot(containerName, blobName, function (snapshotError, snapshotId, snapshotResponse) { assert.equal(snapshotError, null); assert.notEqual(snapshotResponse, null); assert.notEqual(snapshotId, null); if (snapshotResponse) { assert.ok(snapshotResponse.isSuccessful); } blobService.getBlobToText(containerName, blobName, function (getError, content, blockBlob, getResponse) { assert.equal(getError, null); assert.notEqual(blockBlob, null); assert.notEqual(getResponse, null); if (getResponse) { assert.ok(getResponse.isSuccessful); } assert.equal(blobText, content); done(); }); }); }); }); }); describe('acquireLease', function () { it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var blobText = 'hello'; blobService.createBlockBlobFromText(containerName, blobName, blobText, function (uploadError, blob, uploadResponse) { assert.equal(uploadError, null); assert.notEqual(blob, null); assert.ok(uploadResponse.isSuccessful); // Acquire a lease blobService.acquireLease(containerName, blobName, function (leaseBlobError, lease, leaseBlobResponse) { assert.equal(leaseBlobError, null); assert.notEqual(lease, null); if (lease) { assert.ok(lease.id); } assert.notEqual(leaseBlobResponse, null); if (leaseBlobResponse) { assert.ok(leaseBlobResponse.isSuccessful); } // Second lease should not be possible blobService.acquireLease(containerName, blobName, function (secondLeaseBlobError, secondLease, secondLeaseBlobResponse) { assert.equal(secondLeaseBlobError.code, 'LeaseAlreadyPresent'); assert.equal(secondLease, null); assert.equal(secondLeaseBlobResponse.isSuccessful, false); // Delete should not be possible blobService.deleteBlob(containerName, blobName, function (deleteError, deleted, deleteResponse) { assert.equal(deleteError.code, 'LeaseIdMissing'); assert.equal(deleteResponse.isSuccessful, false); done(); }); }); }); }); }); }); describe('getBlobProperties', function () { it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var metadata = { color: 'blue' }; blobService.createBlockBlobFromText(containerName, blobName, 'hello', { metadata: metadata }, function (blobErr) { assert.equal(blobErr, null); blobService.getBlobProperties(containerName, blobName, function (getErr, blob) { assert.equal(getErr, null); assert.notEqual(blob, null); if (blob) { assert.notEqual(blob.metadata, null); if (blob.metadata) { assert.equal(blob.metadata.color, metadata.color); } } done(); }); }); }); }); describe('setBlobProperties', function () { it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var text = 'hello'; blobService.createBlockBlobFromText(containerName, blobName, text, function (blobErr) { assert.equal(blobErr, null); var options = {}; options.contentType = 'text'; options.contentEncoding = 'utf8'; options.contentLanguage = 'pt'; options.cacheControl = 'true'; blobService.setBlobProperties(containerName, blobName, options, function (setErr) { assert.equal(setErr, null); blobService.getBlobProperties(containerName, blobName, function (getErr, blob) { assert.equal(getErr, null); assert.notEqual(blob, null); if (blob) { assert.equal(blob.contentLength, text.length); assert.equal(blob.contentType, options.contentType); assert.equal(blob.contentEncoding, options.contentEncoding); assert.equal(blob.contentLanguage, options.contentLanguage); assert.equal(blob.cacheControl, options.cacheControl); } done(); }); }); }); }); }); describe('getBlobMetadata', function () { it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var metadata = { color: 'blue' }; blobService.createBlockBlobFromText(containerName, blobName, 'hello', { metadata: metadata }, function (blobErr) { assert.equal(blobErr, null); blobService.getBlobMetadata(containerName, blobName, function (getErr, blob) { assert.equal(getErr, null); assert.notEqual(blob, null); if (blob) { assert.notEqual(blob.metadata, null); if (blob.metadata) { assert.equal(blob.metadata.color, metadata.color); } } done(); }); }); }); }); describe('pageBlob', function () { it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var data1 = 'Hello, World!' + repeat(' ', 1024 - 13); var data2 = 'Hello, World!' + repeat(' ', 512 - 13); // Create the empty page blob blobService.createPageBlob(containerName, blobName, 1024, function (err) { assert.equal(err, null); // Upload all data blobService.createBlobPagesFromText(containerName, blobName, data1, 0, 1023, function (err2) { assert.equal(err2, null); // Verify contents blobService.getBlobToText(containerName, blobName, function (err3, content1) { assert.equal(err3, null); assert.equal(content1, data1); // Clear the page blob blobService.clearBlobPages(containerName, blobName, 0, 1023, function (err4) { assert.equal(err4); // Upload other data in 2 pages blobService.createBlobPagesFromText(containerName, blobName, data2, 0, 511, function (err5) { assert.equal(err5, null); blobService.createBlobPagesFromText(containerName, blobName, data2, 512, 1023, function (err6) { assert.equal(err6, null); blobService.getBlobToText(containerName, blobName, function (err7, content2) { assert.equal(err7, null); assert.equal(data2 + data2, content2); done(); }); }); }); }); }); }); }); }); }); describe('createBlockBlobFromText', function () { it('should work with access condition', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var blobText = 'hello'; blobService.createBlockBlobFromText(containerName, blobName, blobText, function (error2) { assert.equal(error2, null); blobService.getBlobProperties(containerName, blobName, function (error4, blobProperties) { assert.equal(error4, null); var options = { accessConditions: { 'if-none-match': blobProperties.etag} }; blobService.createBlockBlobFromText(containerName, blobName, blobText, options, function (error3) { assert.notEqual(error3, null); assert.equal(error3.code, Constants.StorageErrorCodeStrings.CONDITION_NOT_MET); done(); }); }); }); }); it('should work for small size from file', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked) + ' a'; var blobText = 'Hello World'; blobService.createBlockBlobFromText(containerName, blobName, blobText, function (uploadError, blobResponse, uploadResponse) { assert.equal(uploadError, null); assert.notEqual(blobResponse, null); assert.ok(uploadResponse.isSuccessful); blobService.getBlobToText(containerName, blobName, function (downloadErr, blobTextResponse) { assert.equal(downloadErr, null); assert.equal(blobTextResponse, blobText); done(); }); }); }); }); describe('getBlobRange', function () { it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var data1 = 'Hello, World!'; // Create the empty page blob blobService.createBlockBlobFromText(containerName, blobName, data1, function (err) { assert.equal(err, null); blobService.getBlobToText(containerName, blobName, { rangeStart: 2, rangeEnd: 3 }, function (err3, content1) { assert.equal(err3, null); // get the double ll's in the hello assert.equal(content1, 'll'); done(); }); }); }); }); describe('getBlobRangeOpenEnded', function () { it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var data1 = 'Hello, World!'; // Create the empty page blob blobService.createBlockBlobFromText(containerName, blobName, data1, function (err) { assert.equal(err, null); blobService.getBlobToText(containerName, blobName, { rangeStart: 2 }, function (err3, content1) { assert.equal(err3, null); // get the last bytes from the message assert.equal(content1, 'llo, World!'); done(); }); }); }); }); describe('setBlobMime', function () { it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var fileNameSource = testutil.generateId('file') + '.bmp'; // fake bmp file with text... var blobText = 'Hello World!'; fs.writeFile(fileNameSource, blobText, function () { // Create the empty page blob var blobOptions = {blockIdPrefix : 'blockId' }; blobService.createBlockBlobFromFile(containerName, blobName, fileNameSource, blobOptions, function (err) { assert.equal(err, null); blobService.getBlobToText(containerName, blobName, { rangeStart: 2 }, function (err3, content1, blob) { assert.equal(err3, null); // get the last bytes from the message assert.equal(content1, 'llo World!'); assert.ok(blob.contentType === 'image/bmp' || blob.contentType === 'image/x-ms-bmp'); fs.unlink(fileNameSource, function () { done(); }); }); }); }); }); it('should work with skip', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var fileNameSource = testutil.generateId('prefix') + '.bmp'; // fake bmp file with text... var blobText = 'Hello World!'; fs.writeFile(fileNameSource, blobText, function () { // Create the empty page blob blobService.createBlockBlobFromFile(containerName, blobName, fileNameSource, { contentType: null, contentTypeHeader: null, blockIdPrefix : 'blockId' }, function (err) { assert.equal(err, null); blobService.getBlobToText(containerName, blobName, { rangeStart: 2 }, function (err3, content1, blob) { assert.equal(err3, null); // get the last bytes from the message assert.equal(content1, 'llo World!'); assert.equal(blob.contentType, 'application/octet-stream'); fs.unlink(fileNameSource, function () { done(); }); }); }); }); }); }); }); describe('copyBlob', function () { it('should work', function (done) { var sourceContainerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var targetContainerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var sourceBlobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var targetBlobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var blobText = 'hi there'; blobService.createContainer(sourceContainerName, function (createErr1) { assert.equal(createErr1, null); blobService.createContainer(targetContainerName, function (createErr2) { assert.equal(createErr2, null); blobService.createBlockBlobFromText(sourceContainerName, sourceBlobName, blobText, function (uploadErr) { assert.equal(uploadErr, null); blobService.copyBlob(blobService.getBlobUrl(sourceContainerName, sourceBlobName), targetContainerName, targetBlobName, function (copyErr) { assert.equal(copyErr, null); blobService.getBlobToText(targetContainerName, targetBlobName, function (downloadErr, text) { assert.equal(downloadErr, null); assert.equal(text, blobText); done(); }); }); }); }); }); }); }); describe('listBlobs', function () { var containerName; beforeEach(function (done) { containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); blobService.createContainer(containerName, done); }); it('should work', function (done) { var blobName1 = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var blobName2 = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var blobText1 = 'hello1'; var blobText2 = 'hello2'; // Test listing 0 blobs blobService.listBlobs(containerName, function (listErrNoBlobs, listNoBlobs) { assert.equal(listErrNoBlobs, null); assert.notEqual(listNoBlobs, null); if (listNoBlobs) { assert.equal(listNoBlobs.length, 0); } blobService.createBlockBlobFromText(containerName, blobName1, blobText1, function (blobErr1) { assert.equal(blobErr1, null); // Test listing 1 blob blobService.listBlobs(containerName, function (listErr, listBlobs) { assert.equal(listErr, null); assert.notEqual(listBlobs, null); assert.equal(listBlobs.length, 1); blobService.createBlockBlobFromText(containerName, blobName2, blobText2, function (blobErr2) { assert.equal(blobErr2, null); // Test listing multiple blobs blobService.listBlobs(containerName, function (listErr2, listBlobs2) { assert.equal(listErr2, null); assert.notEqual(listBlobs2, null); if (listBlobs2) { assert.equal(listBlobs2.length, 2); var entries = 0; listBlobs2.forEach(function (blob) { if (blob.name === blobName1) { entries += 1; } else if (blob.name === blobName2) { entries += 2; } }); assert.equal(entries, 3); } blobService.createBlobSnapshot(containerName, blobName1, function (snapErr) { assert.equal(snapErr, null); // Test listing without requesting snapshots blobService.listBlobs(containerName, function (listErr3, listBlobs3) { assert.equal(listErr3, null); assert.notEqual(listBlobs3, null); if (listBlobs3) { assert.equal(listBlobs3.length, 2); } // Test listing including snapshots blobService.listBlobs(containerName, { include: BlobConstants.BlobListingDetails.SNAPSHOTS }, function (listErr4, listBlobs4) { assert.equal(listErr4, null); assert.notEqual(listBlobs4, null); if (listBlobs3) { assert.equal(listBlobs4.length, 3); } done(); }); }); }); }); }); }); }); }); }); }); describe('getPageRegions', function () { var containerName; beforeEach(function (done) { containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); blobService.createContainer(containerName, done); }); it('should work', function (done) { var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var data = 'Hello, World!' + repeat(' ', 512 - 13); // Upload contents in 2 parts blobService.createPageBlob(containerName, blobName, 1024 * 1024 * 1024, function (err) { assert.equal(err, null); // Upload all data blobService.createBlobPagesFromText(containerName, blobName, data, 0, 511, function (err2) { assert.equal(err2, null); // Only one region present blobService.listBlobRegions(containerName, blobName, 0, null, function (error, regions) { assert.equal(error, null); assert.notEqual(regions, null); if (regions) { assert.equal(regions.length, 1); var entries = 0; regions.forEach(function (region) { if (region.start === 0) { assert.equal(region.end, 511); entries += 1; } }); assert.equal(entries, 1); } blobService.createBlobPagesFromText(containerName, blobName, data, 1048576, 1049087, null, function (err3) { assert.equal(err3, null); // Get page regions blobService.listBlobRegions(containerName, blobName, 0, null, function (error5, regions) { assert.equal(error5, null); assert.notEqual(regions, null); if (regions) { assert.equal(regions.length, 2); var entries = 0; regions.forEach(function (region) { if (region.start === 0) { assert.equal(region.end, 511); entries += 1; } else if (region.start === 1048576) { assert.equal(region.end, 1049087); entries += 2; } }); assert.equal(entries, 3); } done(); }); }); }); }); }); }); }); it('CreateBlobWithBars', function (done) { var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var blobName = 'blobs/' + testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var blobText = 'Hello World!'; blobService.createContainer(containerName, function (createError) { assert.equal(createError, null); // Create the empty page blob blobService.createBlockBlobFromText(containerName, blobName, blobText, function (err) { assert.equal(err, null); blobService.getBlobProperties(containerName, blobName, function (error, properties) { assert.equal(error, null); assert.equal(properties.container, containerName); assert.equal(properties.blob, blobName); done(); }); }); }); }); it('works with files without specifying content type', function (done) { // This test ensures that blocks can be created from files correctly // and was created to ensure that the request module does not magically add // a content type to the request when the user did not specify one. var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var fileName= testutil.generateId('prefix') + '.txt'; var blobText = 'Hello World!'; try { fs.unlinkSync(fileName); } catch (e) {} fs.writeFileSync(fileName, blobText); var stat = fs.statSync(fileName); blobService.createContainer(containerName, function (createErr1) { assert.equal(createErr1, null); blobService.createBlobBlockFromStream('test', containerName, blobName, fs.createReadStream(fileName), stat.size, function (error) { try { fs.unlinkSync(fileName); } catch (e) {} assert.equal(error, null); done(); }); }); }); it('CommitBlockList', function (done) { var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); blobService.createContainer(containerName, function (error) { assert.equal(error, null); blobService.createBlobBlockFromText('id1', containerName, blobName, 'id1', function (error2) { assert.equal(error2, null); blobService.createBlobBlockFromText('id2', containerName, blobName, 'id2', function (error3) { assert.equal(error3, null); var blockList = { LatestBlocks: ['id1'], UncommittedBlocks: ['id2'] }; blobService.commitBlobBlocks(containerName, blobName, blockList, function (error4) { assert.equal(error4, null); blobService.listBlobBlocks(containerName, blobName, BlobConstants.BlockListFilter.ALL, function (error5, list) { assert.equal(error5, null); assert.notEqual(list, null); assert.notEqual(list.CommittedBlocks, null); assert.equal(list.CommittedBlocks.length, 2); done(); }); }); }); }); }); }); describe('shared access signature', function () { describe('getBlobUrl', function () { it('should work', function (done) { var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var blobServiceassert = storage.createBlobService('storageAccount', 'storageAccessKey', 'host.com:80'); var blobUrl = blobServiceassert.getBlobUrl(containerName); assert.equal(blobUrl, 'https://host.com:80/' + containerName); blobUrl = blobServiceassert.getBlobUrl(containerName, blobName); assert.equal(blobUrl, 'https://host.com:80/' + containerName + '/' + blobName); done(); }); it('should work with shared access policy', function (done) { var containerName = 'container'; var blobName = 'blob'; var blobServiceassert = storage.createBlobService('storageAccount', 'storageAccessKey', 'host.com:80'); var sharedAccessPolicy = { AccessPolicy: { Expiry: new Date('October 12, 2011 11:53:40 am GMT') } }; var blobUrl = blobServiceassert.getBlobUrl(containerName, blobName, sharedAccessPolicy); assert.equal(blobUrl, 'https://host.com:80/' + containerName + '/' + blobName + '?se=2011-10-12T11%3A53%3A40Z&sr=b&sv=2012-02-12&sig=gDOuwDoa4F7hhQJW9ReCimoHN2qp7NF1Nu3sdHjwIfs%3D'); done(); }); it('should work with container acl permissions and spaces in name', function (done) { var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked) + ' foobar'; var blobText = 'Hello World'; var fileNameSource = testutil.generateId('prefix') + '.txt'; // fake bmp file with text... blobService.createContainer(containerName, function (err) { assert.equal(err, null); var startTime = new Date('April 15, 2013 11:53:40 am GMT'); var readWriteSharedAccessPolicy = { Id: 'readwrite', AccessPolicy: { Start: startTime, Permissions: 'rwdl' } }; blobService.setContainerAcl(containerName, null, { signedIdentifiers: [ readWriteSharedAccessPolicy ] }, function (err) { assert.equal(err, null); blobService.createBlockBlobFromText(containerName, blobName, blobText, function (uploadError, blob, uploadResponse) { assert.equal(uploadError, null); assert.ok(uploadResponse.isSuccessful); var blobUrl = blobService.getBlobUrl(containerName, blobName, { Id: 'readwrite', AccessPolicy: { Expiry: new Date('April 15, 2099 11:53:40 am GMT') } }); function responseCallback(err, rsp) { assert.equal(rsp.statusCode, 200); assert.equal(err, null); fs.unlink(fileNameSource, done); } request.get(blobUrl, responseCallback).pipe(fs.createWriteStream(fileNameSource)); }); }); }); }); it('should work with container acl permissions', function (done) { var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var fileNameSource = testutil.generateId('prefix') + '.bmp'; // fake bmp file with text... var blobText = 'Hello World!'; blobService.createContainer(containerName, function (error) { assert.equal(error, null); var startTime = new Date('April 15, 2013 11:53:40 am GMT'); var readWriteSharedAccessPolicy = { Id: 'readwrite', AccessPolicy: { Start: startTime, Permissions: 'rwdl' } }; blobService.setContainerAcl(containerName, null, { signedIdentifiers: [ readWriteSharedAccessPolicy ] }, function (err) { assert.equal(err, null); blobService.createBlockBlobFromText(containerName, blobName, blobText, function (err) { assert.equal(err, null); var blobUrl = blobService.getBlobUrl(containerName, blobName, { Id: 'readwrite', AccessPolicy: { Expiry: new Date('April 15, 2099 11:53:40 am GMT') } }); function responseCallback(err, rsp) { assert.equal(rsp.statusCode, 200); assert.equal(err, null); fs.unlink(fileNameSource, done); } request.get(blobUrl, responseCallback).pipe(fs.createWriteStream(fileNameSource)); }); }); }); }); it('should work with duration', function (done) { var containerName = 'container'; var blobName = 'blob'; var blobServiceassert = storage.createBlobService('storageAccount', 'storageAccessKey', 'host.com:80'); // Mock Date just to ensure a fixed signature this.clock = sinon.useFakeTimers(0); var sharedAccessPolicy = { AccessPolicy: { Expiry: storage.date.minutesFromNow(10) } }; this.clock.restore(); var blobUrl = blobServiceassert.getBlobUrl(containerName, blobName, sharedAccessPolicy); assert.equal(blobUrl, 'https://host.com:80/' + containerName + '/' + blobName + '?se=1970-01-01T00%3A10%3A00Z&sr=b&sv=2012-02-12&sig=ca700zLsjqapO1sUBVHIBblj2XoJCON1V4gMSfyQZc8%3D'); done(); }); }); it('GenerateSharedAccessSignature', function (done) { var containerName = 'images'; var blobName = 'pic1.png'; var devStorageBlobService = storage.createBlobService(ServiceClientConstants.DEVSTORE_STORAGE_ACCOUNT, ServiceClientConstants.DEVSTORE_STORAGE_ACCESS_KEY); var sharedAccessPolicy = { AccessPolicy: { Permissions: BlobConstants.SharedAccessPermissions.READ, Start: new Date('October 11, 2011 11:03:40 am GMT'), Expiry: new Date('October 12, 2011 11:53:40 am GMT') } }; var sharedAccessSignature = devStorageBlobService.generateSharedAccessSignature(containerName, blobName, sharedAccessPolicy); assert.equal(sharedAccessSignature.queryString[QueryStringConstants.SIGNED_START], '2011-10-11T11:03:40Z'); assert.equal(sharedAccessSignature.queryString[QueryStringConstants.SIGNED_EXPIRY], '2011-10-12T11:53:40Z'); assert.equal(sharedAccessSignature.queryString[QueryStringConstants.SIGNED_RESOURCE], BlobConstants.ResourceTypes.BLOB); assert.equal(sharedAccessSignature.queryString[QueryStringConstants.SIGNED_PERMISSIONS], BlobConstants.SharedAccessPermissions.READ); assert.equal(sharedAccessSignature.queryString[QueryStringConstants.SIGNED_VERSION], '2012-02-12'); assert.equal(sharedAccessSignature.queryString[QueryStringConstants.SIGNATURE], 'ju4tX0G79vPxMOkBb7UfNVEgrj9+ZnSMutpUemVYHLY='); done(); }); }); it('responseEmits', function (done) { var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var responseReceived = false; blobService.on('response', function (response) { assert.notEqual(response, null); responseReceived = true; blobService.removeAllListeners('response'); }); blobService.createContainer(containerName, function (error) { assert.equal(error, null); blobService.createBlobBlockFromText('id1', containerName, blobName, 'id1', function (error2) { assert.equal(error2, null); // By the time the complete callback is processed the response header callback must have been called before assert.equal(responseReceived, true); done(); }); }); }); it('getBlobToStream', function (done) { var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var fileNameTarget = testutil.generateId('getBlobFile', [], suiteUtil.isMocked) + '.test'; var blobText = 'Hello World'; blobService.createContainer(containerName, function (createError1, container1) { assert.equal(createError1, null); assert.notEqual(container1, null); blobService.createBlockBlobFromText(containerName, blobName, blobText, function (error1) { assert.equal(error1, null); blobService.getBlobToFile(containerName, blobName, fileNameTarget, function (error2) { assert.equal(error2, null); var exists = azureutil.pathExistsSync(fileNameTarget); assert.equal(exists, true); fs.readFile(fileNameTarget, function (err, fileText) { assert.equal(blobText, fileText); done(); }); }); }); }); }); it('SmallUploadBlobFromFile', function (done) { var containerName = testutil.generateId(containerNamesPrefix, containerNames, suiteUtil.isMocked); var blobName = testutil.generateId(blobNamesPrefix, blobNames, suiteUtil.isMocked); var fileNameSource = testutil.generateId('getBlobFile', [], suiteUtil.isMocked) + '.test'; var blobText = 'Hello World'; fs.writeFile(fileNameSource, blobText, function () { blobService.createContainer(containerName, function (createError1, container1, createResponse1) { assert.equal(createError1, null); assert.notEqual(container1, null); assert.ok(createResponse1.isSuccessful); assert.equal(createResponse1.statusCode, HttpConstants.HttpResponseCodes.Created); var blobOptions = { contentType: 'text', blockIdPrefix : 'blockId' }; blobService.createBlockBlobFromFile(containerName, blobName, fileNameSource, blobOptions, function (uploadError, blobResponse, uploadResponse) { assert.equal(uploadError, null); assert.notEqual(blobResponse, null); assert.ok(uploadResponse.isSuccessful); blobService.getBlobToText(containerName, blobName, function (downloadErr, blobTextResponse) { assert.equal(downloadErr, null); assert.equal(blobTextResponse, blobText); blobService.getBlobProperties(containerName, blobName, function (getBlobPropertiesErr, blobGetResponse) { assert.equal(getBlobPropertiesErr, null); assert.notEqual(blobGetResponse, null); if (blobGetResponse) { assert.equal(blobOptions.contentType, blobGetResponse.contentType); } done(); }); }); }); }); }); }); it('storageConnectionStrings', function (done) { var key = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA=='; var connectionString = 'DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=' + key; var blobService = storage.createBlobService(connectionString); assert.equal(blobService.storageAccount, 'myaccount'); assert.equal(blobService.storageAccessKey, key); assert.equal(blobService.protocol, 'https:'); assert.equal(blobService.host, 'myaccount.blob.core.windows.net'); done(); }); it('storageConnectionStringsDevStore', function (done) { var connectionString = 'UseDevelopmentStorage=true'; var blobService = storage.createBlobService(connectionString); assert.equal(blobService.storageAccount, ServiceClientConstants.DEVSTORE_STORAGE_ACCOUNT); assert.equal(blobService.storageAccessKey, ServiceClientConstants.DEVSTORE_STORAGE_ACCESS_KEY); assert.equal(blobService.protocol, 'http:'); assert.equal(blobService.host, '127.0.0.1'); assert.equal(blobService.port, '10000'); done(); }); it('should be creatable from config', function (done) { var key = 'AhlzsbLRkjfwObuqff3xrhB2yWJNh1EMptmcmxFJ6fvPTVX3PZXwrG2YtYWf5DPMVgNsteKStM5iBLlknYFVoA=='; var connectionString = 'DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=' + key; var config = common.configure('testenvironment', function (c) { c.storage(connectionString); }); var blobService = storage.createBlobService(common.config('testenvironment')); assert.equal(blobService.storageAccount, 'myaccount'); assert.equal(blobService.storageAccessKey, key); assert.equal(blobService.protocol, 'https:'); assert.equal(blobService.host, 'myaccount.blob.core.windows.net'); done(); }); }); function repeat(s, n) { var ret = ''; for (var i = 0; i < n; i++) { ret += s; } return ret; }
begoldsm/azure-sdk-for-node
test/services/blob/blobservice-tests.js
JavaScript
apache-2.0
59,746
// ================================================================================================= // Copyright 2011 Twitter, Inc. // ------------------------------------------------------------------------------------------------- // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this work except in compliance with the License. // You may obtain a copy of the License in the LICENSE file, or 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.twitter.common.net; import java.io.IOException; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nullable; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Functions; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ListenableFutureTask; import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.twitter.common.base.ExceptionalFunction; import com.twitter.common.net.UrlResolver.ResolvedUrl.EndState; import com.twitter.common.quantity.Amount; import com.twitter.common.quantity.Time; import com.twitter.common.stats.PrintableHistogram; import com.twitter.common.util.BackoffStrategy; import com.twitter.common.util.Clock; import com.twitter.common.util.TruncatedBinaryBackoff; import com.twitter.common.util.caching.Cache; import com.twitter.common.util.caching.LRUCache; /** * Class to aid in resolving URLs by following redirects, which can optionally be performed * asynchronously using a thread pool. * * @author William Farner */ public class UrlResolver { private static final Logger LOG = Logger.getLogger(UrlResolver.class.getName()); private static final String TWITTER_UA = "Twitterbot/0.1"; private static final UrlResolverUtil URL_RESOLVER = new UrlResolverUtil(Functions.constant(TWITTER_UA)); private static final ExceptionalFunction<String, String, IOException> RESOLVER = new ExceptionalFunction<String, String, IOException>() { @Override public String apply(String url) throws IOException { return URL_RESOLVER.getEffectiveUrl(url, null); } }; private static ExceptionalFunction<String, String, IOException> getUrlResolver(final @Nullable ProxyConfig proxyConfig) { if (proxyConfig != null) { return new ExceptionalFunction<String, String, IOException>() { @Override public String apply(String url) throws IOException { return URL_RESOLVER.getEffectiveUrl(url, proxyConfig); } }; } else { return RESOLVER; } } private final ExceptionalFunction<String, String, IOException> resolver; private final int maxRedirects; // Tracks the number of active tasks (threads in use). private final Semaphore poolEntrySemaphore; private final Integer threadPoolSize; // Helps with signaling the handler. private final Executor handlerExecutor; // Manages the thread pool and task execution. private ExecutorService executor; // Cache to store resolved URLs. private final Cache<String, String> urlCache = LRUCache.<String, String>builder() .maxSize(10000) .makeSynchronized(true) .build(); // Variables to track connection/request stats. private AtomicInteger requestCount = new AtomicInteger(0); private AtomicInteger cacheHits = new AtomicInteger(0); private AtomicInteger failureCount = new AtomicInteger(0); // Tracks the time (in milliseconds) required to resolve URLs. private final PrintableHistogram urlResolutionTimesMs = new PrintableHistogram( 1, 5, 10, 25, 50, 75, 100, 150, 200, 250, 300, 500, 750, 1000, 1500, 2000); private final Clock clock; private final BackoffStrategy backoffStrategy; @VisibleForTesting UrlResolver(Clock clock, BackoffStrategy backoffStrategy, ExceptionalFunction<String, String, IOException> resolver, int maxRedirects) { this(clock, backoffStrategy, resolver, maxRedirects, null); } /** * Creates a new asynchronous URL resolver. A thread pool will be used to resolve URLs, and * resolved URLs will be announced via {@code handler}. * * @param maxRedirects The maximum number of HTTP redirects to follow. * @param threadPoolSize The number of threads to use for resolving URLs. * @param proxyConfig The proxy settings with which to make the HTTP request, or null for the * default configured proxy. */ public UrlResolver(int maxRedirects, int threadPoolSize, @Nullable ProxyConfig proxyConfig) { this(Clock.SYSTEM_CLOCK, new TruncatedBinaryBackoff(Amount.of(100L, Time.MILLISECONDS), Amount.of(1L, Time.SECONDS)), getUrlResolver(proxyConfig), maxRedirects, threadPoolSize); } public UrlResolver(int maxRedirects, int threadPoolSize) { this(maxRedirects, threadPoolSize, null); } private UrlResolver(Clock clock, BackoffStrategy backoffStrategy, ExceptionalFunction<String, String, IOException> resolver, int maxRedirects, @Nullable Integer threadPoolSize) { this.clock = clock; this.backoffStrategy = backoffStrategy; this.resolver = resolver; this.maxRedirects = maxRedirects; if (threadPoolSize != null) { this.threadPoolSize = threadPoolSize; Preconditions.checkState(threadPoolSize > 0); poolEntrySemaphore = new Semaphore(threadPoolSize); // Start up the thread pool. reset(); // Executor to send notifications back to the handler. This also needs to be // a daemon thread. handlerExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setDaemon(true).build()); } else { this.threadPoolSize = null; poolEntrySemaphore = null; handlerExecutor = null; } } public Future<ResolvedUrl> resolveUrlAsync(final String url, final ResolvedUrlHandler handler) { Preconditions.checkNotNull( "Asynchronous URL resolution cannot be performed without a valid handler.", handler); try { poolEntrySemaphore.acquire(); } catch (InterruptedException e) { LOG.log(Level.SEVERE, "Interrupted while waiting for thread to resolve URL: " + url, e); return null; } final ListenableFutureTask<ResolvedUrl> future = ListenableFutureTask.create( new Callable<ResolvedUrl>() { @Override public ResolvedUrl call() { return resolveUrl(url); } }); future.addListener(new Runnable() { @Override public void run() { try { handler.resolved(future); } finally { poolEntrySemaphore.release(); } } }, handlerExecutor); executor.execute(future); return future; } private void logThreadpoolInfo() { LOG.info("Shutting down thread pool, available permits: " + poolEntrySemaphore.availablePermits()); LOG.info("Queued threads? " + poolEntrySemaphore.hasQueuedThreads()); LOG.info("Queue length: " + poolEntrySemaphore.getQueueLength()); } public void reset() { Preconditions.checkState(threadPoolSize != null); if (executor != null) { Preconditions.checkState(executor.isShutdown(), "The thread pool must be shut down before resetting."); Preconditions.checkState(executor.isTerminated(), "There may still be pending async tasks."); } // Create a thread pool with daemon threads, so that they may be terminated when no // application threads are running. executor = Executors.newFixedThreadPool(threadPoolSize, new ThreadFactoryBuilder().setDaemon(true).setNameFormat("UrlResolver[%d]").build()); } /** * Terminates the thread pool, waiting at most {@code waitSeconds} for active threads to complete. * After this method is called, no more URLs may be submitted for resolution. * * @param waitSeconds The number of seconds to wait for active threads to complete. */ public void clearAsyncTasks(int waitSeconds) { Preconditions.checkState(threadPoolSize != null, "finish() should not be called on a synchronous URL resolver."); logThreadpoolInfo(); executor.shutdown(); // Disable new tasks from being submitted. try { // Wait a while for existing tasks to terminate if (!executor.awaitTermination(waitSeconds, TimeUnit.SECONDS)) { LOG.info("Pool did not terminate, forcing shutdown."); logThreadpoolInfo(); List<Runnable> remaining = executor.shutdownNow(); LOG.info("Tasks still running: " + remaining); // Wait a while for tasks to respond to being cancelled if (!executor.awaitTermination(waitSeconds, TimeUnit.SECONDS)) { LOG.warning("Pool did not terminate."); logThreadpoolInfo(); } } } catch (InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while waiting for threadpool to finish.", e); // (Re-)Cancel if current thread also interrupted executor.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } } /** * Resolves a URL synchronously. * * @param url The URL to resolve. * @return The resolved URL. */ public ResolvedUrl resolveUrl(String url) { ResolvedUrl resolvedUrl = new ResolvedUrl(); resolvedUrl.setStartUrl(url); String cached = urlCache.get(url); if (cached != null) { cacheHits.incrementAndGet(); resolvedUrl.setNextResolve(cached); resolvedUrl.setEndState(EndState.CACHED); return resolvedUrl; } String currentUrl = url; long backoffMs = 0L; String next = null; for (int i = 0; i < maxRedirects; i++) { try { next = resolveOnce(currentUrl); // If there was a 4xx or a 5xx, we''ll get a null back, so we pretend like we never advanced // to allow for a retry within the redirect limit. // TODO(John Sirois): we really need access to the return code here to do the right thing; ie: // retry for internal server errors but probably not for unauthorized if (next == null) { if (i < maxRedirects - 1) { // don't wait if we're about to exit the loop backoffMs = backoffStrategy.calculateBackoffMs(backoffMs); try { clock.waitFor(backoffMs); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException( "Interrupted waiting to retry a failed resolution for: " + currentUrl, e); } } continue; } backoffMs = 0L; if (next.equals(currentUrl)) { // We've reached the end of the redirect chain. resolvedUrl.setEndState(EndState.REACHED_LANDING); urlCache.put(url, currentUrl); for (String intermediateUrl : resolvedUrl.getIntermediateUrls()) { urlCache.put(intermediateUrl, currentUrl); } return resolvedUrl; } else if (!url.equals(next)) { resolvedUrl.setNextResolve(next); } currentUrl = next; } catch (IOException e) { LOG.log(Level.INFO, "Failed to resolve url: " + url, e); resolvedUrl.setEndState(EndState.ERROR); return resolvedUrl; } } resolvedUrl.setEndState(next == null || url.equals(currentUrl) ? EndState.ERROR : EndState.REDIRECT_LIMIT); return resolvedUrl; } /** * Resolves a url, following at most one redirect. Thread-safe. * * @param url The URL to resolve. * @return The result of following the URL through at most one redirect or null if the url could * not be followed * @throws IOException If an error occurs while resolving the URL. */ private String resolveOnce(String url) throws IOException { requestCount.incrementAndGet(); String resolvedUrl = urlCache.get(url); if (resolvedUrl != null) { cacheHits.incrementAndGet(); return resolvedUrl; } try { long startTimeMs = System.currentTimeMillis(); resolvedUrl = resolver.apply(url); if (resolvedUrl == null) { return null; } urlCache.put(url, resolvedUrl); synchronized (urlResolutionTimesMs) { urlResolutionTimesMs.addValue(System.currentTimeMillis() - startTimeMs); } return resolvedUrl; } catch (IOException e) { failureCount.incrementAndGet(); throw e; } } @Override public String toString() { return String.format("Cache: %s\nFailed requests: %d,\nResolution Times: %s", urlCache, failureCount.get(), urlResolutionTimesMs.toString()); } /** * Class to wrap the result of a URL resolution. */ public static class ResolvedUrl { public enum EndState { REACHED_LANDING, ERROR, CACHED, REDIRECT_LIMIT } private String startUrl; private final List<String> resolveChain; private EndState endState; public ResolvedUrl() { resolveChain = Lists.newArrayList(); } @VisibleForTesting public ResolvedUrl(EndState endState, String startUrl, String... resolveChain) { this.endState = endState; this.startUrl = startUrl; this.resolveChain = Lists.newArrayList(resolveChain); } public String getStartUrl() { return startUrl; } void setStartUrl(String startUrl) { this.startUrl = startUrl; } /** * Returns the last URL resolved following a redirect chain, or null if the startUrl is a * landing URL. */ public String getEndUrl() { return resolveChain.isEmpty() ? null : Iterables.getLast(resolveChain); } void setNextResolve(String endUrl) { this.resolveChain.add(endUrl); } /** * Returns any immediate URLs encountered on the resolution chain. If the startUrl redirects * directly to the endUrl or they are the same the imtermediate URLs will be empty. */ public Iterable<String> getIntermediateUrls() { return resolveChain.size() <= 1 ? ImmutableList.<String>of() : resolveChain.subList(0, resolveChain.size() - 1); } public EndState getEndState() { return endState; } void setEndState(EndState endState) { this.endState = endState; } public String toString() { return String.format("%s -> %s [%s, %d redirects]", startUrl, Joiner.on(" -> ").join(resolveChain), endState, resolveChain.size()); } } /** * Interface to use for notifying the caller of resolved URLs. */ public interface ResolvedUrlHandler { /** * Signals that a URL has been resolved to its target. The implementation of this method must * be thread safe. * * @param future The future that has finished resolving a URL. */ public void resolved(Future<ResolvedUrl> future); } }
abel-von/commons
src/java/com/twitter/common/net/UrlResolver.java
Java
apache-2.0
15,827
/* * 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 com.twitter.elephantbird.pig.piggybank; import org.apache.pig.impl.logicalLayer.FrontendException; /** * @see GenericInvoker */ public class InvokeForDouble extends GenericInvoker<Double> { public InvokeForDouble() {} public InvokeForDouble(String fullName) throws FrontendException, SecurityException, ClassNotFoundException, NoSuchMethodException { super(fullName); } public InvokeForDouble(String fullName, String paramSpecsStr) throws FrontendException, SecurityException, ClassNotFoundException, NoSuchMethodException { super(fullName, paramSpecsStr); } public InvokeForDouble(String fullName, String paramSpecsStr, String isStatic) throws ClassNotFoundException, FrontendException, SecurityException, NoSuchMethodException { super(fullName, paramSpecsStr, isStatic); } }
ketralnis/elephant-bird
src/java/com/twitter/elephantbird/pig/piggybank/InvokeForDouble.java
Java
apache-2.0
1,672
define([ './addExtensionsRequired', './addToArray', './ForEach', './getAccessorByteStride', '../../Core/Cartesian3', '../../Core/Math', '../../Core/clone', '../../Core/defaultValue', '../../Core/defined', '../../Core/Quaternion', '../../Core/WebGLConstants' ], function( addExtensionsRequired, addToArray, ForEach, getAccessorByteStride, Cartesian3, CesiumMath, clone, defaultValue, defined, Quaternion, WebGLConstants) { 'use strict'; var updateFunctions = { '0.8' : glTF08to10, '1.0' : glTF10to20, '2.0' : undefined }; /** * Update the glTF version to the latest version (2.0), or targetVersion if specified. * Applies changes made to the glTF spec between revisions so that the core library * only has to handle the latest version. * * @param {Object} gltf A javascript object containing a glTF asset. * @param {Object} [options] Options for updating the glTF. * @param {String} [options.targetVersion] The glTF will be upgraded until it hits the specified version. * @returns {Object} The updated glTF asset. */ function updateVersion(gltf, options) { options = defaultValue(options, {}); var targetVersion = options.targetVersion; var version = gltf.version; gltf.asset = defaultValue(gltf.asset, { version: '1.0' }); version = defaultValue(version, gltf.asset.version); // invalid version if (!updateFunctions.hasOwnProperty(version)) { // try truncating trailing version numbers, could be a number as well if it is 0.8 if (defined(version)) { version = ('' + version).substring(0, 3); } // default to 1.0 if it cannot be determined if (!updateFunctions.hasOwnProperty(version)) { version = '1.0'; } } var updateFunction = updateFunctions[version]; while (defined(updateFunction)) { if (version === targetVersion) { break; } updateFunction(gltf); version = gltf.asset.version; updateFunction = updateFunctions[version]; } return gltf; } function updateInstanceTechniques(gltf) { var materials = gltf.materials; for (var materialId in materials) { if (materials.hasOwnProperty(materialId)) { var material = materials[materialId]; var instanceTechnique = material.instanceTechnique; if (defined(instanceTechnique)) { material.technique = instanceTechnique.technique; material.values = instanceTechnique.values; delete material.instanceTechnique; } } } } function setPrimitiveModes(gltf) { var meshes = gltf.meshes; for (var meshId in meshes) { if (meshes.hasOwnProperty(meshId)) { var mesh = meshes[meshId]; var primitives = mesh.primitives; if (defined(primitives)) { var primitivesLength = primitives.length; for (var i = 0; i < primitivesLength; i++) { var primitive = primitives[i]; var defaultMode = defaultValue(primitive.primitive, WebGLConstants.TRIANGLES); primitive.mode = defaultValue(primitive.mode, defaultMode); delete primitive.primitive; } } } } } function updateNodes(gltf) { var nodes = gltf.nodes; var axis = new Cartesian3(); var quat = new Quaternion(); for (var nodeId in nodes) { if (nodes.hasOwnProperty(nodeId)) { var node = nodes[nodeId]; if (defined(node.rotation)) { var rotation = node.rotation; Cartesian3.fromArray(rotation, 0, axis); Quaternion.fromAxisAngle(axis, rotation[3], quat); node.rotation = [quat.x, quat.y, quat.z, quat.w]; } var instanceSkin = node.instanceSkin; if (defined(instanceSkin)) { node.skeletons = instanceSkin.skeletons; node.skin = instanceSkin.skin; node.meshes = instanceSkin.meshes; delete node.instanceSkin; } } } } function removeTechniquePasses(gltf) { var techniques = gltf.techniques; for (var techniqueId in techniques) { if (techniques.hasOwnProperty(techniqueId)) { var technique = techniques[techniqueId]; var passes = technique.passes; if (defined(passes)) { var passName = defaultValue(technique.pass, 'defaultPass'); if (passes.hasOwnProperty(passName)) { var pass = passes[passName]; var instanceProgram = pass.instanceProgram; technique.attributes = defaultValue(technique.attributes, instanceProgram.attributes); technique.program = defaultValue(technique.program, instanceProgram.program); technique.uniforms = defaultValue(technique.uniforms, instanceProgram.uniforms); technique.states = defaultValue(technique.states, pass.states); } delete technique.passes; delete technique.pass; } } } } function glTF08to10(gltf) { if (!defined(gltf.asset)) { gltf.asset = {}; } var asset = gltf.asset; asset.version = '1.0'; // profile should be an object, not a string if (!defined(asset.profile) || (typeof asset.profile === 'string')) { asset.profile = {}; } // version property should be in asset, not on the root element if (defined(gltf.version)) { delete gltf.version; } // material.instanceTechnique properties should be directly on the material updateInstanceTechniques(gltf); // primitive.primitive should be primitive.mode setPrimitiveModes(gltf); // node rotation should be quaternion, not axis-angle // node.instanceSkin is deprecated updateNodes(gltf); // technique.pass and techniques.passes are deprecated removeTechniquePasses(gltf); // gltf.lights -> khrMaterialsCommon.lights if (defined(gltf.lights)) { var extensions = defaultValue(gltf.extensions, {}); gltf.extensions = extensions; var materialsCommon = defaultValue(extensions.KHR_materials_common, {}); extensions.KHR_materials_common = materialsCommon; materialsCommon.lights = gltf.lights; delete gltf.lights; } // gltf.allExtensions -> extensionsUsed if (defined(gltf.allExtensions)) { gltf.extensionsUsed = gltf.allExtensions; gltf.allExtensions = undefined; } } function removeAnimationSamplersIndirection(gltf) { var animations = gltf.animations; for (var animationId in animations) { if (animations.hasOwnProperty(animationId)) { var animation = animations[animationId]; var parameters = animation.parameters; if (defined(parameters)) { var samplers = animation.samplers; for (var samplerId in samplers) { if (samplers.hasOwnProperty(samplerId)) { var sampler = samplers[samplerId]; sampler.input = parameters[sampler.input]; sampler.output = parameters[sampler.output]; } } delete animation.parameters; } } } } function objectToArray(object, mapping) { var array = []; for (var id in object) { if (object.hasOwnProperty(id)) { var value = object[id]; mapping[id] = array.length; array.push(value); if (!defined(value.name) && typeof(value) === 'object') { value.name = id; } } } return array; } function objectsToArrays(gltf) { var i; var globalMapping = { accessors: {}, animations: {}, bufferViews: {}, buffers: {}, cameras: {}, materials: {}, meshes: {}, nodes: {}, programs: {}, shaders: {}, skins: {}, techniques: {} }; // Map joint names to id names var jointName; var jointNameToId = {}; var nodes = gltf.nodes; for (var id in nodes) { if (nodes.hasOwnProperty(id)) { jointName = nodes[id].jointName; if (defined(jointName)) { jointNameToId[jointName] = id; } } } // Convert top level objects to arrays for (var topLevelId in gltf) { if (gltf.hasOwnProperty(topLevelId) && topLevelId !== 'extras' && topLevelId !== 'asset' && topLevelId !== 'extensions') { var objectMapping = {}; var object = gltf[topLevelId]; if (typeof(object) === 'object' && !Array.isArray(object)) { gltf[topLevelId] = objectToArray(object, objectMapping); globalMapping[topLevelId] = objectMapping; if (topLevelId === 'animations') { objectMapping = {}; object.samplers = objectToArray(object.samplers, objectMapping); globalMapping[topLevelId].samplers = objectMapping; } } } } // Remap joint names to array indexes for (jointName in jointNameToId) { if (jointNameToId.hasOwnProperty(jointName)) { jointNameToId[jointName] = globalMapping.nodes[jointNameToId[jointName]]; } } // Fix references if (defined(gltf.scene)) { gltf.scene = globalMapping.scenes[gltf.scene]; } ForEach.bufferView(gltf, function(bufferView) { if (defined(bufferView.buffer)) { bufferView.buffer = globalMapping.buffers[bufferView.buffer]; } }); ForEach.accessor(gltf, function(accessor) { if (defined(accessor.bufferView)) { accessor.bufferView = globalMapping.bufferViews[accessor.bufferView]; } }); ForEach.shader(gltf, function(shader) { var extensions = shader.extensions; if (defined(extensions)) { var binaryGltf = extensions.KHR_binary_glTF; if (defined(binaryGltf)) { shader.bufferView = globalMapping.bufferViews[binaryGltf.bufferView]; delete extensions.KHR_binary_glTF; } if (Object.keys(extensions).length === 0) { delete shader.extensions; } } }); ForEach.program(gltf, function(program) { if (defined(program.vertexShader)) { program.vertexShader = globalMapping.shaders[program.vertexShader]; } if (defined(program.fragmentShader)) { program.fragmentShader = globalMapping.shaders[program.fragmentShader]; } }); ForEach.technique(gltf, function(technique) { if (defined(technique.program)) { technique.program = globalMapping.programs[technique.program]; } ForEach.techniqueParameter(technique, function(parameter) { if (defined(parameter.node)) { parameter.node = globalMapping.nodes[parameter.node]; } var value = parameter.value; if (defined(value)) { if (Array.isArray(value)) { if (value.length === 1) { var textureId = value[0]; if (typeof textureId === 'string') { value[0] = globalMapping.textures[textureId]; } } } else if (typeof value === 'string') { parameter.value = [globalMapping.textures[value]]; } } }); }); ForEach.mesh(gltf, function(mesh) { ForEach.meshPrimitive(mesh, function(primitive) { if (defined(primitive.indices)) { primitive.indices = globalMapping.accessors[primitive.indices]; } ForEach.meshPrimitiveAttribute(primitive, function(accessorId, semantic) { primitive.attributes[semantic] = globalMapping.accessors[accessorId]; }); if (defined(primitive.material)) { primitive.material = globalMapping.materials[primitive.material]; } }); }); ForEach.node(gltf, function(node) { var children = node.children; if (defined(children)) { var childrenLength = children.length; for (i = 0; i < childrenLength; i++) { children[i] = globalMapping.nodes[children[i]]; } } if (defined(node.meshes)) { // Split out meshes on nodes var meshes = node.meshes; var meshesLength = meshes.length; if (meshesLength > 0) { node.mesh = globalMapping.meshes[meshes[0]]; for (i = 1; i < meshesLength; i++) { var meshNode = { mesh: globalMapping.meshes[meshes[i]], extras: { _pipeline: {} } }; var meshNodeId = addToArray(gltf.nodes, meshNode); if (!defined(children)) { children = []; node.children = children; } children.push(meshNodeId); } } delete node.meshes; } if (defined(node.camera)) { node.camera = globalMapping.cameras[node.camera]; } if (defined(node.skeletons)) { // Assign skeletons to skins var skeletons = node.skeletons; var skeletonsLength = skeletons.length; if ((skeletonsLength > 0) && defined(node.skin)) { var skin = gltf.skins[globalMapping.skins[node.skin]]; skin.skeleton = globalMapping.nodes[skeletons[0]]; } delete node.skeletons; } if (defined(node.skin)) { node.skin = globalMapping.skins[node.skin]; } if (defined(node.jointName)) { delete(node.jointName); } }); ForEach.skin(gltf, function(skin) { if (defined(skin.inverseBindMatrices)) { skin.inverseBindMatrices = globalMapping.accessors[skin.inverseBindMatrices]; } var joints = []; var jointNames = skin.jointNames; if (defined(jointNames)) { for (i = 0; i < jointNames.length; i++) { joints[i] = jointNameToId[jointNames[i]]; } skin.joints = joints; delete skin.jointNames; } }); ForEach.scene(gltf, function(scene) { var sceneNodes = scene.nodes; if (defined(sceneNodes)) { var sceneNodesLength = sceneNodes.length; for (i = 0; i < sceneNodesLength; i++) { sceneNodes[i] = globalMapping.nodes[sceneNodes[i]]; } } }); ForEach.animation(gltf, function(animation) { var samplerMapping = {}; animation.samplers = objectToArray(animation.samplers, samplerMapping); ForEach.animationSampler(animation, function(sampler) { sampler.input = globalMapping.accessors[sampler.input]; sampler.output = globalMapping.accessors[sampler.output]; }); var channels = animation.channels; if (defined(channels)) { var channelsLength = channels.length; for (i = 0; i < channelsLength; i++) { var channel = channels[i]; channel.sampler = samplerMapping[channel.sampler]; var target = channel.target; if (defined(target)) { target.node = globalMapping.nodes[target.id]; delete target.id; } } } }); ForEach.material(gltf, function(material) { if (defined(material.technique)) { material.technique = globalMapping.techniques[material.technique]; } ForEach.materialValue(material, function(value, name) { if (Array.isArray(value)) { if (value.length === 1) { var textureId = value[0]; if (typeof textureId === 'string') { value[0] = globalMapping.textures[textureId]; } } } else if (typeof value === 'string') { material.values[name] = { index : globalMapping.textures[value] }; } }); var extensions = material.extensions; if (defined(extensions)) { var materialsCommon = extensions.KHR_materials_common; if (defined(materialsCommon)) { ForEach.materialValue(materialsCommon, function(value, name) { if (Array.isArray(value)) { if (value.length === 1) { var textureId = value[0]; if (typeof textureId === 'string') { value[0] = globalMapping.textures[textureId]; } } } else if (typeof value === 'string') { materialsCommon.values[name] = { index: globalMapping.textures[value] }; } }); } } }); ForEach.image(gltf, function(image) { var extensions = image.extensions; if (defined(extensions)) { var binaryGltf = extensions.KHR_binary_glTF; if (defined(binaryGltf)) { image.bufferView = globalMapping.bufferViews[binaryGltf.bufferView]; image.mimeType = binaryGltf.mimeType; delete extensions.KHR_binary_glTF; } if (Object.keys(extensions).length === 0) { delete image.extensions; } } if (defined(image.extras)) { var compressedImages = image.extras.compressedImage3DTiles; for (var type in compressedImages) { if (compressedImages.hasOwnProperty(type)) { var compressedImage = compressedImages[type]; var compressedExtensions = compressedImage.extensions; if (defined(compressedExtensions)) { var compressedBinaryGltf = compressedExtensions.KHR_binary_glTF; if (defined(compressedBinaryGltf)) { compressedImage.bufferView = globalMapping.bufferViews[compressedBinaryGltf.bufferView]; compressedImage.mimeType = compressedBinaryGltf.mimeType; delete compressedExtensions.KHR_binary_glTF; } if (Object.keys(compressedExtensions).length === 0) { delete compressedImage.extensions; } } } } } }); ForEach.texture(gltf, function(texture) { if (defined(texture.sampler)) { texture.sampler = globalMapping.samplers[texture.sampler]; } if (defined(texture.source)) { texture.source = globalMapping.images[texture.source]; } }); } function stripProfile(gltf) { var asset = gltf.asset; delete asset.profile; } var knownExtensions = { CESIUM_RTC : true, KHR_materials_common : true, WEB3D_quantized_attributes : true }; function requireKnownExtensions(gltf) { var extensionsUsed = gltf.extensionsUsed; gltf.extensionsRequired = defaultValue(gltf.extensionsRequired, []); if (defined(extensionsUsed)) { var extensionsUsedLength = extensionsUsed.length; for (var i = 0; i < extensionsUsedLength; i++) { var extension = extensionsUsed[i]; if (defined(knownExtensions[extension])) { gltf.extensionsRequired.push(extension); } } } } function removeBufferType(gltf) { ForEach.buffer(gltf, function(buffer) { delete buffer.type; }); } function requireAttributeSetIndex(gltf) { ForEach.mesh(gltf, function(mesh) { ForEach.meshPrimitive(mesh, function(primitive) { ForEach.meshPrimitiveAttribute(primitive, function(accessorId, semantic) { if (semantic === 'TEXCOORD') { primitive.attributes.TEXCOORD_0 = accessorId; } else if (semantic === 'COLOR') { primitive.attributes.COLOR_0 = accessorId; } }); delete primitive.attributes.TEXCOORD; delete primitive.attributes.COLOR; }); }); ForEach.technique(gltf, function(technique) { ForEach.techniqueParameter(technique, function(parameter) { var semantic = parameter.semantic; if (defined(semantic)) { if (semantic === 'TEXCOORD') { parameter.semantic = 'TEXCOORD_0'; } else if (semantic === 'COLOR') { parameter.semantic = 'COLOR_0'; } } }); }); } var knownSemantics = { POSITION: true, NORMAL: true, TEXCOORD: true, COLOR: true, JOINT: true, WEIGHT: true }; function underscoreApplicationSpecificSemantics(gltf) { var mappedSemantics = {}; ForEach.mesh(gltf, function(mesh) { ForEach.meshPrimitive(mesh, function(primitive) { /* jshint unused:vars */ ForEach.meshPrimitiveAttribute(primitive, function(accessorId, semantic) { if (semantic.charAt(0) !== '_') { var setIndex = semantic.search(/_[0-9]+/g); var strippedSemantic = semantic; if (setIndex >= 0) { strippedSemantic = semantic.substring(0, setIndex); } if (!defined(knownSemantics[strippedSemantic])) { var newSemantic = '_' + semantic; mappedSemantics[semantic] = newSemantic; } } }); for (var semantic in mappedSemantics) { if (mappedSemantics.hasOwnProperty(semantic)) { var mappedSemantic = mappedSemantics[semantic]; var accessorId = primitive.attributes[semantic]; if (defined(accessorId)) { delete primitive.attributes[semantic]; primitive.attributes[mappedSemantic] = accessorId; } } } }); }); ForEach.technique(gltf, function(technique) { ForEach.techniqueParameter(technique, function(parameter) { var mappedSemantic = mappedSemantics[parameter.semantic]; if (defined(mappedSemantic)) { parameter.semantic = mappedSemantic; } }); }); } function removeScissorFromTechniques(gltf) { ForEach.technique(gltf, function(technique) { var techniqueStates = technique.states; if (defined(techniqueStates)) { var techniqueFunctions = techniqueStates.functions; if (defined(techniqueFunctions)) { delete techniqueFunctions.scissor; } var enableStates = techniqueStates.enable; if (defined(enableStates)) { var scissorIndex = enableStates.indexOf(WebGLConstants.SCISSOR_TEST); if (scissorIndex >= 0) { enableStates.splice(scissorIndex, 1); } } } }); } function clampTechniqueFunctionStates(gltf) { ForEach.technique(gltf, function(technique) { var techniqueStates = technique.states; if (defined(techniqueStates)) { var functions = techniqueStates.functions; if (defined(functions)) { var blendColor = functions.blendColor; if (defined(blendColor)) { for (var i = 0; i < 4; i++) { blendColor[i] = CesiumMath.clamp(blendColor[i], 0.0, 1.0); } } var depthRange = functions.depthRange; if (defined(depthRange)) { depthRange[1] = CesiumMath.clamp(depthRange[1], 0.0, 1.0); depthRange[0] = CesiumMath.clamp(depthRange[0], 0.0, depthRange[1]); } } } }); } function clampCameraParameters(gltf) { ForEach.camera(gltf, function(camera) { var perspective = camera.perspective; if (defined(perspective)) { var aspectRatio = perspective.aspectRatio; if (defined(aspectRatio) && aspectRatio === 0.0) { delete perspective.aspectRatio; } var yfov = perspective.yfov; if (defined(yfov) && yfov === 0.0) { perspective.yfov = 1.0; } } }); } function requireByteLength(gltf) { ForEach.buffer(gltf, function(buffer) { if (!defined(buffer.byteLength)) { buffer.byteLength = buffer.extras._pipeline.source.length; } }); ForEach.bufferView(gltf, function(bufferView) { if (!defined(bufferView.byteLength)) { var bufferViewBufferId = bufferView.buffer; var bufferViewBuffer = gltf.buffers[bufferViewBufferId]; bufferView.byteLength = bufferViewBuffer.byteLength; } }); } function moveByteStrideToBufferView(gltf) { var bufferViews = gltf.bufferViews; var bufferViewsToDelete = {}; ForEach.accessor(gltf, function(accessor) { var oldBufferViewId = accessor.bufferView; if (defined(oldBufferViewId)) { if (!defined(bufferViewsToDelete[oldBufferViewId])) { bufferViewsToDelete[oldBufferViewId] = true; } var bufferView = clone(bufferViews[oldBufferViewId]); var accessorByteStride = (defined(accessor.byteStride) && accessor.byteStride !== 0) ? accessor.byteStride : getAccessorByteStride(gltf, accessor); if (defined(accessorByteStride)) { bufferView.byteStride = accessorByteStride; if (bufferView.byteStride !== 0) { bufferView.byteLength = accessor.count * accessorByteStride; } bufferView.byteOffset += accessor.byteOffset; accessor.byteOffset = 0; delete accessor.byteStride; } accessor.bufferView = addToArray(bufferViews, bufferView); } }); var bufferViewShiftMap = {}; var bufferViewRemovalCount = 0; /* jshint unused:vars */ ForEach.bufferView(gltf, function(bufferView, bufferViewId) { if (defined(bufferViewsToDelete[bufferViewId])) { bufferViewRemovalCount++; } else { bufferViewShiftMap[bufferViewId] = bufferViewId - bufferViewRemovalCount; } }); var removedCount = 0; for (var bufferViewId in bufferViewsToDelete) { if (defined(bufferViewId)) { var index = parseInt(bufferViewId) - removedCount; bufferViews.splice(index, 1); removedCount++; } } ForEach.accessor(gltf, function(accessor) { var accessorBufferView = accessor.bufferView; if (defined(accessorBufferView)) { accessor.bufferView = bufferViewShiftMap[accessorBufferView]; } }); ForEach.shader(gltf, function(shader) { var shaderBufferView = shader.bufferView; if (defined(shaderBufferView)) { shader.bufferView = bufferViewShiftMap[shaderBufferView]; } }); ForEach.image(gltf, function(image) { var imageBufferView = image.bufferView; if (defined(imageBufferView)) { image.bufferView = bufferViewShiftMap[imageBufferView]; } if (defined(image.extras)) { var compressedImages = image.extras.compressedImage3DTiles; for (var type in compressedImages) { if (compressedImages.hasOwnProperty(type)) { var compressedImage = compressedImages[type]; var compressedImageBufferView = compressedImage.bufferView; if (defined(compressedImageBufferView)) { compressedImage.bufferView = bufferViewShiftMap[compressedImageBufferView]; } } } } }); } function stripTechniqueAttributeValues(gltf) { ForEach.technique(gltf, function(technique) { ForEach.techniqueAttribute(technique, function(attribute) { var parameter = technique.parameters[attribute]; if (defined(parameter.value)) { delete parameter.value; } }); }); } function stripTechniqueParameterCount(gltf) { ForEach.technique(gltf, function(technique) { ForEach.techniqueParameter(technique, function(parameter) { if (defined(parameter.count)) { var semantic = parameter.semantic; if (!defined(semantic) || (semantic !== 'JOINTMATRIX' && semantic.indexOf('_') !== 0)) { delete parameter.count; } } }); }); } function addKHRTechniqueExtension(gltf) { var techniques = gltf.techniques; if (defined(techniques) && techniques.length > 0) { addExtensionsRequired(gltf, 'KHR_technique_webgl'); } } function glTF10to20(gltf) { if (!defined(gltf.asset)) { gltf.asset = {}; } var asset = gltf.asset; asset.version = '2.0'; // material.instanceTechnique properties should be directly on the material. instanceTechnique is a gltf 0.8 property but is seen in some 1.0 models. updateInstanceTechniques(gltf); // animation.samplers now refers directly to accessors and animation.parameters should be removed removeAnimationSamplersIndirection(gltf); // top-level objects are now arrays referenced by index instead of id objectsToArrays(gltf); // asset.profile no longer exists stripProfile(gltf); // move known extensions from extensionsUsed to extensionsRequired requireKnownExtensions(gltf); // bufferView.byteLength and buffer.byteLength are required requireByteLength(gltf); // byteStride moved from accessor to bufferView moveByteStrideToBufferView(gltf); // buffer.type is unnecessary and should be removed removeBufferType(gltf); // TEXCOORD and COLOR attributes must be written with a set index (TEXCOORD_#) requireAttributeSetIndex(gltf); // Add underscores to application-specific parameters underscoreApplicationSpecificSemantics(gltf); // remove scissor from techniques removeScissorFromTechniques(gltf); // clamp technique function states to min/max clampTechniqueFunctionStates(gltf); // clamp camera parameters clampCameraParameters(gltf); // a technique parameter specified as an attribute cannot have a value stripTechniqueAttributeValues(gltf); // only techniques with a JOINTMATRIX or application specific semantic may have a defined count property stripTechniqueParameterCount(gltf); // add KHR_technique_webgl extension addKHRTechniqueExtension(gltf); } return updateVersion; });
EnquistLab/ffdm-frontend
public/assets/images/Workers/ThirdParty/GltfPipeline/updateVersion.js
JavaScript
apache-2.0
36,201
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.Diagnostics; using System.Threading; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ErrorLogger; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Navigation; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.Editor; using Microsoft.VisualStudio.LanguageServices.Implementation.Extensions; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; using Microsoft.VisualStudio.LanguageServices.Implementation.Venus; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.TextManager.Interop; using Roslyn.Utilities; using TextSpan = Microsoft.CodeAnalysis.Text.TextSpan; using VsTextSpan = Microsoft.VisualStudio.TextManager.Interop.TextSpan; namespace Microsoft.VisualStudio.LanguageServices.Implementation { using Workspace = Microsoft.CodeAnalysis.Workspace; internal sealed class VisualStudioDocumentNavigationService : ForegroundThreadAffinitizedObject, IDocumentNavigationService { private readonly IServiceProvider _serviceProvider; private readonly IVsEditorAdaptersFactoryService _editorAdaptersFactoryService; public VisualStudioDocumentNavigationService( SVsServiceProvider serviceProvider, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) { _serviceProvider = serviceProvider; _editorAdaptersFactoryService = editorAdaptersFactoryService; } public bool CanNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan) { // Navigation should not change the context of linked files and Shared Projects. documentId = workspace.GetDocumentIdInCurrentContext(documentId); if (!IsSecondaryBuffer(workspace, documentId)) { return true; } var document = workspace.CurrentSolution.GetDocument(documentId); var text = document.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None); var boundedTextSpan = GetSpanWithinDocumentBounds(textSpan, text.Length); if (boundedTextSpan != textSpan) { try { throw new ArgumentOutOfRangeException(); } catch (ArgumentOutOfRangeException e) when (FatalError.ReportWithoutCrash(e)) { } return false; } var vsTextSpan = text.GetVsTextSpanForSpan(textSpan); return CanMapFromSecondaryBufferToPrimaryBuffer(workspace, documentId, vsTextSpan); } public bool CanNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset) { // Navigation should not change the context of linked files and Shared Projects. documentId = workspace.GetDocumentIdInCurrentContext(documentId); if (!IsSecondaryBuffer(workspace, documentId)) { return true; } var document = workspace.CurrentSolution.GetDocument(documentId); var text = document.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None); var vsTextSpan = text.GetVsTextSpanForLineOffset(lineNumber, offset); return CanMapFromSecondaryBufferToPrimaryBuffer(workspace, documentId, vsTextSpan); } public bool CanNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0) { // Navigation should not change the context of linked files and Shared Projects. documentId = workspace.GetDocumentIdInCurrentContext(documentId); if (!IsSecondaryBuffer(workspace, documentId)) { return true; } var document = workspace.CurrentSolution.GetDocument(documentId); var text = document.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None); var boundedPosition = GetPositionWithinDocumentBounds(position, text.Length); if (boundedPosition != position) { try { throw new ArgumentOutOfRangeException(); } catch (ArgumentOutOfRangeException e) when (FatalError.ReportWithoutCrash(e)) { } return false; } var vsTextSpan = text.GetVsTextSpanForPosition(position, virtualSpace); return CanMapFromSecondaryBufferToPrimaryBuffer(workspace, documentId, vsTextSpan); } public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options) { // Navigation should not change the context of linked files and Shared Projects. documentId = workspace.GetDocumentIdInCurrentContext(documentId); if (!IsForeground()) { throw new InvalidOperationException(ServicesVSResources.Navigation_must_be_performed_on_the_foreground_thread); } var document = OpenDocument(workspace, documentId, options); if (document == null) { return false; } var text = document.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None); var textBuffer = text.Container.GetTextBuffer(); var boundedTextSpan = GetSpanWithinDocumentBounds(textSpan, text.Length); if (boundedTextSpan != textSpan) { try { throw new ArgumentOutOfRangeException(); } catch (ArgumentOutOfRangeException e) when (FatalError.ReportWithoutCrash(e)) { } } var vsTextSpan = text.GetVsTextSpanForSpan(boundedTextSpan); if (IsSecondaryBuffer(workspace, documentId) && !vsTextSpan.TryMapSpanFromSecondaryBufferToPrimaryBuffer(workspace, documentId, out vsTextSpan)) { return false; } return NavigateTo(textBuffer, vsTextSpan); } public bool TryNavigateToLineAndOffset(Workspace workspace, DocumentId documentId, int lineNumber, int offset, OptionSet options) { // Navigation should not change the context of linked files and Shared Projects. documentId = workspace.GetDocumentIdInCurrentContext(documentId); if (!IsForeground()) { throw new InvalidOperationException(ServicesVSResources.Navigation_must_be_performed_on_the_foreground_thread); } var document = OpenDocument(workspace, documentId, options); if (document == null) { return false; } var text = document.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None); var textBuffer = text.Container.GetTextBuffer(); var vsTextSpan = text.GetVsTextSpanForLineOffset(lineNumber, offset); if (IsSecondaryBuffer(workspace, documentId) && !vsTextSpan.TryMapSpanFromSecondaryBufferToPrimaryBuffer(workspace, documentId, out vsTextSpan)) { return false; } return NavigateTo(textBuffer, vsTextSpan); } public bool TryNavigateToPosition(Workspace workspace, DocumentId documentId, int position, int virtualSpace, OptionSet options) { // Navigation should not change the context of linked files and Shared Projects. documentId = workspace.GetDocumentIdInCurrentContext(documentId); if (!IsForeground()) { throw new InvalidOperationException(ServicesVSResources.Navigation_must_be_performed_on_the_foreground_thread); } var document = OpenDocument(workspace, documentId, options); if (document == null) { return false; } var text = document.GetTextAsync(CancellationToken.None).WaitAndGetResult(CancellationToken.None); var textBuffer = text.Container.GetTextBuffer(); var boundedPosition = GetPositionWithinDocumentBounds(position, text.Length); if (boundedPosition != position) { try { throw new ArgumentOutOfRangeException(); } catch (ArgumentOutOfRangeException e) when (FatalError.ReportWithoutCrash(e)) { } } var vsTextSpan = text.GetVsTextSpanForPosition(boundedPosition, virtualSpace); if (IsSecondaryBuffer(workspace, documentId) && !vsTextSpan.TryMapSpanFromSecondaryBufferToPrimaryBuffer(workspace, documentId, out vsTextSpan)) { return false; } return NavigateTo(textBuffer, vsTextSpan); } /// <summary> /// It is unclear why, but we are sometimes asked to navigate to a position that is not /// inside the bounds of the associated <see cref="Document"/>. This method returns a /// position that is guaranteed to be inside the <see cref="Document"/> bounds. If the /// returned position is different from the given position, then the worst observable /// behavior is either no navigation or navigation to the end of the document. See the /// following bugs for more details: /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=112211 /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=136895 /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=224318 /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=235409 /// </summary> private static int GetPositionWithinDocumentBounds(int position, int documentLength) { return Math.Min(documentLength, Math.Max(position, 0)); } /// <summary> /// It is unclear why, but we are sometimes asked to navigate to a <see cref="TextSpan"/> /// that is not inside the bounds of the associated <see cref="Document"/>. This method /// returns a span that is guaranteed to be inside the <see cref="Document"/> bounds. If /// the returned span is different from the given span, then the worst observable behavior /// is either no navigation or navigation to the end of the document. /// See https://github.com/dotnet/roslyn/issues/7660 for more details. /// </summary> private static TextSpan GetSpanWithinDocumentBounds(TextSpan span, int documentLength) { return TextSpan.FromBounds(GetPositionWithinDocumentBounds(span.Start, documentLength), GetPositionWithinDocumentBounds(span.End, documentLength)); } private static Document OpenDocument(Workspace workspace, DocumentId documentId, OptionSet options) { options = options ?? workspace.Options; // Always open the document again, even if the document is already open in the // workspace. If a document is already open in a preview tab and it is opened again // in a permanent tab, this allows the document to transition to the new state. if (workspace.CanOpenDocuments) { if (options.GetOption(NavigationOptions.PreferProvisionalTab)) { // If we're just opening the provisional tab, then do not "activate" the document // (i.e. don't give it focus). This way if a user is just arrowing through a set // of FindAllReferences results, they don't have their cursor placed into the document. var state = __VSNEWDOCUMENTSTATE.NDS_Provisional | __VSNEWDOCUMENTSTATE.NDS_NoActivate; using (var scope = new NewDocumentStateScope(state, VSConstants.NewDocumentStateReason.Navigation)) { workspace.OpenDocument(documentId); } } else { workspace.OpenDocument(documentId); } } if (!workspace.IsDocumentOpen(documentId)) { return null; } return workspace.CurrentSolution.GetDocument(documentId); } private bool NavigateTo(ITextBuffer textBuffer, VsTextSpan vsTextSpan) { using (Logger.LogBlock(FunctionId.NavigationService_VSDocumentNavigationService_NavigateTo, CancellationToken.None)) { var vsTextBuffer = _editorAdaptersFactoryService.GetBufferAdapter(textBuffer); if (vsTextBuffer == null) { Debug.Fail("Could not get IVsTextBuffer for document!"); return false; } var textManager = (IVsTextManager2)_serviceProvider.GetService(typeof(SVsTextManager)); if (textManager == null) { Debug.Fail("Could not get IVsTextManager service!"); return false; } return ErrorHandler.Succeeded( textManager.NavigateToLineAndColumn2( vsTextBuffer, VSConstants.LOGVIEWID.TextView_guid, vsTextSpan.iStartLine, vsTextSpan.iStartIndex, vsTextSpan.iEndLine, vsTextSpan.iEndIndex, (uint)_VIEWFRAMETYPE.vftCodeWindow)); } } private bool IsSecondaryBuffer(Workspace workspace, DocumentId documentId) { var visualStudioWorkspace = workspace as VisualStudioWorkspaceImpl; if (visualStudioWorkspace == null) { return false; } var containedDocument = visualStudioWorkspace.GetHostDocument(documentId) as ContainedDocument; if (containedDocument == null) { return false; } return true; } private bool CanMapFromSecondaryBufferToPrimaryBuffer(Workspace workspace, DocumentId documentId, VsTextSpan spanInSecondaryBuffer) { return spanInSecondaryBuffer.TryMapSpanFromSecondaryBufferToPrimaryBuffer(workspace, documentId, out var spanInPrimaryBuffer); } } }
jkotas/roslyn
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
C#
apache-2.0
15,102
/* * 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.jena.sparql.expr; import org.apache.jena.sparql.expr.nodevalue.XSDFuncOp ; import org.apache.jena.sparql.sse.Tags ; public class E_StrEncodeForURI extends ExprFunction1 { private static final String symbol = Tags.tagStrEncodeForURI ; public E_StrEncodeForURI(Expr expr) { super(expr, symbol) ; } @Override public NodeValue eval(NodeValue v) { return XSDFuncOp.strEncodeForURI(v) ; } @Override public Expr copy(Expr expr) { return new E_StrEncodeForURI(expr) ; } }
tr3vr/jena
jena-arq/src/main/java/org/apache/jena/sparql/expr/E_StrEncodeForURI.java
Java
apache-2.0
1,365
/* *Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * *WSO2 Inc. 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.wso2.appserver.ui.integration.test.webapp.spring; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.wso2.appserver.integration.common.ui.page.LoginPage; import org.wso2.appserver.integration.common.ui.page.main.WebAppListPage; import org.wso2.appserver.integration.common.ui.page.main.WebAppUploadingPage; import org.wso2.appserver.integration.common.utils.ASIntegrationUITest; import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.automation.test.utils.common.TestConfigurationProvider; import java.io.File; import java.io.IOException; import java.util.Calendar; import static org.testng.AssertJUnit.assertTrue; /** * This class tests the deployment and accessibility of a web application which use spring framework */ public class SpringWebApplicationDeploymentTestCase extends ASIntegrationUITest { private WebDriver driver; private final String context = "/booking-faces"; @BeforeClass(alwaysRun = true, enabled = false) public void setUp() throws Exception { super.init(); driver = BrowserManager.getWebDriver(); driver.get(getLoginURL()); LoginPage test = new LoginPage(driver); test.loginAs(userInfo.getUserName(), userInfo.getPassword()); } @Test(groups = "wso2.as", description = "Uploading the web app which use spring", enabled = false) public void uploadSpringWebApplicationTest() throws Exception { String filePath = TestConfigurationProvider.getResourceLocation("AS") + File.separator + "war" + File.separator + "spring" + File.separator + "booking-faces.war"; WebAppUploadingPage uploadPage = new WebAppUploadingPage(driver); Assert.assertTrue(uploadPage.uploadWebApp(filePath), "Web Application uploading failed"); } @Test(groups = "wso2.as", description = "Verifying Deployment the web app which use spring" , dependsOnMethods = "uploadSpringWebApplicationTest", enabled = false) public void webApplicationDeploymentTest() throws Exception { WebAppListPage webAppListPage = new WebAppListPage(driver); assertTrue("Web Application Deployment Failed. Web Application /booking-faces not found in Web application List" , isWebAppDeployed(webAppListPage, context)); driver.findElement(By.id("webappsTable")).findElement(By.linkText("/booking-faces")).click(); } @Test(groups = "wso2.as", description = "Access the spring application" , dependsOnMethods = "webApplicationDeploymentTest", enabled = false) public void invokeSpringApplicationTest() throws Exception { WebDriver driverForApp = null; try { driverForApp = BrowserManager.getWebDriver(); //Go to application driverForApp.get(webAppURL + "/booking-faces/spring/intro"); driverForApp.findElement(By.linkText("Start your Spring Travel experience")).click(); //searching hotels to reserve driverForApp.findElement(By.xpath("//*[@id=\"j_idt13:searchString\"]")).sendKeys("Con"); driverForApp.findElement(By.xpath("//*[@id=\"j_idt13:findHotels\"]")).click(); //view hotel information driverForApp.findElement(By.xpath("//*[@id=\"j_idt12:hotels:0:viewHotelLink\"]")).click(); //go to book hotel driverForApp.findElement(By.xpath("//*[@id=\"hotel:book\"]")).click(); //providing user name and password driverForApp.findElement(By.xpath("/html/body/div/div[3]/div[2]/div[2]/form/fieldset/p[1]/input")) .sendKeys("keith"); driverForApp.findElement(By.xpath("/html/body/div/div[3]/div[2]/div[2]/form/fieldset/p[2]/input")) .sendKeys("melbourne"); //authenticating driverForApp.findElement(By.xpath("/html/body/div/div[3]/div[2]/div[2]/form/fieldset/p[4]/input")) .click(); //booking hotel driverForApp.findElement(By.xpath("//*[@id=\"hotel:book\"]")).click(); //providing payments information driverForApp.findElement(By.xpath("//*[@id=\"bookingForm:creditCard\"]")).sendKeys("1234567890123456"); driverForApp.findElement(By.xpath("//*[@id=\"bookingForm:creditCardName\"]")).sendKeys("xyz"); //proceed transaction driverForApp.findElement(By.xpath("//*[@id=\"bookingForm:proceed\"]")).click(); //confirm booking driverForApp.findElement(By.xpath("//*[@id=\"j_idt13:confirm\"]")).click(); //verify whether the hotel booked is in the booked hotel tabled Assert.assertEquals(driverForApp.findElement(By.xpath("//*[@id=\"bookings_header\"]")).getText() , "Your Hotel Bookings", "Booked Hotel table Not Found"); //verify the hotel name is exist in the booked hotel table Assert.assertEquals(driverForApp.findElement(By.xpath("//*[@id=\"j_idt23:j_idt24_data\"]/tr/td[1]")) .getText(), "Conrad Miami\n" + "1395 Brickell Ave\n" + "Miami, FL", "Hotel Name mismatch"); } finally { if (driverForApp != null) { driverForApp.quit(); } } } @AfterClass(alwaysRun = true, enabled = false) public void deleteWebApplication() throws Exception { try { WebAppListPage webAppListPage = new WebAppListPage(driver); if (webAppListPage.findWebApp(context)) { Assert.assertTrue(webAppListPage.deleteWebApp(context), "Web Application Deletion failed"); Assert.assertTrue(isWebAppUnDeployed(webAppListPage, context)); } } finally { driver.quit(); } } private boolean isWebAppDeployed(WebAppListPage listPage, String webAppContext) throws IOException { boolean isServiceDeployed = false; Calendar startTime = Calendar.getInstance(); long time; while ((time = (Calendar.getInstance().getTimeInMillis() - startTime.getTimeInMillis())) < 1000 * 60 * 2) { listPage = new WebAppListPage(driver); if (listPage.findWebApp(webAppContext)) { isServiceDeployed = true; break; } try { Thread.sleep(1000); } catch (InterruptedException ignored) { } } return isServiceDeployed; } private boolean isWebAppUnDeployed(WebAppListPage listPage, String webAppContext) throws IOException { boolean isServiceUnDeployed = false; Calendar startTime = Calendar.getInstance(); long time; while ((time = (Calendar.getInstance().getTimeInMillis() - startTime.getTimeInMillis())) < 1000 * 60 * 2) { listPage = new WebAppListPage(driver); if (!listPage.findWebApp(webAppContext)) { isServiceUnDeployed = true; break; } try { Thread.sleep(1000); } catch (InterruptedException ignored) { } } return isServiceUnDeployed; } }
kasungayan/product-as
modules/integration/tests-ui-integration/tests-ui/src/test/java/org/wso2/appserver/ui/integration/test/webapp/spring/SpringWebApplicationDeploymentTestCase.java
Java
apache-2.0
8,185
/* * 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.flink.streaming.connectors.kinesis.proxy; import org.apache.flink.annotation.Internal; import software.amazon.awssdk.services.kinesis.model.DeregisterStreamConsumerResponse; import software.amazon.awssdk.services.kinesis.model.DescribeStreamConsumerResponse; import software.amazon.awssdk.services.kinesis.model.DescribeStreamSummaryResponse; import software.amazon.awssdk.services.kinesis.model.RegisterStreamConsumerResponse; import software.amazon.awssdk.services.kinesis.model.SubscribeToShardRequest; import software.amazon.awssdk.services.kinesis.model.SubscribeToShardResponseHandler; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; /** * Interface for a Kinesis proxy using AWS SDK v2.x operating on multiple Kinesis streams within the * same AWS service region. */ @Internal public interface KinesisProxyV2Interface { DescribeStreamSummaryResponse describeStreamSummary(String stream) throws InterruptedException, ExecutionException; DescribeStreamConsumerResponse describeStreamConsumer(final String streamConsumerArn) throws InterruptedException, ExecutionException; DescribeStreamConsumerResponse describeStreamConsumer( final String streamArn, final String consumerName) throws InterruptedException, ExecutionException; RegisterStreamConsumerResponse registerStreamConsumer( final String streamArn, final String consumerName) throws InterruptedException, ExecutionException; DeregisterStreamConsumerResponse deregisterStreamConsumer(final String consumerArn) throws InterruptedException, ExecutionException; CompletableFuture<Void> subscribeToShard( SubscribeToShardRequest request, SubscribeToShardResponseHandler responseHandler); /** Destroy any open resources used by the factory. */ default void close() { // Do nothing by default } }
apache/flink
flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/proxy/KinesisProxyV2Interface.java
Java
apache-2.0
2,775
cask 'dragthing' do version '5.9.12' sha256 '4a351c593aff1c3214613d622a4e81f184e8ae238df6db921dd822efeefe27e6' # amazonaws.com is the official download host per the vendor homepage url "https://s3.amazonaws.com/tlasystems/DragThing-#{version}.dmg" name 'DragThing' homepage 'http://www.dragthing.com' license :freemium app 'DragThing.app' end
mingzhi22/homebrew-cask
Casks/dragthing.rb
Ruby
bsd-2-clause
361
<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Mvc\Router\Http\TestAsset; use Zend\Mvc\Router\Http\RouteInterface; use Zend\Mvc\Router\Http\RouteMatch; use Zend\Stdlib\RequestInterface; /** * Dummy route. * */ class DummyRouteWithParam extends DummyRoute { /** * match(): defined by RouteInterface interface. * * @see Route::match() * @param RequestInterface $request * @return RouteMatch */ public function match(RequestInterface $request) { return new RouteMatch(array('foo' => 'bar'), -4); } /** * assemble(): defined by RouteInterface interface. * * @see Route::assemble() * @param array $params * @param array $options * @return mixed */ public function assemble(array $params = null, array $options = null) { if (isset($params['foo'])) { return $params['foo']; } return ''; } }
exclie/Imagenologia
vendor/zendframework/zendframework/tests/ZendTest/Mvc/Router/Http/TestAsset/DummyRouteWithParam.php
PHP
bsd-3-clause
1,223
goog.module('javascript.protobuf.conformance'); const ConformanceRequest = goog.require('proto.conformance.ConformanceRequest'); const ConformanceResponse = goog.require('proto.conformance.ConformanceResponse'); const TestAllTypesProto2 = goog.require('proto.conformance.TestAllTypesProto2'); const TestAllTypesProto3 = goog.require('proto.conformance.TestAllTypesProto3'); const WireFormat = goog.require('proto.conformance.WireFormat'); const base64 = goog.require('goog.crypt.base64'); /** * Creates a `proto.conformance.ConformanceResponse` response according to the * `proto.conformance.ConformanceRequest` request. * @param {!ConformanceRequest} request * @return {!ConformanceResponse} response */ function doTest(request) { const response = ConformanceResponse.createEmpty(); if(request.getPayloadCase() === ConformanceRequest.PayloadCase.JSON_PAYLOAD) { response.setSkipped('Json is not supported as input format.'); return response; } if(request.getPayloadCase() === ConformanceRequest.PayloadCase.TEXT_PAYLOAD) { response.setSkipped('Text format is not supported as input format.'); return response; } if(request.getPayloadCase() === ConformanceRequest.PayloadCase.PAYLOAD_NOT_SET) { response.setRuntimeError('Request didn\'t have payload.'); return response; } if(request.getPayloadCase() !== ConformanceRequest.PayloadCase.PROTOBUF_PAYLOAD) { throw new Error('Request didn\'t have accepted input format.'); } if (request.getRequestedOutputFormat() === WireFormat.JSON) { response.setSkipped('Json is not supported as output format.'); return response; } if (request.getRequestedOutputFormat() === WireFormat.TEXT_FORMAT) { response.setSkipped('Text format is not supported as output format.'); return response; } if (request.getRequestedOutputFormat() === WireFormat.TEXT_FORMAT) { response.setRuntimeError('Unspecified output format'); return response; } if (request.getRequestedOutputFormat() !== WireFormat.PROTOBUF) { throw new Error('Request didn\'t have accepted output format.'); } if (request.getMessageType() === 'conformance.FailureSet') { response.setProtobufPayload(new ArrayBuffer(0)); } else if ( request.getMessageType() === 'protobuf_test_messages.proto2.TestAllTypesProto2') { try { const testMessage = TestAllTypesProto2.deserialize(request.getProtobufPayload()); response.setProtobufPayload(testMessage.serialize()); } catch (err) { response.setParseError(err.toString()); } } else if ( request.getMessageType() === 'protobuf_test_messages.proto3.TestAllTypesProto3') { try { const testMessage = TestAllTypesProto3.deserialize(request.getProtobufPayload()); response.setProtobufPayload(testMessage.serialize()); } catch (err) { response.setParseError(err.toString()); } } else { throw new Error( `Payload message not supported: ${request.getMessageType()}.`); } return response; } /** * Same as doTest, but both request and response are in base64. * @param {string} base64Request * @return {string} response */ function runConformanceTest(base64Request) { const request = ConformanceRequest.deserialize( base64.decodeStringToUint8Array(base64Request).buffer); const response = doTest(request); return base64.encodeByteArray(new Uint8Array(response.serialize())); } // Needed for node test exports.doTest = doTest; // Needed for browser test goog.exportSymbol('runConformanceTest', runConformanceTest);
nwjs/chromium.src
third_party/protobuf/js/experimental/runtime/kernel/conformance/conformance_testee.js
JavaScript
bsd-3-clause
3,602
require 'spec_helper' module RailsBestPractices::Core describe Klasses do it { should be_a_kind_of Array } context "Klass" do context "#class_name" do it "gets class name without module" do klass = Klass.new("BlogPost", "Post", []) expect(klass.class_name).to eq("BlogPost") end it "gets class name with moduel" do klass = Klass.new("BlogPost", "Post", ["Admin"]) expect(klass.class_name).to eq("Admin::BlogPost") end end context "#extend_class_name" do it "gets extend class name without module" do klass = Klass.new("BlogPost", "Post", []) expect(klass.extend_class_name).to eq("Post") end it "gets extend class name with module" do klass = Klass.new("BlogPost", "Post", ["Admin"]) expect(klass.extend_class_name).to eq("Admin::Post") end end it "gets to_s equal to class_name" do klass = Klass.new("BlogPost", "Post", ["Admin"]) expect(klass.to_s).to eq(klass.class_name) end end end end
eprislac/guard-yard
vendor/jruby/1.9/gems/rails_best_practices-1.15.7/spec/rails_best_practices/core/klasses_spec.rb
Ruby
mit
1,109
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================================= ** ** Class: ArithmeticException ** ** ** Purpose: Exception class for bad arithmetic conditions! ** ** =============================================================================*/ namespace System { using System; using System.Runtime.Serialization; // The ArithmeticException is thrown when overflow or underflow // occurs. // [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public class ArithmeticException : SystemException { // Creates a new ArithmeticException with its message string set to // the empty string, its HRESULT set to COR_E_ARITHMETIC, // and its ExceptionInfo reference set to null. public ArithmeticException() : base(Environment.GetResourceString("Arg_ArithmeticException")) { SetErrorCode(__HResults.COR_E_ARITHMETIC); } // Creates a new ArithmeticException with its message string set to // message, its HRESULT set to COR_E_ARITHMETIC, // and its ExceptionInfo reference set to null. // public ArithmeticException(String message) : base(message) { SetErrorCode(__HResults.COR_E_ARITHMETIC); } public ArithmeticException(String message, Exception innerException) : base(message, innerException) { SetErrorCode(__HResults.COR_E_ARITHMETIC); } protected ArithmeticException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
sekcheong/referencesource
mscorlib/system/arithmeticexception.cs
C#
mit
1,736
// 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 Microsoft.DotNet.Build.VstsBuildsApi.Configuration; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Microsoft.DotNet.Build.VstsBuildsApi { internal class VstsReleaseHttpClient : VstsDefinitionHttpClient { private const string ReleaseApiType = "release"; public VstsReleaseHttpClient(JObject definition, VstsApiEndpointConfig config) : base(new Uri(definition["url"].ToString()), config, ReleaseApiType) { } public override async Task<JObject> UpdateDefinitionAsync(JObject definition) => await JsonClient.PutAsync( GetRequestUri(definition, "definitions"), definition); protected override bool IsMatching(JObject localDefinition, JObject retrievedDefinition) { return localDefinition["name"].ToString() == retrievedDefinition["name"].ToString(); } protected override IEnumerable<JObject> FindObjectsWithIdentifiableProperties(JObject definition) { IEnumerable<JObject> environments = definition["environments"].Children<JObject>(); IEnumerable<JObject> approvals = environments .SelectMany(env => new[] { env["preDeployApprovals"], env["postDeployApprovals"] }) .SelectMany(approvalWrapper => approvalWrapper["approvals"].Values<JObject>()); return new[] { definition } .Concat(environments) .Concat(approvals); } /// <summary> /// From a url like https://devdiv.vsrm.visualstudio.com/1234/_apis/Release/definitions/1 /// in the url property of the given definition, gets the project, "1234". /// </summary> protected override string GetDefinitionProject(JObject definition) { return new Uri(definition["url"].ToString()).Segments[1].TrimEnd('/'); } } }
AlexGhiondea/buildtools
src/Microsoft.DotNet.Build.VstsBuildsApi/VstsReleaseHttpClient.cs
C#
mit
2,198
// 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. // Add any internal types that we need to forward from mscorlib. // These types are required for Desktop to Core serialization as they are not covered by GenAPI because they are marked as internal. [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.CultureAwareComparer))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.OrdinalComparer))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.GenericComparer<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.NullableComparer<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ObjectComparer<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.GenericEqualityComparer<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.NullableEqualityComparer<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ObjectEqualityComparer<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.NonRandomizedStringEqualityComparer))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ByteEqualityComparer))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.EnumEqualityComparer<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.SByteEnumEqualityComparer<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.ShortEnumEqualityComparer<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.LongEnumEqualityComparer<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.ListDictionaryInternal))] // This is temporary as we are building the mscorlib shim against netfx461 which doesn't contain ValueTuples. [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,,>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,,,>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ValueTuple<,,,,,,,>))]
nbarbettini/corefx
src/shims/manual/mscorlib.forwards.cs
C#
mit
3,065
require 'spec_helper' describe 'logrotate::rule' do context 'with an alphanumeric title' do let(:title) { 'test' } context 'and ensure => absent' do let(:params) { {:ensure => 'absent'} } it do should contain_file('/etc/logrotate.d/test').with_ensure('absent') end end let(:params) { {:path => '/var/log/foo.log'} } it do should contain_class('logrotate::base') should contain_file('/etc/logrotate.d/test').with({ 'owner' => 'root', 'group' => 'root', 'ensure' => 'present', 'mode' => '0444', }).with_content(%r{^/var/log/foo\.log \{\n\}\n}) end context 'with an array path' do let (:params) { {:path => ['/var/log/foo1.log','/var/log/foo2.log']} } it do should contain_file('/etc/logrotate.d/test').with_content( %r{/var/log/foo1\.log /var/log/foo2\.log \{\n\}\n} ) end end ########################################################################### # COMPRESS context 'and compress => true' do let(:params) { {:path => '/var/log/foo.log', :compress => true} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ compress$/) end end context 'and compress => false' do let(:params) { {:path => '/var/log/foo.log', :compress => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ nocompress$/) end end context 'and compress => foo' do let(:params) { {:path => '/var/log/foo.log', :compress => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /compress must be a boolean/) end end ########################################################################### # COMPRESSCMD context 'and compresscmd => bzip2' do let(:params) { {:path => '/var/log/foo.log', :compresscmd => 'bzip2'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ compresscmd bzip2$/) end end ########################################################################### # COMPRESSEXT context 'and compressext => .bz2' do let(:params) { {:path => '/var/log/foo.log', :compressext => '.bz2'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ compressext .bz2$/) end end ########################################################################### # COMPRESSOPTIONS context 'and compressoptions => -9' do let(:params) { {:path => '/var/log/foo.log', :compressoptions => '-9'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ compressoptions -9$/) end end ########################################################################### # COPY context 'and copy => true' do let(:params) { {:path => '/var/log/foo.log', :copy => true} } it do should contain_file('/etc/logrotate.d/test').with_content(/^ copy$/) end end context 'and copy => false' do let(:params) { {:path => '/var/log/foo.log', :copy => false} } it do should contain_file('/etc/logrotate.d/test').with_content(/^ nocopy$/) end end context 'and copy => foo' do let(:params) { {:path => '/var/log/foo.log', :copy => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /copy must be a boolean/) end end ########################################################################### # COPYTRUNCATE context 'and copytruncate => true' do let(:params) { {:path => '/var/log/foo.log', :copytruncate => true} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ copytruncate$/) end end context 'and copytruncate => false' do let(:params) { {:path => '/var/log/foo.log', :copytruncate => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ nocopytruncate$/) end end context 'and copytruncate => foo' do let(:params) { {:path => '/var/log/foo.log', :copytruncate => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /copytruncate must be a boolean/) end end ########################################################################### # CREATE / CREATE_MODE / CREATE_OWNER / CREATE_GROUP context 'and create => true' do let(:params) { {:path => '/var/log/foo.log', :create => true} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ create$/) end context 'and create_mode => 0777' do let(:params) { { :path => '/var/log/foo.log', :create => true, :create_mode => '0777', } } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ create 0777$/) end context 'and create_owner => www-data' do let(:params) { { :path => '/var/log/foo.log', :create => true, :create_mode => '0777', :create_owner => 'www-data', } } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ create 0777 www-data/) end context 'and create_group => admin' do let(:params) { { :path => '/var/log/foo.log', :create => true, :create_mode => '0777', :create_owner => 'www-data', :create_group => 'admin', } } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ create 0777 www-data admin$/) end end end context 'and create_group => admin' do let(:params) { { :path => '/var/log/foo.log', :create => true, :create_mode => '0777', :create_group => 'admin', } } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /create_group requires create_owner/) end end end context 'and create_owner => www-data' do let(:params) { { :path => '/var/log/foo.log', :create => true, :create_owner => 'www-data', } } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /create_owner requires create_mode/) end end end context 'and create => false' do let(:params) { {:path => '/var/log/foo.log', :create => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ nocreate$/) end context 'and create_mode => 0777' do let(:params) { { :path => '/var/log/foo.log', :create => false, :create_mode => '0777', } } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /create_mode requires create/) end end end context 'and create => foo' do let(:params) { {:path => '/var/log/foo.log', :create => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /create must be a boolean/) end end ########################################################################### # DATEEXT context 'and dateext => true' do let(:params) { {:path => '/var/log/foo.log', :dateext => true} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ dateext$/) end end context 'and dateext => false' do let(:params) { {:path => '/var/log/foo.log', :dateext => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ nodateext$/) end end context 'and dateext => foo' do let(:params) { {:path => '/var/log/foo.log', :dateext => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /dateext must be a boolean/) end end ########################################################################### # DATEFORMAT context 'and dateformat => -%Y%m%d' do let(:params) { {:path => '/var/log/foo.log', :dateformat => '-%Y%m%d'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ dateformat -%Y%m%d$/) end end ########################################################################### # DELAYCOMPRESS context 'and delaycompress => true' do let(:params) { {:path => '/var/log/foo.log', :delaycompress => true} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ delaycompress$/) end end context 'and delaycompress => false' do let(:params) { {:path => '/var/log/foo.log', :delaycompress => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ nodelaycompress$/) end end context 'and delaycompress => foo' do let(:params) { {:path => '/var/log/foo.log', :delaycompress => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /delaycompress must be a boolean/) end end ########################################################################### # EXTENSION context 'and extension => foo' do let(:params) { {:path => '/var/log/foo.log', :extension => '.foo'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ extension \.foo$/) end end ########################################################################### # IFEMPTY context 'and ifempty => true' do let(:params) { {:path => '/var/log/foo.log', :ifempty => true} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ ifempty$/) end end context 'and ifempty => false' do let(:params) { {:path => '/var/log/foo.log', :ifempty => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ notifempty$/) end end context 'and ifempty => foo' do let(:params) { {:path => '/var/log/foo.log', :ifempty => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /ifempty must be a boolean/) end end ########################################################################### # MAIL / MAILFIRST / MAILLAST context 'and mail => test.example.com' do let(:params) { {:path => '/var/log/foo.log', :mail => 'test@example.com'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ mail test@example.com$/) end context 'and mailfirst => true' do let(:params) { { :path => '/var/log/foo.log', :mail => 'test@example.com', :mailfirst => true, } } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ mailfirst$/) end context 'and maillast => true' do let(:params) { { :path => '/var/log/foo.log', :mail => 'test@example.com', :mailfirst => true, :maillast => true, } } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /set both mailfirst and maillast/) end end end context 'and maillast => true' do let(:params) { { :path => '/var/log/foo.log', :mail => 'test@example.com', :maillast => true, } } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ maillast$/) end end end context 'and mail => false' do let(:params) { {:path => '/var/log/foo.log', :mail => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ nomail$/) end end ########################################################################### # MAXAGE context 'and maxage => 3' do let(:params) { {:path => '/var/log/foo.log', :maxage => 3} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ maxage 3$/) end end context 'and maxage => foo' do let(:params) { {:path => '/var/log/foo.log', :maxage => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /maxage must be an integer/) end end ########################################################################### # MINSIZE context 'and minsize => 100' do let(:params) { {:path => '/var/log/foo.log', :minsize => 100} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ minsize 100$/) end end context 'and minsize => 100k' do let(:params) { {:path => '/var/log/foo.log', :minsize => '100k'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ minsize 100k$/) end end context 'and minsize => 100M' do let(:params) { {:path => '/var/log/foo.log', :minsize => '100M'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ minsize 100M$/) end end context 'and minsize => 100G' do let(:params) { {:path => '/var/log/foo.log', :minsize => '100G'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ minsize 100G$/) end end context 'and minsize => foo' do let(:params) { {:path => '/var/log/foo.log', :minsize => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /minsize must match/) end end ########################################################################### # MISSINGOK context 'and missingok => true' do let(:params) { {:path => '/var/log/foo.log', :missingok => true} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ missingok$/) end end context 'and missingok => false' do let(:params) { {:path => '/var/log/foo.log', :missingok => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ nomissingok$/) end end context 'and missingok => foo' do let(:params) { {:path => '/var/log/foo.log', :missingok => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /missingok must be a boolean/) end end ########################################################################### # OLDDIR context 'and olddir => /var/log/old' do let(:params) { {:path => '/var/log/foo.log', :olddir => '/var/log/old'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ olddir \/var\/log\/old$/) end end context 'and olddir => false' do let(:params) { {:path => '/var/log/foo.log', :olddir => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ noolddir$/) end end ########################################################################### # POSTROTATE context 'and postrotate => /bin/true' do let(:params) { {:path => '/var/log/foo.log', :postrotate => '/bin/true'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/postrotate\n \/bin\/true\n endscript/) end end context "and postrotate => ['/bin/true', '/bin/false']" do let(:params) { {:path => '/var/log/foo.log', :postrotate => ['/bin/true', '/bin/false']} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/postrotate\n \/bin\/true\n \/bin\/false\n endscript/) end end ########################################################################### # PREROTATE context 'and prerotate => /bin/true' do let(:params) { {:path => '/var/log/foo.log', :prerotate => '/bin/true'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/prerotate\n \/bin\/true\n endscript/) end end context "and prerotate => ['/bin/true', '/bin/false']" do let(:params) { {:path => '/var/log/foo.log', :prerotate => ['/bin/true', '/bin/false']} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/prerotate\n \/bin\/true\n \/bin\/false\n endscript/) end end ########################################################################### # FIRSTACTION context 'and firstaction => /bin/true' do let(:params) { {:path => '/var/log/foo.log', :firstaction => '/bin/true'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/firstaction\n \/bin\/true\n endscript/) end end context "and firstaction => ['/bin/true', '/bin/false']" do let(:params) { {:path => '/var/log/foo.log', :firstaction => ['/bin/true', '/bin/false']} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/firstaction\n \/bin\/true\n \/bin\/false\n endscript/) end end ########################################################################### # LASTACTION context 'and lastaction => /bin/true' do let(:params) { {:path => '/var/log/foo.log', :lastaction => '/bin/true'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/lastaction\n \/bin\/true\n endscript/) end end context "and lastaction => ['/bin/true', '/bin/false']" do let(:params) { {:path => '/var/log/foo.log', :lastaction => ['/bin/true', '/bin/false']} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/lastaction\n \/bin\/true\n \/bin\/false\n endscript/) end end ########################################################################### # ROTATE context 'and rotate => 3' do let(:params) { {:path => '/var/log/foo.log', :rotate => 3} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ rotate 3$/) end end context 'and rotate => foo' do let(:params) { {:path => '/var/log/foo.log', :rotate => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /rotate must be an integer/) end end ########################################################################### # ROTATE_EVERY context 'and rotate_every => hour' do let(:params) { {:path => '/var/log/foo.log', :rotate_every => 'hour'} } it { should contain_class('logrotate::hourly') } it { should contain_file('/etc/logrotate.d/hourly/test') } it { should contain_file('/etc/logrotate.d/test').with_ensure('absent') } end context 'and rotate_every => day' do let(:params) { {:path => '/var/log/foo.log', :rotate_every => 'day'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ daily$/) end it do should contain_file('/etc/logrotate.d/hourly/test') \ .with_ensure('absent') end end context 'and rotate_every => week' do let(:params) { {:path => '/var/log/foo.log', :rotate_every => 'week'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ weekly$/) end it do should contain_file('/etc/logrotate.d/hourly/test') \ .with_ensure('absent') end end context 'and rotate_every => month' do let(:params) { {:path => '/var/log/foo.log', :rotate_every => 'month'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ monthly$/) end it do should contain_file('/etc/logrotate.d/hourly/test') \ .with_ensure('absent') end end context 'and rotate_every => year' do let(:params) { {:path => '/var/log/foo.log', :rotate_every => 'year'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ yearly$/) end it do should contain_file('/etc/logrotate.d/hourly/test') \ .with_ensure('absent') end end context 'and rotate_every => foo' do let(:params) { {:path => '/var/log/foo.log', :rotate_every => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /invalid rotate_every value/) end end ########################################################################### # SIZE context 'and size => 100' do let(:params) { {:path => '/var/log/foo.log', :size => 100} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ size 100$/) end end context 'and size => 100k' do let(:params) { {:path => '/var/log/foo.log', :size => '100k'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ size 100k$/) end end context 'and size => 100M' do let(:params) { {:path => '/var/log/foo.log', :size => '100M'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ size 100M$/) end end context 'and size => 100G' do let(:params) { {:path => '/var/log/foo.log', :size => '100G'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ size 100G$/) end end context 'and size => foo' do let(:params) { {:path => '/var/log/foo.log', :size => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /size must match/) end end ########################################################################### # SHAREDSCRIPTS context 'and sharedscripts => true' do let(:params) { {:path => '/var/log/foo.log', :sharedscripts => true} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ sharedscripts$/) end end context 'and sharedscripts => false' do let(:params) { {:path => '/var/log/foo.log', :sharedscripts => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ nosharedscripts$/) end end context 'and sharedscripts => foo' do let(:params) { {:path => '/var/log/foo.log', :sharedscripts => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /sharedscripts must be a boolean/) end end ########################################################################### # SHRED / SHREDCYCLES context 'and shred => true' do let(:params) { {:path => '/var/log/foo.log', :shred => true} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ shred$/) end context 'and shredcycles => 3' do let(:params) { {:path => '/var/log/foo.log', :shred => true, :shredcycles => 3} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ shredcycles 3$/) end end context 'and shredcycles => foo' do let(:params) { {:path => '/var/log/foo.log', :shred => true, :shredcycles => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /shredcycles must be an integer/) end end end context 'and shred => false' do let(:params) { {:path => '/var/log/foo.log', :shred => false} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ noshred$/) end end context 'and shred => foo' do let(:params) { {:path => '/var/log/foo.log', :shred => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /shred must be a boolean/) end end ########################################################################### # START context 'and start => 0' do let(:params) { {:path => '/var/log/foo.log', :start => 0} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ start 0$/) end end context 'and start => foo' do let(:params) { {:path => '/var/log/foo.log', :start => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /start must be an integer/) end end ########################################################################### # SU / SU_OWNER / SU_GROUP context 'and su => true' do let(:params) { {:path => '/var/log/foo.log', :su => true} } context 'and su_owner => www-data' do let(:params) { { :path => '/var/log/foo.log', :su => true, :su_owner => 'www-data', } } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ su www-data/) end context 'and su_group => admin' do let(:params) { { :path => '/var/log/foo.log', :su => true, :su_owner => 'www-data', :su_group => 'admin', } } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ su www-data admin$/) end end end context 'and missing su_owner' do let(:params) { { :path => '/var/log/foo.log', :su => true, } } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /su requires su_owner/) end end end context 'and su => false' do let(:params) { {:path => '/var/log/foo.log', :su => false} } it do should_not contain_file('/etc/logrotate.d/test') \ .with_content(/^ su\s/) end context 'and su_owner => wwww-data' do let(:params) { { :path => '/var/log/foo.log', :su => false, :su_owner => 'www-data', } } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /su_owner requires su/) end end end context 'and su => foo' do let(:params) { {:path => '/var/log/foo.log', :su => 'foo'} } it do expect { should contain_file('/etc/logrotate.d/test') }.to raise_error(Puppet::Error, /su must be a boolean/) end end ########################################################################### # UNCOMPRESSCMD context 'and uncompresscmd => bunzip2' do let(:params) { {:path => '/var/log/foo.log', :uncompresscmd => 'bunzip2'} } it do should contain_file('/etc/logrotate.d/test') \ .with_content(/^ uncompresscmd bunzip2$/) end end end context 'with a non-alphanumeric title' do let(:title) { 'foo bar' } let(:params) { {:path => '/var/log/foo.log'} } it do expect { should contain_file('/etc/logrotate.d/foo bar') }.to raise_error(Puppet::Error, /namevar must be alphanumeric/) end end end
MelanieGault/puppet-logrotate
spec/defines/rule_spec.rb
Ruby
mit
30,362
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Tests\Style; use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Tester\CommandTester; class SymfonyStyleTest extends TestCase { /** @var Command */ protected $command; /** @var CommandTester */ protected $tester; protected function setUp() { putenv('COLUMNS=121'); $this->command = new Command('sfstyle'); $this->tester = new CommandTester($this->command); } protected function tearDown() { putenv('COLUMNS'); $this->command = null; $this->tester = null; } /** * @dataProvider inputCommandToOutputFilesProvider */ public function testOutputs($inputCommandFilepath, $outputFilepath) { $code = require $inputCommandFilepath; $this->command->setCode($code); $this->tester->execute(array(), array('interactive' => false, 'decorated' => false)); $this->assertStringEqualsFile($outputFilepath, $this->tester->getDisplay(true)); } /** * @dataProvider inputInteractiveCommandToOutputFilesProvider */ public function testInteractiveOutputs($inputCommandFilepath, $outputFilepath) { $code = require $inputCommandFilepath; $this->command->setCode($code); $this->tester->execute(array(), array('interactive' => true, 'decorated' => false)); $this->assertStringEqualsFile($outputFilepath, $this->tester->getDisplay(true)); } public function inputInteractiveCommandToOutputFilesProvider() { $baseDir = __DIR__.'/../Fixtures/Style/SymfonyStyle'; return array_map(null, glob($baseDir.'/command/interactive_command_*.php'), glob($baseDir.'/output/interactive_output_*.txt')); } public function inputCommandToOutputFilesProvider() { $baseDir = __DIR__.'/../Fixtures/Style/SymfonyStyle'; return array_map(null, glob($baseDir.'/command/command_*.php'), glob($baseDir.'/output/output_*.txt')); } public function testGetErrorStyle() { $input = $this->getMockBuilder(InputInterface::class)->getMock(); $errorOutput = $this->getMockBuilder(OutputInterface::class)->getMock(); $errorOutput ->method('getFormatter') ->willReturn(new OutputFormatter()); $errorOutput ->expects($this->once()) ->method('write'); $output = $this->getMockBuilder(ConsoleOutputInterface::class)->getMock(); $output ->method('getFormatter') ->willReturn(new OutputFormatter()); $output ->expects($this->once()) ->method('getErrorOutput') ->willReturn($errorOutput); $io = new SymfonyStyle($input, $output); $io->getErrorStyle()->write(''); } public function testGetErrorStyleUsesTheCurrentOutputIfNoErrorOutputIsAvailable() { $output = $this->getMockBuilder(OutputInterface::class)->getMock(); $output ->method('getFormatter') ->willReturn(new OutputFormatter()); $style = new SymfonyStyle($this->getMockBuilder(InputInterface::class)->getMock(), $output); $this->assertInstanceOf(SymfonyStyle::class, $style->getErrorStyle()); } }
Teisi/typo3-deploy
vendor/symfony/console/Tests/Style/SymfonyStyleTest.php
PHP
mit
3,826
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------ namespace System.ServiceModel.Channels { using System.Threading; enum AsyncReceiveResult { Completed, Pending, } interface IMessageSource { AsyncReceiveResult BeginReceive(TimeSpan timeout, WaitCallback callback, object state); Message EndReceive(); Message Receive(TimeSpan timeout); AsyncReceiveResult BeginWaitForMessage(TimeSpan timeout, WaitCallback callback, object state); bool EndWaitForMessage(); bool WaitForMessage(TimeSpan timeout); } }
akoeplinger/referencesource
System.ServiceModel/System/ServiceModel/Channels/IMessageSource.cs
C#
mit
733
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import {Type} from '@angular/core'; import {forwardRef, resolveForwardRef} from '@angular/core/src/di'; import {describe, expect, it} from '@angular/core/testing/testing_internal'; export function main() { describe('forwardRef', function() { it('should wrap and unwrap the reference', () => { const ref = forwardRef(() => String); expect(ref instanceof Type).toBe(true); expect(resolveForwardRef(ref)).toBe(String); }); }); }
xcaliber-tech/angular
modules/@angular/core/test/di/forward_ref_spec.ts
TypeScript
mit
661
/* * Chromaprint -- Audio fingerprinting toolkit * Copyright (C) 2010 Lukas Lalinsky <lalinsky@gmail.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA */ #include <limits> #include <assert.h> #include <math.h> #include "chroma_filter.h" #include "utils.h" using namespace std; using namespace Chromaprint; ChromaFilter::ChromaFilter(const double *coefficients, int length, FeatureVectorConsumer *consumer) : m_coefficients(coefficients), m_length(length), m_buffer(8), m_result(12), m_buffer_offset(0), m_buffer_size(1), m_consumer(consumer) { } ChromaFilter::~ChromaFilter() { } void ChromaFilter::Reset() { m_buffer_size = 1; m_buffer_offset = 0; } void ChromaFilter::Consume(std::vector<double> &features) { m_buffer[m_buffer_offset] = features; m_buffer_offset = (m_buffer_offset + 1) % 8; if (m_buffer_size >= m_length) { int offset = (m_buffer_offset + 8 - m_length) % 8; fill(m_result.begin(), m_result.end(), 0.0); for (int i = 0; i < 12; i++) { for (int j = 0; j < m_length; j++) { m_result[i] += m_buffer[(offset + j) % 8][i] * m_coefficients[j]; } } m_consumer->Consume(m_result); } else { m_buffer_size++; } }
josephwilk/finger-smudge
vendor/chromaprint/src/chroma_filter.cpp
C++
epl-1.0
1,885
<?php /** * Schema object for: PaymentMethodQueryRq * * @author "Keith Palmer Jr." <Keith@ConsoliByte.com> * @license LICENSE.txt * * @package QuickBooks * @subpackage QBXML */ /** * */ require_once 'QuickBooks.php'; /** * */ require_once 'QuickBooks/QBXML/Schema/Object.php'; /** * */ class QuickBooks_QBXML_Schema_Object_PaymentMethodQueryRq extends QuickBooks_QBXML_Schema_Object { protected function &_qbxmlWrapper() { static $wrapper = ''; return $wrapper; } protected function &_dataTypePaths() { static $paths = array ( 'ListID' => 'IDTYPE', 'FullName' => 'STRTYPE', 'MaxReturned' => 'INTTYPE', 'ActiveStatus' => 'ENUMTYPE', 'FromModifiedDate' => 'DATETIMETYPE', 'ToModifiedDate' => 'DATETIMETYPE', 'NameFilter MatchCriterion' => 'ENUMTYPE', 'NameFilter Name' => 'STRTYPE', 'NameRangeFilter FromName' => 'STRTYPE', 'NameRangeFilter ToName' => 'STRTYPE', 'PaymentMethodType' => 'ENUMTYPE', 'IncludeRetElement' => 'STRTYPE', ); return $paths; } protected function &_maxLengthPaths() { static $paths = array ( 'ListID' => 0, 'FullName' => 0, 'MaxReturned' => 0, 'ActiveStatus' => 0, 'FromModifiedDate' => 0, 'ToModifiedDate' => 0, 'NameFilter MatchCriterion' => 0, 'NameFilter Name' => 0, 'NameRangeFilter FromName' => 0, 'NameRangeFilter ToName' => 0, 'PaymentMethodType' => 0, 'IncludeRetElement' => 50, ); return $paths; } protected function &_isOptionalPaths() { static $paths = array ( 'ListID' => false, 'FullName' => false, 'MaxReturned' => true, 'ActiveStatus' => true, 'FromModifiedDate' => true, 'ToModifiedDate' => true, 'NameFilter MatchCriterion' => false, 'NameFilter Name' => false, 'NameRangeFilter FromName' => true, 'NameRangeFilter ToName' => true, 'PaymentMethodType' => true, 'IncludeRetElement' => true, ); } protected function &_sinceVersionPaths() { static $paths = array ( 'ListID' => 999.99, 'FullName' => 999.99, 'MaxReturned' => 0, 'ActiveStatus' => 999.99, 'FromModifiedDate' => 999.99, 'ToModifiedDate' => 999.99, 'NameFilter MatchCriterion' => 999.99, 'NameFilter Name' => 999.99, 'NameRangeFilter FromName' => 999.99, 'NameRangeFilter ToName' => 999.99, 'PaymentMethodType' => 7, 'IncludeRetElement' => 4, ); return $paths; } protected function &_isRepeatablePaths() { static $paths = array ( 'ListID' => true, 'FullName' => true, 'MaxReturned' => false, 'ActiveStatus' => false, 'FromModifiedDate' => false, 'ToModifiedDate' => false, 'NameFilter MatchCriterion' => false, 'NameFilter Name' => false, 'NameRangeFilter FromName' => false, 'NameRangeFilter ToName' => false, 'PaymentMethodType' => true, 'IncludeRetElement' => true, ); return $paths; } /* abstract protected function &_inLocalePaths() { static $paths = array( 'FirstName' => array( 'QBD', 'QBCA', 'QBUK', 'QBAU' ), 'LastName' => array( 'QBD', 'QBCA', 'QBUK', 'QBAU' ), ); return $paths; } */ protected function &_reorderPathsPaths() { static $paths = array ( 0 => 'ListID', 1 => 'FullName', 2 => 'MaxReturned', 3 => 'ActiveStatus', 4 => 'FromModifiedDate', 5 => 'ToModifiedDate', 6 => 'NameFilter MatchCriterion', 7 => 'NameFilter Name', 8 => 'NameRangeFilter FromName', 9 => 'NameRangeFilter ToName', 10 => 'PaymentMethodType', 11 => 'IncludeRetElement', ); return $paths; } } ?>
SayenkoDesign/selectahead
wp-content/plugins/woocommerce-quickbooks-pos-2013/QuickBooks/QBXML/Schema/Object/PaymentMethodQueryRq.php
PHP
gpl-2.0
3,453
/* * Copyright (c) 1997, 2013, 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 javax.swing.text; import java.awt.Color; import java.awt.Font; import java.awt.font.TextAttribute; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Stack; import java.util.Vector; import java.util.ArrayList; import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import javax.swing.event.*; import javax.swing.undo.AbstractUndoableEdit; import javax.swing.undo.CannotRedoException; import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoableEdit; import javax.swing.SwingUtilities; import static sun.swing.SwingUtilities2.IMPLIED_CR; /** * A document that can be marked up with character and paragraph * styles in a manner similar to the Rich Text Format. The element * structure for this document represents style crossings for * style runs. These style runs are mapped into a paragraph element * structure (which may reside in some other structure). The * style runs break at paragraph boundaries since logical styles are * assigned to paragraph boundaries. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @author Timothy Prinzing * @see Document * @see AbstractDocument */ public class DefaultStyledDocument extends AbstractDocument implements StyledDocument { /** * Constructs a styled document. * * @param c the container for the content * @param styles resources and style definitions which may * be shared across documents */ public DefaultStyledDocument(Content c, StyleContext styles) { super(c, styles); listeningStyles = new Vector<Style>(); buffer = new ElementBuffer(createDefaultRoot()); Style defaultStyle = styles.getStyle(StyleContext.DEFAULT_STYLE); setLogicalStyle(0, defaultStyle); } /** * Constructs a styled document with the default content * storage implementation and a shared set of styles. * * @param styles the styles */ public DefaultStyledDocument(StyleContext styles) { this(new GapContent(BUFFER_SIZE_DEFAULT), styles); } /** * Constructs a default styled document. This buffers * input content by a size of <em>BUFFER_SIZE_DEFAULT</em> * and has a style context that is scoped by the lifetime * of the document and is not shared with other documents. */ public DefaultStyledDocument() { this(new GapContent(BUFFER_SIZE_DEFAULT), new StyleContext()); } /** * Gets the default root element. * * @return the root * @see Document#getDefaultRootElement */ public Element getDefaultRootElement() { return buffer.getRootElement(); } /** * Initialize the document to reflect the given element * structure (i.e. the structure reported by the * <code>getDefaultRootElement</code> method. If the * document contained any data it will first be removed. */ protected void create(ElementSpec[] data) { try { if (getLength() != 0) { remove(0, getLength()); } writeLock(); // install the content Content c = getContent(); int n = data.length; StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { ElementSpec es = data[i]; if (es.getLength() > 0) { sb.append(es.getArray(), es.getOffset(), es.getLength()); } } UndoableEdit cEdit = c.insertString(0, sb.toString()); // build the event and element structure int length = sb.length(); DefaultDocumentEvent evnt = new DefaultDocumentEvent(0, length, DocumentEvent.EventType.INSERT); evnt.addEdit(cEdit); buffer.create(length, data, evnt); // update bidi (possibly) super.insertUpdate(evnt, null); // notify the listeners evnt.end(); fireInsertUpdate(evnt); fireUndoableEditUpdate(new UndoableEditEvent(this, evnt)); } catch (BadLocationException ble) { throw new StateInvariantError("problem initializing"); } finally { writeUnlock(); } } /** * Inserts new elements in bulk. This is useful to allow * parsing with the document in an unlocked state and * prepare an element structure modification. This method * takes an array of tokens that describe how to update an * element structure so the time within a write lock can * be greatly reduced in an asynchronous update situation. * <p> * This method is thread safe, although most Swing methods * are not. Please see * <A HREF="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency * in Swing</A> for more information. * * @param offset the starting offset &gt;= 0 * @param data the element data * @exception BadLocationException for an invalid starting offset */ protected void insert(int offset, ElementSpec[] data) throws BadLocationException { if (data == null || data.length == 0) { return; } try { writeLock(); // install the content Content c = getContent(); int n = data.length; StringBuilder sb = new StringBuilder(); for (int i = 0; i < n; i++) { ElementSpec es = data[i]; if (es.getLength() > 0) { sb.append(es.getArray(), es.getOffset(), es.getLength()); } } if (sb.length() == 0) { // Nothing to insert, bail. return; } UndoableEdit cEdit = c.insertString(offset, sb.toString()); // create event and build the element structure int length = sb.length(); DefaultDocumentEvent evnt = new DefaultDocumentEvent(offset, length, DocumentEvent.EventType.INSERT); evnt.addEdit(cEdit); buffer.insert(offset, length, data, evnt); // update bidi (possibly) super.insertUpdate(evnt, null); // notify the listeners evnt.end(); fireInsertUpdate(evnt); fireUndoableEditUpdate(new UndoableEditEvent(this, evnt)); } finally { writeUnlock(); } } /** * Removes an element from this document. * * <p>The element is removed from its parent element, as well as * the text in the range identified by the element. If the * element isn't associated with the document, {@code * IllegalArgumentException} is thrown.</p> * * <p>As empty branch elements are not allowed in the document, if the * element is the sole child, its parent element is removed as well, * recursively. This means that when replacing all the children of a * particular element, new children should be added <em>before</em> * removing old children. * * <p>Element removal results in two events being fired, the * {@code DocumentEvent} for changes in element structure and {@code * UndoableEditEvent} for changes in document content.</p> * * <p>If the element contains end-of-content mark (the last {@code * "\n"} character in document), this character is not removed; * instead, preceding leaf element is extended to cover the * character. If the last leaf already ends with {@code "\n",} it is * included in content removal.</p> * * <p>If the element is {@code null,} {@code NullPointerException} is * thrown. If the element structure would become invalid after the removal, * for example if the element is the document root element, {@code * IllegalArgumentException} is thrown. If the current element structure is * invalid, {@code IllegalStateException} is thrown.</p> * * @param elem the element to remove * @throws NullPointerException if the element is {@code null} * @throws IllegalArgumentException if the element could not be removed * @throws IllegalStateException if the element structure is invalid * * @since 1.7 */ public void removeElement(Element elem) { try { writeLock(); removeElementImpl(elem); } finally { writeUnlock(); } } private void removeElementImpl(Element elem) { if (elem.getDocument() != this) { throw new IllegalArgumentException("element doesn't belong to document"); } BranchElement parent = (BranchElement) elem.getParentElement(); if (parent == null) { throw new IllegalArgumentException("can't remove the root element"); } int startOffset = elem.getStartOffset(); int removeFrom = startOffset; int endOffset = elem.getEndOffset(); int removeTo = endOffset; int lastEndOffset = getLength() + 1; Content content = getContent(); boolean atEnd = false; boolean isComposedText = Utilities.isComposedTextElement(elem); if (endOffset >= lastEndOffset) { // element includes the last "\n" character, needs special handling if (startOffset <= 0) { throw new IllegalArgumentException("can't remove the whole content"); } removeTo = lastEndOffset - 1; // last "\n" must not be removed try { if (content.getString(startOffset - 1, 1).charAt(0) == '\n') { removeFrom--; // preceding leaf ends with "\n", remove it } } catch (BadLocationException ble) { // can't happen throw new IllegalStateException(ble); } atEnd = true; } int length = removeTo - removeFrom; DefaultDocumentEvent dde = new DefaultDocumentEvent(removeFrom, length, DefaultDocumentEvent.EventType.REMOVE); UndoableEdit ue = null; // do not leave empty branch elements while (parent.getElementCount() == 1) { elem = parent; parent = (BranchElement) parent.getParentElement(); if (parent == null) { // shouldn't happen throw new IllegalStateException("invalid element structure"); } } Element[] removed = { elem }; Element[] added = {}; int index = parent.getElementIndex(startOffset); parent.replace(index, 1, added); dde.addEdit(new ElementEdit(parent, index, removed, added)); if (length > 0) { try { ue = content.remove(removeFrom, length); if (ue != null) { dde.addEdit(ue); } } catch (BadLocationException ble) { // can only happen if the element structure is severely broken throw new IllegalStateException(ble); } lastEndOffset -= length; } if (atEnd) { // preceding leaf element should be extended to cover orphaned "\n" Element prevLeaf = parent.getElement(parent.getElementCount() - 1); while ((prevLeaf != null) && !prevLeaf.isLeaf()) { prevLeaf = prevLeaf.getElement(prevLeaf.getElementCount() - 1); } if (prevLeaf == null) { // shouldn't happen throw new IllegalStateException("invalid element structure"); } int prevStartOffset = prevLeaf.getStartOffset(); BranchElement prevParent = (BranchElement) prevLeaf.getParentElement(); int prevIndex = prevParent.getElementIndex(prevStartOffset); Element newElem; newElem = createLeafElement(prevParent, prevLeaf.getAttributes(), prevStartOffset, lastEndOffset); Element[] prevRemoved = { prevLeaf }; Element[] prevAdded = { newElem }; prevParent.replace(prevIndex, 1, prevAdded); dde.addEdit(new ElementEdit(prevParent, prevIndex, prevRemoved, prevAdded)); } postRemoveUpdate(dde); dde.end(); fireRemoveUpdate(dde); if (! (isComposedText && (ue != null))) { // do not fire UndoabeEdit event for composed text edit (unsupported) fireUndoableEditUpdate(new UndoableEditEvent(this, dde)); } } /** * Adds a new style into the logical style hierarchy. Style attributes * resolve from bottom up so an attribute specified in a child * will override an attribute specified in the parent. * * @param nm the name of the style (must be unique within the * collection of named styles). The name may be null if the style * is unnamed, but the caller is responsible * for managing the reference returned as an unnamed style can't * be fetched by name. An unnamed style may be useful for things * like character attribute overrides such as found in a style * run. * @param parent the parent style. This may be null if unspecified * attributes need not be resolved in some other style. * @return the style */ public Style addStyle(String nm, Style parent) { StyleContext styles = (StyleContext) getAttributeContext(); return styles.addStyle(nm, parent); } /** * Removes a named style previously added to the document. * * @param nm the name of the style to remove */ public void removeStyle(String nm) { StyleContext styles = (StyleContext) getAttributeContext(); styles.removeStyle(nm); } /** * Fetches a named style previously added. * * @param nm the name of the style * @return the style */ public Style getStyle(String nm) { StyleContext styles = (StyleContext) getAttributeContext(); return styles.getStyle(nm); } /** * Fetches the list of of style names. * * @return all the style names */ public Enumeration<?> getStyleNames() { return ((StyleContext) getAttributeContext()).getStyleNames(); } /** * Sets the logical style to use for the paragraph at the * given position. If attributes aren't explicitly set * for character and paragraph attributes they will resolve * through the logical style assigned to the paragraph, which * in turn may resolve through some hierarchy completely * independent of the element hierarchy in the document. * <p> * This method is thread safe, although most Swing methods * are not. Please see * <A HREF="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency * in Swing</A> for more information. * * @param pos the offset from the start of the document &gt;= 0 * @param s the logical style to assign to the paragraph, null if none */ public void setLogicalStyle(int pos, Style s) { Element paragraph = getParagraphElement(pos); if ((paragraph != null) && (paragraph instanceof AbstractElement)) { try { writeLock(); StyleChangeUndoableEdit edit = new StyleChangeUndoableEdit((AbstractElement)paragraph, s); ((AbstractElement)paragraph).setResolveParent(s); int p0 = paragraph.getStartOffset(); int p1 = paragraph.getEndOffset(); DefaultDocumentEvent e = new DefaultDocumentEvent(p0, p1 - p0, DocumentEvent.EventType.CHANGE); e.addEdit(edit); e.end(); fireChangedUpdate(e); fireUndoableEditUpdate(new UndoableEditEvent(this, e)); } finally { writeUnlock(); } } } /** * Fetches the logical style assigned to the paragraph * represented by the given position. * * @param p the location to translate to a paragraph * and determine the logical style assigned &gt;= 0. This * is an offset from the start of the document. * @return the style, null if none */ public Style getLogicalStyle(int p) { Style s = null; Element paragraph = getParagraphElement(p); if (paragraph != null) { AttributeSet a = paragraph.getAttributes(); AttributeSet parent = a.getResolveParent(); if (parent instanceof Style) { s = (Style) parent; } } return s; } /** * Sets attributes for some part of the document. * A write lock is held by this operation while changes * are being made, and a DocumentEvent is sent to the listeners * after the change has been successfully completed. * <p> * This method is thread safe, although most Swing methods * are not. Please see * <A HREF="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency * in Swing</A> for more information. * * @param offset the offset in the document &gt;= 0 * @param length the length &gt;= 0 * @param s the attributes * @param replace true if the previous attributes should be replaced * before setting the new attributes */ public void setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace) { if (length == 0) { return; } try { writeLock(); DefaultDocumentEvent changes = new DefaultDocumentEvent(offset, length, DocumentEvent.EventType.CHANGE); // split elements that need it buffer.change(offset, length, changes); AttributeSet sCopy = s.copyAttributes(); // PENDING(prinz) - this isn't a very efficient way to iterate int lastEnd; for (int pos = offset; pos < (offset + length); pos = lastEnd) { Element run = getCharacterElement(pos); lastEnd = run.getEndOffset(); if (pos == lastEnd) { // offset + length beyond length of document, bail. break; } MutableAttributeSet attr = (MutableAttributeSet) run.getAttributes(); changes.addEdit(new AttributeUndoableEdit(run, sCopy, replace)); if (replace) { attr.removeAttributes(attr); } attr.addAttributes(s); } changes.end(); fireChangedUpdate(changes); fireUndoableEditUpdate(new UndoableEditEvent(this, changes)); } finally { writeUnlock(); } } /** * Sets attributes for a paragraph. * <p> * This method is thread safe, although most Swing methods * are not. Please see * <A HREF="https://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html">Concurrency * in Swing</A> for more information. * * @param offset the offset into the paragraph &gt;= 0 * @param length the number of characters affected &gt;= 0 * @param s the attributes * @param replace whether to replace existing attributes, or merge them */ public void setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace) { try { writeLock(); DefaultDocumentEvent changes = new DefaultDocumentEvent(offset, length, DocumentEvent.EventType.CHANGE); AttributeSet sCopy = s.copyAttributes(); // PENDING(prinz) - this assumes a particular element structure Element section = getDefaultRootElement(); int index0 = section.getElementIndex(offset); int index1 = section.getElementIndex(offset + ((length > 0) ? length - 1 : 0)); boolean isI18N = Boolean.TRUE.equals(getProperty(I18NProperty)); boolean hasRuns = false; for (int i = index0; i <= index1; i++) { Element paragraph = section.getElement(i); MutableAttributeSet attr = (MutableAttributeSet) paragraph.getAttributes(); changes.addEdit(new AttributeUndoableEdit(paragraph, sCopy, replace)); if (replace) { attr.removeAttributes(attr); } attr.addAttributes(s); if (isI18N && !hasRuns) { hasRuns = (attr.getAttribute(TextAttribute.RUN_DIRECTION) != null); } } if (hasRuns) { updateBidi( changes ); } changes.end(); fireChangedUpdate(changes); fireUndoableEditUpdate(new UndoableEditEvent(this, changes)); } finally { writeUnlock(); } } /** * Gets the paragraph element at the offset <code>pos</code>. * A paragraph consists of at least one child Element, which is usually * a leaf. * * @param pos the starting offset &gt;= 0 * @return the element */ public Element getParagraphElement(int pos) { Element e; for (e = getDefaultRootElement(); ! e.isLeaf(); ) { int index = e.getElementIndex(pos); e = e.getElement(index); } if(e != null) return e.getParentElement(); return e; } /** * Gets a character element based on a position. * * @param pos the position in the document &gt;= 0 * @return the element */ public Element getCharacterElement(int pos) { Element e; for (e = getDefaultRootElement(); ! e.isLeaf(); ) { int index = e.getElementIndex(pos); e = e.getElement(index); } return e; } // --- local methods ------------------------------------------------- /** * Updates document structure as a result of text insertion. This * will happen within a write lock. This implementation simply * parses the inserted content for line breaks and builds up a set * of instructions for the element buffer. * * @param chng a description of the document change * @param attr the attributes */ protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr) { int offset = chng.getOffset(); int length = chng.getLength(); if (attr == null) { attr = SimpleAttributeSet.EMPTY; } // Paragraph attributes should come from point after insertion. // You really only notice this when inserting at a paragraph // boundary. Element paragraph = getParagraphElement(offset + length); AttributeSet pattr = paragraph.getAttributes(); // Character attributes should come from actual insertion point. Element pParagraph = getParagraphElement(offset); Element run = pParagraph.getElement(pParagraph.getElementIndex (offset)); int endOffset = offset + length; boolean insertingAtBoundry = (run.getEndOffset() == endOffset); AttributeSet cattr = run.getAttributes(); try { Segment s = new Segment(); Vector<ElementSpec> parseBuffer = new Vector<ElementSpec>(); ElementSpec lastStartSpec = null; boolean insertingAfterNewline = false; short lastStartDirection = ElementSpec.OriginateDirection; // Check if the previous character was a newline. if (offset > 0) { getText(offset - 1, 1, s); if (s.array[s.offset] == '\n') { // Inserting after a newline. insertingAfterNewline = true; lastStartDirection = createSpecsForInsertAfterNewline (paragraph, pParagraph, pattr, parseBuffer, offset, endOffset); for(int counter = parseBuffer.size() - 1; counter >= 0; counter--) { ElementSpec spec = parseBuffer.elementAt(counter); if(spec.getType() == ElementSpec.StartTagType) { lastStartSpec = spec; break; } } } } // If not inserting after a new line, pull the attributes for // new paragraphs from the paragraph under the insertion point. if(!insertingAfterNewline) pattr = pParagraph.getAttributes(); getText(offset, length, s); char[] txt = s.array; int n = s.offset + s.count; int lastOffset = s.offset; for (int i = s.offset; i < n; i++) { if (txt[i] == '\n') { int breakOffset = i + 1; parseBuffer.addElement( new ElementSpec(attr, ElementSpec.ContentType, breakOffset - lastOffset)); parseBuffer.addElement( new ElementSpec(null, ElementSpec.EndTagType)); lastStartSpec = new ElementSpec(pattr, ElementSpec. StartTagType); parseBuffer.addElement(lastStartSpec); lastOffset = breakOffset; } } if (lastOffset < n) { parseBuffer.addElement( new ElementSpec(attr, ElementSpec.ContentType, n - lastOffset)); } ElementSpec first = parseBuffer.firstElement(); int docLength = getLength(); // Check for join previous of first content. if(first.getType() == ElementSpec.ContentType && cattr.isEqual(attr)) { first.setDirection(ElementSpec.JoinPreviousDirection); } // Do a join fracture/next for last start spec if necessary. if(lastStartSpec != null) { if(insertingAfterNewline) { lastStartSpec.setDirection(lastStartDirection); } // Join to the fracture if NOT inserting at the end // (fracture only happens when not inserting at end of // paragraph). else if(pParagraph.getEndOffset() != endOffset) { lastStartSpec.setDirection(ElementSpec. JoinFractureDirection); } // Join to next if parent of pParagraph has another // element after pParagraph, and it isn't a leaf. else { Element parent = pParagraph.getParentElement(); int pParagraphIndex = parent.getElementIndex(offset); if((pParagraphIndex + 1) < parent.getElementCount() && !parent.getElement(pParagraphIndex + 1).isLeaf()) { lastStartSpec.setDirection(ElementSpec. JoinNextDirection); } } } // Do a JoinNext for last spec if it is content, it doesn't // already have a direction set, no new paragraphs have been // inserted or a new paragraph has been inserted and its join // direction isn't originate, and the element at endOffset // is a leaf. if(insertingAtBoundry && endOffset < docLength) { ElementSpec last = parseBuffer.lastElement(); if(last.getType() == ElementSpec.ContentType && last.getDirection() != ElementSpec.JoinPreviousDirection && ((lastStartSpec == null && (paragraph == pParagraph || insertingAfterNewline)) || (lastStartSpec != null && lastStartSpec.getDirection() != ElementSpec.OriginateDirection))) { Element nextRun = paragraph.getElement(paragraph. getElementIndex(endOffset)); // Don't try joining to a branch! if(nextRun.isLeaf() && attr.isEqual(nextRun.getAttributes())) { last.setDirection(ElementSpec.JoinNextDirection); } } } // If not inserting at boundary and there is going to be a // fracture, then can join next on last content if cattr // matches the new attributes. else if(!insertingAtBoundry && lastStartSpec != null && lastStartSpec.getDirection() == ElementSpec.JoinFractureDirection) { ElementSpec last = parseBuffer.lastElement(); if(last.getType() == ElementSpec.ContentType && last.getDirection() != ElementSpec.JoinPreviousDirection && attr.isEqual(cattr)) { last.setDirection(ElementSpec.JoinNextDirection); } } // Check for the composed text element. If it is, merge the character attributes // into this element as well. if (Utilities.isComposedTextAttributeDefined(attr)) { MutableAttributeSet mattr = (MutableAttributeSet) attr; mattr.addAttributes(cattr); mattr.addAttribute(AbstractDocument.ElementNameAttribute, AbstractDocument.ContentElementName); // Assure that the composed text element is named properly // and doesn't have the CR attribute defined. mattr.addAttribute(StyleConstants.NameAttribute, AbstractDocument.ContentElementName); if (mattr.isDefined(IMPLIED_CR)) { mattr.removeAttribute(IMPLIED_CR); } } ElementSpec[] spec = new ElementSpec[parseBuffer.size()]; parseBuffer.copyInto(spec); buffer.insert(offset, length, spec, chng); } catch (BadLocationException bl) { } super.insertUpdate( chng, attr ); } /** * This is called by insertUpdate when inserting after a new line. * It generates, in <code>parseBuffer</code>, ElementSpecs that will * position the stack in <code>paragraph</code>.<p> * It returns the direction the last StartSpec should have (this don't * necessarily create the last start spec). */ short createSpecsForInsertAfterNewline(Element paragraph, Element pParagraph, AttributeSet pattr, Vector<ElementSpec> parseBuffer, int offset, int endOffset) { // Need to find the common parent of pParagraph and paragraph. if(paragraph.getParentElement() == pParagraph.getParentElement()) { // The simple (and common) case that pParagraph and // paragraph have the same parent. ElementSpec spec = new ElementSpec(pattr, ElementSpec.EndTagType); parseBuffer.addElement(spec); spec = new ElementSpec(pattr, ElementSpec.StartTagType); parseBuffer.addElement(spec); if(pParagraph.getEndOffset() != endOffset) return ElementSpec.JoinFractureDirection; Element parent = pParagraph.getParentElement(); if((parent.getElementIndex(offset) + 1) < parent.getElementCount()) return ElementSpec.JoinNextDirection; } else { // Will only happen for text with more than 2 levels. // Find the common parent of a paragraph and pParagraph Vector<Element> leftParents = new Vector<Element>(); Vector<Element> rightParents = new Vector<Element>(); Element e = pParagraph; while(e != null) { leftParents.addElement(e); e = e.getParentElement(); } e = paragraph; int leftIndex = -1; while(e != null && (leftIndex = leftParents.indexOf(e)) == -1) { rightParents.addElement(e); e = e.getParentElement(); } if(e != null) { // e identifies the common parent. // Build the ends. for(int counter = 0; counter < leftIndex; counter++) { parseBuffer.addElement(new ElementSpec (null, ElementSpec.EndTagType)); } // And the starts. ElementSpec spec; for(int counter = rightParents.size() - 1; counter >= 0; counter--) { spec = new ElementSpec(rightParents.elementAt(counter).getAttributes(), ElementSpec.StartTagType); if(counter > 0) spec.setDirection(ElementSpec.JoinNextDirection); parseBuffer.addElement(spec); } // If there are right parents, then we generated starts // down the right subtree and there will be an element to // join to. if(rightParents.size() > 0) return ElementSpec.JoinNextDirection; // No right subtree, e.getElement(endOffset) is a // leaf. There will be a facture. return ElementSpec.JoinFractureDirection; } // else: Could throw an exception here, but should never get here! } return ElementSpec.OriginateDirection; } /** * Updates document structure as a result of text removal. * * @param chng a description of the document change */ protected void removeUpdate(DefaultDocumentEvent chng) { super.removeUpdate(chng); buffer.remove(chng.getOffset(), chng.getLength(), chng); } /** * Creates the root element to be used to represent the * default document structure. * * @return the element base */ protected AbstractElement createDefaultRoot() { // grabs a write-lock for this initialization and // abandon it during initialization so in normal // operation we can detect an illegitimate attempt // to mutate attributes. writeLock(); BranchElement section = new SectionElement(); BranchElement paragraph = new BranchElement(section, null); LeafElement brk = new LeafElement(paragraph, null, 0, 1); Element[] buff = new Element[1]; buff[0] = brk; paragraph.replace(0, 0, buff); buff[0] = paragraph; section.replace(0, 0, buff); writeUnlock(); return section; } /** * Gets the foreground color from an attribute set. * * @param attr the attribute set * @return the color */ public Color getForeground(AttributeSet attr) { StyleContext styles = (StyleContext) getAttributeContext(); return styles.getForeground(attr); } /** * Gets the background color from an attribute set. * * @param attr the attribute set * @return the color */ public Color getBackground(AttributeSet attr) { StyleContext styles = (StyleContext) getAttributeContext(); return styles.getBackground(attr); } /** * Gets the font from an attribute set. * * @param attr the attribute set * @return the font */ public Font getFont(AttributeSet attr) { StyleContext styles = (StyleContext) getAttributeContext(); return styles.getFont(attr); } /** * Called when any of this document's styles have changed. * Subclasses may wish to be intelligent about what gets damaged. * * @param style The Style that has changed. */ protected void styleChanged(Style style) { // Only propagate change updated if have content if (getLength() != 0) { // lazily create a ChangeUpdateRunnable if (updateRunnable == null) { updateRunnable = new ChangeUpdateRunnable(); } // We may get a whole batch of these at once, so only // queue the runnable if it is not already pending synchronized(updateRunnable) { if (!updateRunnable.isPending) { SwingUtilities.invokeLater(updateRunnable); updateRunnable.isPending = true; } } } } /** * Adds a document listener for notification of any changes. * * @param listener the listener * @see Document#addDocumentListener */ public void addDocumentListener(DocumentListener listener) { synchronized(listeningStyles) { int oldDLCount = listenerList.getListenerCount (DocumentListener.class); super.addDocumentListener(listener); if (oldDLCount == 0) { if (styleContextChangeListener == null) { styleContextChangeListener = createStyleContextChangeListener(); } if (styleContextChangeListener != null) { StyleContext styles = (StyleContext)getAttributeContext(); List<ChangeListener> staleListeners = AbstractChangeHandler.getStaleListeners(styleContextChangeListener); for (ChangeListener l: staleListeners) { styles.removeChangeListener(l); } styles.addChangeListener(styleContextChangeListener); } updateStylesListeningTo(); } } } /** * Removes a document listener. * * @param listener the listener * @see Document#removeDocumentListener */ public void removeDocumentListener(DocumentListener listener) { synchronized(listeningStyles) { super.removeDocumentListener(listener); if (listenerList.getListenerCount(DocumentListener.class) == 0) { for (int counter = listeningStyles.size() - 1; counter >= 0; counter--) { listeningStyles.elementAt(counter). removeChangeListener(styleChangeListener); } listeningStyles.removeAllElements(); if (styleContextChangeListener != null) { StyleContext styles = (StyleContext)getAttributeContext(); styles.removeChangeListener(styleContextChangeListener); } } } } /** * Returns a new instance of StyleChangeHandler. */ ChangeListener createStyleChangeListener() { return new StyleChangeHandler(this); } /** * Returns a new instance of StyleContextChangeHandler. */ ChangeListener createStyleContextChangeListener() { return new StyleContextChangeHandler(this); } /** * Adds a ChangeListener to new styles, and removes ChangeListener from * old styles. */ void updateStylesListeningTo() { synchronized(listeningStyles) { StyleContext styles = (StyleContext)getAttributeContext(); if (styleChangeListener == null) { styleChangeListener = createStyleChangeListener(); } if (styleChangeListener != null && styles != null) { Enumeration styleNames = styles.getStyleNames(); Vector v = (Vector)listeningStyles.clone(); listeningStyles.removeAllElements(); List<ChangeListener> staleListeners = AbstractChangeHandler.getStaleListeners(styleChangeListener); while (styleNames.hasMoreElements()) { String name = (String)styleNames.nextElement(); Style aStyle = styles.getStyle(name); int index = v.indexOf(aStyle); listeningStyles.addElement(aStyle); if (index == -1) { for (ChangeListener l: staleListeners) { aStyle.removeChangeListener(l); } aStyle.addChangeListener(styleChangeListener); } else { v.removeElementAt(index); } } for (int counter = v.size() - 1; counter >= 0; counter--) { Style aStyle = (Style)v.elementAt(counter); aStyle.removeChangeListener(styleChangeListener); } if (listeningStyles.size() == 0) { styleChangeListener = null; } } } } private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { listeningStyles = new Vector<Style>(); s.defaultReadObject(); // Reinstall style listeners. if (styleContextChangeListener == null && listenerList.getListenerCount(DocumentListener.class) > 0) { styleContextChangeListener = createStyleContextChangeListener(); if (styleContextChangeListener != null) { StyleContext styles = (StyleContext)getAttributeContext(); styles.addChangeListener(styleContextChangeListener); } updateStylesListeningTo(); } } // --- member variables ----------------------------------------------------------- /** * The default size of the initial content buffer. */ public static final int BUFFER_SIZE_DEFAULT = 4096; protected ElementBuffer buffer; /** Styles listening to. */ private transient Vector<Style> listeningStyles; /** Listens to Styles. */ private transient ChangeListener styleChangeListener; /** Listens to Styles. */ private transient ChangeListener styleContextChangeListener; /** Run to create a change event for the document */ private transient ChangeUpdateRunnable updateRunnable; /** * Default root element for a document... maps out the * paragraphs/lines contained. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. */ protected class SectionElement extends BranchElement { /** * Creates a new SectionElement. */ public SectionElement() { super(null, null); } /** * Gets the name of the element. * * @return the name */ public String getName() { return SectionElementName; } } /** * Specification for building elements. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. */ public static class ElementSpec { /** * A possible value for getType. This specifies * that this record type is a start tag and * represents markup that specifies the start * of an element. */ public static final short StartTagType = 1; /** * A possible value for getType. This specifies * that this record type is a end tag and * represents markup that specifies the end * of an element. */ public static final short EndTagType = 2; /** * A possible value for getType. This specifies * that this record type represents content. */ public static final short ContentType = 3; /** * A possible value for getDirection. This specifies * that the data associated with this record should * be joined to what precedes it. */ public static final short JoinPreviousDirection = 4; /** * A possible value for getDirection. This specifies * that the data associated with this record should * be joined to what follows it. */ public static final short JoinNextDirection = 5; /** * A possible value for getDirection. This specifies * that the data associated with this record should * be used to originate a new element. This would be * the normal value. */ public static final short OriginateDirection = 6; /** * A possible value for getDirection. This specifies * that the data associated with this record should * be joined to the fractured element. */ public static final short JoinFractureDirection = 7; /** * Constructor useful for markup when the markup will not * be stored in the document. * * @param a the attributes for the element * @param type the type of the element (StartTagType, EndTagType, * ContentType) */ public ElementSpec(AttributeSet a, short type) { this(a, type, null, 0, 0); } /** * Constructor for parsing inside the document when * the data has already been added, but len information * is needed. * * @param a the attributes for the element * @param type the type of the element (StartTagType, EndTagType, * ContentType) * @param len the length &gt;= 0 */ public ElementSpec(AttributeSet a, short type, int len) { this(a, type, null, 0, len); } /** * Constructor for creating a spec externally for batch * input of content and markup into the document. * * @param a the attributes for the element * @param type the type of the element (StartTagType, EndTagType, * ContentType) * @param txt the text for the element * @param offs the offset into the text &gt;= 0 * @param len the length of the text &gt;= 0 */ public ElementSpec(AttributeSet a, short type, char[] txt, int offs, int len) { attr = a; this.type = type; this.data = txt; this.offs = offs; this.len = len; this.direction = OriginateDirection; } /** * Sets the element type. * * @param type the type of the element (StartTagType, EndTagType, * ContentType) */ public void setType(short type) { this.type = type; } /** * Gets the element type. * * @return the type of the element (StartTagType, EndTagType, * ContentType) */ public short getType() { return type; } /** * Sets the direction. * * @param direction the direction (JoinPreviousDirection, * JoinNextDirection) */ public void setDirection(short direction) { this.direction = direction; } /** * Gets the direction. * * @return the direction (JoinPreviousDirection, JoinNextDirection) */ public short getDirection() { return direction; } /** * Gets the element attributes. * * @return the attribute set */ public AttributeSet getAttributes() { return attr; } /** * Gets the array of characters. * * @return the array */ public char[] getArray() { return data; } /** * Gets the starting offset. * * @return the offset &gt;= 0 */ public int getOffset() { return offs; } /** * Gets the length. * * @return the length &gt;= 0 */ public int getLength() { return len; } /** * Converts the element to a string. * * @return the string */ public String toString() { String tlbl = "??"; String plbl = "??"; switch(type) { case StartTagType: tlbl = "StartTag"; break; case ContentType: tlbl = "Content"; break; case EndTagType: tlbl = "EndTag"; break; } switch(direction) { case JoinPreviousDirection: plbl = "JoinPrevious"; break; case JoinNextDirection: plbl = "JoinNext"; break; case OriginateDirection: plbl = "Originate"; break; case JoinFractureDirection: plbl = "Fracture"; break; } return tlbl + ":" + plbl + ":" + getLength(); } private AttributeSet attr; private int len; private short type; private short direction; private int offs; private char[] data; } /** * Class to manage changes to the element * hierarchy. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans&trade; * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. */ public class ElementBuffer implements Serializable { /** * Creates a new ElementBuffer. * * @param root the root element * @since 1.4 */ public ElementBuffer(Element root) { this.root = root; changes = new Vector<ElemChanges>(); path = new Stack<ElemChanges>(); } /** * Gets the root element. * * @return the root element */ public Element getRootElement() { return root; } /** * Inserts new content. * * @param offset the starting offset &gt;= 0 * @param length the length &gt;= 0 * @param data the data to insert * @param de the event capturing this edit */ public void insert(int offset, int length, ElementSpec[] data, DefaultDocumentEvent de) { if (length == 0) { // Nothing was inserted, no structure change. return; } insertOp = true; beginEdits(offset, length); insertUpdate(data); endEdits(de); insertOp = false; } void create(int length, ElementSpec[] data, DefaultDocumentEvent de) { insertOp = true; beginEdits(offset, length); // PENDING(prinz) this needs to be fixed to create a new // root element as well, but requires changes to the // DocumentEvent to inform the views that there is a new // root element. // Recreate the ending fake element to have the correct offsets. Element elem = root; int index = elem.getElementIndex(0); while (! elem.isLeaf()) { Element child = elem.getElement(index); push(elem, index); elem = child; index = elem.getElementIndex(0); } ElemChanges ec = path.peek(); Element child = ec.parent.getElement(ec.index); ec.added.addElement(createLeafElement(ec.parent, child.getAttributes(), getLength(), child.getEndOffset())); ec.removed.addElement(child); while (path.size() > 1) { pop(); } int n = data.length; // Reset the root elements attributes. AttributeSet newAttrs = null; if (n > 0 && data[0].getType() == ElementSpec.StartTagType) { newAttrs = data[0].getAttributes(); } if (newAttrs == null) { newAttrs = SimpleAttributeSet.EMPTY; } MutableAttributeSet attr = (MutableAttributeSet)root. getAttributes(); de.addEdit(new AttributeUndoableEdit(root, newAttrs, true)); attr.removeAttributes(attr); attr.addAttributes(newAttrs); // fold in the specified subtree for (int i = 1; i < n; i++) { insertElement(data[i]); } // pop the remaining path while (path.size() != 0) { pop(); } endEdits(de); insertOp = false; } /** * Removes content. * * @param offset the starting offset &gt;= 0 * @param length the length &gt;= 0 * @param de the event capturing this edit */ public void remove(int offset, int length, DefaultDocumentEvent de) { beginEdits(offset, length); removeUpdate(); endEdits(de); } /** * Changes content. * * @param offset the starting offset &gt;= 0 * @param length the length &gt;= 0 * @param de the event capturing this edit */ public void change(int offset, int length, DefaultDocumentEvent de) { beginEdits(offset, length); changeUpdate(); endEdits(de); } /** * Inserts an update into the document. * * @param data the elements to insert */ protected void insertUpdate(ElementSpec[] data) { // push the path Element elem = root; int index = elem.getElementIndex(offset); while (! elem.isLeaf()) { Element child = elem.getElement(index); push(elem, (child.isLeaf() ? index : index+1)); elem = child; index = elem.getElementIndex(offset); } // Build a copy of the original path. insertPath = new ElemChanges[path.size()]; path.copyInto(insertPath); // Haven't created the fracture yet. createdFracture = false; // Insert the first content. int i; recreateLeafs = false; if(data[0].getType() == ElementSpec.ContentType) { insertFirstContent(data); pos += data[0].getLength(); i = 1; } else { fractureDeepestLeaf(data); i = 0; } // fold in the specified subtree int n = data.length; for (; i < n; i++) { insertElement(data[i]); } // Fracture, if we haven't yet. if(!createdFracture) fracture(-1); // pop the remaining path while (path.size() != 0) { pop(); } // Offset the last index if necessary. if(offsetLastIndex && offsetLastIndexOnReplace) { insertPath[insertPath.length - 1].index++; } // Make sure an edit is going to be created for each of the // original path items that have a change. for(int counter = insertPath.length - 1; counter >= 0; counter--) { ElemChanges change = insertPath[counter]; if(change.parent == fracturedParent) change.added.addElement(fracturedChild); if((change.added.size() > 0 || change.removed.size() > 0) && !changes.contains(change)) { // PENDING(sky): Do I need to worry about order here? changes.addElement(change); } } // An insert at 0 with an initial end implies some elements // will have no children (the bottomost leaf would have length 0) // this will find what element need to be removed and remove it. if (offset == 0 && fracturedParent != null && data[0].getType() == ElementSpec.EndTagType) { int counter = 0; while (counter < data.length && data[counter].getType() == ElementSpec.EndTagType) { counter++; } ElemChanges change = insertPath[insertPath.length - counter - 1]; change.removed.insertElementAt(change.parent.getElement (--change.index), 0); } } /** * Updates the element structure in response to a removal from the * associated sequence in the document. Any elements consumed by the * span of the removal are removed. */ protected void removeUpdate() { removeElements(root, offset, offset + length); } /** * Updates the element structure in response to a change in the * document. */ protected void changeUpdate() { boolean didEnd = split(offset, length); if (! didEnd) { // need to do the other end while (path.size() != 0) { pop(); } split(offset + length, 0); } while (path.size() != 0) { pop(); } } boolean split(int offs, int len) { boolean splitEnd = false; // push the path Element e = root; int index = e.getElementIndex(offs); while (! e.isLeaf()) { push(e, index); e = e.getElement(index); index = e.getElementIndex(offs); } ElemChanges ec = path.peek(); Element child = ec.parent.getElement(ec.index); // make sure there is something to do... if the // offset is already at a boundary then there is // nothing to do. if (child.getStartOffset() < offs && offs < child.getEndOffset()) { // we need to split, now see if the other end is within // the same parent. int index0 = ec.index; int index1 = index0; if (((offs + len) < ec.parent.getEndOffset()) && (len != 0)) { // it's a range split in the same parent index1 = ec.parent.getElementIndex(offs+len); if (index1 == index0) { // it's a three-way split ec.removed.addElement(child); e = createLeafElement(ec.parent, child.getAttributes(), child.getStartOffset(), offs); ec.added.addElement(e); e = createLeafElement(ec.parent, child.getAttributes(), offs, offs + len); ec.added.addElement(e); e = createLeafElement(ec.parent, child.getAttributes(), offs + len, child.getEndOffset()); ec.added.addElement(e); return true; } else { child = ec.parent.getElement(index1); if ((offs + len) == child.getStartOffset()) { // end is already on a boundary index1 = index0; } } splitEnd = true; } // split the first location pos = offs; child = ec.parent.getElement(index0); ec.removed.addElement(child); e = createLeafElement(ec.parent, child.getAttributes(), child.getStartOffset(), pos); ec.added.addElement(e); e = createLeafElement(ec.parent, child.getAttributes(), pos, child.getEndOffset()); ec.added.addElement(e); // pick up things in the middle for (int i = index0 + 1; i < index1; i++) { child = ec.parent.getElement(i); ec.removed.addElement(child); ec.added.addElement(child); } if (index1 != index0) { child = ec.parent.getElement(index1); pos = offs + len; ec.removed.addElement(child); e = createLeafElement(ec.parent, child.getAttributes(), child.getStartOffset(), pos); ec.added.addElement(e); e = createLeafElement(ec.parent, child.getAttributes(), pos, child.getEndOffset()); ec.added.addElement(e); } } return splitEnd; } /** * Creates the UndoableEdit record for the edits made * in the buffer. */ void endEdits(DefaultDocumentEvent de) { int n = changes.size(); for (int i = 0; i < n; i++) { ElemChanges ec = changes.elementAt(i); Element[] removed = new Element[ec.removed.size()]; ec.removed.copyInto(removed); Element[] added = new Element[ec.added.size()]; ec.added.copyInto(added); int index = ec.index; ((BranchElement) ec.parent).replace(index, removed.length, added); ElementEdit ee = new ElementEdit(ec.parent, index, removed, added); de.addEdit(ee); } changes.removeAllElements(); path.removeAllElements(); /* for (int i = 0; i < n; i++) { ElemChanges ec = (ElemChanges) changes.elementAt(i); System.err.print("edited: " + ec.parent + " at: " + ec.index + " removed " + ec.removed.size()); if (ec.removed.size() > 0) { int r0 = ((Element) ec.removed.firstElement()).getStartOffset(); int r1 = ((Element) ec.removed.lastElement()).getEndOffset(); System.err.print("[" + r0 + "," + r1 + "]"); } System.err.print(" added " + ec.added.size()); if (ec.added.size() > 0) { int p0 = ((Element) ec.added.firstElement()).getStartOffset(); int p1 = ((Element) ec.added.lastElement()).getEndOffset(); System.err.print("[" + p0 + "," + p1 + "]"); } System.err.println(""); } */ } /** * Initialize the buffer */ void beginEdits(int offset, int length) { this.offset = offset; this.length = length; this.endOffset = offset + length; pos = offset; if (changes == null) { changes = new Vector<ElemChanges>(); } else { changes.removeAllElements(); } if (path == null) { path = new Stack<ElemChanges>(); } else { path.removeAllElements(); } fracturedParent = null; fracturedChild = null; offsetLastIndex = offsetLastIndexOnReplace = false; } /** * Pushes a new element onto the stack that represents * the current path. * @param record Whether or not the push should be * recorded as an element change or not. * @param isFracture true if pushing on an element that was created * as the result of a fracture. */ void push(Element e, int index, boolean isFracture) { ElemChanges ec = new ElemChanges(e, index, isFracture); path.push(ec); } void push(Element e, int index) { push(e, index, false); } void pop() { ElemChanges ec = path.peek(); path.pop(); if ((ec.added.size() > 0) || (ec.removed.size() > 0)) { changes.addElement(ec); } else if (! path.isEmpty()) { Element e = ec.parent; if(e.getElementCount() == 0) { // if we pushed a branch element that didn't get // used, make sure its not marked as having been added. ec = path.peek(); ec.added.removeElement(e); } } } /** * move the current offset forward by n. */ void advance(int n) { pos += n; } void insertElement(ElementSpec es) { ElemChanges ec = path.peek(); switch(es.getType()) { case ElementSpec.StartTagType: switch(es.getDirection()) { case ElementSpec.JoinNextDirection: // Don't create a new element, use the existing one // at the specified location. Element parent = ec.parent.getElement(ec.index); if(parent.isLeaf()) { // This happens if inserting into a leaf, followed // by a join next where next sibling is not a leaf. if((ec.index + 1) < ec.parent.getElementCount()) parent = ec.parent.getElement(ec.index + 1); else throw new StateInvariantError("Join next to leaf"); } // Not really a fracture, but need to treat it like // one so that content join next will work correctly. // We can do this because there will never be a join // next followed by a join fracture. push(parent, 0, true); break; case ElementSpec.JoinFractureDirection: if(!createdFracture) { // Should always be something on the stack! fracture(path.size() - 1); } // If parent isn't a fracture, fracture will be // fracturedChild. if(!ec.isFracture) { push(fracturedChild, 0, true); } else // Parent is a fracture, use 1st element. push(ec.parent.getElement(0), 0, true); break; default: Element belem = createBranchElement(ec.parent, es.getAttributes()); ec.added.addElement(belem); push(belem, 0); break; } break; case ElementSpec.EndTagType: pop(); break; case ElementSpec.ContentType: int len = es.getLength(); if (es.getDirection() != ElementSpec.JoinNextDirection) { Element leaf = createLeafElement(ec.parent, es.getAttributes(), pos, pos + len); ec.added.addElement(leaf); } else { // JoinNext on tail is only applicable if last element // and attributes come from that of first element. // With a little extra testing it would be possible // to NOT due this again, as more than likely fracture() // created this element. if(!ec.isFracture) { Element first = null; if(insertPath != null) { for(int counter = insertPath.length - 1; counter >= 0; counter--) { if(insertPath[counter] == ec) { if(counter != (insertPath.length - 1)) first = ec.parent.getElement(ec.index); break; } } } if(first == null) first = ec.parent.getElement(ec.index + 1); Element leaf = createLeafElement(ec.parent, first. getAttributes(), pos, first.getEndOffset()); ec.added.addElement(leaf); ec.removed.addElement(first); } else { // Parent was fractured element. Element first = ec.parent.getElement(0); Element leaf = createLeafElement(ec.parent, first. getAttributes(), pos, first.getEndOffset()); ec.added.addElement(leaf); ec.removed.addElement(first); } } pos += len; break; } } /** * Remove the elements from <code>elem</code> in range * <code>rmOffs0</code>, <code>rmOffs1</code>. This uses * <code>canJoin</code> and <code>join</code> to handle joining * the endpoints of the insertion. * * @return true if elem will no longer have any elements. */ boolean removeElements(Element elem, int rmOffs0, int rmOffs1) { if (! elem.isLeaf()) { // update path for changes int index0 = elem.getElementIndex(rmOffs0); int index1 = elem.getElementIndex(rmOffs1); push(elem, index0); ElemChanges ec = path.peek(); // if the range is contained by one element, // we just forward the request if (index0 == index1) { Element child0 = elem.getElement(index0); if(rmOffs0 <= child0.getStartOffset() && rmOffs1 >= child0.getEndOffset()) { // Element totally removed. ec.removed.addElement(child0); } else if(removeElements(child0, rmOffs0, rmOffs1)) { ec.removed.addElement(child0); } } else { // the removal range spans elements. If we can join // the two endpoints, do it. Otherwise we remove the // interior and forward to the endpoints. Element child0 = elem.getElement(index0); Element child1 = elem.getElement(index1); boolean containsOffs1 = (rmOffs1 < elem.getEndOffset()); if (containsOffs1 && canJoin(child0, child1)) { // remove and join for (int i = index0; i <= index1; i++) { ec.removed.addElement(elem.getElement(i)); } Element e = join(elem, child0, child1, rmOffs0, rmOffs1); ec.added.addElement(e); } else { // remove interior and forward int rmIndex0 = index0 + 1; int rmIndex1 = index1 - 1; if (child0.getStartOffset() == rmOffs0 || (index0 == 0 && child0.getStartOffset() > rmOffs0 && child0.getEndOffset() <= rmOffs1)) { // start element completely consumed child0 = null; rmIndex0 = index0; } if (!containsOffs1) { child1 = null; rmIndex1++; } else if (child1.getStartOffset() == rmOffs1) { // end element not touched child1 = null; } if (rmIndex0 <= rmIndex1) { ec.index = rmIndex0; } for (int i = rmIndex0; i <= rmIndex1; i++) { ec.removed.addElement(elem.getElement(i)); } if (child0 != null) { if(removeElements(child0, rmOffs0, rmOffs1)) { ec.removed.insertElementAt(child0, 0); ec.index = index0; } } if (child1 != null) { if(removeElements(child1, rmOffs0, rmOffs1)) { ec.removed.addElement(child1); } } } } // publish changes pop(); // Return true if we no longer have any children. if(elem.getElementCount() == (ec.removed.size() - ec.added.size())) { return true; } } return false; } /** * Can the two given elements be coelesced together * into one element? */ boolean canJoin(Element e0, Element e1) { if ((e0 == null) || (e1 == null)) { return false; } // Don't join a leaf to a branch. boolean leaf0 = e0.isLeaf(); boolean leaf1 = e1.isLeaf(); if(leaf0 != leaf1) { return false; } if (leaf0) { // Only join leaves if the attributes match, otherwise // style information will be lost. return e0.getAttributes().isEqual(e1.getAttributes()); } // Only join non-leafs if the names are equal. This may result // in loss of style information, but this is typically acceptable // for non-leafs. String name0 = e0.getName(); String name1 = e1.getName(); if (name0 != null) { return name0.equals(name1); } if (name1 != null) { return name1.equals(name0); } // Both names null, treat as equal. return true; } /** * Joins the two elements carving out a hole for the * given removed range. */ Element join(Element p, Element left, Element right, int rmOffs0, int rmOffs1) { if (left.isLeaf() && right.isLeaf()) { return createLeafElement(p, left.getAttributes(), left.getStartOffset(), right.getEndOffset()); } else if ((!left.isLeaf()) && (!right.isLeaf())) { // join two branch elements. This copies the children before // the removal range on the left element, and after the removal // range on the right element. The two elements on the edge // are joined if possible and needed. Element to = createBranchElement(p, left.getAttributes()); int ljIndex = left.getElementIndex(rmOffs0); int rjIndex = right.getElementIndex(rmOffs1); Element lj = left.getElement(ljIndex); if (lj.getStartOffset() >= rmOffs0) { lj = null; } Element rj = right.getElement(rjIndex); if (rj.getStartOffset() == rmOffs1) { rj = null; } Vector<Element> children = new Vector<Element>(); // transfer the left for (int i = 0; i < ljIndex; i++) { children.addElement(clone(to, left.getElement(i))); } // transfer the join/middle if (canJoin(lj, rj)) { Element e = join(to, lj, rj, rmOffs0, rmOffs1); children.addElement(e); } else { if (lj != null) { children.addElement(cloneAsNecessary(to, lj, rmOffs0, rmOffs1)); } if (rj != null) { children.addElement(cloneAsNecessary(to, rj, rmOffs0, rmOffs1)); } } // transfer the right int n = right.getElementCount(); for (int i = (rj == null) ? rjIndex : rjIndex + 1; i < n; i++) { children.addElement(clone(to, right.getElement(i))); } // install the children Element[] c = new Element[children.size()]; children.copyInto(c); ((BranchElement)to).replace(0, 0, c); return to; } else { throw new StateInvariantError( "No support to join leaf element with non-leaf element"); } } /** * Creates a copy of this element, with a different * parent. * * @param parent the parent element * @param clonee the element to be cloned * @return the copy */ public Element clone(Element parent, Element clonee) { if (clonee.isLeaf()) { return createLeafElement(parent, clonee.getAttributes(), clonee.getStartOffset(), clonee.getEndOffset()); } Element e = createBranchElement(parent, clonee.getAttributes()); int n = clonee.getElementCount(); Element[] children = new Element[n]; for (int i = 0; i < n; i++) { children[i] = clone(e, clonee.getElement(i)); } ((BranchElement)e).replace(0, 0, children); return e; } /** * Creates a copy of this element, with a different * parent. Children of this element included in the * removal range will be discarded. */ Element cloneAsNecessary(Element parent, Element clonee, int rmOffs0, int rmOffs1) { if (clonee.isLeaf()) { return createLeafElement(parent, clonee.getAttributes(), clonee.getStartOffset(), clonee.getEndOffset()); } Element e = createBranchElement(parent, clonee.getAttributes()); int n = clonee.getElementCount(); ArrayList<Element> childrenList = new ArrayList<Element>(n); for (int i = 0; i < n; i++) { Element elem = clonee.getElement(i); if (elem.getStartOffset() < rmOffs0 || elem.getEndOffset() > rmOffs1) { childrenList.add(cloneAsNecessary(e, elem, rmOffs0, rmOffs1)); } } Element[] children = new Element[childrenList.size()]; children = childrenList.toArray(children); ((BranchElement)e).replace(0, 0, children); return e; } /** * Determines if a fracture needs to be performed. A fracture * can be thought of as moving the right part of a tree to a * new location, where the right part is determined by what has * been inserted. <code>depth</code> is used to indicate a * JoinToFracture is needed to an element at a depth * of <code>depth</code>. Where the root is 0, 1 is the children * of the root... * <p>This will invoke <code>fractureFrom</code> if it is determined * a fracture needs to happen. */ void fracture(int depth) { int cLength = insertPath.length; int lastIndex = -1; boolean needRecreate = recreateLeafs; ElemChanges lastChange = insertPath[cLength - 1]; // Use childAltered to determine when a child has been altered, // that is the point of insertion is less than the element count. boolean childAltered = ((lastChange.index + 1) < lastChange.parent.getElementCount()); int deepestAlteredIndex = (needRecreate) ? cLength : -1; int lastAlteredIndex = cLength - 1; createdFracture = true; // Determine where to start recreating from. // Start at - 2, as first one is indicated by recreateLeafs and // childAltered. for(int counter = cLength - 2; counter >= 0; counter--) { ElemChanges change = insertPath[counter]; if(change.added.size() > 0 || counter == depth) { lastIndex = counter; if(!needRecreate && childAltered) { needRecreate = true; if(deepestAlteredIndex == -1) deepestAlteredIndex = lastAlteredIndex + 1; } } if(!childAltered && change.index < change.parent.getElementCount()) { childAltered = true; lastAlteredIndex = counter; } } if(needRecreate) { // Recreate all children to right of parent starting // at lastIndex. if(lastIndex == -1) lastIndex = cLength - 1; fractureFrom(insertPath, lastIndex, deepestAlteredIndex); } } /** * Recreates the elements to the right of the insertion point. * This starts at <code>startIndex</code> in <code>changed</code>, * and calls duplicate to duplicate existing elements. * This will also duplicate the elements along the insertion * point, until a depth of <code>endFractureIndex</code> is * reached, at which point only the elements to the right of * the insertion point are duplicated. */ void fractureFrom(ElemChanges[] changed, int startIndex, int endFractureIndex) { // Recreate the element representing the inserted index. ElemChanges change = changed[startIndex]; Element child; Element newChild; int changeLength = changed.length; if((startIndex + 1) == changeLength) child = change.parent.getElement(change.index); else child = change.parent.getElement(change.index - 1); if(child.isLeaf()) { newChild = createLeafElement(change.parent, child.getAttributes(), Math.max(endOffset, child.getStartOffset()), child.getEndOffset()); } else { newChild = createBranchElement(change.parent, child.getAttributes()); } fracturedParent = change.parent; fracturedChild = newChild; // Recreate all the elements to the right of the // insertion point. Element parent = newChild; while(++startIndex < endFractureIndex) { boolean isEnd = ((startIndex + 1) == endFractureIndex); boolean isEndLeaf = ((startIndex + 1) == changeLength); // Create the newChild, a duplicate of the elment at // index. This isn't done if isEnd and offsetLastIndex are true // indicating a join previous was done. change = changed[startIndex]; // Determine the child to duplicate, won't have to duplicate // if at end of fracture, or offseting index. if(isEnd) { if(offsetLastIndex || !isEndLeaf) child = null; else child = change.parent.getElement(change.index); } else { child = change.parent.getElement(change.index - 1); } // Duplicate it. if(child != null) { if(child.isLeaf()) { newChild = createLeafElement(parent, child.getAttributes(), Math.max(endOffset, child.getStartOffset()), child.getEndOffset()); } else { newChild = createBranchElement(parent, child.getAttributes()); } } else newChild = null; // Recreate the remaining children (there may be none). int kidsToMove = change.parent.getElementCount() - change.index; Element[] kids; int moveStartIndex; int kidStartIndex = 1; if(newChild == null) { // Last part of fracture. if(isEndLeaf) { kidsToMove--; moveStartIndex = change.index + 1; } else { moveStartIndex = change.index; } kidStartIndex = 0; kids = new Element[kidsToMove]; } else { if(!isEnd) { // Branch. kidsToMove++; moveStartIndex = change.index; } else { // Last leaf, need to recreate part of it. moveStartIndex = change.index + 1; } kids = new Element[kidsToMove]; kids[0] = newChild; } for(int counter = kidStartIndex; counter < kidsToMove; counter++) { Element toMove =change.parent.getElement(moveStartIndex++); kids[counter] = recreateFracturedElement(parent, toMove); change.removed.addElement(toMove); } ((BranchElement)parent).replace(0, 0, kids); parent = newChild; } } /** * Recreates <code>toDuplicate</code>. This is called when an * element needs to be created as the result of an insertion. This * will recurse and create all the children. This is similar to * <code>clone</code>, but deteremines the offsets differently. */ Element recreateFracturedElement(Element parent, Element toDuplicate) { if(toDuplicate.isLeaf()) { return createLeafElement(parent, toDuplicate.getAttributes(), Math.max(toDuplicate.getStartOffset(), endOffset), toDuplicate.getEndOffset()); } // Not a leaf Element newParent = createBranchElement(parent, toDuplicate. getAttributes()); int childCount = toDuplicate.getElementCount(); Element[] newKids = new Element[childCount]; for(int counter = 0; counter < childCount; counter++) { newKids[counter] = recreateFracturedElement(newParent, toDuplicate.getElement(counter)); } ((BranchElement)newParent).replace(0, 0, newKids); return newParent; } /** * Splits the bottommost leaf in <code>path</code>. * This is called from insert when the first element is NOT content. */ void fractureDeepestLeaf(ElementSpec[] specs) { // Split the bottommost leaf. It will be recreated elsewhere. ElemChanges ec = path.peek(); Element child = ec.parent.getElement(ec.index); // Inserts at offset 0 do not need to recreate child (it would // have a length of 0!). if (offset != 0) { Element newChild = createLeafElement(ec.parent, child.getAttributes(), child.getStartOffset(), offset); ec.added.addElement(newChild); } ec.removed.addElement(child); if(child.getEndOffset() != endOffset) recreateLeafs = true; else offsetLastIndex = true; } /** * Inserts the first content. This needs to be separate to handle * joining. */ void insertFirstContent(ElementSpec[] specs) { ElementSpec firstSpec = specs[0]; ElemChanges ec = path.peek(); Element child = ec.parent.getElement(ec.index); int firstEndOffset = offset + firstSpec.getLength(); boolean isOnlyContent = (specs.length == 1); switch(firstSpec.getDirection()) { case ElementSpec.JoinPreviousDirection: if(child.getEndOffset() != firstEndOffset && !isOnlyContent) { // Create the left split part containing new content. Element newE = createLeafElement(ec.parent, child.getAttributes(), child.getStartOffset(), firstEndOffset); ec.added.addElement(newE); ec.removed.addElement(child); // Remainder will be created later. if(child.getEndOffset() != endOffset) recreateLeafs = true; else offsetLastIndex = true; } else { offsetLastIndex = true; offsetLastIndexOnReplace = true; } // else Inserted at end, and is total length. // Update index incase something added/removed. break; case ElementSpec.JoinNextDirection: if(offset != 0) { // Recreate the first element, its offset will have // changed. Element newE = createLeafElement(ec.parent, child.getAttributes(), child.getStartOffset(), offset); ec.added.addElement(newE); // Recreate the second, merge part. We do no checking // to see if JoinNextDirection is valid here! Element nextChild = ec.parent.getElement(ec.index + 1); if(isOnlyContent) newE = createLeafElement(ec.parent, nextChild. getAttributes(), offset, nextChild.getEndOffset()); else newE = createLeafElement(ec.parent, nextChild. getAttributes(), offset, firstEndOffset); ec.added.addElement(newE); ec.removed.addElement(child); ec.removed.addElement(nextChild); } // else nothin to do. // PENDING: if !isOnlyContent could raise here! break; default: // Inserted into middle, need to recreate split left // new content, and split right. if(child.getStartOffset() != offset) { Element newE = createLeafElement(ec.parent, child.getAttributes(), child.getStartOffset(), offset); ec.added.addElement(newE); } ec.removed.addElement(child); // new content Element newE = createLeafElement(ec.parent, firstSpec.getAttributes(), offset, firstEndOffset); ec.added.addElement(newE); if(child.getEndOffset() != endOffset) { // Signals need to recreate right split later. recreateLeafs = true; } else { offsetLastIndex = true; } break; } } Element root; transient int pos; // current position transient int offset; transient int length; transient int endOffset; transient Vector<ElemChanges> changes; transient Stack<ElemChanges> path; transient boolean insertOp; transient boolean recreateLeafs; // For insert. /** For insert, path to inserted elements. */ transient ElemChanges[] insertPath; /** Only for insert, set to true when the fracture has been created. */ transient boolean createdFracture; /** Parent that contains the fractured child. */ transient Element fracturedParent; /** Fractured child. */ transient Element fracturedChild; /** Used to indicate when fracturing that the last leaf should be * skipped. */ transient boolean offsetLastIndex; /** Used to indicate that the parent of the deepest leaf should * offset the index by 1 when adding/removing elements in an * insert. */ transient boolean offsetLastIndexOnReplace; /* * Internal record used to hold element change specifications */ class ElemChanges { ElemChanges(Element parent, int index, boolean isFracture) { this.parent = parent; this.index = index; this.isFracture = isFracture; added = new Vector<Element>(); removed = new Vector<Element>(); } public String toString() { return "added: " + added + "\nremoved: " + removed + "\n"; } Element parent; int index; Vector<Element> added; Vector<Element> removed; boolean isFracture; } } /** * An UndoableEdit used to remember AttributeSet changes to an * Element. */ public static class AttributeUndoableEdit extends AbstractUndoableEdit { public AttributeUndoableEdit(Element element, AttributeSet newAttributes, boolean isReplacing) { super(); this.element = element; this.newAttributes = newAttributes; this.isReplacing = isReplacing; // If not replacing, it may be more efficient to only copy the // changed values... copy = element.getAttributes().copyAttributes(); } /** * Redoes a change. * * @exception CannotRedoException if the change cannot be redone */ public void redo() throws CannotRedoException { super.redo(); MutableAttributeSet as = (MutableAttributeSet)element .getAttributes(); if(isReplacing) as.removeAttributes(as); as.addAttributes(newAttributes); } /** * Undoes a change. * * @exception CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); MutableAttributeSet as = (MutableAttributeSet)element.getAttributes(); as.removeAttributes(as); as.addAttributes(copy); } // AttributeSet containing additional entries, must be non-mutable! protected AttributeSet newAttributes; // Copy of the AttributeSet the Element contained. protected AttributeSet copy; // true if all the attributes in the element were removed first. protected boolean isReplacing; // Efected Element. protected Element element; } /** * UndoableEdit for changing the resolve parent of an Element. */ static class StyleChangeUndoableEdit extends AbstractUndoableEdit { public StyleChangeUndoableEdit(AbstractElement element, Style newStyle) { super(); this.element = element; this.newStyle = newStyle; oldStyle = element.getResolveParent(); } /** * Redoes a change. * * @exception CannotRedoException if the change cannot be redone */ public void redo() throws CannotRedoException { super.redo(); element.setResolveParent(newStyle); } /** * Undoes a change. * * @exception CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); element.setResolveParent(oldStyle); } /** Element to change resolve parent of. */ protected AbstractElement element; /** New style. */ protected Style newStyle; /** Old style, before setting newStyle. */ protected AttributeSet oldStyle; } /** * Base class for style change handlers with support for stale objects detection. */ abstract static class AbstractChangeHandler implements ChangeListener { /* This has an implicit reference to the handler object. */ private class DocReference extends WeakReference<DefaultStyledDocument> { DocReference(DefaultStyledDocument d, ReferenceQueue<DefaultStyledDocument> q) { super(d, q); } /** * Return a reference to the style change handler object. */ ChangeListener getListener() { return AbstractChangeHandler.this; } } /** Class-specific reference queues. */ private final static Map<Class, ReferenceQueue<DefaultStyledDocument>> queueMap = new HashMap<Class, ReferenceQueue<DefaultStyledDocument>>(); /** A weak reference to the document object. */ private DocReference doc; AbstractChangeHandler(DefaultStyledDocument d) { Class c = getClass(); ReferenceQueue<DefaultStyledDocument> q; synchronized (queueMap) { q = queueMap.get(c); if (q == null) { q = new ReferenceQueue<DefaultStyledDocument>(); queueMap.put(c, q); } } doc = new DocReference(d, q); } /** * Return a list of stale change listeners. * * A change listener becomes "stale" when its document is cleaned by GC. */ static List<ChangeListener> getStaleListeners(ChangeListener l) { List<ChangeListener> staleListeners = new ArrayList<ChangeListener>(); ReferenceQueue<DefaultStyledDocument> q = queueMap.get(l.getClass()); if (q != null) { DocReference r; synchronized (q) { while ((r = (DocReference) q.poll()) != null) { staleListeners.add(r.getListener()); } } } return staleListeners; } /** * The ChangeListener wrapper which guards against dead documents. */ public void stateChanged(ChangeEvent e) { DefaultStyledDocument d = doc.get(); if (d != null) { fireStateChanged(d, e); } } /** Run the actual class-specific stateChanged() method. */ abstract void fireStateChanged(DefaultStyledDocument d, ChangeEvent e); } /** * Added to all the Styles. When instances of this receive a * stateChanged method, styleChanged is invoked. */ static class StyleChangeHandler extends AbstractChangeHandler { StyleChangeHandler(DefaultStyledDocument d) { super(d); } void fireStateChanged(DefaultStyledDocument d, ChangeEvent e) { Object source = e.getSource(); if (source instanceof Style) { d.styleChanged((Style) source); } else { d.styleChanged(null); } } } /** * Added to the StyleContext. When the StyleContext changes, this invokes * <code>updateStylesListeningTo</code>. */ static class StyleContextChangeHandler extends AbstractChangeHandler { StyleContextChangeHandler(DefaultStyledDocument d) { super(d); } void fireStateChanged(DefaultStyledDocument d, ChangeEvent e) { d.updateStylesListeningTo(); } } /** * When run this creates a change event for the complete document * and fires it. */ class ChangeUpdateRunnable implements Runnable { boolean isPending = false; public void run() { synchronized(this) { isPending = false; } try { writeLock(); DefaultDocumentEvent dde = new DefaultDocumentEvent(0, getLength(), DocumentEvent.EventType.CHANGE); dde.end(); fireChangedUpdate(dde); } finally { writeUnlock(); } } } }
stain/jdk8u
src/share/classes/javax/swing/text/DefaultStyledDocument.java
Java
gpl-2.0
107,201
<?php /** * * Amazon payment plugin * * @author Valerie Isaksen * @version $Id: ipnurl.php 8703 2015-02-15 17:11:16Z alatak $ * @package VirtueMart * @subpackage payment * Copyright (C) 2004-2015 Virtuemart Team. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ // Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die(); jimport('joomla.form.formfield'); class JFormFieldIpnURL extends JFormField { var $type = 'ipnurl'; protected function getInput() { $cid = vRequest::getvar('cid', NULL, 'array'); if (is_Array($cid)) { $virtuemart_paymentmethod_id = $cid[0]; } else { $virtuemart_paymentmethod_id = $cid; } $http = JURI::root() . 'index.php?option=com_virtuemart&view=vmplg&task=notify&nt=ipn&tmpl=component&pm=' . $virtuemart_paymentmethod_id; $https = str_replace('http://', 'https://', $http); $string = '<div class="' . $this->class . '">'; $string .= '<div class="ipn-sandbox">' . $http . ' <br /></div>'; if (strcmp($https,$http) !==0){ $string .= '<div class="ipn-sandbox">' . vmText::_('VMPAYMENT_AMAZON_OR') . '<br /></div>'; $string .= $https; } $string .= "</div>"; return $string; } }
isengartz/food
tmp/install_5662784dc4d75/admin/plugins/vmpayment/amazon/fields/ipnurl.php
PHP
gpl-2.0
1,639
///////////////////////////////////////////////////////////////////////////// // Name: src/msw/tbar95.cpp // Purpose: wxToolBar // Author: Julian Smart // Modified by: // Created: 04/01/98 // RCS-ID: $Id: tbar95.cpp 58446 2009-01-26 23:32:16Z VS $ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ // declarations // ============================================================================ // ---------------------------------------------------------------------------- // headers // ---------------------------------------------------------------------------- // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE && !defined(__SMARTPHONE__) #include "wx/toolbar.h" #ifndef WX_PRECOMP #include "wx/msw/wrapcctl.h" // include <commctrl.h> "properly" #include "wx/dynarray.h" #include "wx/frame.h" #include "wx/log.h" #include "wx/intl.h" #include "wx/settings.h" #include "wx/bitmap.h" #include "wx/dcmemory.h" #include "wx/control.h" #include "wx/app.h" // for GetComCtl32Version #include "wx/image.h" #endif #include "wx/sysopt.h" #include "wx/msw/private.h" #if wxUSE_UXTHEME #include "wx/msw/uxtheme.h" #endif // this define controls whether the code for button colours remapping (only // useful for 16 or 256 colour images) is active at all, it's always turned off // for CE where it doesn't compile (and is probably not needed anyhow) and may // also be turned off for other systems if you always use 24bpp images and so // never need it #ifndef __WXWINCE__ #define wxREMAP_BUTTON_COLOURS #endif // !__WXWINCE__ // ---------------------------------------------------------------------------- // constants // ---------------------------------------------------------------------------- // these standard constants are not always defined in compilers headers // Styles #ifndef TBSTYLE_FLAT #define TBSTYLE_LIST 0x1000 #define TBSTYLE_FLAT 0x0800 #endif #ifndef TBSTYLE_TRANSPARENT #define TBSTYLE_TRANSPARENT 0x8000 #endif #ifndef TBSTYLE_TOOLTIPS #define TBSTYLE_TOOLTIPS 0x0100 #endif // Messages #ifndef TB_GETSTYLE #define TB_SETSTYLE (WM_USER + 56) #define TB_GETSTYLE (WM_USER + 57) #endif #ifndef TB_HITTEST #define TB_HITTEST (WM_USER + 69) #endif #ifndef TB_GETMAXSIZE #define TB_GETMAXSIZE (WM_USER + 83) #endif // these values correspond to those used by comctl32.dll #define DEFAULTBITMAPX 16 #define DEFAULTBITMAPY 15 // ---------------------------------------------------------------------------- // wxWin macros // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) /* TOOLBAR PROPERTIES tool bitmap bitmap2 tooltip longhelp radio (bool) toggle (bool) separator style ( wxNO_BORDER | wxTB_HORIZONTAL) bitmapsize margins packing separation dontattachtoframe */ BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase) EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent) EVT_SYS_COLOUR_CHANGED(wxToolBar::OnSysColourChanged) EVT_ERASE_BACKGROUND(wxToolBar::OnEraseBackground) END_EVENT_TABLE() // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- class wxToolBarTool : public wxToolBarToolBase { public: wxToolBarTool(wxToolBar *tbar, int id, const wxString& label, const wxBitmap& bmpNormal, const wxBitmap& bmpDisabled, wxItemKind kind, wxObject *clientData, const wxString& shortHelp, const wxString& longHelp) : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind, clientData, shortHelp, longHelp) { m_nSepCount = 0; } wxToolBarTool(wxToolBar *tbar, wxControl *control) : wxToolBarToolBase(tbar, control) { m_nSepCount = 1; } virtual void SetLabel(const wxString& label) { if ( label == m_label ) return; wxToolBarToolBase::SetLabel(label); // we need to update the label shown in the toolbar because it has a // pointer to the internal buffer of the old label // // TODO: use TB_SETBUTTONINFO } // set/get the number of separators which we use to cover the space used by // a control in the toolbar void SetSeparatorsCount(size_t count) { m_nSepCount = count; } size_t GetSeparatorsCount() const { return m_nSepCount; } private: size_t m_nSepCount; DECLARE_NO_COPY_CLASS(wxToolBarTool) }; // ============================================================================ // implementation // ============================================================================ // ---------------------------------------------------------------------------- // wxToolBarTool // ---------------------------------------------------------------------------- wxToolBarToolBase *wxToolBar::CreateTool(int id, const wxString& label, const wxBitmap& bmpNormal, const wxBitmap& bmpDisabled, wxItemKind kind, wxObject *clientData, const wxString& shortHelp, const wxString& longHelp) { return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind, clientData, shortHelp, longHelp); } wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control) { return new wxToolBarTool(this, control); } // ---------------------------------------------------------------------------- // wxToolBar construction // ---------------------------------------------------------------------------- void wxToolBar::Init() { m_hBitmap = 0; m_disabledImgList = NULL; m_nButtons = 0; m_defaultWidth = DEFAULTBITMAPX; m_defaultHeight = DEFAULTBITMAPY; m_pInTool = 0; } bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { // common initialisation if ( !CreateControl(parent, id, pos, size, style, wxDefaultValidator, name) ) return false; FixupStyle(); // MSW-specific initialisation if ( !MSWCreateToolbar(pos, size) ) return false; wxSetCCUnicodeFormat(GetHwnd()); // workaround for flat toolbar on Windows XP classic style: we have to set // the style after creating the control; doing it at creation time doesn't work #if wxUSE_UXTHEME if ( style & wxTB_FLAT ) { LRESULT style = GetMSWToolbarStyle(); if ( !(style & TBSTYLE_FLAT) ) ::SendMessage(GetHwnd(), TB_SETSTYLE, 0, style | TBSTYLE_FLAT); } #endif // wxUSE_UXTHEME return true; } bool wxToolBar::MSWCreateToolbar(const wxPoint& pos, const wxSize& size) { if ( !MSWCreateControl(TOOLBARCLASSNAME, wxEmptyString, pos, size) ) return false; // toolbar-specific post initialisation ::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); // Fix a bug on e.g. the Silver theme on WinXP where control backgrounds // are incorrectly drawn, by forcing the background to a specific colour. int majorVersion, minorVersion; wxGetOsVersion(& majorVersion, & minorVersion); if (majorVersion < 6) SetBackgroundColour(GetBackgroundColour()); return true; } void wxToolBar::Recreate() { const HWND hwndOld = GetHwnd(); if ( !hwndOld ) { // we haven't been created yet, no need to recreate return; } // get the position and size before unsubclassing the old toolbar const wxPoint pos = GetPosition(); const wxSize size = GetSize(); UnsubclassWin(); if ( !MSWCreateToolbar(pos, size) ) { // what can we do? wxFAIL_MSG( _T("recreating the toolbar failed") ); return; } // reparent all our children under the new toolbar for ( wxWindowList::compatibility_iterator node = m_children.GetFirst(); node; node = node->GetNext() ) { wxWindow *win = node->GetData(); if ( !win->IsTopLevel() ) ::SetParent(GetHwndOf(win), GetHwnd()); } // only destroy the old toolbar now -- // after all the children had been reparented ::DestroyWindow(hwndOld); // it is for the old bitmap control and can't be used with the new one if ( m_hBitmap ) { ::DeleteObject((HBITMAP) m_hBitmap); m_hBitmap = 0; } if ( m_disabledImgList ) { delete m_disabledImgList; m_disabledImgList = NULL; } Realize(); } wxToolBar::~wxToolBar() { // we must refresh the frame size when the toolbar is deleted but the frame // is not - otherwise toolbar leaves a hole in the place it used to occupy wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); if ( frame && !frame->IsBeingDeleted() ) frame->SendSizeEvent(); if ( m_hBitmap ) ::DeleteObject((HBITMAP) m_hBitmap); delete m_disabledImgList; } wxSize wxToolBar::DoGetBestSize() const { wxSize sizeBest; SIZE size; if ( !::SendMessage(GetHwnd(), TB_GETMAXSIZE, 0, (LPARAM)&size) ) { // maybe an old (< 0x400) Windows version? try to approximate the // toolbar size ourselves sizeBest = GetToolSize(); sizeBest.y += 2 * ::GetSystemMetrics(SM_CYBORDER); // Add borders sizeBest.x *= GetToolsCount(); // reverse horz and vertical components if necessary if ( IsVertical() ) { int t = sizeBest.x; sizeBest.x = sizeBest.y; sizeBest.y = t; } } else // TB_GETMAXSIZE succeeded { // but it could still return an incorrect result due to what appears to // be a bug in old comctl32.dll versions which don't handle controls in // the toolbar correctly, so work around it (see SF patch 1902358) if ( !IsVertical() && wxApp::GetComCtl32Version() < 600 ) { // calculate the toolbar width in alternative way RECT rcFirst, rcLast; if ( ::SendMessage(GetHwnd(), TB_GETITEMRECT, 0, (LPARAM)&rcFirst) && ::SendMessage(GetHwnd(), TB_GETITEMRECT, GetToolsCount() - 1, (LPARAM)&rcLast) ) { const int widthAlt = rcLast.right - rcFirst.left; if ( widthAlt > size.cx ) size.cx = widthAlt; } } sizeBest.x = size.cx; sizeBest.y = size.cy; } if (!IsVertical()) { // Without the extra height, DoGetBestSize can report a size that's // smaller than the actual window, causing windows to overlap slightly // in some circumstances, leading to missing borders (especially noticeable // in AUI layouts). if (!(GetWindowStyle() & wxTB_NODIVIDER)) sizeBest.y += 2; sizeBest.y ++; } CacheBestSize(sizeBest); return sizeBest; } WXDWORD wxToolBar::MSWGetStyle(long style, WXDWORD *exstyle) const { // toolbars never have border, giving one to them results in broken // appearance WXDWORD msStyle = wxControl::MSWGetStyle ( (style & ~wxBORDER_MASK) | wxBORDER_NONE, exstyle ); if ( !(style & wxTB_NO_TOOLTIPS) ) msStyle |= TBSTYLE_TOOLTIPS; if ( style & (wxTB_FLAT | wxTB_HORZ_LAYOUT) ) { // static as it doesn't change during the program lifetime static const int s_verComCtl = wxApp::GetComCtl32Version(); // comctl32.dll 4.00 doesn't support the flat toolbars and using this // style with 6.00 (part of Windows XP) leads to the toolbar with // incorrect background colour - and not using it still results in the // correct (flat) toolbar, so don't use it there if ( s_verComCtl > 400 && s_verComCtl < 600 ) msStyle |= TBSTYLE_FLAT | TBSTYLE_TRANSPARENT; if ( s_verComCtl >= 470 && style & wxTB_HORZ_LAYOUT ) msStyle |= TBSTYLE_LIST; } if ( style & wxTB_NODIVIDER ) msStyle |= CCS_NODIVIDER; if ( style & wxTB_NOALIGN ) msStyle |= CCS_NOPARENTALIGN; if ( style & wxTB_VERTICAL ) msStyle |= CCS_VERT; if( style & wxTB_BOTTOM ) msStyle |= CCS_BOTTOM; if ( style & wxTB_RIGHT ) msStyle |= CCS_RIGHT; return msStyle; } // ---------------------------------------------------------------------------- // adding/removing tools // ---------------------------------------------------------------------------- bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos), wxToolBarToolBase *tool) { // nothing special to do here - we really create the toolbar buttons in // Realize() later tool->Attach(this); InvalidateBestSize(); return true; } bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool) { // the main difficulty we have here is with the controls in the toolbars: // as we (sometimes) use several separators to cover up the space used by // them, the indices are not the same for us and the toolbar // first determine the position of the first button to delete: it may be // different from pos if we use several separators to cover the space used // by a control wxToolBarToolsList::compatibility_iterator node; for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarToolBase *tool2 = node->GetData(); if ( tool2 == tool ) { // let node point to the next node in the list node = node->GetNext(); break; } if ( tool2->IsControl() ) pos += ((wxToolBarTool *)tool2)->GetSeparatorsCount() - 1; } // now determine the number of buttons to delete and the area taken by them size_t nButtonsToDelete = 1; // get the size of the button we're going to delete RECT r; if ( !::SendMessage(GetHwnd(), TB_GETITEMRECT, pos, (LPARAM)&r) ) { wxLogLastError(_T("TB_GETITEMRECT")); } int width = r.right - r.left; if ( tool->IsControl() ) { nButtonsToDelete = ((wxToolBarTool *)tool)->GetSeparatorsCount(); width *= nButtonsToDelete; tool->GetControl()->Destroy(); } // do delete all buttons m_nButtons -= nButtonsToDelete; while ( nButtonsToDelete-- > 0 ) { if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, pos, 0) ) { wxLogLastError(wxT("TB_DELETEBUTTON")); return false; } } tool->Detach(); // and finally reposition all the controls after this button (the toolbar // takes care of all normal items) for ( /* node -> first after deleted */ ; node; node = node->GetNext() ) { wxToolBarToolBase *tool2 = node->GetData(); if ( tool2->IsControl() ) { int x; wxControl *control = tool2->GetControl(); control->GetPosition(&x, NULL); control->Move(x - width, wxDefaultCoord); } } InvalidateBestSize(); return true; } void wxToolBar::CreateDisabledImageList() { if (m_disabledImgList != NULL) { delete m_disabledImgList; m_disabledImgList = NULL; } // as we can't use disabled image list with older versions of comctl32.dll, // don't even bother creating it if ( wxApp::GetComCtl32Version() >= 470 ) { // search for the first disabled button img in the toolbar, if any for ( wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarToolBase *tool = node->GetData(); wxBitmap bmpDisabled = tool->GetDisabledBitmap(); if ( bmpDisabled.Ok() ) { m_disabledImgList = new wxImageList ( m_defaultWidth, m_defaultHeight, bmpDisabled.GetMask() != NULL, GetToolsCount() ); break; } } // we don't have any disabled bitmaps } } void wxToolBar::AdjustToolBitmapSize() { wxSize s(m_defaultWidth, m_defaultHeight); const wxSize orig_s(s); for ( wxToolBarToolsList::const_iterator i = m_tools.begin(); i != m_tools.end(); ++i ) { const wxBitmap& bmp = (*i)->GetNormalBitmap(); s.IncTo(wxSize(bmp.GetWidth(), bmp.GetHeight())); } if ( s != orig_s ) SetToolBitmapSize(s); } bool wxToolBar::Realize() { const size_t nTools = GetToolsCount(); if ( nTools == 0 ) // nothing to do return true; // make sure tool size is larger enough for all all bitmaps to fit in // (this is consistent with what other ports do): AdjustToolBitmapSize(); #ifdef wxREMAP_BUTTON_COLOURS // don't change the values of these constants, they can be set from the // user code via wxSystemOptions enum { Remap_None = -1, Remap_Bg, Remap_Buttons, Remap_TransparentBg }; // the user-specified option overrides anything, but if it wasn't set, only // remap the buttons on 8bpp displays as otherwise the bitmaps usually look // much worse after remapping static const wxChar *remapOption = wxT("msw.remap"); const int remapValue = wxSystemOptions::HasOption(remapOption) ? wxSystemOptions::GetOptionInt(remapOption) : wxDisplayDepth() <= 8 ? Remap_Buttons : Remap_None; #endif // wxREMAP_BUTTON_COLOURS // delete all old buttons, if any for ( size_t pos = 0; pos < m_nButtons; pos++ ) { if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, 0, 0) ) { wxLogDebug(wxT("TB_DELETEBUTTON failed")); } } // First, add the bitmap: we use one bitmap for all toolbar buttons // ---------------------------------------------------------------- wxToolBarToolsList::compatibility_iterator node; int bitmapId = 0; wxSize sizeBmp; if ( HasFlag(wxTB_NOICONS) ) { // no icons, don't leave space for them sizeBmp.x = sizeBmp.y = 0; } else // do show icons { // if we already have a bitmap, we'll replace the existing one -- // otherwise we'll install a new one HBITMAP oldToolBarBitmap = (HBITMAP)m_hBitmap; sizeBmp.x = m_defaultWidth; sizeBmp.y = m_defaultHeight; const wxCoord totalBitmapWidth = m_defaultWidth * wx_truncate_cast(wxCoord, nTools), totalBitmapHeight = m_defaultHeight; // Create a bitmap and copy all the tool bitmaps into it wxMemoryDC dcAllButtons; wxBitmap bitmap(totalBitmapWidth, totalBitmapHeight); dcAllButtons.SelectObject(bitmap); #ifdef wxREMAP_BUTTON_COLOURS if ( remapValue != Remap_TransparentBg ) #endif // wxREMAP_BUTTON_COLOURS { // VZ: why do we hardcode grey colour for CE? dcAllButtons.SetBackground(wxBrush( #ifdef __WXWINCE__ wxColour(0xc0, 0xc0, 0xc0) #else // !__WXWINCE__ GetBackgroundColour() #endif // __WXWINCE__/!__WXWINCE__ )); dcAllButtons.Clear(); } m_hBitmap = bitmap.GetHBITMAP(); HBITMAP hBitmap = (HBITMAP)m_hBitmap; #ifdef wxREMAP_BUTTON_COLOURS if ( remapValue == Remap_Bg ) { dcAllButtons.SelectObject(wxNullBitmap); // Even if we're not remapping the bitmap // content, we still have to remap the background. hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap, totalBitmapWidth, totalBitmapHeight); dcAllButtons.SelectObject(bitmap); } #endif // wxREMAP_BUTTON_COLOURS // the button position wxCoord x = 0; // the number of buttons (not separators) int nButtons = 0; CreateDisabledImageList(); for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarToolBase *tool = node->GetData(); if ( tool->IsButton() ) { const wxBitmap& bmp = tool->GetNormalBitmap(); const int w = bmp.GetWidth(); const int h = bmp.GetHeight(); if ( bmp.Ok() ) { int xOffset = wxMax(0, (m_defaultWidth - w)/2); int yOffset = wxMax(0, (m_defaultHeight - h)/2); // notice the last parameter: do use mask dcAllButtons.DrawBitmap(bmp, x + xOffset, yOffset, true); } else { wxFAIL_MSG( _T("invalid tool button bitmap") ); } // also deal with disabled bitmap if we want to use them if ( m_disabledImgList ) { wxBitmap bmpDisabled = tool->GetDisabledBitmap(); #if wxUSE_IMAGE && wxUSE_WXDIB if ( !bmpDisabled.Ok() ) { // no disabled bitmap specified but we still need to // fill the space in the image list with something, so // we grey out the normal bitmap wxImage imgGreyed; wxCreateGreyedImage(bmp.ConvertToImage(), imgGreyed); #ifdef wxREMAP_BUTTON_COLOURS if ( remapValue == Remap_Buttons ) { // we need to have light grey background colour for // MapBitmap() to work correctly for ( int y = 0; y < h; y++ ) { for ( int x = 0; x < w; x++ ) { if ( imgGreyed.IsTransparent(x, y) ) imgGreyed.SetRGB(x, y, wxLIGHT_GREY->Red(), wxLIGHT_GREY->Green(), wxLIGHT_GREY->Blue()); } } } #endif // wxREMAP_BUTTON_COLOURS bmpDisabled = wxBitmap(imgGreyed); } #endif // wxUSE_IMAGE #ifdef wxREMAP_BUTTON_COLOURS if ( remapValue == Remap_Buttons ) MapBitmap(bmpDisabled.GetHBITMAP(), w, h); #endif // wxREMAP_BUTTON_COLOURS m_disabledImgList->Add(bmpDisabled); } // still inc width and number of buttons because otherwise the // subsequent buttons will all be shifted which is rather confusing // (and like this you'd see immediately which bitmap was bad) x += m_defaultWidth; nButtons++; } } dcAllButtons.SelectObject(wxNullBitmap); // don't delete this HBITMAP! bitmap.SetHBITMAP(0); #ifdef wxREMAP_BUTTON_COLOURS if ( remapValue == Remap_Buttons ) { // Map to system colours hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap, totalBitmapWidth, totalBitmapHeight); } #endif // wxREMAP_BUTTON_COLOURS bool addBitmap = true; if ( oldToolBarBitmap ) { #ifdef TB_REPLACEBITMAP if ( wxApp::GetComCtl32Version() >= 400 ) { TBREPLACEBITMAP replaceBitmap; replaceBitmap.hInstOld = NULL; replaceBitmap.hInstNew = NULL; replaceBitmap.nIDOld = (UINT) oldToolBarBitmap; replaceBitmap.nIDNew = (UINT) hBitmap; replaceBitmap.nButtons = nButtons; if ( !::SendMessage(GetHwnd(), TB_REPLACEBITMAP, 0, (LPARAM) &replaceBitmap) ) { wxFAIL_MSG(wxT("Could not replace the old bitmap")); } ::DeleteObject(oldToolBarBitmap); // already done addBitmap = false; } else #endif // TB_REPLACEBITMAP { // we can't replace the old bitmap, so we will add another one // (awfully inefficient, but what else to do?) and shift the bitmap // indices accordingly addBitmap = true; bitmapId = m_nButtons; } } if ( addBitmap ) // no old bitmap or we can't replace it { TBADDBITMAP addBitmap; addBitmap.hInst = 0; addBitmap.nID = (UINT) hBitmap; if ( ::SendMessage(GetHwnd(), TB_ADDBITMAP, (WPARAM) nButtons, (LPARAM)&addBitmap) == -1 ) { wxFAIL_MSG(wxT("Could not add bitmap to toolbar")); } } // disable image lists are only supported in comctl32.dll 4.70+ if ( wxApp::GetComCtl32Version() >= 470 ) { HIMAGELIST hil = m_disabledImgList ? GetHimagelistOf(m_disabledImgList) : 0; // notice that we set the image list even if don't have one right // now as we could have it before and need to reset it in this case HIMAGELIST oldImageList = (HIMAGELIST) ::SendMessage(GetHwnd(), TB_SETDISABLEDIMAGELIST, 0, (LPARAM)hil); // delete previous image list if any if ( oldImageList ) ::DeleteObject(oldImageList); } } // don't call SetToolBitmapSize() as we don't want to change the values of // m_defaultWidth/Height if ( !::SendMessage(GetHwnd(), TB_SETBITMAPSIZE, 0, MAKELONG(sizeBmp.x, sizeBmp.y)) ) { wxLogLastError(_T("TB_SETBITMAPSIZE")); } // Next add the buttons and separators // ----------------------------------- TBBUTTON *buttons = new TBBUTTON[nTools]; // this array will hold the indices of all controls in the toolbar wxArrayInt controlIds; bool lastWasRadio = false; int i = 0; for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarToolBase *tool = node->GetData(); // don't add separators to the vertical toolbar with old comctl32.dll // versions as they didn't handle this properly if ( IsVertical() && tool->IsSeparator() && wxApp::GetComCtl32Version() <= 472 ) { continue; } TBBUTTON& button = buttons[i]; wxZeroMemory(button); bool isRadio = false; switch ( tool->GetStyle() ) { case wxTOOL_STYLE_CONTROL: button.idCommand = tool->GetId(); // fall through: create just a separator too case wxTOOL_STYLE_SEPARATOR: button.fsState = TBSTATE_ENABLED; button.fsStyle = TBSTYLE_SEP; break; case wxTOOL_STYLE_BUTTON: if ( !HasFlag(wxTB_NOICONS) ) button.iBitmap = bitmapId; if ( HasFlag(wxTB_TEXT) ) { const wxString& label = tool->GetLabel(); if ( !label.empty() ) button.iString = (int)label.c_str(); } button.idCommand = tool->GetId(); if ( tool->IsEnabled() ) button.fsState |= TBSTATE_ENABLED; if ( tool->IsToggled() ) button.fsState |= TBSTATE_CHECKED; switch ( tool->GetKind() ) { case wxITEM_RADIO: button.fsStyle = TBSTYLE_CHECKGROUP; if ( !lastWasRadio ) { // the first item in the radio group is checked by // default to be consistent with wxGTK and the menu // radio items button.fsState |= TBSTATE_CHECKED; if (tool->Toggle(true)) { DoToggleTool(tool, true); } } else if ( tool->IsToggled() ) { wxToolBarToolsList::compatibility_iterator nodePrev = node->GetPrevious(); int prevIndex = i - 1; while ( nodePrev ) { TBBUTTON& prevButton = buttons[prevIndex]; wxToolBarToolBase *tool = nodePrev->GetData(); if ( !tool->IsButton() || tool->GetKind() != wxITEM_RADIO ) break; if ( tool->Toggle(false) ) DoToggleTool(tool, false); prevButton.fsState &= ~TBSTATE_CHECKED; nodePrev = nodePrev->GetPrevious(); prevIndex--; } } isRadio = true; break; case wxITEM_CHECK: button.fsStyle = TBSTYLE_CHECK; break; case wxITEM_NORMAL: button.fsStyle = TBSTYLE_BUTTON; break; default: wxFAIL_MSG( _T("unexpected toolbar button kind") ); button.fsStyle = TBSTYLE_BUTTON; break; } bitmapId++; break; } lastWasRadio = isRadio; i++; } if ( !::SendMessage(GetHwnd(), TB_ADDBUTTONS, (WPARAM)i, (LPARAM)buttons) ) { wxLogLastError(wxT("TB_ADDBUTTONS")); } delete [] buttons; // Deal with the controls finally // ------------------------------ // adjust the controls size to fit nicely in the toolbar int y = 0; size_t index = 0; for ( node = m_tools.GetFirst(); node; node = node->GetNext(), index++ ) { wxToolBarToolBase *tool = node->GetData(); // we calculate the running y coord for vertical toolbars so we need to // get the items size for all items but for the horizontal ones we // don't need to deal with the non controls bool isControl = tool->IsControl(); if ( !isControl && !IsVertical() ) continue; // note that we use TB_GETITEMRECT and not TB_GETRECT because the // latter only appeared in v4.70 of comctl32.dll RECT r; if ( !::SendMessage(GetHwnd(), TB_GETITEMRECT, index, (LPARAM)(LPRECT)&r) ) { wxLogLastError(wxT("TB_GETITEMRECT")); } if ( !isControl ) { // can only be control if isVertical y += r.bottom - r.top; continue; } wxControl *control = tool->GetControl(); wxSize size = control->GetSize(); // the position of the leftmost controls corner int left = wxDefaultCoord; // TB_SETBUTTONINFO message is only supported by comctl32.dll 4.71+ #ifdef TB_SETBUTTONINFO // available in headers, now check whether it is available now // (during run-time) if ( wxApp::GetComCtl32Version() >= 471 ) { // set the (underlying) separators width to be that of the // control TBBUTTONINFO tbbi; tbbi.cbSize = sizeof(tbbi); tbbi.dwMask = TBIF_SIZE; tbbi.cx = (WORD)size.x; if ( !::SendMessage(GetHwnd(), TB_SETBUTTONINFO, tool->GetId(), (LPARAM)&tbbi) ) { // the id is probably invalid? wxLogLastError(wxT("TB_SETBUTTONINFO")); } } else #endif // comctl32.dll 4.71 // TB_SETBUTTONINFO unavailable { // try adding several separators to fit the controls width int widthSep = r.right - r.left; left = r.left; TBBUTTON tbb; wxZeroMemory(tbb); tbb.idCommand = 0; tbb.fsState = TBSTATE_ENABLED; tbb.fsStyle = TBSTYLE_SEP; size_t nSeparators = size.x / widthSep; for ( size_t nSep = 0; nSep < nSeparators; nSep++ ) { if ( !::SendMessage(GetHwnd(), TB_INSERTBUTTON, index, (LPARAM)&tbb) ) { wxLogLastError(wxT("TB_INSERTBUTTON")); } index++; } // remember the number of separators we used - we'd have to // delete all of them later ((wxToolBarTool *)tool)->SetSeparatorsCount(nSeparators); // adjust the controls width to exactly cover the separators control->SetSize((nSeparators + 1)*widthSep, wxDefaultCoord); } // position the control itself correctly vertically int height = r.bottom - r.top; int diff = height - size.y; if ( diff < 0 ) { // the control is too high, resize to fit control->SetSize(wxDefaultCoord, height - 2); diff = 2; } int top; if ( IsVertical() ) { left = 0; top = y; y += height + 2 * GetMargins().y; } else // horizontal toolbar { if ( left == wxDefaultCoord ) left = r.left; top = r.top; } control->Move(left, top + (diff + 1) / 2); } // the max index is the "real" number of buttons - i.e. counting even the // separators which we added just for aligning the controls m_nButtons = index; if ( !IsVertical() ) { if ( m_maxRows == 0 ) // if not set yet, only one row SetRows(1); } else if ( m_nButtons > 0 ) // vertical non empty toolbar { // if not set yet, have one column m_maxRows = 1; SetRows(m_nButtons); } InvalidateBestSize(); UpdateSize(); return true; } // ---------------------------------------------------------------------------- // message handlers // ---------------------------------------------------------------------------- bool wxToolBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id) { wxToolBarToolBase *tool = FindById((int)id); if ( !tool ) return false; bool toggled = false; // just to suppress warnings LRESULT state = ::SendMessage(GetHwnd(), TB_GETSTATE, id, 0); if ( tool->CanBeToggled() ) { toggled = (state & TBSTATE_CHECKED) != 0; // ignore the event when a radio button is released, as this doesn't // seem to happen at all, and is handled otherwise if ( tool->GetKind() == wxITEM_RADIO && !toggled ) return true; tool->Toggle(toggled); UnToggleRadioGroup(tool); } // Without the two lines of code below, if the toolbar was repainted during // OnLeftClick(), then it could end up without the tool bitmap temporarily // (see http://lists.nongnu.org/archive/html/lmi/2008-10/msg00014.html). // The Update() call bellow ensures that this won't happen, by repainting // invalidated areas of the toolbar immediately. // // To complicate matters, the tool would be drawn in depressed state (this // code is called when mouse button is released, not pressed). That's not // ideal, having the tool pressed for the duration of OnLeftClick() // provides the user with useful visual clue that the app is busy reacting // to the event. So we manually put the tool into pressed state, handle the // event and then finally restore tool's original state. ::SendMessage(GetHwnd(), TB_SETSTATE, id, MAKELONG(state | TBSTATE_PRESSED, 0)); Update(); bool allowLeftClick = OnLeftClick((int)id, toggled); // Restore the unpressed state. Enabled/toggled state might have been // changed since so take care of it. if (tool->IsEnabled()) state |= TBSTATE_ENABLED; else state &= ~TBSTATE_ENABLED; if (tool->IsToggled()) state |= TBSTATE_CHECKED; else state &= ~TBSTATE_CHECKED; ::SendMessage(GetHwnd(), TB_SETSTATE, id, MAKELONG(state, 0)); // OnLeftClick() can veto the button state change - for buttons which // may be toggled only, of couse if ( !allowLeftClick && tool->CanBeToggled() ) { // revert back tool->Toggle(!toggled); ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(!toggled, 0)); } return true; } bool wxToolBar::MSWOnNotify(int WXUNUSED(idCtrl), WXLPARAM lParam, WXLPARAM *WXUNUSED(result)) { if( !HasFlag(wxTB_NO_TOOLTIPS) ) { #if wxUSE_TOOLTIPS // First check if this applies to us NMHDR *hdr = (NMHDR *)lParam; // the tooltips control created by the toolbar is sometimes Unicode, even // in an ANSI application - this seems to be a bug in comctl32.dll v5 UINT code = hdr->code; if ( (code != (UINT) TTN_NEEDTEXTA) && (code != (UINT) TTN_NEEDTEXTW) ) return false; HWND toolTipWnd = (HWND)::SendMessage(GetHwnd(), TB_GETTOOLTIPS, 0, 0); if ( toolTipWnd != hdr->hwndFrom ) return false; LPTOOLTIPTEXT ttText = (LPTOOLTIPTEXT)lParam; int id = (int)ttText->hdr.idFrom; wxToolBarToolBase *tool = FindById(id); if ( tool ) return HandleTooltipNotify(code, lParam, tool->GetShortHelp()); #else wxUnusedVar(lParam); #endif } return false; } // ---------------------------------------------------------------------------- // toolbar geometry // ---------------------------------------------------------------------------- void wxToolBar::SetToolBitmapSize(const wxSize& size) { wxToolBarBase::SetToolBitmapSize(size); ::SendMessage(GetHwnd(), TB_SETBITMAPSIZE, 0, MAKELONG(size.x, size.y)); } void wxToolBar::SetRows(int nRows) { if ( nRows == m_maxRows ) { // avoid resizing the frame uselessly return; } // TRUE in wParam means to create at least as many rows, FALSE - // at most as many RECT rect; ::SendMessage(GetHwnd(), TB_SETROWS, MAKEWPARAM(nRows, !(GetWindowStyle() & wxTB_VERTICAL)), (LPARAM) &rect); m_maxRows = nRows; UpdateSize(); } // The button size is bigger than the bitmap size wxSize wxToolBar::GetToolSize() const { // TB_GETBUTTONSIZE is supported from version 4.70 #if defined(_WIN32_IE) && (_WIN32_IE >= 0x300 ) \ && !( defined(__GNUWIN32__) && !wxCHECK_W32API_VERSION( 1, 0 ) ) \ && !defined (__DIGITALMARS__) if ( wxApp::GetComCtl32Version() >= 470 ) { DWORD dw = ::SendMessage(GetHwnd(), TB_GETBUTTONSIZE, 0, 0); return wxSize(LOWORD(dw), HIWORD(dw)); } else #endif // comctl32.dll 4.70+ { // defaults return wxSize(m_defaultWidth + 8, m_defaultHeight + 7); } } static wxToolBarToolBase *GetItemSkippingDummySpacers(const wxToolBarToolsList& tools, size_t index ) { wxToolBarToolsList::compatibility_iterator current = tools.GetFirst(); for ( ; current ; current = current->GetNext() ) { if ( index == 0 ) return current->GetData(); wxToolBarTool *tool = (wxToolBarTool *)current->GetData(); size_t separators = tool->GetSeparatorsCount(); // if it is a normal button, sepcount == 0, so skip 1 item (the button) // otherwise, skip as many items as the separator count, plus the // control itself index -= separators ? separators + 1 : 1; } return 0; } wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const { POINT pt; pt.x = x; pt.y = y; int index = (int)::SendMessage(GetHwnd(), TB_HITTEST, 0, (LPARAM)&pt); // MBN: when the point ( x, y ) is close to the toolbar border // TB_HITTEST returns m_nButtons ( not -1 ) if ( index < 0 || (size_t)index >= m_nButtons ) // it's a separator or there is no tool at all there return (wxToolBarToolBase *)NULL; // when TB_SETBUTTONINFO is available (both during compile- and run-time), // we don't use the dummy separators hack #ifdef TB_SETBUTTONINFO if ( wxApp::GetComCtl32Version() >= 471 ) { return m_tools.Item((size_t)index)->GetData(); } else #endif // TB_SETBUTTONINFO { return GetItemSkippingDummySpacers( m_tools, (size_t) index ); } } void wxToolBar::UpdateSize() { wxPoint pos = GetPosition(); ::SendMessage(GetHwnd(), TB_AUTOSIZE, 0, 0); if (pos != GetPosition()) Move(pos); // In case Realize is called after the initial display (IOW the programmer // may have rebuilt the toolbar) give the frame the option of resizing the // toolbar to full width again, but only if the parent is a frame and the // toolbar is managed by the frame. Otherwise assume that some other // layout mechanism is controlling the toolbar size and leave it alone. wxFrame *frame = wxDynamicCast(GetParent(), wxFrame); if ( frame && frame->GetToolBar() == this ) { frame->SendSizeEvent(); } } // ---------------------------------------------------------------------------- // toolbar styles // --------------------------------------------------------------------------- // get the TBSTYLE of the given toolbar window long wxToolBar::GetMSWToolbarStyle() const { return ::SendMessage(GetHwnd(), TB_GETSTYLE, 0, 0L); } void wxToolBar::SetWindowStyleFlag(long style) { // the style bits whose changes force us to recreate the toolbar static const long MASK_NEEDS_RECREATE = wxTB_TEXT | wxTB_NOICONS; const long styleOld = GetWindowStyle(); wxToolBarBase::SetWindowStyleFlag(style); // don't recreate an empty toolbar: not only this is unnecessary, but it is // also fatal as we'd then try to recreate the toolbar when it's just being // created if ( GetToolsCount() && (style & MASK_NEEDS_RECREATE) != (styleOld & MASK_NEEDS_RECREATE) ) { // to remove the text labels, simply re-realizing the toolbar is enough // but I don't know of any way to add the text to an existing toolbar // other than by recreating it entirely Recreate(); } } // ---------------------------------------------------------------------------- // tool state // ---------------------------------------------------------------------------- void wxToolBar::DoEnableTool(wxToolBarToolBase *tool, bool enable) { ::SendMessage(GetHwnd(), TB_ENABLEBUTTON, (WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0)); } void wxToolBar::DoToggleTool(wxToolBarToolBase *tool, bool toggle) { ::SendMessage(GetHwnd(), TB_CHECKBUTTON, (WPARAM)tool->GetId(), (LPARAM)MAKELONG(toggle, 0)); } void wxToolBar::DoSetToggle(wxToolBarToolBase *WXUNUSED(tool), bool WXUNUSED(toggle)) { // VZ: AFAIK, the button has to be created either with TBSTYLE_CHECK or // without, so we really need to delete the button and recreate it here wxFAIL_MSG( _T("not implemented") ); } void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap ) { wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id)); if ( tool ) { wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); tool->SetNormalBitmap(bitmap); Realize(); } } void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap ) { wxToolBarTool* tool = wx_static_cast(wxToolBarTool*, FindById(id)); if ( tool ) { wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools.")); tool->SetDisabledBitmap(bitmap); Realize(); } } // ---------------------------------------------------------------------------- // event handlers // ---------------------------------------------------------------------------- // Responds to colour changes, and passes event on to children. void wxToolBar::OnSysColourChanged(wxSysColourChangedEvent& event) { wxRGBToColour(m_backgroundColour, ::GetSysColor(COLOR_BTNFACE)); // Remap the buttons Realize(); // Relayout the toolbar int nrows = m_maxRows; m_maxRows = 0; // otherwise SetRows() wouldn't do anything SetRows(nrows); Refresh(); // let the event propagate further event.Skip(); } void wxToolBar::OnMouseEvent(wxMouseEvent& event) { if (event.Leaving() && m_pInTool) { OnMouseEnter( -1 ); event.Skip(); return; } if ( event.RightDown() ) { // find the tool under the mouse wxCoord x = 0, y = 0; event.GetPosition(&x, &y); wxToolBarToolBase *tool = FindToolForPosition(x, y); OnRightClick(tool ? tool->GetId() : -1, x, y); } else { event.Skip(); } } // This handler is required to allow the toolbar to be set to a non-default // colour: for example, when it must blend in with a notebook page. void wxToolBar::OnEraseBackground(wxEraseEvent& event) { RECT rect = wxGetClientRect(GetHwnd()); HDC hdc = GetHdcOf((*event.GetDC())); int majorVersion, minorVersion; wxGetOsVersion(& majorVersion, & minorVersion); #if wxUSE_UXTHEME // we may need to draw themed colour so that we appear correctly on // e.g. notebook page under XP with themes but only do it if the parent // draws themed background itself if ( !UseBgCol() && !GetParent()->UseBgCol() ) { wxUxThemeEngine *theme = wxUxThemeEngine::GetIfActive(); if ( theme ) { HRESULT hr = theme->DrawThemeParentBackground(GetHwnd(), hdc, &rect); if ( hr == S_OK ) return; // it can also return S_FALSE which seems to simply say that it // didn't draw anything but no error really occurred if ( FAILED(hr) ) wxLogApiError(_T("DrawThemeParentBackground(toolbar)"), hr); } } // Only draw a rebar theme on Vista, since it doesn't jive so well with XP if ( !UseBgCol() && majorVersion >= 6 ) { wxUxThemeEngine *theme = wxUxThemeEngine::GetIfActive(); if ( theme ) { wxUxThemeHandle hTheme(this, L"REBAR"); RECT r; wxRect rect = GetClientRect(); wxCopyRectToRECT(rect, r); HRESULT hr = theme->DrawThemeBackground(hTheme, hdc, 0, 0, & r, NULL); if ( hr == S_OK ) return; // it can also return S_FALSE which seems to simply say that it // didn't draw anything but no error really occurred if ( FAILED(hr) ) wxLogApiError(_T("DrawThemeBackground(toolbar)"), hr); } } #endif // wxUSE_UXTHEME if ( UseBgCol() || (GetMSWToolbarStyle() & TBSTYLE_TRANSPARENT) ) { // do draw our background // // notice that this 'dumb' implementation may cause flicker for some of // the controls in which case they should intercept wxEraseEvent and // process it themselves somehow AutoHBRUSH hBrush(wxColourToRGB(GetBackgroundColour())); wxCHANGE_HDC_MAP_MODE(hdc, MM_TEXT); ::FillRect(hdc, &rect, hBrush); } else // we have no non default background colour { // let the system do it for us event.Skip(); } } bool wxToolBar::HandleSize(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam) { // calculate our minor dimension ourselves - we're confusing the standard // logic (TB_AUTOSIZE) with our horizontal toolbars and other hacks RECT r; if ( ::SendMessage(GetHwnd(), TB_GETITEMRECT, 0, (LPARAM)&r) ) { int w, h; if ( IsVertical() ) { w = r.right - r.left; if ( m_maxRows ) { w *= (m_nButtons + m_maxRows - 1)/m_maxRows; } h = HIWORD(lParam); } else { w = LOWORD(lParam); if (HasFlag( wxTB_FLAT )) h = r.bottom - r.top - 3; else h = r.bottom - r.top; if ( m_maxRows ) { // FIXME: hardcoded separator line height... h += HasFlag(wxTB_NODIVIDER) ? 4 : 6; h *= m_maxRows; } } if ( MAKELPARAM(w, h) != lParam ) { // size really changed SetSize(w, h); } // message processed return true; } return false; } bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam) { // erase any dummy separators which were used // for aligning the controls if any here // first of all, are there any controls at all? wxToolBarToolsList::compatibility_iterator node; for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { if ( node->GetData()->IsControl() ) break; } if ( !node ) // no controls, nothing to erase return false; wxSize clientSize = GetClientSize(); int majorVersion, minorVersion; wxGetOsVersion(& majorVersion, & minorVersion); // prepare the DC on which we'll be drawing // prepare the DC on which we'll be drawing wxClientDC dc(this); dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID)); dc.SetPen(*wxTRANSPARENT_PEN); RECT r; if ( !::GetUpdateRect(GetHwnd(), &r, FALSE) ) // nothing to redraw anyhow return false; wxRect rectUpdate; wxCopyRECTToRect(r, rectUpdate); dc.SetClippingRegion(rectUpdate); // draw the toolbar tools, separators &c normally wxControl::MSWWindowProc(WM_PAINT, wParam, lParam); // for each control in the toolbar find all the separators intersecting it // and erase them // // NB: this is really the only way to do it as we don't know if a separator // corresponds to a control (i.e. is a dummy one) or a real one // otherwise for ( node = m_tools.GetFirst(); node; node = node->GetNext() ) { wxToolBarToolBase *tool = node->GetData(); if ( tool->IsControl() ) { // get the control rect in our client coords wxControl *control = tool->GetControl(); wxRect rectCtrl = control->GetRect(); // iterate over all buttons TBBUTTON tbb; int count = ::SendMessage(GetHwnd(), TB_BUTTONCOUNT, 0, 0); for ( int n = 0; n < count; n++ ) { // is it a separator? if ( !::SendMessage(GetHwnd(), TB_GETBUTTON, n, (LPARAM)&tbb) ) { wxLogDebug(_T("TB_GETBUTTON failed?")); continue; } if ( tbb.fsStyle != TBSTYLE_SEP ) continue; // get the bounding rect of the separator RECT r; if ( !::SendMessage(GetHwnd(), TB_GETITEMRECT, n, (LPARAM)&r) ) { wxLogDebug(_T("TB_GETITEMRECT failed?")); continue; } // does it intersect the control? wxRect rectItem; wxCopyRECTToRect(r, rectItem); if ( rectCtrl.Intersects(rectItem) ) { // yes, do erase it! bool haveRefreshed = false; #if wxUSE_UXTHEME if ( !UseBgCol() && !GetParent()->UseBgCol() ) { // Don't use DrawThemeBackground } else if (!UseBgCol() && majorVersion >= 6 ) { wxUxThemeEngine *theme = wxUxThemeEngine::GetIfActive(); if ( theme ) { wxUxThemeHandle hTheme(this, L"REBAR"); RECT clipRect = r; // Draw the whole background since the pattern may be position sensitive; // but clip it to the area of interest. r.left = 0; r.right = clientSize.x; r.top = 0; r.bottom = clientSize.y; HRESULT hr = theme->DrawThemeBackground(hTheme, (HDC) dc.GetHDC(), 0, 0, & r, & clipRect); if ( hr == S_OK ) haveRefreshed = true; } } #endif if (!haveRefreshed) dc.DrawRectangle(rectItem); // Necessary in case we use a no-paint-on-size // style in the parent: the controls can disappear control->Refresh(false); } } } } return true; } void wxToolBar::HandleMouseMove(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam) { wxCoord x = GET_X_LPARAM(lParam), y = GET_Y_LPARAM(lParam); wxToolBarToolBase* tool = FindToolForPosition( x, y ); // cursor left current tool if ( tool != m_pInTool && !tool ) { m_pInTool = 0; OnMouseEnter( -1 ); } // cursor entered a tool if ( tool != m_pInTool && tool ) { m_pInTool = tool; OnMouseEnter( tool->GetId() ); } } WXLRESULT wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { switch ( nMsg ) { case WM_MOUSEMOVE: // we don't handle mouse moves, so always pass the message to // wxControl::MSWWindowProc (HandleMouseMove just calls OnMouseEnter) HandleMouseMove(wParam, lParam); break; case WM_SIZE: if ( HandleSize(wParam, lParam) ) return 0; break; #ifndef __WXWINCE__ case WM_PAINT: if ( HandlePaint(wParam, lParam) ) return 0; #endif default: break; } return wxControl::MSWWindowProc(nMsg, wParam, lParam); } // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- #ifdef wxREMAP_BUTTON_COLOURS WXHBITMAP wxToolBar::MapBitmap(WXHBITMAP bitmap, int width, int height) { MemoryHDC hdcMem; if ( !hdcMem ) { wxLogLastError(_T("CreateCompatibleDC")); return bitmap; } SelectInHDC bmpInHDC(hdcMem, (HBITMAP)bitmap); if ( !bmpInHDC ) { wxLogLastError(_T("SelectObject")); return bitmap; } wxCOLORMAP *cmap = wxGetStdColourMap(); for ( int i = 0; i < width; i++ ) { for ( int j = 0; j < height; j++ ) { COLORREF pixel = ::GetPixel(hdcMem, i, j); for ( size_t k = 0; k < wxSTD_COL_MAX; k++ ) { COLORREF col = cmap[k].from; if ( abs(GetRValue(pixel) - GetRValue(col)) < 10 && abs(GetGValue(pixel) - GetGValue(col)) < 10 && abs(GetBValue(pixel) - GetBValue(col)) < 10 ) { if ( cmap[k].to != pixel ) ::SetPixel(hdcMem, i, j, cmap[k].to); break; } } } } return bitmap; } #endif // wxREMAP_BUTTON_COLOURS #endif // wxUSE_TOOLBAR
radiaku/decoda
libs/wxWidgets/src/msw/tbar95.cpp
C++
gpl-3.0
58,053
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle 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. // // Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Version details * * @package filter * @subpackage activitynames * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX) $plugin->requires = 2021052500; // Requires this Moodle version $plugin->component = 'filter_activitynames'; // Full name of the plugin (used for diagnostics)
enovation/moodle
filter/activitynames/version.php
PHP
gpl-3.0
1,206
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_Json * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Exception.php 18951 2009-11-12 16:26:19Z alexander $ */ /** Zend_Json_Exception */ require_once 'Zend/Json/Exception.php'; /** * Zend_Json_Server exceptions * * @uses Zend_Json_Exception * @package Zend_Json * @subpackage Server * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Json_Server_Exception extends Zend_Json_Exception { }
ivesbai/server
vendor/ZendFramework/library/Zend/Json/Server/Exception.php
PHP
agpl-3.0
1,173
/** Messages for Sinhala (සිංහල) * Exported from translatewiki.net * * Translators: * - Singhalawap */ var I18n = { on_leave_page: "ඔබගේ වෙනස්කිරීම් අහිමිවනු ඇත" };
railsfactory-sriman/knowledgeBase
public/javascripts/i18n/si.js
JavaScript
agpl-3.0
235
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@zend.com so we can send you a copy immediately. * * @category Zend * @package Zend_Validate * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Abstract.php 18951 2009-11-12 16:26:19Z alexander $ */ /** * @see Zend_Validate_Abstract */ require_once 'Zend/Validate/Abstract.php'; /** * Class for Database record validation * * @category Zend * @package Zend_Validate * @uses Zend_Validate_Abstract * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ abstract class Zend_Validate_Db_Abstract extends Zend_Validate_Abstract { /** * Error constants */ const ERROR_NO_RECORD_FOUND = 'noRecordFound'; const ERROR_RECORD_FOUND = 'recordFound'; /** * @var array Message templates */ protected $_messageTemplates = array(self::ERROR_NO_RECORD_FOUND => 'No record matching %value% was found', self::ERROR_RECORD_FOUND => 'A record matching %value% was found'); /** * @var string */ protected $_schema = null; /** * @var string */ protected $_table = ''; /** * @var string */ protected $_field = ''; /** * @var mixed */ protected $_exclude = null; /** * Database adapter to use. If null isValid() will use Zend_Db::getInstance instead * * @var unknown_type */ protected $_adapter = null; /** * Provides basic configuration for use with Zend_Validate_Db Validators * Setting $exclude allows a single record to be excluded from matching. * Exclude can either be a String containing a where clause, or an array with `field` and `value` keys * to define the where clause added to the sql. * A database adapter may optionally be supplied to avoid using the registered default adapter. * * @param string||array $table The database table to validate against, or array with table and schema keys * @param string $field The field to check for a match * @param string||array $exclude An optional where clause or field/value pair to exclude from the query * @param Zend_Db_Adapter_Abstract $adapter An optional database adapter to use. */ public function __construct($table, $field, $exclude = null, Zend_Db_Adapter_Abstract $adapter = null) { if ($adapter !== null) { $this->_adapter = $adapter; } $this->_exclude = $exclude; $this->_field = (string) $field; if (is_array($table)) { $this->_table = (isset($table['table'])) ? $table['table'] : ''; $this->_schema = (isset($table['schema'])) ? $table['schema'] : null; } else { $this->_table = (string) $table; } } /** * Run query and returns matches, or null if no matches are found. * * @param String $value * @return Array when matches are found. */ protected function _query($value) { /** * Check for an adapter being defined. if not, fetch the default adapter. */ if ($this->_adapter === null) { $this->_adapter = Zend_Db_Table_Abstract::getDefaultAdapter(); if (null === $this->_adapter) { require_once 'Zend/Validate/Exception.php'; throw new Zend_Validate_Exception('No database adapter present'); } } /** * Build select object */ $select = new Zend_Db_Select($this->_adapter); $select->from($this->_table, array($this->_field), $this->_schema) ->where($this->_adapter->quoteIdentifier($this->_field).' = ?', $value); if ($this->_exclude !== null) { if (is_array($this->_exclude)) { $select->where($this->_adapter->quoteIdentifier($this->_exclude['field']).' != ?', $this->_exclude['value']); } else { $select->where($this->_exclude); } } $select->limit(1); /** * Run query */ $result = $this->_adapter->fetchRow($select, array(), Zend_Db::FETCH_ASSOC); return $result; } }
ratliff/server
vendor/ZendFramework/library/Zend/Validate/Db/Abstract.php
PHP
agpl-3.0
4,823
//===- CodeViewRecordIO.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "llvm/DebugInfo/CodeView/CodeViewRecordIO.h" #include "llvm/DebugInfo/CodeView/CodeView.h" #include "llvm/DebugInfo/CodeView/RecordSerialization.h" #include "llvm/Support/BinaryStreamReader.h" #include "llvm/Support/BinaryStreamWriter.h" using namespace llvm; using namespace llvm::codeview; Error CodeViewRecordIO::beginRecord(Optional<uint32_t> MaxLength) { RecordLimit Limit; Limit.MaxLength = MaxLength; Limit.BeginOffset = getCurrentOffset(); Limits.push_back(Limit); resetStreamedLen(); return Error::success(); } Error CodeViewRecordIO::endRecord() { assert(!Limits.empty() && "Not in a record!"); Limits.pop_back(); // We would like to assert that we actually read / wrote all the bytes that we // expected to for this record, but unfortunately we can't do this. Some // producers such as MASM over-allocate for certain types of records and // commit the extraneous data, so when reading we can't be sure every byte // will have been read. And when writing we over-allocate temporarily since // we don't know how big the record is until we're finished writing it, so // even though we don't commit the extraneous data, we still can't guarantee // we're at the end of the allocated data. if (isStreaming()) { // For streaming mode, add padding to align with 4 byte boundaries for each // record uint32_t Align = getStreamedLen() % 4; if (Align == 0) return Error::success(); int PaddingBytes = 4 - Align; while (PaddingBytes > 0) { char Pad = static_cast<uint8_t>(LF_PAD0 + PaddingBytes); StringRef BytesSR = StringRef(&Pad, sizeof(Pad)); Streamer->EmitBytes(BytesSR); --PaddingBytes; } } return Error::success(); } uint32_t CodeViewRecordIO::maxFieldLength() const { if (isStreaming()) return 0; assert(!Limits.empty() && "Not in a record!"); // The max length of the next field is the minimum of all lengths that would // be allowed by any of the sub-records we're in. In practice, we can only // ever be at most 1 sub-record deep (in a FieldList), but this works for // the general case. uint32_t Offset = getCurrentOffset(); Optional<uint32_t> Min = Limits.front().bytesRemaining(Offset); for (auto X : makeArrayRef(Limits).drop_front()) { Optional<uint32_t> ThisMin = X.bytesRemaining(Offset); if (ThisMin.hasValue()) Min = (Min.hasValue()) ? std::min(*Min, *ThisMin) : *ThisMin; } assert(Min.hasValue() && "Every field must have a maximum length!"); return *Min; } Error CodeViewRecordIO::padToAlignment(uint32_t Align) { if (isReading()) return Reader->padToAlignment(Align); return Writer->padToAlignment(Align); } Error CodeViewRecordIO::skipPadding() { assert(!isWriting() && "Cannot skip padding while writing!"); if (Reader->bytesRemaining() == 0) return Error::success(); uint8_t Leaf = Reader->peek(); if (Leaf < LF_PAD0) return Error::success(); // Leaf is greater than 0xf0. We should advance by the number of bytes in // the low 4 bits. unsigned BytesToAdvance = Leaf & 0x0F; return Reader->skip(BytesToAdvance); } Error CodeViewRecordIO::mapByteVectorTail(ArrayRef<uint8_t> &Bytes, const Twine &Comment) { if (isStreaming()) { emitComment(Comment); Streamer->EmitBinaryData(toStringRef(Bytes)); incrStreamedLen(Bytes.size()); } else if (isWriting()) { if (auto EC = Writer->writeBytes(Bytes)) return EC; } else { if (auto EC = Reader->readBytes(Bytes, Reader->bytesRemaining())) return EC; } return Error::success(); } Error CodeViewRecordIO::mapByteVectorTail(std::vector<uint8_t> &Bytes, const Twine &Comment) { ArrayRef<uint8_t> BytesRef(Bytes); if (auto EC = mapByteVectorTail(BytesRef, Comment)) return EC; if (!isWriting()) Bytes.assign(BytesRef.begin(), BytesRef.end()); return Error::success(); } Error CodeViewRecordIO::mapInteger(TypeIndex &TypeInd, const Twine &Comment) { if (isStreaming()) { emitComment(Comment); Streamer->EmitIntValue(TypeInd.getIndex(), sizeof(TypeInd.getIndex())); incrStreamedLen(sizeof(TypeInd.getIndex())); } else if (isWriting()) { if (auto EC = Writer->writeInteger(TypeInd.getIndex())) return EC; } else { uint32_t I; if (auto EC = Reader->readInteger(I)) return EC; TypeInd.setIndex(I); } return Error::success(); } Error CodeViewRecordIO::mapEncodedInteger(int64_t &Value, const Twine &Comment) { if (isStreaming()) { if (Value >= 0) emitEncodedUnsignedInteger(static_cast<uint64_t>(Value), Comment); else emitEncodedSignedInteger(Value, Comment); } else if (isWriting()) { if (Value >= 0) { if (auto EC = writeEncodedUnsignedInteger(static_cast<uint64_t>(Value))) return EC; } else { if (auto EC = writeEncodedSignedInteger(Value)) return EC; } } else { APSInt N; if (auto EC = consume(*Reader, N)) return EC; Value = N.getExtValue(); } return Error::success(); } Error CodeViewRecordIO::mapEncodedInteger(uint64_t &Value, const Twine &Comment) { if (isStreaming()) emitEncodedUnsignedInteger(Value, Comment); else if (isWriting()) { if (auto EC = writeEncodedUnsignedInteger(Value)) return EC; } else { APSInt N; if (auto EC = consume(*Reader, N)) return EC; Value = N.getZExtValue(); } return Error::success(); } Error CodeViewRecordIO::mapEncodedInteger(APSInt &Value, const Twine &Comment) { if (isStreaming()) { if (Value.isSigned()) emitEncodedSignedInteger(Value.getSExtValue(), Comment); else emitEncodedUnsignedInteger(Value.getZExtValue(), Comment); } else if (isWriting()) { if (Value.isSigned()) return writeEncodedSignedInteger(Value.getSExtValue()); return writeEncodedUnsignedInteger(Value.getZExtValue()); } else return consume(*Reader, Value); return Error::success(); } Error CodeViewRecordIO::mapStringZ(StringRef &Value, const Twine &Comment) { if (isStreaming()) { auto NullTerminatedString = StringRef(Value.data(), Value.size() + 1); emitComment(Comment); Streamer->EmitBytes(NullTerminatedString); incrStreamedLen(NullTerminatedString.size()); } else if (isWriting()) { // Truncate if we attempt to write too much. StringRef S = Value.take_front(maxFieldLength() - 1); if (auto EC = Writer->writeCString(S)) return EC; } else { if (auto EC = Reader->readCString(Value)) return EC; } return Error::success(); } Error CodeViewRecordIO::mapGuid(GUID &Guid, const Twine &Comment) { constexpr uint32_t GuidSize = 16; if (isStreaming()) { StringRef GuidSR = StringRef((reinterpret_cast<const char *>(&Guid)), GuidSize); emitComment(Comment); Streamer->EmitBytes(GuidSR); incrStreamedLen(GuidSize); return Error::success(); } if (maxFieldLength() < GuidSize) return make_error<CodeViewError>(cv_error_code::insufficient_buffer); if (isWriting()) { if (auto EC = Writer->writeBytes(Guid.Guid)) return EC; } else { ArrayRef<uint8_t> GuidBytes; if (auto EC = Reader->readBytes(GuidBytes, GuidSize)) return EC; memcpy(Guid.Guid, GuidBytes.data(), GuidSize); } return Error::success(); } Error CodeViewRecordIO::mapStringZVectorZ(std::vector<StringRef> &Value, const Twine &Comment) { if (!isReading()) { emitComment(Comment); for (auto V : Value) { if (auto EC = mapStringZ(V)) return EC; } uint8_t FinalZero = 0; if (auto EC = mapInteger(FinalZero)) return EC; } else { StringRef S; if (auto EC = mapStringZ(S)) return EC; while (!S.empty()) { Value.push_back(S); if (auto EC = mapStringZ(S)) return EC; }; } return Error::success(); } void CodeViewRecordIO::emitEncodedSignedInteger(const int64_t &Value, const Twine &Comment) { assert(Value < 0 && "Encoded integer is not signed!"); if (Value >= std::numeric_limits<int8_t>::min()) { Streamer->EmitIntValue(LF_CHAR, 2); emitComment(Comment); Streamer->EmitIntValue(Value, 1); incrStreamedLen(3); } else if (Value >= std::numeric_limits<int16_t>::min()) { Streamer->EmitIntValue(LF_SHORT, 2); emitComment(Comment); Streamer->EmitIntValue(Value, 2); incrStreamedLen(4); } else if (Value >= std::numeric_limits<int32_t>::min()) { Streamer->EmitIntValue(LF_LONG, 2); emitComment(Comment); Streamer->EmitIntValue(Value, 4); incrStreamedLen(6); } else { Streamer->EmitIntValue(LF_QUADWORD, 2); emitComment(Comment); Streamer->EmitIntValue(Value, 4); incrStreamedLen(6); } } void CodeViewRecordIO::emitEncodedUnsignedInteger(const uint64_t &Value, const Twine &Comment) { if (Value < LF_NUMERIC) { emitComment(Comment); Streamer->EmitIntValue(Value, 2); incrStreamedLen(2); } else if (Value <= std::numeric_limits<uint16_t>::max()) { Streamer->EmitIntValue(LF_USHORT, 2); emitComment(Comment); Streamer->EmitIntValue(Value, 2); incrStreamedLen(4); } else if (Value <= std::numeric_limits<uint32_t>::max()) { Streamer->EmitIntValue(LF_ULONG, 2); emitComment(Comment); Streamer->EmitIntValue(Value, 4); incrStreamedLen(6); } else { Streamer->EmitIntValue(LF_UQUADWORD, 2); emitComment(Comment); Streamer->EmitIntValue(Value, 8); incrStreamedLen(6); } } Error CodeViewRecordIO::writeEncodedSignedInteger(const int64_t &Value) { assert(Value < 0 && "Encoded integer is not signed!"); if (Value >= std::numeric_limits<int8_t>::min()) { if (auto EC = Writer->writeInteger<uint16_t>(LF_CHAR)) return EC; if (auto EC = Writer->writeInteger<int8_t>(Value)) return EC; } else if (Value >= std::numeric_limits<int16_t>::min()) { if (auto EC = Writer->writeInteger<uint16_t>(LF_SHORT)) return EC; if (auto EC = Writer->writeInteger<int16_t>(Value)) return EC; } else if (Value >= std::numeric_limits<int32_t>::min()) { if (auto EC = Writer->writeInteger<uint16_t>(LF_LONG)) return EC; if (auto EC = Writer->writeInteger<int32_t>(Value)) return EC; } else { if (auto EC = Writer->writeInteger<uint16_t>(LF_QUADWORD)) return EC; if (auto EC = Writer->writeInteger(Value)) return EC; } return Error::success(); } Error CodeViewRecordIO::writeEncodedUnsignedInteger(const uint64_t &Value) { if (Value < LF_NUMERIC) { if (auto EC = Writer->writeInteger<uint16_t>(Value)) return EC; } else if (Value <= std::numeric_limits<uint16_t>::max()) { if (auto EC = Writer->writeInteger<uint16_t>(LF_USHORT)) return EC; if (auto EC = Writer->writeInteger<uint16_t>(Value)) return EC; } else if (Value <= std::numeric_limits<uint32_t>::max()) { if (auto EC = Writer->writeInteger<uint16_t>(LF_ULONG)) return EC; if (auto EC = Writer->writeInteger<uint32_t>(Value)) return EC; } else { if (auto EC = Writer->writeInteger<uint16_t>(LF_UQUADWORD)) return EC; if (auto EC = Writer->writeInteger(Value)) return EC; } return Error::success(); }
root-mirror/root
interpreter/llvm/src/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp
C++
lgpl-2.1
11,857
//===-- RISCVFrameLowering.cpp - RISCV Frame Information ------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file contains the RISCV implementation of TargetFrameLowering class. // //===----------------------------------------------------------------------===// #include "RISCVFrameLowering.h" #include "RISCVMachineFunctionInfo.h" #include "RISCVSubtarget.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/RegisterScavenging.h" #include "llvm/MC/MCDwarf.h" using namespace llvm; bool RISCVFrameLowering::hasFP(const MachineFunction &MF) const { const TargetRegisterInfo *RegInfo = MF.getSubtarget().getRegisterInfo(); const MachineFrameInfo &MFI = MF.getFrameInfo(); return MF.getTarget().Options.DisableFramePointerElim(MF) || RegInfo->needsStackRealignment(MF) || MFI.hasVarSizedObjects() || MFI.isFrameAddressTaken(); } // Determines the size of the frame and maximum call frame size. void RISCVFrameLowering::determineFrameLayout(MachineFunction &MF) const { MachineFrameInfo &MFI = MF.getFrameInfo(); const RISCVRegisterInfo *RI = STI.getRegisterInfo(); // Get the number of bytes to allocate from the FrameInfo. uint64_t FrameSize = MFI.getStackSize(); // Get the alignment. unsigned StackAlign = getStackAlignment(); if (RI->needsStackRealignment(MF)) { unsigned MaxStackAlign = std::max(StackAlign, MFI.getMaxAlignment()); FrameSize += (MaxStackAlign - StackAlign); StackAlign = MaxStackAlign; } // Set Max Call Frame Size uint64_t MaxCallSize = alignTo(MFI.getMaxCallFrameSize(), StackAlign); MFI.setMaxCallFrameSize(MaxCallSize); // Make sure the frame is aligned. FrameSize = alignTo(FrameSize, StackAlign); // Update frame info. MFI.setStackSize(FrameSize); } void RISCVFrameLowering::adjustReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, int64_t Val, MachineInstr::MIFlag Flag) const { MachineRegisterInfo &MRI = MBB.getParent()->getRegInfo(); const RISCVInstrInfo *TII = STI.getInstrInfo(); if (DestReg == SrcReg && Val == 0) return; if (isInt<12>(Val)) { BuildMI(MBB, MBBI, DL, TII->get(RISCV::ADDI), DestReg) .addReg(SrcReg) .addImm(Val) .setMIFlag(Flag); } else if (isInt<32>(Val)) { unsigned Opc = RISCV::ADD; bool isSub = Val < 0; if (isSub) { Val = -Val; Opc = RISCV::SUB; } unsigned ScratchReg = MRI.createVirtualRegister(&RISCV::GPRRegClass); TII->movImm32(MBB, MBBI, DL, ScratchReg, Val, Flag); BuildMI(MBB, MBBI, DL, TII->get(Opc), DestReg) .addReg(SrcReg) .addReg(ScratchReg, RegState::Kill) .setMIFlag(Flag); } else { report_fatal_error("adjustReg cannot yet handle adjustments >32 bits"); } } // Returns the register used to hold the frame pointer. static unsigned getFPReg(const RISCVSubtarget &STI) { return RISCV::X8; } // Returns the register used to hold the stack pointer. static unsigned getSPReg(const RISCVSubtarget &STI) { return RISCV::X2; } void RISCVFrameLowering::emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const { assert(&MF.front() == &MBB && "Shrink-wrapping not yet supported"); MachineFrameInfo &MFI = MF.getFrameInfo(); auto *RVFI = MF.getInfo<RISCVMachineFunctionInfo>(); const RISCVRegisterInfo *RI = STI.getRegisterInfo(); const RISCVInstrInfo *TII = STI.getInstrInfo(); MachineBasicBlock::iterator MBBI = MBB.begin(); if (RI->needsStackRealignment(MF) && MFI.hasVarSizedObjects()) { report_fatal_error( "RISC-V backend can't currently handle functions that need stack " "realignment and have variable sized objects"); } unsigned FPReg = getFPReg(STI); unsigned SPReg = getSPReg(STI); // Debug location must be unknown since the first debug location is used // to determine the end of the prologue. DebugLoc DL; // Determine the correct frame layout determineFrameLayout(MF); // FIXME (note copied from Lanai): This appears to be overallocating. Needs // investigation. Get the number of bytes to allocate from the FrameInfo. uint64_t StackSize = MFI.getStackSize(); // Early exit if there is no need to allocate on the stack if (StackSize == 0 && !MFI.adjustsStack()) return; // Allocate space on the stack if necessary. adjustReg(MBB, MBBI, DL, SPReg, SPReg, -StackSize, MachineInstr::FrameSetup); // Emit ".cfi_def_cfa_offset StackSize" unsigned CFIIndex = MF.addFrameInst( MCCFIInstruction::createDefCfaOffset(nullptr, -StackSize)); BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex); // The frame pointer is callee-saved, and code has been generated for us to // save it to the stack. We need to skip over the storing of callee-saved // registers as the frame pointer must be modified after it has been saved // to the stack, not before. // FIXME: assumes exactly one instruction is used to save each callee-saved // register. const std::vector<CalleeSavedInfo> &CSI = MFI.getCalleeSavedInfo(); std::advance(MBBI, CSI.size()); // Iterate over list of callee-saved registers and emit .cfi_offset // directives. for (const auto &Entry : CSI) { int64_t Offset = MFI.getObjectOffset(Entry.getFrameIdx()); unsigned Reg = Entry.getReg(); unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset( nullptr, RI->getDwarfRegNum(Reg, true), Offset)); BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex); } // Generate new FP. if (hasFP(MF)) { adjustReg(MBB, MBBI, DL, FPReg, SPReg, StackSize - RVFI->getVarArgsSaveSize(), MachineInstr::FrameSetup); // Emit ".cfi_def_cfa $fp, 0" unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa( nullptr, RI->getDwarfRegNum(FPReg, true), 0)); BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex); // Realign Stack const RISCVRegisterInfo *RI = STI.getRegisterInfo(); if (RI->needsStackRealignment(MF)) { unsigned MaxAlignment = MFI.getMaxAlignment(); const RISCVInstrInfo *TII = STI.getInstrInfo(); if (isInt<12>(-(int)MaxAlignment)) { BuildMI(MBB, MBBI, DL, TII->get(RISCV::ANDI), SPReg) .addReg(SPReg) .addImm(-(int)MaxAlignment); } else { unsigned ShiftAmount = countTrailingZeros(MaxAlignment); unsigned VR = MF.getRegInfo().createVirtualRegister(&RISCV::GPRRegClass); BuildMI(MBB, MBBI, DL, TII->get(RISCV::SRLI), VR) .addReg(SPReg) .addImm(ShiftAmount); BuildMI(MBB, MBBI, DL, TII->get(RISCV::SLLI), SPReg) .addReg(VR) .addImm(ShiftAmount); } } } } void RISCVFrameLowering::emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const { MachineBasicBlock::iterator MBBI = MBB.getLastNonDebugInstr(); const RISCVRegisterInfo *RI = STI.getRegisterInfo(); MachineFrameInfo &MFI = MF.getFrameInfo(); auto *RVFI = MF.getInfo<RISCVMachineFunctionInfo>(); DebugLoc DL = MBBI->getDebugLoc(); const RISCVInstrInfo *TII = STI.getInstrInfo(); unsigned FPReg = getFPReg(STI); unsigned SPReg = getSPReg(STI); // Skip to before the restores of callee-saved registers // FIXME: assumes exactly one instruction is used to restore each // callee-saved register. auto LastFrameDestroy = std::prev(MBBI, MFI.getCalleeSavedInfo().size()); uint64_t StackSize = MFI.getStackSize(); uint64_t FPOffset = StackSize - RVFI->getVarArgsSaveSize(); // Restore the stack pointer using the value of the frame pointer. Only // necessary if the stack pointer was modified, meaning the stack size is // unknown. if (RI->needsStackRealignment(MF) || MFI.hasVarSizedObjects()) { assert(hasFP(MF) && "frame pointer should not have been eliminated"); adjustReg(MBB, LastFrameDestroy, DL, SPReg, FPReg, -FPOffset, MachineInstr::FrameDestroy); } if (hasFP(MF)) { // To find the instruction restoring FP from stack. for (auto &I = LastFrameDestroy; I != MBBI; ++I) { if (I->mayLoad() && I->getOperand(0).isReg()) { unsigned DestReg = I->getOperand(0).getReg(); if (DestReg == FPReg) { // If there is frame pointer, after restoring $fp registers, we // need adjust CFA to ($sp - FPOffset). // Emit ".cfi_def_cfa $sp, -FPOffset" unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa( nullptr, RI->getDwarfRegNum(SPReg, true), -FPOffset)); BuildMI(MBB, std::next(I), DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex); break; } } } } // Add CFI directives for callee-saved registers. const std::vector<CalleeSavedInfo> &CSI = MFI.getCalleeSavedInfo(); // Iterate over list of callee-saved registers and emit .cfi_restore // directives. for (const auto &Entry : CSI) { unsigned Reg = Entry.getReg(); unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createRestore( nullptr, RI->getDwarfRegNum(Reg, true))); BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex); } // Deallocate stack adjustReg(MBB, MBBI, DL, SPReg, SPReg, StackSize, MachineInstr::FrameDestroy); // After restoring $sp, we need to adjust CFA to $(sp + 0) // Emit ".cfi_def_cfa_offset 0" unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, 0)); BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION)) .addCFIIndex(CFIIndex); } int RISCVFrameLowering::getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const { const MachineFrameInfo &MFI = MF.getFrameInfo(); const TargetRegisterInfo *RI = MF.getSubtarget().getRegisterInfo(); const auto *RVFI = MF.getInfo<RISCVMachineFunctionInfo>(); // Callee-saved registers should be referenced relative to the stack // pointer (positive offset), otherwise use the frame pointer (negative // offset). const std::vector<CalleeSavedInfo> &CSI = MFI.getCalleeSavedInfo(); int MinCSFI = 0; int MaxCSFI = -1; int Offset = MFI.getObjectOffset(FI) - getOffsetOfLocalArea() + MFI.getOffsetAdjustment(); if (CSI.size()) { MinCSFI = CSI[0].getFrameIdx(); MaxCSFI = CSI[CSI.size() - 1].getFrameIdx(); } if (FI >= MinCSFI && FI <= MaxCSFI) { FrameReg = RISCV::X2; Offset += MF.getFrameInfo().getStackSize(); } else if (RI->needsStackRealignment(MF)) { assert(!MFI.hasVarSizedObjects() && "Unexpected combination of stack realignment and varsized objects"); // If the stack was realigned, the frame pointer is set in order to allow // SP to be restored, but we still access stack objects using SP. FrameReg = RISCV::X2; Offset += MF.getFrameInfo().getStackSize(); } else { FrameReg = RI->getFrameRegister(MF); if (hasFP(MF)) Offset += RVFI->getVarArgsSaveSize(); else Offset += MF.getFrameInfo().getStackSize(); } return Offset; } void RISCVFrameLowering::determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS) const { TargetFrameLowering::determineCalleeSaves(MF, SavedRegs, RS); // Unconditionally spill RA and FP only if the function uses a frame // pointer. if (hasFP(MF)) { SavedRegs.set(RISCV::X1); SavedRegs.set(RISCV::X8); } // If interrupt is enabled and there are calls in the handler, // unconditionally save all Caller-saved registers and // all FP registers, regardless whether they are used. MachineFrameInfo &MFI = MF.getFrameInfo(); if (MF.getFunction().hasFnAttribute("interrupt") && MFI.hasCalls()) { static const MCPhysReg CSRegs[] = { RISCV::X1, /* ra */ RISCV::X5, RISCV::X6, RISCV::X7, /* t0-t2 */ RISCV::X10, RISCV::X11, /* a0-a1, a2-a7 */ RISCV::X12, RISCV::X13, RISCV::X14, RISCV::X15, RISCV::X16, RISCV::X17, RISCV::X28, RISCV::X29, RISCV::X30, RISCV::X31, 0 /* t3-t6 */ }; for (unsigned i = 0; CSRegs[i]; ++i) SavedRegs.set(CSRegs[i]); if (MF.getSubtarget<RISCVSubtarget>().hasStdExtD() || MF.getSubtarget<RISCVSubtarget>().hasStdExtF()) { // If interrupt is enabled, this list contains all FP registers. const MCPhysReg * Regs = MF.getRegInfo().getCalleeSavedRegs(); for (unsigned i = 0; Regs[i]; ++i) if (RISCV::FPR32RegClass.contains(Regs[i]) || RISCV::FPR64RegClass.contains(Regs[i])) SavedRegs.set(Regs[i]); } } } void RISCVFrameLowering::processFunctionBeforeFrameFinalized( MachineFunction &MF, RegScavenger *RS) const { const TargetRegisterInfo *RegInfo = MF.getSubtarget().getRegisterInfo(); MachineFrameInfo &MFI = MF.getFrameInfo(); const TargetRegisterClass *RC = &RISCV::GPRRegClass; // estimateStackSize has been observed to under-estimate the final stack // size, so give ourselves wiggle-room by checking for stack size // representable an 11-bit signed field rather than 12-bits. // FIXME: It may be possible to craft a function with a small stack that // still needs an emergency spill slot for branch relaxation. This case // would currently be missed. if (!isInt<11>(MFI.estimateStackSize(MF))) { int RegScavFI = MFI.CreateStackObject( RegInfo->getSpillSize(*RC), RegInfo->getSpillAlignment(*RC), false); RS->addScavengingFrameIndex(RegScavFI); } } // Not preserve stack space within prologue for outgoing variables when the // function contains variable size objects and let eliminateCallFramePseudoInstr // preserve stack space for it. bool RISCVFrameLowering::hasReservedCallFrame(const MachineFunction &MF) const { return !MF.getFrameInfo().hasVarSizedObjects(); } // Eliminate ADJCALLSTACKDOWN, ADJCALLSTACKUP pseudo instructions. MachineBasicBlock::iterator RISCVFrameLowering::eliminateCallFramePseudoInstr( MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const { unsigned SPReg = RISCV::X2; DebugLoc DL = MI->getDebugLoc(); if (!hasReservedCallFrame(MF)) { // If space has not been reserved for a call frame, ADJCALLSTACKDOWN and // ADJCALLSTACKUP must be converted to instructions manipulating the stack // pointer. This is necessary when there is a variable length stack // allocation (e.g. alloca), which means it's not possible to allocate // space for outgoing arguments from within the function prologue. int64_t Amount = MI->getOperand(0).getImm(); if (Amount != 0) { // Ensure the stack remains aligned after adjustment. Amount = alignSPAdjust(Amount); if (MI->getOpcode() == RISCV::ADJCALLSTACKDOWN) Amount = -Amount; adjustReg(MBB, MI, DL, SPReg, SPReg, Amount, MachineInstr::NoFlags); } } return MBB.erase(MI); }
root-mirror/root
interpreter/llvm/src/lib/Target/RISCV/RISCVFrameLowering.cpp
C++
lgpl-2.1
15,861
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Nest { public class FieldDataFilterDescriptor { internal FieldDataFilter Filter { get; private set; } public FieldDataFilterDescriptor() { this.Filter = new FieldDataFilter(); } public FieldDataFilterDescriptor Frequency( Func<FieldDataFrequencyFilterDescriptor, FieldDataFrequencyFilterDescriptor> frequencyFilterSelector) { var selector = frequencyFilterSelector(new FieldDataFrequencyFilterDescriptor()); this.Filter.Frequency = selector.FrequencyFilter; return this; } public FieldDataFilterDescriptor Regex( Func<FieldDataRegexFilterDescriptor, FieldDataRegexFilterDescriptor> regexFilterSelector) { var selector = regexFilterSelector(new FieldDataRegexFilterDescriptor()); this.Filter.Regex = selector.RegexFilter; return this; } } }
amyzheng424/elasticsearch-net
src/Nest/Domain/Mapping/Descriptors/FieldDataFilterDescriptor.cs
C#
apache-2.0
893
//Copyright © 2014 Sony Computer Entertainment America LLC. See License.txt. using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Windows.Forms.VisualStyles; namespace Sce.Atf.Controls { /// <summary> /// Represents a combination of a standard button on the left and a drop-down button on the right /// that is not limited to Toolstrip</summary> /// <remarks>ToolStripSplitButton is managed only by Toolstrip</remarks> public class SplitButton : Button { /// <summary> /// Constructor</summary> public SplitButton() { AutoSize = true; } /// <summary> /// Sets whether to show split</summary> [DefaultValue(true)] public bool ShowSplit { set { if (value != m_showSplit) { m_showSplit = value; Invalidate(); if (Parent != null) { Parent.PerformLayout(); } } } } private PushButtonState MState { get { return m_state; } set { if (!m_state.Equals(value)) { m_state = value; Invalidate(); } } } /// <summary> /// Gets preferred split button size</summary> /// <param name="proposedSize">Suggested size</param> /// <returns>Preferred size</returns> public override Size GetPreferredSize(Size proposedSize) { Size preferredSize = base.GetPreferredSize(proposedSize); if (m_showSplit && !string.IsNullOrEmpty(Text) && TextRenderer.MeasureText(Text, Font).Width + PushButtonWidth > preferredSize.Width) { return preferredSize + new Size(PushButtonWidth + BorderSize*2, 0); } return preferredSize; } /// <summary> /// Tests if key is a regular input key or a special key that requires preprocessing</summary> /// <param name="keyData">Key to test</param> /// <returns>True iff key is input key</returns> protected override bool IsInputKey(Keys keyData) { if (keyData.Equals(Keys.Down) && m_showSplit) { return true; } else { return base.IsInputKey(keyData); } } /// <summary> /// Raises the GotFocus event</summary> /// <param name="e">A System.EventArgs that contains the event data</param> protected override void OnGotFocus(EventArgs e) { if (!m_showSplit) { base.OnGotFocus(e); return; } if (!MState.Equals(PushButtonState.Pressed) && !MState.Equals(PushButtonState.Disabled)) { MState = PushButtonState.Default; } } /// <summary> /// Raises the KeyDown event</summary> /// <param name="kevent">KeyEventArgs that contains the event data</param> protected override void OnKeyDown(KeyEventArgs kevent) { if (m_showSplit) { if (kevent.KeyCode.Equals(Keys.Down)) { ShowContextMenuStrip(); } else if (kevent.KeyCode.Equals(Keys.Space) && kevent.Modifiers == Keys.None) { MState = PushButtonState.Pressed; } } base.OnKeyDown(kevent); } /// <summary> /// Raises the KeyUp event</summary> /// <param name="kevent">KeyEventArgs that contains the event data</param> protected override void OnKeyUp(KeyEventArgs kevent) { if (kevent.KeyCode.Equals(Keys.Space)) { if (MouseButtons == MouseButtons.None) { MState = PushButtonState.Normal; } } base.OnKeyUp(kevent); } /// <summary> /// Raises the LostFocus event</summary> /// <param name="e">EventArgs that contains the event data</param> protected override void OnLostFocus(EventArgs e) { if (!m_showSplit) { base.OnLostFocus(e); return; } if (!MState.Equals(PushButtonState.Pressed) && !MState.Equals(PushButtonState.Disabled)) { MState = PushButtonState.Normal; } } /// <summary> /// Raises the MouseDown event</summary> /// <param name="e">MouseEventArgs that contains the event data</param> protected override void OnMouseDown(MouseEventArgs e) { if (!m_showSplit) { base.OnMouseDown(e); return; } if (m_dropDownRectangle.Contains(e.Location)) { ShowContextMenuStrip(); } else { MState = PushButtonState.Pressed; } } /// <summary> /// Raises the MouseEnter event</summary> /// <param name="e">EventArgs that contains the event data</param> protected override void OnMouseEnter(EventArgs e) { if (!m_showSplit) { base.OnMouseEnter(e); return; } if (!MState.Equals(PushButtonState.Pressed) && !MState.Equals(PushButtonState.Disabled)) { MState = PushButtonState.Hot; } } /// <summary> /// Raises the MouseLeave event</summary> /// <param name="e">EventArgs that contains the event data</param> protected override void OnMouseLeave(EventArgs e) { if (!m_showSplit) { base.OnMouseLeave(e); return; } if (!MState.Equals(PushButtonState.Pressed) && !MState.Equals(PushButtonState.Disabled)) { if (Focused) { MState = PushButtonState.Default; } else { MState = PushButtonState.Normal; } } } /// <summary> /// Raises the MouseUp event</summary> /// <param name="mevent">MouseEventArgs that contains the event data</param> protected override void OnMouseUp(MouseEventArgs mevent) { if (!m_showSplit) { base.OnMouseUp(mevent); return; } if (ContextMenuStrip == null || !ContextMenuStrip.Visible) { SetButtonDrawState(); if (Bounds.Contains(Parent.PointToClient(Cursor.Position)) && !m_dropDownRectangle.Contains(mevent.Location)) { OnClick(new EventArgs()); } } } /// <summary> /// Raises the Paint event</summary> /// <param name="pevent">PaintEventArgs that contains the event data</param> protected override void OnPaint(PaintEventArgs pevent) { base.OnPaint(pevent); if (!m_showSplit) { return; } Graphics g = pevent.Graphics; Rectangle bounds = ClientRectangle; // draw the button background as according to the current state. if (MState != PushButtonState.Pressed && IsDefault && !Application.RenderWithVisualStyles) { Rectangle backgroundBounds = bounds; backgroundBounds.Inflate(-1, -1); ButtonRenderer.DrawButton(g, backgroundBounds, MState); // button renderer doesnt draw the black frame when themes are off =( g.DrawRectangle(SystemPens.WindowFrame, 0, 0, bounds.Width - 1, bounds.Height - 1); } else { ButtonRenderer.DrawButton(g, bounds, MState); } // calculate the current dropdown rectangle. m_dropDownRectangle = new Rectangle(bounds.Right - PushButtonWidth - 1, BorderSize, PushButtonWidth, bounds.Height - BorderSize*2); int internalBorder = BorderSize; var focusRect = new Rectangle(internalBorder, internalBorder, bounds.Width - m_dropDownRectangle.Width - internalBorder, bounds.Height - (internalBorder*2)); bool drawSplitLine = (MState == PushButtonState.Hot || MState == PushButtonState.Pressed || !Application.RenderWithVisualStyles); if (RightToLeft == RightToLeft.Yes) { m_dropDownRectangle.X = bounds.Left + 1; focusRect.X = m_dropDownRectangle.Right; if (drawSplitLine) { // draw two lines at the edge of the dropdown button g.DrawLine(SystemPens.ButtonShadow, bounds.Left + PushButtonWidth, BorderSize, bounds.Left + PushButtonWidth, bounds.Bottom - BorderSize); g.DrawLine(SystemPens.ButtonFace, bounds.Left + PushButtonWidth + 1, BorderSize, bounds.Left + PushButtonWidth + 1, bounds.Bottom - BorderSize); } } else { if (drawSplitLine) { // draw two lines at the edge of the dropdown button g.DrawLine(SystemPens.ButtonShadow, bounds.Right - PushButtonWidth, BorderSize, bounds.Right - PushButtonWidth, bounds.Bottom - BorderSize); g.DrawLine(SystemPens.ButtonFace, bounds.Right - PushButtonWidth - 1, BorderSize, bounds.Right - PushButtonWidth - 1, bounds.Bottom - BorderSize); } } // Draw an arrow in the correct location PaintArrow(g, m_dropDownRectangle); // Figure out how to draw the text TextFormatFlags formatFlags = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter; // If we dont' use mnemonic, set formatFlag to NoPrefix as this will show ampersand. if (!UseMnemonic) { formatFlags = formatFlags | TextFormatFlags.NoPrefix; } else if (!ShowKeyboardCues) { formatFlags = formatFlags | TextFormatFlags.HidePrefix; } if (!string.IsNullOrEmpty(Text)) { TextRenderer.DrawText(g, Text, Font, focusRect, SystemColors.ControlText, formatFlags); } // draw the focus rectangle. if (MState != PushButtonState.Pressed && Focused) { ControlPaint.DrawFocusRectangle(g, focusRect); } } private void PaintArrow(Graphics g, Rectangle dropDownRect) { var middle = new Point(Convert.ToInt32(dropDownRect.Left + dropDownRect.Width/2), Convert.ToInt32(dropDownRect.Top + dropDownRect.Height/2)); //if the width is odd - favor pushing it over one pixel right. middle.X += (dropDownRect.Width%2); var arrow = new[] { new Point(middle.X - 2, middle.Y - 1), new Point(middle.X + 3, middle.Y - 1), new Point(middle.X, middle.Y + 2) }; g.FillPolygon(SystemBrushes.ControlText, arrow); } private void ShowContextMenuStrip() { if (m_skipNextOpen) { // we were called because we're closing the context menu strip // when clicking the dropdown button. m_skipNextOpen = false; return; } MState = PushButtonState.Pressed; if (ContextMenuStrip != null) { ContextMenuStrip.Closing += ContextMenuStrip_Closing; ContextMenuStrip.Show(this, new Point(0, Height), ToolStripDropDownDirection.BelowRight); } } private void ContextMenuStrip_Closing(object sender, ToolStripDropDownClosingEventArgs e) { var cms = sender as ContextMenuStrip; if (cms != null) { cms.Closing -= ContextMenuStrip_Closing; } SetButtonDrawState(); if (e.CloseReason == ToolStripDropDownCloseReason.AppClicked) { m_skipNextOpen = (m_dropDownRectangle.Contains(PointToClient(Cursor.Position))); } } private void SetButtonDrawState() { if (Bounds.Contains(Parent.PointToClient(Cursor.Position))) { MState = PushButtonState.Hot; } else if (Focused) { MState = PushButtonState.Default; } else { MState = PushButtonState.Normal; } } private const int PushButtonWidth = 14; private static readonly int BorderSize = SystemInformation.Border3DSize.Width * 2; private PushButtonState m_state; private bool m_skipNextOpen; private Rectangle m_dropDownRectangle; private bool m_showSplit = true; } }
SonyWWS/ATF
Framework/Atf.Gui.WinForms/Controls/SplitButton.cs
C#
apache-2.0
14,095
/* * Copyright 2000-2013 Vaadin Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.vaadin.tests.themes.valo; import java.util.Arrays; import java.util.Collections; import java.util.List; import com.vaadin.server.FontAwesome; import com.vaadin.server.Resource; import com.vaadin.server.ThemeResource; /** * * @since * @author Vaadin Ltd */ public class TestIcon { int iconCount = 0; public TestIcon(int startIndex) { iconCount = startIndex; } public Resource get() { return get(false, 32); } public Resource get(boolean isImage) { return get(isImage, 32); } public Resource get(boolean isImage, int imageSize) { if (!isImage) { if (++iconCount >= ICONS.size()) { iconCount = 0; } return ICONS.get(iconCount); } return new ThemeResource("../runo/icons/" + imageSize + "/document.png"); } static List<FontAwesome> ICONS = Collections.unmodifiableList(Arrays .asList(FontAwesome.values())); }
carrchang/vaadin
uitest/src/com/vaadin/tests/themes/valo/TestIcon.java
Java
apache-2.0
1,580
//Copyright © 2014 Sony Computer Entertainment America LLC. See License.txt. using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq.Expressions; namespace Sce.Atf.Controls.PropertyEditing { /// <summary> /// Helper to support INotifyPropertyChanged using expression trees and lambda expression.</summary> internal static class PropertyChangedExtensions { public static bool NotifyIfChanged<T>(this PropertyChangedEventHandler handler, ref T field, T value, Expression<Func<T>> memberExpression) { if (memberExpression == null) { throw new ArgumentNullException("memberExpression"); } var body = memberExpression.Body as MemberExpression; if (body == null) { throw new ArgumentException("Lambda must return a property."); } if (EqualityComparer<T>.Default.Equals(field, value)) { return false; } field = value; var vmExpression = body.Expression as ConstantExpression; if (vmExpression != null) { LambdaExpression lambda = Expression.Lambda(vmExpression); Delegate vmFunc = lambda.Compile(); object sender = vmFunc.DynamicInvoke(); if (handler != null) { handler(sender, new PropertyChangedEventArgs(body.Member.Name)); } } return true; } } }
jethac/ATF
Framework/Atf.Gui/Controls/PropertyEditing/PropertyChangedExtensions.cs
C#
apache-2.0
1,642
#include "testing/testing.hpp" #include "coding/trie.hpp" #include "coding/trie_builder.hpp" #include "coding/trie_reader.hpp" #include "coding/byte_stream.hpp" #include "coding/write_to_sink.hpp" #include "base/logging.hpp" #include "std/algorithm.hpp" #include "std/string.hpp" #include "std/vector.hpp" #include "std/cstring.hpp" #include <boost/utility/binary.hpp> namespace { struct ChildNodeInfo { bool m_isLeaf; uint32_t m_size; vector<uint32_t> m_edge; string m_edgeValue; ChildNodeInfo(bool isLeaf, uint32_t size, char const * edge, char const * edgeValue) : m_isLeaf(isLeaf), m_size(size), m_edgeValue(edgeValue) { while (*edge) m_edge.push_back(*edge++); } uint32_t Size() const { return m_size; } bool IsLeaf() const { return m_isLeaf; } uint32_t const * GetEdge() const { return &m_edge[0]; } uint32_t GetEdgeSize() const { return m_edge.size(); } void const * GetEdgeValue() const { return m_edgeValue.data(); } uint32_t GetEdgeValueSize() const { return m_edgeValue.size(); } }; struct KeyValuePair { buffer_vector<trie::TrieChar, 8> m_key; uint32_t m_value; KeyValuePair() {} template <class TString> KeyValuePair(TString const & key, int value) : m_key(key.begin(), key.end()), m_value(value) {} uint32_t GetKeySize() const { return m_key.size(); } trie::TrieChar const * GetKeyData() const { return m_key.data(); } uint32_t GetValue() const { return m_value; } inline void const * value_data() const { return &m_value; } inline size_t value_size() const { return sizeof(m_value); } bool operator == (KeyValuePair const & p) const { return (m_key == p.m_key && m_value == p.m_value); } bool operator < (KeyValuePair const & p) const { return ((m_key != p.m_key) ? m_key < p.m_key : m_value < p.m_value); } void Swap(KeyValuePair & r) { m_key.swap(r.m_key); swap(m_value, r.m_value); } }; string DebugPrint(KeyValuePair const & p) { string keyS = ::DebugPrint(p.m_key); ostringstream out; out << "KVP(" << keyS << ", " << p.m_value << ")"; return out.str(); } struct KeyValuePairBackInserter { vector<KeyValuePair> m_v; template <class TString> void operator()(TString const & s, trie::FixedSizeValueReader<4>::ValueType const & rawValue) { uint32_t value; memcpy(&value, &rawValue, 4); m_v.push_back(KeyValuePair(s, value)); } }; struct MaxValueCalc { using ValueType = uint8_t; ValueType operator() (void const * p, uint32_t size) const { ASSERT_EQUAL(size, 4, ()); uint32_t value; memcpy(&value, p, 4); ASSERT_LESS(value, 256, ()); return static_cast<uint8_t>(value); } }; class CharValueList { public: CharValueList(const string & s) : m_string(s) {} size_t size() const { return m_string.size(); } bool empty() const { return m_string.empty(); } template <typename TSink> void Dump(TSink & sink) const { sink.Write(m_string.data(), m_string.size()); } private: string m_string; }; class Uint32ValueList { public: using TBuffer = vector<uint32_t>; void Append(uint32_t value) { m_values.push_back(value); } uint32_t size() const { return m_values.size(); } bool empty() const { return m_values.empty(); } template <typename TSink> void Dump(TSink & sink) const { sink.Write(m_values.data(), m_values.size() * sizeof(TBuffer::value_type)); } private: TBuffer m_values; }; } // unnamed namespace #define ZENC bits::ZigZagEncode #define MKSC(x) static_cast<signed char>(x) #define MKUC(x) static_cast<uint8_t>(x) UNIT_TEST(TrieBuilder_WriteNode_Smoke) { vector<uint8_t> serial; PushBackByteSink<vector<uint8_t> > sink(serial); ChildNodeInfo children[] = { ChildNodeInfo(true, 1, "1A", "i1"), ChildNodeInfo(false, 2, "B", "ii2"), ChildNodeInfo(false, 3, "zz", ""), ChildNodeInfo(true, 4, "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij", "i4"), ChildNodeInfo(true, 5, "a", "5z") }; CharValueList valueList("123"); trie::WriteNode(sink, 0, valueList, &children[0], &children[0] + ARRAY_SIZE(children)); uint8_t const expected [] = { BOOST_BINARY(11000101), // Header: [0b11] [0b000101] 3, // Number of values '1', '2', '3', // Values BOOST_BINARY(10000001), // Child 1: header: [+leaf] [-supershort] [2 symbols] MKUC(ZENC(MKSC('1'))), MKUC(ZENC(MKSC('A') - MKSC('1'))), // Child 1: edge 'i', '1', // Child 1: intermediate data 1, // Child 1: size MKUC(64 | ZENC(MKSC('B') - MKSC('1'))), // Child 2: header: [-leaf] [+supershort] 'i', 'i', '2', // Child 2: intermediate data 2, // Child 2: size BOOST_BINARY(00000001), // Child 3: header: [-leaf] [-supershort] [2 symbols] MKUC(ZENC(MKSC('z') - MKSC('B'))), 0, // Child 3: edge 3, // Child 3: size BOOST_BINARY(10111111), // Child 4: header: [+leaf] [-supershort] [>= 63 symbols] 69, // Child 4: edgeSize - 1 MKUC(ZENC(MKSC('a') - MKSC('z'))), 2,2,2,2,2,2,2,2,2, // Child 4: edge MKUC(ZENC(MKSC('a') - MKSC('j'))), 2,2,2,2,2,2,2,2,2, // Child 4: edge MKUC(ZENC(MKSC('a') - MKSC('j'))), 2,2,2,2,2,2,2,2,2, // Child 4: edge MKUC(ZENC(MKSC('a') - MKSC('j'))), 2,2,2,2,2,2,2,2,2, // Child 4: edge MKUC(ZENC(MKSC('a') - MKSC('j'))), 2,2,2,2,2,2,2,2,2, // Child 4: edge MKUC(ZENC(MKSC('a') - MKSC('j'))), 2,2,2,2,2,2,2,2,2, // Child 4: edge MKUC(ZENC(MKSC('a') - MKSC('j'))), 2,2,2,2,2,2,2,2,2, // Child 4: edge 'i', '4', // Child 4: intermediate data 4, // Child 4: size MKUC(BOOST_BINARY(11000000) | ZENC(0)), // Child 5: header: [+leaf] [+supershort] '5', 'z' // Child 5: intermediate data }; TEST_EQUAL(serial, vector<uint8_t>(&expected[0], &expected[0] + ARRAY_SIZE(expected)), ()); } UNIT_TEST(TrieBuilder_Build) { int const base = 3; int const maxLen = 3; vector<string> possibleStrings(1, string()); for (int len = 1; len <= maxLen; ++len) { for (int i = 0, p = static_cast<int>(pow((double) base, len)); i < p; ++i) { string s(len, 'A'); int t = i; for (int l = len - 1; l >= 0; --l, t /= base) s[l] += (t % base); possibleStrings.push_back(s); } } sort(possibleStrings.begin(), possibleStrings.end()); // LOG(LINFO, (possibleStrings)); int const count = static_cast<int>(possibleStrings.size()); for (int i0 = -1; i0 < count; ++i0) for (int i1 = i0; i1 < count; ++i1) for (int i2 = i1; i2 < count; ++i2) { vector<KeyValuePair> v; if (i0 >= 0) v.push_back(KeyValuePair(possibleStrings[i0], i0)); if (i1 >= 0) v.push_back(KeyValuePair(possibleStrings[i1], i1 + 10)); if (i2 >= 0) v.push_back(KeyValuePair(possibleStrings[i2], i2 + 100)); vector<string> vs; for (size_t i = 0; i < v.size(); ++i) vs.push_back(string(v[i].m_key.begin(), v[i].m_key.end())); vector<uint8_t> serial; PushBackByteSink<vector<uint8_t> > sink(serial); trie::Build<PushBackByteSink<vector<uint8_t>>, typename vector<KeyValuePair>::iterator, trie::MaxValueEdgeBuilder<MaxValueCalc>, Uint32ValueList>( sink, v.begin(), v.end(), trie::MaxValueEdgeBuilder<MaxValueCalc>()); reverse(serial.begin(), serial.end()); // LOG(LINFO, (serial.size(), vs)); MemReader memReader = MemReader(&serial[0], serial.size()); using IteratorType = trie::Iterator<trie::FixedSizeValueReader<4>::ValueType, trie::FixedSizeValueReader<1>::ValueType>; unique_ptr<IteratorType> const root(trie::ReadTrie(memReader, trie::FixedSizeValueReader<4>(), trie::FixedSizeValueReader<1>())); vector<KeyValuePair> res; KeyValuePairBackInserter f; trie::ForEachRef(*root, f, vector<trie::TrieChar>()); sort(f.m_v.begin(), f.m_v.end()); TEST_EQUAL(v, f.m_v, ()); uint32_t expectedMaxEdgeValue = 0; for (size_t i = 0; i < v.size(); ++i) if (!v[i].m_key.empty()) expectedMaxEdgeValue = max(expectedMaxEdgeValue, v[i].m_value); uint32_t maxEdgeValue = 0; for (uint32_t i = 0; i < root->m_edge.size(); ++i) maxEdgeValue = max(maxEdgeValue, static_cast<uint32_t>(root->m_edge[i].m_value.m_data[0])); TEST_EQUAL(maxEdgeValue, expectedMaxEdgeValue, (v, f.m_v)); } }
victorbriz/omim
coding/coding_tests/trie_test.cpp
C++
apache-2.0
9,466
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Host; namespace Microsoft.CodeAnalysis.CodeFixes { internal interface IFixAllGetFixesService : IWorkspaceService { /// <summary> /// Computes the fix all occurrences code fix, brings up the preview changes dialog for the fix and /// returns the code action operations corresponding to the fix. /// </summary> Task<IEnumerable<CodeActionOperation>> GetFixAllOperationsAsync(FixAllContext fixAllContext, bool showPreviewChangesDialog); /// <summary> /// Computes the fix all occurrences code fix and returns the changed solution. /// </summary> Task<Solution> GetFixAllChangedSolutionAsync(FixAllContext fixAllContext); } }
rgani/roslyn
src/Features/Core/Portable/CodeFixes/FixAllOccurrences/IFixAllGetFixesService.cs
C#
apache-2.0
1,008
/* * 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.sling.commons.metrics; import org.osgi.annotation.versioning.ProviderType; /** * A metric which calculates the distribution of a value. */ @ProviderType public interface Histogram extends Counting, Metric { /** * Adds a recorded value. * * @param value the length of the value */ void update(long value); }
cleliameneghin/sling
bundles/commons/metrics/src/main/java/org/apache/sling/commons/metrics/Histogram.java
Java
apache-2.0
1,168
/* * 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.flink.runtime.blob; import org.apache.flink.annotation.VisibleForTesting; import org.apache.flink.api.common.JobID; import org.apache.flink.configuration.BlobServerOptions; import org.apache.flink.configuration.Configuration; import org.apache.flink.util.FileUtils; import org.slf4j.LoggerFactory; import javax.annotation.Nullable; import java.io.File; import java.io.IOException; import java.net.InetSocketAddress; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Timer; import java.util.TimerTask; import static org.apache.flink.util.Preconditions.checkNotNull; /** * Provides a cache for permanent BLOB files including a per-job ref-counting and a staged cleanup. * * <p>When requesting BLOBs via {@link #getFile(JobID, PermanentBlobKey)}, the cache will first * attempt to serve the file from its local cache. Only if the local cache does not contain the * desired BLOB, it will try to download it from a distributed HA file system (if available) or the * BLOB server. * * <p>If files for a job are not needed any more, they will enter a staged, i.e. deferred, cleanup. * Files may thus still be be accessible upon recovery and do not need to be re-downloaded. */ public class PermanentBlobCache extends AbstractBlobCache implements PermanentBlobService { /** * Job reference counters with a time-to-live (TTL). */ @VisibleForTesting static class RefCount { /** * Number of references to a job. */ public int references = 0; /** * Timestamp in milliseconds when any job data should be cleaned up (no cleanup for * non-positive values). */ public long keepUntil = -1; } /** * Map to store the number of references to a specific job. */ private final Map<JobID, RefCount> jobRefCounters = new HashMap<>(); /** * Time interval (ms) to run the cleanup task; also used as the default TTL. */ private final long cleanupInterval; /** * Timer task to execute the cleanup at regular intervals. */ private final Timer cleanupTimer; /** * Instantiates a new cache for permanent BLOBs which are also available in an HA store. * * @param blobClientConfig * global configuration * @param blobView * (distributed) HA blob store file system to retrieve files from first * @param serverAddress * address of the {@link BlobServer} to use for fetching files from or {@code null} if none yet * @throws IOException * thrown if the (local or distributed) file storage cannot be created or is not usable */ public PermanentBlobCache( final Configuration blobClientConfig, final BlobView blobView, @Nullable final InetSocketAddress serverAddress) throws IOException { super(blobClientConfig, blobView, LoggerFactory.getLogger(PermanentBlobCache.class), serverAddress ); // Initializing the clean up task this.cleanupTimer = new Timer(true); this.cleanupInterval = blobClientConfig.getLong(BlobServerOptions.CLEANUP_INTERVAL) * 1000; this.cleanupTimer.schedule(new PermanentBlobCleanupTask(), cleanupInterval, cleanupInterval); } /** * Registers use of job-related BLOBs. * * <p>Using any other method to access BLOBs, e.g. {@link #getFile}, is only valid within * calls to <tt>registerJob(JobID)</tt> and {@link #releaseJob(JobID)}. * * @param jobId * ID of the job this blob belongs to * * @see #releaseJob(JobID) */ public void registerJob(JobID jobId) { checkNotNull(jobId); synchronized (jobRefCounters) { RefCount ref = jobRefCounters.get(jobId); if (ref == null) { ref = new RefCount(); jobRefCounters.put(jobId, ref); } else { // reset cleanup timeout ref.keepUntil = -1; } ++ref.references; } } /** * Unregisters use of job-related BLOBs and allow them to be released. * * @param jobId * ID of the job this blob belongs to * * @see #registerJob(JobID) */ public void releaseJob(JobID jobId) { checkNotNull(jobId); synchronized (jobRefCounters) { RefCount ref = jobRefCounters.get(jobId); if (ref == null || ref.references == 0) { log.warn("improper use of releaseJob() without a matching number of registerJob() calls for jobId " + jobId); return; } --ref.references; if (ref.references == 0) { ref.keepUntil = System.currentTimeMillis() + cleanupInterval; } } } public int getNumberOfReferenceHolders(JobID jobId) { checkNotNull(jobId); synchronized (jobRefCounters) { RefCount ref = jobRefCounters.get(jobId); if (ref == null) { return 0; } else { return ref.references; } } } /** * Returns the path to a local copy of the file associated with the provided job ID and blob * key. * * <p>We will first attempt to serve the BLOB from the local storage. If the BLOB is not in * there, we will try to download it from the HA store, or directly from the {@link BlobServer}. * * @param jobId * ID of the job this blob belongs to * @param key * blob key associated with the requested file * * @return The path to the file. * * @throws java.io.FileNotFoundException * if the BLOB does not exist; * @throws IOException * if any other error occurs when retrieving the file */ @Override public File getFile(JobID jobId, PermanentBlobKey key) throws IOException { checkNotNull(jobId); return getFileInternal(jobId, key); } /** * Returns a file handle to the file associated with the given blob key on the blob * server. * * @param jobId * ID of the job this blob belongs to (or <tt>null</tt> if job-unrelated) * @param key * identifying the file * * @return file handle to the file * * @throws IOException * if creating the directory fails */ @VisibleForTesting public File getStorageLocation(JobID jobId, BlobKey key) throws IOException { checkNotNull(jobId); return BlobUtils.getStorageLocation(storageDir, jobId, key); } /** * Returns the job reference counters - for testing purposes only! * * @return job reference counters (internal state!) */ @VisibleForTesting Map<JobID, RefCount> getJobRefCounters() { return jobRefCounters; } /** * Cleanup task which is executed periodically to delete BLOBs whose ref-counter reached * <tt>0</tt>. */ class PermanentBlobCleanupTask extends TimerTask { /** * Cleans up BLOBs which are not referenced anymore. */ @Override public void run() { synchronized (jobRefCounters) { Iterator<Map.Entry<JobID, RefCount>> entryIter = jobRefCounters.entrySet().iterator(); final long currentTimeMillis = System.currentTimeMillis(); while (entryIter.hasNext()) { Map.Entry<JobID, RefCount> entry = entryIter.next(); RefCount ref = entry.getValue(); if (ref.references <= 0 && ref.keepUntil > 0 && currentTimeMillis >= ref.keepUntil) { JobID jobId = entry.getKey(); final File localFile = new File(BlobUtils.getStorageLocationPath(storageDir.getAbsolutePath(), jobId)); /* * NOTE: normally it is not required to acquire the write lock to delete the job's * storage directory since there should be no one accessing it with the ref * counter being 0 - acquire it just in case, to always be on the safe side */ readWriteLock.writeLock().lock(); boolean success = false; try { FileUtils.deleteDirectory(localFile); success = true; } catch (Throwable t) { log.warn("Failed to locally delete job directory " + localFile.getAbsolutePath(), t); } finally { readWriteLock.writeLock().unlock(); } // let's only remove this directory from cleanup if the cleanup was successful // (does not need the write lock) if (success) { entryIter.remove(); } } } } } } @Override protected void cancelCleanupTask() { cleanupTimer.cancel(); } }
hequn8128/flink
flink-runtime/src/main/java/org/apache/flink/runtime/blob/PermanentBlobCache.java
Java
apache-2.0
8,721
/* * Copyright (C) 2008 ZXing 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 com.google.zxing.web.generator.client; import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.KeyPressHandler; import com.google.gwt.user.client.ui.Grid; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.Widget; /** * Generator for email address. * * @author Yohann Coppel */ public final class EmailGenerator implements GeneratorSource { private Grid table; private final TextBox email = new TextBox(); public EmailGenerator(ChangeHandler handler, KeyPressHandler keyListener) { email.addStyleName(StylesDefs.INPUT_FIELD_REQUIRED); email.addChangeHandler(handler); email.addKeyPressHandler(keyListener); } @Override public String getName() { return "Email address"; } @Override public String getText() throws GeneratorException { return "mailto:" + getEmailField(); } private String getEmailField() throws GeneratorException { String input = email.getText(); if (input.length() < 1) { throw new GeneratorException("Email must be present."); } Validators.validateEmail(input); return input; } @Override public Grid getWidget() { if (table != null) { return table; } table = new Grid(1, 2); table.setText(0, 0, "Address"); table.setWidget(0, 1, email); return table; } @Override public void validate(Widget widget) throws GeneratorException { if (widget == email) { getEmailField(); } } @Override public void setFocus() { email.setFocus(true); } }
kerwinxu/barcodeManager
zxing/zxing.appspot.com/src/com/google/zxing/web/generator/client/EmailGenerator.java
Java
bsd-2-clause
2,186
require File.expand_path('../../../spec_helper', __FILE__) require File.expand_path('../../../fixtures/kernel/classes', __FILE__) describe :method_missing_defined_module, :shared => true do describe "for a Module with #method_missing defined" do it "is not called when a defined method is called" do @object.method_public.should == :module_public_method end it "is called when an undefined method is called" do @object.method_undefined.should == :module_method_missing end it "is called when an protected method is called" do @object.method_protected.should == :module_method_missing end it "is called when an private method is called" do @object.method_private.should == :module_method_missing end end end describe :method_missing_module, :shared => true do describe "for a Module" do it "raises a NoMethodError when an undefined method is called" do lambda { @object.method_undefined }.should raise_error(NoMethodError) end it "raises a NoMethodError when a protected method is called" do lambda { @object.method_protected }.should raise_error(NoMethodError) end it "raises a NoMethodError when a private method is called" do lambda { @object.method_private }.should raise_error(NoMethodError) end end end describe :method_missing_defined_class, :shared => true do describe "for a Class with #method_missing defined" do it "is not called when a defined method is called" do @object.method_public.should == :class_public_method end it "is called when an undefined method is called" do @object.method_undefined.should == :class_method_missing end it "is called when an protected method is called" do @object.method_protected.should == :class_method_missing end it "is called when an private method is called" do @object.method_private.should == :class_method_missing end end end describe :method_missing_class, :shared => true do describe "for a Class" do it "raises a NoMethodError when an undefined method is called" do lambda { @object.method_undefined }.should raise_error(NoMethodError) end it "raises a NoMethodError when a protected method is called" do lambda { @object.method_protected }.should raise_error(NoMethodError) end it "raises a NoMethodError when a private method is called" do lambda { @object.method_private }.should raise_error(NoMethodError) end end end describe :method_missing_defined_instance, :shared => true do describe "for an instance with #method_missing defined" do before :each do @instance = @object.new end it "is not called when a defined method is called" do @instance.method_public.should == :instance_public_method end it "is called when an undefined method is called" do @instance.method_undefined.should == :instance_method_missing end it "is called when an protected method is called" do @instance.method_protected.should == :instance_method_missing end it "is called when an private method is called" do @instance.method_private.should == :instance_method_missing end end end describe :method_missing_instance, :shared => true do describe "for an instance" do it "raises a NoMethodError when an undefined method is called" do lambda { @object.new.method_undefined }.should raise_error(NoMethodError) end it "raises a NoMethodError when a protected method is called" do lambda { @object.new.method_protected }.should raise_error(NoMethodError) end it "raises a NoMethodError when a private method is called" do lambda { @object.new.method_private }.should raise_error(NoMethodError) end end end
dblock/rubinius
spec/ruby/shared/kernel/method_missing.rb
Ruby
bsd-3-clause
3,792
'use strict'; var utils = require('./utils'); var normalizeHeaderName = require('./helpers/normalizeHeaderName'); var PROTECTION_PREFIX = /^\)\]\}',?\n/; var DEFAULT_CONTENT_TYPE = { 'Content-Type': 'application/x-www-form-urlencoded' }; function setContentTypeIfUnset(headers, value) { if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { headers['Content-Type'] = value; } } module.exports = { transformRequest: [function transformRequest(data, headers) { normalizeHeaderName(headers, 'Content-Type'); if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data) ) { return data; } if (utils.isArrayBufferView(data)) { return data.buffer; } if (utils.isURLSearchParams(data)) { setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); return data.toString(); } if (utils.isObject(data)) { setContentTypeIfUnset(headers, 'application/json;charset=utf-8'); return JSON.stringify(data); } return data; }], transformResponse: [function transformResponse(data) { /*eslint no-param-reassign:0*/ if (typeof data === 'string') { data = data.replace(PROTECTION_PREFIX, ''); try { data = JSON.parse(data); } catch (e) { /* Ignore */ } } return data; }], headers: { common: { 'Accept': 'application/json, text/plain, */*' }, patch: utils.merge(DEFAULT_CONTENT_TYPE), post: utils.merge(DEFAULT_CONTENT_TYPE), put: utils.merge(DEFAULT_CONTENT_TYPE) }, timeout: 0, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, validateStatus: function validateStatus(status) { return status >= 200 && status < 300; } };
MichaelTsao/yanpei
web/js/node_modules/leancloud-realtime/node_modules/axios/lib/defaults.js
JavaScript
bsd-3-clause
1,867
import * as util from 'util'; import assert = require('assert'); import { readFile } from 'fs'; { // Old and new util.inspect APIs util.inspect(["This is nice"], false, 5); util.inspect(["This is nice"], false, null); util.inspect(["This is nice"], { colors: true, depth: 5, customInspect: false, showProxy: true, maxArrayLength: 10, breakLength: 20, maxStringLength: 123, compact: true, sorted(a, b) { return b.localeCompare(a); }, getters: false, }); util.inspect(["This is nice"], { colors: true, depth: null, customInspect: false, showProxy: true, maxArrayLength: null, breakLength: Infinity, compact: false, sorted: true, getters: 'set', }); util.inspect(["This is nice"], { compact: 42, }); assert(typeof util.inspect.custom === 'symbol'); util.inspect.replDefaults = { colors: true, }; util.inspect({ [util.inspect.custom]: <util.CustomInspectFunction> ((depth, opts) => opts.stylize('woop', 'module')), }); util.format('%s:%s', 'foo'); util.format('%s:%s', 'foo', 'bar', 'baz'); util.format(1, 2, 3); util.format('%% %s'); util.format(); util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); // util.callbackify class callbackifyTest { static fn(): Promise<void> { assert(arguments.length === 0); return Promise.resolve(); } static fnE(): Promise<void> { assert(arguments.length === 0); return Promise.reject(new Error('fail')); } static fnT1(arg1: string): Promise<void> { assert(arguments.length === 1 && arg1 === 'parameter'); return Promise.resolve(); } static fnT1E(arg1: string): Promise<void> { assert(arguments.length === 1 && arg1 === 'parameter'); return Promise.reject(new Error('fail')); } static fnTResult(): Promise<string> { assert(arguments.length === 0); return Promise.resolve('result'); } static fnTResultE(): Promise<string> { assert(arguments.length === 0); return Promise.reject(new Error('fail')); } static fnT1TResult(arg1: string): Promise<string> { assert(arguments.length === 1 && arg1 === 'parameter'); return Promise.resolve('result'); } static fnT1TResultE(arg1: string): Promise<string> { assert(arguments.length === 1 && arg1 === 'parameter'); return Promise.reject(new Error('fail')); } static test(): void { const cfn = util.callbackify(callbackifyTest.fn); const cfnE = util.callbackify(callbackifyTest.fnE); const cfnT1 = util.callbackify(callbackifyTest.fnT1); const cfnT1E = util.callbackify(callbackifyTest.fnT1E); const cfnTResult = util.callbackify(callbackifyTest.fnTResult); const cfnTResultE = util.callbackify(callbackifyTest.fnTResultE); const cfnT1TResult = util.callbackify(callbackifyTest.fnT1TResult); const cfnT1TResultE = util.callbackify(callbackifyTest.fnT1TResultE); cfn((err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === undefined)); cfnE((err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0)); cfnT1('parameter', (err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === undefined)); cfnT1E('parameter', (err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0)); cfnTResult((err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === 'result')); cfnTResultE((err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0)); cfnT1TResult('parameter', (err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === 'result')); cfnT1TResultE('parameter', (err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0)); } } callbackifyTest.test(); // util.promisify const readPromised = util.promisify(readFile); const sampleRead: Promise<any> = readPromised(__filename).then((data: Buffer): void => { }).catch((error: Error): void => { }); const arg0: () => Promise<number> = util.promisify((cb: (err: Error | null, result: number) => void): void => { }); const arg0NoResult: () => Promise<any> = util.promisify((cb: (err: Error | null) => void): void => { }); const arg1: (arg: string) => Promise<number> = util.promisify((arg: string, cb: (err: Error | null, result: number) => void): void => { }); const arg1UnknownError: (arg: string) => Promise<number> = util.promisify((arg: string, cb: (err: Error | null, result: number) => void): void => { }); const arg1NoResult: (arg: string) => Promise<any> = util.promisify((arg: string, cb: (err: Error | null) => void): void => { }); const cbOptionalError: () => Promise<void | {}> = util.promisify((cb: (err?: Error | null) => void): void => { cb(); }); // tslint:disable-line void-return assert(typeof util.promisify.custom === 'symbol'); // util.deprecate const foo = () => {}; // $ExpectType () => void util.deprecate(foo, 'foo() is deprecated, use bar() instead'); // $ExpectType <T extends Function>(fn: T, message: string, code?: string | undefined) => T util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead'); // $ExpectType <T extends Function>(fn: T, message: string, code?: string | undefined) => T util.deprecate(util.deprecate, 'deprecate() is deprecated, use bar() instead', 'DEP0001'); // util.isDeepStrictEqual util.isDeepStrictEqual({foo: 'bar'}, {foo: 'bar'}); // util.TextDecoder() const td = new util.TextDecoder(); new util.TextDecoder("utf-8"); new util.TextDecoder("utf-8", { fatal: true }); new util.TextDecoder("utf-8", { fatal: true, ignoreBOM: true }); const ignoreBom: boolean = td.ignoreBOM; const fatal: boolean = td.fatal; const encoding: string = td.encoding; td.decode(new Int8Array(1)); td.decode(new Int16Array(1)); td.decode(new Int32Array(1)); td.decode(new Uint8Array(1)); td.decode(new Uint16Array(1)); td.decode(new Uint32Array(1)); td.decode(new Uint8ClampedArray(1)); td.decode(new Float32Array(1)); td.decode(new Float64Array(1)); td.decode(new DataView(new Int8Array(1).buffer)); td.decode(new ArrayBuffer(1)); td.decode(null); td.decode(null, { stream: true }); td.decode(new Int8Array(1), { stream: true }); const decode: string = td.decode(new Int8Array(1)); // util.TextEncoder() const te = new util.TextEncoder(); const teEncoding: string = te.encoding; const teEncodeRes: Uint8Array = te.encode("TextEncoder"); const encIntoRes: util.EncodeIntoResult = te.encodeInto('asdf', new Uint8Array(16)); // util.types let b: boolean; b = util.types.isBigInt64Array(15); b = util.types.isBigUint64Array(15); b = util.types.isModuleNamespaceObject(15); const f = (v: any) => { if (util.types.isArrayBufferView(v)) { const abv: ArrayBufferView = v; } }; // tslint:disable-next-line:no-construct const maybeBoxed: number | Number = new Number(1); if (util.types.isBoxedPrimitive(maybeBoxed)) { const boxed: Number = maybeBoxed; } const maybeBoxed2: number | Number = 1; if (!util.types.isBoxedPrimitive(maybeBoxed2)) { const boxed: number = maybeBoxed2; } } function testUtilTypes( object: unknown, readonlySetOrArray: ReadonlySet<any> | ReadonlyArray<any>, readonlyMapOrRecord: ReadonlyMap<any, any> | Record<any, any>, ) { if (util.types.isAnyArrayBuffer(object)) { const expected: ArrayBufferLike = object; } if (util.types.isArgumentsObject(object)) { object; // $ExpectType IArguments } if (util.types.isArrayBufferView(object)) { object; // $ExpectType ArrayBufferView } if (util.types.isBigInt64Array(object)) { object; // $ExpectType BigInt64Array } if (util.types.isBigUint64Array(object)) { object; // $ExpectType BigUint64Array } if (util.types.isBooleanObject(object)) { object; // $ExpectType Boolean } if (util.types.isBoxedPrimitive(object)) { object; // $ExpectType String | Number | Boolean | BigInt | Symbol } if (util.types.isDataView(object)) { object; // $ExpectType DataView } if (util.types.isDate(object)) { object; // $ExpectType Date } if (util.types.isFloat32Array(object)) { object; // $ExpectType Float32Array } if (util.types.isFloat64Array(object)) { object; // $ExpectType Float64Array } if (util.types.isGeneratorFunction(object)) { object; // $ExpectType GeneratorFunction } if (util.types.isGeneratorObject(object)) { object; // $ExpectType Generator<unknown, any, unknown> } if (util.types.isInt8Array(object)) { object; // $ExpectType Int8Array } if (util.types.isInt16Array(object)) { object; // $ExpectType Int16Array } if (util.types.isInt32Array(object)) { object; // $ExpectType Int32Array } if (util.types.isMap(object)) { object; // $ExpectType Map<any, any> if (util.types.isMap(readonlyMapOrRecord)) { readonlyMapOrRecord; // $ExpectType ReadonlyMap<any, any> } } if (util.types.isNativeError(object)) { object; // $ExpectType Error ([ new EvalError(), new RangeError(), new ReferenceError(), new SyntaxError(), new TypeError(), new URIError(), ] as const).forEach((nativeError: EvalError | RangeError | ReferenceError | SyntaxError | TypeError | URIError) => { if (!util.types.isNativeError(nativeError)) { nativeError; // $ExpectType never } }); } if (util.types.isNumberObject(object)) { object; // $ExpectType Number } if (util.types.isPromise(object)) { object; // $ExpectType Promise<any> } if (util.types.isRegExp(object)) { object; // $ExpectType RegExp } if (util.types.isSet(object)) { object; // $ExpectType Set<any> if (util.types.isSet(readonlySetOrArray)) { readonlySetOrArray; // $ExpectType ReadonlySet<any> } } if (util.types.isSharedArrayBuffer(object)) { object; // $ExpectType SharedArrayBuffer } if (util.types.isStringObject(object)) { object; // $ExpectType String } if (util.types.isSymbolObject(object)) { object; // $ExpectType Symbol } if (util.types.isTypedArray(object)) { object; // $ExpectType TypedArray } if (util.types.isUint8Array(object)) { object; // $ExpectType Uint8Array } if (util.types.isUint8ClampedArray(object)) { object; // $ExpectType Uint8ClampedArray } if (util.types.isUint16Array(object)) { object; // $ExpectType Uint16Array } if (util.types.isUint32Array(object)) { object; // $ExpectType Uint32Array } if (util.types.isWeakMap(object)) { object; // $ExpectType WeakMap<any, any> } if (util.types.isWeakSet(object)) { object; // $ExpectType WeakSet<any> } }
markogresak/DefinitelyTyped
types/node/v14/test/util.ts
TypeScript
mit
12,010
<?php function foo($foo, $bar, $foobar) {} ?>
drBenway/siteResearch
vendor/pdepend/pdepend/src/test/resources/files/issues/067/testParserHandlesParameterOptionalIsFalseForAllParameters_1.php
PHP
mit
46
// package: google.protobuf // file: type.proto import * as jspb from "../../index"; import * as google_protobuf_any_pb from "./any_pb"; import * as google_protobuf_source_context_pb from "./source_context_pb"; export class Type extends jspb.Message { getName(): string; setName(value: string): void; clearFieldsList(): void; getFieldsList(): Array<Field>; setFieldsList(value: Array<Field>): void; addFields(value?: Field, index?: number): Field; clearOneofsList(): void; getOneofsList(): Array<string>; setOneofsList(value: Array<string>): void; addOneofs(value: string, index?: number): string; clearOptionsList(): void; getOptionsList(): Array<Option>; setOptionsList(value: Array<Option>): void; addOptions(value?: Option, index?: number): Option; hasSourceContext(): boolean; clearSourceContext(): void; getSourceContext(): google_protobuf_source_context_pb.SourceContext | undefined; setSourceContext(value?: google_protobuf_source_context_pb.SourceContext): void; getSyntax(): Syntax; setSyntax(value: Syntax): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Type.AsObject; static toObject(includeInstance: boolean, msg: Type): Type.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static serializeBinaryToWriter(message: Type, writer: jspb.BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): Type; static deserializeBinaryFromReader(message: Type, reader: jspb.BinaryReader): Type; } export namespace Type { export type AsObject = { name: string, fieldsList: Array<Field.AsObject>, oneofsList: Array<string>, optionsList: Array<Option.AsObject>, sourceContext?: google_protobuf_source_context_pb.SourceContext.AsObject, syntax: Syntax, } } export class Field extends jspb.Message { getKind(): Field.Kind; setKind(value: Field.Kind): void; getCardinality(): Field.Cardinality; setCardinality(value: Field.Cardinality): void; getNumber(): number; setNumber(value: number): void; getName(): string; setName(value: string): void; getTypeUrl(): string; setTypeUrl(value: string): void; getOneofIndex(): number; setOneofIndex(value: number): void; getPacked(): boolean; setPacked(value: boolean): void; clearOptionsList(): void; getOptionsList(): Array<Option>; setOptionsList(value: Array<Option>): void; addOptions(value?: Option, index?: number): Option; getJsonName(): string; setJsonName(value: string): void; getDefaultValue(): string; setDefaultValue(value: string): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Field.AsObject; static toObject(includeInstance: boolean, msg: Field): Field.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static serializeBinaryToWriter(message: Field, writer: jspb.BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): Field; static deserializeBinaryFromReader(message: Field, reader: jspb.BinaryReader): Field; } export namespace Field { export type AsObject = { kind: Kind, cardinality: Cardinality, number: number, name: string, typeUrl: string, oneofIndex: number, packed: boolean, optionsList: Array<Option.AsObject>, jsonName: string, defaultValue: string, } export enum Kind { TYPE_UNKNOWN = 0, TYPE_DOUBLE = 1, TYPE_FLOAT = 2, TYPE_INT64 = 3, TYPE_UINT64 = 4, TYPE_INT32 = 5, TYPE_FIXED64 = 6, TYPE_FIXED32 = 7, TYPE_BOOL = 8, TYPE_STRING = 9, TYPE_GROUP = 10, TYPE_MESSAGE = 11, TYPE_BYTES = 12, TYPE_UINT32 = 13, TYPE_ENUM = 14, TYPE_SFIXED32 = 15, TYPE_SFIXED64 = 16, TYPE_SINT32 = 17, TYPE_SINT64 = 18, } export enum Cardinality { CARDINALITY_UNKNOWN = 0, CARDINALITY_OPTIONAL = 1, CARDINALITY_REQUIRED = 2, CARDINALITY_REPEATED = 3, } } export class Enum extends jspb.Message { getName(): string; setName(value: string): void; clearEnumvalueList(): void; getEnumvalueList(): Array<EnumValue>; setEnumvalueList(value: Array<EnumValue>): void; addEnumvalue(value?: EnumValue, index?: number): EnumValue; clearOptionsList(): void; getOptionsList(): Array<Option>; setOptionsList(value: Array<Option>): void; addOptions(value?: Option, index?: number): Option; hasSourceContext(): boolean; clearSourceContext(): void; getSourceContext(): google_protobuf_source_context_pb.SourceContext | undefined; setSourceContext(value?: google_protobuf_source_context_pb.SourceContext): void; getSyntax(): Syntax; setSyntax(value: Syntax): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Enum.AsObject; static toObject(includeInstance: boolean, msg: Enum): Enum.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static serializeBinaryToWriter(message: Enum, writer: jspb.BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): Enum; static deserializeBinaryFromReader(message: Enum, reader: jspb.BinaryReader): Enum; } export namespace Enum { export type AsObject = { name: string, enumvalueList: Array<EnumValue.AsObject>, optionsList: Array<Option.AsObject>, sourceContext?: google_protobuf_source_context_pb.SourceContext.AsObject, syntax: Syntax, } } export class EnumValue extends jspb.Message { getName(): string; setName(value: string): void; getNumber(): number; setNumber(value: number): void; clearOptionsList(): void; getOptionsList(): Array<Option>; setOptionsList(value: Array<Option>): void; addOptions(value?: Option, index?: number): Option; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): EnumValue.AsObject; static toObject(includeInstance: boolean, msg: EnumValue): EnumValue.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static serializeBinaryToWriter(message: EnumValue, writer: jspb.BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): EnumValue; static deserializeBinaryFromReader(message: EnumValue, reader: jspb.BinaryReader): EnumValue; } export namespace EnumValue { export type AsObject = { name: string, number: number, optionsList: Array<Option.AsObject>, } } export class Option extends jspb.Message { getName(): string; setName(value: string): void; hasValue(): boolean; clearValue(): void; getValue(): google_protobuf_any_pb.Any | undefined; setValue(value?: google_protobuf_any_pb.Any): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Option.AsObject; static toObject(includeInstance: boolean, msg: Option): Option.AsObject; static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>}; static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>}; static serializeBinaryToWriter(message: Option, writer: jspb.BinaryWriter): void; static deserializeBinary(bytes: Uint8Array): Option; static deserializeBinaryFromReader(message: Option, reader: jspb.BinaryReader): Option; } export namespace Option { export type AsObject = { name: string, value?: google_protobuf_any_pb.Any.AsObject, } } export enum Syntax { SYNTAX_PROTO2 = 0, SYNTAX_PROTO3 = 1, }
dsebastien/DefinitelyTyped
types/google-protobuf/google/protobuf/type_pb.d.ts
TypeScript
mit
7,723
package myrcpapp; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.part.ViewPart; public class View extends ViewPart { @Override public void createPartControl(final Composite parent) { Text text = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); text.setText("Hello, world!"); } @Override public void setFocus() { } }
mcmil/wuff
examples/RcpApp-3/MyRcpApp/src/main/java/myrcpapp/View.java
Java
mit
435
module.exports = require('./lib/rework');
atomify/atomify-css
test/fixtures/css/node_modules/rework-clone/node_modules/rework/index.js
JavaScript
mit
42
package nsq import ( "fmt" "github.com/bitly/nsq/util" "github.com/bmizerany/assert" "io/ioutil" "log" "os" "strconv" "testing" "time" ) func TestNsqdToLookupd(t *testing.T) { log.SetOutput(ioutil.Discard) defer log.SetOutput(os.Stdout) topicName := "cluster_test" + strconv.Itoa(int(time.Now().Unix())) hostname, err := os.Hostname() if err != nil { t.Fatalf("ERROR: failed to get hostname - %s", err.Error()) } _, err = util.ApiRequest(fmt.Sprintf("http://127.0.0.1:4151/create_topic?topic=%s", topicName)) if err != nil { t.Fatalf(err.Error()) } _, err = util.ApiRequest(fmt.Sprintf("http://127.0.0.1:4151/create_channel?topic=%s&channel=ch", topicName)) if err != nil { t.Fatalf(err.Error()) } // allow some time for nsqd to push info to nsqlookupd time.Sleep(350 * time.Millisecond) data, err := util.ApiRequest("http://127.0.0.1:4161/debug") if err != nil { t.Fatalf(err.Error()) } topicData := data.Get("topic:" + topicName + ":") producers, _ := topicData.Array() assert.Equal(t, len(producers), 1) producer := topicData.GetIndex(0) assert.Equal(t, producer.Get("address").MustString(), hostname) assert.Equal(t, producer.Get("hostname").MustString(), hostname) assert.Equal(t, producer.Get("broadcast_address").MustString(), hostname) assert.Equal(t, producer.Get("tcp_port").MustInt(), 4150) assert.Equal(t, producer.Get("tombstoned").MustBool(), false) channelData := data.Get("channel:" + topicName + ":ch") producers, _ = channelData.Array() assert.Equal(t, len(producers), 1) producer = topicData.GetIndex(0) assert.Equal(t, producer.Get("address").MustString(), hostname) assert.Equal(t, producer.Get("hostname").MustString(), hostname) assert.Equal(t, producer.Get("broadcast_address").MustString(), hostname) assert.Equal(t, producer.Get("tcp_port").MustInt(), 4150) assert.Equal(t, producer.Get("tombstoned").MustBool(), false) data, err = util.ApiRequest("http://127.0.0.1:4161/lookup?topic=" + topicName) if err != nil { t.Fatalf(err.Error()) } producers, _ = data.Get("producers").Array() assert.Equal(t, len(producers), 1) producer = data.Get("producers").GetIndex(0) assert.Equal(t, producer.Get("address").MustString(), hostname) assert.Equal(t, producer.Get("hostname").MustString(), hostname) assert.Equal(t, producer.Get("broadcast_address").MustString(), hostname) assert.Equal(t, producer.Get("tcp_port").MustInt(), 4150) channels, _ := data.Get("channels").Array() assert.Equal(t, len(channels), 1) channel := channels[0].(string) assert.Equal(t, channel, "ch") data, err = util.ApiRequest("http://127.0.0.1:4151/delete_topic?topic=" + topicName) if err != nil { t.Fatalf(err.Error()) } // allow some time for nsqd to push info to nsqlookupd time.Sleep(350 * time.Millisecond) data, err = util.ApiRequest("http://127.0.0.1:4161/lookup?topic=" + topicName) if err != nil { t.Fatalf(err.Error()) } producers, _ = data.Get("producers").Array() assert.Equal(t, len(producers), 0) data, err = util.ApiRequest("http://127.0.0.1:4161/debug") if err != nil { t.Fatalf(err.Error()) } producers, _ = data.Get("topic:" + topicName + ":").Array() assert.Equal(t, len(producers), 0) producers, _ = data.Get("channel:" + topicName + ":ch").Array() assert.Equal(t, len(producers), 0) }
josephyzhou/nsq
nsqd/test/cluster_test.go
GO
mit
3,316
<?php /* * Copyright 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Updated by Dan Lester 2014 * */ require_once realpath(dirname(__FILE__) . '/../../../autoload.php'); /** * Signs data with PEM key (e.g. taken from new JSON files). * * @author Dan Lester <dan@danlester.com> */ class GoogleGAL_Signer_PEM extends GoogleGAL_Signer_Abstract { // OpenSSL private key resource private $privateKey; // Creates a new signer from a PEM text string public function __construct($pem, $password) { if (!function_exists('openssl_x509_read')) { throw new GoogleGAL_Exception( 'The Google PHP API library needs the openssl PHP extension' ); } $this->privateKey = $pem; if (!$this->privateKey) { throw new GoogleGAL_Auth_Exception("Unable to load private key"); } } public function __destruct() { } public function sign($data) { if (version_compare(PHP_VERSION, '5.3.0') < 0) { throw new GoogleGAL_Auth_Exception( "PHP 5.3.0 or higher is required to use service accounts." ); } $hash = defined("OPENSSL_ALGO_SHA256") ? OPENSSL_ALGO_SHA256 : "sha256"; if (!openssl_sign($data, $signature, $this->privateKey, $hash)) { throw new GoogleGAL_Auth_Exception("Unable to sign data"); } return $signature; } }
nsberrow/pi.parklands.co.za
wp-content/plugins/googleappslogin-enterprise/core/Google/Signer/PEM.php
PHP
gpl-2.0
1,783
package org.wordpress.android.ui.notifications.blocks; import android.content.Context; import android.text.TextUtils; import android.view.MotionEvent; import android.view.View; import android.view.animation.DecelerateInterpolator; import android.widget.TextView; import org.json.JSONObject; import org.wordpress.android.R; import org.wordpress.android.util.JSONUtils; import org.wordpress.android.util.GravatarUtils; import org.wordpress.android.widgets.WPNetworkImageView; /** * A block that displays information about a User (such as a user that liked a post) */ public class UserNoteBlock extends NoteBlock { private final OnGravatarClickedListener mGravatarClickedListener; private int mAvatarSz; public interface OnGravatarClickedListener { // userId is currently unused, but will be handy once a profile view is added to the app public void onGravatarClicked(long siteId, long userId, String siteUrl); } public UserNoteBlock( Context context, JSONObject noteObject, OnNoteBlockTextClickListener onNoteBlockTextClickListener, OnGravatarClickedListener onGravatarClickedListener) { super(noteObject, onNoteBlockTextClickListener); if (context != null) { setAvatarSize(context.getResources().getDimensionPixelSize(R.dimen.notifications_avatar_sz)); } mGravatarClickedListener = onGravatarClickedListener; } void setAvatarSize(int size) { mAvatarSz = size; } int getAvatarSize() { return mAvatarSz; } @Override public BlockType getBlockType() { return BlockType.USER; } @Override public int getLayoutResourceId() { return R.layout.note_block_user; } @Override public View configureView(View view) { final UserActionNoteBlockHolder noteBlockHolder = (UserActionNoteBlockHolder)view.getTag(); noteBlockHolder.nameTextView.setText(getNoteText().toString()); String linkedText = null; if (hasUserUrlAndTitle()) { linkedText = getUserBlogTitle(); } else if (hasUserUrl()) { linkedText = getUserUrl(); } if (!TextUtils.isEmpty(linkedText)) { noteBlockHolder.urlTextView.setText(linkedText); noteBlockHolder.urlTextView.setVisibility(View.VISIBLE); } else { noteBlockHolder.urlTextView.setVisibility(View.GONE); } if (hasUserBlogTagline()) { noteBlockHolder.taglineTextView.setText(getUserBlogTagline()); noteBlockHolder.taglineTextView.setVisibility(View.VISIBLE); } else { noteBlockHolder.taglineTextView.setVisibility(View.GONE); } if (hasImageMediaItem()) { String imageUrl = GravatarUtils.fixGravatarUrl(getNoteMediaItem().optString("url", ""), getAvatarSize()); noteBlockHolder.avatarImageView.setImageUrl(imageUrl, WPNetworkImageView.ImageType.AVATAR); if (!TextUtils.isEmpty(getUserUrl())) { noteBlockHolder.avatarImageView.setOnTouchListener(mOnGravatarTouchListener); noteBlockHolder.rootView.setEnabled(true); noteBlockHolder.rootView.setOnClickListener(mOnClickListener); } else { noteBlockHolder.avatarImageView.setOnTouchListener(null); noteBlockHolder.rootView.setEnabled(false); noteBlockHolder.rootView.setOnClickListener(null); } } else { noteBlockHolder.avatarImageView.showDefaultGravatarImage(); noteBlockHolder.avatarImageView.setOnTouchListener(null); } return view; } private final View.OnClickListener mOnClickListener = new View.OnClickListener() { @Override public void onClick(View v) { showBlogPreview(); } }; @Override public Object getViewHolder(View view) { return new UserActionNoteBlockHolder(view); } private class UserActionNoteBlockHolder { private final View rootView; private final TextView nameTextView; private final TextView urlTextView; private final TextView taglineTextView; private final WPNetworkImageView avatarImageView; public UserActionNoteBlockHolder(View view) { rootView = view.findViewById(R.id.user_block_root_view); nameTextView = (TextView)view.findViewById(R.id.user_name); urlTextView = (TextView)view.findViewById(R.id.user_blog_url); taglineTextView = (TextView)view.findViewById(R.id.user_blog_tagline); avatarImageView = (WPNetworkImageView)view.findViewById(R.id.user_avatar); } } String getUserUrl() { return JSONUtils.queryJSON(getNoteData(), "meta.links.home", ""); } private String getUserBlogTitle() { return JSONUtils.queryJSON(getNoteData(), "meta.titles.home", ""); } private String getUserBlogTagline() { return JSONUtils.queryJSON(getNoteData(), "meta.titles.tagline", ""); } private boolean hasUserUrl() { return !TextUtils.isEmpty(getUserUrl()); } private boolean hasUserUrlAndTitle() { return hasUserUrl() && !TextUtils.isEmpty(getUserBlogTitle()); } private boolean hasUserBlogTagline() { return !TextUtils.isEmpty(getUserBlogTagline()); } final View.OnTouchListener mOnGravatarTouchListener = new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int animationDuration = 150; if (event.getAction() == MotionEvent.ACTION_DOWN) { v.animate() .scaleX(0.9f) .scaleY(0.9f) .alpha(0.5f) .setDuration(animationDuration) .setInterpolator(new DecelerateInterpolator()); } else if (event.getActionMasked() == MotionEvent.ACTION_UP || event.getActionMasked() == MotionEvent.ACTION_CANCEL) { v.animate() .scaleX(1.0f) .scaleY(1.0f) .alpha(1.0f) .setDuration(animationDuration) .setInterpolator(new DecelerateInterpolator()); if (event.getActionMasked() == MotionEvent.ACTION_UP && mGravatarClickedListener != null) { // Fire the listener, which will load the site preview for the user's site // In the future we can use this to load a 'profile view' (currently in R&D) showBlogPreview(); } } return true; } }; private void showBlogPreview() { long siteId = Long.valueOf(JSONUtils.queryJSON(getNoteData(), "meta.ids.site", 0)); long userId = Long.valueOf(JSONUtils.queryJSON(getNoteData(), "meta.ids.user", 0)); String siteUrl = getUserUrl(); if (mGravatarClickedListener != null) { mGravatarClickedListener.onGravatarClicked(siteId, userId, siteUrl); } } }
AftonTroll/WordPress-Android
WordPress/src/main/java/org/wordpress/android/ui/notifications/blocks/UserNoteBlock.java
Java
gpl-2.0
7,212
#!/usr/bin/python # This script generates a list of testsuites that should be run as part of # the Samba 4 test suite. # The output of this script is parsed by selftest.pl, which then decides # which of the tests to actually run. It will, for example, skip all tests # listed in selftest/skip or only run a subset during "make quicktest". # The idea is that this script outputs all of the tests of Samba 4, not # just those that are known to pass, and list those that should be skipped # or are known to fail in selftest/skip or selftest/knownfail. This makes it # very easy to see what functionality is still missing in Samba 4 and makes # it possible to run the testsuite against other servers, such as Samba 3 or # Windows that have a different set of features. # The syntax for a testsuite is "-- TEST --" on a single line, followed # by the name of the test, the environment it needs and the command to run, all # three separated by newlines. All other lines in the output are considered # comments. import os import subprocess import sys def srcdir(): return os.path.normpath(os.getenv("SRCDIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))) def source4dir(): return os.path.normpath(os.path.join(srcdir(), "source4")) def source3dir(): return os.path.normpath(os.path.join(srcdir(), "source3")) def bindir(): return os.path.normpath(os.getenv("BINDIR", "./bin")) def binpath(name): return os.path.join(bindir(), name) # Split perl variable to allow $PERL to be set to e.g. "perl -W" perl = os.getenv("PERL", "perl").split() if subprocess.call(perl + ["-e", "eval require Test::More;"]) == 0: has_perl_test_more = True else: has_perl_test_more = False python = os.getenv("PYTHON", "python") tap2subunit = python + " " + os.path.join(srcdir(), "selftest", "tap2subunit") def valgrindify(cmdline): """Run a command under valgrind, if $VALGRIND was set.""" valgrind = os.getenv("VALGRIND") if valgrind is None: return cmdline return valgrind + " " + cmdline def plantestsuite(name, env, cmdline): """Plan a test suite. :param name: Testsuite name :param env: Environment to run the testsuite in :param cmdline: Command line to run """ print "-- TEST --" print name print env if isinstance(cmdline, list): cmdline = " ".join(cmdline) if "$LISTOPT" in cmdline: raise AssertionError("test %s supports --list, but not --load-list" % name) print cmdline + " 2>&1 " + " | " + add_prefix(name, env) def add_prefix(prefix, env, support_list=False): if support_list: listopt = "$LISTOPT " else: listopt = "" return "%s/selftest/filter-subunit %s--fail-on-empty --prefix=\"%s.\" --suffix=\"(%s)\"" % (srcdir(), listopt, prefix, env) def plantestsuite_loadlist(name, env, cmdline): print "-- TEST-LOADLIST --" if env == "none": fullname = name else: fullname = "%s(%s)" % (name, env) print fullname print env if isinstance(cmdline, list): cmdline = " ".join(cmdline) support_list = ("$LISTOPT" in cmdline) if not "$LISTOPT" in cmdline: raise AssertionError("loadlist test %s does not support not --list" % name) if not "$LOADLIST" in cmdline: raise AssertionError("loadlist test %s does not support --load-list" % name) print ("%s | %s" % (cmdline.replace("$LOADLIST", ""), add_prefix(name, env, support_list))).replace("$LISTOPT", "--list") print cmdline.replace("$LISTOPT", "") + " 2>&1 " + " | " + add_prefix(name, env, False) def skiptestsuite(name, reason): """Indicate that a testsuite was skipped. :param name: Test suite name :param reason: Reason the test suite was skipped """ # FIXME: Report this using subunit, but re-adjust the testsuite count somehow print >>sys.stderr, "skipping %s (%s)" % (name, reason) def planperltestsuite(name, path): """Run a perl test suite. :param name: Name of the test suite :param path: Path to the test runner """ if has_perl_test_more: plantestsuite(name, "none", "%s %s | %s" % (" ".join(perl), path, tap2subunit)) else: skiptestsuite(name, "Test::More not available") def planpythontestsuite(env, module, name=None, extra_path=[]): if name is None: name = module pypath = list(extra_path) args = [python, "-m", "samba.subunit.run", "$LISTOPT", "$LOADLIST", module] if pypath: args.insert(0, "PYTHONPATH=%s" % ":".join(["$PYTHONPATH"] + pypath)) plantestsuite_loadlist(name, env, args) def get_env_torture_options(): ret = [] if not os.getenv("SELFTEST_VERBOSE"): ret.append("--option=torture:progress=no") if os.getenv("SELFTEST_QUICK"): ret.append("--option=torture:quick=yes") return ret samba4srcdir = source4dir() samba3srcdir = source3dir() bbdir = os.path.join(srcdir(), "testprogs/blackbox") configuration = "--configfile=$SMB_CONF_PATH" smbtorture4 = binpath("smbtorture") smbtorture4_testsuite_list = subprocess.Popen([smbtorture4, "--list-suites"], stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate("")[0].splitlines() smbtorture4_options = [ configuration, "--option=\'fss:sequence timeout=1\'", "--maximum-runtime=$SELFTEST_MAXTIME", "--basedir=$SELFTEST_TMPDIR", "--format=subunit" ] + get_env_torture_options() def plansmbtorture4testsuite(name, env, options, target, modname=None): if modname is None: modname = "samba4.%s" % name if isinstance(options, list): options = " ".join(options) options = " ".join(smbtorture4_options + ["--target=%s" % target]) + " " + options cmdline = "%s $LISTOPT $LOADLIST %s %s" % (valgrindify(smbtorture4), options, name) plantestsuite_loadlist(modname, env, cmdline) def smbtorture4_testsuites(prefix): return filter(lambda x: x.startswith(prefix), smbtorture4_testsuite_list) smbclient3 = binpath('smbclient') smbtorture3 = binpath('smbtorture3') ntlm_auth3 = binpath('ntlm_auth') net = binpath('net') scriptdir = os.path.join(srcdir(), "script/tests") wbinfo = binpath('wbinfo') dbwrap_tool = binpath('dbwrap_tool') vfstest = binpath('vfstest')
Zentyal/samba
selftest/selftesthelpers.py
Python
gpl-3.0
6,229
package introsde.document.ws; import introsde.document.model.LifeStatus; import introsde.document.model.Person; import java.util.List; import javax.jws.WebService; //Service Implementation @WebService(endpointInterface = "introsde.document.ws.People", serviceName="PeopleService") public class PeopleImpl implements People { @Override public Person readPerson(int id) { System.out.println("---> Reading Person by id = "+id); Person p = Person.getPersonById(id); if (p!=null) { System.out.println("---> Found Person by id = "+id+" => "+p.getName()); } else { System.out.println("---> Didn't find any Person with id = "+id); } return p; } @Override public List<Person> getPeople() { return Person.getAll(); } @Override public int addPerson(Person person) { Person.savePerson(person); return person.getIdPerson(); } @Override public int updatePerson(Person person) { Person.updatePerson(person); return person.getIdPerson(); } @Override public int deletePerson(int id) { Person p = Person.getPersonById(id); if (p!=null) { Person.removePerson(p); return 0; } else { return -1; } } @Override public int updatePersonHP(int id, LifeStatus hp) { LifeStatus ls = LifeStatus.getLifeStatusById(hp.getIdMeasure()); if (ls.getPerson().getIdPerson() == id) { LifeStatus.updateLifeStatus(hp); return hp.getIdMeasure(); } else { return -1; } } }
orlera/introsde
lab09/Server/src/introsde/document/ws/PeopleImpl.java
Java
gpl-3.0
1,425
/* * 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.commons.math3.linear; import org.apache.commons.math3.FieldElement; /** * Interface handling decomposition algorithms that can solve A &times; X = B. * <p>Decomposition algorithms decompose an A matrix has a product of several specific * matrices from which they can solve A &times; X = B in least squares sense: they find X * such that ||A &times; X - B|| is minimal.</p> * <p>Some solvers like {@link FieldLUDecomposition} can only find the solution for * square matrices and when the solution is an exact linear solution, i.e. when * ||A &times; X - B|| is exactly 0. Other solvers can also find solutions * with non-square matrix A and with non-null minimal norm. If an exact linear * solution exists it is also the minimal norm solution.</p> * * @param <T> the type of the field elements * @since 2.0 */ public interface FieldDecompositionSolver<T extends FieldElement<T>> { /** Solve the linear equation A &times; X = B for matrices A. * <p>The A matrix is implicit, it is provided by the underlying * decomposition algorithm.</p> * @param b right-hand side of the equation A &times; X = B * @return a vector X that minimizes the two norm of A &times; X - B * @throws org.apache.commons.math3.exception.DimensionMismatchException * if the matrices dimensions do not match. * @throws SingularMatrixException * if the decomposed matrix is singular. */ FieldVector<T> solve(final FieldVector<T> b); /** Solve the linear equation A &times; X = B for matrices A. * <p>The A matrix is implicit, it is provided by the underlying * decomposition algorithm.</p> * @param b right-hand side of the equation A &times; X = B * @return a matrix X that minimizes the two norm of A &times; X - B * @throws org.apache.commons.math3.exception.DimensionMismatchException * if the matrices dimensions do not match. * @throws SingularMatrixException * if the decomposed matrix is singular. */ FieldMatrix<T> solve(final FieldMatrix<T> b); /** * Check if the decomposed matrix is non-singular. * @return true if the decomposed matrix is non-singular */ boolean isNonSingular(); /** Get the inverse (or pseudo-inverse) of the decomposed matrix. * @return inverse matrix * @throws SingularMatrixException * if the decomposed matrix is singular. */ FieldMatrix<T> getInverse(); }
happyjack27/autoredistrict
src/org/apache/commons/math3/linear/FieldDecompositionSolver.java
Java
gpl-3.0
3,261
<?php // This file is part of Moodle - http://moodle.org/ // // Moodle 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. // // Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>. /** * Serve question type files * * @since 2.0 * @package qtype * @subpackage calculated * @copyright Dongsheng Cai <dongsheng@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Checks file access for calculated questions. */ function qtype_calculated_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload) { global $CFG; require_once($CFG->libdir . '/questionlib.php'); question_pluginfile($course, $context, 'qtype_calculated', $filearea, $args, $forcedownload); }
micaherne/moodle
question/type/calculated/lib.php
PHP
gpl-3.0
1,284
/* * 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.activemq.artemis.tests.integration.jms.client; import javax.jms.Connection; import javax.jms.DeliveryMode; import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; import org.apache.activemq.artemis.tests.util.JMSTestBase; import org.junit.Before; import org.junit.Test; /** * A ReceiveNoWaitTest */ public class ReceiveNoWaitTest extends JMSTestBase { private Queue queue; @Override @Before public void setUp() throws Exception { super.setUp(); queue = createQueue("TestQueue"); } /* * Test that after sending persistent messages to a queue (these will be sent blocking) * that all messages are available for consumption by receiveNoWait() * https://jira.jboss.org/jira/browse/HORNETQ-284 */ @Test public void testReceiveNoWait() throws Exception { assertNotNull(queue); for (int i = 0; i < 1000; i++) { Connection connection = cf.createConnection(); Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); MessageProducer producer = session.createProducer(queue); producer.setDeliveryMode(DeliveryMode.PERSISTENT); for (int j = 0; j < 100; j++) { String text = "Message" + j; TextMessage message = session.createTextMessage(); message.setText(text); producer.send(message); } connection.start(); MessageConsumer consumer = session.createConsumer(queue); for (int j = 0; j < 100; j++) { TextMessage m = (TextMessage) consumer.receiveNoWait(); if (m == null) { throw new IllegalStateException("msg null"); } assertEquals("Message" + j, m.getText()); m.acknowledge(); } connection.close(); } } }
mnovak1/activemq-artemis
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ReceiveNoWaitTest.java
Java
apache-2.0
2,747
/* * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.openapi.externalSystem.service.task; import com.intellij.openapi.externalSystem.ExternalSystemManager; import com.intellij.openapi.externalSystem.model.DataNode; import com.intellij.openapi.externalSystem.model.Key; import com.intellij.openapi.externalSystem.model.ProjectKeys; import com.intellij.openapi.externalSystem.model.ProjectSystemId; import com.intellij.openapi.externalSystem.model.project.ModuleData; import com.intellij.openapi.externalSystem.model.project.ProjectData; import com.intellij.openapi.externalSystem.model.project.ExternalProjectPojo; import com.intellij.openapi.externalSystem.settings.AbstractExternalSystemLocalSettings; import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil; import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; import com.intellij.openapi.externalSystem.util.Order; import com.intellij.openapi.project.Project; import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtilRt; import com.intellij.util.containers.MultiMap; import org.jetbrains.annotations.NotNull; import java.util.*; /** * Ensures that all external system sub-projects are correctly represented at the external system tool window. * * @author Denis Zhdanov * @since 5/15/13 1:02 PM */ @Order(ExternalSystemConstants.BUILTIN_TOOL_WINDOW_SERVICE_ORDER) public class ToolWindowModuleService extends AbstractToolWindowService<ModuleData> { @NotNull public static final Function<DataNode<ModuleData>, ExternalProjectPojo> MAPPER = node -> ExternalProjectPojo.from(node.getData()); @NotNull @Override public Key<ModuleData> getTargetDataKey() { return ProjectKeys.MODULE; } @Override protected void processData(@NotNull final Collection<DataNode<ModuleData>> nodes, @NotNull Project project) { if (nodes.isEmpty()) { return; } ProjectSystemId externalSystemId = nodes.iterator().next().getData().getOwner(); ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId); assert manager != null; final MultiMap<DataNode<ProjectData>, DataNode<ModuleData>> grouped = ExternalSystemApiUtil.groupBy(nodes, ProjectKeys.PROJECT); Map<ExternalProjectPojo, Collection<ExternalProjectPojo>> data = ContainerUtilRt.newHashMap(); for (Map.Entry<DataNode<ProjectData>, Collection<DataNode<ModuleData>>> entry : grouped.entrySet()) { data.put(ExternalProjectPojo.from(entry.getKey().getData()), ContainerUtilRt.map2List(entry.getValue(), MAPPER)); } AbstractExternalSystemLocalSettings settings = manager.getLocalSettingsProvider().fun(project); Set<String> pathsToForget = detectRenamedProjects(data, settings.getAvailableProjects()); if (!pathsToForget.isEmpty()) { settings.forgetExternalProjects(pathsToForget); } Map<ExternalProjectPojo,Collection<ExternalProjectPojo>> projects = ContainerUtilRt.newHashMap(settings.getAvailableProjects()); projects.putAll(data); settings.setAvailableProjects(projects); } @NotNull private static Set<String> detectRenamedProjects(@NotNull Map<ExternalProjectPojo, Collection<ExternalProjectPojo>> currentInfo, @NotNull Map<ExternalProjectPojo, Collection<ExternalProjectPojo>> oldInfo) { Map<String/* external config path */, String/* project name */> map = ContainerUtilRt.newHashMap(); for (Map.Entry<ExternalProjectPojo, Collection<ExternalProjectPojo>> entry : currentInfo.entrySet()) { map.put(entry.getKey().getPath(), entry.getKey().getName()); for (ExternalProjectPojo pojo : entry.getValue()) { map.put(pojo.getPath(), pojo.getName()); } } Set<String> result = ContainerUtilRt.newHashSet(); for (Map.Entry<ExternalProjectPojo, Collection<ExternalProjectPojo>> entry : oldInfo.entrySet()) { String newName = map.get(entry.getKey().getPath()); if (newName != null && !newName.equals(entry.getKey().getName())) { result.add(entry.getKey().getPath()); } for (ExternalProjectPojo pojo : entry.getValue()) { newName = map.get(pojo.getPath()); if (newName != null && !newName.equals(pojo.getName())) { result.add(pojo.getPath()); } } } return result; } }
asedunov/intellij-community
platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/task/ToolWindowModuleService.java
Java
apache-2.0
4,952
/* * 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.facebook.presto.execution.buffer; import com.facebook.presto.OutputBuffers.OutputBufferId; import com.facebook.presto.block.BlockAssertions; import com.facebook.presto.execution.buffer.ClientBuffer.PageReference; import com.facebook.presto.operator.PageAssertions; import com.facebook.presto.spi.Page; import com.facebook.presto.spi.type.BigintType; import com.facebook.presto.spi.type.Type; import com.google.common.collect.ImmutableList; import io.airlift.units.DataSize; import io.airlift.units.Duration; import org.testng.annotations.Test; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicBoolean; import static com.facebook.presto.execution.buffer.BufferResult.emptyResults; import static com.facebook.presto.spi.type.BigintType.BIGINT; import static com.google.common.base.Preconditions.checkArgument; import static io.airlift.concurrent.MoreFutures.tryGetFutureValue; import static io.airlift.units.DataSize.Unit.BYTE; import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; import static org.testng.Assert.fail; public class TestClientBuffer { private static final Duration NO_WAIT = new Duration(0, MILLISECONDS); private static final DataSize PAGE_SIZE = new DataSize(createPage(42).getRetainedSizeInBytes(), BYTE); private static final String TASK_INSTANCE_ID = "task-instance-id"; private static final ImmutableList<BigintType> TYPES = ImmutableList.of(BIGINT); private static final OutputBufferId BUFFER_ID = new OutputBufferId(33); private static final String INVALID_SEQUENCE_ID = "Invalid sequence id"; @Test public void testSimplePartitioned() throws Exception { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); // add three pages to the buffer for (int i = 0; i < 3; i++) { addPage(buffer, createPage(i)); } assertBufferInfo(buffer, 3, 0); // get the pages elements from the buffer assertBufferResultEquals(TYPES, getBufferResult(buffer, 0, sizeOfPages(10), NO_WAIT), bufferResult(0, createPage(0), createPage(1), createPage(2))); // pages not acknowledged yet so state is the same assertBufferInfo(buffer, 3, 0); // acknowledge first three pages in the buffer buffer.getPages(3, sizeOfPages(10)).cancel(true); // pages now acknowledged assertBufferInfo(buffer, 0, 3); // add 3 more pages for (int i = 3; i < 6; i++) { addPage(buffer, createPage(i)); } assertBufferInfo(buffer, 3, 3); // remove a page assertBufferResultEquals(TYPES, getBufferResult(buffer, 3, sizeOfPages(1), NO_WAIT), bufferResult(3, createPage(3))); // page not acknowledged yet so sent count is the same assertBufferInfo(buffer, 3, 3); // set no more pages buffer.setNoMorePages(); // state should not change assertBufferInfo(buffer, 3, 3); // remove a page assertBufferResultEquals(TYPES, getBufferResult(buffer, 4, sizeOfPages(1), NO_WAIT), bufferResult(4, createPage(4))); assertBufferInfo(buffer, 2, 4); // remove last pages from, should not be finished assertBufferResultEquals(TYPES, getBufferResult(buffer, 5, sizeOfPages(30), NO_WAIT), bufferResult(5, createPage(5))); assertBufferInfo(buffer, 1, 5); // acknowledge all pages from the buffer, should return a finished buffer result assertBufferResultEquals(TYPES, getBufferResult(buffer, 6, sizeOfPages(10), NO_WAIT), emptyResults(TASK_INSTANCE_ID, 6, true)); assertBufferInfo(buffer, 0, 6); // buffer is not destroyed until explicitly destroyed buffer.destroy(); assertBufferDestroyed(buffer, 6); } @Test public void testDuplicateRequests() throws Exception { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); // add three pages for (int i = 0; i < 3; i++) { addPage(buffer, createPage(i)); } assertBufferInfo(buffer, 3, 0); // get the three pages assertBufferResultEquals(TYPES, getBufferResult(buffer, 0, sizeOfPages(10), NO_WAIT), bufferResult(0, createPage(0), createPage(1), createPage(2))); // pages not acknowledged yet so state is the same assertBufferInfo(buffer, 3, 0); // get the three pages again assertBufferResultEquals(TYPES, getBufferResult(buffer, 0, sizeOfPages(10), NO_WAIT), bufferResult(0, createPage(0), createPage(1), createPage(2))); // pages not acknowledged yet so state is the same assertBufferInfo(buffer, 3, 0); // acknowledge the pages buffer.getPages(3, sizeOfPages(10)).cancel(true); // attempt to get the three elements again, which will return an empty resilt assertBufferResultEquals(TYPES, getBufferResult(buffer, 0, sizeOfPages(10), NO_WAIT), emptyResults(TASK_INSTANCE_ID, 0, false)); // pages not acknowledged yet so state is the same assertBufferInfo(buffer, 0, 3); } @Test public void testAddAfterNoMorePages() throws Exception { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); buffer.setNoMorePages(); addPage(buffer, createPage(0)); addPage(buffer, createPage(0)); assertBufferInfo(buffer, 0, 0); } @Test public void testAddAfterDestroy() throws Exception { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); buffer.destroy(); addPage(buffer, createPage(0)); addPage(buffer, createPage(0)); assertBufferDestroyed(buffer, 0); } @Test public void testDestroy() throws Exception { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); // add 5 pages the buffer for (int i = 0; i < 5; i++) { addPage(buffer, createPage(i)); } buffer.setNoMorePages(); // read a page assertBufferResultEquals(TYPES, getBufferResult(buffer, 0, sizeOfPages(1), NO_WAIT), bufferResult(0, createPage(0))); // destroy without acknowledgement buffer.destroy(); assertBufferDestroyed(buffer, 0); // follow token from previous read, which should return a finished result assertBufferResultEquals(TYPES, getBufferResult(buffer, 1, sizeOfPages(1), NO_WAIT), emptyResults(TASK_INSTANCE_ID, 0, true)); } @Test public void testNoMorePagesFreesReader() throws Exception { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); // attempt to get a page CompletableFuture<BufferResult> future = buffer.getPages(0, sizeOfPages(10)); // verify we are waiting for a page assertFalse(future.isDone()); // add one item addPage(buffer, createPage(0)); // verify we got one page assertBufferResultEquals(TYPES, getFuture(future, NO_WAIT), bufferResult(0, createPage(0))); // attempt to get another page, and verify we are blocked future = buffer.getPages(1, sizeOfPages(10)); assertFalse(future.isDone()); // finish the buffer buffer.setNoMorePages(); assertBufferInfo(buffer, 0, 1); // verify the future completed assertBufferResultEquals(TYPES, getFuture(future, NO_WAIT), emptyResults(TASK_INSTANCE_ID, 1, true)); } @Test public void testDestroyFreesReader() throws Exception { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); // attempt to get a page CompletableFuture<BufferResult> future = buffer.getPages(0, sizeOfPages(10)); // verify we are waiting for a page assertFalse(future.isDone()); // add one item addPage(buffer, createPage(0)); assertTrue(future.isDone()); // verify we got one page assertBufferResultEquals(TYPES, getFuture(future, NO_WAIT), bufferResult(0, createPage(0))); // attempt to get another page, and verify we are blocked future = buffer.getPages(1, sizeOfPages(10)); assertFalse(future.isDone()); // destroy the buffer buffer.destroy(); // verify the future completed // buffer does not return a "complete" result in this case, but it doesn't matter assertBufferResultEquals(TYPES, getFuture(future, NO_WAIT), emptyResults(TASK_INSTANCE_ID, 1, false)); // further requests will see a completed result assertBufferDestroyed(buffer, 1); } @Test public void testInvalidTokenFails() throws Exception { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); addPage(buffer, createPage(0)); addPage(buffer, createPage(1)); buffer.getPages(1, sizeOfPages(10)).cancel(true); assertBufferInfo(buffer, 1, 1); // request negative token assertInvalidSequenceId(buffer, -1); assertBufferInfo(buffer, 1, 1); // request token off end of buffer assertInvalidSequenceId(buffer, 10); assertBufferInfo(buffer, 1, 1); } @Test public void testReferenceCount() throws Exception { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); // add 2 pages and verify they are referenced AtomicBoolean page0HasReference = addPage(buffer, createPage(0)); AtomicBoolean page1HasReference = addPage(buffer, createPage(1)); assertTrue(page0HasReference.get()); assertTrue(page1HasReference.get()); assertBufferInfo(buffer, 2, 0); // read one page assertBufferResultEquals(TYPES, getBufferResult(buffer, 0, sizeOfPages(0), NO_WAIT), bufferResult(0, createPage(0))); assertTrue(page0HasReference.get()); assertTrue(page1HasReference.get()); assertBufferInfo(buffer, 2, 0); // acknowledge first page assertBufferResultEquals(TYPES, getBufferResult(buffer, 1, sizeOfPages(1), NO_WAIT), bufferResult(1, createPage(1))); assertFalse(page0HasReference.get()); assertTrue(page1HasReference.get()); assertBufferInfo(buffer, 1, 1); // destroy the buffer buffer.destroy(); assertFalse(page0HasReference.get()); assertFalse(page1HasReference.get()); assertBufferDestroyed(buffer, 1); } private static void assertInvalidSequenceId(ClientBuffer buffer, int sequenceId) { try { buffer.getPages(sequenceId, sizeOfPages(10)); fail("Expected " + INVALID_SEQUENCE_ID); } catch (IllegalArgumentException e) { assertEquals(e.getMessage(), INVALID_SEQUENCE_ID); } } private static BufferResult getBufferResult(ClientBuffer buffer, long sequenceId, DataSize maxSize, Duration maxWait) { CompletableFuture<BufferResult> future = buffer.getPages(sequenceId, maxSize); return getFuture(future, maxWait); } private static BufferResult getFuture(CompletableFuture<BufferResult> future, Duration maxWait) { return tryGetFutureValue(future, (int) maxWait.toMillis(), MILLISECONDS).get(); } private static AtomicBoolean addPage(ClientBuffer buffer, Page page) { AtomicBoolean dereferenced = new AtomicBoolean(true); PageReference pageReference = new PageReference(page, 1, () -> dereferenced.set(false)); buffer.enqueuePages(ImmutableList.of(pageReference)); pageReference.dereferencePage(); return dereferenced; } private static void assertBufferInfo( ClientBuffer buffer, int bufferedPages, int pagesSent) { assertEquals( buffer.getInfo(), new BufferInfo( BUFFER_ID, false, bufferedPages, pagesSent, new PageBufferInfo( BUFFER_ID.getId(), bufferedPages, sizeOfPages(bufferedPages).toBytes(), bufferedPages + pagesSent, // every page has one row bufferedPages + pagesSent))); assertEquals(buffer.isDestroyed(), false); } @SuppressWarnings("ConstantConditions") private static void assertBufferDestroyed(ClientBuffer buffer, int pagesSent) { BufferInfo bufferInfo = buffer.getInfo(); assertEquals(bufferInfo.getBufferedPages(), 0); assertEquals(bufferInfo.getPagesSent(), pagesSent); assertEquals(bufferInfo.isFinished(), true); assertEquals(buffer.isDestroyed(), true); } private static void assertBufferResultEquals(List<? extends Type> types, BufferResult actual, BufferResult expected) { assertEquals(actual.getPages().size(), expected.getPages().size()); assertEquals(actual.getToken(), expected.getToken()); for (int i = 0; i < actual.getPages().size(); i++) { Page actualPage = actual.getPages().get(i); Page expectedPage = expected.getPages().get(i); assertEquals(actualPage.getChannelCount(), expectedPage.getChannelCount()); PageAssertions.assertPageEquals(types, actualPage, expectedPage); } assertEquals(actual.isBufferComplete(), expected.isBufferComplete()); } private static BufferResult bufferResult(long token, Page firstPage, Page... otherPages) { List<Page> pages = ImmutableList.<Page>builder().add(firstPage).add(otherPages).build(); return bufferResult(token, pages); } private static BufferResult bufferResult(long token, List<Page> pages) { checkArgument(!pages.isEmpty(), "pages is empty"); return new BufferResult(TASK_INSTANCE_ID, token, token + pages.size(), false, pages); } private static Page createPage(int i) { return new Page(BlockAssertions.createLongsBlock(i)); } private static DataSize sizeOfPages(int count) { return new DataSize(PAGE_SIZE.toBytes() * count, BYTE); } }
dabaitu/presto
presto-main/src/test/java/com/facebook/presto/execution/buffer/TestClientBuffer.java
Java
apache-2.0
15,131
package shingle import ( "container/ring" "fmt" "github.com/blevesearch/bleve/analysis" "github.com/blevesearch/bleve/registry" ) const Name = "shingle" type ShingleFilter struct { min int max int outputOriginal bool tokenSeparator string fill string ring *ring.Ring itemsInRing int } func NewShingleFilter(min, max int, outputOriginal bool, sep, fill string) *ShingleFilter { return &ShingleFilter{ min: min, max: max, outputOriginal: outputOriginal, tokenSeparator: sep, fill: fill, ring: ring.New(max), } } func (s *ShingleFilter) Filter(input analysis.TokenStream) analysis.TokenStream { rv := make(analysis.TokenStream, 0, len(input)) currentPosition := 0 for _, token := range input { if s.outputOriginal { rv = append(rv, token) } // if there are gaps, insert filler tokens offset := token.Position - currentPosition for offset > 1 { fillerToken := analysis.Token{ Position: 0, Start: -1, End: -1, Type: analysis.AlphaNumeric, Term: []byte(s.fill), } s.ring.Value = &fillerToken if s.itemsInRing < s.max { s.itemsInRing++ } rv = append(rv, s.shingleCurrentRingState()...) s.ring = s.ring.Next() offset-- } currentPosition = token.Position s.ring.Value = token if s.itemsInRing < s.max { s.itemsInRing++ } rv = append(rv, s.shingleCurrentRingState()...) s.ring = s.ring.Next() } return rv } func (s *ShingleFilter) shingleCurrentRingState() analysis.TokenStream { rv := make(analysis.TokenStream, 0) for shingleN := s.min; shingleN <= s.max; shingleN++ { // if there are enough items in the ring // to produce a shingle of this size if s.itemsInRing >= shingleN { thisShingleRing := s.ring.Move(-(shingleN - 1)) shingledBytes := make([]byte, 0) pos := 0 start := -1 end := 0 for i := 0; i < shingleN; i++ { if i != 0 { shingledBytes = append(shingledBytes, []byte(s.tokenSeparator)...) } curr := thisShingleRing.Value.(*analysis.Token) if pos == 0 && curr.Position != 0 { pos = curr.Position } if start == -1 && curr.Start != -1 { start = curr.Start } if curr.End != -1 { end = curr.End } shingledBytes = append(shingledBytes, curr.Term...) thisShingleRing = thisShingleRing.Next() } token := analysis.Token{ Type: analysis.Shingle, Term: shingledBytes, } if pos != 0 { token.Position = pos } if start != -1 { token.Start = start } if end != -1 { token.End = end } rv = append(rv, &token) } } return rv } func ShingleFilterConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.TokenFilter, error) { minVal, ok := config["min"].(float64) if !ok { return nil, fmt.Errorf("must specify min") } min := int(minVal) maxVal, ok := config["max"].(float64) if !ok { return nil, fmt.Errorf("must specify max") } max := int(maxVal) outputOriginal := false outVal, ok := config["output_original"].(bool) if ok { outputOriginal = outVal } sep := " " sepVal, ok := config["separator"].(string) if ok { sep = sepVal } fill := "_" fillVal, ok := config["filler"].(string) if ok { fill = fillVal } return NewShingleFilter(min, max, outputOriginal, sep, fill), nil } func init() { registry.RegisterTokenFilter(Name, ShingleFilterConstructor) }
pmezard/bleve
analysis/token_filters/shingle/shingle.go
GO
apache-2.0
3,459
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Linq; using System.IO; using Roslyn.Test.Utilities; using Microsoft.CodeAnalysis.Test.Utilities; using Xunit; using Microsoft.CodeAnalysis; using System.Collections.Immutable; using Roslyn.Utilities; using System.Runtime.InteropServices; using System.Globalization; namespace Microsoft.CodeAnalysis.Scripting.Hosting.UnitTests { // TODO: clean up and move to portable tests public class MetadataShadowCopyProviderTests : TestBase { private readonly MetadataShadowCopyProvider _provider; private static readonly ImmutableArray<string> s_systemNoShadowCopyDirectories = ImmutableArray.Create( FileUtilities.NormalizeDirectoryPath(Environment.GetFolderPath(Environment.SpecialFolder.Windows)), FileUtilities.NormalizeDirectoryPath(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)), FileUtilities.NormalizeDirectoryPath(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)), FileUtilities.NormalizeDirectoryPath(RuntimeEnvironment.GetRuntimeDirectory())); public MetadataShadowCopyProviderTests() { _provider = CreateProvider(CultureInfo.InvariantCulture); } private static MetadataShadowCopyProvider CreateProvider(CultureInfo culture) { return new MetadataShadowCopyProvider(TempRoot.Root, s_systemNoShadowCopyDirectories, culture); } public override void Dispose() { _provider.Dispose(); Assert.False(Directory.Exists(_provider.ShadowCopyDirectory), "Shadow copy directory should have been deleted"); base.Dispose(); } [Fact] public void Errors() { Assert.Throws<ArgumentNullException>(() => _provider.NeedsShadowCopy(null)); Assert.Throws<ArgumentException>(() => _provider.NeedsShadowCopy("c:goo.dll")); Assert.Throws<ArgumentException>(() => _provider.NeedsShadowCopy("bar.dll")); Assert.Throws<ArgumentException>(() => _provider.NeedsShadowCopy(@"\bar.dll")); Assert.Throws<ArgumentException>(() => _provider.NeedsShadowCopy(@"../bar.dll")); Assert.Throws<ArgumentNullException>(() => _provider.SuppressShadowCopy(null)); Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy("c:goo.dll")); Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy("bar.dll")); Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy(@"\bar.dll")); Assert.Throws<ArgumentException>(() => _provider.SuppressShadowCopy(@"../bar.dll")); Assert.Throws<ArgumentOutOfRangeException>(() => _provider.GetMetadataShadowCopy(@"c:\goo.dll", (MetadataImageKind)Byte.MaxValue)); Assert.Throws<ArgumentNullException>(() => _provider.GetMetadataShadowCopy(null, MetadataImageKind.Assembly)); Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy("c:goo.dll", MetadataImageKind.Assembly)); Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy("bar.dll", MetadataImageKind.Assembly)); Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy(@"\bar.dll", MetadataImageKind.Assembly)); Assert.Throws<ArgumentException>(() => _provider.GetMetadataShadowCopy(@"../bar.dll", MetadataImageKind.Assembly)); Assert.Throws<ArgumentOutOfRangeException>(() => _provider.GetMetadata(@"c:\goo.dll", (MetadataImageKind)Byte.MaxValue)); Assert.Throws<ArgumentNullException>(() => _provider.GetMetadata(null, MetadataImageKind.Assembly)); Assert.Throws<ArgumentException>(() => _provider.GetMetadata("c:goo.dll", MetadataImageKind.Assembly)); } [Fact] public void Copy() { var dir = Temp.CreateDirectory(); var dll = dir.CreateFile("a.dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01); var doc = dir.CreateFile("a.xml").WriteAllText("<hello>"); var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); var sc2 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); Assert.Equal(sc2, sc1); Assert.Equal(dll.Path, sc1.PrimaryModule.OriginalPath); Assert.NotEqual(dll.Path, sc1.PrimaryModule.FullPath); Assert.False(sc1.Metadata.IsImageOwner, "Copy expected"); Assert.Equal(File.ReadAllBytes(dll.Path), File.ReadAllBytes(sc1.PrimaryModule.FullPath)); Assert.Equal(File.ReadAllBytes(doc.Path), File.ReadAllBytes(sc1.DocumentationFile.FullPath)); } [Fact] public void SuppressCopy1() { var dll = Temp.CreateFile().WriteAllText("blah"); _provider.SuppressShadowCopy(dll.Path); var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); Assert.Null(sc1); } [Fact] public void SuppressCopy_Framework() { // framework assemblies not copied: string mscorlib = typeof(object).Assembly.Location; var sc2 = _provider.GetMetadataShadowCopy(mscorlib, MetadataImageKind.Assembly); Assert.Null(sc2); } [Fact] public void SuppressCopy_ShadowCopyDirectory() { // shadow copies not copied: var dll = Temp.CreateFile("a.dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01); // copy: var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); Assert.NotEqual(dll.Path, sc1.PrimaryModule.FullPath); // file not copied: var sc2 = _provider.GetMetadataShadowCopy(sc1.PrimaryModule.FullPath, MetadataImageKind.Assembly); Assert.Null(sc2); } [Fact] public void Modules() { // modules: { MultiModule.dll, mod2.netmodule, mod3.netmodule } var dir = Temp.CreateDirectory(); string path0 = dir.CreateFile("MultiModule.dll").WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll).Path; string path1 = dir.CreateFile("mod2.netmodule").WriteAllBytes(TestResources.SymbolsTests.MultiModule.mod2).Path; string path2 = dir.CreateFile("mod3.netmodule").WriteAllBytes(TestResources.SymbolsTests.MultiModule.mod3).Path; var metadata1 = _provider.GetMetadata(path0, MetadataImageKind.Assembly) as AssemblyMetadata; Assert.NotNull(metadata1); Assert.Equal(3, metadata1.GetModules().Length); var scDir = Directory.GetFileSystemEntries(_provider.ShadowCopyDirectory).Single(); Assert.True(Directory.Exists(scDir)); var scFiles = Directory.GetFileSystemEntries(scDir); AssertEx.SetEqual(new[] { "MultiModule.dll", "mod2.netmodule", "mod3.netmodule" }, scFiles.Select(p => Path.GetFileName(p))); foreach (var sc in scFiles) { Assert.True(_provider.IsShadowCopy(sc)); // files should be locked: Assert.Throws<IOException>(() => File.Delete(sc)); } // should get the same metadata: var metadata2 = _provider.GetMetadata(path0, MetadataImageKind.Assembly) as AssemblyMetadata; Assert.Same(metadata1, metadata2); // modify the file: File.SetLastWriteTimeUtc(path0, DateTime.Now + TimeSpan.FromHours(1)); // we get an updated image if we ask again: var modifiedMetadata3 = _provider.GetMetadata(path0, MetadataImageKind.Assembly) as AssemblyMetadata; Assert.NotSame(modifiedMetadata3, metadata2); // the file has been modified - we get new metadata: for (int i = 0; i < metadata2.GetModules().Length; i++) { Assert.NotSame(metadata2.GetModules()[i], modifiedMetadata3.GetModules()[i]); } } [Fact] public unsafe void DisposalOnFailure() { var f0 = Temp.CreateFile().WriteAllText("bogus").Path; Assert.Throws<BadImageFormatException>(() => _provider.GetMetadata(f0, MetadataImageKind.Assembly)); string f1 = Temp.CreateFile().WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll).Path; Assert.Throws<FileNotFoundException>(() => _provider.GetMetadata(f1, MetadataImageKind.Assembly)); } [Fact] public void GetMetadata() { var dir = Temp.CreateDirectory(); var dll = dir.CreateFile("a.dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01); var doc = dir.CreateFile("a.xml").WriteAllText("<hello>"); var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); var sc2 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); var md1 = _provider.GetMetadata(dll.Path, MetadataImageKind.Assembly); Assert.NotNull(md1); Assert.Equal(MetadataImageKind.Assembly, md1.Kind); // This needs to be in different folder from referencesdir to cause the other code path // to be triggered for NeedsShadowCopy method var dir2 = Path.GetTempPath(); string dll2 = Path.Combine(dir2, "a2.dll"); File.WriteAllBytes(dll2, TestResources.MetadataTests.InterfaceAndClass.CSClasses01); Assert.Equal(1, _provider.CacheSize); var sc3a = _provider.GetMetadataShadowCopy(dll2, MetadataImageKind.Module); Assert.Equal(2, _provider.CacheSize); } [Fact] public void XmlDocComments_SpecificCulture() { var elGR = CultureInfo.GetCultureInfo("el-GR"); var arMA = CultureInfo.GetCultureInfo("ar-MA"); var dir = Temp.CreateDirectory(); var dll = dir.CreateFile("a.dll").WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01); var docInvariant = dir.CreateFile("a.xml").WriteAllText("Invariant"); var docGreek = dir.CreateDirectory(elGR.Name).CreateFile("a.xml").WriteAllText("Greek"); // invariant culture var provider = CreateProvider(CultureInfo.InvariantCulture); var sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); Assert.Equal(Path.Combine(Path.GetDirectoryName(sc.PrimaryModule.FullPath), @"a.xml"), sc.DocumentationFile.FullPath); Assert.Equal("Invariant", File.ReadAllText(sc.DocumentationFile.FullPath)); // Greek culture provider = CreateProvider(elGR); sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); Assert.Equal(Path.Combine(Path.GetDirectoryName(sc.PrimaryModule.FullPath), @"el-GR\a.xml"), sc.DocumentationFile.FullPath); Assert.Equal("Greek", File.ReadAllText(sc.DocumentationFile.FullPath)); // Arabic culture (culture specific docs not found, use invariant) provider = CreateProvider(arMA); sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); Assert.Equal(Path.Combine(Path.GetDirectoryName(sc.PrimaryModule.FullPath), @"a.xml"), sc.DocumentationFile.FullPath); Assert.Equal("Invariant", File.ReadAllText(sc.DocumentationFile.FullPath)); // no culture: provider = CreateProvider(null); sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); Assert.Null(sc.DocumentationFile); } } }
lorcanmooney/roslyn
src/Scripting/CoreTest.Desktop/MetadataShadowCopyProviderTests.cs
C#
apache-2.0
12,063
<?php /** Telugu (తెలుగు) * * See MessagesQqq.php for message documentation incl. usage of parameters * To improve a translation please visit http://translatewiki.net * * @ingroup Language * @file * * @author Arjunaraoc * @author Chaduvari * @author Jprmvnvijay5 * @author Kaganer * @author Kiranmayee * @author Malkum * @author Meno25 * @author Mpradeep * @author Praveen Illa * @author Ravichandra * @author Sunil Mohan * @author The Evil IP address * @author Urhixidur * @author Veeven * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com> * @author לערי ריינהארט * @author రహ్మానుద్దీన్ * @author రాకేశ్వర * @author వైజాసత్య */ $namespaceNames = array( NS_MEDIA => 'మీడియా', NS_SPECIAL => 'ప్రత్యేక', NS_TALK => 'చర్చ', NS_USER => 'వాడుకరి', NS_USER_TALK => 'వాడుకరి_చర్చ', NS_PROJECT_TALK => '$1_చర్చ', NS_FILE => 'దస్త్రం', NS_FILE_TALK => 'దస్త్రంపై_చర్చ', NS_MEDIAWIKI => 'మీడియావికీ', NS_MEDIAWIKI_TALK => 'మీడియావికీ_చర్చ', NS_TEMPLATE => 'మూస', NS_TEMPLATE_TALK => 'మూస_చర్చ', NS_HELP => 'సహాయం', NS_HELP_TALK => 'సహాయం_చర్చ', NS_CATEGORY => 'వర్గం', NS_CATEGORY_TALK => 'వర్గం_చర్చ', ); $namespaceAliases = array( 'సభ్యులు' => NS_USER, 'సభ్యులపై_చర్చ' => NS_USER_TALK, 'సభ్యుడు' => NS_USER, # set for bug 11615 'సభ్యునిపై_చర్చ' => NS_USER_TALK, 'బొమ్మ' => NS_FILE, 'బొమ్మపై_చర్చ' => NS_FILE_TALK, 'ఫైలు' => NS_FILE, 'ఫైలుపై_చర్చ' => NS_FILE_TALK, 'సహాయము' => NS_HELP, 'సహాయము_చర్చ' => NS_HELP_TALK, ); $specialPageAliases = array( 'Allmessages' => array( 'అన్నిసందేశాలు' ), 'Allpages' => array( 'అన్నిపేజీలు' ), 'Ancientpages' => array( 'పురాతనపేజీలు' ), 'Blankpage' => array( 'ఖాళీపేజి' ), 'Block' => array( 'అడ్డగించు', 'ఐపినిఅడ్డగించు', 'వాడుకరినిఅడ్డగించు' ), 'Blockme' => array( 'నన్నుఅడ్డగించు' ), 'Booksources' => array( 'పుస్తకమూలాలు' ), 'BrokenRedirects' => array( 'తెగిపోయినదారిమార్పులు' ), 'Categories' => array( 'వర్గాలు' ), 'ChangePassword' => array( 'సంకేతపదముమార్చు' ), 'Confirmemail' => array( 'ఈమెయిలుధ్రువపరచు' ), 'CreateAccount' => array( 'ఖాతాసృష్టించు' ), 'Deadendpages' => array( 'అగాధపేజీలు' ), 'Disambiguations' => array( 'అయోమయనివృత్తి' ), 'DoubleRedirects' => array( 'రెండుసార్లుదారిమార్పు' ), 'Emailuser' => array( 'వాడుకరికిఈమెయిలుచెయ్యి' ), 'Export' => array( 'ఎగుమతి' ), 'Fewestrevisions' => array( 'అతితక్కువకూర్పులు' ), 'Import' => array( 'దిగుమతి' ), 'Listfiles' => array( 'ఫైళ్లజాబితా', 'బొమ్మలజాబితా' ), 'Listgrouprights' => array( 'గుంపుహక్కులజాబితా', 'వాడుకరులగుంపుహక్కులు' ), 'Listusers' => array( 'వాడుకరులజాబితా' ), 'Log' => array( 'చిట్టా', 'చిట్టాలు' ), 'Lonelypages' => array( 'ఒంటరిపేజీలు', 'అనాధపేజీలు' ), 'Longpages' => array( 'పొడుగుపేజీలు' ), 'MergeHistory' => array( 'చరిత్రనువిలీనంచేయి' ), 'Mostcategories' => array( 'ఎక్కువవర్గములు' ), 'Mostrevisions' => array( 'ఎక్కువకూర్పులు' ), 'Movepage' => array( 'వ్యాసమునుతరలించు' ), 'Mycontributions' => array( 'నా_మార్పులు-చేర్పులు' ), 'Mypage' => array( 'నాపేజీ' ), 'Mytalk' => array( 'నాచర్చ' ), 'Newimages' => array( 'కొత్తఫైళ్లు', 'కొత్తబొమ్మలు' ), 'Newpages' => array( 'కొత్తపేజీలు' ), 'Popularpages' => array( 'ప్రాచుర్యంపొందినపేజీలు' ), 'Preferences' => array( 'అభిరుచులు' ), 'Protectedpages' => array( 'సంరక్షితపేజీలు' ), 'Randompage' => array( 'యాదృచ్చికపేజీ' ), 'Randomredirect' => array( 'యాదుచ్చికదారిమార్పు' ), 'Recentchanges' => array( 'ఇటీవలిమార్పులు' ), 'Recentchangeslinked' => array( 'చివరిమార్పులలింకులు', 'సంబంధితమార్పులు' ), 'Revisiondelete' => array( 'కూర్పుతొలగించు' ), 'Search' => array( 'అన్వేషణ' ), 'Shortpages' => array( 'చిన్నపేజీలు' ), 'Specialpages' => array( 'ప్రత్యేకపేజీలు' ), 'Statistics' => array( 'గణాంకాలు' ), 'Uncategorizedcategories' => array( 'వర్గీకరించనివర్గములు' ), 'Uncategorizedimages' => array( 'వర్గీకరించనిఫైళ్లు', 'వర్గీకరించనిబొమ్మలు' ), 'Uncategorizedpages' => array( 'వర్గీకరించనిపేజీలు' ), 'Uncategorizedtemplates' => array( 'వర్గీకరించనిమూసలు' ), 'Unusedcategories' => array( 'వాడనివర్గములు' ), 'Unusedimages' => array( 'వాడనిఫైళ్లు', 'వాడనిబొమ్మలు' ), 'Unusedtemplates' => array( 'వాడనిమూసలు' ), 'Unwatchedpages' => array( 'వీక్షించనిపేజీలు' ), 'Upload' => array( 'ఎక్కింపు' ), 'Userlogin' => array( 'వాడుకరిప్రవేశం' ), 'Userlogout' => array( 'వాడుకరినిష్క్రమణ' ), 'Userrights' => array( 'వాడుకరిహక్కులు' ), 'Version' => array( 'కూర్పు' ), 'Wantedcategories' => array( 'కోరినవర్గాలు' ), 'Wantedfiles' => array( 'అవసరమైనఫైళ్లు' ), 'Wantedpages' => array( 'అవసరమైనపేజీలు', 'విరిగిపోయినలింకులు' ), 'Wantedtemplates' => array( 'అవసరమైననమూనాలు' ), 'Watchlist' => array( 'వీక్షణజాబితా' ), 'Whatlinkshere' => array( 'ఇక్కడికిలింకున్నపేజీలు' ), 'Withoutinterwiki' => array( 'అంతరవికీలేకుండా' ), ); $magicWords = array( 'redirect' => array( '0', '#దారిమార్పు', '#REDIRECT' ), 'notoc' => array( '0', '__విషయసూచికవద్దు__', '__NOTOC__' ), 'toc' => array( '0', '__విషయసూచిక__', '__TOC__' ), 'pagename' => array( '1', 'పేజీపేరు', 'PAGENAME' ), 'img_right' => array( '1', 'కుడి', 'right' ), 'img_left' => array( '1', 'ఎడమ', 'left' ), 'special' => array( '0', 'ప్రత్యేక', 'special' ), ); $linkTrail = "/^([\xE0\xB0\x81-\xE0\xB1\xAF]+)(.*)$/sDu"; $digitGroupingPattern = "##,##,###"; $messages = array( # User preference toggles 'tog-underline' => 'లంకె క్రీగీత:', 'tog-justify' => 'పేరాలను ఇరు పక్కలా సమానంగా సర్దు', 'tog-hideminor' => 'ఇటీవలి మార్పులలో చిన్న మార్పులను దాచిపెట్టు', 'tog-hidepatrolled' => 'ఇటీవలి మార్పులలో నిఘా ఉన్న మార్పులను దాచిపెట్టు', 'tog-newpageshidepatrolled' => 'కొత్త పేజీల జాబితా నుంచి నిఘా ఉన్న పేజీలను దాచిపెట్టు', 'tog-extendwatchlist' => 'కేవలం ఇటీవలి మార్పులే కాక, మార్పులన్నీ చూపించటానికి నా వీక్షణా జాబితాను పెద్దది చేయి', 'tog-usenewrc' => 'ఇటీవలి మార్పులు మరియు విక్షణ జాబితాలలో మార్పులను పేజీ వారిగా చూపించు (జావాస్క్రిప్టు అవసరం)', 'tog-numberheadings' => 'శీర్షికలకు ఆటోమాటిక్‌గా వరుస సంఖ్యలు పెట్టు', 'tog-showtoolbar' => 'దిద్దుబాట్లు చేసేటప్పుడు, అందుకు సహాయపడే పరికరాలపెట్టెను చూపించు (జావాస్క్రిప్టు)', 'tog-editondblclick' => 'డబుల్‌ క్లిక్కు చేసినప్పుడు పేజీని మార్చు (జావాస్క్రిప్టు)', 'tog-editsection' => '[మార్చు] లింకు ద్వారా విభాగం మార్పు కావాలి', 'tog-editsectiononrightclick' => 'విభాగం పేరు మీద కుడి క్లిక్కుతో విభాగం మార్పు కావాలి (జావాస్క్రిప్టు)', 'tog-showtoc' => 'విషయసూచిక చూపించు (3 కంటే ఎక్కువ శీర్షికలున్న పేజీలకు)', 'tog-rememberpassword' => 'ఈ విహారిణిలో నా ప్రవేశాన్ని గుర్తుంచుకో (గరిష్ఠంగా $1 {{PLURAL:$1|రోజు|రోజుల}}కి)', 'tog-watchcreations' => 'నేను సృష్టించే పేజీలను మరియు దస్త్రాలను నా వీక్షణ జాబితాకు చేర్చు', 'tog-watchdefault' => 'నేను మార్చే పేజీలను మరియు దస్త్రాలను నా వీక్షణ జాబితాకు చేర్చు', 'tog-watchmoves' => 'నేను తరలించిన పేజీలను దస్త్రాలను నా వీక్షణ జాబితాకు చేర్చు', 'tog-watchdeletion' => 'నేను తొలగించిన పేజీలను దస్త్రాలను నా వీక్షణ జాబితాకు చేర్చు', 'tog-minordefault' => 'ప్రత్యేకంగా తెలుపనంతవరకూ నా మార్పులను చిన్న మార్పులుగా గుర్తించు', 'tog-previewontop' => 'వ్యాసం మార్పుల తరువాత ఎలావుంటుందో మార్పుల‌ బాక్సుకు పైన చూపు', 'tog-previewonfirst' => 'దిద్దిబాట్లు చేసిన వ్యాసాన్ని భద్రపరిచే ముందు ఎలా వుంటుందో ఒకసారి చూపించు', 'tog-nocache' => 'విహారిణిలో పుటల కాషింగుని అచేతనంచేయి', 'tog-enotifwatchlistpages' => 'నా వీక్షణాజాబితా లోని పేజీ లేదా దస్త్రం మారినపుడు నాకు ఈ-మెయిలు పంపించు', 'tog-enotifusertalkpages' => 'నా చర్చా పేజీలో మార్పులు జరిగినపుడు నాకు ఈ-మెయిలు పంపించు', 'tog-enotifminoredits' => 'పేజీలు మరియు దస్త్రాలకు జరిగే చిన్న మార్పులకు కూడా నాకు ఈ-మెయిలును పంపించు', 'tog-enotifrevealaddr' => 'గమనింపు మెయిళ్ళలో నా ఈ-మెయిలు చిరునామాను చూపించు', 'tog-shownumberswatching' => 'వీక్షకుల సంఖ్యను చూపించు', 'tog-oldsig' => 'ప్రస్తుత సంతకం:', 'tog-fancysig' => 'సంతకాన్ని వికీపాఠ్యంగా తీసుకో (ఆటోమెటిక్‌ లింకు లేకుండా)', 'tog-uselivepreview' => 'రాస్తున్నదానిని ఎప్పటికప్పుడు సరిచూడండి (జావాస్క్రిప్టు) (పరీక్షాదశలో ఉంది)', 'tog-forceeditsummary' => 'దిద్దుబాటు సారాంశం ఖాళీగా ఉంటే ఆ విషయాన్ని నాకు సూచించు', 'tog-watchlisthideown' => 'నా మార్పులను వీక్షణా జాబితాలో చూపించొద్దు', 'tog-watchlisthidebots' => 'బాట్లు చేసిన మార్పులను నా వీక్షణా జాబితాలో చూపించొద్దు', 'tog-watchlisthideminor' => 'చిన్న మార్పులను నా వీక్షణా జాబితాలో చూపించొద్దు', 'tog-watchlisthideliu' => 'ప్రవేశించిన వాడుకరుల మార్పులను వీక్షణా జాబితాలో చూపించకు', 'tog-watchlisthideanons' => 'అజ్ఞాత వాడుకరుల మార్పులను విక్షణా జాబితాలో చూపించకు', 'tog-watchlisthidepatrolled' => 'నిఘా ఉన్న మార్పులను వీక్షణజాబితా నుంచి దాచిపెట్టు', 'tog-ccmeonemails' => 'నేను ఇతర వాడుకరులకు పంపించే ఈ-మెయిళ్ల కాపీలను నాకు కూడా పంపు', 'tog-diffonly' => 'తేడాలను చూపిస్తున్నపుడు, కింద చూపించే పేజీలోని సమాచారాన్ని చూపించొద్దు', 'tog-showhiddencats' => 'దాచిన వర్గాలను చూపించు', 'tog-norollbackdiff' => 'రద్దు చేసాక తేడాలు చూపించవద్దు', 'tog-useeditwarning' => 'ఏదైనా పేజీని నేను వదిలివెళ్తున్నప్పుడు దానిలో భద్రపరచని మార్పులు ఉంటే నన్ను హెచ్చరించు', 'underline-always' => 'ఎల్లప్పుడూ', 'underline-never' => 'ఎప్పటికీ వద్దు', 'underline-default' => 'అలంకారపు లేదా విహారిణి అప్రమేయం', # Font style option in Special:Preferences 'editfont-style' => 'దిద్దుబాటు పెట్టె ఫాంటు శైలి:', 'editfont-default' => 'విహరిణి అప్రమేయం', 'editfont-monospace' => 'మోనోస్పేసుడ్ ఫాంట్', 'editfont-sansserif' => 'సాన్స్-సెరిఫ్ ఫాంటు', 'editfont-serif' => 'సెరిఫ్ ఫాంటు', # Dates 'sunday' => 'ఆదివారం', 'monday' => 'సోమవారం', 'tuesday' => 'మంగళవారం', 'wednesday' => 'బుధవారం', 'thursday' => 'గురువారం', 'friday' => 'శుక్రవారం', 'saturday' => 'శనివారం', 'sun' => 'ఆది', 'mon' => 'సోమ', 'tue' => 'మంగళ', 'wed' => 'బుధ', 'thu' => 'గురు', 'fri' => 'శుక్ర', 'sat' => 'శని', 'january' => 'జనవరి', 'february' => 'ఫిబ్రవరి', 'march' => 'మార్చి', 'april' => 'ఏప్రిల్', 'may_long' => 'మే', 'june' => 'జూన్', 'july' => 'జూలై', 'august' => 'ఆగష్టు', 'september' => 'సెప్టెంబరు', 'october' => 'అక్టోబరు', 'november' => 'నవంబరు', 'december' => 'డిసెంబరు', 'january-gen' => 'జనవరి', 'february-gen' => 'ఫిబ్రవరి', 'march-gen' => 'మార్చి', 'april-gen' => 'ఏప్రిల్', 'may-gen' => 'మే', 'june-gen' => 'జూన్', 'july-gen' => 'జూలై', 'august-gen' => 'ఆగష్టు', 'september-gen' => 'సెప్టెంబరు', 'october-gen' => 'అక్టోబరు', 'november-gen' => 'నవంబరు', 'december-gen' => 'డిసెంబరు', 'jan' => 'జన', 'feb' => 'ఫిబ్ర', 'mar' => 'మార్చి', 'apr' => 'ఏప్రి', 'may' => 'మే', 'jun' => 'జూన్', 'jul' => 'జూలై', 'aug' => 'ఆగ', 'sep' => 'సెప్టెం', 'oct' => 'అక్టో', 'nov' => 'నవం', 'dec' => 'డిసెం', 'january-date' => 'జనవరి $1', 'february-date' => 'ఫిబ్రవరి $1', 'march-date' => 'మార్చి $1', 'april-date' => 'ఏప్రిల్ $1', 'may-date' => 'మే $1', 'june-date' => 'జూన్ $1', 'july-date' => 'జూలై $1', 'august-date' => 'ఆగస్టు $1', 'september-date' => 'సెప్టెంబర్ $1', 'october-date' => 'అక్టోబర్ $1', 'november-date' => 'నవంబర్ $1', 'december-date' => 'డిసెంబర్ $1', # Categories related messages 'pagecategories' => '{{PLURAL:$1|వర్గం|వర్గాలు}}', 'category_header' => '"$1" వర్గంలోని పుటలు', 'subcategories' => 'ఉపవర్గాలు', 'category-media-header' => '"$1" వర్గంలో ఉన్న మీడియా ఫైళ్లు', 'category-empty' => "''ప్రస్తుతం ఈ వర్గంలో ఎలాంటి పేజీలుగానీ మీడియా ఫైళ్లుగానీ లేవు.''", 'hidden-categories' => '{{PLURAL:$1|దాచిన వర్గం|దాచిన వర్గాలు}}', 'hidden-category-category' => 'దాచిన వర్గాలు', 'category-subcat-count' => '{{PLURAL:$2|ఈ వర్గంలో క్రింద చూపిస్తున్న ఒకే ఉపవర్గం ఉంది.|ఈ వర్గంలో ఉన్న మొత్తం $2 వర్గాలలో ప్రస్తుతం {{PLURAL:$1|ఒక ఉపవర్గాన్ని|$1 ఉపవర్గాలను}} చూపిస్తున్నాము.}}', 'category-subcat-count-limited' => 'ఈ వర్గం క్రింద చూపిస్తున్న {{PLURAL:$1|ఒక ఉపవర్గం ఉంది|$1 ఉపవర్గాలు ఉన్నాయి}}.', 'category-article-count' => '{{PLURAL:$2|ఈ వర్గంలో క్రింద చూపిస్తున్న ఒకే పేజీ ఉంది.|ఈ వర్గంలో ఉన్న మొత్తం $2 పేజీలలో ప్రస్తుతం {{PLURAL:$1|ఒక పేజీని|$1 పేజీలను}} చూపిస్తున్నాము.}}', 'category-article-count-limited' => 'ఈ వర్గం క్రింద చూపిస్తున్న {{PLURAL:$1|ఒక పేజీ ఉంది|$1 పేజీలు ఉన్నాయి}}.', 'category-file-count' => '{{PLURAL:$2|ఈ వర్గంలో క్రింద చూపిస్తున్న ఒకే ఫైలు ఉంది.|ఈ వర్గంలో ఉన్న మొత్తం $2 పేజీలలో ప్రస్తుతం {{PLURAL:$1|ఒక ఫైలును|$1 ఫైళ్లను}} చూపిస్తున్నాము.}}', 'category-file-count-limited' => 'ఈ వర్గం క్రింద చూపిస్తున్న {{PLURAL:$1|ఒక ఫైలు ఉంది|$1 ఫైళ్లు ఉన్నాయి}}.', 'listingcontinuesabbrev' => '(కొనసాగింపు)', 'index-category' => 'సూచీకరించిన పేజీలు', 'noindex-category' => 'సూచీకరించని పేజీలు', 'broken-file-category' => 'తెగిపోయిన ఫైలులింకులు గల పేజీలు', 'about' => 'గురించి', 'article' => 'విషయపు పేజీ', 'newwindow' => '(కొత్త కిటికీలో వస్తుంది)', 'cancel' => 'రద్దు', 'moredotdotdot' => 'ఇంకా...', 'morenotlisted' => 'ఈ జాబితా సంపూర్ణం కాదు.', 'mypage' => 'పుట', 'mytalk' => 'చర్చ', 'anontalk' => 'ఈ ఐ.పి.కి సంబంధించిన చర్చ', 'navigation' => 'మార్గదర్శకం', 'and' => '&#32;మరియు', # Cologne Blue skin 'qbfind' => 'వెతుకు', 'qbbrowse' => 'విహరించు', 'qbedit' => 'సవరించు', 'qbpageoptions' => 'ఈ పేజీ', 'qbmyoptions' => 'నా పేజీలు', 'qbspecialpages' => 'ప్రత్యేక పేజీలు', 'faq' => 'తరచూ అడిగే ప్రశ్నలు', 'faqpage' => 'Project:తరచూ అడిగే ప్రశ్నలు', # Vector skin 'vector-action-addsection' => 'విషయాన్ని చేర్చు', 'vector-action-delete' => 'తొలగించు', 'vector-action-move' => 'తరలించు', 'vector-action-protect' => 'సంరక్షించు', 'vector-action-undelete' => 'తిరిగి చేర్చు', 'vector-action-unprotect' => 'సంరక్షణను మార్చు', 'vector-simplesearch-preference' => 'సరళమైన వెతుకుడు పట్టీని చేతనంచేయి (వెక్టర్ అలంకారానికి మాత్రమే)', 'vector-view-create' => 'సృష్టించు', 'vector-view-edit' => 'సవరించు', 'vector-view-history' => 'చరిత్రను చూడండి', 'vector-view-view' => 'చదువు', 'vector-view-viewsource' => 'మూలాన్ని చూడండి', 'actions' => 'పనులు', 'namespaces' => 'పేరుబరులు', 'variants' => 'రకరకాలు', 'errorpagetitle' => 'పొరపాటు', 'returnto' => 'తిరిగి $1కి.', 'tagline' => '{{SITENAME}} నుండి', 'help' => 'సహాయం', 'search' => 'వెతుకు', 'searchbutton' => 'వెతుకు', 'go' => 'వెళ్లు', 'searcharticle' => 'వెళ్లు', 'history' => 'పేజీ చరిత్ర', 'history_short' => 'చరిత్ర', 'updatedmarker' => 'నేను కిందటిసారి వచ్చిన తరువాత జరిగిన మార్పులు', 'printableversion' => 'అచ్చుతీయదగ్గ కూర్పు', 'permalink' => 'శాశ్వత లంకె', 'print' => 'ముద్రించు', 'view' => 'చూచుట', 'edit' => 'సవరించు', 'create' => 'సృష్టించు', 'editthispage' => 'ఈ పేజీని సవరించండి', 'create-this-page' => 'ఈ పేజీని సృష్టించండి', 'delete' => 'తొలగించు', 'deletethispage' => 'ఈ పేజీని తొలగించండి', 'undelete_short' => '{{PLURAL:$1|ఒక్క రచనను|$1 రచనలను}} పునఃస్థాపించు', 'viewdeleted_short' => '{{PLURAL:$1|తొలగించిన ఒక మార్పు|$1 తొలగించిన మార్పుల}}ను చూడండి', 'protect' => 'సంరక్షించు', 'protect_change' => 'మార్చు', 'protectthispage' => 'ఈ పేజీని సంరక్షించు', 'unprotect' => 'సంరక్షణ మార్పు', 'unprotectthispage' => 'ఈ పుట సంరక్షణను మార్చండి', 'newpage' => 'కొత్త పేజీ', 'talkpage' => 'ఈ పేజీని చర్చించండి', 'talkpagelinktext' => 'చర్చ', 'specialpage' => 'ప్రత్యేక పేజీ', 'personaltools' => 'వ్యక్తిగత పనిముట్లు', 'postcomment' => 'కొత్త విభాగం', 'articlepage' => 'విషయపు పేజీని చూడండి', 'talk' => 'చర్చ', 'views' => 'చూపులు', 'toolbox' => 'పనిముట్ల పెట్టె', 'userpage' => 'వాడుకరి పేజీని చూడండి', 'projectpage' => 'ప్రాజెక్టు పేజీని చూడు', 'imagepage' => 'ఫైలు పేజీని చూడండి', 'mediawikipage' => 'సందేశం పేజీని చూడు', 'templatepage' => 'మూస పేజీని చూడు', 'viewhelppage' => 'సహాయం పేజీని చూడు', 'categorypage' => 'వర్గం పేజీని చూడు', 'viewtalkpage' => 'చర్చను చూడు', 'otherlanguages' => 'ఇతర భాషలలొ', 'redirectedfrom' => '($1 నుండి మళ్ళించబడింది)', 'redirectpagesub' => 'దారిమార్పు పుట', 'lastmodifiedat' => 'ఈ పేజీకి $2, $1న చివరి మార్పు జరిగినది.', 'viewcount' => 'ఈ పేజీ {{PLURAL:$1|ఒక్క సారి|$1 సార్లు}} దర్శించబడింది.', 'protectedpage' => 'సంరక్షణలోని పేజీ', 'jumpto' => 'ఇక్కడికి గెంతు:', 'jumptonavigation' => 'పేజీకి సంబంధించిన లింకులు', 'jumptosearch' => 'వెతుకు', 'view-pool-error' => 'క్షమించండి, ప్రస్తుతం సర్వర్లన్నీ ఓవర్‌లోడ్ అయిఉన్నాయి. చాలామంది వాడుకరులు ఈ పేజీని చూస్తున్నారు. ఈ పేజీని వీక్షించడానికి కొద్దిసేపు నిరీక్షించండి. $1', 'pool-timeout' => 'తాళం కొరకు వేచివుండడానికి కాలపరిమితి అయిపోయింది', 'pool-queuefull' => 'సమూహపు వరుస నిండుగా ఉంది', 'pool-errorunknown' => 'గుర్తుతెలియని పొరపాటు', # All link text and link target definitions of links into project namespace that get used by other message strings, with the exception of user group pages (see grouppage). 'aboutsite' => '{{SITENAME}} గురించి', 'aboutpage' => 'Project:గురించి', 'copyright' => 'విషయ సంగ్రహం $1 కి లోబడి లభ్యం.', 'copyrightpage' => '{{ns:project}}:ప్రచురణ హక్కులు', 'currentevents' => 'ఇప్పటి ముచ్చట్లు', 'currentevents-url' => 'Project:ఇప్పటి ముచ్చట్లు', 'disclaimers' => 'అస్వీకారములు', 'disclaimerpage' => 'Project:సాధారణ నిష్పూచీ', 'edithelp' => 'దిద్దుబాటు సహాయం', 'helppage' => 'Help:సూచిక', 'mainpage' => 'మొదటి పేజీ', 'mainpage-description' => 'తలపుట', 'policy-url' => 'Project:విధానం', 'portal' => 'సముదాయ పందిరి', 'portal-url' => 'Project:సముదాయ పందిరి', 'privacy' => 'గోప్యతా విధానం', 'privacypage' => 'Project:గోప్యతా విధానం', 'badaccess' => 'అనుమతి లోపం', 'badaccess-group0' => 'మీరు చేయతలపెట్టిన పనికి మీకు హక్కులు లేవు.', 'badaccess-groups' => 'మీరు చేయతలపెట్టిన పని ఈ {{PLURAL:$2|గుంపు|గుంపుల}} లోని వాడుకర్లకు మాత్రమే పరిమితం: $1.', 'versionrequired' => 'మీడియావికీ సాఫ్టువేరు వెర్షను $1 కావాలి', 'versionrequiredtext' => 'ఈ పేజీని వాడటానికి మీకు మీడియావికీ సాఫ్టువేరు వెర్షను $1 కావాలి. [[Special:Version|వెర్షను పేజీ]]ని చూడండి.', 'ok' => 'సరే', 'retrievedfrom' => '"$1" నుండి వెలికితీశారు', 'youhavenewmessages' => 'మీకు $1 ఉన్నాయి ($2).', 'newmessageslink' => 'కొత్త సందేశాలు', 'newmessagesdifflink' => 'చివరి మార్పు', 'youhavenewmessagesfromusers' => 'మీకు {{PLURAL:$3|మరో వాడుకరి|$3 వాడుకరుల}} నుండి $1 ($2).', 'youhavenewmessagesmanyusers' => 'మీకు చాలా వాడుకరుల నుండి $1 ($2).', 'newmessageslinkplural' => '{{PLURAL:$1|ఒక కొత్త సందేశం వచ్చింది|కొత్త సందేశాలు ఉన్నాయి}}', 'newmessagesdifflinkplural' => 'చివరి {{PLURAL:$1|మార్పు|మార్పులు}}', 'youhavenewmessagesmulti' => '$1లో మీకో సందేశం ఉంది', 'editsection' => 'మార్చు', 'editold' => 'సవరించు', 'viewsourceold' => 'మూలాన్ని చూడండి', 'editlink' => 'సవరించు', 'viewsourcelink' => 'మూలాన్ని చూడండి', 'editsectionhint' => 'విభాగాన్ని మార్చు: $1', 'toc' => 'విషయ సూచిక', 'showtoc' => 'చూపించు', 'hidetoc' => 'దాచు', 'collapsible-collapse' => 'కుదించు', 'collapsible-expand' => 'విస్తరించు', 'thisisdeleted' => '$1ను చూస్తారా, పునఃస్థాపిస్తారా?', 'viewdeleted' => '$1 చూస్తారా?', 'restorelink' => '{{PLURAL:$1|ఒక తొలగించిన మార్పు|$1 తొలగించిన మార్పులు}}', 'feedlinks' => 'ఫీడు:', 'feed-invalid' => 'మీరు కోరిన ఫీడు సరైన రకం కాదు.', 'feed-unavailable' => 'సిండికేషన్ ఫీడులేమీ అందుబాటులో లేవు.', 'site-rss-feed' => '$1 RSS ఫీడు', 'site-atom-feed' => '$1 ఆటమ్ ఫీడు', 'page-rss-feed' => '"$1" ఆరెసెస్సు(RSS) ఫీడు', 'page-atom-feed' => '"$1" ఆటమ్ ఫీడు', 'red-link-title' => '$1 (పుట లేదు)', 'sort-descending' => 'అవరోహణ క్రమంలో అమర్చు', 'sort-ascending' => 'ఆరోహణ క్రమంలో అమర్చు', # Short words for each namespace, by default used in the namespace tab in monobook 'nstab-main' => 'పేజీ', 'nstab-user' => 'వాడుకరి పేజీ', 'nstab-media' => 'మీడియా పేజీ', 'nstab-special' => 'ప్రత్యేక పేజీ', 'nstab-project' => 'ప్రాజెక్టు పేజీ', 'nstab-image' => 'దస్త్రం', 'nstab-mediawiki' => 'సందేశం', 'nstab-template' => 'మూస', 'nstab-help' => 'సహాయము', 'nstab-category' => 'వర్గం', # Main script and global functions 'nosuchaction' => 'అటువంటి కార్యం లేదు', 'nosuchactiontext' => 'మీరు URLలో పేర్కొన్న కార్యం సరైనది కాదు. మీరు URLని తప్పుగా టైపు చేసివుండవచ్చు లేదా తప్పుడు లింకుని అనుసరించివుండొచ్చు. {{SITENAME}} ఉపయోగించే మృదుపరికరంలో దోషమైనా అయివుండవచ్చు.', 'nosuchspecialpage' => 'అటువంటి ప్రత్యేక పేజీ లేదు', 'nospecialpagetext' => '<strong>మీరు అడిగిన ప్రత్యేకపేజీ సరైనది కాదు.</strong> సరైన ప్రత్యేకపేజీల జాబితా [[Special:SpecialPages|{{int:specialpages}}]] వద్ద ఉంది.', # General errors 'error' => 'లోపం', 'databaseerror' => 'డేటాబేసు లోపం', 'laggedslavemode' => 'హెచ్చరిక: పేజీలో ఇటీవల జరిగిన మార్పులు ఉండకపోవచ్చు.', 'readonly' => 'డేటాబేసు లాక్‌చెయ్యబడింది', 'enterlockreason' => 'డేటాబేసుకు వేయబోతున్న లాకుకు కారణం తెలుపండి, దానితోపాటే ఎంతసమయం తరువాత ఆ లాకు తీసేస్తారో కూడా తెలుపండి', 'readonlytext' => 'డేటాబేసు ప్రస్తుతం లాకు చేయబడింది. మార్పులు, చేర్పులు ప్రస్తుతం చెయ్యలేరు. మామూలుగా జరిగే నిర్వహణ కొరకు ఇది జరిగి ఉండవచ్చు; అది పూర్తి కాగానే తిరిగి మామూలుగా పనిచేస్తుంది. దీనిని లాకు చేసిన నిర్వాహకుడు ఇలా తెలియజేస్తున్నాడు: $1', 'missing-article' => '"$1" $2 అనే పేజీ పాఠ్యం డేటాబేసులో దొరకలేదు. కాలదోషం పట్టిన తేడా కోసం చూసినపుడుగానీ, తొలగించిన పేజీ చరితం కోసం చూసినపుడుగానీ ఇది సాధారణంగా జరుగుతుంది. ఒకవేళ అలా కాకపోతే, మీరో బగ్‌ను కనుక్కున్నట్టే. ఈ URLను సూచిస్తూ, దీన్ని ఓ [[Special:ListUsers/sysop|నిర్వాహకునికి]] తెలియజెయ్యండి.', 'missingarticle-rev' => '(కూర్పు#: $1)', 'missingarticle-diff' => '(తేడా: $1, $2)', 'readonly_lag' => 'అనుచర (స్లేవ్) డేటాబేసు సర్వర్లు, ప్రధాన (మాస్టరు) సర్వరును అందుకునేందుకుగాను, డేటాబేసు ఆటోమాటిక్‌గా లాకు అయింది.', 'internalerror' => 'అంతర్గత లోపం', 'internalerror_info' => 'అంతర్గత లోపం: $1', 'fileappenderrorread' => 'చేరుస్తున్నప్పుడు "$1"ని చదవలేకపోయాం.', 'fileappenderror' => '"$1" ని "$2" తో కూర్చలేకపోతున్నాం', 'filecopyerror' => 'ఫైలు "$1"ని "$2"కు కాపీ చెయ్యటం కుదరలేదు.', 'filerenameerror' => 'ఫైలు "$1" పేరును "$2"గా మార్చటం కుదరలేదు.', 'filedeleteerror' => 'ఫైలు "$1"ని తీసివేయటం కుదరలేదు.', 'directorycreateerror' => '"$1" అనే డైరెక్టరీని సృష్టించలేక పోతున్నాను.', 'filenotfound' => 'ఫైలు "$1" కనబడలేదు.', 'fileexistserror' => '"$1" అనే ఫైలు ఉంది, కాని అందులోకి రాయలేకపోతున్నాను', 'unexpected' => 'అనుకోని విలువ: "$1"="$2".', 'formerror' => 'లోపం: ఈ ఫారాన్ని పంపించలేకపోతున్నాను', 'badarticleerror' => 'ఈ పేజీపై ఈ పని చేయడం కుదరదు.', 'cannotdelete' => '"$1" అనే పేజీ లేదా ఫైలుని తొలగించలేకపోయాం. దాన్ని ఇప్పటికే ఎవరైనా తొలగించి ఉండవచ్చు.', 'cannotdelete-title' => '"$1" పుటను తొలగించలేరు', 'badtitle' => 'తప్పు శీర్షిక', 'badtitletext' => 'మీరు కోరిన పుట యొక్క పేరు చెల్లనిది, ఖాళీగా ఉంది, లేదా తప్పుగా ఇచ్చిన అంతర్వికీ లేదా అంతర-భాషా శీర్షిక అయివుండాలి. శీర్షికలలో ఉపయోగించకూడని అక్షరాలు దానిలో ఉండివుండొచ్చు.', 'perfcached' => 'కింది డేటా ముందే సేకరించి పెట్టుకున్నది. కాబట్టి తాజా డేటాతో పోలిస్తే తేడాలుండవచ్చు. A maximum of {{PLURAL:$1|one result is|$1 results are}} available in the cache.', 'perfcachedts' => 'కింది సమాచారం ముందే సేకరించి పెట్టుకున్నది. దీన్ని $1న చివరిసారిగా తాజాకరించారు. A maximum of {{PLURAL:$4|one result is|$4 results are}} available in the cache.', 'querypage-no-updates' => 'ప్రస్తుతం ఈ పుటకి తాజాకరణలని అచేతనం చేసారు. ఇక్కడున్న భోగట్టా కూడా తాజాకరించబడదు.', 'wrong_wfQuery_params' => 'wfQuery()కి తప్పుడు పారామీటర్లు వచ్చాయి<br /> ఫంక్షను: $1<br /> క్వీరీ: $2', 'viewsource' => 'మూలాన్ని చూపించు', 'viewsource-title' => '$1 యొక్క సోర్సు చూడండి', 'actionthrottled' => 'కార్యాన్ని ఆపేసారు', 'actionthrottledtext' => 'స్పామును తగ్గించటానికి తీసుకున్న నిర్ణయాల వల్ల, మీరు ఈ కార్యాన్ని అతి తక్కువ సమయంలో బోలెడన్ని సార్లు చేయకుండా అడ్డుకుంటున్నాము. కొన్ని నిమిషాలు ఆగి మరలా ప్రయత్నించండి.', 'protectedpagetext' => 'ఈ పేజీని మార్చకుండా ఉండేందుకు సంరక్షించారు.', 'viewsourcetext' => 'మీరీ పేజీ సోర్సును చూడవచ్చు, కాపీ చేసుకోవచ్చు:', 'viewyourtext' => "ఈ పేజీకి '''మీ మార్పుల''' యొక్క మూలాన్ని చూడవచ్చు లేదా కాపీచేసుకోవచ్చు:", 'protectedinterface' => 'సాఫ్టువేరు ఇంటరుఫేసుకు చెందిన టెక్స్టును ఈ పేజీ అందిస్తుంది. దుశ్చర్యల నివారణ కోసమై దీన్ని లాకు చేసాం.', 'editinginterface' => "'''హెచ్చరిక''': సాఫ్టువేరుకు ఇంటరుఫేసు టెక్స్టును అందించే పేజీని మీరు సరిదిద్దుతున్నారు. ఈ పేజీలో చేసే మార్పుల వల్ల ఇతర వాడుకరులకు ఇంటరుఫేసు కనబడే విధానంలో తేడావస్తుంది. అనువాదాల కొరకైతే, [//translatewiki.net/wiki/Main_Page?setlang=te ట్రాన్స్‌లేట్ వికీ.నెట్], మీడియావికీ స్థానికీకరణ ప్రాజెక్టు, ని వాడండి.", 'cascadeprotected' => 'కింది {{PLURAL:$1|పేజీని|పేజీలను}} కాస్కేడింగు ఆప్షనుతో చేసి సంరక్షించారు. ప్రస్తుత పేజీ, ఈ పేజీల్లో ఇంక్లూడు అయి ఉంది కాబట్టి, దిద్దుబాటు చేసే వీలు లేకుండా ఇది కూడా రక్షణలో ఉంది. $2', 'namespaceprotected' => "'''$1''' నేంస్పేసులో మార్పులు చేయటానికి మీకు అనుమతి లేదు.", 'ns-specialprotected' => 'ప్రత్యేక పేజీలపై దిద్దుబాట్లు చేయలేరు.', 'titleprotected' => "సభ్యులు [[User:$1|$1]] ఈ పేజీని సృష్టించనివ్వకుండా నిరోదిస్తున్నారు. అందుకు ఇచ్చిన కారణం: ''$2''.", 'exception-nologin' => 'లోనికి ప్రవేశించిలేరు', 'exception-nologin-text' => 'ఈ వికీలో ఈ పేజీ లేదా పనికి మీరు తప్పనిసరిగా ప్రవేశించివుండాలి.', # Virus scanner 'virus-badscanner' => "తప్పుడు స్వరూపణం: తెలియని వైరస్ స్కానర్: ''$1''", 'virus-scanfailed' => 'స్కాన్ విఫలమైంది (సంకేతం $1)', 'virus-unknownscanner' => 'అజ్ఞాత యాంటీవైరస్:', # Login and logout pages 'logouttext' => "'''ఇప్పుడు మీరు నిష్క్రమించారు.''' మీరు {{SITENAME}}ని అజ్ఞాతంగా వాడుతూండొచ్చు, లేదా ఇదే వాడుకరిగా కానీ లేదా వేరే వాడుకరిగా కానీ <span class='plainlinks'>[$1 మళ్ళీ ప్రవేశించవచ్చు]</span>. అయితే, మీ విహారిణిలోని కోశాన్ని శుభ్రపరిచే వరకు కొన్ని పేజీలు మీరింకా ప్రవేశించి ఉన్నట్లుగానే చూపించవచ్చని గమనించండి.", 'welcomeuser' => 'స్వాగతం, $1!', 'welcomecreation-msg' => 'మీ ఖాతాని సృష్టించాం. మీ [[Special:Preferences|{{SITENAME}} అభిరుచులను]] మార్చుకోవడం మరువకండి. తెలుగు వికీపీడియాలో తెలుగులోనే రాయాలి. వికీలో రచనలు చేసే ముందు, కింది సూచనలను గమనించండి. తెలుగు {{SITENAME}}లో తెలుగులోనే రాయాలి. వికీలో రచనలు చేసే ముందు, కింది సూచనలను గమనించండి. *వికీని త్వరగా అర్థం చేసుకునేందుకు [[వికీపీడియా:5 నిమిషాల్లో వికీ|5 నిమిషాల్లో వికీ]] పేజీని చూడండి. *తెలుగులో రాసేందుకు ఇంగ్లీషు అక్షరాల ఉచ్ఛారణతో తెలుగు టైపు చేసే [[వికీపీడియా:టైపింగు సహాయం| టైపింగ్ సహాయం]] వాడవచ్చు. మరిన్ని ఉపకరణాల కొరకు [[కీ బోర్డు]] మరియు తెరపై తెలుగు సరిగా లేకపోతే[[వికీపీడియా:Setting up your browser for Indic scripts|ఈ పేజీ]] చూడండి.', 'yourname' => 'వాడుకరి పేరు:', 'userlogin-yourname' => 'వాడుకరి పేరు', 'userlogin-yourname-ph' => 'మీ వాడుకరి పేరును ఇవ్వండి', 'yourpassword' => 'సంకేతపదం:', 'userlogin-yourpassword' => 'సంకేతపదం', 'userlogin-yourpassword-ph' => 'మీ సంకేతపదాన్ని ఇవ్వండి', 'createacct-yourpassword-ph' => 'సంకేతపదాన్ని ఇవ్వండి', 'yourpasswordagain' => 'సంకేతపదాన్ని మళ్ళీ ఇవ్వండి:', 'createacct-yourpasswordagain' => 'సంకేతపదాన్ని నిర్ధారించండి', 'createacct-yourpasswordagain-ph' => 'సంకేతపదాన్ని మళ్ళీ ఇవ్వండి', 'remembermypassword' => 'ఈ కంప్యూటరులో నా ప్రవేశాన్ని గుర్తుంచుకో (గరిష్ఠంగా $1 {{PLURAL:$1|రోజు|రోజుల}}కి)', 'userlogin-remembermypassword' => 'నన్ను ప్రవేశింపజేసి ఉంచు', 'yourdomainname' => 'మీ డోమైను', 'password-change-forbidden' => 'ఈ వికీలో మీరు సంకేతపదాలను మార్చలేరు.', 'externaldberror' => 'డేటాబేసు అధీకరణలో పొరపాటు జరిగింది లేదా మీ బయటి ఖాతాని తాజాకరించడానికి మీకు అనుమతి లేదు.', 'login' => 'లోనికి రండి', 'nav-login-createaccount' => 'లోనికి ప్రవేశించండి / ఖాతాని సృష్టించుకోండి', 'loginprompt' => '{{SITENAME}}లోకి ప్రవేశించాలంటే మీ విహారిణిలో కూకీలు చేతనమై ఉండాలి.', 'userlogin' => 'ప్రవేశించండి / ఖాతాను సృష్టించుకోండి', 'userloginnocreate' => 'ప్రవేశించండి', 'logout' => 'నిష్క్రమించు', 'userlogout' => 'నిష్క్రమించు', 'notloggedin' => 'లోనికి ప్రవేశించి లేరు', 'userlogin-noaccount' => 'మీకు ఖాతా లేదా?', 'userlogin-joinproject' => '{{SITENAME}}లో చేరండి', 'nologin' => 'ఖాతా లేదా? $1.', 'nologinlink' => 'ఖాతాని సృష్టించుకోండి', 'createaccount' => 'ఖాతాని సృష్టించు', 'gotaccount' => 'ఇప్పటికే మీకు ఖాతా ఉందా? $1.', 'gotaccountlink' => 'ప్రవేశించండి', 'userlogin-resetlink' => 'మీ ప్రవేశ వివరాలను మరచిపోయారా?', 'userlogin-resetpassword-link' => 'మీ దాటుమాటను మార్చుకోండి', 'helplogin-url' => 'Help:ప్రవేశించడం', 'userlogin-helplink' => '[[{{MediaWiki:helplogin-url}}|ప్రవేశించడానికి సహాయం]]', 'createacct-join' => 'మీ సమాచారాన్ని క్రింద ఇవ్వండి.', 'createacct-emailrequired' => 'ఈమెయిలు చిరునామా', 'createacct-emailoptional' => 'ఈమెయిలు చిరునామా (ఐచ్చికం)', 'createacct-email-ph' => 'మీ ఈమెయిలు చిరునామాను ఇవ్వండి', 'createaccountmail' => 'తాత్కాలిక యాదృచ్చిక సంకేతపదాన్ని వాడి దాన్ని ఈ క్రింద ఇచ్చిన ఈమెయిలు చిరునామాకు పంపించు', 'createacct-realname' => 'అసలు పేరు (ఐచ్చికం)', 'createaccountreason' => 'కారణం:', 'createacct-reason' => 'కారణం', 'createacct-reason-ph' => 'మీరు మరో ఖాతాను ఎందుకు సృష్టించుకుంటున్నారు', 'createacct-captcha' => 'భద్రతా తనిఖీ', 'createacct-imgcaptcha-ph' => 'పైన కనబడే మాటలను ఇక్కడ ఇవ్వండి', 'createacct-submit' => 'మీ ఖాతాను సృష్టించుకోండి', 'createacct-benefit-heading' => '{{SITENAME}}ను తయారుచేసేది మీలాంటి ప్రజలే.', 'createacct-benefit-body1' => '{{PLURAL:$1|మార్పు|మార్పులు}}', 'createacct-benefit-body2' => '{{PLURAL:$1|పేజీ|పేజీలు}}', 'badretype' => 'మీరు ఇచ్చిన రెండు సంకేతపదాలు ఒకదానితో మరొకటి సరిపోలడం లేదు.', 'userexists' => 'ఇచ్చిన వాడుకరిపేరు ఇప్పటికే వాడుకలో ఉంది. వేరే పేరును ఎంచుకోండి.', 'loginerror' => 'ప్రవేశంలో పొరపాటు', 'createacct-error' => 'పద్దు తెరవడములో తప్పు', 'createaccounterror' => 'ఖాతాని సృష్టించలేకపోయాం: $1', 'nocookiesnew' => 'ఖాతాని సృష్టించాం, కానీ మీరు ఇంకా లోనికి ప్రవేశించలేదు. వాడుకరుల ప్రవేశానికి {{SITENAME}} కూకీలను వాడుతుంది. మీరు కూకీలని అచేతనం చేసివున్నారు. దయచేసి వాటిని చేతనంచేసి, మీ కొత్త వాడుకరి పేరు మరియు సంకేతపదాలతో లోనికి ప్రవేశించండి.', 'nocookieslogin' => 'వాడుకరుల ప్రవేశానికై {{SITENAME}} కూకీలను వాడుతుంది. మీరు కుకీలని అచేతనం చేసివున్నారు. వాటిని చేతనంచేసి ప్రయత్నించండి.', 'nocookiesfornew' => 'మూలాన్ని కనుక్కోలేకపోయాం కాబట్టి, ఈ వాడుకరి ఖాతాను సృష్టించలేకపోయాం. మీ కంప్యూటర్లో కూకీలు చేతనమై ఉన్నాయని నిశ్చయించుకొని, ఈ పేజీని తిరిగి లోడు చేసి, మళ్ళీ ప్రయత్నించండి.', 'noname' => 'మీరు సరైన వాడుకరిపేరు ఇవ్వలేదు.', 'loginsuccesstitle' => 'ప్రవేశం విజయవంతమైనది', 'loginsuccess' => "'''మీరు ఇప్పుడు {{SITENAME}}లోనికి \"\$1\"గా ప్రవేశించారు.'''", 'nosuchuser' => '"$1" అనే పేరుతో వాడుకరులు లేరు. వాడుకరి పేర్లు కేస్ సెన్సిటివ్. అక్షరక్రమం సరిచూసుకోండి, లేదా [[Special:UserLogin/signup|కొత్త ఖాతా సృష్టించుకోండి]].', 'nosuchusershort' => '"$1" అనే పేరుతో సభ్యులు లేరు. పేరు సరి చూసుకోండి.', 'nouserspecified' => 'సభ్యనామాన్ని తప్పనిసరిగా ఎంచుకోవాలి.', 'login-userblocked' => 'ఈ వాడుకరిని నిరోధించారు. ప్రవేశానికి అనుమతి లేదు.', 'wrongpassword' => 'ఈ సంకేతపదం సరైనది కాదు. దయచేసి మళ్లీ ప్రయత్నించండి.', 'wrongpasswordempty' => 'ఖాళీ సంకేతపదం ఇచ్చారు. మళ్ళీ ప్రయత్నించండి.', 'passwordtooshort' => 'మీ సంకేతపదం కనీసం {{PLURAL:$1|1 అక్షరం|$1 అక్షరాల}} పొడవు ఉండాలి.', 'password-name-match' => 'మీ సంకేతపదం మీ వాడుకరిపేరుకి భిన్నంగా ఉండాలి.', 'password-login-forbidden' => 'ఈ వాడుకరిపేరు మరియు సంకేతపదాలను ఉపయోగించడం నిషిద్ధం.', 'mailmypassword' => 'కొత్త సంకేతపదాన్ని ఈ-మెయిల్లో పంపించు', 'passwordremindertitle' => '{{SITENAME}} కోసం కొత్త తాత్కాలిక సంకేతపదం', 'passwordremindertext' => '{{SITENAME}} ($4) లో కొత్త సంకేతపదం పంపించమని ఎవరో (బహుశ మీరే, ఐ.పీ. చిరునామా $1 నుండి) అడిగారు. వాడుకరి "$2" కొరకు "$3" అనే తాత్కాలిక సంకేతపదం సిద్ధంచేసి ఉంచాం. మీ ఉద్దేశం అదే అయితే, ఇప్పుడు మీరు సైటులోనికి ప్రవేశించి కొత్త సంకేతపదాన్ని ఎంచుకోవచ్చు. మీ తాత్కాలిక సంకేతపదం {{PLURAL:$5|ఒక రోజు|$5 రోజుల}}లో కాలంచెల్లుతుంది. ఒకవేళ ఈ అభ్యర్థన మీరుకాక మరెవరో చేసారనుకున్నా లేదా మీ సంకేతపదం మీకు గుర్తుకువచ్చి దాన్ని మార్చకూడదు అనుకుంటున్నా, ఈ సందేశాన్ని మర్చిపోయి మీ పాత సంకేతపదాన్ని వాడడం కొనసాగించవచ్చు.', 'noemail' => 'సభ్యులు "$1"కు ఈ-మెయిలు చిరునామా నమోదయి లేదు.', 'noemailcreate' => 'మీరు సరైన ఈమెయిల్ చిరునామాని ఇవ్వాలి', 'passwordsent' => '"$1" కొరకు నమోదైన ఈ-మెయిలు చిరునామాకి కొత్త సంకేతపదాన్ని పంపించాం. అది అందిన తర్వాత ప్రవేశించి చూడండి.', 'blocked-mailpassword' => 'దిద్దుబాట్లు చెయ్యకుండా ఈ ఐపీఅడ్రసును నిరోధించాం. అంచేత, దుశ్చర్యల నివారణ కోసం గాను, మరచిపోయిన సంకేతపదాన్ని పొందే అంశాన్ని అనుమతించము.', 'eauthentsent' => 'ఇచ్చిన ఈ-మెయిలు అడ్రసుకు ధృవీకరణ మెయిలు వెళ్ళింది. మరిన్ని మెయిళ్ళు పంపే ముందు, మీరు ఆ మెయిల్లో సూచించినట్లుగా చేసి, ఈ చిరునామా మీదేనని ధృవీకరించండి.', 'throttled-mailpassword' => 'గడచిన {{PLURAL:$1|ఒక గంటలో|$1 గంటల్లో}} ఇప్పటికే దాటుమాట మార్చినట్లుగా ఒక మెయిల్  పంపించివున్నాం. దుశ్చర్యలను నివారించేందుకు గాను, {{PLURAL:$1|ఒక గంటకి|$1 గంటలకి}} ఒక్కసారి మాత్రమే దాటుమాట మార్పు మెయిల్ పంపిస్తాము.', 'mailerror' => 'మెయిలు పంపించడంలో లోపం: $1', 'acct_creation_throttle_hit' => 'మీ ఐపీ చిరునామా వాడుతున్న ఈ వికీ సందర్శకులు గత ఒక్క రోజులో {{PLURAL:$1|1 ఖాతాని|$1 ఖాతాలను}} సృష్టించారు, ఈ కాల వ్యవధిలో అది గరిష్ఠ పరిమితి. అందువల్ల, ఈ ఐపీని వాడుతున్న సందర్శకులు ప్రస్తుతానికి ఇంక ఖాతాలని సృష్టించలేరు.', 'emailauthenticated' => 'మీ ఈ-మెయిలు చిరునామా $2న $3కి ధృవీకరింపబడింది.', 'emailnotauthenticated' => 'మీ ఈ-మెయిలు చిరునామాను ఇంకా ధృవీకరించలేదు. కాబట్టి కింద పేర్కొన్న అంశాలకు ఎటువంటి ఈ-మెయులునూ పంపించము.', 'noemailprefs' => 'కింది అంశాలు పని చెయ్యటానికి ఈ-మెయిలు చిరునామాను నమొదుచయ్యండి.', 'emailconfirmlink' => 'మీ ఈ-మెయిలు చిరునామాను ధృవీకరించండి', 'invalidemailaddress' => 'మీరు ఇచ్చిన ఈ-మెయిలు చిరునామా సరైన రీతిలో లేనందున అంగీకరించటంలేదు. దయచేసి ఈ-మెయిలు చిరునామాను సరైన రీతిలో ఇవ్వండి లేదా ఖాళీగా వదిలేయండి.', 'cannotchangeemail' => 'ఈ వికీలో ఖాతా ఈ-మెయిలు చిరునామాను మార్చుకోలేరు.', 'emaildisabled' => 'ఈ సైటు ఈమెయిళ్ళను పంపించలేదు.', 'accountcreated' => 'ఖాతాని సృష్టించాం', 'accountcreatedtext' => '$1 కి వాడుకరి ఖాతాని సృష్టించాం.', 'createaccount-title' => '{{SITENAME}} కోసం ఖాతా సృష్టి', 'createaccount-text' => '{{SITENAME}} ($4) లో ఎవరో మీ ఈమెయిలు చిరునామాకి "$2" అనే పేరుగల ఖాతాని "$3" అనే సంకేతపదంతో సృష్టించారు. మీరు లోనికి ప్రవేశించి మీ సంకేతపదాన్ని ఇప్పుడే మార్చుకోవాలి. ఈ ఖాతాని పొరపాటున సృష్టిస్తే గనక, ఈ సందేశాన్ని పట్టించుకోకండి.', 'usernamehasherror' => 'వాడుకరిపేరులో హాష్ అక్షరాలు ఉండకూడదు', 'login-throttled' => 'గత కొద్దిసేపటి నుండి మీరు చాలా ప్రవేశ ప్రయత్నాలు చేసారు. మళ్ళీ ప్రయత్నించే ముందు కాసేపు వేచివుండండి.', 'login-abort-generic' => 'మీ లాగిన్ ప్రయత్నం విఫలమైంది - ఆగిపోయింది', 'loginlanguagelabel' => 'భాష: $1', 'suspicious-userlogout' => 'సరిగా పనిచేయని విహారిణి లేదా కాషింగ్ ప్రాక్సీ వల్ల పంపబడడం చేత, నిష్క్రమించాలనే మీ అభ్యర్థనని నిరాకరించారు.', # Email sending 'php-mail-error-unknown' => 'PHP యొక్క mail() ఫంక్షన్‍లో ఏదో తెలియని లోపం దొర్లింది', 'user-mail-no-addy' => 'ఈ-మెయిలు చిరునామాని ఇవ్వకుండానే ఈ-మెయిలు పంపడానికి ప్రయత్నించారు.', # Change password dialog 'resetpass' => 'సంకేతపదాన్ని మార్చండి', 'resetpass_announce' => 'మీకు పంపిన తాత్కాలిక సంకేతంతో ప్రవేశించివున్నారు. ప్రవేశాన్ని పూర్తిచేసేందుకు, మీరు తప్పనిసరిగా ఇక్కడ కొత్త సంకేతపదాన్ని అమర్చుకోవాలి:', 'resetpass_header' => 'ఖాతా సంకేతపదం మార్పు', 'oldpassword' => 'పాత సంకేతపదం:', 'newpassword' => 'కొత్త సంకేతపదం:', 'retypenew' => 'సంకేతపదం, మళ్ళీ', 'resetpass_submit' => 'సంకేతపదాన్ని మార్చి లోనికి ప్రవేశించండి', 'changepassword-success' => 'మీ సంకేతపదాన్ని జయప్రదంగా మార్చాం! ఇక మిమ్మల్ని లోనికి ప్రవేశింపచేస్తున్నాం...', 'resetpass_forbidden' => 'సంకేతపదాలను మార్చటం కుదరదు', 'resetpass-no-info' => 'ఈ పేజీని నేరుగా చూడటానికి మీరు లోనికి ప్రవేశించివుండాలి.', 'resetpass-submit-loggedin' => 'సంకేతపదాన్ని మార్చు', 'resetpass-submit-cancel' => 'రద్దుచేయి', 'resetpass-wrong-oldpass' => 'తప్పుడు తాత్కాలిక లేదా ప్రస్తుత సంకేతపదం. మీరు మీ సంకేతపదాన్ని ఇప్పటికే విజయవంతంగా మార్చుకొనివుండవచ్చు లేదా కొత్త తాత్కాలిక సంకేతపదం కోసం అభ్యర్థించారు.', 'resetpass-temp-password' => 'తాత్కాలిక సంకేతపదం:', # Special:PasswordReset 'passwordreset' => 'సంకేతపదాన్ని మార్చుకోండి', 'passwordreset-legend' => 'సంకేతపదాన్ని మార్చుకోండి', 'passwordreset-disabled' => 'ఈ వికీలో సంకేతపదాల మార్పును అచేతనం చేసాం.', 'passwordreset-username' => 'వాడుకరి పేరు:', 'passwordreset-domain' => 'డొమైన్:', 'passwordreset-email' => 'ఈ-మెయిలు చిరునామా:', 'passwordreset-emailtitle' => '{{SITENAME}}లో ఖాతా వివరాలు', 'passwordreset-emailtext-ip' => 'ఎవరో (బహుశా మీరే, ఐపీ అడ్రసు $1 నుంచి) {{SITENAME}} ($4) లో మీ ఖాతా వివరాలను చెప్పమంటూ అడిగారు. కింది వాడుకరి {{PLURAL:$3|ఖాతా|ఖాతాలు}} ఈ ఈమెయిలు అడ్రసుతో అనుసంధింపబడి ఉన్నాయి: $2 {{PLURAL:$3|ఈ తాత్కాలిక సంకేతపదానికి|ఈ తాత్కాలిక సంకేతపదాలకు}} {{PLURAL:$5|ఒక్క రోజులో|$5 రోజుల్లో}} కాలం చెల్లుతుంది. ఇప్పుడు మీరు లాగినై కొత్త సంకేతపదాన్ని ఎంచుకోవాల్సి ఉంటుంది. ఈ అభ్యర్ధన చేసింది మరెవరైనా అయినా, లేక మీ అసలు సంకేతపదం మీకు గుర్తొచ్చి, మార్చాల్సిన అవసరం లేకపోయినా, మీరీ సందేశాన్ని పట్టించుకోనక్కర్లేదు. పాత సంకేతపదాన్నే వాడుతూ పోవచ్చు.', 'passwordreset-emailtext-user' => '{{SITENAME}} లోని వాడుకరి $1, {{SITENAME}} ($4) లోని మీ ఖాతా వివరాలను చెప్పమంటూ అడిగారు. కింది వాడుకరి {{PLURAL:$3|ఖాతా|ఖాతాలు}} ఈ ఈమెయిలు అడ్రసుతో అనుసంధింపబడి ఉన్నాయి: $2 {{PLURAL:$3|ఈ తాత్కాలిక సంకేతపదానికి|ఈ తాత్కాలిక సంకేతపదాలకు}} {{PLURAL:$5|ఒక్క రోజులో|$5 రోజుల్లో}} కాలం చెల్లుతుంది. ఇప్పుడు మీరు లాగినై కొత్త సంకేతపదాన్ని ఎంచుకోవాల్సి ఉంటుంది. ఈ అభ్యర్ధన చేసింది మరెవరైనా అయినా, లేక మీ అసలు సంకేతపదం మీకు గుర్తొచ్చి, మార్చాల్సిన అవసరం లేకపోయినా, మీరీ సందేశాన్ని పట్టించుకోనక్కర్లేదు. పాత సంకేతపదాన్నే వాడుతూ పోవచ్చు.', 'passwordreset-emailelement' => 'వాడుకరిపేరు: $1 తాత్కాలిక సంకేతపదం: $2', 'passwordreset-emailsent' => 'జ్ఞాపకం ఈమెయిలు పంపించాం.', 'passwordreset-emailsent-capture' => 'క్రింద చూపబడిన, గుర్తుచేయు సందేశమును పంపినాము.', # Special:ChangeEmail 'changeemail' => 'ఈ-మెయిలు చిరునామా మార్పు', 'changeemail-header' => 'ఖాతా ఈ-మెయిల్ చిరునామాని మార్చండి', 'changeemail-text' => 'మీ ఈమెయిలు చిరునామాని మార్చుకోడానికి ఈ ఫారాన్ని నింపండి. ఈ మార్పుని నిర్ధారించడానికి మీ సంకేతపదాన్ని ఇవ్వాల్సివస్తుంది.', 'changeemail-no-info' => 'ఈ పేజీని నేరుగా చూడటానికి మీరు లోనికి ప్రవేశించివుండాలి.', 'changeemail-oldemail' => 'ప్రస్తుత ఈ-మెయిలు చిరునామా:', 'changeemail-newemail' => 'కొత్త ఈ-మెయిలు చిరునామా:', 'changeemail-none' => '(ఏమీలేదు)', 'changeemail-password' => 'మీ {{SITENAME}} సంకేతపదం:', 'changeemail-submit' => 'ఈ-మెయిల్ మార్చు', 'changeemail-cancel' => 'రద్దుచేయి', # Edit page toolbar 'bold_sample' => 'బొద్దు అక్షరాలు', 'bold_tip' => 'బొద్దు అక్షరాలు', 'italic_sample' => 'వాలు పాఠ్యం', 'italic_tip' => 'వాలు పాఠ్యం', 'link_sample' => 'లింకు పేరు', 'link_tip' => 'అంతర్గత లింకు', 'extlink_sample' => 'http://www.example.com లింకు పేరు', 'extlink_tip' => 'బయటి లింకు (దీనికి ముందు http:// ఇవ్వటం మరువకండి)', 'headline_sample' => 'శీర్షిక పాఠ్యం', 'headline_tip' => '2వ స్థాయి శీర్షిక', 'nowiki_sample' => 'ఫార్మాటు చేయకూడని పాఠ్యాన్ని ఇక్కడ చేర్చండి', 'nowiki_tip' => 'వికీ ఫార్మాటును పట్టించుకోవద్దు', 'image_tip' => 'పొదిగిన ఫైలు', 'media_tip' => 'దస్త్రపు లంకె', 'sig_tip' => 'సమయంతో సహా మీ సంతకం', 'hr_tip' => 'అడ్డగీత (అరుదుగా వాడండి)', # Edit pages 'summary' => 'సారాంశం:', 'subject' => 'విషయం/శీర్షిక:', 'minoredit' => 'ఇది ఒక చిన్న మార్పు', 'watchthis' => 'ఈ పుట మీద కన్నేసి ఉంచు', 'savearticle' => 'పేజీని భద్రపరచు', 'preview' => 'మునుజూపు', 'showpreview' => 'మునుజూపు', 'showlivepreview' => 'తాజా మునుజూపు', 'showdiff' => 'తేడాలను చూపించు', 'anoneditwarning' => "'''హెచ్చరిక:''' మీరు లోనికి ప్రవేశించలేదు. ఈ పేజీ దిద్దుబాటు చరిత్రలో మీ ఐపీ చిరునామా నమోదవుతుంది.", 'anonpreviewwarning' => "''మీరు లోనికి ప్రవేశించలేదు. భద్రపరిస్తే ఈ పేజీ యొక్క దిద్దుబాటు చరిత్రలో మీ ఐపీ చిరునామా నమోదవుతుంది.''", 'missingsummary' => "'''గుర్తు చేస్తున్నాం:''' మీరు దిద్దుబాటు సారాంశమేమీ ఇవ్వలేదు. పేజీని మళ్ళీ భద్రపరచమని చెబితే సారాంశమేమీ లేకుండానే దిద్దుబాటును భద్రపరుస్తాం.", 'missingcommenttext' => 'కింద ఓ వ్యాఖ్య రాయండి.', 'missingcommentheader' => "'''గుర్తు చేస్తున్నాం''': ఈ వ్యాఖ్యకు మీరు విషయం/శీర్షిక పెట్టలేదు. \"{{int:savearticle}}\"ని మళ్ళీ నొక్కితే, మీ మార్పుకి విషయం/శీర్షిక ఏమీ లేకుండానే భద్రపరుస్తాం.", 'summary-preview' => 'మీరు రాసిన సారాంశం:', 'subject-preview' => 'విషయం/శీర్షిక మునుజూపు:', 'blockedtitle' => 'సభ్యునిపై నిరోధం అమలయింది', 'blockedtext' => "'''మీ వాడుకరి పేరుని లేదా ఐ.పీ. చిరునామాని నిరోధించారు.''' నిరోధించినది $1. అందుకు ఇచ్చిన కారణం: ''$2'' * నిరోధం మొదలైన సమయం: $8 * నిరోధించిన కాలం: $6 * నిరోధానికి గురైనవారు: $7 ఈ నిరోధంపై చర్చించేందుకు మీరు $1ను గాని, మరెవరైనా [[{{MediaWiki:Grouppage-sysop}}|నిర్వాహకులను]] గాని సంప్రదించవచ్చు. మీ [[Special:Preferences|ఖాతా అభిరుచులలో]] సరైన ఈ-మెయిలు చిరునామా ఇచ్చివుండకపోయినా లేదా మిమ్మల్ని 'ఈ వాడుకరికి ఈ-మెయిలు పంపు' సౌలభ్యాన్ని వాడుకోవడం నుండి నిరోధించివున్నా మీరు ఈమెయిలు ద్వారా సంప్రదించలేరు. మీ ప్రస్తుత ఐ.పీ. చిరునామా $3, మరియు నిరోధపు ID #$5. మీ సంప్రదింపులన్నిటిలోనూ వీటిని పేర్కొనండి.", 'autoblockedtext' => 'మీ ఐపీ చిరునామా ఆటోమాటిగ్గా నిరోధించబడింది. ఎందుకంటే ఇదే ఐపీ చిరునామాని ఓ నిరోధిత వాడుకరి ఉపయోగించారు. ఆ వాడుకరిని $1 నిరోధించారు. అందుకు ఇచ్చిన కారణం ఇదీ: :\'\'$2\'\' * నిరోధం మొదలైన సమయం: $8 * నిరోధించిన కాలం: $6 * ఉద్దేశించిన నిరోధిత వాడుకరి: $7 ఈ నిరోధం గురించి చర్చించేందుకు మీరు $1 ను గానీ, లేదా ఇతర [[{{MediaWiki:Grouppage-sysop}}|నిర్వాహకులను]] గానీ సంప్రదించండి. మీ [[Special:Preferences|అభిరుచులలో]] సరైన ఈమెయిలు ఐడీని ఇచ్చి ఉంటే తప్ప, మీరు "ఈ సభ్యునికి మెయిలు పంపు" అనే అంశాన్ని వాడజాలరని గమనించండి. ఆ సౌలభ్యాన్ని వాడటం నుండి మిమ్మల్ని నిరోధించలేదు. మీ ప్రస్తుత ఐపీ చిరునామా $3, మరియు నిరోధపు ఐడీ: $5. మీ సంప్రదింపులన్నిటిలోను అన్ని పై వివరాలను ఉదహరించండి.', 'blockednoreason' => 'కారణమేమీ ఇవ్వలేదు', 'whitelistedittext' => 'పుటలలో మార్పులు చెయ్యడానికి మీరు $1 ఉండాలి.', 'confirmedittext' => 'పేజీల్లో మార్పులు చేసేముందు మీ ఈ-మెయిలు చిరునామా ధృవీకరించాలి. [[Special:Preferences|మీ అభిరుచుల]]లో మీ ఈ-మెయిలు చిరునామా రాసి, ధృవీకరించండి.', 'nosuchsectiontitle' => 'విభాగాన్ని కనగొనలేకపోయాం', 'nosuchsectiontext' => 'మీరు లేని విభాగాన్ని మార్చడానికి ప్రయత్నించారు. మీరు పేజీని చూస్తూన్నప్పుడు దాన్ని ఎవరైనా తరలించి లేదా తొలగించి ఉండవచ్చు.', 'loginreqtitle' => 'ప్రవేశము తప్పనిసరి', 'loginreqlink' => 'లోనికి రండి', 'loginreqpagetext' => 'ఇతర పుటలను చూడడానికి మీరు $1 ఉండాలి.', 'accmailtitle' => 'సంకేతపదం పంపించబడింది.', 'accmailtext' => "[[User talk:$1|$1]] కొరకు ఒక యాదృచ్చిక సంకేతపదాన్ని $2కి పంపించాం. ఈ కొత్త ఖాతా యొక్క సంకేతపదాన్ని లోనికి ప్రవేశించిన తర్వాత ''[[Special:ChangePassword|సంకేతపదాన్ని మార్చుకోండి]]'' అన్న పేజీలో మార్చుకోవచ్చు.", 'newarticle' => '(కొత్తది)', 'newarticletext' => "ఈ లింకుకు సంబంధించిన పేజీ ఉనికిలొ లేదు. కింది పెట్టెలో మీ రచనను టైపు చేసి ఆ పేజీని సృష్టించండి (దీనిపై సమాచారం కొరకు [[{{MediaWiki:Helppage}}|సహాయం]] పేజీ చూడండి). మీరిక్కడికి పొరపాటున వచ్చి ఉంటే, మీ బ్రౌజరు '''back''' మీట నొక్కండి.", 'anontalkpagetext' => "----''ఇది ఒక అజ్ఞాత వాడుకరి చర్చా పేజీ. ఆ వాడుకరి ఇంకా తనకై ఖాతాను సృష్టించుకోలేదు, లేదా ఖాతా ఉన్నా దానిని ఉపయోగించడం లేదు. అజ్ఞాత వాడుకరులను గుర్తించడానికి అంకెలతో ఉండే ఐ.పీ. చిరునామాను వాడుతాం. కానీ, ఒకే ఐ.పీ. చిరునామాని చాలా మంది వాడుకరులు ఉపయోగించే అవకాశం ఉంది. మీరు అజ్ఞాత వాడుకరి అయితే మరియు సంబంధంలేని వ్యాఖ్యలు మిమ్మల్ని ఉద్దేశించినట్టుగా అనిపిస్తే, భవిష్యత్తులో ఇతర అజ్ఞాత వాడుకరులతో అయోమయం లేకుండా ఉండటానికి, దయచేసి [[Special:UserLogin/signup|ఖాతాను సృష్టించుకోండి]] లేదా [[Special:UserLogin|లోనికి ప్రవేశించండి]].''", 'noarticletext' => 'ప్రస్తుతం ఈ పేజీలో పాఠ్యమేమీ లేదు. వేరే పేజీలలో [[Special:Search/{{PAGENAME}}|ఈ పేజీ శీర్షిక కోసం వెతకవచ్చు]], <span class="plainlinks">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} సంబంధిత చిట్టాలు చూడవచ్చు], లేదా [{{fullurl:{{FULLPAGENAME}}|action=edit}} ఈ పేజీని మార్చవచ్చు]</span>.', 'noarticletext-nopermission' => 'ప్రస్తుతం ఈ పేజీలో పాఠ్యమేమీ లేదు. మీరు ఇతర పేజీలలో [[Special:Search/{{PAGENAME}}|ఈ పేజీ శీర్షిక కోసం వెతకవచ్చు]], లేదా <span class="plainlinks">[{{fullurl:{{#Special:Log}}|page={{FULLPAGENAMEE}}}} సంబంధిత చిట్టాలలో వెతకవచ్చు]</span>, కానీ ఈ పేజీని సృష్టించడానికి మీకు అనుమతి లేదు.', 'userpage-userdoesnotexist' => '"<nowiki>$1</nowiki>" అనే వాడుకరి ఖాతా నమోదయిలేదు. మీరు ఈ పేజీని సృష్టించ/సరిదిద్దాలనుకుంటే, సరిచూసుకోండి.', 'userpage-userdoesnotexist-view' => 'వాడుకరి ఖాతా "$1" నమోదుకాలేదు.', 'blocked-notice-logextract' => 'ప్రస్తుతం ఈ వాడుకరిని నిరోధించారు. నిరోధపు చిట్టాలోని చివరి పద్దుని మీ సమాచారం కోసం ఈ క్రింద ఇస్తున్నాం:', 'clearyourcache' => "'''గమనిక - భద్రపరచిన తర్వాత, మార్పులను చూడడానికి మీ విహారిణి యొక్క కోశాన్ని తీసేయాల్సిరావచ్చు.''' '''మొజిల్లా/ ఫైర్‌ఫాక్స్‌ / సఫారి:''' ''Shift'' మీటని నొక్కిపట్టి ''రీలోడ్''ని నొక్కండి లేదా ''Ctrl-F5'' అనే మీటల్ని లేదా ''Ctrl-R'' (మాకింటోషులో ''Command-R'') అనే మీటల్ని కలిపి నొక్కండి; '''కాంకరర్: '''''రీలోడ్''ని నొక్కండి లేదా ''F5'' మీటని నొక్కండి; '''ఒపెరా:''' ''Tools → Preferences'' ద్వారా కోశాన్ని శుభ్రపరచండి; '''ఇంటర్నెట్ ఎక్ప్లోరర్:'''''Ctrl'' మీటని నొక్కిపట్టి ''రీఫ్రెష్''ని నొక్కండి లేదా ''Ctrl-F5'' మీటల్ని కలిపి నొక్కండి.", 'usercssyoucanpreview' => "'''చిట్కా:''' భద్రపరిచేముందు మీ కొత్త CSSని పరీక్షించడానికి \"{{int:showpreview}}\" అనే బొత్తాన్ని వాడండి.", 'userjsyoucanpreview' => "'''చిట్కా:''' భద్రపరిచేముందు మీ కొత్త జావాస్క్రిప్టుని పరీక్షించడానికి \"{{int:showpreview}}\" అనే బొత్తాన్ని వాడండి.", 'usercsspreview' => "'''మీరు వాడుకరి CSSను కేవలం సరిచూస్తున్నారని గుర్తుంచుకోండి.''' '''దాన్నింకా భద్రపరచలేదు!'''", 'userjspreview' => "'''గుర్తుంచుకోండి, మీరింకా మీ వాడుకరి జావాస్క్రిప్ట్&zwnj;ను భద్రపరచలేదు, కేవలం పరీక్షిస్తున్నారు/సరిచూస్తున్నారు!'''", 'sitecsspreview' => "'''మీరు చూస్తున్నది ఈ CSS మునుజూపును మాత్రమేనని గుర్తుంచుకోండి.''' '''దీన్నింకా భద్రపరచలేదు!'''", 'sitejspreview' => "'''మీరు చూస్తున్నది ఈ JavaScript మునుజూపును మాత్రమేనని గుర్తుంచుకోండి.''' '''దీన్నింకా భద్రపరచలేదు!'''", 'userinvalidcssjstitle' => "'''హెచ్చరిక:''' \"\$1\" అనే అలంకారం లేదు. అభిమత .css మరియు .js పుటల శీర్షికలు ఇంగ్లీషు చిన్నబడి అక్షరాల లోనే ఉండాలని గుర్తుంచుకోండి, ఉదాహరణకు ఇలా {{ns:user}}:Foo/vector.css అంతేగానీ, {{ns:user}}:Foo/Vector.css ఇలా కాదు.", 'updated' => '(నవీకరించబడింది)', 'note' => "'''గమనిక:'''", 'previewnote' => "'''ఇది మునుజూపు మాత్రమేనని గుర్తుంచుకోండి.''' మీ మార్పులు ఇంకా భద్రమవ్వలేదు!", 'continue-editing' => 'సరిదిద్దే చోటుకి వెళ్ళండి', 'previewconflict' => 'భద్రపరచిన తరువాత పై టెక్స్ట్‌ ఏరియాలోని టెక్స్టు ఇలాగ కనిపిస్తుంది.', 'session_fail_preview' => "'''క్షమించండి! సెషను డేటా పోవడం వలన మీ మార్పులను స్వీకరించలేకపోతున్నాం.''' దయచేసి మళ్ళీ ప్రయత్నించండి. అయినా పని జరక్కపోతే, ఓసారి [[Special:UserLogout|నిష్క్రమించి]] మళ్ళీ లోనికి ప్రవేశించి ప్రయత్నించండి.", 'session_fail_preview_html' => "'''సారీ! సెషను డేటా పోవడం వలన మీ దిద్దుబాటును ప్రాసెస్ చెయ్యలేలేక పోతున్నాం.''' ''{{SITENAME}}లో ముడి HTML సశక్తమై ఉంది కాబట్టి, జావాస్క్రిప్టు దాడుల నుండి రక్షణగా మునుజూపును దాచేశాం.'' '''మీరు చేసినది సరైన దిద్దుబాటే అయితే, మళ్ళీ ప్రయత్నించండి. అయినా పనిచెయ్యకపోతే, ఓ సారి లాగౌటయ్యి, మళ్ళీ లాగినయి చూడండి.'''", 'token_suffix_mismatch' => "'''మీ క్లయంటు, దిద్దుబాటు టోకెన్‌లోని వ్యాకరణ గుర్తులను గజిబిజి చేసింది కాబట్టి మీ దిద్దుబాటును తిరస్కరించాం. పేజీలోని పాఠ్యాన్ని చెడగొట్టకుండా ఉండేందుకు గాను, ఆ దిద్దుబాటును రద్దు చేశాం. వెబ్‌లో ఉండే లోపభూయిష్టమైన అజ్ఞాత ప్రాక్సీ సర్వీసులను వాడినపుడు ఒక్కోసారి ఇలా జరుగుతుంది.'''", 'edit_form_incomplete' => '’’’ఈ ఎడిట్ ఫారంలోని కొన్ని భాగాలు సర్వరును చేరలేదు; మీ మార్పుచేర్పులు భద్రంగా ఉన్నాయని ధృవపరచుకుని, మళ్ళీ ప్రయత్నించండి.’’’', 'editing' => '$1కి మార్పులు', 'creating' => '$1 పేజీని సృష్టిస్తున్నారు', 'editingsection' => '$1కు మార్పులు (విభాగం)', 'editingcomment' => '$1 దిద్దుబాటు (కొత్త విభాగం)', 'editconflict' => 'దిద్దుబాటు ఘర్షణ: $1', 'explainconflict' => "మీరు మార్పులు చెయ్యడం మొదలుపెట్టిన తరువాత, వేరే ఎవరో ఈ పుటని మార్పారు. పైన ఉన్న పాఠ్య పేటికలో ఈ పుట యొక్క ప్రస్తుతపు పాఠ్యం ఉంది. మీరు చేసిన మార్పులు క్రింది పాఠ్య పేటికలో చూపించబడ్డాయి. మీరు మీ మార్పులను ప్రస్తుతపు పాఠ్యంలో విలీనం చెయ్యవలసి ఉంటుంది. మీరు \"{{int:savearticle}}\"ను నొక్కినపుడు, పై పాఠ్య పేటికలో ఉన్న పాఠ్యం '''మాత్రమే''' భద్రపరచబడుతుంది.", 'yourtext' => 'మీ పాఠ్యం', 'storedversion' => 'భద్రపరచిన కూర్పు', 'nonunicodebrowser' => "'''WARNING: Your browser is not unicode compliant. A workaround is in place to allow you to safely edit pages: non-ASCII characters will appear in the edit box as hexadecimal codes.'''", 'editingold' => "'''హెచ్చ రిక: ఈ పేజీ యొక్క కాలం చెల్లిన సంచికను మీరు మరుస్తున్నారు. దీనిని భద్రపరిస్తే, ఆ సంచిక తరువాత ఈ పేజీలో జరిగిన మార్పులన్నీ పోతాయి.'''", 'yourdiff' => 'తేడాలు', 'copyrightwarning' => "{{SITENAME}}కు సమర్పించే అన్ని రచనలూ $2కు లోబడి ప్రచురింపబడినట్లుగా భావించబడతాయి (వివరాలకు $1 చూడండి). మీ రచనలను ఎవ్వరూ మార్చ రాదనీ లెదా వేరే ఎవ్వరూ వాడుకో రాదని మీరు భావిస్తే, ఇక్కడ ప్రచురించకండి.<br /> మీ స్వీయ రచనను గాని, సార్వజనీనమైన రచననుగాని, ఇతర ఉచిత వనరుల నుండి సేకరించిన రచననుగాని మాత్రమే ప్రచురిస్తున్నానని కూడా మీరు ప్రమాణం చేస్తున్నారు. '''కాపీహక్కులుగల రచనను తగిన అనుమతి లేకుండా సమర్పించకండి!'''", 'copyrightwarning2' => "{{SITENAME}}లో ప్రచురించే రచనలన్నిటినీ ఇతర రచయితలు సరిదిద్దడం, మార్చడం, తొలగించడం చేసే అవకాశం ఉంది. మీ రచనలను అలా నిర్దాక్షిణ్యంగా దిద్దుబాట్లు చెయ్యడం మీకిష్టం లేకపోతే, వాటిని ఇక్కడ ప్రచురించకండి. <br /> ఈ రచనను మీరే చేసారని, లేదా ఏదైనా సార్వజనిక వనరు నుండి కాపీ చేసి తెచ్చారని, లేదా అలాంటి ఉచిత, స్వేచ్ఛా వనరు నుండి తెచ్చారని మాకు వాగ్దానం చేస్తున్నారు. (వివరాలకు $1 చూడండి). '''తగు అనుమతులు లేకుండా కాపీ హక్కులు గల రచనలను సమర్పించకండి!'''", 'longpageerror' => "'''పొరపాటు: మీరు సమర్పించిన పాఠ్యం, గరిష్ఠ పరిమితి అయిన {{PLURAL:$2|ఒక కిలోబైటుని|$2 కిలోబైట్లను}} మించి {{PLURAL:$1|ఒక కిలోబైటు|$1 కిలోబైట్ల}} పొడవుంది.''' దీన్ని భద్రపరచలేము.", 'readonlywarning' => "'''హెచ్చరిక: నిర్వహణ కొరకు డేటాబేసుకి తాళం వేసారు, కాబట్టి మీ మార్పుచేర్పులను ఇప్పుడు భద్రపరచలేరు. మీ మార్పులను ఒక ఫాఠ్య ఫైలులోకి కాపీ చేసి భద్రపరచుకొని, తరువాత సమర్పించండి.''' తాళం వేసిన నిర్వాహకుడి వివరణ ఇదీ: $1", 'protectedpagewarning' => "'''హెచ్చరిక: ఈ పేజీ సంరక్షించబడినది, కనుక నిర్వాహక అనుమతులు ఉన్న వాడుకరులు మాత్రమే మార్చగలరు.''' చివరి చిట్టా పద్దుని మీ సమాచారం కోసం ఇక్కడ ఇస్తున్నాం:", 'semiprotectedpagewarning' => "'''గమనిక:''' నమోదయిన వాడుకరులు మాత్రమే మార్పులు చెయ్యగలిగేలా ఈ పేజీకి సంరక్షించారు. మీ సమాచారం కోసం చివరి చిట్టా పద్దుని ఇక్కడ ఇస్తున్నాం:", 'cascadeprotectedwarning' => "'''హెచ్చరిక:''' ఈ పేజీ, కాస్కేడింగు రక్షణలో ఉన్న కింది {{PLURAL:$1|పేజీ|పేజీల్లో}} ఇంక్లూడు అయి ఉంది కాబట్టి, నిర్వాహకులు తప్ప ఇతరులు దిద్దుబాటు చేసే వీలు లేకుండా పేజీని లాకు చేసాం:", 'titleprotectedwarning' => "హెచ్చరిక: ఈ పేజీని సంరక్షించారు కాబట్టి దీన్ని సృష్టించడానికి [[Special:ListGroupRights|ప్రత్యేక హక్కులు]] ఉండాలి.''' మీ సమాచారం కోసం చివరి చిట్టా పద్దుని ఇక్కడ ఇస్తున్నాం:", 'templatesused' => 'ఈ పేజీలో వాడిన {{PLURAL:$1|మూస|మూసలు}}:', 'templatesusedpreview' => 'ఈ మునుజూపులో వాడిన {{PLURAL:$1|మూస|మూసలు}}:', 'templatesusedsection' => 'ఈ విభాగంలో వాడిన {{PLURAL:$1|మూస|మూసలు}}:', 'template-protected' => '(సంరక్షితం)', 'template-semiprotected' => '(సెమీ-రక్షణలో ఉంది)', 'hiddencategories' => 'ఈ పేజీ {{PLURAL:$1|ఒక దాచిన వర్గంలో|$1 దాచిన వర్గాల్లో}} ఉంది:', 'nocreatetext' => '{{SITENAME}}లో కొత్త పేజీలు సృష్టించడాన్ని నియంత్రించారు. మీరు వెనక్కి వెళ్ళి వేరే పేజీలు మార్చవచ్చు, లేదా [[Special:UserLogin|లోనికి ప్రవేశించండి లేదా ఖాతా సృష్టించుకోండి]].', 'nocreate-loggedin' => 'కొత్త పేజీలను సృష్టించేందుకు మీకు అనుమతి లేదు.', 'sectioneditnotsupported-title' => 'విభాగపు దిద్దిబాట్లకి తొడ్పాటు లేదు', 'sectioneditnotsupported-text' => 'ఈ పేజీలో విభాగాల దిద్దుబాటుకి తోడ్పాటు లేదు.', 'permissionserrors' => 'అనుమతుల తప్పిదాలు', 'permissionserrorstext' => 'కింద పేర్కొన్న {{PLURAL:$1|కారణం|కారణాల}} మూలంగా, ఆ పని చెయ్యడానికి మీకు అనుమతిలేదు:', 'permissionserrorstext-withaction' => 'ఈ క్రింది {{PLURAL:$1|కారణం|కారణాల}} వల్ల, మీకు $2 అనుమతి లేదు:', 'recreate-moveddeleted-warn' => "'''హెచ్చరిక: ఇంతకు మునుపు ఒకసారి తొలగించిన పేజీని మళ్లీ సృష్టిద్దామని మీరు ప్రయత్నిస్తున్నారు.''' ఈ పేజీపై మార్పులు చేసేముందు, అవి ఇక్కడ ఉండతగినవేనా కాదా అని ఒకసారి ఆలోచించండి. మీ సౌలభ్యం కొరకు ఈ పేజీ యొక్క తొలగింపు మరియు తరలింపు చిట్టా ఇక్కడ ఇచ్చాము:", 'moveddeleted-notice' => 'ఈ పేజీని తొలగించారు. సమాచారం కొరకు ఈ పేజీ యొక్క తొలగింపు మరియు తరలింపు చిట్టాని క్రింద ఇచ్చాం.', 'log-fulllog' => 'పూర్తి చిట్టాని చూడండి', 'edit-hook-aborted' => 'కొక్కెం మార్పుని విచ్ఛిన్నం చేసింది. అది ఎటువంటి వివరణా ఇవ్వలేదు.', 'edit-gone-missing' => 'పేజీని మార్చలేము. దీన్ని తొలగించినట్టున్నారు.', 'edit-conflict' => 'మార్పు సంఘర్షణ.', 'edit-no-change' => 'పాఠ్యంలో ఏమీ మార్పులు లేవు గనక, మీ మార్పుని పట్టించుకోవట్లేదు.', 'postedit-confirmation' => 'మీ మార్పు భద్రమయ్యింది.', 'edit-already-exists' => 'కొత్త పేజీని సృష్టించలేము. అది ఇప్పటికే ఉంది.', 'defaultmessagetext' => 'అప్రమేయ సందేశపు పాఠ్యం', 'invalid-content-data' => 'తప్పుడు విషయం', 'editwarning-warning' => 'ఈ పేజీని వదిలివెళ్ళడం వల్ల మీరు చేసిన మార్పులను కోల్పోయే అవకాశం ఉంది. మీరు ప్రవేశించివుంటే, ఈ హెచ్చరికని మీ అభిరుచులలో "మరపులు" అనే విభాగంలో అచేతనం చేసుకోవచ్చు.', # Content models 'content-model-wikitext' => 'వికీపాఠ్యం', 'content-model-text' => 'సాదా పాఠ్యం', 'content-model-javascript' => 'జావాస్క్రిప్ట్', 'content-model-css' => 'CSS', # Parser/template warnings 'expensive-parserfunction-warning' => 'హెచ్చరిక: ఈ పేజీలో ఖరీదైన పార్సరు పిలుపులు చాలా ఉన్నాయి. పార్సరు {{PLURAL:$2|పిలుపు|పిలుపులు}} $2 కంటే తక్కువ ఉండాలి, ప్రస్తుతం {{PLURAL:$1|$1 పిలుపు ఉంది|$1 పిలుపులు ఉన్నాయి}}.', 'expensive-parserfunction-category' => 'పార్సరు సందేశాలు అధికంగా ఉన్న పేజీలు', 'post-expand-template-inclusion-warning' => "'''హెచ్చరిక''': మూస చేర్పు సైజు చాలా పెద్దదిగా ఉంది. కొన్ని మూసలను చేర్చలేదు.", 'post-expand-template-inclusion-category' => 'మూస చేర్పు సైజును అధిగమించిన పేజీలు', 'post-expand-template-argument-warning' => 'హెచ్చరిక: చాల పెద్ద సైజున్న మూస ఆర్గ్యుమెంటు, కనీసం ఒకటి, ఈ పేజీలో ఉంది. ఈ ఆర్గ్యుమెంట్లను వదలివేసాం.', 'post-expand-template-argument-category' => 'తొలగించిన మూస ఆర్గ్యుమెంట్లు ఉన్న పేజీలు', 'parser-template-loop-warning' => 'మూస లూపు కనబడింది: [[$1]]', 'parser-template-recursion-depth-warning' => 'మూస రికర్షను లోతు అధిగమించబడింది ($1)', 'language-converter-depth-warning' => 'భాషా మార్పిడి లోతు పరిమితిని అధిగమించారు ($1)', # "Undo" feature 'undo-success' => 'దిద్దుబాటును రద్దు చెయ్యవచ్చు. కింది పోలికను చూసి, మీరు చెయ్యదలచినది ఇదేనని నిర్ధారించుకోండి. ఆ తరువాత మార్పులను భద్రపరచి దిద్దుబాటు రద్దును పూర్తి చెయ్యండి.', 'undo-failure' => 'మధ్యలో జరిగిన దిద్దుబాట్లతో తలెత్తిన ఘర్షణ కారణంగా ఈ దిద్దుబాటును రద్దు చెయ్యలేక పోయాం.', 'undo-norev' => 'ఈ దిద్దుబాటును అసలు లేకపోవటం వలన, లేదా తొలగించేయడం వలన రద్దుచేయలేకపోతున్నాం.', 'undo-summary' => '[[Special:Contributions/$2|$2]] ([[User talk:$2|చర్చ]]) దిద్దుబాటు చేసిన కూర్పు $1 ను రద్దు చేసారు', # Account creation failure 'cantcreateaccounttitle' => 'ఈ ఖాతా తెరవలేము', 'cantcreateaccount-text' => "ఈ ఐపీ అడ్రసు ('''$1''') నుండి ఖాతా సృష్టించడాన్ని [[User:$3|$3]] నిరోధించారు. $3 చెప్పిన కారణం: ''$2''", # History pages 'viewpagelogs' => 'ఈ పేజీకి సంబంధించిన లాగ్‌లను చూడండి', 'nohistory' => 'ఈ పేజీకి మార్పుల చరిత్ర లేదు.', 'currentrev' => 'ప్రస్తుతపు సంచిక', 'currentrev-asof' => '$1 నాటి ప్రస్తుత కూర్పు', 'revisionasof' => '$1 నాటి సంచిక', 'revision-info' => '$1 నాటి కూర్పు. రచయిత: $2', 'previousrevision' => '← పాత కూర్పు', 'nextrevision' => 'దీని తరువాతి సంచిక→', 'currentrevisionlink' => 'ప్రస్తుతపు సంచిక', 'cur' => 'ప్రస్తుత', 'next' => 'తర్వాతి', 'last' => 'గత', 'page_first' => 'మొదటి', 'page_last' => 'చివరి', 'histlegend' => 'తేడా ఎంపిక: సంచికల యొక్క రేడియో బాక్సులను ఎంచుకొని ఎంటర్‌ నొక్కండి, లేదా పైన/ కింద ఉన్న మీటను నొక్కండి.<br /> సూచిక: (ప్రస్తుత) = ప్రస్తుత సంచికతో కల తేడాలు, (గత) = ఇంతకు ముందరి సంచికతో గల తేడాలు, చి = చిన్న మార్పు', 'history-fieldset-title' => 'చరిత్రలో చూడండి', 'history-show-deleted' => 'తొలగించినవి మాత్రమే', 'histfirst' => 'తొట్టతొలి', 'histlast' => 'చిట్టచివరి', 'historysize' => '({{PLURAL:$1|ఒక బైటు|$1 బైట్లు}})', 'historyempty' => '(ఖాళీ)', # Revision feed 'history-feed-title' => 'కూర్పుల చరిత్ర', 'history-feed-description' => 'ఈ పేజీకి వికీలో కూర్పుల చరిత్ర', 'history-feed-item-nocomment' => '$2 వద్ద ఉన్న $1', 'history-feed-empty' => 'మీరడిగిన పేజీ లేదు. దాన్ని వికీలోంచి తొలగించి ఉండొచ్చు, లేదా పేరు మార్చి ఉండొచ్చు. సంబంధిత కొత్త పేజీల కోసం [[Special:Search|వికీలో వెతికి చూడండి]].', # Revision deletion 'rev-deleted-comment' => '(మార్పుల సంగ్రహాన్ని తొలగించారు)', 'rev-deleted-user' => '(వాడుకరి పేరుని తొలగించారు)', 'rev-deleted-event' => '(దినచర్యని తొలగించాం)', 'rev-deleted-user-contribs' => '[వాడుకరిపేరు లేదా ఐపీ చిరునామాని తొలగించారు - మార్పుచేర్పుల నుండి మార్పుని దాచారు]', 'rev-deleted-text-permission' => "ఈ పేజీ కూర్పుని '''తొలగించారు'''. [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} తొలగింపు చిట్టా]లో పూర్తి వివరాలు ఉండవచ్చు.", 'rev-deleted-text-unhide' => "ఈ పేజీ కూర్పుని '''తొలగించారు'''. [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} తొలగింపు చిట్టా]లో వివరాలు ఉండవచ్చు. మీరు కావాలనుకుంటే, నిర్వాహకులుగా [$1 ఈ కూర్పుని చూడవచ్చు].", 'rev-suppressed-text-unhide' => "ఈ పేజీకూర్పును '''అణచి పెట్టాం'''. [{{fullurl:{{#Special:Log}}/suppress|page={{FULLPAGENAMEE}}}} అణచివేత చిట్టా]లో వివరాలు ఉండొచ్చు. ముందుకు సాగాలనుకుంటే ఒక నిర్వాహకుడిగా మీరీ [$1 కూర్పును చూడవచ్చు].", 'rev-deleted-text-view' => "ఈ పేజీ కూర్పుని '''తొలగించారు'''. ఒక నిర్వాహకుడిగా మీరు దాన్ని చూడవచ్చు; [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} తొలగింపు చిట్టా]లో వివరాలు ఉండవచ్చు.", 'rev-suppressed-text-view' => "ఈ పేజీకూర్పును '''అణచి పెట్టాం'''. ఒక నిర్వాహకుడిగా మీరు దాన్ని చూడవచ్చు; [{{fullurl:{{#Special:Log}}/suppress|page={{FULLPAGENAMEE}}}} అణచివేత చిట్టా]లోవివరాలు ఉండవచ్చు.", 'rev-deleted-no-diff' => "మీరు తేడాలను చూడలేదు ఎందుకంటే ఒక కూర్పుని '''తొలగించారు'''. [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} తొలగింపు చిట్టా]లో వివరాలు ఉండవచ్చు.", 'rev-suppressed-no-diff' => "ఈ తేడాని మీరు చూడలేరు ఎందుకంటే ఒక కూర్పుని '''తొలగించారు'''.", 'rev-deleted-unhide-diff' => "ఈ తేడాల యొక్క కూర్పులలో ఒకదాన్ని '''తొలగించారు'''. [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} తొలగింపు చిట్టా]లో వివరాలు ఉండవచ్చు. మీరు కావాలనుకుంటే నిర్వాహకులుగా [$1 ఈ తేడాని చూడవచ్చు].", 'rev-suppressed-unhide-diff' => "ఈ తేడా లోని ఒక కూర్పును '''అణచి పెట్టాం'''. [{{fullurl:{{#Special:Log}}/suppress|page={{FULLPAGENAMEE}}}} అణచివేత చిట్టా]లోవివరాలు ఉండవచ్చు. కావాలనుకుంటే, ఒక నిర్వాహకుడిగా మీరు [$1 ఆ తేడాను చూడవచ్చు].", 'rev-deleted-diff-view' => "ఈ తేడా లోని ఒక పేజీకూర్పును '''తొలగించాం'''. ఒక నిర్వాహకుడిగా మీరు ఈ తేడాను చూడవచ్చు; [{{fullurl:{{#Special:Log}}/delete|page={{FULLPAGENAMEE}}}} తొలగింపు చిట్టా]లోవివరాలు ఉండవచ్చు.", 'rev-suppressed-diff-view' => " ఈ తేడా లోని ఒక కూర్పును '''అణచి పెట్టాం'''. ఒక నిర్వాహకుడిగా మీరు ఈ తేడాను చూడవచ్చు; [{{fullurl:{{#Special:Log}}/suppress|page={{FULLPAGENAMEE}}}} అణచివేత చిట్టా]లోవివరాలు ఉండవచ్చు.", 'rev-delundel' => 'చూపించు/దాచు', 'rev-showdeleted' => 'చూపించు', 'revisiondelete' => 'కూర్పులను తొలగించు/తొలగింపును రద్దుచెయ్యి', 'revdelete-nooldid-title' => 'తప్పుడు లక్ష్యపు కూర్పు', 'revdelete-nooldid-text' => 'ఈ పని ఏ కూర్పు లేదా కూర్పుల మీద చెయ్యాలో మీరు సూచించలేదు, లేదా మీరు సూచించిన కూర్పు లేదు, లేదా ప్రస్తుత కూర్పునే దాచాలని ప్రయత్నిస్తున్నారు.', 'revdelete-nologtype-title' => 'చిట్టా రకం ఇవ్వలేదు', 'revdelete-nologtype-text' => 'ఈ చర్య జరపాల్సిన చిట్టా రకాన్ని మీరు పేర్కొననేలేదు.', 'revdelete-nologid-title' => 'తప్పుడు చిట్టా పద్దు', 'revdelete-nologid-text' => 'ఈ పని చేయడానికి మీరు లక్ష్యిత చిట్టా పద్దుని ఇవ్వలేదు లేదా మీరు చెప్పిన పద్దు ఉనికిలో లేదు.', 'revdelete-no-file' => 'ఆ పేర్కొన్న ఫైలు ఉనికిలో లేదు.', 'revdelete-show-file-confirm' => 'మీరు నిజంగానే "<nowiki>$1</nowiki>" ఫైలు యొక్క $2 $3 నాటి తొలగించిన కూర్పుని చూడాలనుకుంటున్నారా?', 'revdelete-show-file-submit' => 'అవును', 'revdelete-selected' => "'''[[:$1]] యొక్క {{PLURAL:$2|ఎంచుకున్న కూర్పు|ఎంచుకున్న కూర్పులు}}:'''", 'logdelete-selected' => "'''{{PLURAL:$1|ఎంచుకున్న చిట్టా ఘటన|ఎంచుకున్న చిట్టా ఘటనలు}}:'''", 'revdelete-text' => "'''తొలగించిన కూర్పులు, ఘటనలూ పేజీ చరితం లోనూ, చిట్టాలలోనూ కనిపిస్తాయి, కానీ వాటిలో కొన్ని భాగాలు సార్వజనికంగా అందుబాటులో ఉండవు.''' {{SITENAME}} లోని ఇతర నిర్వాహకులు ఆ దాచిన భాగాలను చూడగలరు మరియు (ఏవిధమైన నియంత్రణలూ లేకుంటే) ఇదే అంతరవర్తి ద్వారా వాటిని పునస్థాపించగలరు.", 'revdelete-confirm' => 'మీరు దీన్ని చేయగోరుతున్నారనీ, దీని పర్యవసానాలు మీకు తెలుసుననీ, మరియు మీరు దీన్ని [[{{MediaWiki:Policy-url}}|విధానం]] ప్రకారమే చేస్తున్నారనీ దయచేసి నిర్ధారించండి.', 'revdelete-suppress-text' => 'అణచివేతను కింది సందర్భాలలో "మాత్రమే" వాడాలి: * బురదజల్లే ధోరణిలో ఉన్న సమాచారం * అనుచితమైన వ్యక్తిగత సమాచారం * "ఇంటి చిరునామాలు, టెలిఫోను నంబర్లు, సోషల్ సెక్యూరిటీ నంబర్లు, వగైరాలు"', 'revdelete-legend' => 'సందర్శక నిబంధనలు అమర్చు', 'revdelete-hide-text' => 'కూర్పు పాఠ్యాన్ని దాచు', 'revdelete-hide-image' => 'ఫైలులోని విషయాన్ని దాచు', 'revdelete-hide-name' => 'చర్యను, లక్ష్యాన్నీ దాచు', 'revdelete-hide-comment' => 'దిద్దుబాటు వ్యాఖ్యను దాచు', 'revdelete-hide-user' => 'దిద్దుబాటు చేసినవారి సభ్యనామాన్ని/ఐపీని దాచు', 'revdelete-hide-restricted' => 'డేటాను అందరిలాగే నిర్వాహకులకు కూడా కనబడనివ్వకు', 'revdelete-radio-same' => '(మార్చకు)', 'revdelete-radio-set' => 'అవును', 'revdelete-radio-unset' => 'కాదు', 'revdelete-suppress' => 'డేటాను అందరిలాగే నిర్వాహకులకు కూడా కనబడనివ్వకు', 'revdelete-unsuppress' => 'పునస్థాపిత కూర్పులపై నిబంధనలను తీసివెయ్యి', 'revdelete-log' => 'కారణం:', 'revdelete-submit' => 'ఎంచుకున్న {{PLURAL:$1|కూర్పుకు|కూర్పులకు}} ఆపాదించు', 'revdelete-success' => "'''కూర్పు కనబడే విధానాన్ని జయప్రదంగా తాజాకరించాం.'''", 'revdelete-failure' => "'''కూర్పు కనబడే పద్ధతిని తాజాపరచలేకపోయాం:''' $1", 'logdelete-success' => "'''ఘటన కనబడే విధానాన్ని జయప్రదంగా సెట్ చేసాం.'''", 'logdelete-failure' => "'''చిట్టా కనబడే పద్ధతిని అమర్చలేకపోయాం:''' $1", 'revdel-restore' => 'దృశ్యతని మార్చు', 'revdel-restore-deleted' => 'తొలగించిన కూర్పులు', 'revdel-restore-visible' => 'కనిపిస్తున్న కూర్పులు', 'pagehist' => 'పేజీ చరిత్ర', 'deletedhist' => 'తొలగించిన చరిత్ర', 'revdelete-hide-current' => '$2, $1 నాటి అంశాన్ని దాచడంలో లోపం దొర్లింది: ఇది ప్రస్తుత కూర్పు. దీన్ని దాచలేము.', 'revdelete-show-no-access' => '$2, $1 నాటి అంశాన్ని చూపడంలో లోపం దొర్లింది: ఇది "నిరోధించబడింది" అని గుర్తించబడింది. ఇది మీకు అందుబాటులో లేదు.', 'revdelete-modify-no-access' => '$2, $1 నాటి అంశాన్ని మార్చడంలో లోపం దొర్లింది: ఇది "నిరోధించబడింది" అని గుర్తించబడింది. ఇది మీకు అందుబాటులో లేదు.', 'revdelete-modify-missing' => '$1 అంశాన్ని మార్చడంలో లోపం దొర్లింది: ఇది డేటాబేసులో కనబడలేదు!', 'revdelete-no-change' => "'''హెచ్చరిక:''' $2, $1 నాటి అంశానికి మీరడిగిన చూపు అమరికలన్నీ ఈసరికే ఉన్నాయి.", 'revdelete-concurrent-change' => '$2, $1 నాటి అంశాన్ని మార్చడంలో లోపం దొర్లింది: మీరు మార్చడానికి ప్రయత్నించిన సమయంలోనే వేరొకరు దాని స్థితిని మార్చినట్లుగా కనిపిస్తోంది. ఓసారి లాగ్‌లను చూడండి.', 'revdelete-only-restricted' => '$2, $1 తేదీ గల అంశాన్ని దాచడంలో పొరపాటు: ఇతర దృశ్యత వికల్పాల్లోంచి ఒకదాన్ని ఎంచుకోకుండా అంశాలని నిర్వాహకులకు కనబడకుండా అణచివెయ్యలేరు.', 'revdelete-reason-dropdown' => '*సాధారణ తొలగింపు కారణాలు ** కాపీహక్కుల ఉల్లంఘన ** అసంబద్ధ వ్యాఖ్య లేదా వ్యక్తిగత సమాచారం ** అసంబద్ధ వాడుకరి పేరు ** నిందాపూర్వక సమాచారం', 'revdelete-otherreason' => 'ఇతర/అదనపు కారణం:', 'revdelete-reasonotherlist' => 'ఇతర కారణం', 'revdelete-edit-reasonlist' => 'తొలగింపు కారణాలని మార్చండి', 'revdelete-offender' => 'కూర్పు రచయిత:', # Suppression log 'suppressionlog' => 'అణచివేతల చిట్టా', 'suppressionlogtext' => 'నిర్వాహకులకు కనబడని విషయం కలిగిన తొలగింపులు, నిరోధాల జాబితా ఇది. ప్రస్తుతం అమల్లో ఉన్న నిషేధాలు, నిరోధాల జాబితా కోసం [[Special:IPBlockList|ఐపీ నిరోధాల జాబితా]] చూడండి.', # History merging 'mergehistory' => 'పేజీ చరితాలను విలీనం చెయ్యి', 'mergehistory-header' => 'ఓ పేజీ చరితం లోని కూర్పులను మరో పేజీలోకి విలీనం చెయ్యడానికి ఈ పేజీని వాడండి. మీరు చెయ్యబోయే మార్పు చరితం క్రమాన్ని పాటిస్తుందని నిర్ధారించుకోండి.', 'mergehistory-box' => 'రెండు పేజీల కూర్పులను విలీనం చెయ్యి:', 'mergehistory-from' => 'మూల పేజీ:', 'mergehistory-into' => 'లక్ష్యిత పేజీ:', 'mergehistory-list' => 'విలీనం చెయ్యదగ్గ దిద్దుబాటు చరితం', 'mergehistory-merge' => '[[:$1]] యొక్క కింది కూర్పులను [[:$2]] తో విలీనం చెయ్యవచ్చు. ఫలానా సమయమూ, దాని కంటే ముందూ తయారైన కూర్పులతో మాత్రమే విలీనం చెయ్యాలనుకుంటే, సంబంధిత రేడియో బటనున్న నిలువు వరుసను వాడండి. నేవిగేషను లింకులను వాడితే ఈ వరుస రీసెట్ అవుతుంది.', 'mergehistory-go' => 'విలీనం చెయ్యదగ్గ దిద్దుబాట్లను చూపించు', 'mergehistory-submit' => 'కూర్పులను విలీనం చెయ్యి', 'mergehistory-empty' => 'ఏ కూర్పులనూ విలీనం చెయ్యలేము.', 'mergehistory-success' => '[[:$1]] యొక్క $3 {{PLURAL:$3|కూర్పుని|కూర్పులను}} [[:$2]] లోనికి జయప్రదంగా విలీనం చేసాం.', 'mergehistory-fail' => 'చరితాన్ని విలీనం చెయ్యలేకపోయాం. పేజీని, సమయాలను సరిచూసుకోండి.', 'mergehistory-no-source' => 'మూలం పేజీ, $1 లేదు.', 'mergehistory-no-destination' => 'గమ్యం పేజీ, $1 లేదు.', 'mergehistory-invalid-source' => 'మూలం పేజీకి సరైన పేరు ఉండాలి.', 'mergehistory-invalid-destination' => 'గమ్యం పేజీకి సరైన పేరు ఉండాలి.', 'mergehistory-autocomment' => '[[:$1]]ని [[:$2]] లోనికి విలీనం చేసారు', 'mergehistory-comment' => '[[:$1]]ని [[:$2]] లోనికి విలీనం చేసారు: $3', 'mergehistory-same-destination' => 'మూల మరియు గమ్యస్థాన పేజీలు ఒకటే కాకూడదు', 'mergehistory-reason' => 'కారణం:', # Merge log 'mergelog' => 'వీలీనాల చిట్టా', 'pagemerge-logentry' => '[[$1]] ను [[$2]] లోకి విలీనం చేసాం ($3 కూర్పు దాకా)', 'revertmerge' => 'విలీనాన్ని రద్దుచెయ్యి', 'mergelogpagetext' => 'ఒక పేజీ చరితాన్ని మరో పేజీ చరితం లోకి ఇటీవల చేసిన విలీనాల జాబితా ఇది.', # Diffs 'history-title' => '"$1" యొక్క కూర్పుల చరిత్ర', 'difference-title' => '"$1" యొక్క తిరిగిచూపుల నడుమ తేడాలు', 'difference-title-multipage' => '"$1" మరియు "$2" పేజీల మధ్య తేడా', 'difference-multipage' => '(పేజీల మధ్య తేడా)', 'lineno' => 'పంక్తి $1:', 'compareselectedversions' => 'ఎంచుకున్న సంచికలను పోల్చిచూడు', 'showhideselectedversions' => 'ఎంచుకున్న కూర్పులను చూపించు/దాచు', 'editundo' => 'మార్పుని రద్దుచెయ్యి', 'diff-multi' => '({{PLURAL:$2|ఒక వాడుకరి|$2 వాడుకరుల}} యొక్క {{PLURAL:$1|ఒక మధ్యంతర కూర్పును|$1 మధ్యంతర కూర్పులను}} చూపించట్లేదు)', 'diff-multi-manyusers' => '$2 మంది పైన ({{PLURAL:$2|ఒక వాడుకరి|వాడుకరుల}} యొక్క {{PLURAL:$1|ఒక మధ్యంతర కూర్పును|$1 మధ్యంతర కూర్పులను}} చూపించట్లేదు)', # Search results 'searchresults' => 'వెదుకులాట ఫలితాలు', 'searchresults-title' => '"$1"కి అన్వేషణ ఫలితాలు', 'searchresulttext' => '{{SITENAME}}లో అన్వేషించే విషయమై మరింత సమాచారం కొరకు [[{{MediaWiki:Helppage}}|{{int:help}}]] చూడండి.', 'searchsubtitle' => 'మీరు \'\'\'[[:$1]]\'\'\' కోసం వెతికారు ([[Special:Prefixindex/$1|"$1"తో మొదలయ్యే అన్ని పేజీలు]]{{int:pipe-separator}}[[Special:WhatLinksHere/$1|"$1"కి లింకు ఉన్న అన్ని పేజీలు]])', 'searchsubtitleinvalid' => "మీరు '''$1''' కోసం వెతికారు", 'toomanymatches' => 'చాలా పోలికలు వచ్చాయి, దయచేసి మరో ప్రశ్నని ప్రయత్నించండి', 'titlematches' => 'వ్యాస శీర్షిక సరిపోయింది', 'notitlematches' => 'పేజీ పేరు సరిపోలడం లేదు', 'textmatches' => 'పేజిలోని పాఠం సరిపోలింది', 'notextmatches' => 'పేజీ పాఠ్యమేదీ సరిపోలడం లేదు', 'prevn' => 'క్రితం {{PLURAL:$1|$1}}', 'nextn' => 'తరువాతి {{PLURAL:$1|$1}}', 'prevn-title' => 'గత $1 {{PLURAL:$1|ఫలితం|ఫలితాలు}}', 'nextn-title' => 'తదుపరి $1 {{PLURAL:$1|ఫలితం|ఫలితాలు}}', 'shown-title' => 'పేజీకి $1 {{PLURAL:$1|ఫలితాన్ని|ఫలితాలను}} చూపించు', 'viewprevnext' => '($1 {{int:pipe-separator}} $2) ($3) చూపించు.', 'searchmenu-legend' => 'అన్వేషణ ఎంపికలు', 'searchmenu-exists' => "'''ఈ వికీలో \"[[:\$1]]\" అనే పేజీ ఉంది'''", 'searchmenu-new' => "'''ఈ వికీలో \"[[:\$1]]\" అనే పేరుతో పేజీని సృష్టించు!'''", 'searchmenu-prefix' => '[[Special:PrefixIndex/$1|ఈ ఉపసర్గ ఉన్న పేజీలను చూడండి]]', 'searchprofile-articles' => 'విషయపు పేజీలు', 'searchprofile-project' => 'సహాయం మరియు ప్రాజెక్టు పేజీలు', 'searchprofile-images' => 'బహుళమాధ్యమాలు', 'searchprofile-everything' => 'ప్రతీ ఒక్కటీ', 'searchprofile-advanced' => 'ఉన్నత', 'searchprofile-articles-tooltip' => '$1 లలో వెతకండి', 'searchprofile-project-tooltip' => '$1 లలో వెతకండి', 'searchprofile-images-tooltip' => 'పైళ్ళ కోసం వెతకండి', 'searchprofile-everything-tooltip' => 'అన్ని చోట్లా (చర్చా పేజీలతో సహా) వెతకండి', 'searchprofile-advanced-tooltip' => 'కస్టం నేంస్పేసులలో వెదుకు', 'search-result-size' => '$1 ({{PLURAL:$2|1 పదం|$2 పదాలు}})', 'search-result-category-size' => '{{PLURAL:$1|1 సభ్యుడు|$1 సభ్యులు}} ({{PLURAL:$2|1 ఉవవర్గం|$2 ఉపవర్గాలు}}, {{PLURAL:$3|1 దస్త్రం|$3 దస్త్రాలు}})', 'search-result-score' => 'సంబంధం: $1%', 'search-redirect' => '(దారిమార్పు $1)', 'search-section' => '(విభాగం $1)', 'search-suggest' => 'మీరు అంటున్నది ఇదా: $1', 'search-interwiki-caption' => 'సోదర ప్రాజెక్టులు', 'search-interwiki-default' => '$1 ఫలితాలు:', 'search-interwiki-more' => '(మరిన్ని)', 'search-relatedarticle' => 'సంబంధించినవి', 'mwsuggest-disable' => 'AJAX సూచనలను అచేతనంచేయి', 'searcheverything-enable' => 'అన్ని పేరుబరుల్లో వెతుకు', 'searchrelated' => 'సంబంధించినవి', 'searchall' => 'అన్నీ', 'showingresults' => "కింద ఉన్న {{PLURAL:$1|'''ఒక్క''' ఫలితం|'''$1''' ఫలితాలు}}, #'''$2''' నుండి మొదలుకొని చూపిస్తున్నాం.", 'showingresultsnum' => "కింద ఉన్న {{PLURAL:$3|'''ఒక్క''' ఫలితం|'''$3''' ఫలితాలు}}, #'''$2''' నుండి మొదలుకొని చూపిస్తున్నాం.", 'showingresultsheader' => "'''$4''' కొరకై {{PLURAL:$5|'''$3'''లో '''$1''' ఫలితం|'''$3''' ఫలితాల్లో '''$1 - $2''' వరకు}}", 'nonefound' => "'''గమనిక''': డిఫాల్టుగా కొన్ని నేమ్‌స్పేసుల్లో మాత్రమే వెతుకుతాం. చర్చాపేజీలు, మూసలు మొదలైన వాటితో సహా ఆన్ని నేమ్‌స్పేసుల్లోను వెతికేందుకు మీ అన్వేషకానికి ముందు ''all:'' అనే పదం ఉంచండి. లేదా మీరు వెతకదలచిన నేమ్‌స్పేసును ఆదిపదంగా పెట్టండి.", 'search-nonefound' => 'మీ ప్రశ్నకి సరిపోలిన ఫలితాలేమీ లేవు.', 'powersearch' => 'నిశితంగా వెతుకు', 'powersearch-legend' => 'నిశితమైన అన్వేషణ', 'powersearch-ns' => 'ఈ పేరుబరుల్లో వెతుకు:', 'powersearch-redir' => 'దారిమార్పులను చూపించు', 'powersearch-field' => 'దీని కోసం వెతుకు:', 'powersearch-togglelabel' => 'ఎంచుకోవాల్సినవి:', 'powersearch-toggleall' => 'అన్నీ', 'powersearch-togglenone' => 'ఏదీకాదు', 'search-external' => 'బయటి అన్వేషణ', 'searchdisabled' => '{{SITENAME}} అన్వేషణ తాత్కాలికంగా పని చెయ్యడం లేదు. ఈలోగా మీరు గూగుల్‌ ఉపయోగించి అన్వేషించవచ్చు. ఒక గమనిక: గూగుల్‌ ద్వారా కాలదోషం పట్టిన ఫలితాలు రావడానికి అవకాశం ఉంది.', # Preferences page 'preferences' => 'అభిరుచులు', 'mypreferences' => 'అభిరుచులు', 'prefs-edits' => 'దిద్దుబాట్ల సంఖ్య:', 'prefsnologin' => 'లాగిన్‌ అయిలేరు', 'prefsnologintext' => 'వాడుకరి అభిరుచులను మార్చుకోడానికి, మీరు <span class="plainlinks">[{{fullurl:{{#Special:UserLogin}}|returnto=$1}} లోనికి ప్రవేశించి]</span> ఉండాలి.', 'changepassword' => 'సంకేతపదాన్ని మార్చండి', 'prefs-skin' => 'అలంకారం', 'skin-preview' => 'మునుజూపు/సరిచూడు', 'datedefault' => 'ఏదైనా పరవాలేదు', 'prefs-beta' => 'బీటా సౌలభ్యాలు', 'prefs-datetime' => 'తేదీ, సమయం', 'prefs-labs' => 'ప్రయోగాత్మక సౌలభ్యాలు', 'prefs-user-pages' => 'వాడుకరి పేజీలు', 'prefs-personal' => 'వాడుకరి వివరాలు', 'prefs-rc' => 'ఇటీవలి మార్పులు', 'prefs-watchlist' => 'వీక్షణ జాబితా', 'prefs-watchlist-days' => 'వీక్షణ జాబితాలో చూపించవలసిన రోజులు:', 'prefs-watchlist-days-max' => '$1 {{PLURAL:$1|రోజు|రోజులు}} గరిష్ఠం', 'prefs-watchlist-edits' => 'విస్తృత వీక్షణ జాబితాలో చూపించవలసిన దిద్దుబాట్లు:', 'prefs-watchlist-edits-max' => 'గరిష్ఠ సంఖ్య: 1000', 'prefs-watchlist-token' => 'వీక్షణాజాబితా టోకెను:', 'prefs-misc' => 'ఇతరాలు', 'prefs-resetpass' => 'సంకేతపదాన్ని మార్చుకోండి', 'prefs-changeemail' => 'ఈ-మెయిలు చిరునామా మార్పు', 'prefs-setemail' => 'ఒక ఈ-మెయిల్ చిరునామాని అమర్చండి', 'prefs-email' => 'ఈ-మెయిల్ ఎంపికలు', 'prefs-rendering' => 'రూపురేఖలు', 'saveprefs' => 'భద్రపరచు', 'resetprefs' => 'మునుపటి వలె', 'restoreprefs' => 'సృష్టించబడినప్పటి అభిరుచులు తిరిగి తీసుకురా', 'prefs-editing' => 'మార్పులు', 'rows' => 'వరుసలు', 'columns' => 'వరుసలు:', 'searchresultshead' => 'అన్వేషణ', 'resultsperpage' => 'పేజీకి ఫలితాలు:', 'stub-threshold' => '<a href="#" class="stub">మొలక లింకు</a> ఫార్మాటింగు కొరకు హద్దు (బైట్లు):', 'stub-threshold-disabled' => 'అచేతనం', 'recentchangesdays' => 'ఇటీవలి మార్పులు లో చూపించవలసిన రోజులు:', 'recentchangesdays-max' => '($1 {{PLURAL:$1|రోజు|రోజులు}} గరిష్ఠం)', 'recentchangescount' => 'అప్రమేయంగా చూపించాల్సిన దిద్దుబాట్ల సంఖ్య:', 'prefs-help-recentchangescount' => 'ఇది ఇటీవలి మార్పులు, పేజీ చరిత్రలు, మరియు చిట్టాలకు వర్తిస్తుంది.', 'savedprefs' => 'మీ అభిరుచులను భద్రపరిచాం.', 'timezonelegend' => 'కాల మండలం:', 'localtime' => 'స్థానిక సమయం:', 'timezoneuseserverdefault' => 'వికీ అప్రమేయాన్ని ఉపయోగించు ($1)', 'timezoneuseoffset' => 'ఇతర (భేదాన్ని ఇవ్వండి)', 'timezoneoffset' => 'తేడా¹:', 'servertime' => 'సర్వరు సమయం:', 'guesstimezone' => 'విహారిణి నుండి తీసుకో', 'timezoneregion-africa' => 'ఆఫ్రికా', 'timezoneregion-america' => 'అమెరికా', 'timezoneregion-antarctica' => 'అంటార్కిటికా', 'timezoneregion-arctic' => 'ఆర్కిటిక్', 'timezoneregion-asia' => 'ఆసియా', 'timezoneregion-atlantic' => 'అట్లాంటిక్ మహాసముద్రం', 'timezoneregion-australia' => 'ఆష్ట్రేలియా', 'timezoneregion-europe' => 'ఐరోపా', 'timezoneregion-indian' => 'హిందూ మహాసముద్రం', 'timezoneregion-pacific' => 'పసిఫిక్ మహాసముద్రం', 'allowemail' => 'ఇతర వాడుకరుల నుండి ఈ-మెయిళ్ళను రానివ్వు', 'prefs-searchoptions' => 'వెతుకులాట', 'prefs-namespaces' => 'పేరుబరులు', 'defaultns' => 'లేకపోతే ఈ నేంస్పేసులలో అన్వేషించు:', 'default' => 'అప్రమేయం', 'prefs-files' => 'ఫైళ్ళు', 'prefs-custom-css' => 'ప్రత్యేక CSS', 'prefs-custom-js' => 'ప్రత్యేక JS', 'prefs-common-css-js' => 'అన్ని అలంకారాలకై పంచుకోబడిన CSS/JS:', 'prefs-reset-intro' => 'ఈ పేజీలో, మీ అభిరుచులను సైటు డిఫాల్టు విలువలకు మార్చుకోవచ్చు. మళ్ళీ వెనక్కి తీసుకుపోలేరు.', 'prefs-emailconfirm-label' => 'ఈ-మెయిల్ నిర్ధారణ:', 'youremail' => 'మీ ఈ-మెయిలు*', 'username' => '{{GENDER:$1|వాడుకరి పేరు}}:', 'uid' => '{{GENDER:$1|వాడుకరి}} ID:', 'prefs-memberingroups' => 'ఈ {{PLURAL:$1|గుంపులో|గుంపులలో}} {{GENDER:$2|సభ్యుడు|సభ్యురాలు}}:', 'prefs-registration' => 'నమోదైన సమయం:', 'yourrealname' => 'అసలు పేరు:', 'yourlanguage' => 'భాష:', 'yourvariant' => 'విషయపు భాషా వైవిధ్యం:', 'prefs-help-variant' => 'ఈ వికీ లోని విషయపు పేజీలను చూపించడానికి మీ అభిమత వైవిధ్యం లేదా ఆర్ధోగ్రఫీ.', 'yournick' => 'ముద్దు పేరు', 'prefs-help-signature' => 'చర్చా పేజీల లోని వ్యాఖ్యలకు "<nowiki>~~~~</nowiki>"తో సంతకం చేస్తే అది మీ సంతకం మరియు కాలముద్రగా మారుతుంది.', 'badsig' => 'సంతకాన్ని సరిగ్గా ఇవ్వలేదు; HTML ట్యాగులను ఒకసారి పరిశీలించండి.', 'badsiglength' => 'మీ సంతకం చాలా పెద్దగా ఉంది. ఇది తప్పనిసరిగా $1 {{PLURAL:$1|అక్షరం|అక్షరాల}} లోపులోనే ఉండాలి.', 'yourgender' => 'లింగం:', 'gender-unknown' => 'వెల్లడించకండి', 'gender-male' => 'పురుషుడు', 'gender-female' => 'స్త్రీ', 'prefs-help-gender' => 'ఐచ్ఛికం: లింగ-సమంజసమైన సంబోధనలకు ఈ మృదుఉపకరణం వాడుకుంటుంది. ఈ సమాచారం బహిర్గతమౌతుంది.', 'email' => 'ఈ-మెయిలు', 'prefs-help-realname' => 'అసలు పేరు (తప్పనిసరి కాదు), మీ అసలు పేరు ఇస్తేగనక, మీ రచనలన్నీ మీ అసలు పేరుతోనే గుర్తిస్తూ ఉంటారు.', 'prefs-help-email' => 'ఈ-మెయిలు చిరునామా ఐచ్చికం, కానీ మీరు సంకేతపదాన్ని మర్చిపోతే కొత్త సంకేతపదాన్ని మీకు పంపించడానికి అవసరమవుతుంది.', 'prefs-help-email-others' => 'మీ వాడుకరి లేదా చర్చా పేజీలలో ఉండే లంకె ద్వారా ఇతరులు మిమ్మల్ని ఈ-మెయిలు ద్వారా సంప్రదించే వీలుకల్పించవచ్చు. ఇతరులు మిమ్మల్ని సంప్రదించినప్పుడు మీ ఈ-మెయిలు చిరునామా బహిర్గతమవదు.', 'prefs-help-email-required' => 'ఈ-మెయిలు చిరునామా తప్పనిసరి.', 'prefs-info' => 'ప్రాథమిక సమాచారం', 'prefs-i18n' => 'అంతర్జాతీకరణ', 'prefs-signature' => 'సంతకం', 'prefs-dateformat' => 'తేదీ ఆకృతి', 'prefs-timeoffset' => 'సమయ సవరణ', 'prefs-advancedediting' => 'ఉన్నత ఎంపికలు', 'prefs-advancedrc' => 'ఉన్నత ఎంపికలు', 'prefs-advancedrendering' => 'ఉన్నత ఎంపికలు', 'prefs-advancedsearchoptions' => 'ఉన్నత ఎంపికలు', 'prefs-advancedwatchlist' => 'ఉన్నత ఎంపికలు', 'prefs-displayrc' => 'ప్రదర్శన ఎంపికలు', 'prefs-displaysearchoptions' => 'ప్రదర్శన ఎంపికలు', 'prefs-displaywatchlist' => 'ప్రదర్శన ఎంపికలు', 'prefs-diffs' => 'తేడాలు', # User preference: email validation using jQuery 'email-address-validity-valid' => 'ఈ-మెయిలు చిరునామా సరిగానే ఉన్నట్టుంది', 'email-address-validity-invalid' => 'దయచేసి సరైన ఈమెయిలు చిరునామాని ఇవ్వండి', # User rights 'userrights' => 'వాడుకరి హక్కుల నిర్వహణ', 'userrights-lookup-user' => 'వాడుకరి సమూహాలను సంభాళించండి', 'userrights-user-editname' => 'సభ్యనామాన్ని ఇవ్వండి:', 'editusergroup' => 'వాడుకరి గుంపులను మార్చు', 'editinguser' => "వాడుకరి '''[[User:$1|$1]]''' $2 యొక్క వాడుకరి హక్కులను మారుస్తున్నారు", 'userrights-editusergroup' => 'వాడుకరి సమూహాలను మార్చండి', 'saveusergroups' => 'వాడుకరి గుంపులను భద్రపరచు', 'userrights-groupsmember' => 'సభ్యులు:', 'userrights-groupsmember-auto' => 'సంభావిత సభ్యులు:', 'userrights-groups-help' => 'ఈ వాడుకరి ఏయే గుంపులలో ఉండవచ్చో మీరు మార్చవచ్చు. * టిక్కు పెట్టివుంటే ఆ గుంపులో ఈ వాడుకరి ఉన్నట్టు. * టిక్కు లేకుంటే ఆ గుంపులో ఈ వాడుకరి లేనట్టు. * <nowiki>*</nowiki> ఉంటే ఒకసారి ఆ గుంపుని చేర్చాకా మీరు తీసివేయలేరు, లేదా తీసివేసాకా తిరిగి చేర్చలేరు.', 'userrights-reason' => 'కారణం:', 'userrights-no-interwiki' => 'ఇతర వికీలలో వాడుకరి హక్కులను మార్చడానికి మీకు అనుమతి లేదు.', 'userrights-nodatabase' => '$1 అనే డేటాబేసు లేదు లేదా అది స్థానికం కాదు.', 'userrights-nologin' => 'వాడుకరి హక్కులను ఇవ్వడానికి మీరు తప్పనిసరిగా ఓ నిర్వాహక ఖాతాతో [[Special:UserLogin|లోనికి ప్రవేశించాలి]].', 'userrights-notallowed' => 'వాడుకరి హక్కులను చేర్చే మరియు తొలగించే అనుమతి మీ ఖాతాకు లేదు.', 'userrights-changeable-col' => 'మీరు మార్చదగిన గుంపులు', 'userrights-unchangeable-col' => 'మీరు మార్చలేని గుంపులు', # Groups 'group' => 'గుంపు:', 'group-user' => 'వాడుకరులు', 'group-autoconfirmed' => 'ఆటోమాటిగ్గా నిర్ధారించబడిన వాడుకరులు', 'group-bot' => 'బాట్‌లు', 'group-sysop' => 'నిర్వాహకులు', 'group-bureaucrat' => 'అధికారులు', 'group-suppress' => 'పరాకులు', 'group-all' => '(అందరూ)', 'group-user-member' => '{{GENDER:$1|వాడుకరి}}', 'group-autoconfirmed-member' => '{{GENDER:$1|ఆటోమాటిగ్గా నిర్ధారించబడిన వాడుకరి}}', 'group-bot-member' => '{{GENDER:$1|బాట్}}', 'group-sysop-member' => '{{GENDER:$1|నిర్వాహకుడు|నిర్వాహకురాలు}}', 'group-bureaucrat-member' => '{{GENDER:$1|అధికారి|అధికారిణి}}', 'group-suppress-member' => 'పరాకు', 'grouppage-user' => '{{ns:project}}:వాడుకరులు', 'grouppage-autoconfirmed' => '{{ns:project}}:ఆటోమాటిగ్గా నిర్ధారించబడిన వాడుకరులు', 'grouppage-bot' => '{{ns:project}}:బాట్లు', 'grouppage-sysop' => '{{ns:project}}:నిర్వాహకులు', 'grouppage-bureaucrat' => '{{ns:project}}:అధికార్లు', 'grouppage-suppress' => '{{ns:project}}:పరాకు', # Rights 'right-read' => 'పేజీలు చదవడం', 'right-edit' => 'పేజీలను మార్చడం', 'right-createpage' => 'పేజీలను సృష్టించడం (చర్చాపేజీలు కానివి)', 'right-createtalk' => 'చర్చా పేజీలను సృష్టించడం', 'right-createaccount' => 'కొత్త వాడుకరి ఖాతాలను సృష్టించడం', 'right-minoredit' => 'మార్పుని చిన్నదిగా గుర్తించడం', 'right-move' => 'పేజీలను తరలించడం', 'right-move-subpages' => 'పేజీలను వాటి ఉపపేజీలతో బాటుగా తరలించడం', 'right-move-rootuserpages' => 'వాడుకరుల ప్రధాన పేజీలను తరలించగలగడం', 'right-movefile' => 'ఫైళ్ళను తరలించడం', 'right-suppressredirect' => 'పేజీని తరలించేటపుడు పాత పేరు నుండి దారిమార్పును సృష్టించకుండా ఉండటం', 'right-upload' => 'దస్త్రాలను ఎక్కించడం', 'right-reupload' => 'ఇప్పటికే ఉన్న ఫైలును తిరగరాయి', 'right-reupload-own' => 'తానే ఇదివరలో అప్‌లోడు చేసిన ఫైలును తిరగరాయి', 'right-reupload-shared' => 'స్థానికంగా ఉమ్మడి మీడియా సొరుగులోని ఫైళ్ళను అధిక్రమించు', 'right-upload_by_url' => 'URL అడ్రసునుండి ఫైలును అప్‌లోడు చెయ్యి', 'right-purge' => 'పేజీకి సంబంధించిన సైటు కాషెను, నిర్ధారణ కోరకుండానే తొలగించు', 'right-autoconfirmed' => 'అర్ధ సంరక్షణలో ఉన్న పేజీలలో దిద్దుబాటు చెయ్యి', 'right-bot' => 'ఆటోమాటిక్ ప్రాసెస్ లాగా భావించబడు', 'right-nominornewtalk' => 'చర్చా పేజీల్లో జరిగిన అతి చిన్న మార్పులకు కొత్తసందేశము వచ్చిందన్న సూచన చెయ్యవద్దు', 'right-apihighlimits' => 'API ప్రశ్నల్లో ఉన్నత పరిమితులను వాడు', 'right-writeapi' => 'రైట్ API వినియోగం', 'right-delete' => 'పేజీలను తొలగించడం', 'right-bigdelete' => 'చాలా పెద్ద చరితం ఉన్న పేజీలను తొలగించు', 'right-deleterevision' => 'పేజీల ప్రత్యేకించిన కూర్పులను తొలగించు, తొలగింపును నివారించు', 'right-deletedhistory' => 'తొలగింపులను, వాటి పాఠ్యం లేకుండా, చరితంలో చూడు', 'right-deletedtext' => 'తొలగించిన పాఠ్యాన్ని మరియు తొలగించిన కూర్పుల మధ్య మార్పలని చూడగలగడం', 'right-browsearchive' => 'తొలగించిన పేజీలను వెతుకు', 'right-undelete' => 'పేజీ తొలగింపును రద్దు చెయ్యి', 'right-suppressrevision' => 'నిర్వాహకులకు కనబడకుండా ఉన్న కూర్పులను సమీక్షించి పౌనస్థాపించు', 'right-suppressionlog' => 'గోప్యంగా ఉన్న లాగ్‌లను చూడు', 'right-block' => 'దిద్దుబాటు చెయ్యకుండా ఇతర వాడుకరులను నిరోధించగలగడం', 'right-blockemail' => 'ఈమెయిలు పంపకుండా సభ్యుని నిరోధించు', 'right-hideuser' => 'ప్రజలకు కనబడకుండా చేసి, సభ్యనామాన్ని నిరోధించు', 'right-ipblock-exempt' => 'ఐపీ నిరోధాలు, ఆటో నిరోధాలు, శ్రేణి నిరోధాలను తప్పించు', 'right-proxyunbannable' => 'ప్రాక్సీల ఆటోమాటిక్ నిరోధాన్ని తప్పించు', 'right-unblockself' => 'వారినే అనిరోధించుకోవడం', 'right-protect' => 'సంరక్షణ స్థాయిలను మార్చు, సంరక్షిత పేజీలలో దిద్దుబాటు చెయ్యి', 'right-editprotected' => 'సంరక్షిత పేజీలలో దిద్దుబటు చెయ్యి (కాస్కేడింగు సంరక్షణ లేనివి)', 'right-editinterface' => 'యూజరు ఇంటరుఫేసులో దిద్దుబాటు చెయ్యి', 'right-editusercssjs' => 'ఇతర వాడుకరుల CSS, JS ఫైళ్ళలో దిద్దుబాటు చెయ్యి', 'right-editusercss' => 'ఇతర వాడుకరుల CSS ఫైళ్ళలో దిద్దుబాటు చెయ్యి', 'right-edituserjs' => 'ఇతర వాడుకరుల JS ఫైళ్ళలో దిద్దుబాటు చెయ్యి', 'right-rollback' => 'ఒకానొక పేజీలో చివరి దిద్దుబాటు చేసిన వాడుకరి చేసిన దిద్దుబాట్లను రద్దుచేయి', 'right-markbotedits' => 'వెనక్కి తెచ్చిన దిద్దుబాట్లను బాట్ దిద్దుబాట్లుగా గుర్తించు', 'right-noratelimit' => 'రేటు పరిమితులు ప్రభావం చూపవు', 'right-import' => 'ఇతర వికీల నుండి పేజీలను దిగుమతి చేసుకో', 'right-importupload' => 'ఫైలు అప్‌లోడు నుండి పేజీలను దిగుమతి చేసుకో', 'right-patrol' => 'ఇతరుల దిద్దుబాట్లను నిఘాలో ఉన్నట్లుగా గుర్తించు', 'right-autopatrol' => 'తానే చేసిన మార్పులను నిఘాలో ఉన్నట్లుగా ఆటోమాటిగా గుర్తించు', 'right-patrolmarks' => 'ఇటీవలి మార్పుల నిఘా గుర్తింపులను చూడు', 'right-unwatchedpages' => 'వీక్షణలో లేని పేజీల జాబితాను చూడు', 'right-mergehistory' => 'పేజీల యొక్క చరిత్రలని విలీనం చేయగలగడం', 'right-userrights' => 'వాడుకరులందరి హక్కులను మార్చు', 'right-userrights-interwiki' => 'ఇతర వికీల్లోని వాడుకరుల హక్కులను మార్చు', 'right-siteadmin' => 'డేటాబేసును లాక్, అన్‌లాక్ చెయ్యి', 'right-override-export-depth' => '5 లింకుల లోతు వరకు ఉన్న పేజీలతో సహా, పేజీలను ఎగుమతి చెయ్యి', 'right-sendemail' => 'ఇతర వాడుకరులకు ఈ-మెయిలు పంపించగలగడం', 'right-passwordreset' => 'సంకేతపదాన్ని పునరుద్ధరించిన ఈ-మెయిళ్ళు', # Special:Log/newusers 'newuserlogpage' => 'కొత్త వాడుకరుల చిట్టా', 'newuserlogpagetext' => 'ఇది వాడుకరి నమోదుల చిట్టా.', # User rights log 'rightslog' => 'వాడుకరుల హక్కుల మార్పుల చిట్టా', 'rightslogtext' => 'ఇది వాడుకరుల హక్కులకు జరిగిన మార్పుల చిట్టా.', # Associated actions - in the sentence "You do not have permission to X" 'action-read' => 'ఈ పేజీని చదవండి', 'action-edit' => 'ఈ పేజీని సవరించండి', 'action-createpage' => 'పేజీలను సృష్టించే', 'action-createtalk' => 'చర్చాపేజీలను సృష్టించే', 'action-createaccount' => 'ఈ వాడుకరి ఖాతాని సృష్టించే', 'action-minoredit' => 'ఈ మార్పుని చిన్నదానిగా గుర్తించే', 'action-move' => 'ఈ పేజీని తరలించే', 'action-move-subpages' => 'ఈ పేజీని మరియు దీని ఉపపేజీలను తరలించే', 'action-move-rootuserpages' => 'ప్రధాన వాడుకరి పేజీలని తరలించగడగడం', 'action-movefile' => 'ఈ ఫైలుని తరలించే', 'action-upload' => 'ఈ దస్త్రాన్ని ఎక్కించే', 'action-reupload' => 'ఈ ఫైలుని తిరగవ్రాసే', 'action-reupload-shared' => 'సామూహిక నిక్షేపంపై ఈ ఫైలును అతిక్రమించు', 'action-upload_by_url' => 'ఈ ఫైలుని URL చిరునామా నుండి ఎగుమతి చేసే', 'action-writeapi' => 'వ్రాసే APIని ఉపయోగించే', 'action-delete' => 'ఈ పేజీని తొలగించే', 'action-deleterevision' => 'ఈ కూర్పుని తొలగించే', 'action-deletedhistory' => 'ఈ పేజీ యొక్క తొలగించిన చరిత్రని చూసే', 'action-browsearchive' => 'తొలగించిన పేజీలలో వెతికే', 'action-undelete' => 'ఈ పేజీని పునఃస్థాపించే', 'action-suppressrevision' => 'ఈ దాచిన కూర్పుని సమీక్షించి పునఃస్థాపించే', 'action-suppressionlog' => 'ఈ అంతరంగిక చిట్టాను చూసే', 'action-block' => 'ఈ వాడుకరిని మార్పులు చేయడం నుండి నిరోధించే', 'action-protect' => 'ఈ పేజీకి సంరక్షణా స్థాయిని మార్చే', 'action-import' => 'మరో వికీ నుండి ఈ పేజీని దిగుమతి చేసే', 'action-importupload' => 'ఎగుమతి చేసిన ఫైలు నుండి ఈ పేజీలోనికి దిగుమతి చేసే', 'action-patrol' => 'ఇతరుల మార్పులను పర్యవేక్షించినవిగా గుర్తించే', 'action-autopatrol' => 'మీ మార్పులను పర్యవేక్షించినవిగా గుర్తించే', 'action-unwatchedpages' => 'వీక్షణలో లేని పేజీల జాబితాని చూసే', 'action-mergehistory' => 'ఈ పేజీ యొక్క చరిత్రని విలీనం చేసే', 'action-userrights' => 'అందరు వాడుకరుల హక్కులను మార్చే', 'action-userrights-interwiki' => 'ఇతర వికీలలో వాడుకరుల యొక్క హక్కులను మార్చే', 'action-siteadmin' => 'డాటాబేసుకి తాళం వేసే లేదా తీసే', 'action-sendemail' => 'ఈ-మెయిల్స్ పంపించు', # Recent changes 'nchanges' => '{{PLURAL:$1|ఒక మార్పు|$1 మార్పులు}}', 'enhancedrc-history' => 'చరితం', 'recentchanges' => 'ఇటీవలి మార్పులు', 'recentchanges-legend' => 'ఇటీవలి మార్పుల ఎంపికలు', 'recentchanges-summary' => 'వికీలో ఇటీవలే జరిగిన మార్పులను ఈ పేజీలో గమనించవచ్చు.', 'recentchanges-feed-description' => 'ఈ ఫీడు ద్వారా వికీలో జరుగుతున్న మార్పుల గురించి ఎప్పటికప్పుడు సమాచారాన్ని పొందండి.', 'recentchanges-label-newpage' => 'ఈ మార్పు కొత్త పేజీని సృష్టించింది', 'recentchanges-label-minor' => 'ఇది ఒక చిన్న మార్పు', 'recentchanges-label-bot' => 'ఈ మార్పును ఒక బాటు చేసింది', 'recentchanges-label-unpatrolled' => 'ఈ దిద్దుబాటు మీద నిఘా లేదు', 'rcnote' => "$4 నాడు $5 సమయానికి, గత {{PLURAL:$2|ఒక్క రోజులో|'''$2''' రోజులలో}} చేసిన చివరి {{PLURAL:$1|ఒక్క మార్పు కింద ఉంది|'''$1''' మార్పులు కింద ఉన్నాయి}}.", 'rcnotefrom' => '<b>$2</b> నుండి జరిగిన మార్పులు (<b>$1</b> వరకు చూపబడ్డాయి).', 'rclistfrom' => '$1 నుండి జరిగిన మార్పులను చూపించు', 'rcshowhideminor' => 'చిన్న మార్పులను $1', 'rcshowhidebots' => 'బాట్లను $1', 'rcshowhideliu' => 'ప్రవేశించిన వాడుకరుల మార్పులను $1', 'rcshowhideanons' => 'అజ్ఞాత వాడుకరులను $1', 'rcshowhidepatr' => 'నిఘాలో ఉన్న మార్పులను $1', 'rcshowhidemine' => 'నా మార్పులను $1', 'rclinks' => 'గత $2 రోజుల లోని చివరి $1 మార్పులను చూపించు <br />$3', 'diff' => 'తేడాలు', 'hist' => 'చరిత్ర', 'hide' => 'దాచు', 'show' => 'చూపించు', 'minoreditletter' => 'చి', 'newpageletter' => 'కొ', 'boteditletter' => 'బా', 'number_of_watching_users_pageview' => '[వీక్షిస్తున్న సభ్యులు: {{PLURAL:$1|ఒక్కరు|$1}}]', 'rc_categories' => 'ఈ వర్గాలకు పరిమితం చెయ్యి ("|" తో వేరు చెయ్యండి)', 'rc_categories_any' => 'ఏదయినా', 'rc-change-size-new' => 'మార్పు తర్వాత $1 {{PLURAL:$1|బైటు|బైట్లు}}', 'newsectionsummary' => '/* $1 */ కొత్త విభాగం', 'rc-enhanced-expand' => 'వివరాలని చూపించు (జావాస్క్రిప్ట్ అవసరం)', 'rc-enhanced-hide' => 'వివరాలను దాచు', 'rc-old-title' => 'మొదట "$1"గా సృష్టించారు', # Recent changes linked 'recentchangeslinked' => 'సంబంధిత మార్పులు', 'recentchangeslinked-feed' => 'సంబంధిత మార్పులు', 'recentchangeslinked-toolbox' => 'పొంతనగల మార్పులు', 'recentchangeslinked-title' => '$1 కు సంబంధించిన మార్పులు', 'recentchangeslinked-summary' => "దీనికి లింకై ఉన్న పేజీల్లో జరిగిన చివరి మార్పులు ఇక్కడ చూడవచ్చు. మీ వీక్షణ జాబితాలో ఉన్న పేజీలు '''బొద్దు'''గా ఉంటాయి.", 'recentchangeslinked-page' => 'పేజీ పేరు:', 'recentchangeslinked-to' => 'ఇచ్చిన పేజీకి లింకయివున్న పేజీలలో జరిగిన మార్పులను చూపించు', # Upload 'upload' => 'దస్త్రపు ఎక్కింపు', 'uploadbtn' => 'దస్త్రాన్ని ఎక్కించు', 'reuploaddesc' => 'మళ్ళీ అప్‌లోడు ఫారంకు వెళ్ళు.', 'upload-tryagain' => 'మార్చిన ఫైలు వివరణని దాఖలుచేయండి', 'uploadnologin' => 'లాగిన్‌ అయిలేరు', 'uploadnologintext' => 'ఫైలు అప్‌లోడు చెయ్యాలంటే, మీరు [[Special:UserLogin|లాగిన్‌]] కావాలి', 'upload_directory_missing' => 'ఎగుమతి డైరెక్టరీ ($1) తప్పింది మరియు వెబ్ సర్వర్ దాన్ని సృష్టించలేకున్నది.', 'upload_directory_read_only' => 'అప్‌లోడు డైరెక్టరీ ($1), వెబ్‌సర్వరు రాసేందుకు అనుకూలంగా లేదు.', 'uploaderror' => 'ఎక్కింపు పొరపాటు', 'upload-recreate-warning' => "'''హెచ్చరిక: ఆ పేరుతో ఉన్న దస్త్రాన్ని తరలించి లేదా తొలగించి ఉన్నారు.''' మీ సౌకర్యం కోసం ఈ పుట యొక్క తొలగింపు మరియు తరలింపు చిట్టాని ఇక్కడ ఇస్తున్నాం:", 'uploadtext' => "దస్త్రాలను ఎక్కించడానికి ఈ కింది ఫారాన్ని ఉపయోగించండి. గతంలో ఎక్కించిన దస్త్రాలను చూడడానికి లేదా వెతకడానికి [[Special:FileList|ఎక్కించిన దస్త్రాల యొక్క జాబితా]]కు వెళ్ళండి, (పునః)ఎక్కింపులు [[Special:Log/upload|ఎక్కింపుల చిట్టా]] లోనూ తొలగింపులు [[Special:Log/delete|తొలగింపుల చిట్టా]] లోనూ కూడా నమోదవుతాయి. ఒక దస్త్రాన్ని ఏదైనా పుటలో చేర్చడానికి, కింద చూపిన వాటిలో ఏదేనీ విధంగా లింకుని వాడండి: * దస్త్రపు పూర్తి కూర్పుని వాడడానికి '''<code><nowiki>[[</nowiki>{{ns:file}}<nowiki>:File.jpg]]</nowiki></code>''' * ఎడమ వైపు మార్జినులో 200 పిక్సెళ్ళ వెడల్పుగల బొమ్మ మరియు 'ప్రత్యామ్నాయ పాఠ్యం' అన్న వివరణతో గల పెట్టె కోసం '''<code><nowiki>[[</nowiki>{{ns:file}}<nowiki>:File.png|200px|thumb|left|ప్రత్యామ్నాయ పాఠ్యం]]</nowiki></code>''' * దస్త్రాన్ని చూపించకుండా నేరుగా లింకు ఇవ్వడానికి '''<code><nowiki>[[</nowiki>{{ns:media}}<nowiki>:File.ogg]]</nowiki></code>'''", 'upload-permitted' => 'అనుమతించే ఫైలు రకాలు: $1.', 'upload-preferred' => 'అనుమతించే ఫైలు రకాలు: $1.', 'upload-prohibited' => 'నిషేధించిన ఫైలు రకాలు: $1.', 'uploadlog' => 'ఎక్కింపుల చిట్టా', 'uploadlogpage' => 'ఎక్కింపుల చిట్టా', 'uploadlogpagetext' => 'ఇటీవల జరిగిన ఫైలు అప్‌లోడుల జాబితా ఇది.', 'filename' => 'ఫైలు పేరు', 'filedesc' => 'సారాంశం', 'fileuploadsummary' => 'సారాంశం:', 'filereuploadsummary' => 'ఫైలు మార్పులు:', 'filestatus' => 'కాపీహక్కు స్థితి:', 'filesource' => 'మూలం:', 'uploadedfiles' => 'ఎగుమతయిన ఫైళ్ళు', 'ignorewarning' => 'హెచ్చరికను పట్టించుకోకుండా ఫైలును భద్రపరచు', 'ignorewarnings' => 'హెచ్చరికలను పట్టించుకోవద్దు', 'minlength1' => 'పైలు పేర్లు కనీసం ఒక్క అక్షరమైనా ఉండాలి.', 'illegalfilename' => '"$1" అనే దస్త్రపుపేరు పేజీ శీర్షికలలో వాడకూడని అక్షరాలను కలిగివుంది. దస్త్రపు పేరుని మార్చి మళ్ళీ ఎక్కించడానికి ప్రయత్నించండి.', 'filename-toolong' => 'దస్త్రపు పేరు 240 బైట్ల కంటే పొడవు ఉండకూడదు.', 'badfilename' => 'ఫైలు పేరు "$1"కి మార్చబడినది.', 'filetype-mime-mismatch' => 'దస్త్రపు పొడగింపు ".$1" ఆ దస్త్రం యొక్క MIME రకం ($2) తో సరిపోలలేదు.', 'filetype-badmime' => '"$1" MIME రకం ఉన్న ఫైళ్ళను ఎగుమతికి అనుమతించం.', 'filetype-bad-ie-mime' => 'ఈ ఫైలుని ఎగుమతి చేయలేరు ఎందుకంటే ఇంటర్నెట్ ఎక్స్‌ప్లోరర్ దీన్ని "$1" గా చూపిస్తుంది, ఇది అనుమతి లేని మరియు ప్రమాదకారమైన ఫైలు రకం.', 'filetype-unwanted-type' => "'''\".\$1\"''' అనేది అవాంఛిత ఫైలు రకం. \$2 {{PLURAL:\$3|అనేది వాడదగ్గ ఫైలు రకం|అనేవి వాడదగ్గ ఫైలు రకాలు}}.", 'filetype-banned-type' => '\'\'\'".$1"\'\'\' {{PLURAL:$4|అనేది అనుమతించబడిన ఫైలు రకం కాదు|అనేవి అనుమతించబడిన ఫైలు రకాలు కాదు}}. అనుమతించబడిన {{PLURAL:$3|ఫైలు రకం|ఫైలు రకాలు}} $2.', 'filetype-missing' => 'ఫైలుకి పొడగింపు (".jpg" లాంటిది) లేదు.', 'empty-file' => 'మీరు సమర్పించిన దస్త్రం ఖాళీగా ఉంది.', 'file-too-large' => 'మీరు సమర్పించిన దస్త్రం చాలా పెద్దగా ఉంది.', 'filename-tooshort' => 'దస్త్రపు పేరు మరీ చిన్నగా ఉంది.', 'filetype-banned' => 'ఈ రకపు దస్త్రాలని నిషేధించాము.', 'verification-error' => 'దస్త్రపు తనిఖీలో ఈ దస్త్రం ఉత్తీర్ణమవలేదు.', 'hookaborted' => 'మీరు చేయప్రత్నించిన మార్పుని ఒక పొడగింత కొక్కెం విచ్ఛిన్నం చేసింది.', 'illegal-filename' => 'ఆ దస్త్రపుపేరు అనుమతించబడదు.', 'overwrite' => 'ఇప్పటికే ఉన్న దస్త్రాన్ని తిరిగరాయడం అనుమతించబడదు.', 'unknown-error' => 'ఏదో తెలియని పొరపాటు జరిగింది.', 'tmp-create-error' => 'తాత్కాలిక దస్త్రాన్ని సృష్టించలేకపోయాం.', 'tmp-write-error' => 'తాత్కాలిక దస్త్రాన్ని రాయడంలో పొరపాటు.', 'large-file' => 'ఫైళ్ళు $1 కంటే పెద్దవిగా ఉండకుండా ఉంటే మంచిది; ఈ ఫైలు $2 ఉంది.', 'largefileserver' => 'ఈ ఫైలు సైజు సర్వరులో విధించిన పరిమితి కంటే ఎక్కువగా ఉంది.', 'emptyfile' => 'మీరు అప్‌లోడు చేసిన ఫైలు ఖాళీగా ఉన్నట్లుంది. ఫైలు పేరును ఇవ్వడంలో స్పెల్లింగు తప్పు దొర్లి ఉండొచ్చు. మీరు అప్‌లోడు చెయ్యదలచింది ఇదో కాదో నిర్ధారించుకోండి.', 'windows-nonascii-filename' => 'దస్త్రాల పేర్లలో ప్రత్యేక అక్షరాలకు ఈ వికీలో తోడ్పాటు లేదు.', 'fileexists' => 'ఈ పేరుతో ఒక ఫైలు ఇప్పటికే ఉంది. దీనిని మీరు మార్చాలో లేదో తెలియకపోతె ఫైలు <strong>[[:$1]]</strong>ని చూడండి. [[$1|thumb]]', 'filepageexists' => 'ఈ ఫైలు కొరకు వివరణ పేజీని <strong>[[:$1]]</strong> వద్ద ఈసరికే సృష్టించారు, కానీ ఆ పేరుతో ప్రస్తుతం ఏ ఫైలూ లేదు. మీరు ఇస్తున్న సంగ్రహం ఆ వివరణ పేజీలో కనబడదు. మీ సంగ్రహం అక్కడ కనబడాలంటే, నేరుగా అక్కడే చేర్చాలి. [[$1|thumb]]', 'fileexists-extension' => 'ఇటువంటి పేరుతో మరో ఫైలు ఉంది: [[$2|thumb]] * ఎగుమతి చేస్తున్న ఫైలు పేరు: <strong>[[:$1]]</strong> * ప్రస్తుతం ఉన్న ఫైలు పేరు: <strong>[[:$2]]</strong> దయచేసి మరో పేరు ఎంచుకోండి.', 'fileexists-thumbnail-yes' => "ఈ ఫైలు కుదించిన బొమ్మ లాగా ఉంది ''(థంబ్‌నెయిలు)''. [[$1|thumb]] <strong>[[:$1]]</strong> ఫైలు చూడండి. గుర్తు పెట్టబడిన ఫైలు అసలు సైజే అది అయితే, మరో థంబ్‌నెయిలును అప్‌లోడు చెయ్యాల్సిన అవసరం లేదు.", 'file-thumbnail-no' => "ఫైలు పేరు <strong>$1</strong> తో మొదలవుతోంది. అది పరిమాణం తగ్గించిన ''(నఖచిత్రం)'' లాగా అనిపిస్తోంది. ఈ బొమ్మ యొక్క పూర్తి స్పష్టత కూర్పు ఉంటే, దాన్ని ఎగుమతి చెయ్యండి. లేదా ఫైలు పేరును మార్చండి.", 'fileexists-forbidden' => 'ఈ పేరుతో ఇప్పటికే ఒక ఫైలు ఉంది, దాన్ని తిరగరాయలేరు. మీరు ఇప్పటికీ ఈ ఫైలుని ఎగుమతి చేయాలనుకుంటే, వెనక్కి వెళ్ళి మరో పేరుతో ఎగుమతి చేయండి. [[File:$1|thumb|center|$1]]', 'fileexists-shared-forbidden' => 'ఈ పేరుతో ఇప్పటికే ఒక ఫైలు అందరి ఫైళ్ళ ఖజానాలో ఉంది. ఇప్పటికీ మీ ఫైలుని ఎగుమతి చేయాలనుకుంటే, వెనక్కివెళ్ళి మరో పేరు వాడండి. [[File:$1|thumb|center|$1]]', 'file-exists-duplicate' => 'ఈ ఫైలు క్రింద పేర్కొన్న {{PLURAL:$1|ఫైలుకి|ఫైళ్ళకి}} నకలు:', 'file-deleted-duplicate' => 'గతంలో ఈ ఫైలు లాంటిదే ఒక ఫైలుని ([[:$1]]) తొలగించివున్నారు. మీరు దీన్ని ఎగుమతి చేసేముందు ఆ ఫైలు యొక్క తొలగింపు చరిత్రని ఒక్కసారి చూడండి.', 'uploadwarning' => 'ఎక్కింపు హెచ్చరిక', 'uploadwarning-text' => 'ఫైలు వివరణని క్రింద మార్చి మళ్ళీ ప్రయత్నించండి.', 'savefile' => 'దస్త్రాన్ని భద్రపరచు', 'uploadedimage' => '"[[$1]]"ని ఎక్కించారు', 'overwroteimage' => '"[[$1]]" యొక్క కొత్త కూర్పును ఎక్కించారు', 'uploaddisabled' => 'క్షమించండి, అప్‌లోడు చెయ్యడం ప్రస్తుతానికి ఆపబడింది', 'copyuploaddisabled' => 'URL ద్వారా ఎక్కింపుని అశక్తం చేసారు.', 'uploadfromurl-queued' => 'మీ ఎక్కింపు వరుసలో ఉంది.', 'uploaddisabledtext' => 'ఫైళ్ళ ఎగుమతులను అచేతనం చేసారు.', 'php-uploaddisabledtext' => 'PHPలో ఫైలు ఎక్కింపులు అచేతనమై ఉన్నాయి. దయచేసి file_uploads అమరికని చూడండి.', 'uploadscripted' => 'ఈ ఫైల్లో HTML కోడు గానీ స్క్రిప్టు కోడు గానీ ఉంది. వెబ్ బ్రౌజరు దాన్ని పొరపాటుగా అనువదించే అవకాశం ఉంది.', 'uploadvirus' => 'ఈ ఫైలులో వైరస్‌ ఉంది! వివరాలు: $1', 'uploadjava' => 'ఇదొక ZIP ఫైలు, ఇందులో ఒక Java .class ఫైలు ఉంది. Java ఫైళ్ళ వలన భద్రతకు తూట్లు పడే అవకాశం ఉంది కాబట్టి, వాటిని ఎక్కించడానికి అనుమతి లేదు.', 'upload-source' => 'మూల దస్త్రం', 'sourcefilename' => 'మూలం ఫైలుపేరు:', 'sourceurl' => 'మూల URL:', 'destfilename' => 'ఉద్దేశించిన ఫైలుపేరు:', 'upload-maxfilesize' => 'గరిష్ట ఫైలు పరిమాణం: $1', 'upload-description' => 'దస్త్రపు వివరణ', 'upload-options' => 'ఎక్కింపు వికల్పాలు', 'watchthisupload' => 'ఈ ఫైలుని గమనించు', 'filewasdeleted' => 'ఇదే పేరుతో ఉన్న ఒక ఫైలును గతంలో అప్లోడు చేసారు, తరువాతి కాలంలో దాన్ని తొలగించారు. దాన్నీ మళ్ళీ అప్లోడు చేసే ముందు, మీరు $1 ను చూడాలి', 'filename-bad-prefix' => "మీరు అప్లోడు చేస్తున్న ఫైలు పేరు '''\"\$1\"''' తో మొదలవుతుంది. ఇది డిజిటల్ కెమెరాలు ఆటోమాటిగ్గా ఇచ్చే పేరు. మరింత వివరంగా ఉండే పేరును ఎంచుకోండి.", 'upload-success-subj' => 'అప్‌లోడు జయప్రదం', 'upload-success-msg' => '[$2] నుండి మీ ఎక్కింపు సఫలమైంది. అది ఇక్కడ అందుబాటులో ఉంది: [[:{{ns:file}}:$1]]', 'upload-failure-subj' => 'ఎక్కింపు సమస్య', 'upload-failure-msg' => '[$2] నుండి మీ ఎక్కింపుతో ఏదో సమస్య ఉంది: $1', 'upload-warning-subj' => 'ఎక్కింపు హెచ్చరిక', 'upload-warning-msg' => '[$2] నుండి మీ ఎక్కింపులో ఏదో సమస్య ఉంది. దాన్ని సరిచేయడానికి మీరు తిరిగి [[Special:Upload/stash/$1|ఎక్కింపు ఫారానికి]] వెళ్ళవచ్చు.', 'upload-proto-error' => 'తప్పు ప్రోటోకోల్', 'upload-proto-error-text' => 'రిమోట్ అప్‌లోడులు చెయ్యాలంటే URLలు <code>http://</code> లేదా <code>ftp://</code> తో మొదలు కావాలి.', 'upload-file-error' => 'అంతర్గత లోపం', 'upload-file-error-text' => 'సర్వరులో తాత్కాలిక ఫైలును సృష్టించబోగా ఏదో అంతర్గత లోపం తలెత్తింది. ఎవరైనా [[Special:ListUsers/sysop|నిర్వాహకుడిని]] సంప్రదించండి.', 'upload-misc-error' => 'తెలియని అప్‌లోడు లోపం', 'upload-misc-error-text' => 'అప్‌లోడు చేస్తూండగా ఏదో తెలియని లోపం తలెత్తింది. URL సరైనదేనని, అది అందుబాటులోనే ఉందని నిర్ధారించుకుని మళ్ళీ ప్రయత్నిందండి. సమస్య అలాగే ఉంటే, సిస్టము నిర్వాహకుని సంప్రదించండి.', 'upload-too-many-redirects' => 'ఆ URLలో చాలా దారిమార్పులు ఉన్నాయి', 'upload-unknown-size' => 'సైజు తెలియదు', 'upload-http-error' => 'ఒక HTTP పొరపాటు జరిగింది: $1', # File backend 'backend-fail-notexists' => '$1 ఫైలు అసలు లేనేలేదు.', 'backend-fail-delete' => '$1 ఫైలును తొలగించలేకున్నాం.', 'backend-fail-alreadyexists' => '$1 అనే దస్త్రం ఇప్పటికే ఉంది.', 'backend-fail-opentemp' => 'తాత్కాలిక దస్త్రాన్ని తెరవలేకపోతున్నాం.', 'backend-fail-closetemp' => 'తాత్కాలిక దస్త్రాన్ని మూసివేయలేకపోయాం.', 'backend-fail-read' => '$1 దస్త్రము చదువలేకపోతిమి.', 'backend-fail-create' => '$1 ఫైలులో రాయలేకున్నాం.', # ZipDirectoryReader 'zip-file-open-error' => 'ఈ ఫైలును ZIP పరీక్ష కోసం తెరవబోతే, ఏదో తెలియని లోపం ఎదురైంది.', 'zip-wrong-format' => 'ఇచ్చినది ZIP ఫైలు కాదు.', 'zip-bad' => 'ఫైలు చెడిపోయిన, లేదా చదవడానికి వీల్లేని ZIP ఫైలు అయ్యుండాలి. దానిపై భద్రతా పరమైన పరీక్ష చెయ్యలేం.', 'zip-unsupported' => 'ఇది MediaWiki కి పట్టులేని ZIP అంశాలు కలిగిన ZIP ఫైలు. దీనిపై సరైన భద్రతా పరీక్షలు చెయ్యలేం.', # Special:UploadStash 'uploadstash-summary' => 'ఎక్కించినప్పటికీ వికీలో ప్రచురితం కాని (లేదా ఎక్కింపు జరుగుతున్న) ఫైళ్ళు ఈ పేజీలో కనిపిస్తాయి. ఈ ఫైళ్ళు ఎక్కించిన వాడుకరికి తప్ప మరొకరికి కనబడవు.', 'uploadstash-badtoken' => 'ఆ చర్య విఫలమైంది. బహుశా మీ ఎడిటింగు అనుమతులకు కాలం చెల్లిందేమో. మళ్ళీ ప్రయత్నించండి.', 'uploadstash-errclear' => 'ఫైళ్ళ తీసివేత విఫలమైంది.', 'uploadstash-refresh' => 'దస్త్రాల జాబిజాను తాజాకరించు', # img_auth script messages 'img-auth-accessdenied' => 'అనుమతిని నిరాకరించారు', 'img-auth-nopathinfo' => 'PATH_INFO లేదు. మీ సర్వరు ఈ సమాచారాన్ని పంపించేందుకు అనువుగా అమర్చి లేదు. అది CGI ఆధారితమై ఉండొచ్చు. అంచేత img_auth కు అనుకూలంగా లేదు. https://www.mediawiki.org/wiki/Manual:Image_Authorization చూడండి.', 'img-auth-notindir' => 'అభ్యర్థించిన తోవ ఎక్కింపు సంచయంలో లేదు.', 'img-auth-badtitle' => '"$1" నుండి సరైన శీర్షికని నిర్మించలేకపోయాం.', 'img-auth-nologinnWL' => 'మీరు ప్రవేశించి లేరు మరియు "$1" అనేది తెల్లజాబితాలో లేదు.', 'img-auth-nofile' => '"$1" అనే ఫైలు ఉనికిలో లేదు.', 'img-auth-isdir' => 'మీరు "$1" అనే సంచయాన్ని చూడడానికి ప్రయత్నిస్తున్నారు. ఫైళ్ళను చూడడానికి మాత్రమే అనుమతివుంది.', 'img-auth-streaming' => '"$1" ను ప్రసారిస్తున్నాం.', 'img-auth-public' => 'img_auth.php యొక్క పని, గోప్యవికీలనుండి ఫైళ్ళ వివరాలను బయట పెట్టడం. ఇది బహిరంగ వికీగా తయారుచేయబడింది. సరైన భద్రత కోసం, img_auth.php ను అచేతనం చేసాం.', 'img-auth-noread' => '"$1"ని చూడడానికి వాడుకరికి అనుమతి లేదు.', 'img-auth-bad-query-string' => 'ఈ URL లో తప్పుడు క్వెరీ స్ట్రింగు ఉంది.', # HTTP errors 'http-invalid-url' => 'తప్పుడు URL: $1', 'http-invalid-scheme' => '"$1" ప్రణాళికలో ఉన్న URLలకు తోడ్పాటులేదు', 'http-request-error' => 'తెలియని పొరపాటు వల్ల HTTP అభ్యర్థన విఫలమైంది.', 'http-read-error' => 'HTTP చదువుటలో పొరపాటు.', 'http-timed-out' => 'HTTP అభ్యర్థనకి కాలం చెల్లింది.', 'http-curl-error' => 'URLని తేవడంలో పొరపాటు: $1', 'http-bad-status' => 'HTTP అభ్యర్ధన చేస్తున్నప్పుడు సమస్య ఉంది: $1 $2', # Some likely curl errors. More could be added from <http://curl.haxx.se/libcurl/c/libcurl-errors.html> 'upload-curl-error6' => 'URL కు వెళ్ళలేకపోయాం', 'upload-curl-error6-text' => 'ఇచ్చిన URL కు వెళ్ళలేకపోయాం. URL సరైనదేనని, సైటు పనిచేస్తూనే ఉన్నదనీ నిర్ధారించుకోండి.', 'upload-curl-error28' => 'అప్లోడు కాలాతీతం', 'upload-curl-error28-text' => 'చాలా సమయం తరువాత కూడా సైటు స్పందించలేదు. సైటు పనిచేస్తూనే ఉందని నిర్ధారించుకుని, కాస్త ఆగి మళ్ళీ ప్రయత్నించండి. రద్దీ కాస్త తక్కువగా ఉన్నపుడు ప్రయత్నిస్తే నయం.', 'license' => 'లైసెన్సు వివరాలు:', 'license-header' => 'లైసెన్సింగ్', 'nolicense' => 'దేన్నీ ఎంచుకోలేదు', 'license-nopreview' => '(మునుజూపు అందుబాటులో లేదు)', 'upload_source_url' => ' (సార్వజనికంగా అందుబాటులో ఉన్న, సరైన URL)', 'upload_source_file' => ' (మీ కంప్యూటర్లో ఒక ఫైలు)', # Special:ListFiles 'listfiles-summary' => 'ఈ ప్రత్యేక పేజీ ఇప్పటి వరకూ ఎక్కించిన దస్త్రాలన్నింటినీ చూపిస్తుంది. వాడుకరి పేరు మీద వడపోసినప్పుడు, ఆ వాడుకరి ఎక్కించిన కూర్పు ఆ దస్త్రం యొక్క సరికొత్త కూర్పు అయితేనే చూపిస్తుంది.', 'listfiles_search_for' => 'మీడియా పేరుకై వెతుకు:', 'imgfile' => 'దస్త్రం', 'listfiles' => 'దస్త్రాల జాబితా', 'listfiles_thumb' => 'నఖచిత్రం', 'listfiles_date' => 'తేదీ', 'listfiles_name' => 'పేరు', 'listfiles_user' => 'వాడుకరి', 'listfiles_size' => 'పరిమాణం', 'listfiles_description' => 'వివరణ', 'listfiles_count' => 'కూర్పులు', # File description page 'file-anchor-link' => 'దస్త్రం', 'filehist' => 'దస్త్రపు చరిత్ర', 'filehist-help' => 'తేదీ/సమయం ను నొక్కి ఆ సమయాన ఫైలు ఎలా ఉండేదో చూడవచ్చు.', 'filehist-deleteall' => 'అన్నిటినీ తొలగించు', 'filehist-deleteone' => 'తొలగించు', 'filehist-revert' => 'తిరుగుసేత', 'filehist-current' => 'ప్రస్తుత', 'filehist-datetime' => 'తేదీ/సమయం', 'filehist-thumb' => 'నఖచిత్రం', 'filehist-thumbtext' => '$1 యొక్క నఖచిత్ర కూర్పు', 'filehist-nothumb' => 'నఖచిత్రం లేదు', 'filehist-user' => 'వాడుకరి', 'filehist-dimensions' => 'కొలతలు', 'filehist-filesize' => 'దస్త్రపు పరిమాణం', 'filehist-comment' => 'వ్యాఖ్య', 'filehist-missing' => 'ఫైలు కనిపించుటలేదు', 'imagelinks' => 'దస్త్రపు వాడుక', 'linkstoimage' => 'కింది {{PLURAL:$1|పేజీ|$1 పేజీల}} నుండి ఈ ఫైలుకి లింకులు ఉన్నాయి:', 'linkstoimage-more' => '$1 కంటే ఎక్కువ {{PLURAL:$1|పేజీలు|పేజీలు}} ఈ ఫైలుకి లింకుని కలిగివున్నాయి. ఈ ఫైలుకి లింకున్న {{PLURAL:$1|మొదటి ఒక పేజీని|మొదటి $1 పేజీలను}} ఈ క్రింది జాబితా చూపిస్తుంది. [[Special:WhatLinksHere/$2|పూర్తి జాబితా]] కూడా ఉంది.', 'nolinkstoimage' => 'ఈ ఫైలుకు లింకున్న పేజీలు లేవు.', 'morelinkstoimage' => 'ఈ ఫైలుకు ఇంకా [[Special:WhatLinksHere/$1| లింకులను]] చూడు', 'linkstoimage-redirect' => '$1 (దస్త్రపు దారిమార్పు) $2', 'duplicatesoffile' => 'క్రింద పేర్కొన్న {{PLURAL:$1|ఫైలు ఈ ఫైలుకి నకలు|$1 ఫైళ్ళు ఈ ఫైలుకి నకళ్ళు}} ([[Special:FileDuplicateSearch/$2|మరిన్ని వివరాలు]]):', 'sharedupload' => 'ఈ ఫైలు $1 నుండి మరియు దీనిని ఇతర ప్రాజెక్టులలో కూడా ఉపయోగిస్తూవుండవచ్చు.', 'sharedupload-desc-there' => 'ఈ ఫైలు $1 నుండి వచ్చింది అలానే ఇతర ప్రాజెక్టులలో కూడా ఉపయోగిస్తూ ఉండవచ్చు. మరింత సమాచారం కోసం, దయచేసి [$2 ఫైలు వివరణ పేజీ]ని చూడండి.', 'sharedupload-desc-here' => 'ఈ ఫైలు $1 నుండి మరియు దీనిని ఇతర ప్రాజెక్టులలో కూడా ఉపయోగిస్తూ ఉండవచ్చు. దీని [$2 ఫైలు వివరణ పేజీ] లో ఉన్న వివరణని క్రింద చూపించాం.', 'filepage-nofile' => 'ఈ పేరుతో ఏ ఫైలు లేదు.', 'filepage-nofile-link' => 'ఈ పేరుతో ఏ ఫైలూ లేదు, కానీ మీరు $1 ను అప్‌లోడ్ చెయ్యవచ్చు.', 'uploadnewversion-linktext' => 'ఈ దస్త్రపు కొత్త కూర్పును ఎక్కించండి', 'shared-repo-from' => '$1 నుండి', 'shared-repo' => 'సామూహిక నిక్షేపం', 'shared-repo-name-wikimediacommons' => 'వికీమీడియా కామన్స్', 'upload-disallowed-here' => 'ఈ దస్త్రాన్ని మీరు తిరగరాయలేరు.', # File reversion 'filerevert' => '$1 ను వెనక్కు తీసుకుపో', 'filerevert-legend' => 'ఫైలును వెనక్కు తీసుకుపో', 'filerevert-intro' => "మీరు '''[[Media:$1|$1]]''' ను [$3, $2 నాటి $4 కూర్పు]కు తీసుకు వెళ్తున్నారు.", 'filerevert-comment' => 'కారణం:', 'filerevert-defaultcomment' => '$2, $1 నాటి కూర్పుకు తీసుకువెళ్ళాం', 'filerevert-submit' => 'వెనక్కు తీసుకువెళ్ళు', 'filerevert-success' => "'''[[Media:$1|$1]]''' ను [$3, $2 నాటి $4 కూర్పు]కు తీసుకువెళ్ళాం.", 'filerevert-badversion' => 'మీరిచ్చిన టైముస్టాంపుతో ఈ ఫైలుకు స్థానిక కూర్పేమీ లేదు.', # File deletion 'filedelete' => '$1ని తొలగించు', 'filedelete-legend' => 'ఫైలుని తొలగించు', 'filedelete-intro' => "మీరు '''[[Media:$1|$1]]''' ఫైలుని దాని చరిత్రతో సహా తొలగించబోతున్నారు.", 'filedelete-intro-old' => "మీరు '''[[Media:$1|$1]]''' యొక్క [$4 $3, $2] నాటి కూర్పును తొలగిస్తున్నారు.", 'filedelete-comment' => 'కారణం:', 'filedelete-submit' => 'తొలగించు', 'filedelete-success' => "'''$1'''ని తొలగించాం.", 'filedelete-success-old' => "'''[[Media:$1|$1]]''' యొక్క $3, $2 నాటి కూర్పును తొలగించాం.</span>", 'filedelete-nofile' => "'''$1''' ఇక్కడ లేదు.", 'filedelete-nofile-old' => "'''$1''' యొక్క పాత కూర్పుల్లో మీరిచ్చిన పరామితులు కలిగిన కూర్పేమీ లేదు.", 'filedelete-otherreason' => 'ఇతర/అదనపు కారణం:', 'filedelete-reason-otherlist' => 'ఇతర కారణం', 'filedelete-reason-dropdown' => '* మామూలు తొలగింపు కారణాలు ** కాపీహక్కుల ఉల్లంఘన ** వేరొక దస్త్రానికి నకలు', 'filedelete-edit-reasonlist' => 'తొలగింపు కారణాలని మార్చండి', 'filedelete-maintenance' => 'సంరక్షణ నిమిత్తం ఫైళ్ళ తొలగింపు మరియు పునస్థాపనలను తాత్కాలికంగా అచేయతనం చేసారు.', 'filedelete-maintenance-title' => 'దస్త్రాన్ని తొలగించలేకపోయాం', # MIME search 'mimesearch' => 'బొమ్మల మెటాడేటా(MIME)ను వెతకండి', 'mimesearch-summary' => 'ఈ పేజీ MIME-రకాన్ననుసరించి ఫైళ్ళను వడగట్టేందుకు దోహదం చేస్తుంది. Input: contenttype/subtype, ఉదా. <code>బొమ్మ/jpeg</code>.', 'mimetype' => 'MIME రకం:', 'download' => 'డౌన్‌లోడు', # Unwatched pages 'unwatchedpages' => 'వీక్షణలో లేని పేజీలు', # List redirects 'listredirects' => 'దారిమార్పుల జాబితా', # Unused templates 'unusedtemplates' => 'వాడని మూసలు', 'unusedtemplatestext' => 'వేరే ఇతర పేజీలలో చేర్చని {{ns:template}} పేరుబరిలోని పేజీలన్నింటినీ ఈ పేజీ చూపిస్తుంది. మూసలను తొలగించే ముందు వాటికి ఉన్న ఇతర లింకుల కోసం చూడడం గుర్తుంచుకోండి.', 'unusedtemplateswlh' => 'ఇతర లింకులు', # Random page 'randompage' => 'యాదృచ్ఛిక పేజీ', 'randompage-nopages' => 'ఈ క్రింది {{PLURAL:$2|పెరుబరిలో|పెరుబరులలో}} పేజీలు ఏమి లేవు:$1', # Random redirect 'randomredirect' => 'యాదృచ్చిక దారిమార్పు', 'randomredirect-nopages' => '"$1" పేరుబరిలో దారిమార్పులేమీ లేవు.', # Statistics 'statistics' => 'గణాంకాలు', 'statistics-header-pages' => 'పేజీ గణాంకాలు', 'statistics-header-edits' => 'మార్పుల గణాంకాలు', 'statistics-header-views' => 'వీక్షణల గణాంకాలు', 'statistics-header-users' => 'వాడుకరులు', 'statistics-header-hooks' => 'ఇతర గణాంకాలు', 'statistics-articles' => 'విషయపు పేజీలు', 'statistics-pages' => 'పేజీలు', 'statistics-pages-desc' => 'ఈ వికీలోని అన్ని పేజీలు (చర్చా పేజీలు, దారిమార్పులు, మొదలైనవన్నీ కలుపుకొని).', 'statistics-files' => 'ఎక్కించిన దస్త్రాలు', 'statistics-edits' => '{{SITENAME}}ని మొదలుపెట్టినప్పటినుండి జరిగిన మార్పులు', 'statistics-edits-average' => 'పేజీకి సగటు మార్పులు', 'statistics-views-total' => 'మొత్తం వీక్షణలు', 'statistics-views-total-desc' => 'ఉనికిలో లేని పుటలకు మరియు ప్రత్యేక పుటలకు వచ్చిన సందర్శనలని కలుపలేదు', 'statistics-views-peredit' => 'ఒక మార్పుకి వీక్షణలు', 'statistics-users' => 'నమోదైన [[Special:ListUsers|వాడుకర్లు]]', 'statistics-users-active' => 'క్రియాశీల వాడుకర్లు', 'statistics-users-active-desc' => 'గత {{PLURAL:$1|రోజు|$1 రోజుల}}లో ఒక్క చర్యైనా చేసిన వాడుకరులు', 'statistics-mostpopular' => 'ఎక్కువగా చూసిన పేజీలు', 'pageswithprop-submit' => 'వెళ్ళు', 'doubleredirects' => 'జంట దారిమార్పులు', 'doubleredirectstext' => 'ఇతర దారిమార్పు పుటలకి తీసుకెళ్ళే దారిమార్పులని ఈ పుట చూపిస్తుంది. ప్రతీ వరుసలో మొదటి మరియు రెండవ దారిమార్పులకు లంకెలు, ఆలానే రెండవ దారిమార్పు పుట యొక్క లక్ష్యం ఉన్నాయి. సాధారణంగా ఈ రెండవ దారిమార్పు యొక్క లక్ష్యమే "అసలైనది", అదే మొదటి దారిమార్పు యొక్క లక్ష్యంగా ఉండాలి. <del>కొట్టివేయబడిన</del> పద్దులు పరిష్కరించబడ్డవి.', 'double-redirect-fixed-move' => '[[$1]]ని తరలించారు, అది ప్రస్తుతం [[$2]]కి దారిమార్పు.', 'double-redirect-fixed-maintenance' => '[[$1]] కు జమిలి దారిమార్పును [[$2]] కు సరిచేస్తున్నాం.', 'double-redirect-fixer' => 'దారిమార్పు సరిద్దువారు', 'brokenredirects' => 'తెగిపోయిన దారిమార్పులు', 'brokenredirectstext' => 'కింది దారిమార్పులు లేని-పేజీలకు మళ్ళించుతున్నాయి:', 'brokenredirects-edit' => 'సవరించు', 'brokenredirects-delete' => 'తొలగించు', 'withoutinterwiki' => 'భాషా లింకులు లేని పేజీలు', 'withoutinterwiki-summary' => 'క్రింది పేజీల నుండి ఇతర భాషా వికీలకు లింకులు లేవు:', 'withoutinterwiki-legend' => 'ఆదిపదం', 'withoutinterwiki-submit' => 'చూపించు', 'fewestrevisions' => 'అతి తక్కువ కూర్పులు కలిగిన వ్యాసాలు', # Miscellaneous special pages 'nbytes' => '$1 {{PLURAL:$1|బైటు|బైట్లు}}', 'ncategories' => '$1 {{PLURAL:$1|వర్గం|వర్గాలు}}', 'ninterwikis' => '$1 {{PLURAL:$1|అంతర్వికీ|అంతర్వికీలు}}', 'nlinks' => '$1 {{PLURAL:$1|లింకు|లింకులు}}', 'nmembers' => '{{PLURAL:$1|ఒక ఉపవర్గం/పేజీ/ఫైలు|$1 ఉపవర్గాలు/పేజీలు/ఫైళ్లు}}', 'nrevisions' => '{{PLURAL:$1|ఒక సంచిక|$1 సంచికలు}}', 'nviews' => '$1 {{PLURAL:$1|దర్శనము|దర్శనలు}}', 'nimagelinks' => '$1 {{PLURAL:$1|పుట|పుటల}}లో ఉపయోగించారు', 'ntransclusions' => '$1 {{PLURAL:$1|పుట|పుటల}}లో ఉపయోగించారు', 'specialpage-empty' => 'ఈ పేజీ ఖాళీగా ఉంది.', 'lonelypages' => 'అనాధ పేజీలు', 'lonelypagestext' => 'కింది పేజీలకు {{SITENAME}}లోని ఏ ఇతర పేజీ నుండి కూడా లింకులు లేవు లేదా ఇవి మరే ఇతర పేజీలోనూ కలపబడలేదు.', 'uncategorizedpages' => 'వర్గీకరించని పేజీలు', 'uncategorizedcategories' => 'వర్గీకరించని వర్గములు', 'uncategorizedimages' => 'వర్గీకరించని బొమ్మలు', 'uncategorizedtemplates' => 'వర్గీకరించని మూసలు', 'unusedcategories' => 'ఉపయోగించని వర్గాలు', 'unusedimages' => 'ఉపయోగించబడని ఫైళ్ళు', 'popularpages' => 'ప్రజాదరణ పొందిన పేజీలు', 'wantedcategories' => 'కోరిన వర్గాలు', 'wantedpages' => 'కోరిన పేజీలు', 'wantedpages-badtitle' => 'ఫలితాల సమితిలో తప్పుడు శీర్షిక: $1', 'wantedfiles' => 'కావలసిన ఫైళ్ళు', 'wantedtemplates' => 'కావాల్సిన మూసలు', 'mostlinked' => 'అధిక లింకులు చూపే పేజీలు', 'mostlinkedcategories' => 'అధిక లింకులు చూపే వర్గాలు', 'mostlinkedtemplates' => 'ఎక్కువగా ఉపయోగించిన మూసలు', 'mostcategories' => 'అధిక వర్గాలలో చేరిన వ్యాసాలు', 'mostimages' => 'అధిక లింకులు గల బొమ్మలు', 'mostrevisions' => 'అధిక సంచికలు గల వ్యాసాలు', 'prefixindex' => 'ఉపసర్గతో అన్ని పేజీలు', 'prefixindex-namespace' => 'ఉపసర్గతో ఉన్న పేజీలు ($1 పేరుబరి)', 'shortpages' => 'చిన్న పేజీలు', 'longpages' => 'పొడవు పేజీలు', 'deadendpages' => 'అగాధ (డెడ్ఎండ్) పేజీలు', 'deadendpagestext' => 'కింది పేజీల నుండి ఈ వికీ లోని ఏ ఇతర పేజీకీ లింకులు లేవు.', 'protectedpages' => 'సంరక్షిత పేజీలు', 'protectedpages-indef' => 'అనంత సంరక్షణ మాత్రమే', 'protectedpages-cascade' => 'కాస్కేడింగు రక్షణలు మాత్రమే', 'protectedpagestext' => 'కింది పేజీలను తరలించకుండా, దిద్దుబాటు చెయ్యకుండా సంరక్షించాము', 'protectedpagesempty' => 'ఈ పరామితులతో ప్రస్తుతం ఏ పేజీలు కూడా సంరక్షించబడి లేవు.', 'protectedtitles' => 'సంరక్షిత శీర్షికలు', 'protectedtitlestext' => 'కింది శీర్షికలతో పేజీలు సృష్టించకుండా సంరక్షించబడ్డాయి', 'protectedtitlesempty' => 'ఈ పరామితులతో ప్రస్తుతం శీర్షికలేమీ సరక్షించబడి లేవు.', 'listusers' => 'వాడుకరుల జాబితా', 'listusers-editsonly' => 'మార్పులు చేసిన వాడుకరులను మాత్రమే చూపించు', 'listusers-creationsort' => 'చేరిన తేదీ క్రమంలో చూపించు', 'usereditcount' => '$1 {{PLURAL:$1|మార్పు|మార్పులు}}', 'usercreated' => '$1 న $2కి {{GENDER:$3|చేరారు}}', 'newpages' => 'కొత్త పేజీలు', 'newpages-username' => 'వాడుకరి పేరు:', 'ancientpages' => 'పాత పేజీలు', 'move' => 'తరలించు', 'movethispage' => 'ఈ పేజీని తరలించు', 'unusedimagestext' => 'ఈ క్రింది ఫైళ్ళు ఉన్నాయి కానీ వాటిని ఏ పేజీలోనూ ఉపయోగించట్లేదు. ఇతర వెబ్ సైట్లు సూటి URL ద్వారా ఇక్కడి ఫైళ్ళకు లింకు ఇవ్వవచ్చు, మరియు ఆవిధంగా క్రియాశీలంగా వాడుకలో ఉన్నప్పటికీ అటువంటివి ఈ జాబితాలో చేరి ఉండవచ్చునని గమనించండి.', 'unusedcategoriestext' => 'కింది వర్గాలకు పేజీలైతే ఉన్నాయి గానీ, వీటిని వ్యాసాలు గానీ, ఇతర వర్గాలు గానీ ఉపయోగించడం లేదు.', 'notargettitle' => 'గమ్యం లేదు', 'notargettext' => 'ఈ పని ఏ పేజీ లేదా సభ్యునిపై జరగాలనే గమ్యాన్ని మీరు సూచించలేదు.', 'nopagetitle' => 'అలాంటి పేజీ లేదు', 'nopagetext' => 'మీరు అడిగిన పేజీ లేదు', 'pager-newer-n' => '{{PLURAL:$1|1 కొత్తది|$1 కొత్తవి}}', 'pager-older-n' => '{{PLURAL:$1|1 పాతది|$1 పాతవి}}', 'suppress' => 'పరాకు', 'querypage-disabled' => 'పనితీరు కారణాల వలన, ఈ ప్రత్యేకపేజీని అశక్తం చేసాం.', # Book sources 'booksources' => 'పుస్తక మూలాలు', 'booksources-search-legend' => 'పుస్తక మూలాల కోసం వెతుకు', 'booksources-go' => 'వెళ్ళు', 'booksources-text' => 'కొత్త, పాత పుస్తకాలు అమ్మే ఇతర సైట్లకు లింకులు కింద ఇచ్చాం. మీరు వెతికే పుస్తకాలకు సంబంధించిన మరింత సమాచారం కూడా అక్కడ దొరకొచ్చు:', 'booksources-invalid-isbn' => 'మీరిచ్చిన ISBN సరైనదిగా అనిపించుటలేదు; అసలు మూలాన్నుండి కాపీ చేయడంలో పొరపాట్లున్నాయేమో చూసుకోండి.', # Special:Log 'specialloguserlabel' => 'కర్త:', 'speciallogtitlelabel' => 'లక్ష్యం (శీర్షిక లేదా వాడుకరి):', 'log' => 'చిట్టాలు', 'all-logs-page' => 'అన్ని బహిరంగ చిట్టాలు', 'alllogstext' => '{{SITENAME}} యొక్క అందుబాటులో ఉన్న అన్ని చిట్టాల యొక్క సంయుక్త ప్రదర్శన. ఒక చిట్టా రకాన్ని గానీ, ఒక వాడుకరి పేరు గానీ (case-sensitive), లేదా ప్రభావిత పుటని (ఇది కూడా case-sensitive) గానీ ఎంచుకుని సంబంధిత చిట్టాను మాత్రమే చూడవచ్చు.', 'logempty' => 'సరిపోలిన అంశాలేమీ చిట్టాలో లేవు.', 'log-title-wildcard' => 'ఈ పాఠ్యంతో మొదలయ్యే పుస్తకాల కొరకు వెతుకు', 'showhideselectedlogentries' => 'ఎంచుకున్న చిట్టా పద్దులను చూపించు/దాచు', # Special:AllPages 'allpages' => 'అన్ని పేజీలు', 'alphaindexline' => '$1 నుండి $2 వరకు', 'nextpage' => 'తరువాతి పేజీ ($1)', 'prevpage' => 'మునుపటి పేజీ ($1)', 'allpagesfrom' => 'ఇక్కడ మొదలు పెట్టి పేజీలు చూపించు:', 'allpagesto' => 'ఇక్కడవరకు ఉన్న పేజీలు చూపించు:', 'allarticles' => 'అన్ని పేజీలు', 'allinnamespace' => 'అన్ని పేజీలు ($1 namespace)', 'allnotinnamespace' => 'అన్ని పేజీలు ($1 నేంస్పేస్ లేనివి)', 'allpagesprev' => 'పూర్వపు', 'allpagesnext' => 'తర్వాతి', 'allpagessubmit' => 'వెళ్లు', 'allpagesprefix' => 'ఈ ఆదిపదం కలిగిన పేజీలను చూపించు:', 'allpagesbadtitle' => 'మీరిచ్చిన పేజీ పేరు సరైనది కాకపోయి ఉండాలి లేదా దానికి భాషాంతర లేదా అంతర్వికీ ఆదిపదమైనా ఉండి ఉండాలి. పేర్లలో వాడకూడని కారెక్టర్లు ఆ పేరులో ఉండి ఉండవచ్చు.', 'allpages-bad-ns' => '{{SITENAME}} లో "$1" అనే నేమ్&zwnj;స్పేస్ లేదు.', 'allpages-hide-redirects' => 'దారిమార్పులను దాచు', # SpecialCachedPage 'cachedspecial-refresh-now' => 'సరికొత్త కూర్పును చూడండి.', # Special:Categories 'categories' => 'వర్గాలు', 'categoriespagetext' => 'ఈ క్రింది {{PLURAL:$1|వర్గం పేజీలను లేదా మాధ్యమాలను కలిగివుంది|వర్గాలు పేజీలను లేదా మాధ్యమాలను కలిగివున్నాయి}}. [[Special:UnusedCategories|వాడుకలో లేని వర్గాలని]] ఇక్కడ చూపించట్లేదు. [[Special:WantedCategories|కోరుతున్న వర్గాలను]] కూడా చూడండి.', 'categoriesfrom' => 'ఇక్కడనుండి మొదలుకొని వర్గాలు చూపించు:', 'special-categories-sort-count' => 'సంఖ్యల ప్రకారం క్రమపరచు', 'special-categories-sort-abc' => 'అకారాది క్రమంలో అమర్చు', # Special:DeletedContributions 'deletedcontributions' => 'తొలగించబడిన వాడుకరి రచనలు', 'deletedcontributions-title' => 'తొలగించబడిన వాడుకరి రచనలు', 'sp-deletedcontributions-contribs' => 'మార్పులు చేర్పులు', # Special:LinkSearch 'linksearch' => 'బయటి లింకుల అన్వేషణ', 'linksearch-pat' => 'వెతకాల్సిన నమూనా:', 'linksearch-ns' => 'పేరుబరి:', 'linksearch-ok' => 'వెతుకు', 'linksearch-text' => '"*.wikipedia.org" వంటి వైల్డ్ కార్డులు వాడవచ్చు.<br />ఉపయోగించుకోగల ప్రోటోకాళ్లు: <code>$1</code>', 'linksearch-line' => '$2 నుండి $1కి లింకు ఉంది', 'linksearch-error' => 'హోస్ట్‌నేముకు ముందు మాత్రమే వైల్డ్ కార్డులు వాడవచ్చు.', # Special:ListUsers 'listusersfrom' => 'వాడుకరులను ఇక్కడ నుండి చూపించు:', 'listusers-submit' => 'చూపించు', 'listusers-noresult' => 'వాడుకరి దొరకలేదు.', 'listusers-blocked' => '(నిరోధించారు)', # Special:ActiveUsers 'activeusers' => 'క్రియాశీల వాడుకరుల జాబితా', 'activeusers-intro' => 'ఇది గత $1 {{PLURAL:$1|రోజులో|రోజులలో}} ఏదైనా కార్యకలాపం చేసిన వాడుకరుల జాబితా.', 'activeusers-count' => 'గడచిన {{PLURAL:$3|ఒక రోజు|$3 రోజుల}}లో $1 {{PLURAL:$1|మార్పు|మార్పులు}}', 'activeusers-from' => 'వాడుకరులను ఇక్కడ నుండి చూపించు:', 'activeusers-hidebots' => 'బాట్లను దాచు', 'activeusers-hidesysops' => 'నిర్వాహకులను దాచు', 'activeusers-noresult' => 'వాడుకరులెవరూ లేరు.', # Special:ListGroupRights 'listgrouprights' => 'వాడుకరి గుంపుల హక్కులు', 'listgrouprights-summary' => 'కింది జాబితాలో ఈ వికీలో నిర్వచించిన వాడుకరి గుంపులు, వాటికి సంబంధించిన హక్కులు ఉన్నాయి. విడివిడిగా హక్కులకు సంబంధించిన మరింత సమాచారం [[{{MediaWiki:Listgrouprights-helppage}}]] వద్ద లభించవచ్చు.', 'listgrouprights-key' => '* <span class="listgrouprights-granted">ప్రసాదించిన హక్కు</span> * <span class="listgrouprights-revoked">వెనక్కి తీసుకున్న హక్కు</span>', 'listgrouprights-group' => 'గుంపు', 'listgrouprights-rights' => 'హక్కులు', 'listgrouprights-helppage' => 'Help:గుంపు హక్కులు', 'listgrouprights-members' => '(సభ్యుల జాబితా)', 'listgrouprights-addgroup' => '{{PLURAL:$2|గుంపుని|గుంపులను}} చేర్చగలరు: $1', 'listgrouprights-removegroup' => '{{PLURAL:$2|గుంపుని|గుంపులను}} తొలగించగలరు: $1', 'listgrouprights-addgroup-all' => 'అన్ని గుంపులను చేర్చగలరు', 'listgrouprights-removegroup-all' => 'అన్ని గుంపులను తొలగించగలరు', 'listgrouprights-addgroup-self' => '{{PLURAL:$2|సమూహాన్ని|సమూహాలని}} తన స్వంత ఖాతాకి చేర్చుకోగలగడం: $1', 'listgrouprights-removegroup-self' => '{{PLURAL:$2|సమూహాన్ని|సమూహాలని}} తన స్వంత ఖాతా నుండి తొలగించుకోవడం: $1', 'listgrouprights-addgroup-self-all' => 'అన్ని సమూహాలని స్వంత ఖాతాకి చేర్చుకోలగడటం', 'listgrouprights-removegroup-self-all' => 'స్వంత ఖాతా నుండి అన్ని సమూహాలనూ తొలగించుకోగలగడం', # Email user 'mailnologin' => 'పంపించవలసిన చిరునామా లేదు', 'mailnologintext' => 'ఇతరులకు ఈ-మెయిలు పంపించాలంటే, మీరు [[Special:UserLogin|లాగిన్‌]] అయి ఉండాలి, మరియు మీ [[Special:Preferences|అభిరుచుల]]లో సరైన ఈ-మెయిలు చిరునామా ఇచ్చి ఉండాలి.', 'emailuser' => 'ఈ వాడుకరికి ఈ-మెయిలుని పంపించండి', 'emailuser-title-target' => 'ఈ {{GENDER:$1|వాడుకరికి}} ఈమెయిలు పంపించండి', 'emailuser-title-notarget' => 'ఈ-మెయిలు వాడుకరి', 'emailpage' => 'వాడుకరికి ఈ-మెయిలుని పంపించు', 'emailpagetext' => 'వాడుకరికి ఈమెయిలు సందేశము పంపించుటకు క్రింది ఫారంను ఉపయోగించవచ్చు. [[Special:Preferences|మీ వాడుకరి అభిరుచుల]]లో మీరిచ్చిన ఈ-మెయిలు చిరునామా "నుండి" ఆ సందేశం వచ్చినట్లుగా ఉంటుంది, కనుక వేగుని అందుకునేవారు నేరుగా మీకు జవాబివ్వగలుగుతారు.', 'usermailererror' => 'మెయిలు ఆబ్జెక్టు ఈ లోపాన్ని చూపింది:', 'defemailsubject' => 'వాడుకరి "$1" నుండి {{SITENAME}} ఈ-మెయిలు', 'usermaildisabled' => 'వాడుకరి ఈ-మెయిళ్ళు అచేతనం చేసారు', 'usermaildisabledtext' => 'ఈ వికీలో మీరు ఇతర వాడుకరులకి ఈ-మెయిళ్ళని పంపించలేరు', 'noemailtitle' => 'ఈ-మెయిలు చిరునామా లేదు', 'noemailtext' => 'ఈ వాడుకరి సరైన ఈ-మెయిలు చిరునామాని ఇవ్వలేదు.', 'nowikiemailtitle' => 'ఈ-మెయిళ్ళను అనుమతించరు', 'nowikiemailtext' => 'ఇతర వాడుకరుల నుండి ఈ-మెయిళ్ళను అందుకోడానికి ఈ వాడుకరి సుముఖంగా లేరు.', 'emailtarget' => 'అందుకొనేవారి వాడుకరిపేరు ఇవ్వండి', 'emailusername' => 'వాడుకరి పేరు:', 'emailusernamesubmit' => 'దాఖలుచెయ్యి', 'email-legend' => 'మరో {{SITENAME}} వాడుకరికి వేగు పంపించండి', 'emailfrom' => 'ఎవరు:', 'emailto' => 'ఎవరికి:', 'emailsubject' => 'విషయం:', 'emailmessage' => 'సందేశం:', 'emailsend' => 'పంపించు', 'emailccme' => 'సందేశపు ఒక ప్రతిని నాకు ఈమెయిలు పంపు.', 'emailccsubject' => '$1 కు మీరు పంపిన సందేశపు ప్రతి: $2', 'emailsent' => 'ఈ-మెయిలు పంపించాం', 'emailsenttext' => 'మీ ఈ-మెయిలు సందేశం పంపబడింది.', 'emailuserfooter' => 'ఈ ఈ-మెయిలుని $2 కి {{SITENAME}} లోని "వాడుకరికి ఈమెయిలు" అనే సౌలభ్యం ద్వారా $1 పంపించారు.', # User Messenger 'usermessage-summary' => 'వ్యవస్థ సందేశాన్ని వదిలివేస్తున్నాం.', 'usermessage-editor' => 'వ్యవస్థ సందేశకులు', # Watchlist 'watchlist' => 'వీక్షణ జాబితా', 'mywatchlist' => 'వీక్షణ జాబితా', 'watchlistfor2' => '$1 కొరకు $2', 'nowatchlist' => 'మీ వీక్షణ జాబితా ఖాళీగా ఉంది.', 'watchlistanontext' => 'మీ వీక్షణ జాబితా లోని అంశాలను చూసేందుకు లేదా మార్చేందుకు మీరు $1.', 'watchnologin' => 'లాగిన్‌ అయిలేరు', 'watchnologintext' => 'మీ వీక్షణ జాబితాను మార్చడానికి మీరు [[Special:UserLogin|లాగిన్‌]] అయి ఉండాలి.', 'addwatch' => 'వీక్షణ జాబితాలో చేర్చు', 'addedwatchtext' => "\"[[:\$1]]\" అనే పుట మీ [[Special:Watchlist|వీక్షణ జాబితా]]లో చేరింది. భవిష్యత్తులో ఈ పుటకి మరియు సంబంధిత చర్చాపుటకి జరిగే మార్పులు అక్కడ కనిపిస్తాయి, మరియు [[Special:RecentChanges|ఇటీవలి మార్పుల జాబితా]]లో సులభంగా గుర్తించడానికి ఈ పుట '''బొద్దుగా''' కనిపిస్తుంది.", 'removewatch' => 'వీక్షణ జాబితా నుండి తొలగించు', 'removedwatchtext' => '"[[:$1]]" అనే పేజీ [[Special:Watchlist|మీ వీక్షణ జాబితా]] నుండి తొలగించబడినది.', 'watch' => 'వీక్షించు', 'watchthispage' => 'ఈ పుట మీద కన్నేసి ఉంచు', 'unwatch' => 'వీక్షించవద్దు', 'unwatchthispage' => 'వీక్షణను ఆపు', 'notanarticle' => 'వ్యాసం పేజీ కాదు', 'notvisiblerev' => 'ఈ కూర్పును తొలగించాం', 'watchlist-details' => 'మీ వీక్షణ జాబితాలో {{PLURAL:$1|ఒక పేజీ ఉంది|$1 పేజీలు ఉన్నాయి}}, చర్చా పేజీలని వదిలేసి.', 'wlheader-enotif' => 'ఈ-మెయిలు ప్రకటనలు పంపబడతాయి.', 'wlheader-showupdated' => "మీ గత సందర్శన తరువాత మారిన పేజీలు '''బొద్దు'''గా చూపించబడ్డాయి.", 'watchmethod-recent' => 'వీక్షణ జాబితాలోని పేజీల కొరకు ఇటీవలి మార్పులు పరిశీలించబడుతున్నాయి', 'watchmethod-list' => 'ఇటీవలి మార్పుల కొరకు వీక్షణ జాబితాలోని పేజీలు పరిశీలించబడుతున్నాయి', 'watchlistcontains' => 'మీ వీక్షణ జాబితాలో {{PLURAL:$1|ఒక పేజీ ఉంది|$1 పేజీలు ఉన్నాయి}}.', 'iteminvalidname' => "'$1' తో ఇబ్బంది, సరైన పేరు కాదు...", 'wlnote' => "$3 నాడు $4 సమయానికి, గడచిన {{PLURAL:$2|గంటలో|'''$2''' గంటలలో}} జరిగిన {{PLURAL:$1|ఒక్క మార్పు కింద ఉంది|'''$1''' మార్పులు కింద ఉన్నాయి}}.", 'wlshowlast' => 'గత $1 గంటలు $2 రోజులు $3 చూపించు', 'watchlist-options' => 'వీక్షణ జాబితా ఎంపికలు', # Displayed when you click the "watch" button and it is in the process of watching 'watching' => 'గమనిస్తున్నాం...', 'unwatching' => 'వీక్షణ నుండి తొలగిస్తున్నా...', 'enotif_mailer' => '{{SITENAME}} ప్రకటన మెయిలు పంపునది', 'enotif_reset' => 'అన్ని పేజీలను చూసినట్లుగా గుర్తించు', 'enotif_impersonal_salutation' => '{{SITENAME}} వాడుకరి', 'enotif_lastvisited' => 'మీ గత సందర్శన తరువాత జరిగిన మార్పుల కొరకు $1 చూడండి.', 'enotif_lastdiff' => 'ఈ మార్పు చూసేందుకు $1 కు వెళ్ళండి.', 'enotif_anon_editor' => 'అజ్ఞాత వాడుకరి $1', 'enotif_body' => 'ప్రియమైన $WATCHINGUSERNAME, {{SITENAME}}లో $PAGETITLE అనే పేజీని $PAGEEDITDATE సమయానికి $PAGEEDITOR $CHANGEDORCREATED, ప్రస్తుత కూర్పు కొరకు $PAGETITLE_URL చూడండి. $NEWPAGE రచయిత సారాంశం: $PAGESUMMARY $PAGEMINOREDIT రచయితను సంప్రదించండి: మెయిలు: $PAGEEDITOR_EMAIL వికీ: $PAGEEDITOR_WIKI మీరు ఈ పేజీకి వెళ్తే తప్ప ఇక ముందు ఈ పేజీకి జరిగే మార్పుల గురించిన వార్తలను మీకు పంపించము. మీ వీక్షణజాబితా లోని అన్ని పేజీలకు ఉన్న గమనింపు జెండాలను మార్చుకోవచ్చు. మీ స్నేహపూర్వక {{SITENAME}} గమనింపుల వ్యవస్థ -- మీ వీక్షణజాబితా అమరికలను మార్చుకునేందుకు, {{canonicalurl:{{#special:EditWatchlist}}}} ని చూడండి. ఈ పేజీని మీ వీక్షణజాబితా నుండి తొలగించుకునేందుకు, $UNWATCHURL కి వెళ్ళండి. మీ అభిప్రాయాలు చెప్పేందుకు మరియు మరింత సహాయానికై: {{canonicalurl:{{MediaWiki:helppage}}}}', 'created' => 'సృష్టించారు', 'changed' => 'మార్చారు', # Delete 'deletepage' => 'పేజీని తొలగించు', 'confirm' => 'ధృవీకరించు', 'excontent' => "ఇదివరకు విషయ సంగ్రహం: '$1'", 'excontentauthor' => 'ఉన్న విషయ సంగ్రహం: "$1" (మరియు దీని ఒకే ఒక్క రచయిత "[[Special:Contributions/$2|$2]]")', 'exbeforeblank' => "ఖాళీ చెయ్యకముందు పేజీలో ఉన్న విషయ సంగ్రహం: '$1'", 'exblank' => 'పేజీ ఖాళీగా ఉంది', 'delete-confirm' => '"$1"ని తొలగించు', 'delete-legend' => 'తొలగించు', 'historywarning' => "'''హెచ్చరిక''': మీరు తొలగించబోయే పేజీకి సుమారు $1 {{PLURAL:$1|కూర్పుతో|కూర్పులతో}} చరిత్ర ఉంది:", 'confirmdeletetext' => 'మీరో పేజీనో, బొమ్మనో దాని చరిత్రతోపాటుగా శాశ్వతంగా డేటాబేసు నుండి తీసెయ్యబోతున్నారు. మీరు చెయ్యదలచింది ఇదేననీ, దీని పర్యవసానాలు మీకు తెలుసనీ, దీన్ని [[{{MediaWiki:Policy-url}}|నిభందనల]] ప్రకారమే చేస్తున్నారనీ నిర్ధారించుకోండి.', 'actioncomplete' => 'పని పూర్తయింది', 'actionfailed' => 'చర్య విఫలమైంది', 'deletedtext' => '"$1" తుడిచివేయబడింది. ఇటీవలి తుడిచివేతలకు సంబంధించిన నివేదిక కొరకు $2 చూడండి.', 'dellogpage' => 'తొలగింపుల చిట్టా', 'dellogpagetext' => 'ఇది ఇటీవలి తుడిచివేతల జాబితా.', 'deletionlog' => 'తొలగింపుల చిట్టా', 'reverted' => 'పాత కూర్పుకు తీసుకువెళ్ళాం.', 'deletecomment' => 'కారణం:', 'deleteotherreason' => 'ఇతర/అదనపు కారణం:', 'deletereasonotherlist' => 'ఇతర కారణం', 'deletereason-dropdown' => '* తొలగింపుకి సాధారణ కారణాలు ** రచయిత అభ్యర్థన ** కాపీహక్కుల ఉల్లంఘన ** దుశ్చర్య', 'delete-edit-reasonlist' => 'తొలగింపు కారణాలని మార్చండి', 'delete-toobig' => 'ఈ పేజీకి $1 {{PLURAL:$1|కూర్పుకు|కూర్పులకు}} మించిన, చాలా పెద్ద దిద్దుబాటు చరితం ఉంది. {{SITENAME}}కు అడ్డంకులు కలగడాన్ని నివారించేందుకు గాను, అలాంటి పెద్ద పేజీల తొలగింపును నియంత్రించాం.', 'delete-warning-toobig' => 'ఈ పేజీకి $1 {{PLURAL:$1|కూర్పుకు|కూర్పులకు}} మించిన, చాలా పెద్ద దిద్దుబాటు చరితం ఉంది. దాన్ని తొలగిస్తే {{SITENAME}}కి చెందిన డేటాబేసు కార్యాలకు ఆటంకం కలగొచ్చు; అప్రమత్తతో ముందుకుసాగండి.', # Rollback 'rollback' => 'దిద్దుబాట్లను రద్దుచేయి', 'rollback_short' => 'రద్దుచేయి', 'rollbacklink' => 'రద్దుచేయి', 'rollbacklinkcount' => '$1 {{PLURAL:$1|మార్పును|మార్పులను}} రద్దుచేయి', 'rollbacklinkcount-morethan' => '$1 కంటే ఎక్కువ {{PLURAL:$1|మార్పును|మార్పులను}} రద్దుచేయి', 'rollbackfailed' => 'రద్దుచేయటం విఫలమైంది', 'cantrollback' => 'రచనను వెనక్కి తీసుకువెళ్ళలేము; ఈ పేజీకి ఇదొక్కటే రచన.', 'alreadyrolled' => '[[:$1]]లో [[User:$2|$2]] ([[User talk:$2|చర్చ]]{{int:pipe-separator}}[[Special:Contributions/$2|{{int:contribslink}}]]) చేసిన చివరి మార్పును రద్దు చెయ్యలేము; మరెవరో ఆ పేజీని వెనక్కి మళ్ళించారు, లేదా మార్చారు. చివరి మార్పులు చేసినవారు: [[User:$3|$3]] ([[User talk:$3|చర్చ]]{{int:pipe-separator}}[[Special:Contributions/$3|{{int:contribslink}}]]).', 'editcomment' => "దిద్దుబాటు సారాశం: \"''\$1''\".", 'revertpage' => '[[Special:Contributions/$2|$2]] ([[User talk:$2|చర్చ]]) చేసిన మార్పులను [[User:$1|$1]] యొక్క చివరి కూర్పు వరకు తిప్పికొట్టారు.', 'revertpage-nouser' => '(తొలగించిన వాడుకరిపేరు) చేసిన మార్పులను [[User:$1|$1]] యొక్క చివరి కూర్పుకి తిప్పికొట్టారు', 'rollback-success' => '$1 చేసిన దిద్దుబాట్లను వెనక్కు తీసుకెళ్ళాం; తిరిగి $2 చేసిన చివరి కూర్పుకు మార్చాం.', # Edit tokens 'sessionfailure-title' => 'సెషను వైఫల్యం', 'sessionfailure' => 'మీ ప్రవేశపు సెషనుతో ఏదో సమస్య ఉన్నట్లుంది; సెషను హైజాకు కాకుండా ఈ చర్యను రద్దు చేసాం. "back" కొట్టి, ఎక్కడి నుండి వచ్చారో ఆ పేజీని మళ్ళీ లోడు చేసి, తిరిగి ప్రయత్నించండి.', # Protect 'protectlogpage' => 'సంరక్షణల చిట్టా', 'protectlogtext' => 'ఈ క్రింద ఉన్నది పేజీల సంరక్షణలకు జరిగిన మార్పుల జాబితా. ప్రస్తుతం అమలులో ఉన్న సంరక్షణలకై [[Special:ProtectedPages|సంరక్షిత పేజీల జాబితా]]ను చూడండి.', 'protectedarticle' => '"[[$1]]" సంరక్షించబడింది.', 'modifiedarticleprotection' => '"[[$1]]" సరక్షణ స్థాయిని మార్చాం', 'unprotectedarticle' => '"[[$1]]" యొక్క సంరక్షణను తొలగించారు', 'movedarticleprotection' => 'సంరక్షణా అమరికని "[[$2]]" నుండి "[[$1]]"కి మార్చారు', 'protect-title' => '"$1" యొక్క సంరక్షణ స్థాయి అమర్పు', 'protect-title-notallowed' => '"$1" యొక్క సంరక్షణ స్థాయి', 'prot_1movedto2' => '$1, $2కు తరలించబడింది', 'protect-badnamespace-text' => 'ఈ పేరుబరిలో ఉన్న పేజీలను సంరక్షించలేరు.', 'protect-legend' => 'సంరక్షణను నిర్ధారించు', 'protectcomment' => 'కారణం:', 'protectexpiry' => 'గడువు:', 'protect_expiry_invalid' => 'గడువు సమయాన్ని సరిగ్గా ఇవ్వలేదు.', 'protect_expiry_old' => 'మీరిచ్చిన గడువు ప్రస్తుత సమయం కంటే ముందు ఉంది.', 'protect-unchain-permissions' => 'మరిన్ని సంరక్షణ వికల్పాలను తెరువు', 'protect-text' => "ఈ పెజీ '''$1''' ఎంత సంరక్షణలొ వుందో మీరు ఇక్కడ చూడవచ్చు, మార్చవచ్చు.", 'protect-locked-blocked' => "నిరోధించబడి ఉండగా మీరు సంరక్షణ స్థాయిని మార్చలేరు. ప్రస్తుతం '''$1''' పేజీకి ఉన్న సెట్టింగులివి:", 'protect-locked-dblock' => "ప్రస్తుతం అమల్లో ఉన్న డేటాబేసు లాకు కారణంగా సంరక్షణ స్థాయిని సెట్ చెయ్యడం కుదరదు. ప్రస్తుతం '''$1''' పేజీకి ఉన్న సెట్టింగులివి:", 'protect-locked-access' => "మీ ఖాతకు పేజీ రక్షన స్థాయిని మార్చే హక్కులు లేవు. '''$1''' అనే పేరున్న ఈ పేజీకి ప్రస్తుతం ఈ రక్షణ ఉంది:", 'protect-cascadeon' => 'ఈ పేజీ కాస్కేడింగు రక్షణలో ఉన్న ఈ కింది {{PLURAL:$1|పేజీకి|పేజీలకు}} జతచేయటం వలన, ప్రస్తుతం రక్షణలో ఉంది. మీరు ఈ పేజీ యొక్క రక్షణ స్థాయిన మార్చవచ్చు, దాని వలన కాస్కేడింగు రక్షణకు ఎటువంటి సమస్య ఉండదు.', 'protect-default' => 'అందరు వాడుకరులను అనుమతించు', 'protect-fallback' => '"$1" అనుమతి ఉన్న వాడుకరులను మాత్రమే అనుమతించు', 'protect-level-autoconfirmed' => 'కొత్త మరియు నమోదుకాని వాడుకరులను నిరోధించు', 'protect-level-sysop' => 'నిర్వాహకులను మాత్రమే అనుమతించు', 'protect-summary-cascade' => 'కాస్కేడింగు', 'protect-expiring' => '$1 (UTC)న కాలంచెల్లుతుంది', 'protect-expiring-local' => '$1న కాలంచెల్లుతుంది', 'protect-expiry-indefinite' => 'నిరవధికం', 'protect-cascade' => 'ఈ పేజీకి జతపరిచిన పేజీలను కూడా రక్షించు (కాస్కేడింగు రక్షణ)', 'protect-cantedit' => 'ఈ పేజీ యొక్క సంరక్షణా స్థాయిని మీరు మార్చలేరు, ఎందుకంటే దాన్ని మార్చే అనుమతి మీకు లేదు.', 'protect-othertime' => 'ఇతర సమయం:', 'protect-othertime-op' => 'ఇతర సమయం', 'protect-existing-expiry' => 'ప్రస్తుత కాల పరిమితి: $3, $2', 'protect-otherreason' => 'ఇతర/అదనపు కారణం:', 'protect-otherreason-op' => 'ఇతర కారణం', 'protect-dropdown' => '*సాధారణ సంరక్షణ కారణాలు ** అత్యధిక వాండలిజం ** అత్యధిక స్పామింగు ** నిర్మాణాత్మకంగా లేని మార్పుల యుద్ధం ** అధిక రద్దీగల పేజీ', 'protect-edit-reasonlist' => 'సంరక్షణా కారణాలని మార్చండి', 'protect-expiry-options' => '1 గంట:1 hour,1 రోజు:1 day,1 వారం:1 week,2 వారాలు:2 weeks,1 నెల:1 month,3 నెలలు:3 months,6 నెలలు:6 months,1 సంవత్సరం:1 year,ఎప్పటికీ:infinite', 'restriction-type' => 'అనుమతి:', 'restriction-level' => 'నియంత్రణ స్థాయి:', 'minimum-size' => 'కనీస పరిమాణం', 'maximum-size' => 'గరిష్ఠ పరిమాణం', 'pagesize' => '(బైట్లు)', # Restrictions (nouns) 'restriction-edit' => 'మార్చు', 'restriction-move' => 'తరలించు', 'restriction-create' => 'సృష్టించు', 'restriction-upload' => 'ఎక్కించు', # Restriction levels 'restriction-level-sysop' => 'పూర్తి సంరక్షణ', 'restriction-level-autoconfirmed' => 'అర్థ సంరక్షణ', 'restriction-level-all' => 'ఏ స్థాయి అయినా', # Undelete 'undelete' => 'తుడిచివేయబడ్డ పేజీలను చూపించు', 'undeletepage' => 'తుడిచివేయబడిన పేజీలను చూపించు, పునఃస్థాపించు', 'undeletepagetitle' => "'''క్రింద చూపిస్తున్నవి [[:$1]] యొక్క తొలగించిన మార్పులు'''.", 'viewdeletedpage' => 'తొలగించిన పేజీలను చూడండి', 'undeletepagetext' => 'క్రింది {{PLURAL:$1|పేజీని|$1 పేజీలను}} తొలగించారు, కానీ పునఃస్థాపనకు వీలుగా భండాగారంలో ఉన్నాయి. భండాగారం నిర్ణీత వ్యవధులలో పూర్తిగా ఖాళీ చేయబడుతుంటుంది.', 'undelete-fieldset-title' => 'కూర్పులను పునఃస్థాపించండి', 'undeleteextrahelp' => "పేజీ యొక్క మొత్తం చరిత్రను పునస్థాపించేందుకు, చెక్ బాక్సులన్నిటినీ ఖాళీగా ఉంచి, '''''{{int:undeletebtn}}''''' నొక్కండి. కొన్ని కూర్పులను మాత్రమే పుసస్థాపించదలిస్తే, సదరు కూర్పులకు ఎదురుగా ఉన్న చెక్ బాక్సులలో టిక్కు పెట్టి, '''''{{int:undeletebtn}}''''' నొక్కండి.", 'undeleterevisions' => '$1 {{PLURAL:$1|కూర్పును|కూర్పులను}} భాండారానికి చేర్చాం', 'undeletehistory' => 'పేజీని పునఃస్థాపిస్తే, అన్ని సంచికలూ పేజీచరిత్ర దినచర్యలోకి పునఃస్థాపించబడతాయి. తుడిచివేయబడిన తరువాత, అదే పేరుతో వేరే పేజీ సృష్టించబడి ఉంటే, పునఃస్థాపించిన సంచికలు ముందరి చరిత్రలోకి వెళ్తాయి.', 'undeleterevdel' => 'తొలగింపును రద్దు చేస్తున్నప్పుడు, అన్నిటికంటే పైనున్న కూర్పు పాక్షికంగా తొలగింపబడే పక్షంలో తొలగింపు-రద్దు జరగదు. అటువంటి సందర్భాల్లో, తొలగించిన కూర్పులలో కొత్తవాటిని ఎంచుకోకుండా ఉండాలి, లేదా దాపు నుండి తీసెయ్యాలి.', 'undeletehistorynoadmin' => 'ఈ పుటని తొలగించివున్నారు. తొలగింపునకు కారణం, తొలగింపునకు క్రితం ఈ పుటకి మార్పులు చేసిన వాడుకరుల వివరాలతో సహా, ఈ కింద సారాంశంలో చూపబడింది. తొలగించిన కూర్పులలోని వాస్తవ పాఠ్యం నిర్వాహకులకు మాత్రమే అందుబాటులో ఉంటుంది.', 'undelete-revision' => '$1 యొక్క తొలగించబడిన కూర్పు (చివరగా $4 నాడు, $5కి $3 మార్చారు):', 'undeleterevision-missing' => 'తప్పుడు లేదా తప్పిపోయిన కూర్పు. మీరు నొక్కింది తప్పుడు లింకు కావచ్చు, లేదా భాండాగారం నుండి కూర్పు పునఃస్థాపించబడి లేదా తొలగించబడి ఉండవచ్చు.', 'undelete-nodiff' => 'గత కూర్పులేమీ లేవు.', 'undeletebtn' => 'పునఃస్థాపించు', 'undeletelink' => 'చూడండి/పునస్థాపించండి', 'undeleteviewlink' => 'చూడండి', 'undeletereset' => 'మునుపటి వలె', 'undeleteinvert' => 'ఎంపికని తిరగవెయ్యి', 'undeletecomment' => 'కారణం:', 'undeletedrevisions' => '{{PLURAL:$1|ఒక సంచిక|$1 సంచికల}} పునఃస్థాపన జరిగింది', 'undeletedrevisions-files' => '{{PLURAL:$1|ఒక కూర్పు|$1 కూర్పులు}} మరియు {{PLURAL:$2|ఒక ఫైలు|$2 ఫైళ్ళ}}ను పునస్థాపించాం', 'undeletedfiles' => '{{PLURAL:$1|ఒక ఫైలును|$1 ఫైళ్లను}} పునఃస్థాపించాం', 'cannotundelete' => 'తొలగింపు రద్దు విఫలమైంది: $1', 'undeletedpage' => "'''$1 ను పునస్థాపించాం''' ఇటీవల జరిగిన తొలగింపులు, పునస్థాపనల కొరకు [[Special:Log/delete|తొలగింపు చిట్టా]]ని చూడండి.", 'undelete-header' => 'ఇటీవల తొలగించిన పేజీల కొరకు [[Special:Log/delete|తొలగింపు చిట్టా]]ని చూడండి.', 'undelete-search-title' => 'తొలగించిన పేజీల అన్వేషణ', 'undelete-search-box' => 'తొలగించిన పేజీలను వెతుకు', 'undelete-search-prefix' => 'దీనితో మొదలయ్యే పేజీలు చూపించు:', 'undelete-search-submit' => 'వెతుకు', 'undelete-no-results' => 'తొలగింపు సంగ్రహాల్లో దీనిని పోలిన పేజీలు లేవు.', 'undelete-filename-mismatch' => '$1 టైమ్‌స్టాంపు కలిగిన ఫైలుకూర్పు తొలగింపును రద్దు చెయ్యలేకపోయాం: ఫైలుపేరు సరిపోలలేదు', 'undelete-bad-store-key' => '$1 టైమ్‌స్టాంపు కలిగిన ఫైలు తొలగింపును రద్దు చెయ్యలేకున్నాం: తొలగింపుకు ముందే ఫైలు కనబడటం లేదు.', 'undelete-cleanup-error' => 'వాడని భాండారం ఫైలు "$1" తొలగింపును రద్దు చెయ్యడంలో లోపం దొర్లింది.', 'undelete-missing-filearchive' => 'ID $1 కలిగిన భాండారం ఫైలు డేటాబేసులో లేకపోవడం చేత దాన్ని పునస్థాపించలేకున్నాం. దాని తొలగింపును ఇప్పటికే రద్దుపరచి ఉండవచ్చు.', 'undelete-error-short' => 'ఫైలు $1 తొలగింపును రద్దు పరచడంలో లోపం దొర్లింది', 'undelete-error-long' => 'ఫైలు $1 తొలగింపును రద్దు పరచడంలో లోపాలు దొర్లాయి', 'undelete-show-file-confirm' => '$2 నాడు $3 సమయాన ఉన్న "<nowiki>$1</nowiki>" ఫైలు యొక్క తొలగించిన కూర్పుని మీరు నిజంగానే చూడాలనుకుంటున్నారా?', 'undelete-show-file-submit' => 'అవును', # Namespace form on various pages 'namespace' => 'పేరుబరి:', 'invert' => 'ఎంపికను తిరగవెయ్యి', 'namespace_association' => 'సంబంధిత పేరుబరి', 'blanknamespace' => '(మొదటి)', # Contributions 'contributions' => '{{GENDER:$1|వాడుకరి}} రచనలు', 'contributions-title' => '$1 యొక్క మార్పులు-చేర్పులు', 'mycontris' => 'మార్పులు చేర్పులు', 'contribsub2' => '$1 ($2) కొరకు', 'nocontribs' => 'ఈ విధమైన మార్పులేమీ దొరకలేదు.', 'uctop' => '(పైది)', 'month' => 'ఈ నెల నుండి (అంతకు ముందువి):', 'year' => 'ఈ సంవత్సరం నుండి (అంతకు ముందువి):', 'sp-contributions-newbies' => 'కొత్త ఖాతాల యొక్క రచనలని మాత్రమే చూపించు', 'sp-contributions-newbies-sub' => 'కొత్తవారి కోసం', 'sp-contributions-newbies-title' => 'కొత్త ఖాతాల వాడుకరుల మార్పుచేర్పులు', 'sp-contributions-blocklog' => 'నిరోధాల చిట్టా', 'sp-contributions-deleted' => 'తొలగించబడిన వాడుకరి రచనలు', 'sp-contributions-uploads' => 'ఎక్కింపులు', 'sp-contributions-logs' => 'చిట్టాలు', 'sp-contributions-talk' => 'చర్చ', 'sp-contributions-userrights' => 'వాడుకరి హక్కుల నిర్వహణ', 'sp-contributions-blocked-notice' => 'ఈ వాడుకరిపై ప్రస్తుతం నిరోధం ఉంది. నిరోధపు చిట్టాలోని చివరి పద్దుని మీ సమాచారంకోసం ఇస్తున్నాం:', 'sp-contributions-blocked-notice-anon' => 'ఈ ఐపీ చిరునామాపై ప్రస్తుతం నిరోధం ఉంది. నిరోధపు చిట్టాలోని చివరి పద్దుని మీ సమాచారంకోసం ఇస్తున్నాం:', 'sp-contributions-search' => 'రచనల కోసం అన్వేషణ', 'sp-contributions-username' => 'ఐపీ చిరునామా లేదా వాడుకరిపేరు:', 'sp-contributions-toponly' => 'చిట్టచివరి కూర్పులను మాత్రమే చూపించు', 'sp-contributions-submit' => 'వెతుకు', # What links here 'whatlinkshere' => 'ఇక్కడికి లంకెలున్నవి', 'whatlinkshere-title' => '"$1"కి లింకున్న పుటలు', 'whatlinkshere-page' => 'పేజీ:', 'linkshere' => "కిందనున్న పేజీల నుండి '''[[:$1]]'''కు లింకులు ఉన్నాయి:", 'nolinkshere' => "'''[[:$1]]'''కు ఏ పేజీ నుండీ లింకు లేదు.", 'nolinkshere-ns' => "'''[[:$1]]''' పేజీకి లింకయ్యే పేజీలు ఎంచుకున్న నేంస్పేసులో లేవు.", 'isredirect' => 'దారిమార్పు పుట', 'istemplate' => 'పేజీకి జతపరిచారు', 'isimage' => 'దస్త్రపు లంకె', 'whatlinkshere-prev' => '{{PLURAL:$1|మునుపటిది|మునుపటి $1}}', 'whatlinkshere-next' => '{{PLURAL:$1|తరువాతది|తరువాతి $1}}', 'whatlinkshere-links' => '← లంకెలు', 'whatlinkshere-hideredirs' => 'దారిమార్పులను $1', 'whatlinkshere-hidetrans' => '$1 ట్రాన్స్‌క్లూజన్లు', 'whatlinkshere-hidelinks' => 'లింకులను $1', 'whatlinkshere-hideimages' => '$1 దస్త్రాల లంకెలు', 'whatlinkshere-filters' => 'వడపోతలు', # Block/unblock 'autoblockid' => 'tanaDDu #$1', 'block' => 'వాడుకరి నిరోధం', 'unblock' => 'వాడుకరిపై నిరోధాన్ని తీసెయ్యండి', 'blockip' => 'వాడుకరి నిరోధం', 'blockip-title' => 'వాడుకరిని నిరోధించు', 'blockip-legend' => 'వాడుకరి నిరోధం', 'blockiptext' => 'ఏదైనా ప్రత్యేక ఐపీ చిరునామానో లేదా వాడుకరిపేరునో రచనలు చెయ్యకుండా నిరోధించాలంటే కింది ఫారాన్ని వాడండి. కేవలం దుశ్చర్యల నివారణ కోసం మాత్రమే దీన్ని వాడాలి, అదికూడా [[{{MediaWiki:Policy-url}}|విధానాన్ని]] అనుసరించి మాత్రమే. స్పష్టమైన కారణాన్ని కింద రాయండి (ఉదాహరణకు, దుశ్చర్యలకు పాల్పడిన పేజీలను ఉదహరించండి).', 'ipadressorusername' => 'ఐపీ చిరునామా లేదా వాడుకరిపేరు:', 'ipbexpiry' => 'అంతమయ్యే గడువు', 'ipbreason' => 'కారణం:', 'ipbreasonotherlist' => 'ఇతర కారణం', 'ipbreason-dropdown' => '*సాధారణ నిరోధ కారణాలు ** తప్పు సమాచారాన్ని చొప్పించడం ** పేజీల్లోని సమాచారాన్ని తీసెయ్యడం ** బయటి సైట్లకు లంకెలతో స్పాము చెయ్యడం ** పేజీల్లోకి చెత్తను ఎక్కించడం ** బెదిరింపు ప్రవర్తన/వేధింపులు ** అనేక ఖాతాలను సృష్టించి దుశ్చర్యకు పాల్పడడం ** అనుచితమైన వాడుకరి పేరు ** అదుపు తప్పిన బాటు', 'ipb-hardblock' => 'లాగినై ఉన్న వాడుకరులు ఈ ఐపీ అడ్రసు నుంచి మార్పుచేర్పులు చెయ్యకుండా నిరోధించండి', 'ipbcreateaccount' => 'ఖాతా సృష్టింపుని నివారించు', 'ipbemailban' => 'వాడుకరిని ఈ-మెయిల్ చెయ్యకుండా నివారించు', 'ipbenableautoblock' => 'ఈ వాడుకరి వాడిన చివరి ఐపీ అడ్రసును, అలాగే ఆ తరువాత వాడే అడ్రసులను కూడా ఆటోమాటిగ్గా నిరోధించు', 'ipbsubmit' => 'ఈ సభ్యుని నిరోధించు', 'ipbother' => 'వేరే గడువు', 'ipboptions' => '2 గంటలు:2 hours,1 రోజు:1 day,3 రోజులు:3 days,1 వారం:1 week,2 వారాలు:2 weeks,1 నెల:1 month,3 నెలలు:3 months,6 నెలలు:6 months,1 సంవత్సరం:1 year,ఎప్పటికీ:infinite', 'ipbotheroption' => 'వేరే', 'ipbotherreason' => 'ఇతర/అదనపు కారణం', 'ipbhidename' => 'మార్పులు మరియు జాబితాల నుండి ఈ వాడుకరిపేరుని దాచు', 'ipbwatchuser' => 'ఈ సభ్యుని సభ్యుని పేజీ, చర్చాపేజీలను వీక్షణలో ఉంచు', 'ipb-disableusertalk' => 'నిరోధంలో ఉండగా ఈ వాడుకరి తన స్వంత చర్చ పేజీలో మార్పుచేర్పులు చెయ్యకుండా నిరోధించు', 'ipb-change-block' => 'ఈ అమరికలతో వాడుకరిని పునర్నిరోధించు', 'ipb-confirm' => 'నిరోధాన్ని ధృవపరచండి', 'badipaddress' => 'సరైన ఐ.పి. అడ్రసు కాదు', 'blockipsuccesssub' => 'నిరోధం విజయవంతం అయింది', 'blockipsuccesstext' => '[[Special:Contributions/$1|$1]] నిరోధించబడింది. <br />నిరోధాల సమీక్ష కొరకు [[Special:BlockList|ఐ.పి. నిరొధాల జాబితా]] చూడండి.', 'ipb-blockingself' => 'మిమ్మల్ని మీరే నిరోధించుకోబోతున్నారు! అదే మీ నిశ్చయమా?', 'ipb-edit-dropdown' => 'నిరోధపు కారణాలను మార్చండి', 'ipb-unblock-addr' => '$1 పై ఉన్న నిరోధాన్ని తొలగించండి', 'ipb-unblock' => 'వాడుకరి పేరుపై లేదా ఐపీ చిరునామాపై ఉన్న నిరోధాన్ని తొలగించండి', 'ipb-blocklist' => 'అమల్లో ఉన్న నిరోధాలను చూపించు', 'ipb-blocklist-contribs' => '$1 యొక్క మార్పులు-చేర్పులు', 'unblockip' => 'సభ్యునిపై నిరోధాన్ని తొలగించు', 'unblockiptext' => 'కింది ఫారం ఉపయోగించి, నిరోధించబడిన ఐ.పీ. చిరునామా లేదా సభ్యునికి తిరిగి రచనలు చేసే అధికారం ఇవ్వవచ్చు.', 'ipusubmit' => 'ఈ నిరోధాన్ని తొలగించు', 'unblocked' => '[[User:$1|$1]]పై నిరోధం తొలగించబడింది', 'unblocked-range' => '$1 పై నిరోధాన్ని తీసేసాం', 'unblocked-id' => '$1 అనే నిరోధాన్ని తొలగించాం', 'blocklist' => 'నిరోధిత వాడుకరులు', 'ipblocklist' => 'నిరోధించబడిన వాడుకరులు', 'ipblocklist-legend' => 'నిరోధించబడిన వాడుకరిని వెతకండి', 'blocklist-userblocks' => 'ఖాతా నిరోధాలను దాచు', 'blocklist-tempblocks' => 'తాత్కాలిక నిరోధాలను దాచు', 'blocklist-addressblocks' => 'ఏకైక ఐపీ నిరోధాలను దాచు', 'blocklist-timestamp' => 'కాలముద్ర', 'blocklist-target' => 'గమ్యం', 'blocklist-expiry' => 'కాలం చేల్లేది', 'blocklist-by' => 'నిర్వాహకుని నిరోధం', 'blocklist-params' => 'నిరోధపు పరామితులు', 'blocklist-reason' => 'కారణం', 'ipblocklist-submit' => 'వెతుకు', 'ipblocklist-localblock' => 'స్థానిక నిరోధం', 'ipblocklist-otherblocks' => 'ఇతర {{PLURAL:$1|నిరోధం|నిరోధాలు}}', 'infiniteblock' => 'అనంతం', 'expiringblock' => '$1 నాడు $2కి కాలం చెల్లుతుంది', 'anononlyblock' => 'అజ్ఞాతవ్యక్తులు మాత్రమే', 'noautoblockblock' => 'ఆటోమాటిక్ నిరోధాన్ని అశక్తం చేసాం', 'createaccountblock' => 'ఖాతా తెరవడాన్ని నిరోధించాము', 'emailblock' => 'ఈ-మెయిలుని నిరోధించాం', 'blocklist-nousertalk' => 'తమ చర్చాపేజీని మార్చలేరు', 'ipblocklist-empty' => 'నిరోధపు జాబితా ఖాళీగా ఉంది.', 'ipblocklist-no-results' => 'మీరడిగిన ఐపీ అడ్రసు లేదా సభ్యనామాన్ని నిరోధించలేదు.', 'blocklink' => 'నిరోధించు', 'unblocklink' => 'నిరోధాన్ని ఎత్తివేయి', 'change-blocklink' => 'నిరోధాన్ని మార్చండి', 'contribslink' => 'రచనలు', 'emaillink' => 'ఈ-మెయిలును పంపించు', 'autoblocker' => 'మీ ఐ.పీ. అడ్రసును "[[User:$1|$1]]" ఇటీవల వాడుట చేత, అది ఆటోమాటిక్‌గా నిరోధించబడినది. $1ను నిరోధించడానికి కారణం: "\'\'\'$2\'\'\'"', 'blocklogpage' => 'నిరోధాల చిట్టా', 'blocklog-showlog' => 'ఈ వాడుకరిని గతంలో నిరోధించారు. మీ సమాచారం కోసం నిరోధపు చిట్టాని క్రింద ఇచ్చాం:', 'blocklog-showsuppresslog' => 'ఈ వాడుకరిని గతంలో నిరోధించి, దాచి ఉంచారు. వివరాల కోసం అణచివేత చిట్టా కింద చూపబడింది:', 'blocklogentry' => '"[[$1]]" పై నిరోధం అమలయింది. నిరోధ కాలం $2 $3', 'reblock-logentry' => '[[$1]] కై నిరోధపు అమరికలను $2 $3 గడువుతో మార్చారు', 'blocklogtext' => 'వాడుకరుల నిరోధాలు, పునస్థాపనల చిట్టా ఇది. ఆటోమాటిక్‌గా నిరోధానికి గురైన ఐ.పి. చిరునామాలు ఈ జాబితాలో ఉండవు. ప్రస్తుతం అమల్లో ఉన్న నిరోధాలు, నిషేధాల కొరకు [[Special:BlockList|ఐ.పి. నిరోధాల జాబితా]]ను చూడండి.', 'unblocklogentry' => '$1పై నిరోధం తొలగించబడింది', 'block-log-flags-anononly' => 'అజ్ఞాత వాడుకర్లు మాత్రమే', 'block-log-flags-nocreate' => 'ఖాతా సృష్టించడాన్ని అశక్తం చేసాం', 'block-log-flags-noautoblock' => 'ఆటోమాటిక్ నిరోధాన్ని అశక్తం చేసాం', 'block-log-flags-noemail' => 'ఈ-మెయిలుని నిరోధించాం', 'block-log-flags-nousertalk' => 'తమ చర్చాపేజీని మార్చలేరు', 'block-log-flags-angry-autoblock' => 'మరింత ధృడమైన స్వయంనిరోధకం సచేతనం చేయబడింది', 'block-log-flags-hiddenname' => 'వాడుకరిపేరుని దాచారు', 'range_block_disabled' => 'శ్రేణి(రేంజి) నిరోధం చెయ్యగల నిర్వాహక అనుమతిని అశక్తం చేసాం.', 'ipb_expiry_invalid' => 'అంతమయ్యే గడువు సరైనది కాదు.', 'ipb_expiry_temp' => 'దాచిన వాడుకరిపేరు నిరోధాలు శాశ్వతంగా ఉండాలి.', 'ipb_hide_invalid' => 'ఈ ఖాతాను అణచలేకపోతున్నాం. దాని కింద చాలా దిద్దుబాట్లు ఉండి ఉంటాయి.', 'ipb_already_blocked' => '"$1" ను ఇప్పటికే నిరోధించాం', 'ipb-needreblock' => '$1ని ఇప్పటికే నిరోధించారు. ఆ అమరికలని మీరు మార్చాలనుకుంటున్నారా?', 'ipb-otherblocks-header' => 'ఇతర {{PLURAL:$1|నిరోధం|నిరోధాలు}}', 'unblock-hideuser' => 'ఈ వాడుకరి యొక్క వాడుకరిపేరు దాచబడి ఉంది కాబట్టి, వారిపై నిరోధాన్ని తీసెయ్యలేరు.', 'ipb_cant_unblock' => 'లోపం: నిరోధించిన ఐడీ $1 దొరకలేదు. దానిపై ఉన్న నిరోధాన్ని ఈసరికే తొలగించి ఉండవచ్చు.', 'ipb_blocked_as_range' => 'లోపం: ఐపీ $1 ను నేరుగా నిరోధించలేదు, అంచేత నిరోధాన్ని రద్దుపరచలేము. అయితే, అది $2 శ్రేణిలో భాగంగా నిరోధానికి గురైంది, ఈ శ్రేణిపై ఉన్న నిరోధాన్ని రద్దుపరచవచ్చు.', 'ip_range_invalid' => 'సరైన ఐపీ శ్రేణి కాదు.', 'ip_range_toolarge' => '/$1 కంటే పెద్దవైన సామూహిక నిరోధాలు అనుమతించబడవు.', 'proxyblocker' => 'ప్రాక్సీ నిరోధకం', 'proxyblockreason' => 'మీ ఐపీ అడ్రసు ఒక ఓపెన్ ప్రాక్సీ కాబట్టి దాన్ని నిరోధించాం. మీ ఇంటర్నెట్ సేవాదారుని గానీ, సాంకేతిక సహాయకుని గానీ సంప్రదించి తీవ్రమైన ఈ భద్రతా వైఫల్యాన్ని గురించి తెలపండి.', 'sorbsreason' => '{{SITENAME}} వాడే DNSBLలో మీ ఐపీ అడ్రసు ఒక ఓపెన్ ప్రాక్సీగా నమోదై ఉంది.', 'sorbs_create_account_reason' => 'మీ ఐపీ అడ్రసు DNSBL లో ఓపెను ప్రాక్సీగా నమోదయి ఉంది. మీరు ఎకౌంటును సృష్టించజాలరు.', 'cant-block-while-blocked' => 'నిరోధంలో ఉన్న మీరు ఇతర వాడుకరులపై నిరోధం అమలుచేయలేరు.', 'cant-see-hidden-user' => 'మీరు నిరోధించదలచిన వాడుకరి ఇప్పటికే నిరోధించబడి, దాచబడి ఉన్నారు. మీకు హక్కు లేదు కాబట్టి, ఆ వాడుకరి నిరోధాన్ని చూడటంగానీ, దాన్ని మార్చడంగానీ చెయ్యలేరు.', 'ipbblocked' => 'మీరు ఇతర వాడుకరులని నిరోధించలేరు లేదా అనిరోధించలేరు, ఎందుకంటే మిమ్మల్ని మీరే నిరోధించుకున్నారు', 'ipbnounblockself' => 'మిమ్మల్ని మీరే అనిరోధించుకునే అనుమతి మీకు లేదు', # Developer tools 'lockdb' => 'డాటాబేసును లాక్‌ చెయ్యి', 'unlockdb' => 'డాటాబేసుకి తాళంతియ్యి', 'lockdbtext' => 'డాటాబేసును లాక్‌ చెయ్యడం వలన సభ్యులు పేజీలు మార్చడం, అభిరుచులు మార్చడం, వీక్షణ జాబితాను మార్చడం వంటి డాటాబేసు ఆధారిత పనులు చెయ్యలేరు. మీరు చెయ్యదలచినది ఇదేనని, మీ పని కాగానే తిరిగి డాటాబేసును ప్రారంభిస్తాననీ ధృవీకరించండి.', 'unlockdbtext' => 'డేటాబేసుకు తాళం తీసేసిన తరువాత, వాడుకరులందరూ పేజీలను మార్చటం మొదలు పెట్టగలరు, తమ అభిరుచులను మార్చుకోగలరు, వీక్షణా జాబితాకు పేజీలను కలుపుకోగలరు తీసివేయనూగలరు, అంతేకాక డేటాబేసులో మార్పులు చేయగలిగే ఇంకొన్ని పనులు కూడా చేయవచ్చు. మీరు చేయదలుచుకుంది ఇదేనాకాదా అని ఒకసారి నిర్ధారించండి.', 'lockconfirm' => 'అవును, డేటాబేసును లాకు చెయ్యాలని నిజంగానే అనుకుంటున్నాను.', 'unlockconfirm' => 'అవును, నేను నిజంగానే డాటాబేసుకి తాళం తియ్యాలనుకుంటున్నాను.', 'lockbtn' => 'డాటాబేసును లాక్‌ చెయ్యి', 'unlockbtn' => 'డాటాబేసు తాళంతియ్యి', 'locknoconfirm' => 'మీరు ధృవీకరణ పెట్టెలో టిక్కు పెట్టలేదు.', 'lockdbsuccesssub' => 'డాటాబేసు లాకు విజయవంతం అయ్యింది.', 'unlockdbsuccesssub' => 'డాటాబేసుకు తాళం తీసేసాం', 'lockdbsuccesstext' => 'డాటాబేసు లాకయింది.<br />పని పూర్తి కాగానే లాకు తియ్యడం మర్చిపోకండి.', 'unlockdbsuccesstext' => 'డాటాబేసుకి తాళం తీసాం.', 'lockfilenotwritable' => 'డేటాబేసుకు తాళంవేయగల ఫైలులో రాయలేకపోతున్నాను. డేటాబేసుకు తాళంవేయటానికిగానీ లేదా తీసేయటానికిగానీ, వెబ్‌సర్వరులో ఉన్న ఈ ఫైలులో రాయగలగాలి.', 'databasenotlocked' => 'డేటాబేసు లాకవలేదు.', # Move page 'move-page' => '$1 తరలింపు', 'move-page-legend' => 'పేజీని తరలించు', 'movepagetext' => "కింది ఫారం ఉపయోగించి, ఓ పేజీ పేరు మార్చవచ్చు. దాంతో పాటు దాని చరిత్ర అంతా కొత్త పేజీ చరిత్రగా మారుతుంది. పాత పేజీ కొత్త దానికి దారిమార్పు పేజీ అవుతుంది. పాత పేజీకి ఉన్న దారిమార్పు పేజీలను ఆటోమెటిగ్గా సరిచేయవచ్చు. ఆలా చేయవద్దనుకుంటే, [[Special:DoubleRedirects|ద్వంద]] లేదా [[Special:BrokenRedirects|పనిచేయని]] దారిమార్పుల పేజీలలో సరిచూసుకోండి. లింకులన్నీ అనుకున్నట్లుగా చేరవలసిన చోటికే చేరుతున్నాయని నిర్ధారించుకోవలసిన బాధ్యత మీదే. ఒకవేళ కొత్త పేరుతో ఇప్పటికే ఒక పేజీ ఉండి ఉంటే (అది గత మార్పుల చరిత్ర లేని ఖాళీ పేజీనో లేదా దారిమార్పు పేజీనో కాకపోతే) తరలింపు '''జరగదు'''. అంటే మీరు పొరపాటు చేస్తే కొత్త పేరును మార్చి తిరిగి పాత పేరుకు తీసుకురాగలరు కానీ ఇప్పటికే వున్న పేజీని తుడిచివేయలేరు. '''హెచ్చరిక!''' ఈ మార్పు బాగా జనరంజకమైన పేజీలకు అనూహ్యం కావచ్చు; దాని పరిణామాలను అర్ధం చేసుకుని ముందుకుసాగండి.", 'movepagetext-noredirectfixer' => "కింది ఫారాన్ని వాడి, ఓ పేజీ పేరు మార్చవచ్చు. దాని చరిత్ర పూర్తిగా కొత్త పేరుకు తరలిపోతుంది. పాత శీర్షిక కొత్తదానికి దారిమార్పు పేజీగా మారిపోతుంది. [[Special:DoubleRedirects|double]] లేదా [[Special:BrokenRedirects|broken redirects]] లను చూడటం మరువకండి. లింకులు వెళ్ళాల్సిన చోటికి వెళ్తున్నాయని నిర్ధారించుకోవాల్సిన బాధ్యత మీదే. కొత్త పేరుతో ఈసరికే ఏదైనా పేజీ ఉంటే - అది ఖాళీగా ఉన్నా లేక మార్పుచేర్పుల చరిత్ర ఏమీ లేని దారిమార్పు పేజీ అయినా తప్ప- తరలింపు ’’’జరుగదు’’’ అని గమనించండి. అంటే, ఏదైనా పొరపాటు జరిగితే పేరును తిరిగి పాత పేరుకే మార్చగలరు తప్ప, ఈపాటికే ఉన్న పేజీపై ఓవరరైటు చెయ్యలేరు. '''హెచ్చరిక!''' బహుళ వ్యాప్తి పొందిన ఓ పేజీలో ఈ మార్పు చాలా తీవ్రమైనది, ఊహించనిదీ అవుతుంది. దాని పర్యవసానాలు అర్థం చేసుకున్నాకే ముందుకు వెళ్ళండి.", 'movepagetalktext' => "దానితో పాటు సంబంధిత చర్చా పేజీ కూడా ఆటోమాటిక్‌‌గా తరలించబడుతుంది, '''కింది సందర్భాలలో తప్ప:''' *ఒక నేంస్పేసు నుండి ఇంకోదానికి తరలించేటపుడు, *కొత్త పేరుతో ఇప్పటికే ఒక చర్చా పేజీ ఉంటే, *కింది చెక్‌బాక్సులో టిక్కు పెట్టకపోతే. ఆ సందర్భాలలో, మీరు చర్చా పేజీని కూడా పనిగట్టుకుని తరలించవలసి ఉంటుంది, లేదా ఏకీకృత పరచవలసి ఉంటుంది.", 'movearticle' => 'పేజీని తరలించు', 'moveuserpage-warning' => "'''హెచ్చరిక:''' మీరు ఒక వాడుకరి పేజీని తరలించబోతున్నారు. పేజీ మాత్రమే తరలించబడుతుందనీ, వాడుకరి పేరుమార్పు జరగదనీ గమనించండి.", 'movenologin' => 'లాగిన్‌ అయిలేరు', 'movenologintext' => 'పేజీని తరలించడానికి మీరు [[Special:UserLogin|లాగిన్‌]] అయిఉండాలి.', 'movenotallowed' => 'పేజీలను తరలించడానికి మీకు అనుమతి లేదు.', 'movenotallowedfile' => 'మీకు ఫైళ్ళను తరలించే అనుమతి లేదు.', 'cant-move-user-page' => 'వాడుకరి పేజీలను (ఉపపేజీలు కానివాటిని) తరలించే అనుమతి మీకు లేదు .', 'cant-move-to-user-page' => 'మీకు ఒక పేజీని వాడుకరి పేజీగా (వాడుకరి ఉపపేజీగా తప్ప) తరలించే అనుమతి లేదు.', 'newtitle' => 'కొత్త పేరుకి', 'move-watch' => 'ఈ పేజీని గమనించు', 'movepagebtn' => 'పేజీని తరలించు', 'pagemovedsub' => 'తరలింపు విజయవంతమైనది', 'movepage-moved' => '\'\'\'"$1"ని "$2"కి తరలించాం\'\'\'', 'movepage-moved-redirect' => 'ఒక దారిమార్పుని సృష్టించాం.', 'movepage-moved-noredirect' => 'దారిమార్పుని సృష్టించలేదు.', 'articleexists' => 'ఆ పేరుతో ఇప్పటికే ఒక పేజీ ఉంది, లేదా మీరు ఎంచుకున్న పేరు సరైనది కాదు. వేరే పేరు ఎంచుకోండి.', 'cantmove-titleprotected' => 'ఈ పేరుతోఉన్న పేజీని సృష్టించనివ్వకుండా సంరక్షిస్తున్నారు, అందుకని ఈ ప్రదేశంలోకి పేజీని తరలించలేను', 'talkexists' => "'''పేజీని జయప్రదంగా తరలించాము, కానీ చర్చా పేజీని తరలించలేక పోయాము. కొత్త పేరుతో చర్చ పేజీ ఇప్పటికే ఉంది, ఆ రెంటినీ మీరే ఏకీకృతం చెయ్యండి.'''", 'movedto' => 'తరలింపు', 'movetalk' => 'కూడా వున్న చర్చ పేజీని తరలించు', 'move-subpages' => 'ఉపపేజీలను ($1 వరకు) తరలించు', 'move-talk-subpages' => 'చర్చా పేజీ యొక్క ఉపపేజీలను ($1 వరకు) తరలించు', 'movepage-page-exists' => '$1 అనే పేజీ ఈపాటికే ఉంది మరియు దాన్ని ఆటోమెటిగ్గా ఈ పేజీతో మార్చివేయలేరు.', 'movepage-page-moved' => '$1 అనే పేజీని $2 కి తరలించాం.', 'movepage-page-unmoved' => '$1 అనే పేజీని $2 కి తరలించలేకపోయాము.', 'movepage-max-pages' => '$1 యొక్క గరిష్ఠ పరిమితి {{PLURAL:$1|పేజీ|పేజీలు}} వరకు తరలించడమైనది. ఇక ఆటోమాటిగ్గా తరలించము.', 'movelogpage' => 'తరలింపుల చిట్టా', 'movelogpagetext' => 'కింద తరలించిన పేజీల జాబితా ఉన్నది.', 'movesubpage' => '{{PLURAL:$1|ఉపపేజీ|ఉపపేజీలు}}', 'movesubpagetext' => 'ఈ పేజీకి క్రింద చూపించిన $1 {{PLURAL:$1|ఉపపేజీ ఉంది|ఉపపేజీలు ఉన్నాయి}}.', 'movenosubpage' => 'ఈ పేజీకి ఉపపేజీలు ఏమీ లేవు.', 'movereason' => 'కారణం:', 'revertmove' => 'తరలింపును రద్దుచేయి', 'delete_and_move' => 'తొలగించి, తరలించు', 'delete_and_move_text' => '==తొలగింపు అవసరం== ఉద్దేశించిన వ్యాసం "[[:$1]]" ఇప్పటికే ఉనికిలో ఉంది. ప్రస్తుత తరలింపుకు వీలుగా దాన్ని తొలగించేయమంటారా?', 'delete_and_move_confirm' => 'అవును, పేజీని తొలగించు', 'delete_and_move_reason' => '"[[$1]]"ను తరలించడానికి వీలుగా తొలగించారు', 'selfmove' => 'మూలం, గమ్యం పేర్లు ఒకటే; పేజీని దాని పైకే తరలించడం కుదరదు.', 'immobile-source-namespace' => '"$1" పేరుబరిలోని పేజీలను తరలించలేరు', 'immobile-target-namespace' => '"$1" పేరుబరిలోనికి పేజీలను తరలించలేరు', 'immobile-target-namespace-iw' => 'పేజీని తరలించడానికి అంతర్వికీ లింకు సరైన లక్ష్యం కాదు.', 'immobile-source-page' => 'ఈ పేజీని తరలించలేరు.', 'immobile-target-page' => 'ఆ లక్ష్యిత శీర్షికకి తరలించలేము.', 'imagenocrossnamespace' => 'ఫైలును, ఫైలుకు చెందని నేమ్‌స్పేసుకు తరలించలేం', 'nonfile-cannot-move-to-file' => 'దస్త్రాలు కానివాటిని దస్త్రపు పేరుబరికి తరలించలేరు', 'imagetypemismatch' => 'ఈ కొత్త ఫైలు ఎక్స్&zwnj;టెన్షన్ ఫైలు రకానికి సరిపోలేదు', 'imageinvalidfilename' => 'లక్ష్యిత దస్త్రపు పేరు చెల్లనిది', 'fix-double-redirects' => 'పాత పేజీని సూచిస్తున్న దారిమార్పులను తాజాకరించు', 'move-leave-redirect' => 'పాత పేజీని దారిమార్పుగా ఉంచు', 'protectedpagemovewarning' => "'''హెచ్చరిక:''' ఈ పేజీని సంరక్షించారు కనుక నిర్వాహక హక్కులు కలిగిన వాడుకరులు మాత్రమే దీన్ని తరలించగలరు. మీ సమాచారం కోసం చివరి చిట్టా పద్దుని ఇక్కడ ఇస్తున్నాం:", 'semiprotectedpagemovewarning' => "'''గమనిక:''' ఈ పేజీని సంరక్షించారు కనుక నమోదైన వాడుకరులు మాత్రమే దీన్ని తరలించగలరు. మీ సమాచారం కోసం చివరి చిట్టా పద్దుని ఇక్కడ ఇస్తున్నాం:", 'move-over-sharedrepo' => '== ఫైలు ఉంది == [[:$1]] సామూహిక నిక్షేపంలో ఉంది. ఈ పేరుతో మరొక ఫైలును తరలిస్తే అది ఆ సామూహిక ఫైలును ఓవర్‌రైడు చేస్తుంది.', 'file-exists-sharedrepo' => 'ఎంచుకున్న ఫైలు పేరు ఇప్పటికే సామాన్య భాండాగారంలో వాడుకలో ఉంది. దయచేసి మరొక పేరుని ఎంచుకోండి.', # Export 'export' => 'ఎగుమతి పేజీలు', 'exporttext' => 'ఎంచుకున్న పేజీ లేదా పేజీలలోని వ్యాసం మరియు పేజీ చరితం లను XML లో ఎగుమతి చేసుకోవచ్చు. MediaWiki ని ఉపయోగించి Special:Import page ద్వారా దీన్ని వేరే వికీ లోకి దిగుమతి చేసుకోవచ్చు. పేజీలను ఎగుమతి చేసందుకు, కింద ఇచ్చిన టెక్స్టు బాక్సులో పేజీ పేర్లను లైనుకో పేరు చొప్పున ఇవ్వండి. ప్రస్తుత కూర్పుతో పాటు పాత కూర్పులు కూడా కావాలా, లేక ప్రస్తుత కూర్పు మాత్రమే చాలా అనే విషయం కూడా ఇవ్వవచ్చు. రెండో పద్ధతిలో అయితే, పేజీ యొక్క లింకును కూడా వాడవచ్చు. ఉదాహరణకు, "[[{{MediaWiki:Mainpage}}]]" కోసమైతే [[{{#Special:Export}}/{{MediaWiki:Mainpage}}]] అని ఇవ్వవచ్చు.', 'exportcuronly' => 'ప్రస్తుత కూర్పు మాత్రమే, పూర్తి చరితం వద్దు', 'exportnohistory' => "---- '''గమనిక:''' ఈ ఫారాన్ని ఉపయోగించి పేజీలయొక్క పూర్తి చరిత్రను ఎగుమతి చేయడాన్ని సర్వరుపై వత్తిడి పెరిగిన కారణంగా ప్రస్తుతం నిలిపివేశారు.", 'export-submit' => 'ఎగుమతించు', 'export-addcattext' => 'ఈ వర్గంలోని పేజీలను చేర్చు:', 'export-addcat' => 'చేర్చు', 'export-addnstext' => 'ఈ పేరుబరి నుండి పేజీలను చేర్చు:', 'export-addns' => 'చేర్చు', 'export-download' => 'ఫైలుగా భద్రపరచు', 'export-templates' => 'మూసలను కలుపు', 'export-pagelinks' => 'ఈ లోతు వరకు లింకై ఉన్న పేజీలను చేర్చు:', # Namespace 8 related 'allmessages' => 'అన్ని సిస్టం సందేశాలు', 'allmessagesname' => 'పేరు', 'allmessagesdefault' => 'అప్రమేయ సందేశపు పాఠ్యం', 'allmessagescurrent' => 'ప్రస్తుత పాఠ్యం', 'allmessagestext' => 'మీడియావికీ పేరుబరిలో ఉన్న అంతరవర్తి సందేశాల జాబితా ఇది. సాధారణ మీడియావికీ స్థానికీకరణకి మీరు తోడ్పడాలనుకుంటే, దయచేసి [//www.mediawiki.org/wiki/Localisation మీడియావికీ స్థానికీకరణ] మరియు [//translatewiki.net ట్రాన్స్&zwnj;లేట్&zwnj;వికీ.నెట్] సైట్లను చూడండి.', 'allmessagesnotsupportedDB' => "'''\$wgUseDatabaseMessages''' అన్నది అచేతనం చేసి ఉన్నందువల్ల ఈ పేజీని వాడలేరు.", 'allmessages-filter-legend' => 'వడపోత', 'allmessages-filter' => 'కస్టమైజేషను స్థితిని బట్టి వడకట్టు:', 'allmessages-filter-unmodified' => 'మార్చబడనివి', 'allmessages-filter-all' => 'అన్నీ', 'allmessages-filter-modified' => 'మార్చబడినవి', 'allmessages-prefix' => 'ఉపసర్గ పై వడపోత:', 'allmessages-language' => 'భాష:', 'allmessages-filter-submit' => 'వెళ్ళు', # Thumbnails 'thumbnail-more' => 'పెద్దది చెయ్యి', 'filemissing' => 'ఫైలు కనపడుటలేదు', 'thumbnail_error' => '$1: నఖచిత్రం తయారుచెయ్యడంలో లోపం జరిగింది', 'djvu_page_error' => 'DjVu పేజీ రేంజి దాటిపోయింది', 'djvu_no_xml' => 'DjVu ఫైలు కోసం XMLను తీసుకుని రాలేకపోయాను', 'thumbnail_invalid_params' => 'నఖచిత్రాలకు సరయిన పారామీటర్లు లేవు', 'thumbnail_dest_directory' => 'గమ్యస్థానంలో డైరెక్టరీని సృష్టించలేకపోయాం', 'thumbnail_image-type' => 'ఈ బొమ్మ రకానికి మద్దతు లేదు', 'thumbnail_gd-library' => 'అసంపూర్ణ GD సంచయపు ఏర్పాటు: $1 ఫంక్షను లేదు.', 'thumbnail_image-missing' => 'ఫైలు తప్పిపోయినట్లున్నది: $1', # Special:Import 'import' => 'పేజీలను దిగుమతి చేసుకోండి', 'importinterwiki' => 'ఇంకోవికీ నుండి దిగుమతి', 'import-interwiki-text' => 'దిగుమతి చేసుకోవడానికి ఒక వికీని మరియు అందులోని పేజీని ఎంచుకోండి. కూర్పుల తేదీలు మరియు మార్పులు చేసిన వారి పేర్లు భద్రపరచబడతాయి. ఇతర వికీలనుండి చేస్తున్న దిగుమతుల చర్యలన్నీ [[Special:Log/import|దిగుమతుల చిట్టా]]లో నమోదవుతాయి.', 'import-interwiki-source' => 'మూల వికీ/పేజీ:', 'import-interwiki-history' => 'ఈ పేజీ యొక్క అన్ని చారిత్రక కూర్పులను కాపీ చెయ్యి', 'import-interwiki-templates' => 'అన్ని మూసలను ఉంచు', 'import-interwiki-submit' => 'దిగుమతించు', 'import-interwiki-namespace' => 'లక్ష్యిత నేంస్పేసు:', 'import-upload-filename' => 'పైలుపేరు:', 'import-comment' => 'వ్యాఖ్య:', 'importtext' => '[[Special:Export|ఎగుమతి ఉపకరణాన్ని]] ఉపయోగించి, ఈ ఫైలుని మూల వికీ నుంచి ఎగుమతి చెయ్యండి. దాన్ని మీ కంప్యూటర్లో భద్రపరచి, ఆపై ఇక్కడికి ఎక్కించండి.', 'importstart' => 'పేజీలను దిగుమతి చేస్తున్నాం...', 'import-revision-count' => '$1 {{PLURAL:$1|కూర్పు|కూర్పులు}}', 'importnopages' => 'దిగుమతి చెయ్యడానికి పేజీలేమీ లేవు.', 'imported-log-entries' => '$1 {{PLURAL:$1|చిట్టా పద్దు దిగుమతయ్యింది|చిట్టా పద్దులు దిగుమతయ్యాయి}}.', 'importfailed' => 'దిగుమతి కాలేదు: $1', 'importunknownsource' => 'దిగుమతి చేసుకుంటున్న దాని మాతృక రకం తెలియదు', 'importcantopen' => 'దిగుమతి చేయబోతున్న ఫైలును తెరవలేకపోతున్నాను', 'importbadinterwiki' => 'చెడు అంతర్వికీ లింకు', 'importnotext' => 'ఖాళీ లేదా పాఠ్యం లేదు', 'importsuccess' => 'దిగుమతి పూర్తయ్యింది!', 'importhistoryconflict' => 'కూర్పుల చరిత్రలో ఘర్షణ తలెత్తింది (ఈ పేజీని ఇంతకు ముందే దిగుమతి చేసుంటారు)', 'importnosources' => 'No transwiki import sources have been defined and direct history uploads are disabled. ఎటువంటి అంతర్వికీ దిగుమతి మూలాలను పేర్కొనకపోవటం వలన, ప్రత్యక్ష చరిత్ర అప్లోడులను నిలిపివేశాం.', 'importnofile' => 'ఎటువంటి దిగుమతి ఫైలునూ అప్లోడుచేయలేదు.', 'importuploaderrorsize' => 'దిగుమతి ఫైలు అప్లోడు ఫలించలేదు. ఈ ఫైలు అప్లోడు ఫైలుకు నిర్దేశించిన పరిమాణం కంటే పెద్దా ఉంది.', 'importuploaderrorpartial' => 'దిగుమతి ఫైలు అప్లోడు ఫలించలేదు. ఈ ఫైలులో కొంత భాగాన్ని మాత్రమే అప్లోడు చేయగలిగం.', 'importuploaderrortemp' => 'దిగుమతి ఫైలు అప్లోడు ఫలించలేదు. ఒక తాత్కాలిక ఫోల్డరు కనిపించటం లేదు.', 'import-parse-failure' => 'దిగుమతి చేసుకుంటున్న XML విశ్లేషణ ఫలించలేదు', 'import-noarticle' => 'దిగుమతి చెయ్యాల్సిన పేజీ లేదు!', 'import-nonewrevisions' => 'అన్ని కూర్పులూ గతంలోనే దిగుమతయ్యాయి.', 'xml-error-string' => '$1 $2వ లైనులో, వరుస $3 ($4వ బైటు): $5', 'import-upload' => 'XML డేటాను అప్‌లోడు చెయ్యి', 'import-token-mismatch' => 'సెషను భోగట్టా పోయింది. దయచేసి మళ్ళీ ప్రయత్నించండి.', 'import-invalid-interwiki' => 'మీరు చెప్పిన వికీనుండి దిగుమతి చేయలేము.', # Import log 'importlogpage' => 'దిగుమతుల చిట్టా', 'importlogpagetext' => 'ఇతర వికీల నుండీ మార్పుల చరిత్రతోసహా తెచ్చిన నిర్వహణా దిగుమతులు.', 'import-logentry-upload' => '[[$1]]ను ఫైలు అప్లోడు ద్వారా దిగుమతి చేసాం', 'import-logentry-upload-detail' => '$1 {{PLURAL:$1|కూర్పు|కూర్పులు}}', 'import-logentry-interwiki' => 'ఇతర వికీల నుండి $1', 'import-logentry-interwiki-detail' => '$2 నుండి {{PLURAL:$1|ఒక కూర్పు|$1 కూర్పులు}}', # JavaScriptTest 'javascripttest' => 'జావాస్క్రిప్ట్ పరీక్ష', 'javascripttest-title' => '$1 పరీక్షలు నడుస్తున్నాయి', # Tooltip help for the actions 'tooltip-pt-userpage' => 'మీ వాడుకరి పేజీ', 'tooltip-pt-anonuserpage' => 'మీ ఐపీ చిరునామాకి సంబంధించిన వాడుకరి పేజీ', 'tooltip-pt-mytalk' => 'మీ చర్చా పేజీ', 'tooltip-pt-anontalk' => 'ఈ ఐపీ చిరునామా నుండి చేసిన మార్పుల గురించి చర్చ', 'tooltip-pt-preferences' => 'మీ అభిరుచులు', 'tooltip-pt-watchlist' => 'మీరు మార్పుల కొరకు గమనిస్తున్న పేజీల జాబితా', 'tooltip-pt-mycontris' => 'మీ మార్పు-చేర్పుల జాబితా', 'tooltip-pt-login' => 'మీరు లోనికి ప్రవేశించడాన్ని ప్రోత్సహిస్తున్నాం; కానీ అది తప్పనిసరి కాదు.', 'tooltip-pt-anonlogin' => 'మీరు లోనికి ప్రవేశించడాన్ని ప్రోత్సహిస్తాం; కానీ, అది తప్పనిసరి కాదు', 'tooltip-pt-logout' => 'నిష్క్రమించండి', 'tooltip-ca-talk' => 'విషయపు పుట గురించి చర్చ', 'tooltip-ca-edit' => 'ఈ పేజీని మీరు సరిదిద్దవచ్చు. దాచేముందు మునుజూపు బొత్తాన్ని వాడండి.', 'tooltip-ca-addsection' => 'కొత్త విభాగాన్ని మొదలుపెట్టండి', 'tooltip-ca-viewsource' => 'ఈ పుటని సంరక్షించారు. మీరు దీని మూలాన్ని చూడవచ్చు', 'tooltip-ca-history' => 'ఈ పుట యొక్క వెనుకటి కూర్పులు', 'tooltip-ca-protect' => 'ఈ పేజీని సంరక్షించండి', 'tooltip-ca-unprotect' => 'ఈ పేజీ సంరక్షణను మార్చండి', 'tooltip-ca-delete' => 'ఈ పేజీని తొలగించండి', 'tooltip-ca-undelete' => 'ఈ పేజీని తొలగించడానికి ముందు చేసిన మార్పులను పునఃస్థాపించు', 'tooltip-ca-move' => 'ఈ పేజీని తరలించండి', 'tooltip-ca-watch' => 'ఈ పేజీని మీ విక్షణా జాబితాకి చేర్చుకోండి', 'tooltip-ca-unwatch' => 'ఈ పేజీని మీ విక్షణా జాబితా నుండి తొలగించండి', 'tooltip-search' => '{{SITENAME}} లో వెతకండి', 'tooltip-search-go' => 'ఇదే పేరుతో పేజీ ఉంటే అక్కడికి తీసుకెళ్ళు', 'tooltip-search-fulltext' => 'పేజీలలో ఈ పాఠ్యం కొరకు వెతుకు', 'tooltip-p-logo' => 'మొదటి పుటను దర్శించండి', 'tooltip-n-mainpage' => 'తలపుటను చూడండి', 'tooltip-n-mainpage-description' => 'మొదటి పుటను చూడండి', 'tooltip-n-portal' => 'ప్రాజెక్టు గురించి, మీరేం చేయవచ్చు, సమాచారం ఎక్కడ దొరుకుతుంది', 'tooltip-n-currentevents' => 'ఇప్పటి ముచ్చట్ల యొక్క మునుపటి మందలను తెలుసుకొనుడి', 'tooltip-n-recentchanges' => 'వికీలో ఇటీవల జరిగిన మార్పుల జాబితా.', 'tooltip-n-randompage' => 'ఓ యాదృచ్చిక పేజీని చూడండి', 'tooltip-n-help' => 'తెలుసుకోడానికి ఓ మంచి ప్రదేశం.', 'tooltip-t-whatlinkshere' => 'ఇక్కడితో ముడిపడియున్న అన్ని వికీ పుటల లంకెలు', 'tooltip-t-recentchangeslinked' => 'ఈ పుటకు ముడివడియున్న పుటలలో జరిగిన ఇటీవలి మార్పులు', 'tooltip-feed-rss' => 'ఈ పేజీకి RSS ఫీడు', 'tooltip-feed-atom' => 'ఈ పేజీకి Atom ఫీడు', 'tooltip-t-contributions' => 'ఈ వాడుకరి యొక్క రచనల జాబితా చూడండి', 'tooltip-t-emailuser' => 'ఈ వాడుకరికి ఓ ఈమెయిలు పంపండి', 'tooltip-t-upload' => 'దస్త్రాలను ఎక్కించండి', 'tooltip-t-specialpages' => 'అన్ని ప్రత్యేక పుటల యొక్క జాబితా', 'tooltip-t-print' => 'ఈ పుట యొక్క అచ్చుతీయదగ్గ కూర్పు', 'tooltip-t-permalink' => 'పుట యొక్క ఈ కూర్పుకి శాశ్వత లంకె', 'tooltip-ca-nstab-main' => 'ముచ్చట్ల పుటను చూడండి', 'tooltip-ca-nstab-user' => 'వాడుకరి పేజీని చూడండి', 'tooltip-ca-nstab-media' => 'మీడియా పేజీని చూడండి', 'tooltip-ca-nstab-special' => 'ఇది ఒక ప్రత్యేక పుట, దీన్ని మీరు సరిదిద్దలేరు', 'tooltip-ca-nstab-project' => 'ప్రాజెక్టు పేజీని చూడండి', 'tooltip-ca-nstab-image' => 'ఫైలు పేజీని చూడండి', 'tooltip-ca-nstab-mediawiki' => 'వ్యవస్థా సందేశం చూడండి', 'tooltip-ca-nstab-template' => 'మూసని చూడండి', 'tooltip-ca-nstab-help' => 'సహాయపు పేజీ చూడండి', 'tooltip-ca-nstab-category' => 'వర్గపు పేజీ చూడండి', 'tooltip-minoredit' => 'దీన్ని చిన్న మార్పుగా గుర్తించు', 'tooltip-save' => 'మీ మార్పులను భద్రపరచండి', 'tooltip-preview' => 'మీ మార్పులను మునుజూడండి, భద్రపరిచేముందు ఇది వాడండి!', 'tooltip-diff' => 'పాఠానికి మీరు చేసిన మార్పులను చూపుంచు. [alt-v]', 'tooltip-compareselectedversions' => 'ఈ పేజీలో ఎంచుకున్న రెండు కూర్పులకు మధ్య తేడాలను చూడండి. [alt-v]', 'tooltip-watch' => 'ఈ పేజీని మీ విక్షణా జాబితాకు చేర్చండి', 'tooltip-watchlistedit-normal-submit' => 'శీర్షికలను తీసివెయ్యి', 'tooltip-watchlistedit-raw-submit' => 'వీక్షణ జాబితాను తాజాకరించు', 'tooltip-recreate' => 'పేజీ తుడిచివేయబడ్డాకానీ మళ్ళీ సృష్టించు', 'tooltip-upload' => 'ఎగుమతి మొదలుపెట్టు', 'tooltip-rollback' => '"రద్దుచేయి" అనేది ఈ పేజీని చివరిగా మార్చినవారి మార్పులని రద్దుచేస్తుంది', 'tooltip-undo' => '"దిద్దుబాటుని రద్దుచేయి" ఈ మార్పుని రద్దుచేస్తుంది మరియు దిద్దుబాటు ఫారాన్ని మునుజూపులో తెరుస్తుంది. సారాంశానికి కారణాన్ని చేర్చే వీలుకల్పిస్తుంది', 'tooltip-preferences-save' => 'అభిరుచులను భద్రపరచు', 'tooltip-summary' => 'చిన్న సారాంశాన్ని ఇవ్వండి', # Metadata 'notacceptable' => 'ఈ వికీ సర్వరు మీ క్లయంటు చదవగలిగే రీతిలో డేటాను ఇవ్వలేదు.', # Attribution 'anonymous' => '{{SITENAME}} యొక్క అజ్ఞాత {{PLURAL:$1|వాడుకరి|వాడుకరులు}}', 'siteuser' => '{{SITENAME}} వాడుకరి $1', 'anonuser' => '{{SITENAME}} అజ్ఞాత వాడుకరి $1', 'lastmodifiedatby' => 'ఈ పేజీకి $3 $2, $1న చివరి మార్పు చేసారు.', 'othercontribs' => '$1 యొక్క కృతిపై ఆధారితం.', 'others' => 'ఇతరాలు', 'siteusers' => '{{SITENAME}} {{PLURAL:$2|వాడుకరి|వాడుకరులు}} $1', 'anonusers' => '{{SITENAME}} అజ్ఞాత {{PLURAL:$2|వాడుకరి|వాడుకరులు}} $1', 'creditspage' => 'పేజీ క్రెడిట్లు', 'nocredits' => 'ఈ పేజీకి క్రెడిట్ల సమాచారం అందుబాటులో లేదు.', # Spam protection 'spamprotectiontitle' => 'స్పాం సంరక్షణ ఫిల్టరు', 'spamprotectiontext' => 'మీరు భద్రపరచదలచిన పేజీని మా స్పాం వడపోత నిరోధించింది. బహుశా ఏదైనా నిషేధిత బయటి సైటుకు ఇచ్చిన లింకు కారణంగా ఇది జరిగివుండవచ్చు.', 'spamprotectionmatch' => 'మా స్పాం ఫిల్టరును ప్రేరేపించిన రచన భాగం ఇది: $1', 'spambot_username' => 'మీడియావికీ స్పాము శుద్ధి', 'spam_reverting' => '$1 కు లింకులు లేని గత కూర్పుకు తిరిగి తీసుకెళ్తున్నాం', 'spam_blanking' => '$1 కు లింకులు ఉన్న కూర్పులన్నిటినీ ఖాళీ చేస్తున్నాం', # Info page 'pageinfo-title' => '"$1" గురించి సమాచారం', 'pageinfo-header-basic' => 'ప్రాథమిక సమాచారం', 'pageinfo-header-edits' => 'మార్పుల చరిత్ర', 'pageinfo-views' => 'వీక్షణల సంఖ్య', 'pageinfo-watchers' => 'పేజీ వీక్షకుల సంఖ్య', 'pageinfo-edits' => 'మొత్తం మార్పుల సంఖ్య', 'pageinfo-toolboxlink' => 'పేజీ సమాచారం', 'pageinfo-contentpage-yes' => 'అవును', 'pageinfo-protect-cascading-yes' => 'అవును', 'pageinfo-category-info' => 'వర్గపు సమాచారం', 'pageinfo-category-pages' => 'పేజీల సంఖ్య', 'pageinfo-category-subcats' => 'ఉపవర్గాల సంఖ్య', 'pageinfo-category-files' => 'దస్త్రాల సంఖ్య', # Skin names 'skinname-cologneblue' => 'కలోన్ నీలం', 'skinname-monobook' => 'మోనోబుక్', 'skinname-modern' => 'ఆధునిక', 'skinname-vector' => 'వెక్టర్', # Patrolling 'markaspatrolleddiff' => 'పరీక్షించినట్లుగా గుర్తు పెట్టు', 'markaspatrolledtext' => 'ఈ వ్యాసాన్ని పరీక్షించినట్లుగా గుర్తు పెట్టు', 'markedaspatrolled' => 'పరీక్షింపబడినట్లు గుర్తింపబడింది', 'markedaspatrolledtext' => '[[:$1]] యొక్క ఎంచుకున్న కూర్పుని పరీక్షించినట్లుగా గుర్తించాం.', 'rcpatroldisabled' => 'ఇటీవలి మార్పుల నిఘాను అశక్తం చేసాం', 'rcpatroldisabledtext' => 'ఇటీవలి మార్పుల నిఘాను ప్రస్తుతానికి అశక్తం చేసాం', 'markedaspatrollederror' => 'నిఘాలో ఉన్నట్లుగా గుర్తించలేకున్నాం', 'markedaspatrollederrortext' => 'నిఘాలో ఉన్నట్లు గుర్తించేందుకుగాను, కూర్పును చూపించాలి.', 'markedaspatrollederror-noautopatrol' => 'మీరు చేసిన మార్పులను మీరే నిఘాలో పెట్టలేరు.', # Patrol log 'patrol-log-page' => 'నిఘా చిట్టా', 'patrol-log-header' => 'ఇది పర్యవేక్షించిన కూర్పుల చిట్టా.', 'log-show-hide-patrol' => '$1 పర్యవేక్షణ చిట్టా', # Image deletion 'deletedrevision' => 'పాత సంచిక $1 తొలగించబడినది.', 'filedeleteerror-short' => 'ఫైలు తొలగించడంలో పొరపాటు: $1', 'filedeleteerror-long' => 'ఫైలుని తొలగించడంలో పొరపాట్లు జరిగాయి: $1', 'filedelete-missing' => '"$1" అన్న ఫైలు ఉనికిలో లేనందున, దాన్ని తొలగించలేం.', 'filedelete-old-unregistered' => 'మీరు చెప్పిన ఫైలు కూర్పు "$1" డాటాబేసులో లేదు.', 'filedelete-current-unregistered' => 'మీరు చెప్పిన ఫైలు "$1" డాటాబేసులో లేదు.', 'filedelete-archive-read-only' => '"$1" భాండార డైరెక్టరీలో వెబ్‌సర్వరు రాయలేకున్నది.', # Browsing diffs 'previousdiff' => '← మునుపటి మార్పు', 'nextdiff' => 'తరువాతి మార్పు →', # Media information 'mediawarning' => "'''హెచ్చరిక''': ఈ రకపు ఫైలులో హానికరమైన కోడ్‌ ఉండవచ్చు. దాన్ని నడపడం వల్ల, మీ సిస్టమ్ లొంగిపోవచ్చు.", 'imagemaxsize' => "బొమ్మ పరిమాణంపై పరిమితి:<br />''(దస్త్రపు వివరణ పుటల కొరకు)''", 'thumbsize' => 'నఖచిత్రం వైశాల్యం:', 'widthheightpage' => '$1 × $2, $3 {{PLURAL:$3|పేజీ|పేజీలు}}', 'file-info' => 'ఫైలు పరిమాణం: $1, MIME రకం: $2', 'file-info-size' => '$1 × $2 పిక్సెళ్ళు, ఫైలు పరిమాణం: $3, MIME రకం: $4', 'file-info-size-pages' => '$1 × $2 పిక్సెళ్ళు, దస్త్రపు పరిమాణం: $3, MIME రకం: $4, $5 {{PLURAL:$5|పేజీ|పేజీలు}}', 'file-nohires' => 'మరింత స్పష్టమైన బొమ్మ లేదు.', 'svg-long-desc' => 'SVG ఫైలు, నామమాత్రంగా $1 × $2 పిక్సెళ్ళు, ఫైలు పరిమాణం: $3', 'show-big-image' => 'అసలు పరిమాణం', 'show-big-image-preview' => 'ఈ మునుజూపు పరిమాణం: $1.', 'show-big-image-other' => 'ఇతర {{PLURAL:$2|వైశాల్యం|వైశాల్యాలు}}: $1.', 'show-big-image-size' => '$1 × $2 పిక్సెళ్ళు', 'file-info-gif-looped' => 'లూపులో పడింది', 'file-info-gif-frames' => '$1 {{PLURAL:$1|ఫ్రేము|ఫ్రేములు}}', 'file-info-png-looped' => 'పునరావృతమవుతుంది', 'file-info-png-repeat' => '{{PLURAL:$1|ఒకసారి|$1 సార్లు}} ఆడించారు', 'file-info-png-frames' => '$1 {{PLURAL:$1|ఫ్రేము|ఫ్రేములు}}', # Special:NewFiles 'newimages' => 'కొత్త ఫైళ్ళ కొలువు', 'imagelisttext' => "ఇది $2 వారీగా పేర్చిన '''$1''' {{PLURAL:$1|పైలు|ఫైళ్ళ}} జాబితా.", 'newimages-summary' => 'ఇటీవలే ఎగుమతైన ఫైళ్ళను ఈ ప్రత్యేక పేజీ చూపిస్తుంది.', 'newimages-legend' => 'పడపోత', 'newimages-label' => 'ఫైలుపేరు (లేదా దానిలోని భాగం):', 'showhidebots' => '($1 బాట్లు)', 'noimages' => 'చూసేందుకు ఏమీ లేదు.', 'ilsubmit' => 'వెతుకు', 'bydate' => 'తేదీ వారీగ', 'sp-newimages-showfrom' => '$2, $1 నుండి మొదలుపెట్టి కొత్త ఫైళ్ళను చూపించు', # Video information, used by Language::formatTimePeriod() to format lengths in the above messages 'seconds-abbrev' => '$1క్ష', 'days-abbrev' => '$1రో', 'seconds' => '{{PLURAL:$1|$1 క్షణం|$1 క్షణాల}}', 'minutes' => '{{PLURAL:$1|ఒక నిమిషం|$1 నిమిషాల}}', 'hours' => '{{PLURAL:$1|ఒక గంట|$1 గంటల}}', 'days' => '{{PLURAL:$1|ఒక రోజు|$1 రోజుల}}', 'weeks' => '{{PLURAL:$1|$1 వారం|$1 వారాలు}}', 'months' => '{{PLURAL:$1|ఒక నెల|$1 నెలల}}', 'years' => '{{PLURAL:$1|ఒక సంవత్సరం|$1 సంవత్సరాల}}', 'ago' => '$1 క్రితం', 'just-now' => 'ఇప్పుడే', # Human-readable timestamps 'hours-ago' => '$1 {{PLURAL:$1|గంట|గంటల}} క్రితం', 'minutes-ago' => '$1 {{PLURAL:$1|నిమిషం|నిమిషాల}} క్రితం', 'seconds-ago' => '$1 {{PLURAL:$1|క్షణం|క్షణాల}} క్రితం', 'monday-at' => 'సోమవారం నాడు $1కి', 'tuesday-at' => 'మంగళవారం నాడు $1కి', 'wednesday-at' => 'బుధవారం నాడు $1కి', 'thursday-at' => 'గురువారం నాడు $1కి', 'friday-at' => 'శుక్రవారం నాడు $1కి', 'saturday-at' => 'శనివారం నాడు $1కి', 'sunday-at' => 'ఆదివారం నాడు $1కి', 'yesterday-at' => 'నిన్న $1కి', # Bad image list 'bad_image_list' => 'కింద తెలిపిన తీరులో కలపాలి: జాబితాలో ఉన్నవాటినే (* గుర్తుతో మొదలయ్యే వాక్యాలు) పరిగణలోకి తీసుకుంటారు. వ్యాక్యంలో ఉన్న మొదటి లింకు ఒక చెడిపోయిన బొమ్మకు లింకు అయ్యుండాలి. అదే వాక్యంలో ఈ లింకు తరువాత వచ్చే లింకులను పట్టించుకోదు, ఆ పేజీలలో బొమ్మలు సరిగ్గా చేర్చారని భావిస్తుంది.', # Metadata 'metadata' => 'మెటాడేటా', 'metadata-help' => 'ఈ ఫైలులో అదనపు సమాచారం ఉంది, బహుశా దీన్ని సృష్టించడానికి లేదా సాంఖ్యీకరించడానికి వాడిన డిజిటల్ కేమెరా లేదా స్కానర్ ఆ సమాచారాన్ని చేర్చివుంవచ్చు. ఈ ఫైలుని అసలు స్థితి నుండి మారిస్తే, కొన్ని వివరాలు ఆ మారిన ఫైలులో పూర్తిగా ప్రతిఫలించకపోవచ్చు.', 'metadata-expand' => 'విస్తరిత వివరాలను చూపించు', 'metadata-collapse' => 'విస్తరిత వివరాలను దాచు', 'metadata-fields' => 'కింది జాబితాలో ఉన్న మెటాడేటా ఫీల్డులు, బొమ్మ పేజీలో మేటాడేటా టేబులు మూసుకొన్నపుడు కనబడతాయి. మిగతావి దాచేసి ఉంటాయి. * make * model * datetimeoriginal * exposuretime * fnumber * isospeedratings * focallength * artist * copyright * imagedescription * gpslatitude * gpslongitude * gpsaltitude', # Exif tags 'exif-imagewidth' => 'వెడల్పు', 'exif-imagelength' => 'ఎత్తు', 'exif-bitspersample' => 'ఒక్కో కాంపొనెంటుకు బిట్లు', 'exif-compression' => 'కుదింపు పద్ధతి (కంప్రెషను స్కీము)', 'exif-photometricinterpretation' => 'పిక్సెళ్ళ అమరిక', 'exif-orientation' => 'దిశ', 'exif-samplesperpixel' => 'కాంపొనెంట్ల సంఖ్య', 'exif-planarconfiguration' => 'డాటా అమరిక', 'exif-ycbcrsubsampling' => 'Y, C ల ఉప నమూనా నిష్పత్తి', 'exif-ycbcrpositioning' => 'Y మరియు C స్థానాలు', 'exif-xresolution' => 'క్షితిజసమాంతర స్పష్టత', 'exif-yresolution' => 'లంబ స్పష్టత', 'exif-stripoffsets' => 'బొమ్మ డేటా ఉన్న స్థలం', 'exif-rowsperstrip' => 'ఒక్కో పట్టికి ఉన్న అడ్డువరుసలు', 'exif-stripbytecounts' => 'ఒక్కో కుదించిన పట్టీలో ఉన్న బైట్లు', 'exif-jpeginterchangeformat' => 'JPEG SOI కి ఆఫ్‌సెట్', 'exif-jpeginterchangeformatlength' => 'JPEG డాటా యొక్క బైట్లు', 'exif-whitepoint' => 'శ్వేతబిందు వర్ణోగ్రత (క్రొమాటిసిటీ)', 'exif-primarychromaticities' => 'ప్రైమారిటీల వర్ణోగ్రతలు', 'exif-ycbcrcoefficients' => 'వర్ణస్థల మార్పు మాత్రిక స్థానసూచికలు', 'exif-referenceblackwhite' => 'నలుపు మరియు తెలుపు సూచీ విలువల యొక్క జత', 'exif-datetime' => 'ఫైలు మార్చిన తేదీ మరియు సమయం', 'exif-imagedescription' => 'బొమ్మ శీర్షిక', 'exif-make' => 'కేమెరా తయారీదారు', 'exif-model' => 'కేమెరా మోడల్', 'exif-software' => 'ఉపయోగించిన సాఫ్ట్&zwnj;వేర్', 'exif-artist' => 'కృతికర్త', 'exif-copyright' => 'కాపీ హక్కుదారు', 'exif-exifversion' => 'ఎక్సిఫ్ వెర్షన్', 'exif-flashpixversion' => 'అనుమతించే Flashpix కూర్పు', 'exif-colorspace' => 'వర్ణస్థలం', 'exif-componentsconfiguration' => 'ప్రతీ అంగం యొక్క అర్థం', 'exif-compressedbitsperpixel' => 'బొమ్మ కుదింపు పద్ధతి', 'exif-pixelydimension' => 'బొమ్మ వెడల్పు', 'exif-pixelxdimension' => 'బొమ్మ ఎత్తు', 'exif-usercomment' => 'వాడుకరి వ్యాఖ్యలు', 'exif-relatedsoundfile' => 'సంబంధిత శబ్ద ఫైలు', 'exif-datetimeoriginal' => 'డేటా తయారైన తేదీ, సమయం', 'exif-datetimedigitized' => 'డిజిటైజు చేసిన తేదీ, సమయం', 'exif-subsectime' => 'తేదీసమయం ఉపక్షణాలు', 'exif-subsectimeoriginal' => 'DateTimeOriginal ఉపసెకండ్లు', 'exif-subsectimedigitized' => 'DateTimeDigitized ఉపసెకండ్లు', 'exif-exposuretime' => 'ఎక్స్పోజరు సమయం', 'exif-exposuretime-format' => '$1 క్షణ ($2)', 'exif-fnumber' => 'F సంఖ్య', 'exif-exposureprogram' => 'ఎక్స్పోజరు ప్రోగ్రాము', 'exif-spectralsensitivity' => 'వర్ణపట సున్నితత్వం', 'exif-isospeedratings' => 'ISO స్పీడు రేటింగు', 'exif-shutterspeedvalue' => 'APEX షట్టరు వేగం', 'exif-aperturevalue' => 'APEX ఎపర్చరు', 'exif-brightnessvalue' => 'APEX దీప్తి', 'exif-exposurebiasvalue' => 'ఎక్స్పోజరు బయాస్', 'exif-maxaperturevalue' => 'గరిష్ఠ లాండు ఎపర్చరు', 'exif-subjectdistance' => 'వస్తువు దూరం', 'exif-meteringmode' => 'మీటరింగు మోడ్', 'exif-lightsource' => 'కాంతి మూలం', 'exif-flash' => 'ఫ్లాష్', 'exif-focallength' => 'కటకపు నాభ్యంతరం', 'exif-subjectarea' => 'వస్తువు ప్రదేశం', 'exif-flashenergy' => 'ఫ్లాష్ శక్తి', 'exif-focalplanexresolution' => 'X నాభి తలపు స్పష్టత', 'exif-focalplaneyresolution' => 'Y నాభి తలపు స్పష్టత', 'exif-focalplaneresolutionunit' => 'నాభితలపు స్పష్టత కొలమానం', 'exif-subjectlocation' => 'వస్తువు యొక్క ప్రాంతం', 'exif-exposureindex' => 'ఎక్స్పోజరు సూచిక', 'exif-sensingmethod' => 'గ్రహించే పద్ధతి', 'exif-filesource' => 'ఫైలు మూలం', 'exif-scenetype' => 'దృశ్యపు రకం', 'exif-customrendered' => 'కస్టమ్ బొమ్మ ప్రాసెసింగు', 'exif-exposuremode' => 'ఎక్స్పోజరు పద్ధతి', 'exif-whitebalance' => 'తెలుపు సంతులనం', 'exif-digitalzoomratio' => 'డిజిటల్ జూమ్ నిష్పత్తి', 'exif-focallengthin35mmfilm' => '35 మి.మీ. ఫిల్ములో నాభ్యంతరం', 'exif-scenecapturetype' => 'దృశ్య సంగ్రహ పద్ధతి', 'exif-gaincontrol' => 'దృశ్య నియంత్రణ', 'exif-contrast' => 'కాంట్రాస్టు', 'exif-saturation' => 'సంతృప్తి', 'exif-sharpness' => 'పదును', 'exif-devicesettingdescription' => 'డివైసు సెట్టుంగుల వివరణ', 'exif-subjectdistancerange' => 'వస్తు దూరపు శ్రేణి', 'exif-imageuniqueid' => 'విలక్షణమైన బొమ్మ ఐడీ', 'exif-gpsversionid' => 'GPS ట్యాగు కూర్పు', 'exif-gpslatituderef' => 'ఉత్తర లేదా దక్షిణ అక్షాంశం', 'exif-gpslatitude' => 'అక్షాంశం', 'exif-gpslongituderef' => 'తూర్పు లేదా పశ్చిమ రేఖాంశం', 'exif-gpslongitude' => 'రేఖాంశం', 'exif-gpsaltituderef' => 'ఎత్తుకు మూలం', 'exif-gpsaltitude' => 'సముద్ర మట్టం', 'exif-gpstimestamp' => 'GPS సమయం (అణు గడియారం)', 'exif-gpssatellites' => 'కొలిచేందుకు వాడిన ఉపగ్రహాలు', 'exif-gpsstatus' => 'రిసీవర్ స్థితి', 'exif-gpsmeasuremode' => 'కొలత పద్ధతి', 'exif-gpsdop' => 'కొలత ఖచ్చితత్వం', 'exif-gpsspeedref' => 'వేగపు కొలమానం', 'exif-gpsspeed' => 'GPS రిసీవరు వేగం', 'exif-gpstrackref' => 'కదలిక దిశ కోసం మూలం', 'exif-gpstrack' => 'కదలిక యొక్క దిశ', 'exif-gpsimgdirectionref' => 'బొమ్మ దిశ కోసం మూలం', 'exif-gpsimgdirection' => 'బొమ్మ యొక్క దిశ', 'exif-gpsmapdatum' => 'వాడిన జియోడెటిక్ సర్వే డేటా', 'exif-gpsdestlatituderef' => 'గమ్యస్థాన రేఖాంశం కోసం మూలం', 'exif-gpsdestlatitude' => 'గమ్యస్థానం యొక్క అక్షాంశం', 'exif-gpsdestlongituderef' => 'గమ్యస్థాన అక్షాంశం కోసం మూలం', 'exif-gpsdestlongitude' => 'గమ్యస్థానం యొక్క రేఖాంశం', 'exif-gpsdestbearingref' => 'గమ్యస్థాన బేరింగు కోసం మూలం', 'exif-gpsdestbearing' => 'గమ్యస్థానం బేరింగు', 'exif-gpsdestdistanceref' => 'గమ్యస్థానానీ ఉన్న దూరం కోసం మూలం', 'exif-gpsdestdistance' => 'గమ్యస్థానానికి దూరం', 'exif-gpsprocessingmethod' => 'GPS ప్రాసెసింగు పద్ధతి పేరు', 'exif-gpsareainformation' => 'GPS ప్రదేశం యొక్క పేరు', 'exif-gpsdatestamp' => 'GPS తేదీ', 'exif-gpsdifferential' => 'GPS తేడా సవరణ', 'exif-jpegfilecomment' => 'JPEG బొమ్మ వ్యాఖ్య', 'exif-keywords' => 'కీలకపదాలు', 'exif-worldregioncreated' => 'ఫొటో తీసిన ప్రపంచపు ప్రాంతం', 'exif-countrycreated' => 'ఫొటో తీసిన దేశం', 'exif-countrycodecreated' => 'ఫొటో తీసిన దేశపు కోడ్', 'exif-provinceorstatecreated' => 'ఫొటో తీసిన రాష్ట్రం లేదా ప్రాంతీయ విభాగం', 'exif-citycreated' => 'ఫొటో తీసిన నగరం', 'exif-sublocationcreated' => 'ఫొటో తీసిన నగరపు విభాగం', 'exif-worldregiondest' => 'ప్రపంచపు ప్రాంతం చూపబడింది', 'exif-countrydest' => 'దేశం చూపబడింది', 'exif-countrycodedest' => 'దేశపు కోడ్ చూపబడింది', 'exif-provinceorstatedest' => 'రాష్ట్రం లేదా ప్రాంతీయ విభాగం చూపబడింది', 'exif-citydest' => 'నగరం చూపబడింది', 'exif-sublocationdest' => 'నగరపు విభాగం చూపబడింది', 'exif-objectname' => 'పొట్టి శీర్షిక', 'exif-specialinstructions' => 'ప్రత్యేక సూచనలు', 'exif-headline' => 'శీర్షిక', 'exif-credit' => 'క్రెడిట్/సమర్పించినవారు', 'exif-source' => 'మూలం', 'exif-editstatus' => 'బొమ్మ యొక్క ఎడిటోరియల్ స్థితి', 'exif-urgency' => 'ఎంత త్వరగా కావాలి', 'exif-locationdest' => 'చూపించిన ప్రాంతం', 'exif-objectcycle' => 'ఈ మాధ్యమం ఉద్దేశించిన సమయం', 'exif-contact' => 'సంప్రదింపు సమాచారం', 'exif-writer' => '', 'exif-languagecode' => 'భాష', 'exif-iimversion' => 'IIM రూపాంతరం', 'exif-iimcategory' => 'వర్గం', 'exif-iimsupplementalcategory' => 'అనుషంగిక వర్గాలు', 'exif-datetimeexpires' => 'దీని తరువాత వాడవద్దు', 'exif-datetimereleased' => 'విడుదల తేదీ', 'exif-identifier' => 'గుర్తింపకం', 'exif-lens' => 'వాడిన కటకం', 'exif-serialnumber' => 'కెమేరా యొక్క సీరియల్ నంబర్', 'exif-cameraownername' => 'కేమెరా యజమాని', 'exif-rating' => 'రేటింగు (5 కి గాను)', 'exif-rightscertificate' => 'హక్కుల నిర్వాహణ ధృవీకరణ పత్రం', 'exif-copyrighted' => 'కాపీహక్కుల స్థితి', 'exif-copyrightowner' => 'కాపీ హక్కుదారు', 'exif-usageterms' => 'వాడుక నియమాలు', 'exif-morepermissionsurl' => 'ప్రత్యామ్నాయ లైసెన్సు సమాచారం', 'exif-pngfilecomment' => 'PNG ఫైలు వ్యాఖ్య', 'exif-disclaimer' => 'నిష్పూచీ', 'exif-contentwarning' => 'విషయపు హెచ్చరిక', 'exif-giffilecomment' => 'GIF ఫైలు వ్యాఖ్య', 'exif-intellectualgenre' => 'అంశము యొక్క రకము', 'exif-subjectnewscode' => 'సబ్జెక్టు కోడ్', 'exif-event' => 'చూపించిన ఘటన', 'exif-organisationinimage' => 'చూపించిన సంస్థ', 'exif-personinimage' => 'చిత్రంలో ఉన్న వ్యక్తి', 'exif-originalimageheight' => 'కత్తిరించబడక ముందు బొమ్మ యొక్క ఎత్తు', 'exif-originalimagewidth' => 'కత్తిరించబడక ముందు బొమ్మ యొక్క వెడల్పు', # Exif attributes 'exif-compression-1' => 'కుదించని', 'exif-copyrighted-true' => 'నకలుహక్కులుకలది', 'exif-copyrighted-false' => 'కాపీహక్కుల స్థితి అమర్చలేదు', 'exif-unknowndate' => 'అజ్ఞాత తేదీ', 'exif-orientation-1' => 'సాధారణ', 'exif-orientation-2' => 'క్షితిజ సమాంతరంగా తిరగేసాం', 'exif-orientation-3' => '180° తిప్పాం', 'exif-orientation-4' => 'నిలువుగా తిరగేసాం', 'exif-orientation-5' => 'అపసవ్య దిశలో 90° తిప్పి, నిలువుగా తిరగేసాం', 'exif-orientation-6' => 'అపసవ్యదిశలో 90° తిప్పారు', 'exif-orientation-7' => 'సవ్యదిశలో 90° తిప్పి, నిలువుగా తిరగేసాం', 'exif-orientation-8' => 'సవ్యదిశలో 90° తిప్పారు', 'exif-planarconfiguration-1' => 'స్థూల ఆకృతి', 'exif-planarconfiguration-2' => 'సమతల ఆకృతి', 'exif-componentsconfiguration-0' => 'లేదు', 'exif-exposureprogram-0' => 'అనిర్వచితం', 'exif-exposureprogram-1' => 'చేతితో', 'exif-exposureprogram-2' => 'మామూలు ప్రోగ్రాము', 'exif-exposureprogram-3' => 'ఎపర్చరు ప్రాముఖ్యత', 'exif-exposureprogram-4' => 'షట్టరు ప్రాముఖ్యత', 'exif-exposureprogram-5' => 'సృజనాత్మక ప్రోగ్రాము (క్షేత్రపు లోతువైపు మొగ్గుతో)', 'exif-exposureprogram-6' => 'చర్య ప్రోగ్రాము (షట్టర్ వేగం వైపు మొగ్గుతో)', 'exif-exposureprogram-7' => 'పోర్ట్రైటు పద్ధతి (నేపథ్యం దృశ్యంలోకి రాకుండా క్లోజప్ ఫోటోలు)', 'exif-exposureprogram-8' => 'విస్తృత పద్ధతి (నేపథ్యం దృశ్యంలోకి వస్తూ ఉండే విస్తృత ఫోటోలు)', 'exif-subjectdistance-value' => '$1 మీటర్లు', 'exif-meteringmode-0' => 'అజ్ఞాతం', 'exif-meteringmode-1' => 'సగటు', 'exif-meteringmode-2' => 'CenterWeightedAverage', 'exif-meteringmode-3' => 'స్థలం', 'exif-meteringmode-4' => 'బహుళస్థలం', 'exif-meteringmode-5' => 'సరళి', 'exif-meteringmode-6' => 'పాక్షికం', 'exif-meteringmode-255' => 'ఇతర', 'exif-lightsource-0' => 'తెలియదు', 'exif-lightsource-1' => 'సూర్యకాంతి', 'exif-lightsource-2' => 'ఫ్లోరోసెంట్', 'exif-lightsource-3' => 'టంగ్‌స్టన్ (మామూలు బల్బు)', 'exif-lightsource-4' => 'ఫ్లాష్', 'exif-lightsource-9' => 'ఆహ్లాద వాతావరణం', 'exif-lightsource-10' => 'మేఘావృతం', 'exif-lightsource-11' => 'నీడ', 'exif-lightsource-12' => 'పగటి వెలుగు ఫ్లోరోసెంట్ (D 5700 – 7100K)', 'exif-lightsource-13' => 'పగటి తెలుపు ఫ్లోరోసెంట్ (N 4600 – 5400K)', 'exif-lightsource-14' => 'చల్లని తెలుపు ఫ్లోరోసెంట్ (W 3900 – 4500K)', 'exif-lightsource-15' => 'తెల్లని ఫ్లోరోసెంట్ (WW 3200 – 3700K)', 'exif-lightsource-17' => 'ప్రామాణిక కాంతి A', 'exif-lightsource-18' => 'ప్రామాణిక కాంతి B', 'exif-lightsource-19' => 'ప్రామాణిక కాంతి C', 'exif-lightsource-24' => 'ISO స్టూడియోలోని బల్బు వెలుతురు', 'exif-lightsource-255' => 'ఇతర కాంతి మూలం', # Flash modes 'exif-flash-fired-0' => 'ఫ్లాష్ వెలగలేదు', 'exif-flash-fired-1' => 'ఫ్లాష్ వెలిగింది', 'exif-flash-return-0' => 'స్ట్రోబ్ రిటర్న్ డిటెక్షన్ ఫంక్షను లేదు', 'exif-flash-return-2' => 'స్ట్రోబ్ రిటర్న్ లైటును కనుగొనలేదు', 'exif-flash-return-3' => 'స్ట్రోబ్ రిటర్న్ లైటు కనబడింది', 'exif-flash-mode-1' => 'తప్పనిసరిగా ఫ్లాష్ వెలుగుతుంది', 'exif-flash-mode-2' => 'తప్పనిసరిగా ఫ్లాష్ వెలగదు', 'exif-flash-mode-3' => 'ఆటో మోడ్', 'exif-flash-function-1' => 'ఫ్లాష్ ఫంక్షను లేదు', 'exif-flash-redeye-1' => 'ఎర్ర-కన్ను తగ్గింపు పద్ధతి', 'exif-focalplaneresolutionunit-2' => 'అంగుళాలు', 'exif-sensingmethod-1' => 'అనిర్వచితం', 'exif-sensingmethod-2' => 'ఒక-చిప్పున్న రంగును గుర్తించే సెన్సారు', 'exif-sensingmethod-3' => 'రెండు-చిప్పులున్న రంగును గుర్తించే సెన్సారు', 'exif-sensingmethod-4' => 'మూడు-చిప్పులున్న రంగును గుర్తించే సెన్సారు', 'exif-sensingmethod-5' => 'వర్ణ అనుక్రమ సీమ సెన్సర్', 'exif-sensingmethod-7' => 'త్రిసరళరేఖా సెన్సర్', 'exif-sensingmethod-8' => 'వర్ణ అనుక్రమ రేఖా సెన్సర్', 'exif-filesource-3' => 'సాంఖ్యీక సాధారణ కెమెరా', 'exif-scenetype-1' => 'ఎటువంటి హంగులూ లేకుండా ఫొటోతీయబడిన బొమ్మ', 'exif-customrendered-0' => 'సాధారణ ప్రక్రియ', 'exif-customrendered-1' => 'ప్రత్యేక ప్రక్రియ', 'exif-exposuremode-0' => 'ఆటోమాటిక్ ఎక్స్పోజరు', 'exif-exposuremode-1' => 'అమర్చిన ఎక్స్పోజరు', 'exif-exposuremode-2' => 'వెలుతురుబట్టి అంచలవారీగా మారింది', 'exif-whitebalance-0' => 'ఆటోమాటిక్ తెలుపు సంతులనం', 'exif-whitebalance-1' => 'అమర్చిన తెలుపు సంతులనం', 'exif-scenecapturetype-0' => 'ప్రామాణిక', 'exif-scenecapturetype-1' => 'ప్రకృతిదృశ్యం', 'exif-scenecapturetype-2' => 'వ్యక్తి చిత్రణ', 'exif-scenecapturetype-3' => 'రాత్రి దృశ్యం', 'exif-gaincontrol-0' => 'ఏదీ కాదు', 'exif-gaincontrol-1' => 'చిన్న గెయిన్ పెంపు', 'exif-gaincontrol-2' => 'పెద్ద గెయిన్ పెంపు', 'exif-gaincontrol-3' => 'చిన్న గెయిన్ తగ్గింపు', 'exif-gaincontrol-4' => 'పెద్ద గెయిన్ తగ్గింపు', 'exif-contrast-0' => 'సాధారణ', 'exif-contrast-1' => 'మృదువు', 'exif-contrast-2' => 'కఠినం', 'exif-saturation-0' => 'సాధారణ', 'exif-saturation-1' => 'రంగులు ముద్దలు ముద్దలుగా తయారవ్వలేదు', 'exif-saturation-2' => 'రంగులు ముద్దలు ముద్దలుగా తయారయ్యాయి', 'exif-sharpness-0' => 'సాధారణ', 'exif-sharpness-1' => 'మృదువు', 'exif-sharpness-2' => 'కఠినం', 'exif-subjectdistancerange-0' => 'అజ్ఞాతం', 'exif-subjectdistancerange-1' => 'మాక్రో', 'exif-subjectdistancerange-2' => 'దగ్గరి దృశ్యం', 'exif-subjectdistancerange-3' => 'దూరపు దృశ్యం', # Pseudotags used for GPSLatitudeRef and GPSDestLatitudeRef 'exif-gpslatitude-n' => 'ఉత్తర అక్షాంశం', 'exif-gpslatitude-s' => 'దక్షిణ అక్షాంశం', # Pseudotags used for GPSLongitudeRef and GPSDestLongitudeRef 'exif-gpslongitude-e' => 'తూర్పు రేఖాంశం', 'exif-gpslongitude-w' => 'పశ్చిమ రేఖాంశం', # Pseudotags used for GPSAltitudeRef 'exif-gpsaltitude-above-sealevel' => 'సముద్రమట్టానికి $1 {{PLURAL:$1|మీటరు|మీటర్లు}} ఎగువన', 'exif-gpsaltitude-below-sealevel' => 'సముద్రమట్టానికి $1 {{PLURAL:$1|మీటరు|మీటర్లు}} దిగువున', 'exif-gpsstatus-a' => 'కొలత జరుగుతూంది', 'exif-gpsstatus-v' => 'కొలత ఇంటర్‌ఆపరేటబిలిటీ', 'exif-gpsmeasuremode-2' => 'ద్వైమానిక కొలమానం', 'exif-gpsmeasuremode-3' => 'త్రిదిశాత్మక కొలమానం', # Pseudotags used for GPSSpeedRef 'exif-gpsspeed-k' => 'గంటకి కిలోమీటర్లు', 'exif-gpsspeed-m' => 'గంటకి మైళ్ళు', 'exif-gpsspeed-n' => 'ముడులు', # Pseudotags used for GPSDestDistanceRef 'exif-gpsdestdistance-k' => 'కిలోమీటర్లు', 'exif-gpsdestdistance-m' => 'మైళ్ళు', 'exif-gpsdestdistance-n' => 'నాటికల్ మైళ్ళు', 'exif-objectcycle-a' => 'ఉదయం మాత్రమే', 'exif-objectcycle-p' => 'సాయంత్రం మాత్రమే', 'exif-objectcycle-b' => 'ఉదయమూ మరియు సాయంత్రమూ', # Pseudotags used for GPSTrackRef, GPSImgDirectionRef and GPSDestBearingRef 'exif-gpsdirection-t' => 'వాస్తవ దిశ', 'exif-gpsdirection-m' => 'అయస్కాంత దిశ', 'exif-dc-contributor' => 'సహాయకులు', 'exif-dc-date' => 'తేదీ‍‍(లు)', 'exif-dc-publisher' => 'ప్రచురణకర్త', 'exif-dc-relation' => 'సంబంధిత మీడియా', 'exif-dc-rights' => 'హక్కులు', 'exif-dc-source' => 'మీడియా మూలము', 'exif-dc-type' => 'మీడియా యొక్క రకము', 'exif-rating-rejected' => 'తిరస్కరించబడింది', 'exif-isospeedratings-overflow' => '65535 కంటే ఎక్కువ', 'exif-iimcategory-ace' => 'కళలు, సంస్కృతి మరియు వినోదం', 'exif-iimcategory-clj' => 'నేరము మరియు చట్టము', 'exif-iimcategory-dis' => 'విపత్తులు మరియు ప్రమాదాలు', 'exif-iimcategory-fin' => 'ఆర్ధికం మరియు వ్యాపారం', 'exif-iimcategory-edu' => 'విద్య', 'exif-iimcategory-evn' => 'పర్యావరణం', 'exif-iimcategory-hth' => 'ఆరోగ్యం', 'exif-iimcategory-hum' => 'మానవీయ ఆసక్తి', 'exif-iimcategory-lab' => 'కృషి', 'exif-iimcategory-lif' => 'జీవనశైలి మరియు కాలక్షేపం', 'exif-iimcategory-pol' => 'రాజకీయాలు', 'exif-iimcategory-rel' => 'మతం మరియు విశ్వాసం', 'exif-iimcategory-sci' => 'వైజ్ఞానికం మరియు సాంకేతికం', 'exif-iimcategory-soi' => 'సాంఘిక సమస్యలు', 'exif-iimcategory-spo' => 'క్రీడలు', 'exif-iimcategory-war' => 'యుద్ధం, సంఘర్షణలు మరియు అనిశ్చితి', 'exif-iimcategory-wea' => 'వాతావరణం', 'exif-urgency-normal' => 'సాధారణం ($1)', 'exif-urgency-low' => 'తక్కువ ($1)', 'exif-urgency-high' => 'ఎక్కువ ($1)', 'exif-urgency-other' => 'వాడుకరి-నిర్వచిత ప్రాథాన్యత ($1)', # External editor support 'edit-externally' => 'బయటి అప్లికేషను వాడి ఈ ఫైలును మార్చు', 'edit-externally-help' => '(మరింత సమాచారం కొరకు [//www.mediawiki.org/wiki/Manual:External_editors సెటప్‌ సూచనల]ని చూడండి)', # 'all' in various places, this might be different for inflected languages 'watchlistall2' => 'అన్నీ', 'namespacesall' => 'అన్నీ', 'monthsall' => 'అన్నీ', 'limitall' => 'అన్నీ', # Email address confirmation 'confirmemail' => 'ఈ-మెయిలు చిరునామా ధృవీకరించండి', 'confirmemail_noemail' => '[[Special:Preferences|మీ అభిరుచులలో]] ఈమెయిలు అడ్రసు పెట్టి లేదు.', 'confirmemail_text' => '{{SITENAME}}లో ఈ-మెయిలు అంశాల్ని వాడుకునే ముందు మీ ఈ-మెయిలు చిరునామాను నిర్ధారించవలసిన అవసరం ఉంది. కింది మీటను నొక్కగానే మీరిచ్చిన చిరునామాకు ధృవీకరణ మెయిలు వెళ్తుంది. ఆ మెయిల్లో ఒక సంకేతం కలిగిన ఒక లింకు ఉంటుంది; ఆ లింకును మీ బ్రౌజరులో తెరవండి. ఈ-మెయిలు చిరునామా ధృవీకరణ అయిపోతుంది.', 'confirmemail_pending' => 'ఒక నిర్ధారణ కోడుని మీకు ఇప్పటికే ఈ-మెయిల్లో పంపించాం; కొద్దిసేపటి క్రితమే మీ ఖాతా సృష్టించి ఉంటే, కొత్త కొడు కోసం అభ్యర్థన పంపేముందు కొద్ది నిమిషాలు వేచిచూడండి.', 'confirmemail_send' => 'ఒక ధృవీకరణ సంకేతాన్ని పంపించు', 'confirmemail_sent' => 'ధృవీకరణ ఈ-మెయిలును పంపబడినది', 'confirmemail_oncreate' => 'మీ ఈ-మెయిలు చిరునామాకి ఒక ధృవీకరణ సంకేతాన్ని పంపించాం. లోనికి ప్రవేశించేందుకు ఆ సంకేతం అవసరంలేదు, కానీ ఈ వికీలో ఈ-మెయిలు ఆధారిత సౌలభ్యాలను చేతనం చేసేముందు దాన్ని ఇవ్వవలసి ఉంటుంది.', 'confirmemail_sendfailed' => '{{SITENAME}} మీ నిర్ధారణ మెయిలుని పంపలేకపోయింది. మీ ఈమెయిల్ చిరునామాలో తప్పులున్నాయేమో సరిచూసుకోండి. మెయిలరు ఇలా చెప్పింది: $1', 'confirmemail_invalid' => 'ధృవీకరణ సంకేతం సరైనది కాదు. దానికి కాలం చెల్లి ఉండవచ్చు.', 'confirmemail_needlogin' => 'మీ ఈమెయిలు చిరునామాని దృవపరచటానికి మీరు $1 ఉండాలి.', 'confirmemail_success' => 'మీ ఈ-మెయిలు చిరునామా ధృవీకరించబడింది. ఇక [[Special:UserLogin|లోనికి ప్రవేశించి]] వికీని అస్వాదించండి.', 'confirmemail_loggedin' => 'మీ ఈ-మెయిలు చిరునామా ఇప్పుడు రూఢి అయింది.', 'confirmemail_error' => 'మీ ధృవీకరణను భద్రపరచడంలో ఏదో లోపం జరిగింది.', 'confirmemail_subject' => '{{SITENAME}} ఈ-మెయిలు చిరునామా ధృవీకరణ', 'confirmemail_body' => '$1 ఐపీ చిరునామా నుండి ఎవరో, బహుశా మీరే, {{SITENAME}}లో "$2" అనే ఖాతాని ఈ ఈ-మెయిలు చిరునామాతో నమోదుచేసుకున్నారు. ఆ ఖాతా నిజంగా మీదే అని నిర్ధారించేందుకు మరియు {{SITENAME}}లో ఈ-మెయిలు సౌలభ్యాలని చేతనం చేసుకునేందుకు, ఈ లంకెని మీ విహారిణిలో తెరవండి: $3 ఒకవేళ ఆ ఖాతా మీది *కాకపోతే*, ఈ-మెయిలు చిరునామా నిర్ధారణని రద్దుచేసేందుకు ఈ లంకెని అనుసరించండి: $5 ఈ నిర్ధారణా సంకేతం $4కి కాలంచెల్లుతుంది.', 'confirmemail_body_changed' => '$1 ఐపీ చిరునామా నుండి ఎవరో, బహుశా మీరే, {{SITENAME}}లో "$2" అనే ఖాతా యొక్క ఈ-మెయిలు చిరునామాని ఈ చిరునామాకి మార్చారు. ఆ ఖాతా నిజంగా మీదే అని నిర్ధారించేందుకు మరియు {{SITENAME}}లో ఈ-మెయిలు సౌలభ్యాలని పునఃచేతనం చేసుకునేందుకు, ఈ లంకెని మీ విహారిణిలో తెరవండి: $3 ఒకవేళ ఆ ఖాతా మీది *కాకపోతే*, ఈ-మెయిలు చిరునామా నిర్ధారణని రద్దుచేసేందుకు ఈ లంకెని అనుసరించండి: $5 ఈ నిర్ధారణా సంకేతం $4కి కాలంచెల్లుతుంది.', 'confirmemail_invalidated' => 'ఈ-మెయిలు చిరునామా నిర్ధారణని రద్దుచేసాం', 'invalidateemail' => 'ఈ-మెయిలు నిర్ధారణని రద్దుచేయండి', # Scary transclusion 'scarytranscludedisabled' => '[ఇతరవికీల మూసలను ఇక్కడ వాడటాన్ని అనుమతించటం లేదు]', 'scarytranscludefailed' => '[$1 కొరకు మూసను తీసుకురావటం విఫలమైంది]', 'scarytranscludetoolong' => '[URL మరీ పొడుగ్గా ఉంది]', # Delete conflict 'deletedwhileediting' => "'''హెచ్చరిక''': మీరు మార్పులు చేయటం మొదలుపెట్టాక ఈ పేజీ తొలగించబడింది!", 'confirmrecreate' => "మీరు పేజీ రాయటం మొదలుపెట్టిన తరువాత [[User:$1|$1]] ([[User talk:$1|చర్చ]]) దానిని తీసివేసారు. దానికి ఈ కారణం ఇచ్చారు: ''$2'' మీరు ఈ పేజీని మళ్ళీ తయారు చేయాలనుకుంటున్నారని ధృవీకరించండి.", 'confirmrecreate-noreason' => 'మీరు మార్చడం మొదలుపెట్టిన తర్వాత ఈ పుటను వాడుకరి [[User:$1|$1]] ([[User talk:$1|చర్చ]]) తొలగించారు. ఈ పుటను మీరు నిజంగానే పునఃసృష్టించాలనుకుంటున్నారని నిర్ధారించండి.', 'recreate' => 'మళ్లీ సృష్టించు', # action=purge 'confirm_purge_button' => 'సరే', 'confirm-purge-top' => 'ఈ పేజీ యొక్క పాత కాపీని తొలగించమంటారా?', 'confirm-purge-bottom' => 'సత్వరనిల్వ(cache)లోపేజీ నిర్మూలించితే, ఇటీవలి కూర్పు కనబడుతుంది.', # action=watch/unwatch 'confirm-watch-button' => 'సరే', 'confirm-watch-top' => 'ఈ పుటను మీ వీక్షణ జాబితాలో చేర్చాలా?', 'confirm-unwatch-button' => 'సరే', 'confirm-unwatch-top' => 'ఈ పుటను మీ వీక్షణ జాబితా నుండి తొలగించాలా?', # Multipage image navigation 'imgmultipageprev' => '← మునుపటి పేజీ', 'imgmultipagenext' => 'తరువాతి పేజీ →', 'imgmultigo' => 'వెళ్ళు!', 'imgmultigoto' => '$1వ పేజీకి వెళ్ళు', # Table pager 'ascending_abbrev' => 'ఆరోహణ', 'descending_abbrev' => 'అవరోహణ', 'table_pager_next' => 'తరువాతి పేజీ', 'table_pager_prev' => 'ముందరి పేజీ', 'table_pager_first' => 'మొదటి పేజీ', 'table_pager_last' => 'చివరి పేజీ', 'table_pager_limit' => 'పేజీకి $1 అంశాలను చూపించు', 'table_pager_limit_label' => 'పేజీకి ఎన్ని అంశాలు:', 'table_pager_limit_submit' => 'వెళ్ళు', 'table_pager_empty' => 'ఫలితాలు లేవు', # Auto-summaries 'autosumm-blank' => 'పేజీలోని విషయాన్నంతటినీ తీసేసారు.', 'autosumm-replace' => "పేజీని '$1' తో మారుస్తున్నాం", 'autoredircomment' => '[[$1]]కు దారిమళ్ళించారు', 'autosumm-new' => "'$1' తో కొత్త పేజీని సృష్టించారు", # Live preview 'livepreview-loading' => 'లోడవుతోంది...', 'livepreview-ready' => 'లోడవుతోంది… సిద్ధం!', 'livepreview-failed' => 'టైపు చేస్తుండగా ప్రీవ్యూ సృష్టించడం కుదరలేదు! మామూలు ప్రీవ్యూను ప్రయత్నించండి.', 'livepreview-error' => 'అనుసంధానం కుదరలేదు: $1 "$2". మామూలు ప్రీవ్యూ ప్రయత్నించి చూడండి.', # Friendlier slave lag warnings 'lag-warn-normal' => '$1 {{PLURAL:$1|క్షణం|క్షణాల}} లోపు జరిగిన మార్పులు ఈ జాబితాలో కనిపించకపోవచ్చు.', 'lag-warn-high' => 'అధిక వత్తిడి వలన డేటాబేసు సర్వరు వెనుకబడింది, $1 {{PLURAL:$1|క్షణం|క్షణాల}} కంటే కొత్తవైన మార్పులు ఈ జాబితాలో కనిపించకపోవచ్చు.', # Watchlist editor 'watchlistedit-numitems' => 'మీ వీక్షణ జాబితాలో చర్చాపేజీలు కాకుండా {{PLURAL:$1|1 శీర్షిక|$1 శీర్షికలు}} ఉన్నాయి.', 'watchlistedit-noitems' => 'మీ వీక్షణ జాబితాలో శీర్షికలేమీ లేవు.', 'watchlistedit-normal-title' => 'వీక్షణ జాబితాను మార్చు', 'watchlistedit-normal-legend' => 'వీక్షణ జాబితా నుండి శీర్షికలను తీసివెయ్యి', 'watchlistedit-normal-explain' => 'మీ వీక్షణ జాబితాలోని శీర్షికలను ఈ క్రింద చూపించాం. ఏదైనా శీర్షికను తీసివేసేందుకు, దాని పక్కనున్న పెట్టెను చెక్ చేసి, "{{int:Watchlistedit-normal-submit}}"ని నొక్కండి. మీరు [[Special:EditWatchlist/raw|ముడి జాబితాను కూడా మార్చవచ్చు]].', 'watchlistedit-normal-submit' => 'శీర్షికలను తీసివెయ్యి', 'watchlistedit-normal-done' => 'మీ వీక్షణ జాబితా నుండి {{PLURAL:$1|1 శీర్షికను|$1 శీర్షికలను}} తీసివేసాం:', 'watchlistedit-raw-title' => 'ముడి వీక్షణ జాబితాను మార్చు', 'watchlistedit-raw-legend' => 'ముడి వీక్షణ జాబితాను మార్చు', 'watchlistedit-raw-explain' => 'మీ వీక్షణ జాబితాలోని శీర్షికలను ఈ కింద చూపించాం. ఈ జాబితాలో ఉన్నవాటిని తీసివెయ్యడం గానీ కొత్తవాటిని చేర్చడం గానీ (వరుసకొకటి చొప్పున) చెయ్యవచ్చు. పూర్తయ్యాక, "{{int:Watchlistedit-raw-submit}}" అన్న బొత్తాన్ని నొక్కండి. మీరు [[Special:EditWatchlist|మామూలు పాఠ్యకూర్పరిని కూడా వాడవచ్చు]].', 'watchlistedit-raw-titles' => 'శీర్షికలు:', 'watchlistedit-raw-submit' => 'వీక్షణ జాబితాను తాజాకరించు', 'watchlistedit-raw-done' => 'మీ వీక్షణ జాబితాను తాజాకరించాం.', 'watchlistedit-raw-added' => '{{PLURAL:$1|1 శీర్షికను|$1 శీర్షికలను}} చేర్చాం:', 'watchlistedit-raw-removed' => '{{PLURAL:$1|1 శీర్షికను|$1 శీర్షికలను}} తీసివేశాం:', # Watchlist editing tools 'watchlisttools-view' => 'సంబంధిత మార్పులను చూడండి', 'watchlisttools-edit' => 'వీక్షణ జాబితాను చూడండి లేదా మార్చండి', 'watchlisttools-raw' => 'ముడి వీక్షణ జాబితాలో మార్పులు చెయ్యి', # Signatures 'signature' => '[[{{ns:user}}:$1|$2]] ([[{{ns:user_talk}}:$1|చర్చ]])', # Core parser functions 'unknown_extension_tag' => '"$1" అనే ట్యాగు ఈ పొడిగింతకు తెలియదు', 'duplicate-defaultsort' => 'హెచ్చరిక: డిఫాల్టు పేర్చు కీ "$2", గత డిఫాల్టు పేర్చు కీ "$1" ని అతిక్రమిస్తుంది.', # Special:Version 'version' => 'సంచిక', 'version-extensions' => 'స్థాపించిన పొడగింతలు', 'version-specialpages' => 'ప్రత్యేక పేజీలు', 'version-parserhooks' => 'పార్సరు కొక్కాలు', 'version-variables' => 'చరరాశులు', 'version-antispam' => 'స్పాము నివారణ', 'version-skins' => 'అలంకారాలు', 'version-other' => 'ఇతర', 'version-mediahandlers' => 'మీడియాను ఫైళ్లను నడిపించే పొడిగింపులు', 'version-hooks' => 'కొక్కాలు', 'version-parser-extensiontags' => 'పార్సరు పొడిగింపు ట్యాగులు', 'version-parser-function-hooks' => 'పార్సరుకు కొక్కాలు', 'version-hook-name' => 'కొక్కెం పేరు', 'version-hook-subscribedby' => 'ఉపయోగిస్తున్నవి', 'version-version' => '(సంచిక $1)', 'version-license' => 'లైసెన్సు', 'version-poweredby-credits' => "ఈ వికీ '''[//www.mediawiki.org/ మీడియావికీ]'''చే శక్తిమంతం, కాపీహక్కులు © 2001-$1 $2.", 'version-poweredby-others' => 'ఇతరులు', 'version-license-info' => 'మీడియావికీ అన్నది స్వేచ్ఛా మృదూపకరణం; మీరు దీన్ని పునఃపంపిణీ చేయవచ్చు మరియు/లేదా ఫ్రీ సాఫ్ట్&zwnj;వేర్ ఫౌండేషన్ ప్రచురించిన గ్నూ జనరల్ పబ్లిక్ లైసెస్సు వెర్షను 2 లేదా (మీ ఎంపిక ప్రకారం) అంతకంటే కొత్త వెర్షను యొక్క నియమాలకు లోబడి మార్చుకోవచ్చు. మీడియావికీ ప్రజోపయోగ ఆకాంక్షతో పంపిణీ చేయబడుతుంది, కానీ ఎటువంటి వారంటీ లేకుండా; కనీసం ఏదైనా ప్రత్యేక ఉద్దేశానికి సరిపడుతుందని గానీ లేదా వస్తుత్వం యొక్క అంతర్నిహిత వారంటీ లేకుండా. మరిన్ని వివరాలకు గ్నూ జనరల్ పబ్లిక్ లైసెన్సుని చూడండి. ఈ ఉపకరణంతో పాటు మీకు [{{SERVER}}{{SCRIPTPATH}}/COPYING గ్నూ జనరల్ పబ్లిక్ లైసెన్సు యొక్క ఒక కాపీ] అందివుండాలి; లేకపోతే, Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA అన్న చిరునామాకి వ్రాయండి లేదా [//www.gnu.org/licenses/old-licenses/gpl-2.0.html జాలం లోనే చదవండి].', 'version-software' => 'స్థాపిత మృదూపకరణాలు', 'version-software-product' => 'ప్రోడక్టు', 'version-software-version' => 'వెర్షను', 'version-entrypoints' => 'ప్రవేశ బిందు చిరునామాలు', 'version-entrypoints-header-entrypoint' => 'ప్రవేశ బిందువు', 'version-entrypoints-header-url' => 'చిరునామా', # Special:Redirect 'redirect-submit' => 'వెళ్ళు', 'redirect-value' => 'విలువ:', 'redirect-user' => 'వాడుకరి ID', 'redirect-revision' => 'పేజీ కూర్పు', 'redirect-file' => 'దస్త్రపు పేరు', 'redirect-not-exists' => 'విలువ కనబడలేదు', # Special:FileDuplicateSearch 'fileduplicatesearch' => 'ఫైళ్ల మారుప్రతుల కోసం వెతుకు', 'fileduplicatesearch-summary' => 'మారుప్రతుల కోసం ఫైళ్ల హాష్ విలువ ఆధారంగా వెతుకు.', 'fileduplicatesearch-legend' => 'మారుప్రతి కొరకు వెతుకు', 'fileduplicatesearch-filename' => 'ఫైలు పేరు:', 'fileduplicatesearch-submit' => 'వెతుకు', 'fileduplicatesearch-info' => '$1 × $2 పిక్సెళ్లు<br />దస్త్రపు పరిమాణం: $3<br />MIME రకం: $4', 'fileduplicatesearch-result-1' => '"$1" అనే పేరుగల ఫైలుకు సరిసమానమైన మారుప్రతులు లేవు.', 'fileduplicatesearch-result-n' => '"$1" అనే పేరుగల ఫైలుకు {{PLURAL:$2|ఒక మారుప్రతి ఉంది|$2 మారుప్రతులున్నాయి}}.', 'fileduplicatesearch-noresults' => '"$1" అనే పేరుగల దస్త్రమేమీ కనబడలేదు.', # Special:SpecialPages 'specialpages' => 'ప్రత్యేక పేజీలు', 'specialpages-note' => '---- * మామూలు ప్రత్యేక పుటలు. * <strong class="mw-specialpagerestricted">నియంత్రిత ప్రత్యేక పుటలు.</strong> * <span class="mw-specialpagecached">Cached ప్రత్యేక పుటలు (పాతబడి ఉండొచ్చు).</span>', 'specialpages-group-maintenance' => 'నిర్వహణా నివేదికలు', 'specialpages-group-other' => 'ఇతర ప్రత్యేక పేజీలు', 'specialpages-group-login' => 'ప్రవేశించండి / ఖాతాను సృష్టించుకోండి', 'specialpages-group-changes' => 'ఇటీవలి మార్పులు మరియు దినచర్యలు', 'specialpages-group-media' => 'మాధ్యమ నివేదికలు మరియు ఎగుమతులు', 'specialpages-group-users' => 'వాడుకర్లు మరియు హక్కులు', 'specialpages-group-highuse' => 'అధిక వాడుక పేజీలు', 'specialpages-group-pages' => 'పేజీల యొక్క జాబితాలు', 'specialpages-group-pagetools' => 'పేజీ పనిముట్లు', 'specialpages-group-wiki' => 'డాటా మరియు పనిముట్లు', 'specialpages-group-redirects' => 'ప్రత్యేక పేజీల దారిమార్పులు', 'specialpages-group-spam' => 'స్పామ్ పనిముట్లు', # Special:BlankPage 'blankpage' => 'ఖాళీ పేజీ', 'intentionallyblankpage' => 'బెంచిమార్కింగు, మొదలగు వాటికై ఈ పేజీని కావాలనే ఖాళీగా వదిలాము.', # External image whitelist 'external_image_whitelist' => ' #ఈ లైనును ఎలా ఉన్నదో అలాగే వదిలెయ్యండి<pre> #regular expression తునకలను (// ల మధ్య ఉండే భాగం)కింద పెట్టండి #వీటిని బయటి బొమ్మల URLలతో సరిపోల్చుతాము #సరిపోలిన బొమ్మలను చూపిస్తాము, మిగిలినవాటి లింకులను మాత్రమే చూపిస్తాము ##తో మొదలయ్యే లైనులు వ్యాఖ్యానాలుగా భావించబడతాయి #ఇది కేస్-సెన్సిటివ్ #అన్ని తునకలను ఈ లైనుకు పైన ఉంచండి. ఈ లైనును ఎలా ఉన్నదో అలాగే వదిలెయ్యండి</pre>', # Special:Tags 'tags' => 'సరైన మార్పు ట్యాగులు', 'tag-filter' => '[[Special:Tags|ట్యాగుల]] వడపోత:', 'tag-filter-submit' => 'వడపోయి', 'tags-title' => 'టాగులు', 'tags-intro' => 'ఈ పేజీ మృదూపకరణం మార్పులకు ఇచ్చే ట్యాగులను, మరియు వాటి అర్ధాలను చూపిస్తుంది.', 'tags-tag' => 'ట్యాగు పేరు', 'tags-display-header' => 'మార్పుల జాబితాలో కనపించు రీతి', 'tags-description-header' => 'అర్థం యొక్క పూర్తి వివరణ', 'tags-hitcount-header' => 'ట్యాగులున్న మార్పులు', 'tags-edit' => 'మార్చు', 'tags-hitcount' => '$1 {{PLURAL:$1|మార్పు|మార్పులు}}', # Special:ComparePages 'comparepages' => 'పుటల పోలిక', 'compare-selector' => 'పుట కూర్పుల పోలిక', 'compare-page1' => 'పుట 1', 'compare-page2' => 'పుట 2', 'compare-rev1' => 'కూర్పు 1', 'compare-rev2' => 'కూర్పు 2', 'compare-submit' => 'పోల్చిచూడు', 'compare-invalid-title' => 'మీరు ఇచ్చిన శీర్షిక చెల్లనిది.', 'compare-title-not-exists' => 'మీరు పేర్కొన్న శీర్షిక లేనే లేదు.', 'compare-revision-not-exists' => 'మీరు పేర్కొన్న కూర్పు లేనే లేదు.', # Database error messages 'dberr-header' => 'ఈ వికీ సమస్యాత్మకంగా ఉంది', 'dberr-problems' => 'క్షమించండి! ఈ సైటు సాంకేతిక సమస్యలని ఎదుర్కొంటుంది.', 'dberr-again' => 'కొన్ని నిమిషాలాగి మళ్ళీ ప్రయత్నించండి.', 'dberr-info' => '(డాటాబేసు సర్వరుని సంధానించలేకున్నాం: $1)', 'dberr-usegoogle' => 'ఈలోపు మీరు గూగుల్ ద్వారా వెతకడానికి ప్రయత్నించండి.', 'dberr-outofdate' => 'మా విషయం యొక్క వారి సూచీలు అంత తాజావి కావపోవచ్చని గమనించండి.', 'dberr-cachederror' => 'అభ్యర్థించిన పేజీ యొక్క కోశం లోని కాపీ ఇది, అంత తాజాది కాకపోవచ్చు.', # HTML forms 'htmlform-invalid-input' => 'మీరు ఇచ్చినవాటితో కొన్ని సమస్యలున్నాయి', 'htmlform-select-badoption' => 'మీరిచ్చిన విలువ సరైన వికల్పం కాదు.', 'htmlform-int-invalid' => 'మీరు ఇచ్చిన విలువ పూర్ణసంఖ్య కాదు.', 'htmlform-float-invalid' => 'మీరిచ్చిన విలువ ఒక సంఖ్య కాదు.', 'htmlform-int-toolow' => 'మీరిచ్చిన విలువ $1 యొక్క కనిష్ఠ విలువ కంటే తక్కువగా ఉంది.', 'htmlform-int-toohigh' => 'మీరిచ్చిన విలువ $1 యొక్క గరిష్ఠ విలువకంటే ఎక్కవగా ఉంది.', 'htmlform-required' => 'ఈ విలువ తప్పనిసరి', 'htmlform-submit' => 'దాఖలుచెయ్యి', 'htmlform-reset' => 'మార్పులను రద్దుచెయ్యి', 'htmlform-selectorother-other' => 'ఇతర', 'htmlform-no' => 'కాదు', 'htmlform-yes' => 'అవును', # SQLite database support 'sqlite-has-fts' => '$1 పూర్తి-పాఠ్య అన్వేషణ తోడ్పాటుతో', 'sqlite-no-fts' => '$1 పూర్తి-పాఠ్య అన్వేషణ తోడ్పాటు లేకుండా', # New logging system 'logentry-delete-delete' => '$1 $3 పేజీని {{GENDER:$2|తొలగించారు}}', 'revdelete-content-hid' => 'కంటెంట్ దాచబడింది', 'revdelete-summary-hid' => 'మార్పుల సారాంశాన్ని దాచారు', 'revdelete-uname-hid' => 'వాడుకరి పేరుని దాచారు', 'revdelete-restricted' => 'నిర్వాహకులకు ఆంక్షలు విధించాను', 'revdelete-unrestricted' => 'నిర్వాహకులకున్న ఆంక్షలను ఎత్తేశాను', 'logentry-move-move' => '$1 $3 పేజీని $4కి తరలించారు', 'logentry-move-move-noredirect' => '$1 $3 పేజీని $4కి దారిమార్పు లేకుండా తరలించారు', 'logentry-move-move_redir' => '$1 $3 పేజీని $4కి దారిమార్పు ద్వారా తరలించారు', 'logentry-move-move_redir-noredirect' => '$1 $3 పేజీని $4కి దారిమార్పు లేకుండా తరలించారు', 'logentry-newusers-newusers' => '$1 వాడుకరి ఖాతాను సృష్టించారు', 'logentry-newusers-create' => '$1 ఒక వాడుకరి ఖాతాను సృష్టించారు', 'logentry-newusers-create2' => '$1 వాడుకరి ఖాతా $3ను సృష్టించారు', 'logentry-newusers-autocreate' => '$1 ఖాతాను ఆటోమెటిగ్గా సృష్టించారు', 'rightsnone' => '(ఏమీలేవు)', # Feedback 'feedback-subject' => 'విషయం:', 'feedback-message' => 'సందేశం:', 'feedback-cancel' => 'రద్దుచేయి', 'feedback-submit' => 'ప్రతిస్పందనను దాఖలుచేయి', 'feedback-error2' => 'దోషము: సవరణ విఫలమైంది', 'feedback-thanks' => 'కృతజ్ఞతలు! మీ ప్రతిస్పందనను “[$2 $1]” పేజీలో చేర్చాం.', 'feedback-close' => 'పూర్తయ్యింది', 'feedback-bugcheck' => 'అద్భుతం! ఇది ఇప్పటికే [$1 తెలిసిన బగ్గుల]లో లేదని సరిచూసుకోండి.', 'feedback-bugnew' => 'చూసాను. కొత్త బగ్గును నివేదించు', # Search suggestions 'searchsuggest-search' => 'వెతుకు', # API errors 'api-error-badaccess-groups' => 'ఈ వికీ లోనికి దస్త్రాలను ఎక్కించే అనుమతి మీకు లేదు.', 'api-error-duplicate-archive-popup-title' => 'నకిలీ {{PLURAL:$1|దస్త్రాన్ని|దస్త్రాలను}} ఇప్పటికే తొలగించారు.', 'api-error-duplicate-popup-title' => 'నకిలీ {{PLURAL:$1|దస్త్రం|దస్త్రాలు}}.', 'api-error-empty-file' => 'మీరు దాఖలుచేసిన ఫైల్ ఖాళీది.', 'api-error-emptypage' => 'కొత్త మరియు ఖాళీ పేజీలను సృష్టించడానికి అనుమతి లేదు.', 'api-error-file-too-large' => 'మీరు సమర్పించిన దస్త్రం చాలా పెద్దగా ఉంది.', 'api-error-filename-tooshort' => 'దస్త్రపు పేరు మరీ చిన్నగా ఉంది.', 'api-error-filetype-banned' => 'ఈ రకపు దస్త్రాలని నిషేధించారు.', 'api-error-filetype-banned-type' => '$1 {{PLURAL:$4|అనేది అనుమతించబడిన ఫైలు రకం కాదు|అనేవి అనుమతించబడిన ఫైలు రకాలు కాదు}}. అనుమతించబడిన {{PLURAL:$3|ఫైలు రకం|ఫైలు రకాలు}} $2.', 'api-error-http' => 'అంతర్గత దోషము: సేవకానికి అనుసంధానమవలేకపోతున్నది.', 'api-error-illegal-filename' => 'ఆ పైల్ పేరు అనుమతించబడదు.', 'api-error-invalid-file-key' => 'అంతర్గత దోషము: తాత్కాలిక నిల్వలో ఫైల్ కనపడలేదు.', 'api-error-mustbeloggedin' => 'దస్త్రాలను ఎక్కించడానికి మీరు ప్రవేశించివుండాలి.', 'api-error-nomodule' => 'అంతర్గత దోషము: ఎక్కింపు పర్వికము అమర్చబడలేదు.', 'api-error-ok-but-empty' => 'అంతర్గత దోషము: సేవకము నుండి ఎటువంటి స్పందనా లేదు.', 'api-error-stashfailed' => 'అంతర్గత పొరపాటు: తాత్కాలిక దస్త్రాన్ని భద్రపరచడంలో సేవకి విఫలమైంది.', 'api-error-unclassified' => 'ఒక తెలియని దోషము సంభవించినది', 'api-error-unknown-code' => 'తెలియని పొరపాటు: "$1".', 'api-error-unknown-error' => 'అంతర్గత పొరపాటు: మీ దస్త్రాన్ని ఎక్కించేప్పుడు ఏదో పొరపాటు జరిగింది.', 'api-error-unknown-warning' => 'తెలియని హెచ్చరిక: $1', 'api-error-unknownerror' => 'తెలియని పొరపాటు: "$1".', 'api-error-uploaddisabled' => 'ఈ వికీలో ఎక్కింపులని అచేతనం చేసారు.', 'api-error-verification-error' => 'ఈ ఫైల్ పాడైవుండవచ్చు, లేదా తప్పుడు పొడిగింతను కలిగివుండవచ్చు.', # Durations 'duration-seconds' => '$1 {{PLURAL:$1|క్షణం|క్షణాలు}}', 'duration-minutes' => '$1 {{PLURAL:$1|నిమిషం|నిమిషాలు}}', 'duration-hours' => '$1 {{PLURAL:$1|గంట|గంటలు}}', 'duration-days' => '$1 {{PLURAL:$1|రోజు|రోజులు}}', 'duration-weeks' => '$1 {{PLURAL: $1|వారం|వారాలు}}', 'duration-years' => '$1 {{PLURAL:$1|సంవత్సరం|సంవత్సరాలు}}', 'duration-decades' => '$1 {{PLURAL:$1|దశాబ్దం|దశాబ్దాలు}}', 'duration-centuries' => '$1 {{PLURAL:$1|శతాబ్దం|శతాబ్దాలు}}', 'duration-millennia' => '$1 {{PLURAL:$1|సహస్రాబ్దం|సహస్రాబ్దాలు}}', );
BRL-CAD/web
wiki/languages/messages/MessagesTe.php
PHP
bsd-2-clause
376,813
package cz.metacentrum.perun.webgui.json.authzResolver; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.json.client.JSONNumber; import com.google.gwt.json.client.JSONObject; import cz.metacentrum.perun.webgui.client.PerunWebSession; import cz.metacentrum.perun.webgui.client.UiElements; import cz.metacentrum.perun.webgui.client.resources.PerunEntity; import cz.metacentrum.perun.webgui.json.JsonCallbackEvents; import cz.metacentrum.perun.webgui.json.JsonPostClient; import cz.metacentrum.perun.webgui.model.*; /** * Ajax query which removes admin from VO / Group * * @author Pavel Zlamal <256627@mail.muni.cz> */ public class RemoveAdmin { // web session private PerunWebSession session = PerunWebSession.getInstance(); // URL to call final String VO_JSON_URL = "vosManager/removeAdmin"; final String GROUP_JSON_URL = "groupsManager/removeAdmin"; final String FACILITY_JSON_URL = "facilitiesManager/removeAdmin"; final String SECURITY_JSON_URL = "securityTeamsManager/removeAdmin"; // external events private JsonCallbackEvents events = new JsonCallbackEvents(); // ids private int userId = 0; private int entityId = 0; private PerunEntity entity; /** * Creates a new request * * @param entity VO/GROUP/FACILITY */ public RemoveAdmin(PerunEntity entity) { this.entity = entity; } /** * Creates a new request with custom events passed from tab or page * * @param entity VO/GROUP/FACILITY * @param events custom events */ public RemoveAdmin(PerunEntity entity, final JsonCallbackEvents events) { this.entity = entity; this.events = events; } /** * Attempts to remove admin from Group, it first tests the values and then submits them. * * @param group where we want to remove admin * @param user User to be removed from admin */ public void removeGroupAdmin(final Group group, final User user) { this.userId = (user != null) ? user.getId() : 0; this.entityId = (group != null) ? group.getId() : 0; this.entity = PerunEntity.GROUP; // test arguments if(!this.testRemoving()){ return; } // new events JsonCallbackEvents newEvents = new JsonCallbackEvents(){ public void onError(PerunError error) { session.getUiElements().setLogErrorText("Removing "+user.getFullName()+" from managers failed."); events.onError(error); // custom events }; public void onFinished(JavaScriptObject jso) { session.getUiElements().setLogSuccessText("User " + user.getFullName()+ " removed from managers of "+group.getName()); events.onFinished(jso); }; public void onLoadingStart() { events.onLoadingStart(); }; }; // sending data JsonPostClient jspc = new JsonPostClient(newEvents); jspc.sendData(GROUP_JSON_URL, prepareJSONObject()); } /** * Attempts to remove admin from VO, it first tests the values and then submits them. * * @param vo where we want to remove admin from * @param user User to be removed from admins */ public void removeVoAdmin(final VirtualOrganization vo, final User user) { this.userId = (user != null) ? user.getId() : 0; this.entityId = (vo != null) ? vo.getId() : 0; this.entity = PerunEntity.VIRTUAL_ORGANIZATION; // test arguments if(!this.testRemoving()){ return; } // new events JsonCallbackEvents newEvents = new JsonCallbackEvents(){ public void onError(PerunError error) { session.getUiElements().setLogErrorText("Removing "+user.getFullName()+" from managers failed."); events.onError(error); // custom events }; public void onFinished(JavaScriptObject jso) { session.getUiElements().setLogSuccessText("User " + user.getFullName()+ " removed from managers of "+vo.getName()); events.onFinished(jso); }; public void onLoadingStart() { events.onLoadingStart(); }; }; // sending data JsonPostClient jspc = new JsonPostClient(newEvents); jspc.sendData(VO_JSON_URL, prepareJSONObject()); } /** * Attempts to remove admin from Facility, it first tests the values and then submits them. * * @param facility where we want to remove admin from * @param user User to be removed from admins */ public void removeFacilityAdmin(final Facility facility, final User user) { this.userId = (user != null) ? user.getId() : 0; this.entityId = (facility != null) ? facility.getId() : 0; this.entity = PerunEntity.FACILITY; // test arguments if(!this.testRemoving()){ return; } // new events JsonCallbackEvents newEvents = new JsonCallbackEvents(){ public void onError(PerunError error) { session.getUiElements().setLogErrorText("Removing "+user.getFullName()+" from managers failed."); events.onError(error); // custom events }; public void onFinished(JavaScriptObject jso) { session.getUiElements().setLogSuccessText("User " + user.getFullName()+ " removed form managers of "+facility.getName()); events.onFinished(jso); }; public void onLoadingStart() { events.onLoadingStart(); }; }; // sending data JsonPostClient jspc = new JsonPostClient(newEvents); jspc.sendData(FACILITY_JSON_URL, prepareJSONObject()); } /** * Attempts to remove admin from SecurityTeam, it first tests the values and then submits them. * * @param securityTeam where we want to remove admin from * @param user User to be removed from admins */ public void removeSecurityTeamAdmin(final SecurityTeam securityTeam, final User user) { this.userId = (user != null) ? user.getId() : 0; this.entityId = (securityTeam != null) ? securityTeam.getId() : 0; this.entity = PerunEntity.SECURITY_TEAM; // test arguments if(!this.testRemoving()){ return; } // new events JsonCallbackEvents newEvents = new JsonCallbackEvents(){ public void onError(PerunError error) { session.getUiElements().setLogErrorText("Removing "+user.getFullName()+" from managers failed."); events.onError(error); // custom events }; public void onFinished(JavaScriptObject jso) { session.getUiElements().setLogSuccessText("User " + user.getFullName()+ " removed form managers of "+securityTeam.getName()); events.onFinished(jso); }; public void onLoadingStart() { events.onLoadingStart(); }; }; // sending data JsonPostClient jspc = new JsonPostClient(newEvents); jspc.sendData(SECURITY_JSON_URL, prepareJSONObject()); } /** * Attempts to remove admin group from Group, it first tests the values and then submits them. * * @param groupToAddAdminTo where we want to remove admin group from * @param group Group to be removed from admins */ public void removeGroupAdminGroup(final Group groupToAddAdminTo,final Group group) { // store group id to user id to used unified check method this.userId = (group != null) ? group.getId() : 0; this.entityId = (groupToAddAdminTo != null) ? groupToAddAdminTo.getId() : 0; this.entity = PerunEntity.GROUP; // test arguments if(!this.testRemoving()){ return; } // new events JsonCallbackEvents newEvents = new JsonCallbackEvents(){ public void onError(PerunError error) { session.getUiElements().setLogErrorText("Removing group "+group.getShortName()+" from managers failed."); events.onError(error); // custom events }; public void onFinished(JavaScriptObject jso) { session.getUiElements().setLogSuccessText("Group " + group.getShortName()+ " removed from managers of "+groupToAddAdminTo.getName()); events.onFinished(jso); }; public void onLoadingStart() { events.onLoadingStart(); }; }; // sending data JsonPostClient jspc = new JsonPostClient(newEvents); jspc.sendData(GROUP_JSON_URL, prepareJSONObjectForGroup()); } /** * Attempts to remove admin group from VO, it first tests the values and then submits them. * * @param vo where we want to remove admin from * @param group Group to be removed from admins */ public void removeVoAdminGroup(final VirtualOrganization vo,final Group group) { // store group id to user id to used unified check method this.userId = (group != null) ? group.getId() : 0; this.entityId = (vo != null) ? vo.getId() : 0; this.entity = PerunEntity.VIRTUAL_ORGANIZATION; // test arguments if(!this.testRemoving()){ return; } // new events JsonCallbackEvents newEvents = new JsonCallbackEvents(){ public void onError(PerunError error) { session.getUiElements().setLogErrorText("Removing group "+group.getShortName()+" from managers failed."); events.onError(error); // custom events }; public void onFinished(JavaScriptObject jso) { session.getUiElements().setLogSuccessText("Group " + group.getShortName()+ " removed from managers of "+vo.getName()); events.onFinished(jso); }; public void onLoadingStart() { events.onLoadingStart(); }; }; // sending data JsonPostClient jspc = new JsonPostClient(newEvents); jspc.sendData(VO_JSON_URL, prepareJSONObjectForGroup()); } /** * Attempts to remove admin group from Facility, it first tests the values and then submits them. * * @param facility where we want to remove admin from * @param group Group to be removed from admins */ public void removeFacilityAdminGroup(final Facility facility,final Group group) { // store group id to user id to used unified check method this.userId = (group != null) ? group.getId() : 0; this.entityId = (facility != null) ? facility.getId() : 0; this.entity = PerunEntity.FACILITY; // test arguments if(!this.testRemoving()){ return; } // new events JsonCallbackEvents newEvents = new JsonCallbackEvents(){ public void onError(PerunError error) { session.getUiElements().setLogErrorText("Removing group "+group.getShortName()+" from managers failed."); events.onError(error); // custom events }; public void onFinished(JavaScriptObject jso) { session.getUiElements().setLogSuccessText("Group " + group.getShortName()+ " removed from managers of "+facility.getName()); events.onFinished(jso); }; public void onLoadingStart() { events.onLoadingStart(); }; }; // sending data JsonPostClient jspc = new JsonPostClient(newEvents); jspc.sendData(FACILITY_JSON_URL, prepareJSONObjectForGroup()); } /** * Attempts to remove admin group from SecurityTeam, it first tests the values and then submits them. * * @param securityTeam where we want to remove admin from * @param group Group to be removed from admins */ public void removeSecurityTeamAdminGroup(final SecurityTeam securityTeam, final Group group) { // store group id to user id to used unified check method this.userId = (group != null) ? group.getId() : 0; this.entityId = (securityTeam != null) ? securityTeam.getId() : 0; this.entity = PerunEntity.SECURITY_TEAM; // test arguments if(!this.testRemoving()){ return; } // new events JsonCallbackEvents newEvents = new JsonCallbackEvents(){ public void onError(PerunError error) { session.getUiElements().setLogErrorText("Removing group "+group.getShortName()+" from managers failed."); events.onError(error); // custom events }; public void onFinished(JavaScriptObject jso) { session.getUiElements().setLogSuccessText("Group " + group.getShortName()+ " removed from managers of "+securityTeam.getName()); events.onFinished(jso); }; public void onLoadingStart() { events.onLoadingStart(); }; }; // sending data JsonPostClient jspc = new JsonPostClient(newEvents); jspc.sendData(SECURITY_JSON_URL, prepareJSONObjectForGroup()); } /** * Tests the values, if the process can continue * * @return true/false for continue/stop */ private boolean testRemoving() { boolean result = true; String errorMsg = ""; if(entityId == 0){ errorMsg += "Wrong parameter <strong>Entity ID</strong>.<br/>"; result = false; } if(userId == 0){ errorMsg += "Wrong parameter <strong>User ID</strong>."; result = false; } if(errorMsg.length()>0){ UiElements.generateAlert("Parameter error", errorMsg); } return result; } /** * Prepares a JSON object * * @return JSONObject the whole query */ private JSONObject prepareJSONObject() { // whole JSON query JSONObject jsonQuery = new JSONObject(); if (entity.equals(PerunEntity.VIRTUAL_ORGANIZATION)) { jsonQuery.put("vo", new JSONNumber(entityId)); } else if (entity.equals(PerunEntity.GROUP)) { jsonQuery.put("group", new JSONNumber(entityId)); } else if (entity.equals(PerunEntity.FACILITY)) { jsonQuery.put("facility", new JSONNumber(entityId)); } else if (entity.equals(PerunEntity.SECURITY_TEAM)) { jsonQuery.put("securityTeam", new JSONNumber(entityId)); } jsonQuery.put("user", new JSONNumber(userId)); return jsonQuery; } /** * Prepares a JSON object * * @return JSONObject the whole query */ private JSONObject prepareJSONObjectForGroup() { // whole JSON query JSONObject jsonQuery = new JSONObject(); if (entity.equals(PerunEntity.VIRTUAL_ORGANIZATION)) { jsonQuery.put("vo", new JSONNumber(entityId)); } else if (entity.equals(PerunEntity.GROUP)) { jsonQuery.put("group", new JSONNumber(entityId)); } else if (entity.equals(PerunEntity.FACILITY)) { jsonQuery.put("facility", new JSONNumber(entityId)); } else if (entity.equals(PerunEntity.SECURITY_TEAM)) { jsonQuery.put("securityTeam", new JSONNumber(entityId)); } jsonQuery.put("authorizedGroup", new JSONNumber(userId)); return jsonQuery; } }
zlamalp/perun
perun-web-gui/src/main/java/cz/metacentrum/perun/webgui/json/authzResolver/RemoveAdmin.java
Java
bsd-2-clause
13,511
/* * kmp_debug.cpp -- debug utilities for the Guide library */ //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "kmp.h" #include "kmp_debug.h" /* really necessary? */ #include "kmp_i18n.h" #include "kmp_io.h" #ifdef KMP_DEBUG void __kmp_debug_printf_stdout(char const *format, ...) { va_list ap; va_start(ap, format); __kmp_vprintf(kmp_out, format, ap); va_end(ap); } #endif void __kmp_debug_printf(char const *format, ...) { va_list ap; va_start(ap, format); __kmp_vprintf(kmp_err, format, ap); va_end(ap); } #ifdef KMP_USE_ASSERT int __kmp_debug_assert(char const *msg, char const *file, int line) { if (file == NULL) { file = KMP_I18N_STR(UnknownFile); } else { // Remove directories from path, leave only file name. File name is enough, // there is no need in bothering developers and customers with full paths. char const *slash = strrchr(file, '/'); if (slash != NULL) { file = slash + 1; } } #ifdef KMP_DEBUG __kmp_acquire_bootstrap_lock(&__kmp_stdio_lock); __kmp_debug_printf("Assertion failure at %s(%d): %s.\n", file, line, msg); __kmp_release_bootstrap_lock(&__kmp_stdio_lock); #ifdef USE_ASSERT_BREAK #if KMP_OS_WINDOWS DebugBreak(); #endif #endif // USE_ASSERT_BREAK #ifdef USE_ASSERT_STALL /* __kmp_infinite_loop(); */ for (;;) ; #endif // USE_ASSERT_STALL #ifdef USE_ASSERT_SEG { int volatile *ZERO = (int *)0; ++(*ZERO); } #endif // USE_ASSERT_SEG #endif __kmp_fatal(KMP_MSG(AssertionFailure, file, line), KMP_HNT(SubmitBugReport), __kmp_msg_null); return 0; } // __kmp_debug_assert #endif // KMP_USE_ASSERT /* Dump debugging buffer to stderr */ void __kmp_dump_debug_buffer(void) { if (__kmp_debug_buffer != NULL) { int i; int dc = __kmp_debug_count; char *db = &__kmp_debug_buffer[(dc % __kmp_debug_buf_lines) * __kmp_debug_buf_chars]; char *db_end = &__kmp_debug_buffer[__kmp_debug_buf_lines * __kmp_debug_buf_chars]; char *db2; __kmp_acquire_bootstrap_lock(&__kmp_stdio_lock); __kmp_printf_no_lock("\nStart dump of debugging buffer (entry=%d):\n", dc % __kmp_debug_buf_lines); for (i = 0; i < __kmp_debug_buf_lines; i++) { if (*db != '\0') { /* Fix up where no carriage return before string termination char */ for (db2 = db + 1; db2 < db + __kmp_debug_buf_chars - 1; db2++) { if (*db2 == '\0') { if (*(db2 - 1) != '\n') { *db2 = '\n'; *(db2 + 1) = '\0'; } break; } } /* Handle case at end by shortening the printed message by one char if * necessary */ if (db2 == db + __kmp_debug_buf_chars - 1 && *db2 == '\0' && *(db2 - 1) != '\n') { *(db2 - 1) = '\n'; } __kmp_printf_no_lock("%4d: %.*s", i, __kmp_debug_buf_chars, db); *db = '\0'; /* only let it print once! */ } db += __kmp_debug_buf_chars; if (db >= db_end) db = __kmp_debug_buffer; } __kmp_printf_no_lock("End dump of debugging buffer (entry=%d).\n\n", (dc + i - 1) % __kmp_debug_buf_lines); __kmp_release_bootstrap_lock(&__kmp_stdio_lock); } }
endlessm/chromium-browser
third_party/llvm/openmp/runtime/src/kmp_debug.cpp
C++
bsd-3-clause
3,628
# Copyright (c) 2006-2010 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """try to find more bugs in the code using astng inference capabilities """ import re import shlex from logilab import astng from logilab.astng import InferenceError, NotFoundError, YES, Instance from pylint.interfaces import IASTNGChecker from pylint.checkers import BaseChecker from pylint.checkers.utils import safe_infer, is_super, check_messages MSGS = { 'E1101': ('%s %r has no %r member', 'Used when a variable is accessed for an unexistent member.'), 'E1102': ('%s is not callable', 'Used when an object being called has been inferred to a non \ callable object'), 'E1103': ('%s %r has no %r member (but some types could not be inferred)', 'Used when a variable is accessed for an unexistent member, but \ astng was not able to interpret all possible types of this \ variable.'), 'E1111': ('Assigning to function call which doesn\'t return', 'Used when an assignment is done on a function call but the \ inferred function doesn\'t return anything.'), 'W1111': ('Assigning to function call which only returns None', 'Used when an assignment is done on a function call but the \ inferred function returns nothing but None.'), 'E1120': ('No value passed for parameter %s in function call', 'Used when a function call passes too few arguments.'), 'E1121': ('Too many positional arguments for function call', 'Used when a function call passes too many positional \ arguments.'), 'E1122': ('Duplicate keyword argument %r in function call', 'Used when a function call passes the same keyword argument \ multiple times.'), 'E1123': ('Passing unexpected keyword argument %r in function call', 'Used when a function call passes a keyword argument that \ doesn\'t correspond to one of the function\'s parameter names.'), 'E1124': ('Multiple values passed for parameter %r in function call', 'Used when a function call would result in assigning multiple \ values to a function parameter, one value from a positional \ argument and one from a keyword argument.'), } class TypeChecker(BaseChecker): """try to find bugs in the code using type inference """ __implements__ = (IASTNGChecker,) # configuration section name name = 'typecheck' # messages msgs = MSGS priority = -1 # configuration options options = (('ignore-mixin-members', {'default' : True, 'type' : 'yn', 'metavar': '<y_or_n>', 'help' : 'Tells whether missing members accessed in mixin \ class should be ignored. A mixin class is detected if its name ends with \ "mixin" (case insensitive).'} ), ('ignored-classes', {'default' : ('SQLObject',), 'type' : 'csv', 'metavar' : '<members names>', 'help' : 'List of classes names for which member attributes \ should not be checked (useful for classes with attributes dynamically set).'} ), ('zope', {'default' : False, 'type' : 'yn', 'metavar': '<y_or_n>', 'help' : 'When zope mode is activated, add a predefined set \ of Zope acquired attributes to generated-members.'} ), ('generated-members', {'default' : ( 'REQUEST', 'acl_users', 'aq_parent'), 'type' : 'string', 'metavar' : '<members names>', 'help' : 'List of members which are set dynamically and \ missed by pylint inference system, and so shouldn\'t trigger E0201 when \ accessed. Python regular expressions are accepted.'} ), ) def open(self): # do this in open since config not fully initialized in __init__ self.generated_members = list(self.config.generated_members) if self.config.zope: self.generated_members.extend(('REQUEST', 'acl_users', 'aq_parent')) def visit_assattr(self, node): if isinstance(node.ass_type(), astng.AugAssign): self.visit_getattr(node) def visit_delattr(self, node): self.visit_getattr(node) @check_messages('E1101', 'E1103') def visit_getattr(self, node): """check that the accessed attribute exists to avoid to much false positives for now, we'll consider the code as correct if a single of the inferred nodes has the accessed attribute. function/method, super call and metaclasses are ignored """ # generated_members may containt regular expressions # (surrounded by quote `"` and followed by a comma `,`) # REQUEST,aq_parent,"[a-zA-Z]+_set{1,2}"' => # ('REQUEST', 'aq_parent', '[a-zA-Z]+_set{1,2}') if isinstance(self.config.generated_members, str): gen = shlex.shlex(self.config.generated_members) gen.whitespace += ',' self.config.generated_members = tuple(tok.strip('"') for tok in gen) for pattern in self.config.generated_members: # attribute is marked as generated, stop here if re.match(pattern, node.attrname): return try: infered = list(node.expr.infer()) except InferenceError: return # list of (node, nodename) which are missing the attribute missingattr = set() ignoremim = self.config.ignore_mixin_members inference_failure = False for owner in infered: # skip yes object if owner is YES: inference_failure = True continue # skip None anyway if isinstance(owner, astng.Const) and owner.value is None: continue # XXX "super" / metaclass call if is_super(owner) or getattr(owner, 'type', None) == 'metaclass': continue name = getattr(owner, 'name', 'None') if name in self.config.ignored_classes: continue if ignoremim and name[-5:].lower() == 'mixin': continue try: if not [n for n in owner.getattr(node.attrname) if not isinstance(n.statement(), astng.AugAssign)]: missingattr.add((owner, name)) continue except AttributeError: # XXX method / function continue except NotFoundError: if isinstance(owner, astng.Function) and owner.decorators: continue if isinstance(owner, Instance) and owner.has_dynamic_getattr(): continue # explicit skipping of optparse'Values class if owner.name == 'Values' and owner.root().name == 'optparse': continue missingattr.add((owner, name)) continue # stop on the first found break else: # we have not found any node with the attributes, display the # message for infered nodes done = set() for owner, name in missingattr: if isinstance(owner, Instance): actual = owner._proxied else: actual = owner if actual in done: continue done.add(actual) if inference_failure: msgid = 'E1103' else: msgid = 'E1101' self.add_message(msgid, node=node, args=(owner.display_type(), name, node.attrname)) def visit_assign(self, node): """check that if assigning to a function call, the function is possibly returning something valuable """ if not isinstance(node.value, astng.CallFunc): return function_node = safe_infer(node.value.func) # skip class, generator and incomplete function definition if not (isinstance(function_node, astng.Function) and function_node.root().fully_defined()): return if function_node.is_generator() \ or function_node.is_abstract(pass_is_abstract=False): return returns = list(function_node.nodes_of_class(astng.Return, skip_klass=astng.Function)) if len(returns) == 0: self.add_message('E1111', node=node) else: for rnode in returns: if not (isinstance(rnode.value, astng.Const) and rnode.value.value is None): break else: self.add_message('W1111', node=node) def visit_callfunc(self, node): """check that called functions/methods are inferred to callable objects, and that the arguments passed to the function match the parameters in the inferred function's definition """ # Build the set of keyword arguments, checking for duplicate keywords, # and count the positional arguments. keyword_args = set() num_positional_args = 0 for arg in node.args: if isinstance(arg, astng.Keyword): keyword = arg.arg if keyword in keyword_args: self.add_message('E1122', node=node, args=keyword) keyword_args.add(keyword) else: num_positional_args += 1 called = safe_infer(node.func) # only function, generator and object defining __call__ are allowed if called is not None and not called.callable(): self.add_message('E1102', node=node, args=node.func.as_string()) # Note that BoundMethod is a subclass of UnboundMethod (huh?), so must # come first in this 'if..else'. if isinstance(called, astng.BoundMethod): # Bound methods have an extra implicit 'self' argument. num_positional_args += 1 elif isinstance(called, astng.UnboundMethod): if called.decorators is not None: for d in called.decorators.nodes: if isinstance(d, astng.Name) and (d.name == 'classmethod'): # Class methods have an extra implicit 'cls' argument. num_positional_args += 1 break elif (isinstance(called, astng.Function) or isinstance(called, astng.Lambda)): pass else: return if called.args.args is None: # Built-in functions have no argument information. return if len( called.argnames() ) != len( set( called.argnames() ) ): # Duplicate parameter name (see E9801). We can't really make sense # of the function call in this case, so just return. return # Analyze the list of formal parameters. num_mandatory_parameters = len(called.args.args) - len(called.args.defaults) parameters = [] parameter_name_to_index = {} for i, arg in enumerate(called.args.args): if isinstance(arg, astng.Tuple): name = None # Don't store any parameter names within the tuple, since those # are not assignable from keyword arguments. else: if isinstance(arg, astng.Keyword): name = arg.arg else: assert isinstance(arg, astng.AssName) # This occurs with: # def f( (a), (b) ): pass name = arg.name parameter_name_to_index[name] = i if i >= num_mandatory_parameters: defval = called.args.defaults[i - num_mandatory_parameters] else: defval = None parameters.append([(name, defval), False]) # Match the supplied arguments against the function parameters. # 1. Match the positional arguments. for i in range(num_positional_args): if i < len(parameters): parameters[i][1] = True elif called.args.vararg is not None: # The remaining positional arguments get assigned to the *args # parameter. break else: # Too many positional arguments. self.add_message('E1121', node=node) break # 2. Match the keyword arguments. for keyword in keyword_args: if keyword in parameter_name_to_index: i = parameter_name_to_index[keyword] if parameters[i][1]: # Duplicate definition of function parameter. self.add_message('E1124', node=node, args=keyword) else: parameters[i][1] = True elif called.args.kwarg is not None: # The keyword argument gets assigned to the **kwargs parameter. pass else: # Unexpected keyword argument. self.add_message('E1123', node=node, args=keyword) # 3. Match the *args, if any. Note that Python actually processes # *args _before_ any keyword arguments, but we wait until after # looking at the keyword arguments so as to make a more conservative # guess at how many values are in the *args sequence. if node.starargs is not None: for i in range(num_positional_args, len(parameters)): [(name, defval), assigned] = parameters[i] # Assume that *args provides just enough values for all # non-default parameters after the last parameter assigned by # the positional arguments but before the first parameter # assigned by the keyword arguments. This is the best we can # get without generating any false positives. if (defval is not None) or assigned: break parameters[i][1] = True # 4. Match the **kwargs, if any. if node.kwargs is not None: for i, [(name, defval), assigned] in enumerate(parameters): # Assume that *kwargs provides values for all remaining # unassigned named parameters. if name is not None: parameters[i][1] = True else: # **kwargs can't assign to tuples. pass # Check that any parameters without a default have been assigned # values. for [(name, defval), assigned] in parameters: if (defval is None) and not assigned: if name is None: display = '<tuple>' else: display_name = repr(name) self.add_message('E1120', node=node, args=display_name) def register(linter): """required method to auto register this checker """ linter.register_checker(TypeChecker(linter))
michalliu/chromium-depot_tools
third_party/pylint/checkers/typecheck.py
Python
bsd-3-clause
16,288
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/policy/core/common/cloud/device_management_service.h" #include <utility> #include "base/bind.h" #include "base/compiler_specific.h" #include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_proxy.h" #include "net/base/escape.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/http/http_response_headers.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_request_status.h" #include "url/gurl.h" namespace em = enterprise_management; namespace policy { namespace { const char kPostContentType[] = "application/protobuf"; const char kServiceTokenAuthHeader[] = "Authorization: GoogleLogin auth="; const char kDMTokenAuthHeader[] = "Authorization: GoogleDMToken token="; // Number of times to retry on ERR_NETWORK_CHANGED errors. const int kMaxNetworkChangedRetries = 3; // HTTP Error Codes of the DM Server with their concrete meanings in the context // of the DM Server communication. const int kSuccess = 200; const int kInvalidArgument = 400; const int kInvalidAuthCookieOrDMToken = 401; const int kMissingLicenses = 402; const int kDeviceManagementNotAllowed = 403; const int kInvalidURL = 404; // This error is not coming from the GFE. const int kInvalidSerialNumber = 405; const int kDomainMismatch = 406; const int kDeviceIdConflict = 409; const int kDeviceNotFound = 410; const int kPendingApproval = 412; const int kInternalServerError = 500; const int kServiceUnavailable = 503; const int kPolicyNotFound = 902; const int kDeprovisioned = 903; bool IsProxyError(const net::URLRequestStatus status) { switch (status.error()) { case net::ERR_PROXY_CONNECTION_FAILED: case net::ERR_TUNNEL_CONNECTION_FAILED: case net::ERR_PROXY_AUTH_UNSUPPORTED: case net::ERR_HTTPS_PROXY_TUNNEL_RESPONSE: case net::ERR_MANDATORY_PROXY_CONFIGURATION_FAILED: case net::ERR_PROXY_CERTIFICATE_INVALID: case net::ERR_SOCKS_CONNECTION_FAILED: case net::ERR_SOCKS_CONNECTION_HOST_UNREACHABLE: return true; } return false; } bool IsProtobufMimeType(const net::URLFetcher* fetcher) { return fetcher->GetResponseHeaders()->HasHeaderValue( "content-type", "application/x-protobuffer"); } bool FailedWithProxy(const net::URLFetcher* fetcher) { if ((fetcher->GetLoadFlags() & net::LOAD_BYPASS_PROXY) != 0) { // The request didn't use a proxy. return false; } if (!fetcher->GetStatus().is_success() && IsProxyError(fetcher->GetStatus())) { LOG(WARNING) << "Proxy failed while contacting dmserver."; return true; } if (fetcher->GetStatus().is_success() && fetcher->GetResponseCode() == kSuccess && fetcher->WasFetchedViaProxy() && !IsProtobufMimeType(fetcher)) { // The proxy server can be misconfigured but pointing to an existing // server that replies to requests. Try to recover if a successful // request that went through a proxy returns an unexpected mime type. LOG(WARNING) << "Got bad mime-type in response from dmserver that was " << "fetched via a proxy."; return true; } return false; } const char* UserAffiliationToString(UserAffiliation affiliation) { switch (affiliation) { case USER_AFFILIATION_MANAGED: return dm_protocol::kValueUserAffiliationManaged; case USER_AFFILIATION_NONE: return dm_protocol::kValueUserAffiliationNone; } NOTREACHED() << "Invalid user affiliation " << affiliation; return dm_protocol::kValueUserAffiliationNone; } const char* JobTypeToRequestType(DeviceManagementRequestJob::JobType type) { switch (type) { case DeviceManagementRequestJob::TYPE_AUTO_ENROLLMENT: return dm_protocol::kValueRequestAutoEnrollment; case DeviceManagementRequestJob::TYPE_REGISTRATION: return dm_protocol::kValueRequestRegister; case DeviceManagementRequestJob::TYPE_POLICY_FETCH: return dm_protocol::kValueRequestPolicy; case DeviceManagementRequestJob::TYPE_API_AUTH_CODE_FETCH: return dm_protocol::kValueRequestApiAuthorization; case DeviceManagementRequestJob::TYPE_UNREGISTRATION: return dm_protocol::kValueRequestUnregister; case DeviceManagementRequestJob::TYPE_UPLOAD_CERTIFICATE: return dm_protocol::kValueRequestUploadCertificate; case DeviceManagementRequestJob::TYPE_DEVICE_STATE_RETRIEVAL: return dm_protocol::kValueRequestDeviceStateRetrieval; } NOTREACHED() << "Invalid job type " << type; return ""; } } // namespace // Request job implementation used with DeviceManagementService. class DeviceManagementRequestJobImpl : public DeviceManagementRequestJob { public: DeviceManagementRequestJobImpl( JobType type, const std::string& agent_parameter, const std::string& platform_parameter, DeviceManagementService* service, net::URLRequestContextGetter* request_context); virtual ~DeviceManagementRequestJobImpl(); // Handles the URL request response. void HandleResponse(const net::URLRequestStatus& status, int response_code, const net::ResponseCookies& cookies, const std::string& data); // Gets the URL to contact. GURL GetURL(const std::string& server_url); // Configures the fetcher, setting up payload and headers. void ConfigureRequest(net::URLFetcher* fetcher); // Returns true if this job should be retried. |fetcher| has just completed, // and can be inspected to determine if the request failed and should be // retried. bool ShouldRetry(const net::URLFetcher* fetcher); // Invoked right before retrying this job. void PrepareRetry(); protected: // DeviceManagementRequestJob: virtual void Run() OVERRIDE; private: // Invokes the callback with the given error code. void ReportError(DeviceManagementStatus code); // Pointer to the service this job is associated with. DeviceManagementService* service_; // Whether the BYPASS_PROXY flag should be set by ConfigureRequest(). bool bypass_proxy_; // Number of times that this job has been retried due to ERR_NETWORK_CHANGED. int retries_count_; // The request context to use for this job. net::URLRequestContextGetter* request_context_; DISALLOW_COPY_AND_ASSIGN(DeviceManagementRequestJobImpl); }; DeviceManagementRequestJobImpl::DeviceManagementRequestJobImpl( JobType type, const std::string& agent_parameter, const std::string& platform_parameter, DeviceManagementService* service, net::URLRequestContextGetter* request_context) : DeviceManagementRequestJob(type, agent_parameter, platform_parameter), service_(service), bypass_proxy_(false), retries_count_(0), request_context_(request_context) {} DeviceManagementRequestJobImpl::~DeviceManagementRequestJobImpl() { service_->RemoveJob(this); } void DeviceManagementRequestJobImpl::Run() { service_->AddJob(this); } void DeviceManagementRequestJobImpl::HandleResponse( const net::URLRequestStatus& status, int response_code, const net::ResponseCookies& cookies, const std::string& data) { if (status.status() != net::URLRequestStatus::SUCCESS) { LOG(WARNING) << "DMServer request failed, status: " << status.status() << ", error: " << status.error(); em::DeviceManagementResponse dummy_response; callback_.Run(DM_STATUS_REQUEST_FAILED, status.error(), dummy_response); return; } if (response_code != kSuccess) LOG(WARNING) << "DMServer sent an error response: " << response_code; switch (response_code) { case kSuccess: { em::DeviceManagementResponse response; if (!response.ParseFromString(data)) { ReportError(DM_STATUS_RESPONSE_DECODING_ERROR); return; } callback_.Run(DM_STATUS_SUCCESS, net::OK, response); return; } case kInvalidArgument: ReportError(DM_STATUS_REQUEST_INVALID); return; case kInvalidAuthCookieOrDMToken: ReportError(DM_STATUS_SERVICE_MANAGEMENT_TOKEN_INVALID); return; case kMissingLicenses: ReportError(DM_STATUS_SERVICE_MISSING_LICENSES); return; case kDeviceManagementNotAllowed: ReportError(DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED); return; case kPendingApproval: ReportError(DM_STATUS_SERVICE_ACTIVATION_PENDING); return; case kInvalidURL: case kInternalServerError: case kServiceUnavailable: ReportError(DM_STATUS_TEMPORARY_UNAVAILABLE); return; case kDeviceNotFound: ReportError(DM_STATUS_SERVICE_DEVICE_NOT_FOUND); return; case kPolicyNotFound: ReportError(DM_STATUS_SERVICE_POLICY_NOT_FOUND); return; case kInvalidSerialNumber: ReportError(DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER); return; case kDomainMismatch: ReportError(DM_STATUS_SERVICE_DOMAIN_MISMATCH); return; case kDeprovisioned: ReportError(DM_STATUS_SERVICE_DEPROVISIONED); return; case kDeviceIdConflict: ReportError(DM_STATUS_SERVICE_DEVICE_ID_CONFLICT); return; default: // Handle all unknown 5xx HTTP error codes as temporary and any other // unknown error as one that needs more time to recover. if (response_code >= 500 && response_code <= 599) ReportError(DM_STATUS_TEMPORARY_UNAVAILABLE); else ReportError(DM_STATUS_HTTP_STATUS_ERROR); return; } } GURL DeviceManagementRequestJobImpl::GetURL( const std::string& server_url) { std::string result(server_url); result += '?'; for (ParameterMap::const_iterator entry(query_params_.begin()); entry != query_params_.end(); ++entry) { if (entry != query_params_.begin()) result += '&'; result += net::EscapeQueryParamValue(entry->first, true); result += '='; result += net::EscapeQueryParamValue(entry->second, true); } return GURL(result); } void DeviceManagementRequestJobImpl::ConfigureRequest( net::URLFetcher* fetcher) { fetcher->SetRequestContext(request_context_); fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DISABLE_CACHE | (bypass_proxy_ ? net::LOAD_BYPASS_PROXY : 0)); std::string payload; CHECK(request_.SerializeToString(&payload)); fetcher->SetUploadData(kPostContentType, payload); std::string extra_headers; if (!gaia_token_.empty()) extra_headers += kServiceTokenAuthHeader + gaia_token_ + "\n"; if (!dm_token_.empty()) extra_headers += kDMTokenAuthHeader + dm_token_ + "\n"; fetcher->SetExtraRequestHeaders(extra_headers); } bool DeviceManagementRequestJobImpl::ShouldRetry( const net::URLFetcher* fetcher) { if (FailedWithProxy(fetcher) && !bypass_proxy_) { // Retry the job if it failed due to a broken proxy, by bypassing the // proxy on the next try. bypass_proxy_ = true; return true; } // Early device policy fetches on ChromeOS and Auto-Enrollment checks are // often interrupted during ChromeOS startup when network change notifications // are sent. Allowing the fetcher to retry once after that is enough to // recover; allow it to retry up to 3 times just in case. if (fetcher->GetStatus().error() == net::ERR_NETWORK_CHANGED && retries_count_ < kMaxNetworkChangedRetries) { ++retries_count_; return true; } // The request didn't fail, or the limit of retry attempts has been reached; // forward the result to the job owner. return false; } void DeviceManagementRequestJobImpl::PrepareRetry() { if (!retry_callback_.is_null()) retry_callback_.Run(this); } void DeviceManagementRequestJobImpl::ReportError(DeviceManagementStatus code) { em::DeviceManagementResponse dummy_response; callback_.Run(code, net::OK, dummy_response); } DeviceManagementRequestJob::~DeviceManagementRequestJob() {} void DeviceManagementRequestJob::SetGaiaToken(const std::string& gaia_token) { gaia_token_ = gaia_token; } void DeviceManagementRequestJob::SetOAuthToken(const std::string& oauth_token) { AddParameter(dm_protocol::kParamOAuthToken, oauth_token); } void DeviceManagementRequestJob::SetUserAffiliation( UserAffiliation user_affiliation) { AddParameter(dm_protocol::kParamUserAffiliation, UserAffiliationToString(user_affiliation)); } void DeviceManagementRequestJob::SetDMToken(const std::string& dm_token) { dm_token_ = dm_token; } void DeviceManagementRequestJob::SetClientID(const std::string& client_id) { AddParameter(dm_protocol::kParamDeviceID, client_id); } em::DeviceManagementRequest* DeviceManagementRequestJob::GetRequest() { return &request_; } DeviceManagementRequestJob::DeviceManagementRequestJob( JobType type, const std::string& agent_parameter, const std::string& platform_parameter) { AddParameter(dm_protocol::kParamRequest, JobTypeToRequestType(type)); AddParameter(dm_protocol::kParamDeviceType, dm_protocol::kValueDeviceType); AddParameter(dm_protocol::kParamAppType, dm_protocol::kValueAppType); AddParameter(dm_protocol::kParamAgent, agent_parameter); AddParameter(dm_protocol::kParamPlatform, platform_parameter); } void DeviceManagementRequestJob::SetRetryCallback( const RetryCallback& retry_callback) { retry_callback_ = retry_callback; } void DeviceManagementRequestJob::Start(const Callback& callback) { callback_ = callback; Run(); } void DeviceManagementRequestJob::AddParameter(const std::string& name, const std::string& value) { query_params_.push_back(std::make_pair(name, value)); } // A random value that other fetchers won't likely use. const int DeviceManagementService::kURLFetcherID = 0xde71ce1d; DeviceManagementService::~DeviceManagementService() { // All running jobs should have been cancelled by now. DCHECK(pending_jobs_.empty()); DCHECK(queued_jobs_.empty()); } DeviceManagementRequestJob* DeviceManagementService::CreateJob( DeviceManagementRequestJob::JobType type, net::URLRequestContextGetter* request_context) { return new DeviceManagementRequestJobImpl( type, configuration_->GetAgentParameter(), configuration_->GetPlatformParameter(), this, request_context); } void DeviceManagementService::ScheduleInitialization(int64 delay_milliseconds) { if (initialized_) return; base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&DeviceManagementService::Initialize, weak_ptr_factory_.GetWeakPtr()), base::TimeDelta::FromMilliseconds(delay_milliseconds)); } void DeviceManagementService::Initialize() { if (initialized_) return; initialized_ = true; while (!queued_jobs_.empty()) { StartJob(queued_jobs_.front()); queued_jobs_.pop_front(); } } void DeviceManagementService::Shutdown() { for (JobFetcherMap::iterator job(pending_jobs_.begin()); job != pending_jobs_.end(); ++job) { delete job->first; queued_jobs_.push_back(job->second); } pending_jobs_.clear(); } DeviceManagementService::DeviceManagementService( scoped_ptr<Configuration> configuration) : configuration_(configuration.Pass()), initialized_(false), weak_ptr_factory_(this) { DCHECK(configuration_); } void DeviceManagementService::StartJob(DeviceManagementRequestJobImpl* job) { std::string server_url = GetServerUrl(); net::URLFetcher* fetcher = net::URLFetcher::Create( kURLFetcherID, job->GetURL(server_url), net::URLFetcher::POST, this); job->ConfigureRequest(fetcher); pending_jobs_[fetcher] = job; fetcher->Start(); } std::string DeviceManagementService::GetServerUrl() { return configuration_->GetServerUrl(); } void DeviceManagementService::OnURLFetchComplete( const net::URLFetcher* source) { JobFetcherMap::iterator entry(pending_jobs_.find(source)); if (entry == pending_jobs_.end()) { NOTREACHED() << "Callback from foreign URL fetcher"; return; } DeviceManagementRequestJobImpl* job = entry->second; pending_jobs_.erase(entry); if (job->ShouldRetry(source)) { VLOG(1) << "Retrying dmserver request."; job->PrepareRetry(); StartJob(job); } else { std::string data; source->GetResponseAsString(&data); job->HandleResponse(source->GetStatus(), source->GetResponseCode(), source->GetCookies(), data); } delete source; } void DeviceManagementService::AddJob(DeviceManagementRequestJobImpl* job) { if (initialized_) StartJob(job); else queued_jobs_.push_back(job); } void DeviceManagementService::RemoveJob(DeviceManagementRequestJobImpl* job) { for (JobFetcherMap::iterator entry(pending_jobs_.begin()); entry != pending_jobs_.end(); ++entry) { if (entry->second == job) { delete entry->first; pending_jobs_.erase(entry); return; } } const JobQueue::iterator elem = std::find(queued_jobs_.begin(), queued_jobs_.end(), job); if (elem != queued_jobs_.end()) queued_jobs_.erase(elem); } } // namespace policy
7kbird/chrome
components/policy/core/common/cloud/device_management_service.cc
C++
bsd-3-clause
17,300
// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized extern int omp_default_mem_alloc; void xxx(int argc) { int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}} #pragma omp for simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } namespace X { int x; }; struct B { static int ib; // expected-note {{'B::ib' declared here}} static int bfoo() { return 8; } }; int bfoo() { return 4; } int z; const int C1 = 1; const int C2 = 2; void test_linear_colons() { int B = 0; #pragma omp for simd linear(B:bfoo()) for (int i = 0; i < 10; ++i) ; // expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'}} #pragma omp for simd linear(B::ib:B:bfoo()) for (int i = 0; i < 10; ++i) ; // expected-error@+1 {{use of undeclared identifier 'ib'; did you mean 'B::ib'}} #pragma omp for simd linear(B:ib) for (int i = 0; i < 10; ++i) ; // expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'?}} #pragma omp for simd linear(z:B:ib) for (int i = 0; i < 10; ++i) ; #pragma omp for simd linear(B:B::bfoo()) for (int i = 0; i < 10; ++i) ; #pragma omp for simd linear(X::x : ::z) for (int i = 0; i < 10; ++i) ; #pragma omp for simd linear(B,::z, X::x) for (int i = 0; i < 10; ++i) ; #pragma omp for simd linear(::z) for (int i = 0; i < 10; ++i) ; // expected-error@+1 {{expected variable name}} #pragma omp for simd linear(B::bfoo()) for (int i = 0; i < 10; ++i) ; #pragma omp for simd linear(B::ib,B:C1+C2) for (int i = 0; i < 10; ++i) ; } template<int L, class T, class N> T test_template(T* arr, N num) { N i; T sum = (T)0; T ind2 = - num * L; // expected-note {{'ind2' defined here}} // expected-error@+1 {{argument of a linear clause should be of integral or pointer type}} #pragma omp for simd linear(ind2:L) for (i = 0; i < num; ++i) { T cur = arr[(int)ind2]; ind2 += L; sum += cur; } return T(); } template<int LEN> int test_warn() { int ind2 = 0; // expected-warning@+1 {{zero linear step (ind2 should probably be const)}} #pragma omp for simd linear(ind2:LEN) for (int i = 0; i < 100; i++) { ind2 += LEN; } return ind2; } struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}} extern S1 a; class S2 { mutable int a; public: S2():a(0) { } }; const S2 b; // expected-note 2 {{'b' defined here}} const S2 ba[5]; class S3 { int a; public: S3():a(0) { } }; const S3 ca[5]; class S4 { int a; S4(); public: S4(int v):a(v) { } }; class S5 { int a; S5():a(0) {} public: S5(int v):a(v) { } }; S3 h; #pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} template<class I, class C> int foomain(I argc, C **argv) { I e(4); I g(5); int i; int &j = i; #pragma omp for simd linear // expected-error {{expected '(' after 'linear'}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear () // expected-error {{expected expression}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; // expected-error@+2 {{linear variable with incomplete type 'S1'}} // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S2'}} #pragma omp for simd linear (a, b:B::ib) for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear(e, g) for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear(i) for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel { int v = 0; long z; int i; #pragma omp for simd linear(z, v:i) for (int k = 0; k < argc; ++k) { i = k; v += i; } } #pragma omp for simd linear(j) for (int k = 0; k < argc; ++k) ++k; int v = 0; #pragma omp for simd linear(v:j) for (int k = 0; k < argc; ++k) { ++k; v += j; } #pragma omp for simd linear(i) for (int k = 0; k < argc; ++k) ++k; return 0; } namespace A { double x; #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}} } namespace C { using A::x; } int main(int argc, char **argv) { double darr[100]; // expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}} test_template<-4>(darr, 4); // expected-note@+1 {{in instantiation of function template specialization 'test_warn<0>' requested here}} test_warn<0>(); S4 e(4); // expected-note {{'e' defined here}} S5 g(5); // expected-note {{'g' defined here}} int i; int &j = i; #pragma omp for simd linear // expected-error {{expected '(' after 'linear'}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear () // expected-error {{expected expression}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argc) for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; // expected-error@+2 {{linear variable with incomplete type 'S1'}} // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S2'}} #pragma omp for simd linear(a, b) for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; // expected-error@+2 {{argument of a linear clause should be of integral or pointer type, not 'S4'}} // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}} #pragma omp for simd linear(e, g) for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel { int i; #pragma omp for simd linear(i : i) for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear(i : 4) for (int k = 0; k < argc; ++k) { ++k; i += 4; } } #pragma omp for simd linear(j) for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear(i) for (int k = 0; k < argc; ++k) ++k; foomain<int,char>(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain<int, char>' requested here}} return 0; }
endlessm/chromium-browser
third_party/llvm/clang/test/OpenMP/for_simd_linear_messages.cpp
C++
bsd-3-clause
8,731
import { __extends } from "tslib"; /** * ============================================================================ * IMPORTS * ============================================================================ * @hidden */ import { dataLoader } from "./DataLoader"; import { JSONParser } from "./JSONParser"; import { CSVParser } from "./CSVParser"; import { BaseObjectEvents } from "../Base"; import { Adapter } from "../utils/Adapter"; import { Language } from "../utils/Language"; import { DateFormatter } from "../formatters/DateFormatter"; import { registry } from "../Registry"; import * as $type from "../utils/Type"; import * as $object from "../utils/Object"; ; ; /** * ============================================================================ * MAIN CLASS * ============================================================================ * @hidden */ /** * Represents a single data source - external file with all of its settings, * such as format, data parsing, etc. * * ```TypeScript * chart.dataSource.url = "http://www.myweb.com/data.json"; * chart.dataSource.parser = am4core.JSONParser; * ``` * ```JavaScript * chart.dataSource.url = "http://www.myweb.com/data.json"; * chart.dataSource.parser = am4core.JSONParser; * ``` * ```JSON * { * // ... * "dataSource": { * "url": "http://www.myweb.com/data.json", * "parser": "JSONParser" * }, * // ... * } * ``` * * @see {@link IDataSourceEvents} for a list of available events * @see {@link IDataSourceAdapters} for a list of available Adapters */ var DataSource = /** @class */ (function (_super) { __extends(DataSource, _super); /** * Constructor */ function DataSource(url, parser) { var _this = // Init _super.call(this) || this; /** * Adapter. */ _this.adapter = new Adapter(_this); /** * Custom options for HTTP(S) request. */ _this._requestOptions = {}; /** * If set to `true`, any subsequent data loads will be considered incremental * (containing only new data points that are supposed to be added to existing * data). * * NOTE: this setting works only with element's `data` property. It won't * work with any other externally-loadable data property. * * @default false */ _this._incremental = false; /** * A collection of key/value pairs to attach to a data source URL when making * an incremental request. */ _this._incrementalParams = {}; /** * This setting is used only when `incremental = true`. If set to `true`, * it will try to retain the same number of data items across each load. * * E.g. if incremental load yeilded 5 new records, then 5 items from the * beginning of data will be removed so that we end up with the same number * of data items. * * @default false */ _this._keepCount = false; /** * If set to `true`, each subsequent load will be treated as an update to * currently loaded data, meaning that it will try to update values on * existing data items, not overwrite the whole data. * * This will work faster than complete update, and also will animate the * values to their new positions. * * Data sources across loads must contain the same number of data items. * * Loader will not truncate the data set if loaded data has fewer data items, * and if it is longer, the excess data items will be ignored. * * @default false * @since 4.5.5 */ _this._updateCurrentData = false; /** * Will show loading indicator when loading files. */ _this.showPreloader = true; _this.className = "DataSource"; // Set defaults if (url) { _this.url = url; } // Set parser if (parser) { if (typeof parser == "string") { _this.parser = dataLoader.getParserByType(parser); } else { _this.parser = parser; } } return _this; } /** * Processes the loaded data. * * @ignore Exclude from docs * @param data Raw (unparsed) data * @param contentType Content type of the loaded data (optional) */ DataSource.prototype.processData = function (data, contentType) { // Parsing started this.dispatchImmediately("parsestarted"); // Check if parser is set if (!this.parser) { // Try to resolve from data this.parser = dataLoader.getParserByData(data, contentType); if (!this.parser) { // We have a problem - nobody knows what to do with the data // Raise error if (this.events.isEnabled("parseerror")) { var event_1 = { type: "parseerror", message: this.language.translate("No parser available for file: %1", null, this.url), target: this }; this.events.dispatchImmediately("parseerror", event_1); } this.dispatchImmediately("parseended"); return; } } // Apply options adapters this.parser.options = this.adapter.apply("parserOptions", this.parser.options); this.parser.options.dateFields = this.adapter.apply("dateFields", this.parser.options.dateFields || []); this.parser.options.numberFields = this.adapter.apply("numberFields", this.parser.options.numberFields || []); // Check if we need to pass in date formatter if (this.parser.options.dateFields && !this.parser.options.dateFormatter) { this.parser.options.dateFormatter = this.dateFormatter; } // Parse this.data = this.adapter.apply("parsedData", this.parser.parse(this.adapter.apply("unparsedData", data))); // Check for parsing errors if (!$type.hasValue(this.data) && this.events.isEnabled("parseerror")) { var event_2 = { type: "parseerror", message: this.language.translate("Error parsing file: %1", null, this.url), target: this }; this.events.dispatchImmediately("parseerror", event_2); } // Wrap up this.dispatchImmediately("parseended"); if ($type.hasValue(this.data)) { this.dispatchImmediately("done", { "data": this.data }); } // The component is responsible for updating its own data vtriggered via // events. // Update last data load this.lastLoad = new Date(); }; Object.defineProperty(DataSource.prototype, "url", { /** * @return URL */ get: function () { // Get URL var url = this.disableCache ? this.timestampUrl(this._url) : this._url; // Add incremental params if (this.incremental && this.component.data.length) { url = this.addUrlParams(url, this.incrementalParams); } return this.adapter.apply("url", url); }, /** * URL of the data source. * * @param value URL */ set: function (value) { this._url = value; }, enumerable: true, configurable: true }); Object.defineProperty(DataSource.prototype, "requestOptions", { /** * @return Options */ get: function () { return this.adapter.apply("requestOptions", this._requestOptions); }, /** * Custom options for HTTP(S) request. * * At this moment the only option supported is: `requestHeaders`, which holds * an array of objects for custom request headers, e.g.: * * ```TypeScript * chart.dataSource.requestOptions.requestHeaders = [{ * "key": "x-access-token", * "value": "123456789" * }]; * ``````JavaScript * chart.dataSource.requestOptions.requestHeaders = [{ * "key": "x-access-token", * "value": "123456789" * }]; * ``` * ```JSON * { * // ... * "dataSource": { * // ... * "requestOptions": { * "requestHeaders": [{ * "key": "x-access-token", * "value": "123456789" * }] * } * } * } * ``` * * NOTE: setting this options on an-already loaded DataSource will not * trigger a reload. * * @param value Options */ set: function (value) { this._requestOptions = value; }, enumerable: true, configurable: true }); Object.defineProperty(DataSource.prototype, "parser", { /** * @return Data parser */ get: function () { if (!this._parser) { this._parser = new JSONParser(); } return this.adapter.apply("parser", this._parser); }, /** * A parser to be used to parse data. * * ```TypeScript * chart.dataSource.url = "http://www.myweb.com/data.json"; * chart.dataSource.parser = am4core.JSONParser; * ``` * ```JavaScript * chart.dataSource.url = "http://www.myweb.com/data.json"; * chart.dataSource.parser = am4core.JSONParser; * ``` * ```JSON * { * // ... * "dataSource": { * "url": "http://www.myweb.com/data.json", * "parser": { * "type": "JSONParser" * } * }, * // ... * } * ``` * * @default JSONParser * @param value Data parser */ set: function (value) { this._parser = value; }, enumerable: true, configurable: true }); Object.defineProperty(DataSource.prototype, "reloadFrequency", { /** * @return Reload frequency (ms) */ get: function () { return this.adapter.apply("reloadTimeout", this._reloadFrequency); }, /** * Data source reload frequency. * * If set, it will reload the same URL every X milliseconds. * * @param value Reload frequency (ms) */ set: function (value) { var _this = this; if (this._reloadFrequency != value) { this._reloadFrequency = value; // Should we schedule a reload? if (value) { if (!$type.hasValue(this._reloadDisposer)) { this._reloadDisposer = this.events.on("ended", function (ev) { _this._reloadTimeout = setTimeout(function () { _this.load(); }, _this.reloadFrequency); }); } } else if ($type.hasValue(this._reloadDisposer)) { this._reloadDisposer.dispose(); this._reloadDisposer = undefined; } } }, enumerable: true, configurable: true }); Object.defineProperty(DataSource.prototype, "incremental", { /** * @return Incremental load? */ get: function () { return this.adapter.apply("incremental", this._incremental); }, /** * Should subsequent reloads be treated as incremental? * * Incremental loads will assume that they contain only new data items * since the last load. * * If `incremental = false` the loader will replace all of the target's * data with each load. * * This setting does not have any effect trhe first time data is loaded. * * NOTE: this setting works only with element's `data` property. It won't * work with any other externally-loadable data property. * * @default false * @param Incremental load? */ set: function (value) { this._incremental = value; }, enumerable: true, configurable: true }); Object.defineProperty(DataSource.prototype, "incrementalParams", { /** * @return Incremental request parameters */ get: function () { return this.adapter.apply("incrementalParams", this._incrementalParams); }, /** * An object consisting of key/value pairs to apply to an URL when data * source is making an incremental request. * * @param value Incremental request parameters */ set: function (value) { this._incrementalParams = value; }, enumerable: true, configurable: true }); Object.defineProperty(DataSource.prototype, "keepCount", { /** * @return keepCount load? */ get: function () { return this.adapter.apply("keepCount", this._keepCount); }, /** * This setting is used only when `incremental = true`. If set to `true`, * it will try to retain the same number of data items across each load. * * E.g. if incremental load yeilded 5 new records, then 5 items from the * beginning of data will be removed so that we end up with the same number * of data items. * * @default false * @param Keep record count? */ set: function (value) { this._keepCount = value; }, enumerable: true, configurable: true }); Object.defineProperty(DataSource.prototype, "updateCurrentData", { /** * @return Update current data? */ get: function () { return this.adapter.apply("updateCurrentData", this._updateCurrentData); }, /** * If set to `true`, each subsequent load will be treated as an update to * currently loaded data, meaning that it will try to update values on * existing data items, not overwrite the whole data. * * This will work faster than complete update, and also will animate the * values to their new positions. * * Data sources across loads must contain the same number of data items. * * Loader will not truncate the data set if loaded data has fewer data items, * and if it is longer, the excess data items will be ignored. * * NOTE: this setting is ignored if `incremental = true`. * * @default false * @since 2.5.5 * @param Update current data? */ set: function (value) { this._updateCurrentData = value; }, enumerable: true, configurable: true }); Object.defineProperty(DataSource.prototype, "language", { /** * @return A [[Language]] instance to be used */ get: function () { if (this._language) { return this._language; } else if (this.component) { this._language = this.component.language; return this._language; } this.language = new Language(); return this.language; }, /** * Language instance to use. * * Will inherit and use chart's language, if not set. * * @param value An instance of Language */ set: function (value) { this._language = value; }, enumerable: true, configurable: true }); Object.defineProperty(DataSource.prototype, "dateFormatter", { /** * @return A [[DateFormatter]] instance to be used */ get: function () { if (this._dateFormatter) { return this._dateFormatter; } else if (this.component) { this._dateFormatter = this.component.dateFormatter; return this._dateFormatter; } this.dateFormatter = new DateFormatter(); return this.dateFormatter; }, /** * A [[DateFormatter]] to use when parsing dates from string formats. * * Will inherit and use chart's DateFormatter if not ser. * * @param value An instance of [[DateFormatter]] */ set: function (value) { this._dateFormatter = value; }, enumerable: true, configurable: true }); /** * Adds current timestamp to the URL. * * @param url Source URL * @return Timestamped URL */ DataSource.prototype.timestampUrl = function (url) { var tstamp = new Date().getTime().toString(); var params = {}; params[tstamp] = ""; return this.addUrlParams(url, params); }; /** * Disposes of this object. */ DataSource.prototype.dispose = function () { _super.prototype.dispose.call(this); if (this._reloadTimeout) { clearTimeout(this._reloadTimeout); } if ($type.hasValue(this._reloadDisposer)) { this._reloadDisposer.dispose(); this._reloadDisposer = undefined; } }; /** * Initiate the load. * * All loading in JavaScript is asynchronous. This function will trigger the * load and will exit immediately. * * Use DataSource's events to watch for loaded data and errors. */ DataSource.prototype.load = function () { if (this.url) { if (this._reloadTimeout) { clearTimeout(this._reloadTimeout); } dataLoader.load(this); } }; /** * Adds parameters to `url` as query strings. Will take care of proper * separators. * * @param url Source URL * @param params Parameters * @return New URL */ DataSource.prototype.addUrlParams = function (url, params) { var join = url.match(/\?/) ? "&" : "?"; var add = []; $object.each(params, function (key, value) { if (value != "") { add.push(key + "=" + encodeURIComponent(value)); } else { add.push(key); } }); if (add.length) { return url + join + add.join("&"); } return url; }; /** * Processes JSON-based config before it is applied to the object. * * @ignore Exclude from docs * @param config Config */ DataSource.prototype.processConfig = function (config) { registry.registeredClasses["json"] = JSONParser; registry.registeredClasses["JSONParser"] = JSONParser; registry.registeredClasses["csv"] = CSVParser; registry.registeredClasses["CSVParser"] = CSVParser; _super.prototype.processConfig.call(this, config); }; return DataSource; }(BaseObjectEvents)); export { DataSource }; //# sourceMappingURL=DataSource.js.map
cdnjs/cdnjs
ajax/libs/amcharts4/4.10.9/.internal/core/data/DataSource.js
JavaScript
mit
20,447
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.javascript.drivers; import java.io.File; import java.io.FileReader; import java.io.IOException; import junit.framework.TestCase; import org.mozilla.javascript.Context; import org.mozilla.javascript.ContextFactory; import org.mozilla.javascript.Scriptable; public class JsTestsBase extends TestCase { private int optimizationLevel; public void setOptimizationLevel(int level) { this.optimizationLevel = level; } public void runJsTest(Context cx, Scriptable shared, String name, String source) { // create a lightweight top-level scope Scriptable scope = cx.newObject(shared); scope.setPrototype(shared); System.out.print(name + ": "); Object result; try { result = cx.evaluateString(scope, source, "jstest input", 1, null); } catch (RuntimeException e) { System.out.println("FAILED"); throw e; } assertTrue(result != null); assertTrue("success".equals(result)); System.out.println("passed"); } public void runJsTests(File[] tests) throws IOException { ContextFactory factory = ContextFactory.getGlobal(); Context cx = factory.enterContext(); try { cx.setOptimizationLevel(this.optimizationLevel); Scriptable shared = cx.initStandardObjects(); for (File f : tests) { int length = (int) f.length(); // don't worry about very long // files char[] buf = new char[length]; new FileReader(f).read(buf, 0, length); String session = new String(buf); runJsTest(cx, shared, f.getName(), session); } } finally { Context.exit(); } } }
NhlalukoG/android_samsung_j7e3g
vendor/samsung/preloads/UniversalMDMClient/rhino1_7R4/testsrc/org/mozilla/javascript/drivers/JsTestsBase.java
Java
gpl-2.0
2,042
// PR c++/82293 // { dg-do compile { target c++11 } } // { dg-options "-Wshadow" } template <typename> struct S { int f{[this](){return 42;}()}; }; int main(){ return S<int>{}.f; }
Gurgel100/gcc
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice24.C
C++
gpl-2.0
187
<?php /** * This file is automatically @generated by {@link BuildMetadataPHPFromXml}. * Please don't modify it directly. */ return array ( 'generalDesc' => array ( 'NationalNumberPattern' => ' [126-9]\\d{4,11}| 3(?: [0-79]\\d{3,10}| 8[2-9]\\d{2,9} ) ', 'PossibleNumberPattern' => '\\d{5,12}', ), 'fixedLine' => array ( 'NationalNumberPattern' => ' (?: 1(?: [02-9][2-9]| 1[1-9] )\\d| 2(?: [0-24-7][2-9]\\d| [389](?: 0[2-9]| [2-9]\\d ) )| 3(?: [0-8][2-9]\\d| 9(?: [2-9]\\d| 0[2-9] ) ) )\\d{3,8} ', 'PossibleNumberPattern' => '\\d{5,12}', 'ExampleNumber' => '10234567', ), 'mobile' => array ( 'NationalNumberPattern' => ' 6(?: [0-689]| 7\\d )\\d{6,7} ', 'PossibleNumberPattern' => '\\d{8,10}', 'ExampleNumber' => '601234567', ), 'tollFree' => array ( 'NationalNumberPattern' => '800\\d{3,9}', 'PossibleNumberPattern' => '\\d{6,12}', 'ExampleNumber' => '80012345', ), 'premiumRate' => array ( 'NationalNumberPattern' => ' (?: 90[0169]| 78\\d )\\d{3,7} ', 'PossibleNumberPattern' => '\\d{6,12}', 'ExampleNumber' => '90012345', ), 'sharedCost' => array ( 'NationalNumberPattern' => 'NA', 'PossibleNumberPattern' => 'NA', ), 'personalNumber' => array ( 'NationalNumberPattern' => 'NA', 'PossibleNumberPattern' => 'NA', ), 'voip' => array ( 'NationalNumberPattern' => 'NA', 'PossibleNumberPattern' => 'NA', ), 'pager' => array ( 'NationalNumberPattern' => 'NA', 'PossibleNumberPattern' => 'NA', ), 'uan' => array ( 'NationalNumberPattern' => '7[06]\\d{4,10}', 'PossibleNumberPattern' => '\\d{6,12}', 'ExampleNumber' => '700123456', ), 'emergency' => array ( 'NationalNumberPattern' => 'NA', 'PossibleNumberPattern' => 'NA', ), 'voicemail' => array ( 'NationalNumberPattern' => 'NA', 'PossibleNumberPattern' => 'NA', ), 'shortCode' => array ( 'NationalNumberPattern' => 'NA', 'PossibleNumberPattern' => 'NA', ), 'standardRate' => array ( 'NationalNumberPattern' => 'NA', 'PossibleNumberPattern' => 'NA', ), 'carrierSpecific' => array ( 'NationalNumberPattern' => 'NA', 'PossibleNumberPattern' => 'NA', ), 'noInternationalDialling' => array ( 'NationalNumberPattern' => 'NA', 'PossibleNumberPattern' => 'NA', ), 'id' => 'RS', 'countryCode' => 381, 'internationalPrefix' => '00', 'nationalPrefix' => '0', 'nationalPrefixForParsing' => '0', 'sameMobileAndFixedLinePattern' => false, 'numberFormat' => array ( 0 => array ( 'pattern' => '([23]\\d{2})(\\d{4,9})', 'format' => '$1 $2', 'leadingDigitsPatterns' => array ( 0 => ' (?: 2[389]| 39 )0 ', ), 'nationalPrefixFormattingRule' => '0$1', 'domesticCarrierCodeFormattingRule' => '', ), 1 => array ( 'pattern' => '([1-3]\\d)(\\d{5,10})', 'format' => '$1 $2', 'leadingDigitsPatterns' => array ( 0 => ' 1| 2(?: [0-24-7]| [389][1-9] )| 3(?: [0-8]| 9[1-9] ) ', ), 'nationalPrefixFormattingRule' => '0$1', 'domesticCarrierCodeFormattingRule' => '', ), 2 => array ( 'pattern' => '(6\\d)(\\d{6,8})', 'format' => '$1 $2', 'leadingDigitsPatterns' => array ( 0 => '6', ), 'nationalPrefixFormattingRule' => '0$1', 'domesticCarrierCodeFormattingRule' => '', ), 3 => array ( 'pattern' => '([89]\\d{2})(\\d{3,9})', 'format' => '$1 $2', 'leadingDigitsPatterns' => array ( 0 => '[89]', ), 'nationalPrefixFormattingRule' => '0$1', 'domesticCarrierCodeFormattingRule' => '', ), 4 => array ( 'pattern' => '(7[26])(\\d{4,9})', 'format' => '$1 $2', 'leadingDigitsPatterns' => array ( 0 => '7[26]', ), 'nationalPrefixFormattingRule' => '0$1', 'domesticCarrierCodeFormattingRule' => '', ), 5 => array ( 'pattern' => '(7[08]\\d)(\\d{4,9})', 'format' => '$1 $2', 'leadingDigitsPatterns' => array ( 0 => '7[08]', ), 'nationalPrefixFormattingRule' => '0$1', 'domesticCarrierCodeFormattingRule' => '', ), ), 'intlNumberFormat' => array ( ), 'mainCountryForCode' => false, 'leadingZeroPossible' => false, 'mobileNumberPortableRegion' => true, );
ingagecreative/cg
wp-content/plugins/constant-contact-api/vendor/giggsey/libphonenumber-for-php/src/libphonenumber/data/PhoneNumberMetadata_RS.php
PHP
gpl-2.0
5,064
<?php /* * Copyright 2016 Johannes M. Schmitt <schmittjoh@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace JMS\Serializer\Tests\Fixtures; use JMS\Serializer\Annotation\Type; class ObjectWithNullProperty extends SimpleObject { /** * @var null * @Type("string") */ private $nullProperty = null; /** * @return null */ public function getNullProperty() { return $this->nullProperty; } }
SheYo/bc
webform_handlers/vendor/jms/serializer/tests/Fixtures/ObjectWithNullProperty.php
PHP
gpl-2.0
980
// -*- c-basic-offset: 4 -*- /* * elementmap.{cc,hh} -- an element map class * Eddie Kohler * * Copyright (c) 1999-2000 Massachusetts Institute of Technology * Copyright (c) 2000 Mazu Networks, Inc. * Copyright (c) 2001 International Computer Science Institute * Copyright (c) 2008-2009 Meraki, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, subject to the conditions * listed in the Click LICENSE file. These conditions include: you must * preserve this copyright notice, and you cannot mention the copyright * holders in advertising related to the Software without their permission. * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This * notice is a summary of the Click LICENSE file; the license in that file is * legally binding. */ #include <click/config.h> #include <click/straccum.hh> #include <click/bitvector.hh> #include "routert.hh" #include "lexert.hh" #include "elementmap.hh" #include "toolutils.hh" #include <click/confparse.hh> int32_t ElementMap::version_counter = 0; static ElementMap main_element_map; ElementMap *ElementMap::the_element_map = &main_element_map; static Vector<ElementMap *> element_map_stack; ElementMap::ElementMap() : _name_map(0), _use_count(0), _driver_mask(Driver::ALLMASK), _provided_driver_mask(0) { _e.push_back(Traits()); _def.push_back(Globals()); incr_version(); } ElementMap::ElementMap(const String& str, ErrorHandler* errh) : _name_map(0), _use_count(0), _driver_mask(Driver::ALLMASK), _provided_driver_mask(0) { _e.push_back(Traits()); _def.push_back(Globals()); parse(str, errh); incr_version(); } ElementMap::~ElementMap() { assert(_use_count == 0); } void ElementMap::push_default(ElementMap *emap) { emap->use(); element_map_stack.push_back(the_element_map); the_element_map = emap; } void ElementMap::pop_default() { ElementMap *old = the_element_map; if (element_map_stack.size()) { the_element_map = element_map_stack.back(); element_map_stack.pop_back(); } else the_element_map = &main_element_map; old->unuse(); } void ElementMap::pop_default(ElementMap *emap) { if (the_element_map == emap) pop_default(); } int ElementMap::driver_elt_index(int i) const { while (i > 0 && (_e[i].driver_mask & _driver_mask) == 0) i = _e[i].name_next; return i; } String ElementMap::documentation_url(const ElementTraits &t) const { String name = t.documentation_name; if (name) return percent_substitute(_def[t.def_index].dochref, 's', name.c_str(), 0); else return ""; } int ElementMap::add(const Traits &e) { int i = _e.size(); _e.push_back(e); Traits &my_e = _e.back(); if (my_e.requirements) my_e.calculate_driver_mask(); if (e.name) { ElementClassT *c = ElementClassT::base_type(e.name); my_e.name_next = _name_map[c->name()]; _name_map.set(c->name(), i); } incr_version(); return i; } void ElementMap::remove_at(int i) { // XXX repeated removes can fill up ElementMap with crap if (i <= 0 || i >= _e.size()) return; Traits &e = _e[i]; int p = -1; for (int t = _name_map.get(e.name); t > 0; p = t, t = _e[t].name_next) /* nada */; if (p >= 0) _e[p].name_next = e.name_next; else if (e.name) _name_map.set(e.name, e.name_next); e.name = e.cxx = String(); incr_version(); } Traits & ElementMap::force_traits(const String &class_name) { int initial_i = _name_map[class_name], i = initial_i; if (!(_e[i].driver_mask & _driver_mask) && i > 0) i = driver_elt_index(i); if (i == 0) { Traits t; if (initial_i == 0) t.name = class_name; else t = _e[initial_i]; t.driver_mask = _driver_mask; i = add(t); } return _e[i]; } static const char * parse_attribute_value(String *result, const char *s, const char *ends, const HashTable<String, String> &entities, ErrorHandler *errh) { while (s < ends && isspace((unsigned char) *s)) s++; if (s >= ends || (*s != '\'' && *s != '\"')) { errh->error("XML parse error: missing attribute value"); return s; } char quote = *s; const char *first = s + 1; StringAccum sa; for (s++; s < ends && *s != quote; s++) if (*s == '&') { // dump on normal text sa.append(first, s - first); if (s + 3 < ends && s[1] == '#' && s[2] == 'x') { // hex character reference int c = 0; for (s += 3; isxdigit((unsigned char) *s); s++) if (isdigit((unsigned char) *s)) c = (c * 16) + *s - '0'; else c = (c * 16) + tolower((unsigned char) *s) - 'a' + 10; sa << (char)c; } else if (s + 2 < ends && s[1] == '#') { // decimal character reference int c = 0; for (s += 2; isdigit((unsigned char) *s); s++) c = (c * 10) + *s - '0'; sa << (char)c; } else { // named entity const char *t; for (t = s + 1; t < ends && *t != quote && *t != ';'; t++) /* nada */; if (t < ends && *t == ';') { String entity_name(s + 1, t - s - 1); sa << entities[entity_name]; s = t; } } // check entity ended correctly if (s >= ends || *s != ';') { errh->error("XML parse error: bad entity name"); return s; } first = s + 1; } sa.append(first, s - first); if (s >= ends) errh->error("XML parse error: unterminated attribute value"); else s++; *result = sa.take_string(); return s; } static const char * parse_xml_attrs(HashTable<String, String> &attrs, const char *s, const char *ends, bool *closed, const HashTable<String, String> &entities, ErrorHandler *errh) { while (s < ends) { while (s < ends && isspace((unsigned char) *s)) s++; if (s >= ends) return s; else if (*s == '/') { *closed = true; return s; } else if (*s == '>') return s; // get attribute name const char *attrstart = s; while (s < ends && !isspace((unsigned char) *s) && *s != '=') s++; if (s == attrstart) { errh->error("XML parse error: missing attribute name"); return s; } String attrname(attrstart, s - attrstart); // skip whitespace and equals sign while (s < ends && isspace((unsigned char) *s)) s++; if (s >= ends || *s != '=') { errh->error("XML parse error: missing %<=%>"); return s; } s++; // get attribute value String attrvalue; s = parse_attribute_value(&attrvalue, s, ends, entities, errh); attrs.set(attrname, attrvalue); } return s; } void ElementMap::parse_xml(const String &str, const String &package_name, ErrorHandler *errh) { if (!errh) errh = ErrorHandler::silent_handler(); // prepare entities HashTable<String, String> entities; entities.set("lt", "<"); entities.set("amp", "&"); entities.set("gt", ">"); entities.set("quot", "\""); entities.set("apos", "'"); const char *s = str.data(); const char *ends = s + str.length(); bool in_elementmap = false; while (s < ends) { // skip to '<' while (s < ends && *s != '<') s++; for (s++; s < ends && isspace((unsigned char) *s); s++) /* nada */; bool closed = false; if (s < ends && *s == '/') { closed = true; for (s++; s < ends && isspace((unsigned char) *s); s++) /* nada */; } // which tag if (s + 10 < ends && memcmp(s, "elementmap", 10) == 0 && (isspace((unsigned char) s[10]) || s[10] == '>' || s[10] == '/')) { // parse elementmap tag if (!closed) { if (in_elementmap) errh->error("XML elementmap parse error: nested <elementmap> tags"); HashTable<String, String> attrs; s = parse_xml_attrs(attrs, s + 10, ends, &closed, entities, errh); Globals g; g.package = (attrs["package"] ? attrs["package"] : package_name); g.srcdir = attrs["sourcedir"]; if (attrs["src"].substring(0, 7) == "file://") g.srcdir = attrs["src"].substring(7); g.dochref = attrs["dochref"]; if (!g.dochref) g.dochref = attrs["webdoc"]; if (attrs["provides"]) _e[0].provisions += " " + attrs["provides"]; g.driver_mask = Driver::ALLMASK; if (attrs["drivers"]) g.driver_mask = Driver::driver_mask(attrs["drivers"]); if (!_provided_driver_mask) _provided_driver_mask = g.driver_mask; _def.push_back(g); in_elementmap = true; } if (closed) in_elementmap = false; } else if (s + 5 < ends && memcmp(s, "entry", 5) == 0 && (isspace((unsigned char) s[5]) || s[5] == '>' || s[5] == '/') && !closed && in_elementmap) { // parse entry tag HashTable<String, String> attrs; s = parse_xml_attrs(attrs, s + 5, ends, &closed, entities, errh); Traits elt; for (HashTable<String, String>::iterator i = attrs.begin(); i.live(); i++) if (String *sp = elt.component(i.key())) *sp = i.value(); if (elt.provisions || elt.name) { elt.def_index = _def.size() - 1; (void) add(elt); } } else if (s + 7 < ends && memcmp(s, "!ENTITY", 7) == 0 && (isspace((unsigned char) s[7]) || s[7] == '>' || s[7] == '/')) { // parse entity declaration for (s += 7; s < ends && isspace((unsigned char) *s); s++) /* nada */; if (s >= ends || *s == '%') // skip DTD entities break; const char *name_start = s; while (s < ends && !isspace((unsigned char) *s)) s++; String name(name_start, s - name_start), value; s = parse_attribute_value(&value, s, ends, entities, errh); entities.set(name, value); } else if (s + 8 < ends && memcmp(s, "![CDATA[", 8) == 0) { // skip CDATA section for (s += 8; s < ends; s++) if (*s == ']' && s + 3 <= ends && memcmp(s, "]]>", 3) == 0) break; } else if (s + 3 < ends && memcmp(s, "!--", 3) == 0) { // skip comment for (s += 3; s < ends; s++) if (*s == '-' && s + 3 <= ends && memcmp(s, "-->", 3) == 0) break; } // skip to '>' while (s < ends && *s != '>') s++; } } void ElementMap::parse(const String &str, const String &package_name, ErrorHandler *errh) { if (str.length() && str[0] == '<') { parse_xml(str, package_name, errh); return; } int def_index = 0; if (package_name != _def[0].package) { def_index = _def.size(); _def.push_back(Globals()); _def.back().package = package_name; } // set up default data Vector<int> data; for (int i = Traits::D_FIRST_DEFAULT; i <= Traits::D_LAST_DEFAULT; i++) data.push_back(i); // loop over the lines const char *begin = str.begin(); const char *end = str.end(); while (begin < end) { // read a line String line = str.substring(begin, find(begin, end, '\n')); begin = line.end() + 1; // break into words Vector<String> words; cp_spacevec(line, words); // skip blank lines & comments if (words.size() == 0 || words[0][0] == '#') continue; // check for $sourcedir if (words[0] == "$sourcedir") { if (words.size() == 2) { def_index = _def.size(); _def.push_back(Globals()); _def.back() = _def[def_index - 1]; _def.back().srcdir = cp_unquote(words[1]); } } else if (words[0] == "$webdoc") { if (words.size() == 2) { def_index = _def.size(); _def.push_back(Globals()); _def.back() = _def[def_index - 1]; _def.back().dochref = cp_unquote(words[1]); } } else if (words[0] == "$provides") { for (int i = 1; i < words.size(); i++) _e[0].provisions += " " + cp_unquote(words[i]); } else if (words[0] == "$data") { data.clear(); for (int i = 1; i < words.size(); i++) data.push_back(Traits::parse_component(cp_unquote(words[i]))); } else if (words[0][0] != '$') { // an actual line Traits elt; for (int i = 0; i < data.size() && i < words.size(); i++) if (String *sp = elt.component(data[i])) *sp = cp_unquote(words[i]); if (elt.provisions || elt.name) { elt.def_index = def_index; (void) add(elt); } } } } void ElementMap::parse(const String &str, ErrorHandler *errh) { parse(str, String(), errh); } String ElementMap::unparse(const String &package) const { StringAccum sa; sa << "<?xml version=\"1.0\" standalone=\"yes\"?>\n\ <elementmap xmlns=\"http://www.lcdf.org/click/xml/\""; if (package) sa << " package=\"" << xml_quote(package) << "\""; sa << ">\n"; for (int i = 1; i < _e.size(); i++) { const Traits &e = _e[i]; if (!e.name && !e.cxx) continue; sa << " <entry"; if (e.name) sa << " name=\"" << xml_quote(e.name) << "\""; if (e.cxx) sa << " cxxclass=\"" << xml_quote(e.cxx) << "\""; if (e.documentation_name) sa << " docname=\"" << xml_quote(e.documentation_name) << "\""; if (e.header_file) sa << " headerfile=\"" << xml_quote(e.header_file) << "\""; if (e.source_file) sa << " sourcefile=\"" << xml_quote(e.source_file) << "\""; sa << " processing=\"" << xml_quote(e.processing_code) << "\" flowcode=\"" << xml_quote(e.flow_code) << "\""; if (e.flags) sa << " flags=\"" << xml_quote(e.flags) << "\""; if (e.requirements) sa << " requires=\"" << xml_quote(e.requirements) << "\""; if (e.provisions) sa << " provides=\"" << xml_quote(e.provisions) << "\""; if (e.noexport) sa << " noexport=\"" << xml_quote(e.noexport) << "\""; sa << " />\n"; } sa << "</elementmap>\n"; return sa.take_string(); } String ElementMap::unparse_nonxml() const { StringAccum sa; sa << "$data\tname\tcxxclass\tdocname\theaderfile\tprocessing\tflowcode\tflags\trequires\tprovides\n"; for (int i = 1; i < _e.size(); i++) { const Traits &e = _e[i]; if (!e.name && !e.cxx) continue; sa << cp_quote(e.name) << '\t' << cp_quote(e.cxx) << '\t' << cp_quote(e.documentation_name) << '\t' << cp_quote(e.header_file) << '\t' << cp_quote(e.processing_code) << '\t' << cp_quote(e.flow_code) << '\t' << cp_quote(e.flags) << '\t' << cp_quote(e.requirements) << '\t' << cp_quote(e.provisions) << '\n'; } return sa.take_string(); } void ElementMap::collect_indexes(const RouterT *router, Vector<int> &indexes, ErrorHandler *errh) const { indexes.clear(); HashTable<ElementClassT *, int> types(-1); router->collect_types(types); for (HashTable<ElementClassT *, int>::iterator i = types.begin(); i.live(); i++) if (i.key()->primitive()) { int t = _name_map[i.key()->name()]; if (t > 0) indexes.push_back(t); else if (errh) errh->error("unknown element class %<%s%>", i.key()->printable_name_c_str()); } } int ElementMap::check_completeness(const RouterT *r, ErrorHandler *errh) const { LocalErrorHandler lerrh(errh); Vector<int> indexes; collect_indexes(r, indexes, &lerrh); return (lerrh.nerrors() ? -1 : 0); } bool ElementMap::driver_indifferent(const RouterT *r, int driver_mask, ErrorHandler *errh) const { Vector<int> indexes; collect_indexes(r, indexes, errh); for (int i = 0; i < indexes.size(); i++) { int idx = indexes[i]; if (idx > 0 && (_e[idx].driver_mask & driver_mask) != driver_mask) return false; } return true; } int ElementMap::compatible_driver_mask(const RouterT *r, ErrorHandler *errh) const { Vector<int> indexes; collect_indexes(r, indexes, errh); int mask = Driver::ALLMASK; for (int i = 0; i < indexes.size(); i++) { int idx = indexes[i]; int elt_mask = 0; while (idx > 0) { int idx_mask = _e[idx].driver_mask; if (idx_mask & (1 << Driver::MULTITHREAD)) for (int d = 0; d < Driver::COUNT; ++d) if ((idx_mask & (1 << d)) && !provides_global(Driver::multithread_name(d))) idx_mask &= ~(1 << d); elt_mask |= idx_mask; idx = _e[idx].name_next; } mask &= elt_mask; } return mask; } bool ElementMap::driver_compatible(const RouterT *r, int driver, ErrorHandler *errh) const { return compatible_driver_mask(r, errh) & (1 << driver); } void ElementMap::set_driver_mask(int driver_mask) { if (_driver_mask != driver_mask) incr_version(); _driver_mask = driver_mask; } int ElementMap::pick_driver(int wanted_driver, const RouterT* router, ErrorHandler* errh) const { LocalErrorHandler lerrh(errh); int driver_mask = compatible_driver_mask(router, &lerrh); if (driver_mask == 0) { lerrh.warning("configuration not compatible with any driver"); return Driver::USERLEVEL; } if ((driver_mask & _provided_driver_mask) == 0) { lerrh.warning("configuration not compatible with installed drivers"); driver_mask = _provided_driver_mask; } if (wanted_driver >= 0) { if (!(driver_mask & (1 << wanted_driver))) lerrh.warning("configuration not compatible with %s driver", Driver::name(wanted_driver)); return wanted_driver; } for (int d = Driver::COUNT - 1; d >= 0; d--) if (driver_mask & (1 << d)) wanted_driver = d; // don't complain if only a single driver works if ((driver_mask & (driver_mask - 1)) != 0 && !driver_indifferent(router, driver_mask, errh)) lerrh.warning("configuration not indifferent to driver, picking %s\n(You might want to specify a driver explicitly.)", Driver::name(wanted_driver)); return wanted_driver; } bool ElementMap::find_and_parse_package_file(const String& package_name, const RouterT* r, const String& default_path, ErrorHandler* errh, const String& filetype, bool verbose) { String mapname, mapname2; if (package_name && package_name != "<archive>") { mapname = "elementmap-" + package_name + ".xml"; mapname2 = "elementmap." + package_name; } else { mapname = "elementmap.xml"; mapname2 = "elementmap"; } // look for elementmap in archive if (r) { int aei = r->archive_index(mapname); if (aei < 0) aei = r->archive_index(mapname2); if (aei >= 0) { if (errh && verbose) errh->message("parsing %s %<%s%> from configuration archive", filetype.c_str(), r->archive(aei).name.c_str()); parse(r->archive(aei).data, package_name); return true; } } // look for elementmap in file system if (package_name != "<archive>") { String fn = clickpath_find_file(mapname, "share", default_path); if (!fn) fn = clickpath_find_file(mapname2, "share", default_path); if (fn) { if (errh && verbose) errh->message("parsing %s %<%s%>", filetype.c_str(), fn.c_str()); String text = file_string(fn, errh); parse(text, package_name); return true; } if (errh) errh->warning("%s missing", filetype.c_str()); } return false; } bool ElementMap::parse_default_file(const String &default_path, ErrorHandler *errh, bool verbose) { return find_and_parse_package_file("", 0, default_path, errh, "default elementmap", verbose); } bool ElementMap::parse_package_file(const String& package_name, const RouterT* r, const String& default_path, ErrorHandler* errh, bool verbose) { return find_and_parse_package_file(package_name, r, default_path, errh, errh->format("package %<%s%> elementmap", package_name.c_str()), verbose); } bool ElementMap::parse_requirement_files(RouterT *r, const String &default_path, ErrorHandler *errh, bool verbose) { String not_found; // try elementmap in archive find_and_parse_package_file("<archive>", r, "", errh, "archive elementmap", verbose); // parse elementmaps for requirements in required order const Vector<String> &requirements = r->requirements(); bool ok = true; for (int i = 0; i < requirements.size(); i += 2) { if (!requirements[i].equals("package", 7)) continue; if (!find_and_parse_package_file(requirements[i+1], r, default_path, errh, errh->format("package %<%s%> elementmap", requirements[i+1].c_str()), verbose)) ok = false; } return ok; } bool ElementMap::parse_all_files(RouterT *r, const String &default_path, ErrorHandler *errh) { bool found_default = parse_default_file(default_path, errh); bool found_other = parse_requirement_files(r, default_path, errh); if (found_default && found_other) return true; else { report_file_not_found(default_path, found_default, errh); return false; } } void ElementMap::report_file_not_found(String default_path, bool found_default, ErrorHandler *errh) { if (!found_default) errh->message("(The %<elementmap.xml%> file stores information about available elements,\nand is required for correct operation. %<make install%> should install it."); else errh->message("(You may get unknown element class errors."); const char *path = clickpath(); bool allows_default = path_allows_default_path(path); if (!allows_default) errh->message("Searched in CLICKPATH %<%s%>.)", path); else if (!path) errh->message("Searched in install directory %<%s%>.)", default_path.c_str()); else errh->message("Searched in CLICKPATH and %<%s%>.)", default_path.c_str()); } // TraitsIterator ElementMap::TraitsIterator::TraitsIterator(const ElementMap *emap, bool elements_only) : _emap(emap), _index(0), _elements_only(elements_only) { (*this)++; } void ElementMap::TraitsIterator::operator++(int) { _index++; while (_index < _emap->size()) { const ElementTraits &t = _emap->traits_at(_index); if ((t.driver_mask & _emap->driver_mask()) && (t.name || t.cxx) && (t.name || !_elements_only)) break; _index++; } }
NetSys/click
tools/lib/elementmap.cc
C++
gpl-2.0
21,491
/* * Copyright (C) 2005-2009 Team XBMC * http://www.xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, 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 XBMC; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ #include "DBusUtil.h" #ifdef HAS_DBUS #include "utils/log.h" CVariant CDBusUtil::GetVariant(const char *destination, const char *object, const char *interface, const char *property) { //dbus-send --system --print-reply --dest=destination object org.freedesktop.DBus.Properties.Get string:interface string:property CDBusMessage message(destination, object, "org.freedesktop.DBus.Properties", "Get"); CVariant result; if (message.AppendArgument(interface) && message.AppendArgument(property)) { DBusMessage *reply = message.SendSystem(); if (reply) { DBusMessageIter iter; if (dbus_message_iter_init(reply, &iter)) { if (!dbus_message_has_signature(reply, "v")) CLog::Log(LOGERROR, "DBus: wrong signature on Get - should be \"v\" but was %s", dbus_message_iter_get_signature(&iter)); else result = ParseVariant(&iter); } } } else CLog::Log(LOGERROR, "DBus: append arguments failed"); return result; } CVariant CDBusUtil::GetAll(const char *destination, const char *object, const char *interface) { CDBusMessage message(destination, object, "org.freedesktop.DBus.Properties", "GetAll"); CVariant properties; message.AppendArgument(interface); DBusMessage *reply = message.SendSystem(); if (reply) { DBusMessageIter iter; if (dbus_message_iter_init(reply, &iter)) { if (!dbus_message_has_signature(reply, "a{sv}")) CLog::Log(LOGERROR, "DBus: wrong signature on GetAll - should be \"a{sv}\" but was %s", dbus_message_iter_get_signature(&iter)); else { do { DBusMessageIter sub; dbus_message_iter_recurse(&iter, &sub); do { DBusMessageIter dict; dbus_message_iter_recurse(&sub, &dict); do { const char * key = NULL; dbus_message_iter_get_basic(&dict, &key); dbus_message_iter_next(&dict); CVariant value = ParseVariant(&dict); if (!value.isNull()) properties[key] = value; } while (dbus_message_iter_next(&dict)); } while (dbus_message_iter_next(&sub)); } while (dbus_message_iter_next(&iter)); } } } return properties; } CVariant CDBusUtil::ParseVariant(DBusMessageIter *itr) { DBusMessageIter variant; dbus_message_iter_recurse(itr, &variant); return ParseType(&variant); } CVariant CDBusUtil::ParseType(DBusMessageIter *itr) { CVariant value; const char * string = NULL; dbus_int32_t int32 = 0; dbus_uint32_t uint32 = 0; dbus_int64_t int64 = 0; dbus_uint64_t uint64 = 0; dbus_bool_t boolean = false; double doublev = 0; int type = dbus_message_iter_get_arg_type(itr); switch (type) { case DBUS_TYPE_OBJECT_PATH: case DBUS_TYPE_STRING: dbus_message_iter_get_basic(itr, &string); value = string; break; case DBUS_TYPE_UINT32: dbus_message_iter_get_basic(itr, &uint32); value = (uint64_t)uint32; break; case DBUS_TYPE_BYTE: case DBUS_TYPE_INT32: dbus_message_iter_get_basic(itr, &int32); value = (int64_t)int32; break; case DBUS_TYPE_UINT64: dbus_message_iter_get_basic(itr, &uint64); value = (uint64_t)uint64; break; case DBUS_TYPE_INT64: dbus_message_iter_get_basic(itr, &int64); value = (int64_t)int64; break; case DBUS_TYPE_BOOLEAN: dbus_message_iter_get_basic(itr, &boolean); value = (bool)boolean; break; case DBUS_TYPE_DOUBLE: dbus_message_iter_get_basic(itr, &doublev); value = (double)doublev; break; case DBUS_TYPE_ARRAY: DBusMessageIter array; dbus_message_iter_recurse(itr, &array); value = CVariant::VariantTypeArray; do { CVariant item = ParseType(&array); if (!item.isNull()) value.push_back(item); } while (dbus_message_iter_next(&array)); break; } return value; } #endif
j2carv/xbmc-1
xbmc/linux/DBusUtil.cpp
C++
gpl-2.0
4,822